summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libstdc++-v3/ChangeLog5936
-rw-r--r--libstdc++-v3/Makefile.am147
-rw-r--r--libstdc++-v3/Makefile.in509
-rw-r--r--libstdc++-v3/README94
-rw-r--r--libstdc++-v3/acconfig.h199
-rw-r--r--libstdc++-v3/acinclude.m4881
-rw-r--r--libstdc++-v3/aclocal.m41503
-rw-r--r--libstdc++-v3/backward/algo.h114
-rw-r--r--libstdc++-v3/backward/algobase.h71
-rw-r--r--libstdc++-v3/backward/alloc.h46
-rw-r--r--libstdc++-v3/backward/bvector.h51
-rw-r--r--libstdc++-v3/backward/defalloc.h87
-rw-r--r--libstdc++-v3/backward/deque.h42
-rw-r--r--libstdc++-v3/backward/function.h118
-rw-r--r--libstdc++-v3/backward/hash_map.h49
-rw-r--r--libstdc++-v3/backward/hash_set.h44
-rw-r--r--libstdc++-v3/backward/hashtable.h48
-rw-r--r--libstdc++-v3/backward/heap.h46
-rw-r--r--libstdc++-v3/backward/iostream.h55
-rw-r--r--libstdc++-v3/backward/iterator.h104
-rw-r--r--libstdc++-v3/backward/list.h42
-rw-r--r--libstdc++-v3/backward/map.h41
-rw-r--r--libstdc++-v3/backward/multimap.h41
-rw-r--r--libstdc++-v3/backward/multiset.h41
-rw-r--r--libstdc++-v3/backward/new.h46
-rw-r--r--libstdc++-v3/backward/pair.h51
-rw-r--r--libstdc++-v3/backward/rope.h34
-rw-r--r--libstdc++-v3/backward/set.h41
-rw-r--r--libstdc++-v3/backward/slist.h28
-rw-r--r--libstdc++-v3/backward/stack.h46
-rw-r--r--libstdc++-v3/backward/tempbuf.h62
-rw-r--r--libstdc++-v3/backward/tree.h46
-rw-r--r--libstdc++-v3/backward/vector.h42
-rw-r--r--libstdc++-v3/bits/basic_file.h174
-rw-r--r--libstdc++-v3/bits/basic_ios.h216
-rw-r--r--libstdc++-v3/bits/basic_ios.tcc142
-rw-r--r--libstdc++-v3/bits/basic_string.h1039
-rw-r--r--libstdc++-v3/bits/c++config.h66
-rw-r--r--libstdc++-v3/bits/char_traits.h327
-rw-r--r--libstdc++-v3/bits/cpp_type_traits.h301
-rw-r--r--libstdc++-v3/bits/exception_support.h79
-rw-r--r--libstdc++-v3/bits/fpos.h121
-rw-r--r--libstdc++-v3/bits/fstream.tcc568
-rw-r--r--libstdc++-v3/bits/generic_shadow.h57
-rw-r--r--libstdc++-v3/bits/gslice.h117
-rw-r--r--libstdc++-v3/bits/gslice_array.h169
-rw-r--r--libstdc++-v3/bits/indirect_array.h160
-rw-r--r--libstdc++-v3/bits/ios_base.h576
-rw-r--r--libstdc++-v3/bits/istream.tcc1216
-rw-r--r--libstdc++-v3/bits/limits_generic.h786
-rw-r--r--libstdc++-v3/bits/locale_facets.h1935
-rw-r--r--libstdc++-v3/bits/locale_facets.tcc1440
-rw-r--r--libstdc++-v3/bits/localefwd.h497
-rw-r--r--libstdc++-v3/bits/mask_array.h160
-rw-r--r--libstdc++-v3/bits/ostream.tcc673
-rw-r--r--libstdc++-v3/bits/pthread_allocimpl.h495
-rw-r--r--libstdc++-v3/bits/sbuf_iter.h264
-rw-r--r--libstdc++-v3/bits/slice.h77
-rw-r--r--libstdc++-v3/bits/slice_array.h161
-rw-r--r--libstdc++-v3/bits/sstream.tcc221
-rw-r--r--libstdc++-v3/bits/std_algorithm.h40
-rw-r--r--libstdc++-v3/bits/std_bitset.h1216
-rw-r--r--libstdc++-v3/bits/std_cassert.h38
-rw-r--r--libstdc++-v3/bits/std_cctype.h210
-rw-r--r--libstdc++-v3/bits/std_cerrno.h39
-rw-r--r--libstdc++-v3/bits/std_cfloat.h46
-rw-r--r--libstdc++-v3/bits/std_ciso646.h71
-rw-r--r--libstdc++-v3/bits/std_climits.h39
-rw-r--r--libstdc++-v3/bits/std_clocale.h40
-rw-r--r--libstdc++-v3/bits/std_cmath.h247
-rw-r--r--libstdc++-v3/bits/std_complex.h966
-rw-r--r--libstdc++-v3/bits/std_csetjmp.h39
-rw-r--r--libstdc++-v3/bits/std_csignal.h39
-rw-r--r--libstdc++-v3/bits/std_cstdarg.h39
-rw-r--r--libstdc++-v3/bits/std_cstddef.h39
-rw-r--r--libstdc++-v3/bits/std_cstdio.h60
-rw-r--r--libstdc++-v3/bits/std_cstdlib.h53
-rw-r--r--libstdc++-v3/bits/std_cstring.h43
-rw-r--r--libstdc++-v3/bits/std_ctime.h39
-rw-r--r--libstdc++-v3/bits/std_cwchar.h108
-rw-r--r--libstdc++-v3/bits/std_cwctype.h164
-rw-r--r--libstdc++-v3/bits/std_deque.h41
-rw-r--r--libstdc++-v3/bits/std_exception.h80
-rw-r--r--libstdc++-v3/bits/std_fstream.h386
-rw-r--r--libstdc++-v3/bits/std_functional.h27
-rw-r--r--libstdc++-v3/bits/std_iomanip.h219
-rw-r--r--libstdc++-v3/bits/std_ios.h52
-rw-r--r--libstdc++-v3/bits/std_iosfwd.h157
-rw-r--r--libstdc++-v3/bits/std_iostream.h58
-rw-r--r--libstdc++-v3/bits/std_istream.h307
-rw-r--r--libstdc++-v3/bits/std_iterator.h46
-rw-r--r--libstdc++-v3/bits/std_list.h40
-rw-r--r--libstdc++-v3/bits/std_locale.h44
-rw-r--r--libstdc++-v3/bits/std_map.h40
-rw-r--r--libstdc++-v3/bits/std_memory.h124
-rw-r--r--libstdc++-v3/bits/std_new.h81
-rw-r--r--libstdc++-v3/bits/std_numeric.h41
-rw-r--r--libstdc++-v3/bits/std_ostream.h288
-rw-r--r--libstdc++-v3/bits/std_queue.h45
-rw-r--r--libstdc++-v3/bits/std_set.h40
-rw-r--r--libstdc++-v3/bits/std_sstream.h367
-rw-r--r--libstdc++-v3/bits/std_stack.h41
-rw-r--r--libstdc++-v3/bits/std_stdexcept.h90
-rw-r--r--libstdc++-v3/bits/std_streambuf.h460
-rw-r--r--libstdc++-v3/bits/std_string.h63
-rw-r--r--libstdc++-v3/bits/std_strstream.h159
-rw-r--r--libstdc++-v3/bits/std_typeinfo.h80
-rw-r--r--libstdc++-v3/bits/std_utility.h38
-rw-r--r--libstdc++-v3/bits/std_valarray.h748
-rw-r--r--libstdc++-v3/bits/std_vector.h42
-rw-r--r--libstdc++-v3/bits/stl_algo.h2900
-rw-r--r--libstdc++-v3/bits/stl_algobase.h652
-rw-r--r--libstdc++-v3/bits/stl_alloc.h905
-rw-r--r--libstdc++-v3/bits/stl_config.h490
-rw-r--r--libstdc++-v3/bits/stl_construct.h90
-rw-r--r--libstdc++-v3/bits/stl_deque.h1768
-rw-r--r--libstdc++-v3/bits/stl_function.h732
-rw-r--r--libstdc++-v3/bits/stl_heap.h281
-rw-r--r--libstdc++-v3/bits/stl_iterator.h1093
-rw-r--r--libstdc++-v3/bits/stl_iterator_base.h358
-rw-r--r--libstdc++-v3/bits/stl_list.h867
-rw-r--r--libstdc++-v3/bits/stl_map.h273
-rw-r--r--libstdc++-v3/bits/stl_multimap.h275
-rw-r--r--libstdc++-v3/bits/stl_multiset.h266
-rw-r--r--libstdc++-v3/bits/stl_numeric.h239
-rw-r--r--libstdc++-v3/bits/stl_pair.h101
-rw-r--r--libstdc++-v3/bits/stl_pthread_alloc.h31
-rw-r--r--libstdc++-v3/bits/stl_queue.h221
-rw-r--r--libstdc++-v3/bits/stl_range_errors.h74
-rw-r--r--libstdc++-v3/bits/stl_raw_storage_iter.h81
-rw-r--r--libstdc++-v3/bits/stl_relops.h62
-rw-r--r--libstdc++-v3/bits/stl_set.h259
-rw-r--r--libstdc++-v3/bits/stl_stack.h133
-rw-r--r--libstdc++-v3/bits/stl_string_fwd.h47
-rw-r--r--libstdc++-v3/bits/stl_tempbuf.h161
-rw-r--r--libstdc++-v3/bits/stl_threads.h369
-rw-r--r--libstdc++-v3/bits/stl_tree.h1368
-rw-r--r--libstdc++-v3/bits/stl_uninitialized.h281
-rw-r--r--libstdc++-v3/bits/stl_vector.h873
-rw-r--r--libstdc++-v3/bits/streambuf.tcc259
-rw-r--r--libstdc++-v3/bits/string.tcc858
-rw-r--r--libstdc++-v3/bits/type_traits.h387
-rw-r--r--libstdc++-v3/bits/valarray_array.h535
-rw-r--r--libstdc++-v3/bits/valarray_array.tcc161
-rw-r--r--libstdc++-v3/bits/valarray_meta.h1057
-rw-r--r--libstdc++-v3/config.h.in569
-rw-r--r--libstdc++-v3/config/aix/bits/ctype_base.h62
-rw-r--r--libstdc++-v3/config/aix/bits/ctype_specializations.h76
-rw-r--r--libstdc++-v3/config/aix/ctype.cc110
-rw-r--r--libstdc++-v3/config/c_io_libio.cc268
-rw-r--r--libstdc++-v3/config/c_io_libio.h108
-rw-r--r--libstdc++-v3/config/cpu/alpha/atomicity.h113
-rw-r--r--libstdc++-v3/config/cpu/arm/atomicity.h109
-rw-r--r--libstdc++-v3/config/cpu/generic/atomicity.h58
-rw-r--r--libstdc++-v3/config/cpu/i386/atomicity.h62
-rw-r--r--libstdc++-v3/config/cpu/powerpc/atomicity.h110
-rw-r--r--libstdc++-v3/config/cpu/sparc/sparc32/atomicity.h104
-rw-r--r--libstdc++-v3/config/cpu/sparc/sparc64/atomicity.h88
-rw-r--r--libstdc++-v3/config/generic/bits/ctype_base.h59
-rw-r--r--libstdc++-v3/config/generic/bits/ctype_specializations.h73
-rw-r--r--libstdc++-v3/config/generic/ctype.cc106
-rw-r--r--libstdc++-v3/config/gnu-linux/bits/ctype_base.h60
-rw-r--r--libstdc++-v3/config/gnu-linux/bits/ctype_specializations.h73
-rw-r--r--libstdc++-v3/config/gnu-linux/ctype.cc112
-rw-r--r--libstdc++-v3/config/irix/bits/ctype_base.h60
-rw-r--r--libstdc++-v3/config/irix/bits/ctype_specializations.h73
-rw-r--r--libstdc++-v3/config/irix/ctype.cc45
-rw-r--r--libstdc++-v3/config/newlib/bits/ctype_base.h61
-rw-r--r--libstdc++-v3/config/newlib/bits/ctype_specializations.h73
-rw-r--r--libstdc++-v3/config/newlib/ctype.cc120
-rw-r--r--libstdc++-v3/config/solaris/solaris2.5/bits/ctype_base.h56
-rw-r--r--libstdc++-v3/config/solaris/solaris2.5/bits/ctype_specializations.h73
-rw-r--r--libstdc++-v3/config/solaris/solaris2.5/ctype.cc118
-rw-r--r--libstdc++-v3/config/solaris/solaris2.6/bits/ctype_base.h58
-rw-r--r--libstdc++-v3/config/solaris/solaris2.6/bits/ctype_specializations.h73
-rw-r--r--libstdc++-v3/config/solaris/solaris2.6/ctype.cc107
-rw-r--r--libstdc++-v3/config/solaris/solaris2.7/bits/ctype_base.h58
-rw-r--r--libstdc++-v3/config/solaris/solaris2.7/bits/ctype_specializations.h73
-rw-r--r--libstdc++-v3/config/solaris/solaris2.7/ctype.cc110
-rw-r--r--libstdc++-v3/config/threads-no.h78
-rw-r--r--libstdc++-v3/config/threads-posix.h91
-rwxr-xr-xlibstdc++-v3/configure4470
-rw-r--r--libstdc++-v3/configure.host43
-rw-r--r--libstdc++-v3/configure.in197
-rw-r--r--libstdc++-v3/docs/17_intro/BADNAMES162
-rw-r--r--libstdc++-v3/docs/17_intro/BUGS31
-rw-r--r--libstdc++-v3/docs/17_intro/C++STYLE310
-rw-r--r--libstdc++-v3/docs/17_intro/CHECKLIST6014
-rw-r--r--libstdc++-v3/docs/17_intro/COPYING340
-rw-r--r--libstdc++-v3/docs/17_intro/DESIGN859
-rw-r--r--libstdc++-v3/docs/17_intro/HEADER_POLICY164
-rw-r--r--libstdc++-v3/docs/17_intro/PROBLEMS8
-rw-r--r--libstdc++-v3/docs/17_intro/RELEASE-NOTES99
-rw-r--r--libstdc++-v3/docs/17_intro/TODO177
-rw-r--r--libstdc++-v3/docs/17_intro/contribute.html76
-rw-r--r--libstdc++-v3/docs/17_intro/howto.html156
-rw-r--r--libstdc++-v3/docs/17_intro/libstdc++-assign.txt122
-rw-r--r--libstdc++-v3/docs/17_intro/organization84
-rw-r--r--libstdc++-v3/docs/18_support/howto.html217
-rw-r--r--libstdc++-v3/docs/19_diagnostics/howto.html83
-rw-r--r--libstdc++-v3/docs/20_util/howto.html194
-rw-r--r--libstdc++-v3/docs/21_strings/gotw29a.txt155
-rw-r--r--libstdc++-v3/docs/21_strings/howto.html292
-rw-r--r--libstdc++-v3/docs/21_strings/stringtok_h.txt102
-rw-r--r--libstdc++-v3/docs/21_strings/stringtok_std_h.txt39
-rw-r--r--libstdc++-v3/docs/22_locale/howto.html71
-rw-r--r--libstdc++-v3/docs/23_containers/howto.html246
-rw-r--r--libstdc++-v3/docs/23_containers/wrappers_h.txt48
-rw-r--r--libstdc++-v3/docs/24_iterators/howto.html95
-rw-r--r--libstdc++-v3/docs/25_algorithms/howto.html65
-rw-r--r--libstdc++-v3/docs/26_numerics/howto.html65
-rw-r--r--libstdc++-v3/docs/27_io/howto.html346
-rw-r--r--libstdc++-v3/docs/27_io/iostreams_hierarchy.pdf1
-rw-r--r--libstdc++-v3/docs/configopts.html164
-rw-r--r--libstdc++-v3/docs/documentation.html63
-rw-r--r--libstdc++-v3/docs/download.html39
-rw-r--r--libstdc++-v3/docs/faq/index.html672
-rw-r--r--libstdc++-v3/docs/faq/index.txt611
-rw-r--r--libstdc++-v3/docs/footer.html18
-rw-r--r--libstdc++-v3/docs/gccrebuild.html120
-rw-r--r--libstdc++-v3/docs/header.html69
-rw-r--r--libstdc++-v3/docs/index.html61
-rw-r--r--libstdc++-v3/docs/install.html378
-rw-r--r--libstdc++-v3/docs/lib3styles.css6
-rw-r--r--libstdc++-v3/docs/links.html38
-rw-r--r--libstdc++-v3/docs/mail.html67
-rw-r--r--libstdc++-v3/docs/status.html147
-rw-r--r--libstdc++-v3/docs/thanks.html100
-rw-r--r--libstdc++-v3/ext/bvector52
-rw-r--r--libstdc++-v3/ext/hash_map518
-rw-r--r--libstdc++-v3/ext/hash_set502
-rw-r--r--libstdc++-v3/ext/rope32
-rw-r--r--libstdc++-v3/ext/ropeimpl.h1586
-rw-r--r--libstdc++-v3/ext/slist1023
-rw-r--r--libstdc++-v3/ext/stl_bvector.h892
-rw-r--r--libstdc++-v3/ext/stl_hash_fun.h93
-rw-r--r--libstdc++-v3/ext/stl_hashtable.h1054
-rw-r--r--libstdc++-v3/ext/stl_rope.h2710
-rw-r--r--libstdc++-v3/ext/tree23
-rwxr-xr-xlibstdc++-v3/inclosure100
-rw-r--r--libstdc++-v3/libio/ChangeLog2669
-rw-r--r--libstdc++-v3/libio/Makefile.am62
-rw-r--r--libstdc++-v3/libio/Makefile.in349
-rw-r--r--libstdc++-v3/libio/cleanup.c17
-rw-r--r--libstdc++-v3/libio/filedoalloc.c120
-rw-r--r--libstdc++-v3/libio/fileops.c811
-rwxr-xr-xlibstdc++-v3/libio/gen-params751
-rw-r--r--libstdc++-v3/libio/genops.c946
-rw-r--r--libstdc++-v3/libio/iolibio.h63
-rw-r--r--libstdc++-v3/libio/libio.h365
-rw-r--r--libstdc++-v3/libio/libioP.h648
-rw-r--r--libstdc++-v3/libio/stdfiles.c51
-rw-r--r--libstdc++-v3/m4/lc_messages.m419
-rw-r--r--libstdc++-v3/m4/mathfcts.m415
-rw-r--r--libstdc++-v3/m4/stringfcts.m415
-rw-r--r--libstdc++-v3/math/Makefile.am56
-rw-r--r--libstdc++-v3/math/Makefile.in348
-rw-r--r--libstdc++-v3/math/atan2f.c39
-rw-r--r--libstdc++-v3/math/c_log.c63
-rw-r--r--libstdc++-v3/math/c_logf.c64
-rw-r--r--libstdc++-v3/math/c_logl.c69
-rw-r--r--libstdc++-v3/math/cabs.c38
-rw-r--r--libstdc++-v3/math/cabsf.c38
-rw-r--r--libstdc++-v3/math/cabsl.c42
-rw-r--r--libstdc++-v3/math/carg.c37
-rw-r--r--libstdc++-v3/math/cargf.c38
-rw-r--r--libstdc++-v3/math/cargl.c38
-rw-r--r--libstdc++-v3/math/ccos.c68
-rw-r--r--libstdc++-v3/math/ccosf.c68
-rw-r--r--libstdc++-v3/math/ccosh.c93
-rw-r--r--libstdc++-v3/math/ccoshf.c92
-rw-r--r--libstdc++-v3/math/ccoshl.c92
-rw-r--r--libstdc++-v3/math/ccosl.c69
-rw-r--r--libstdc++-v3/math/cexp.c111
-rw-r--r--libstdc++-v3/math/cexpf.c110
-rw-r--r--libstdc++-v3/math/cexpl.c110
-rw-r--r--libstdc++-v3/math/clog10.c65
-rw-r--r--libstdc++-v3/math/clog10f.c64
-rw-r--r--libstdc++-v3/math/clog10l.c68
-rw-r--r--libstdc++-v3/math/complex-stub.h88
-rw-r--r--libstdc++-v3/math/copysignf.c39
-rw-r--r--libstdc++-v3/math/cpow.c39
-rw-r--r--libstdc++-v3/math/cpowf.c38
-rw-r--r--libstdc++-v3/math/cpowl.c40
-rw-r--r--libstdc++-v3/math/csin.c115
-rw-r--r--libstdc++-v3/math/csinf.c115
-rw-r--r--libstdc++-v3/math/csinh.c110
-rw-r--r--libstdc++-v3/math/csinhf.c89
-rw-r--r--libstdc++-v3/math/csinhl.c110
-rw-r--r--libstdc++-v3/math/csinl.c115
-rw-r--r--libstdc++-v3/math/csqrt.c110
-rw-r--r--libstdc++-v3/math/csqrtf.c110
-rw-r--r--libstdc++-v3/math/csqrtl.c114
-rw-r--r--libstdc++-v3/math/ctan.c70
-rw-r--r--libstdc++-v3/math/ctanf.c70
-rw-r--r--libstdc++-v3/math/ctanh.c70
-rw-r--r--libstdc++-v3/math/ctanhf.c70
-rw-r--r--libstdc++-v3/math/ctanhl.c70
-rw-r--r--libstdc++-v3/math/ctanl.c69
-rw-r--r--libstdc++-v3/math/expf.c39
-rw-r--r--libstdc++-v3/math/hypot.c38
-rw-r--r--libstdc++-v3/math/hypotf.c48
-rw-r--r--libstdc++-v3/math/hypotl.c37
-rw-r--r--libstdc++-v3/math/mathconf.h381
-rw-r--r--libstdc++-v3/math/nan.c36
-rw-r--r--libstdc++-v3/math/signbit.c41
-rw-r--r--libstdc++-v3/math/signbitf.c41
-rw-r--r--libstdc++-v3/math/signbitl.c40
-rwxr-xr-xlibstdc++-v3/mkc++config58
-rwxr-xr-xlibstdc++-v3/mkcheck.in302
-rwxr-xr-xlibstdc++-v3/mkcshadow83
-rwxr-xr-xlibstdc++-v3/mknumeric_limits268
-rw-r--r--libstdc++-v3/shadow/assert.h35
-rw-r--r--libstdc++-v3/shadow/ctype.h55
-rw-r--r--libstdc++-v3/shadow/errno.h37
-rw-r--r--libstdc++-v3/shadow/float.h38
-rw-r--r--libstdc++-v3/shadow/libio.h44
-rw-r--r--libstdc++-v3/shadow/limits.h38
-rw-r--r--libstdc++-v3/shadow/locale.h45
-rw-r--r--libstdc++-v3/shadow/math.h63
-rw-r--r--libstdc++-v3/shadow/setjmp.h44
-rw-r--r--libstdc++-v3/shadow/signal.h45
-rw-r--r--libstdc++-v3/shadow/stdarg.h42
-rw-r--r--libstdc++-v3/shadow/stddef.h51
-rw-r--r--libstdc++-v3/shadow/stdio.h84
-rw-r--r--libstdc++-v3/shadow/stdlib.h72
-rw-r--r--libstdc++-v3/shadow/string.h63
-rw-r--r--libstdc++-v3/shadow/time.h60
-rw-r--r--libstdc++-v3/shadow/unistd.h44
-rw-r--r--libstdc++-v3/shadow/wchar.h109
-rw-r--r--libstdc++-v3/shadow/wctype.h59
-rw-r--r--libstdc++-v3/src/Makefile.am515
-rw-r--r--libstdc++-v3/src/Makefile.in858
-rw-r--r--libstdc++-v3/src/bitset.cc107
-rw-r--r--libstdc++-v3/src/cmath.cc85
-rw-r--r--libstdc++-v3/src/complex.cc274
-rw-r--r--libstdc++-v3/src/complex_io.cc160
-rw-r--r--libstdc++-v3/src/complexf.cc5
-rw-r--r--libstdc++-v3/src/complexl.cc8
-rw-r--r--libstdc++-v3/src/gen-num-limits.cc707
-rw-r--r--libstdc++-v3/src/ios.cc321
-rw-r--r--libstdc++-v3/src/limits_generic.cc340
-rw-r--r--libstdc++-v3/src/locale-inst.cc311
-rw-r--r--libstdc++-v3/src/locale.cc820
-rw-r--r--libstdc++-v3/src/localename.cc250
-rw-r--r--libstdc++-v3/src/misc-inst.cc210
-rw-r--r--libstdc++-v3/src/stdexcept.cc74
-rw-r--r--libstdc++-v3/src/stdstreams.cc48
-rw-r--r--libstdc++-v3/src/stl-inst.cc52
-rw-r--r--libstdc++-v3/src/string-inst.cc406
-rw-r--r--libstdc++-v3/src/strstream.cc427
-rw-r--r--libstdc++-v3/src/valarray-inst.cc64
-rw-r--r--libstdc++-v3/std/algorithm3
-rw-r--r--libstdc++-v3/std/bitset3
-rw-r--r--libstdc++-v3/std/cassert3
-rw-r--r--libstdc++-v3/std/cctype3
-rw-r--r--libstdc++-v3/std/cerrno3
-rw-r--r--libstdc++-v3/std/cfloat3
-rw-r--r--libstdc++-v3/std/ciso6463
-rw-r--r--libstdc++-v3/std/climits3
-rw-r--r--libstdc++-v3/std/clocale3
-rw-r--r--libstdc++-v3/std/cmath3
-rw-r--r--libstdc++-v3/std/complex3
-rw-r--r--libstdc++-v3/std/csetjmp4
-rw-r--r--libstdc++-v3/std/csignal4
-rw-r--r--libstdc++-v3/std/cstdarg4
-rw-r--r--libstdc++-v3/std/cstddef3
-rw-r--r--libstdc++-v3/std/cstdio3
-rw-r--r--libstdc++-v3/std/cstdlib3
-rw-r--r--libstdc++-v3/std/cstring3
-rw-r--r--libstdc++-v3/std/ctime3
-rw-r--r--libstdc++-v3/std/cwchar3
-rw-r--r--libstdc++-v3/std/cwctype3
-rw-r--r--libstdc++-v3/std/deque3
-rw-r--r--libstdc++-v3/std/exception3
-rw-r--r--libstdc++-v3/std/fstream3
-rw-r--r--libstdc++-v3/std/functional3
-rw-r--r--libstdc++-v3/std/iomanip3
-rw-r--r--libstdc++-v3/std/ios3
-rw-r--r--libstdc++-v3/std/iosfwd3
-rw-r--r--libstdc++-v3/std/iostream5
-rw-r--r--libstdc++-v3/std/istream3
-rw-r--r--libstdc++-v3/std/iterator3
-rw-r--r--libstdc++-v3/std/limits3
-rw-r--r--libstdc++-v3/std/list3
-rw-r--r--libstdc++-v3/std/locale3
-rw-r--r--libstdc++-v3/std/map3
-rw-r--r--libstdc++-v3/std/memory3
-rw-r--r--libstdc++-v3/std/new3
-rw-r--r--libstdc++-v3/std/numeric3
-rw-r--r--libstdc++-v3/std/ostream3
-rw-r--r--libstdc++-v3/std/queue3
-rw-r--r--libstdc++-v3/std/set3
-rw-r--r--libstdc++-v3/std/sstream3
-rw-r--r--libstdc++-v3/std/stack3
-rw-r--r--libstdc++-v3/std/stdexcept3
-rw-r--r--libstdc++-v3/std/streambuf3
-rw-r--r--libstdc++-v3/std/string3
-rw-r--r--libstdc++-v3/std/strstream3
-rw-r--r--libstdc++-v3/std/typeinfo3
-rw-r--r--libstdc++-v3/std/utility3
-rw-r--r--libstdc++-v3/std/valarray3
-rw-r--r--libstdc++-v3/std/vector3
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_ciso646.cc131
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_fstream.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_iomanip.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_ios.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_iosfwd.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_iostream.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_istream.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_ostream.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_sstream.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_streambuf.cc36
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers.cc83
-rw-r--r--libstdc++-v3/testsuite/18_support/numeric_limits.cc95
-rw-r--r--libstdc++-v3/testsuite/21_strings/append.cc170
-rw-r--r--libstdc++-v3/testsuite/21_strings/capacity.cc181
-rw-r--r--libstdc++-v3/testsuite/21_strings/char_traits.cc122
-rw-r--r--libstdc++-v3/testsuite/21_strings/compare.cc132
-rw-r--r--libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc189
-rw-r--r--libstdc++-v3/testsuite/21_strings/element_access.cc102
-rw-r--r--libstdc++-v3/testsuite/21_strings/find.cc202
-rw-r--r--libstdc++-v3/testsuite/21_strings/insert.cc200
-rw-r--r--libstdc++-v3/testsuite/21_strings/inserters_extractors.cc315
-rw-r--r--libstdc++-v3/testsuite/21_strings/invariants.cc181
-rw-r--r--libstdc++-v3/testsuite/21_strings/nonmember.cc306
-rw-r--r--libstdc++-v3/testsuite/21_strings/operations.cc58
-rw-r--r--libstdc++-v3/testsuite/21_strings/replace.cc96
-rw-r--r--libstdc++-v3/testsuite/21_strings/substr.cc86
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype.cc34
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype_char_members.cc105
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset_ctor.cc90
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset_shift.cc116
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset.cc73
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector_capacity.cc69
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector_ctor.cc64
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector_modifiers.cc71
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istreambuf_iterator.cc127
-rw-r--r--libstdc++-v3/testsuite/24_iterators/iterator.cc599
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/min_max.cc51
-rw-r--r--libstdc++-v3/testsuite/26_numerics/binary_closure.cc36
-rw-r--r--libstdc++-v3/testsuite/26_numerics/buggy_complex.cc37
-rw-r--r--libstdc++-v3/testsuite/26_numerics/c_math.cc61
-rw-r--r--libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc95
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray.cc8
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf-1.tst158
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf-1.txt158
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf-2.tst1
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf-3.tst7
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf.cc528
-rw-r--r--libstdc++-v3/testsuite/27_io/fpos.cc178
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc74
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base_members_static.cc66
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_ctor.cc94
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc114
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc123
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_members.cc152
-rw-r--r--libstdc++-v3/testsuite/27_io/iostream_objects.cc117
-rw-r--r--libstdc++-v3/testsuite/27_io/istream.cc64
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc387
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_char.cc232
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_other-1.tst65
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_other-1.txt65
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_other-2.tst65
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_other.cc197
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_manip.cc93
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_sentry.cc86
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_unformatted-1.tst7
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_unformatted-1.txt7
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_unformatted-2.tst0
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_unformatted.cc582
-rw-r--r--libstdc++-v3/testsuite/27_io/istringstream_members.cc86
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream.cc52
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc303
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.tst1000
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc271
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_other-1.tst158
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_other-2.tst158
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc100
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_manip.cc92
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_unformatted.cc55
-rw-r--r--libstdc++-v3/testsuite/27_io/streambuf.cc257
-rw-r--r--libstdc++-v3/testsuite/27_io/stringbuf.cc452
-rw-r--r--libstdc++-v3/testsuite/27_io/stringstream.cc174
-rw-r--r--libstdc++-v3/testsuite/ext/headers.cc33
-rw-r--r--libstdc++-v3/testsuite/printnow.c13
486 files changed, 109649 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
new file mode 100644
index 000000000000..104f41261fd7
--- /dev/null
+++ b/libstdc++-v3/ChangeLog
@@ -0,0 +1,5936 @@
+2000-04-20 Benjamin Kosnik <bkoz@redhat.com>
+
+ * bits/std_sstream.h: Tweak formatting.
+ * bits/std_fstream.h: Make types public.
+
+ * testsuite/27_io/streambuf.cc: Fix for alpha.
+
+ Brad Garcia <bgarcia@laurelnetworks.com>
+ * bits/locale_facets.h (numpunct::numpunct(size_t)): Fix bool
+ initialization.
+ * testsuite/27_io/ios_manip_fmtflags.cc (test02): Add test for
+ bool formatting.
+
+2000-04-19 Nathan Myers <ncm@cantrip.org>
+
+ * src/string-inst: consolidate _S_create,
+ destroy, leak, clone members into stringMAIN and stringMUTATE
+ object files.
+ * src/Makefile.am: Above, and eliminate dependence on
+ wstring-inst.cc.
+ * src/wstring-inst.cc: Remove.
+
+2000-04-18 Benjamin Kosnik <bkoz@redhat.com>
+
+ * src/Makefile.am (AC_CXXFLAGS): Activate debugging code, again.
+ Add flags for specialized rules dealing with instantiations.
+
+ * src/string-inst.cc: Add instantiations missing from shared
+ libraries--see stringEQ, stringCONSC.
+ * src/Makefile.am (wstring_sources): Add.
+ (string_sources): Same.
+ * src/Makefile.in: Regenerate.
+
+ * stl/*: Integrate contents of this directory into top-level
+ directories.
+ * ext/bvector hash_map hash_set rope ropeimpl.h slist
+ stl_bvector.h stl_hash_fun.h stl_hashtable.h stl_rope.h tree: Add.
+ * bits/pthread_allocimpl.h std_algorithm.h std_bitset.h
+ std_deque.h std_functional.h std_iterator.h std_list.h std_map.h
+ std_memory.h std_numeric.h std_queue.h std_set.h std_stack.h
+ std_stdexcept.h std_strstream.h std_utility.h std_vector.h
+ stl_algo.h stl_algobase.h stl_alloc.h stl_config.h stl_construct.h
+ stl_deque.h stl_function.h stl_heap.h stl_iterator.h
+ stl_iterator_base.h stl_list.h stl_map.h stl_multimap.h
+ stl_multiset.h stl_numeric.h stl_pair.h stl_pthread_alloc.h
+ stl_queue.h stl_range_errors.h stl_raw_storage_iter.h stl_relops.h
+ stl_set.h stl_stack.h stl_string_fwd.h stl_tempbuf.h stl_threads.h
+ stl_tree.h stl_uninitialized.h stl_vector.h type_traits.h: Add.
+ * backward/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 rope.h set.h slist.h
+ stack.h tempbuf.h tree.h vector.h: Add.
+ * README (file): Update.
+ * docs/documentation.html: README not being found.
+ * src/Makefile.am (sources): Take out stl directory.
+ * mkcheck.in (SRC_DIR): And here.
+ * src/Makefile.in: Regenerate.
+
+2000-04-18 Levente Farkas <lfarkas@mindmaker.hu>
+
+ * stl/bits/stl_function.h: Add bits so that const and non-const
+ both work.
+
+2000-04-18 scott snyder <snyder@fnal.gov>
+
+ * stl/bits/stl_map.h (class map): Fix default for _Alloc template
+ parameter. Get rid of use of __STL_DEFAULT_ALLOCATOR and
+ __STL_LIMITED_DEFAULT_TEMPLATES macros.
+ * stl/bits/stl_multimap.h (class multimap): Likewise. Get rid of
+ use of __STL_DEPENDENT_DEFAULT_TMPL macro.
+
+2000-04-18 scott snyder <snyder@fnal.gov>
+
+ * stl/bits/stl_config.h (__STL_DEPENDENT_DEFAULT_TMPL): Deleted
+ this macro.
+
+ * stl/ext/hash_map (class hash_map, class hash_multimap): Get rid
+ of use of __STL_DEPENDENT_DEFAULT_TMPL macro.
+ * stl/ext/hash_set (class hash_set, class hash_multiset):
+ Likewise.
+ * stl/bits/stl_function.h (struct constant_unary_fun, struct
+ constant_binary_fun): Likewise.
+ * stl/bits/stl_queue.h (class queue, class priority_queue): Likewise.
+ * stl/bits/stl_stack.h (class stack): Likewise.
+ * stl/bits/stl_set.h (class set): Likewise.
+ * stl/bits/stl_multiset.h (class multiset): Likewise.
+
+ * stl/bits/stl_iterator.h (class reverse_bidirectional_iterator,
+ class reverse_iterator): Get rid of use of
+ __STL_LIMITED_DEFAULT_TEMPLATES macro.
+
+ * stl/bits/stl_config.h (__STL_DEFAULT_ALLOCATOR): Deleted this
+ macro.
+
+ * stl/bits/stl_deque.h (class deque): Get rid of use of
+ __STL_DEFAULT_ALLOCATOR macro.
+ * stl/bits/stl_list.h (class list): Likewise.
+ * stl/bits/stl_multiset.h (class multiset): Likewise.
+ * stl/bits/stl_set.h (class set): Likewise.
+ * stl/bits/stl_string_fwd.h (class basic_string): Likewise.
+ * stl/bits/stl_tree.h (class _Rb_tree, class rb_tree): Likewise.
+ * stl/bits/stl_vector.h (class vector): Likewise.
+ * stl/ext/ropeimpl.h (rotate): Likewise.
+ * stl/ext/hash_map (class hash_map, class hash_multimap):
+ Likewise.
+ * stl/ext/hash_set (class hash_set, class hash_multiset):
+ Likewise.
+ * stl/ext/slist (class slist): Likewise.
+ * stl/ext/stl_bvector.h (class bit_vector): Likewise.
+ * stl/ext/stl_rope.h (class rope): Likewise.
+ * src/locale.cc (_Impl): Likewise.
+ * src/localename.cc (_Impl): Likewise.
+ * bits/localefwd.h (_Impl): Likewise.
+
+2000-04-18 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * docs/install.html: Cleanup, minor changes.
+ * docs/17_intro/howto.html: Ditto.
+
+2000-04-18 Nathan Myers <ncm@cantrip.org>
+
+ * bits/basic_string.h: Remove "inline" from member _S_find.
+
+ * src/string-inst.cc: Rewrite to reflect non-inline template
+ instantiations in string.tcc.
+
+ * src/stringADDCS.cc, stringADDPS.cc, stringADDSC.cc, stringADDSP.cc,
+ stringADDSS.cc, stringBIST.cc, stringBOST.cc, stringCHTR.cc,
+ stringEQPS.cc, stringEQSP.cc, stringEQSS.cc, stringEXTRA.cc,
+ stringGEPS.cc, stringGESP.cc, stringGESS.cc, stringGETLI.cc,
+ stringGTPS.cc, stringGTPS.cc, stringGTSP.cc, stringGTSS.cc,
+ stringINSER.cc, stringLEPS.cc, stringLESP.cc, stringLESS.cc,
+ stringLESP.cc, stringLTPS.cc, stringLTPS.cc, stringLTSP.cc,
+ stringLTSS.cc, stringMAIN.cc, stringNEPS.cc, stringNESP.cc,
+ stringNESS.cc, stringSCOPY.cc: Remove.
+ * src/wstringADDCS.cc, etc: Remove.
+
+ Benjamin Kosnik <bkoz@haight.constant.com>
+ * src/Makefile.am: Modify to reflect above.
+ * src/Makefile.in: Regenerate.
+
+2000-04-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * docs/install.html (--enable-libstdcxx-v3): Clean up install docs.
+
+2000-04-13 Benjamin Kosnik <bkoz@haight.cygnus.com>
+
+ * bits/std_fstream.h (filebuf::sync): Need to use the abstracted
+ io interface here instead of the libio particulars.
+
+ * config/threads-posix.h: Consistency with stl_config.h.
+
+ * mkcheck.in (CXX_FLAG): Add DDEBUG_ASSERT back in.
+
+2000-04-13 Loren J. Rittle <ljrittle@acm.org>
+
+ * mknumeric_limits: Rename generic type template parameter name
+ '_T' to '_Tp'.
+ * stl/bits/type_traits.h: Ditto.
+
+2000-04-06 Benjamin Kosnik <bkoz@decepticon.cygnus.com>
+
+ * mkcheck.in (SRC_DIR): Change default mkcheck behavior, so that
+ it is more useful for --enable-libstdcxx-v3. Use the built
+ compilers with v3, instead of compilers in PATH, and don't
+ re-include include directories for checking the install.
+
+2000-04-05 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * src/Makefile.am (AM_CXXFLAGS): Disable NAMESPACES, as this is on
+ by default when using --enable-libstdcxx-v3.
+ * src/Makefile.in: Regenerate.
+ * configure.in: Disable GLIBCPP_ENABLE_NAMESPACES,
+ GLIBCPP_ENABLE_RELIBGCC for --enable-libstdcxx-v3 flag.
+ * configure: Regenerate.
+ * mkcheck.in: Deal with NAMESPACES.
+
+2000-04-05 Petter Urkedal <petter@matfys.lth.se>
+
+ * src/cmath.cc: New file...
+ (pow(*, int)): Define functions...
+ * src/Makefile.am (sources): ...register file.
+ * src/Makefile.in: Regenerate.
+ * bits/std_cmath.h (pow): ...declare functions here, and remove
+ old definitions.
+
+2000-04-04 Benjamin Kosnik <bkoz@redhat.com>
+
+ * acinclude.m4 (GCC_OBJDIR): Tweaks
+
+2000-04-03 Benjamin Kosnik <bkoz@redhat.com>
+
+ * acinclude.m4 (GLIBCPP_CHECK_CPU): Add arm configure bits.
+ * config/cpu/arm: New directory.
+
+ Jesper Skov <jskov@redhat.com>
+ * config/cpu/arm/atomicity.h: New file.
+
+2000-03-31 Benjamin Kosnik <bkoz@redhat.com>
+
+ * stl/bits/stl_config.h: Make _STL_THREADS depend on _REENTRANT.
+ Remove unused bits. Clean.
+
+2000-03-29 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * testsuite/25_algorithms: New directory.
+ * testsuite/25_algorithms/min_max.cc: New file.
+
+2000-03-29 scott snyder <snyder@fnal.gov>
+
+ * bits/locale_facets.tcc (do_put): Allow a couple extra digits of
+ precision beyond that which we get from numeric_limits::digits10.
+
+ * stl/bits/stl_algobase.h (max, min): Don't use comparison
+ operator.
+
+ * testsuite/23_containers/bitset_shift.cc: Fix.
+
+ * testsuite/27_io/ios_manip_fmtflags.cc (test01): Don't give a
+ temporary to imbue().
+
+ * bits/std_fstream.h (sync): Resync libio's idea of the current
+ file position with the external file.
+
+2000-03-28 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * testsuite/27_io/istream_extractor_arith.cc.cvs: Fix merge
+ mistake.
+
+ * bits/std_fstream.h (filebuf::is_open): Check for _M_file before
+ attempting calls to it.
+ * bits/fstream.tcc (ctors): Don't call _M_init_filebuf in
+ ctors. Instead, call _M_init_filebuf ...
+ (open): Here, as suggested by 27.8.1.3.
+ * src/ios.cc (ios_base::Init::Init()): Clean up default filebufs
+ properly when initializing cout/cin/cerr.
+
+2000-03-27 Russell Davidson <russell@ehess.cnrs-mrs.fr>
+
+ * testsuite/23_containers/multiset.cc (main): Clean up for namespaces.
+ * testsuite/22_locale/ctype_char_members.cc: And here.
+ * testsuite/27_io/streambuf.cc (streambuf): And here.
+ * testsuite/27_io/ostream_inserter_char.cc (test06): And here.
+ * testsuite/27_io/istream_unformatted.cc (test05): And here.
+ * testsuite/27_io/istream_extractor_arith.cc: And here.
+ * testsuite/27_io/ios_manip_basefield.cc (test02): And here.
+ * testsuite/27_io/ios_base_members_static.cc: And here.
+ * bits/std_climits.h (_CPP_CLIMITS): Fix typo.
+
+2000-03-27 Chris Faylor <cgf@cygnus.com>
+
+ * configure.in: Remove setting of CXX if canadian cross.
+ * configure: Regenerate.
+
+2000-03-27 Nathan Myers <ncm@zembu.com>
+
+ * bits/sstream.tcc: Optimize.
+ * bits/basic_string.h(string::append): Don't inline.
+ * bits/string.tcc: Move out-of-line.
+
+2000-03-27 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * acinclude.m4: (GLIBCPP_CHECK_COMPILER_VERSION) When using <2.96,
+ define WERRORSUPPRESS so that the inlining warnings won't kill us.
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+ * src/Makefile.am: Use WERRORSUPPRESS for the files that need it.
+ * src/Makefile.in: Regenerate.
+
+ * docs/install.html: Almost complete rewrite.
+
+2000-03-25 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * docs/install.html: Explain -Werror problem at "#Werror" mark.
+ * docs/faq/index.html: Testsuite will die horribly if new libgcc.a
+ not installed.
+ * docs/faq/index.txt: Regenerate.
+
+2000-03-24 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
+
+ * src/Makefile.am (libio_headers_install): Fix.
+ * src/Makefile.in: Regenerate.
+
+2000-03-24 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * docs/17_intro/RELEASE-NOTES: Fix typos.
+ * docs/index.html: Update.
+ * docs/17_intro/BUGS: Update.
+ * docs/status.html: Update for 2.90.8 release.
+
+2000-03-23 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * Makefile.am: Better error message when missing libgcc2.ready.
+ * Makefile.in: Regenerate.
+ * acinclude.m4: Fastidious nitpicking reformatting.
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+ * mkcheck.in: Must use same namespace settings as the library being
+ tested. Also log ST_FLAG, since it's being passed.
+ * docs/install.html: Add brief chunk on configuration.
+ * docs/17_intro/RELEASE-NOTES: Fix minor Cygwin typo.
+ * docs/23_containers/howto.html: Mention MT-safe string.
+ * docs/faq/index.html: Minor updates.
+ * docs/faq/index.txt: Regerarate.
+
+2000-03-22 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/sstream.tcc (seekoff): Fix for gptr() null cases.
+ Return newoff.
+ * bits/fstream.tcc (seekoff): Sync.
+ (seekpos): Sync.
+ * testsuite/27_io/ostream_unformatted.cc: New file.
+ * testsuite/27_io/stringbuf.cc: Fix.
+ * testsuite/27_io/istream_unformatted.cc (test04): Fix.
+
+ * config/newlib/bits/ctype_base.h (ctype_base): Fix.
+ * config/newlib/ctype.cc (ctype): Change __ctype -> _ctype_.
+
+ * src/complex_io.cc (operator>>complex): Tweak.
+
+ * config/cpu/alpha/atomicity.h: Explicitly typedef uint32_t, int32_t if
+ <inttypes.h> does not exist.
+ * config/cpu/sparc/sparc64/atomicity.h: Same.
+ * config/cpu/sparc/sparc32/atomicity.h: Same.
+ * config/cpu/powerpc/atomicity.h: Same.
+ * config/cpu/i386/atomicity.h: Same.
+ * config/cpu/generic/atomicity.h: Same.
+ * configure.in: Check for inttypes.h.
+ * configure: Regnerate.
+
+2000-03-21 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_sstream.h (_M_init_stringbuf): Set initial ate position
+ correctly.
+ * testsuite/27_io/ostream_inserter_char.cc (test06): Add tests for ate.
+
+ * docs/17_intro/RELEASE-NOTES (New): Add bits.
+
+ * configure.in: Move AC_CHECK_HEADERS to a point where we know we
+ are compiling natively.
+
+ * libio/*: Update to CVS libio from egcs.
+
+2000-03-21 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * docs/download.html: Document use of -z9 for CVS.
+ * docs/index.html: Add target date (no link) for future snapshot.
+
+2000-03-21 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/slice_array.h: Rename generic type template parameter name
+ '_T' to '_Tp'.
+ * bits/mask_array.h: Ditto
+
+2000-03-20 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * *: Change copyright holder from "Cygnus Solutions" to "Free
+ Software Foundation, Inc."
+
+ * docs/configopts.html: Explain what "hella versions" means.
+ * docs/install.html: Some tweaks--nice job on this Phil.
+ * docs/documentation.html: Add a direct link to configuration options.
+
+ * src/Makefile.am (OPTIMIZE_CXXFLAGS): Add in extras.
+ * docs/17_intro/RELEASE-NOTES (New): Add.
+ * bits/c++config.h (__GLIBCPP__): Bump version.
+
+ * config/c_io_libio.cc (__basic__file(__c_lock*)): Change argument
+ type to match prototype.
+
+2000-03-20 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * docs/install.html: Update for new funky build procedure. Move
+ description of 'configure' options to...
+ * docs/configopts.html: ...here. New file.
+ * docs/17_intro/howto.html: Updates for new snapshot.
+ * docs/20_util/howto.html: Ditto.
+ * docs/21_strings/howto.html: Ditto.
+ * docs/21_strings/stringtok_std_h.txt: Fix example typos.
+ * docs/22_locale/howto.html: Ditto.
+ * docs/23_containers/howto.html: Ditto.
+ * docs/faq/index.html: Ditto.
+
+2000-03-18 Petter Urkedal <petter@matfys.lth.se>
+ Benjamin Kosnik <bkoz@gnu.org>
+
+ * acinclude.m4 (GLIBCPP_CHECK_COMPLEX_SUPPORT): Move code for main
+ to the right place.
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+
+2000-03-16 Benjamin Kosnik <bkoz@cygnus.com>
+ scott snyder <sss@karma.fnal.gov>
+
+ * config/c_io_libio.h: Add __c_lock.
+ * config/threads-no.h: Same here.
+ * config/threads-posix.h: Add __mutext_type typedef.
+ * config/c_io_libio.cc: basic_file ctor takes lock arg.
+ * bits/basic_file.h: Ctor takes lock arg.
+ * bits/std_fstream.h: Add _M_lock.
+ * bits/fstream.tcc: Supply it to basic_file ctor.
+
+ * mkcheck.in (resultstext): Change [[ to [.
+
+ * testsuite/27_io/ostream_inserter_char.cc (test06): Tweak.
+
+ * bits/locale_facets.h: Tweak.
+
+ * stl/bits/stl_config.h: Fix defines.
+
+2000-03-16 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * mkcheck.in (INC_PATH): Add paths from cpu_include_dir to find
+ atomicity.h
+ * configure: Regenerate.
+ * aclocal.m4: Regnerate.
+
+2000-03-16 Nathan Myers <ncm@zembu.com>
+
+ * bits/string.tcc: Add MT support.
+ * bits/basic_string.h: Same.
+
+2000-03-16 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * configure.in: Make --enable-namespaces and -libgcc-rebuild=../..
+ the defaults.
+ * configure: Regenerate.
+
+ * config/solaris/solaris2.7/ctype.cc: Fix unsigned/signed comparison.
+
+2000-03-16 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * acinclude.m4 (GLIBCPP_CHECK_CTYPE): If Sol2.5 ctype is found, keep
+ checking for 2.[67]. (GLIBCPP_ENABLE_RELIBGCC): No longer ignore
+ any defaults passed in.
+ * aclocal.m4: Regenerate.
+
+2000-03-16 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * mkcheck.in: Report total successes and failures.
+
+2000-03-15 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * config/cpu: New directory, intended to be used to provide
+ cpu-specific configuration files. In particular, assembly language
+ primitives for thread safety.
+ * config/cpu/alpha: Populate.
+ * config/cpu/alpha/atomicity.h: New file.
+ * config/cpu/arm: Populate.
+ * config/cpu/generic: Populate.
+ * config/cpu/generic/atomicity.h: New file.
+ * config/cpu/hppa: Populate.
+ * config/cpu/i386: Populate.
+ * config/cpu/i386/atomicity.h: New file, take from i486.
+ * config/cpu/m68k: Populate.
+ * config/cpu/mips: Populate.
+ * config/cpu/powerpc: Populate.
+ * config/cpu/powerpc/atomicity.h: New file.
+ * config/cpu/sparc: Populate.
+ * config/cpu/sparc/sparc32: Populate.
+ * config/cpu/sparc/sparc64: Populate.
+ * config/cpu/sparc/sparc32/atomicity.h: New file.
+ * config/cpu/sparc/sparc64/atomicity.h: New file.
+
+ * src/Makefile.am (myinstallheaders): Add install routines.
+ * acinclude.m4 (GLIBCPP_CHECK_CPU):Add configuration for the
+ cpu dir.
+ * configure.in: Add.
+
+ * config/default: Adopt glibc naming conventions, and so move to
+ * config/generic: Here.
+ * acinclude.m4 (GLIBCPP_CHECK_CTYPE): Modify default case to generic.
+
+2000-03-15 Bill Thompson <billt@toast.net>
+
+ * testsuite/27_io/ostream_inserter_char.cc (test06): Add test.
+
+2000-03-14 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * docs/17_intro/howto.html: Add missing "TOC" entry, and new section.
+
+ * acinclude.m4 (GLIBCPP_CHECK_CTYPE): Fixup.
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+
+2000-03-13 scott snyder <snyder@fnal.gov>
+ Jason Merrill <jason@cygnus.com>
+
+ * bits/locale_facets.h (class ctype, class ctype<char>, class
+ ctype<wchar_t>): More mask fixes.
+ * testsuite/22_locale/ctype.cc: Test for the problem.
+
+2000-03-13 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * acconfig.h: Add bits.
+ * configure.in: Move AM_PROG_LIBTOOL up in file.
+ Tweak cross compiling info.
+ * configure: Regenerate.
+
+ * mknumeric_limits (XCOMPILE): Echo compilation line for
+ gen-num-limits.cc
+
+ * acinclude.m4 (GLIBCPP_CHECK_CTYPE): Add aix checks.
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+ * config/aix/ctype.cc (ctype): Tweak.
+ * config/aix/bits/ctype_base.h (ctype_base): Tweak.
+ * config/aix/bits/ctype_specializations.h: New file.
+
+2000-03-10 scott snyder <snyder@fnal.gov>
+
+ * stl/bits/stl_vector.h (_M_assign_aux): Fix for __normal_iterator
+ conversions.
+ * testsuite/23_containers/vector_modifiers.cc (test01): Add a
+ regression test for the problem.
+
+2000-03-09 Benjamin Kosnik <bkoz@fidel.cygnus.com>
+
+ * testsuite/27_io/streambuf.cc (class testbuf): Same here.
+ * bits/fpos.h: And here.
+ * bits/std_ostream.h: Same here.
+ * bits/std_istream.h: Same here.
+ * bits/basic_ios.h: Same here.
+ * bits/std_fstream.h: Same here.
+ * bits/sbuf_iter.h (std): Here too.
+ * bits/std_sstream.h: Make types public.
+
+ * src/misc-inst.cc: Use size_t instead of unsigned int.
+ * bits/locale_facets.tcc (_S_format): For now, cast to char. I
+ suppose this should be ctype::narrow... all the ctype<wchar_t>
+ stuff needs to be cleaned up.
+
+2000-03-09 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * docs/gentop: Remove entire directory, finally.
+
+2000-03-09 scott snyder <snyder@fnal.gov>
+
+ * bits/std_cmath.h (modf): Fix pointer overrun.
+ * testsuite/26_numerics/c_math.cc (test04, main): Add a regression
+ test for the problem.
+
+2000-03-09 Phil Edwards <pme@sourceware.cygnus.com>
+
+ Looks like changes to the #include'd files must be followed by a
+ change to the #include'ing files to take effect. Caveat emptor.
+ * docs/header.html: New file, for server-side include.
+ * docs/footer.html: New file, for server-side include.
+ * docs/documentation.html: Change to use SSI.
+ * docs/download.html: Ditto.
+ * docs/index.html: Ditto.
+ * docs/mail.html: Ditto.
+ * docs/status.html: Ditto.
+ * docs/thanks.html: Ditto, plus minor updates.
+ * docs/how.html: Remove.
+
+2000-03-09 Benjamin Kosnik <bkoz@gnu.org>
+
+ Preliminary alpha-linux support.
+ * src/locale.cc (ctype<wchar_t>): Use correct types...
+ * bits/locale_facets.h (ctype<char>): Add __table_type typedef.
+ (ctype<wchar_t>): Same.
+ * bits/locale_facets.h (ctype<wchar_t>): Have char and wchar_t
+ types match for table_size (size_t).
+
+ * config/gnu-linux/ctype.cc (ctype): Change char_type to wchar_t
+ as per char specialization.
+ * config/*/ctype.cc: Same.
+
+2000-03-09 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/locale_facets.h (_Ctype<>::mask): Import from base class
+ _Ctype_nois<>. Template base classes are never examinated in
+ first-phase name-lookup.
+
+2000-03-08 Benjamin Kosnik <bkoz@gnu.org>
+
+ Add Solaris 2.5.1 support.
+ * config/solaris/solaris2.5/bits/ctype_base.h (ctype_base): And here.
+ * config/solaris/solaris2.5/ctype.cc: Fixup.
+ * config/solaris/solaris2.5/bits/ctype_specializations.h: Add.
+ * acinclude.m4 (GLIBCPP_CHECK_CTYPE): Add bits for solaris2.5.1.
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+
+ * config/default/ctype.cc (ctype): Fixup.
+
+2000-03-07 Benjamin Kosnik <bkoz@blues.cygnus.com>
+
+ * testsuite/27_io/filebuf.cc: Activate init code from yesterday...
+ * testsuite/27_io/ostream_inserter_arith.cc (testcases): Fix for
+ non-wchar_t case.
+
+2000-03-07 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/cpp_type_traits.h: Expand on this file purpose.
+
+2000-03-06 Benjamin Kosnik <bkoz@gnu.org>
+
+ * bits/locale_facets.h (ctype<char>): Remove static members, and
+ re-work initialization code.
+ (ctype<wchar_t>): Same.
+ Move _S_touppper to _M_toupper and initialize in ctor.
+ Move _S_tolower to _M_tolower and initialize in ctor.
+ Move _S_table to _M_ctable and intialize in ctor.
+ * bits/locale_facets.h (std): And here.
+ * src/locale.cc (std): Tweak.
+ * config/gnu-linux/ctype.cc: Change initialization here.
+ * config/newlib/ctype.cc: And here.
+ * config/solaris/solaris2.7/ctype.cc: And here.
+ * config/solaris/solaris2.6/ctype.cc: And here.
+
+ * bits/localefwd.h: Tweak.
+ * bits/std_streambuf.h: Tweak formatting.
+
+ * testsuite/27_io/filebuf.cc: Remove BUFSIZ dependancies.
+
+2000-03-05 Chip Salzenberg <chip@valinux.com>
+
+ * src/misc-inst.cc (basic_iostream<>): Instantiate.
+
+2000-03-02 Phil Edwards <pme@sourceware.cygnus.com>
+ Kevin Atkinson <kevinatk@home.com>
+
+ Initial grab of SGI's strstream implementation with minor
+ modifications.
+ * src/strstream.cc: New file.
+ * std/strstream: New file.
+ * stl/bits/std_strstream.h: New file.
+ * bits/std_streambuf.h: Add public access.
+ * src/Makefile.am: Add strstream sources to list of dependancies.
+ * src/Makefile.in: Regenerate.
+
+2000-03-03 2000 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/valarray_meta.h: Fix typo.
+
+2000-03-02 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
+ Chip Salzenberg <chip@valinux.com>
+ Petter Urkedal <petter@matfys.lth.se>
+
+ * src/Makefile.am (myinstallheaders): Hack to avoid
+ `for i in ; do'.
+ * src/Makefile.in: Regenerate.
+
+2000-03-02 Chip Salzenberg <chip@valinux.com>
+
+ * libio/Makefile.an, math/Makefile.an, src/Makefile.am
+ (LINK): Put quotes around "$(CC)" for libtool link mode,
+ so libtool will use "-B" options during GCC bootstrap.
+ * */Makefile.in: Regenerate.
+
+2000-03-02 Petter Urkedal <petter@matfys.lth.se>
+
+ * config/c_io_libio.h: Enclose it all in ::std.
+ * bits/basic_string.h (basic_string<>): Make types and
+ `npos' public.
+ * mkc++config: Truncate output file before writing.
+
+2000-03-01 Benjamin Kosnik <bkoz@gnu.org>
+
+ * math/cabsf.c (__mycabsf): Rename to cabsf.
+ * math/cabs.c (__mycabs): Rename to cabs.
+
+2000-02-29 LLeweLLyn Reese <llewelly@198.dsl.xmission.com>
+
+ * bits/basic_string.h: Move declarations of __out_of_range(),
+ __length_error() and accompanying macros ...
+ * bits/exception_support.h: here. (Newly created file).
+ * bits/basic_string.h: #include <bits/exception_support.h>
+ * stl/bits/stl_vector.h: #include <bits/exception_support.h>
+ * src/Makefile.am (headers): Add.
+ * src/Makefile.in: Regenerate.
+
+2000-02-29 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/cpp_type_traits.h: Rename structs so they don't clash with
+ type_traits.h.
+ * bits/valarray_array.h: Synch. Fix typos.
+
+ * libio/Makefile.am: Change to only compile source files that
+ config/c_io_libio.cc actually needs.
+ * libio/Makefile.in: Regnerate.
+ * libio/PlotFile.hes SFile.h builtinbuf.h editbuf.h floatconv.c
+ floatio.h fstream.h indstream.h iofclose.c iofdopen.c iofeof.c
+ ioferror.c iofflush.c iofgetpos.c iofgets.c iofopen.c iofprintf.c
+ iofputs.c iofread.c iofscanf.c iofsetpos.c ioftell.c iofwrite.c
+ iogetc.c iogetdelim.c iogetline.c iogets.c ioignore.c iomanip.h
+ iopadn.c ioperror.c iopopen.c ioprims.c ioprintf.c ioputc.c
+ ioputs.c ioscanf.c ioseekoff.c ioseekpos.c iosetbuffer.c
+ iosetvbuf.c iosprintf.c iosscanf.c iostream.h iostrerror.c
+ ioungetc.c iovfprintf.c iovfscanf.c iovsprintf.c iovsscanf.c
+ istream.h list.out ostream.h outfloat.c parsestream.h peekc.c
+ pfstream.h procbuf.h stdiostream.h stream.h streambuf.h strfile.h
+ strops.c strstream.h: Delete.
+
+ * bits/basic_file.h: Stub out or delete unused bits in this
+ interface.
+ (filepos_beg): Remove.
+ (filepos_cur): Remove.
+ (filepos_valid): Remove.
+ * config/c_io_libio.cc: Resynch with the changes to basic_file.
+
+2000-02-29 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/cpp_type_traits.h: Correct typo.
+
+2000-02-29 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/cpp_type_traits.h: New file.
+
+ * bits/valarray_array.h: Tweak. #include <bits/cpp_type_traits.h>
+ Improve array construction.
+ (_Array_default_ctor): New dispatcher class.
+ (__valarray_default_construct): New function.
+ (_Array_copy_ctor): New dispatcher class.
+ (__valarray_copy_construct): New function.
+ (_Array<>::free_data): Remove.
+
+ * src/Makefile.am (headers): Add cpp_type_traits.h
+ * src/Makefile.in: Regenerate.
+
+2000-02-28 Benjamin Kosnik <bkoz@cygnus.com>
+
+ Prune libio directory to match files in libio/Makefile.
+ * libio/PlotFile.cc,indstream.cc, isgetsb.cc, sbform.cc,
+ stream.cc, SFile.cc, ioassign.cc, isscan.cc, sbgetline.cc,
+ streambuf.cc, builtinbuf.cc, ioextend.cc, osform.cc, sbscan.cc,
+ strstream.cc, editbuf.cc, iomanip.cc, parsestream.cc,
+ stdiostream.cc, filebuf.cc, iostream.cc, pfstream.cc,
+ stdstrbufs.cc, fstream.cc, isgetline.cc, procbuf.cc,
+ stdstreams.cc: Remove.
+ * libio/floatio.h, iolibio.h, iostdio.h, iostreamP.h: Remove.
+ * libio/iofflush_u.c: Remove.
+
+ * libio/dbz: Remove.
+ * libio/include: Remove.
+ * libio/stdio: Remove.
+ * libio/tests: Remove.
+ * libio/testsuite: Remove.
+
+ * config/c_io_libio.cc: Add fcntl.h include for Solaris.
+
+ * acinclude.m4 (GLIBCPP_ENABLE_CSTDIO): Add bits.
+ * configure.in: Replace 'grep -e' with 'grep' for Solaris.
+ * configure: Regenerate.
+
+2000-02-25 Benjamin Kosnik <bkoz@gnu.org>
+
+ Abstract out the underlying "C" io bits.
+ * bits/std_new.h: Remove <stl_config> include, as well as <cstddef>.
+ * stl/bits/stl_string_fwd.h: Remove <stddef> include.
+ * bits/std_cwchar.h: Wrap with _GLIBCPP_USE_WCHAR_T guards. Don't
+ include <cstddef>.
+ * stl/bits/stl_config.h: Don't include _G_config.h.
+
+ * bits/basic_file.h: Allow for non-inheritance based __basic_files.
+ * config/c_io_libio.h (_GLIBCPP_BASIC_FILE_INHERITANCE): Define.
+ * config/c_io_libio.cc: Tweak.
+
+ * src/Makefile.am (TOPLEVEL_INCLUDES): Add includedir.
+ * src/Makefile.in: Regenerate.
+ * Makefile.am (AM_MAKEFLAGS): Define includedir so that
+ prefix/include files will be picked up.
+ * Makefile.in: Regenerate.
+ * math/Makefile.am (TOPLEVEL_INCLUDES): And here.
+ * libio/Makefile.am (TOPLEVEL_INCLUDES): And here.
+
+ * bits/std_ios.h: Include <bits/c++io.h> instead of libio.
+ * bits/fpos.h: And here.
+ * bits/basic_file.h (get_fileno): Move definition from ...
+ * src/basic_file.cc (std): To here.
+ * bits/fpos.h: Move types for streamoff, streampos to..
+ * bits/basic_file.h: Move __c_file_type and fpos typedefs to...
+ * config/c_io_libio.h: ...here.
+ (_GLIBCPP_[BOOLALPHA, HEX, DEC, FIXED, INTERNAL, LEFT, OCT, RIGHT,
+ SCIENTIFIC, SHOWBASE, SHOWPOINT, SHOWPOS, SKIPWS, UNITBUF,
+ UPPERCASE, ADJUSTFIELD, BASEFIELD, FLOATFIELD, BADBIT, EOFBIT,
+ FAILBIT, GOODBIT, APP, ATE, BINARY, IN, OUT, TRUNC): New macros to
+ abstract out bits in ios_base.
+ * bits/ios_base.h: Re-macrofy.
+ * src/basic_file.cc : Rename, move to
+ * config/c_io_libio.cc: Here.
+ * config/c_io_libio.h: New file. Include libio.
+ * bits/c++config.h: Don't define _GLIBCPP_USE_LIBIO.
+ * configure.in (blddir): Add enabling bits for GLIBCPP_ENABLE_CSTDIO.
+ * configure: Regenerate.
+ * src/Makefile.am (sources): Take out basic_file.cc and add c++io.cc.
+ (generated_headers): Add c++io.h
+ * acinclude.m4 (GLIBCPP_ENABLE_CSTDIO): New function to select
+ underlying "C" io library.
+ * acinclude.m4 (GLIBCPP_CHECK_LIBIO): Roll functionality into
+ GLIBCPP_ENABLE_CSTDIO.
+
+ * configure.in: Add configure bits for cross compiling non-newlib
+ targets. .
+ GLIBCPP_CHECK_COMPILER_VERSION: Take out this test for this
+ target, as we assume g++ support is not the limiting factor.
+ GLIBCPP_CHECK_LIBIO: Same, know we don't need libio.
+ * configure: Regenerate.
+
+2000-02-22 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * Makefile.am (INTERFACE): Define.
+ * Makefile.in: Regenerate.
+ * libio/ChangeLog: Add entry.
+
+2000-02-21 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * docs/install.html: Update install directions.
+
+ * docs/status.html: Fix sidebar to be consistent.
+ * docs/thanks.html: Same.
+ * docs/links.html: Same.
+ * docs/mail.html: Same.
+ * docs/download.html: Same.
+
+ * testsuite/27_io/filebuf.cc: Change BUFSIZ to buffer_size, and
+ kill the macro BUFSIZ. I think the solaris fails lie elsewhere
+ however, in the ctype_char_members.cc fail (for instance.)
+ * testsuite/17_intro/headers.cc: Remove extraneous fails for hosts
+ that do not have wchar_t enabled.
+ * testsuite/27_io/ostream_inserter_arith.cc (struct _TestCase):
+ Same here.
+ * testsuite/27_io/iostream_objects.cc: And here.
+
+ * libio/gen-params (CONFIG_NM): Specifically add in nm as the
+ default CONFIG_NM.
+
+2000-02-18 Benjamin Kosnik <bkoz@haight.constant.com>
+ Tom Tromey <tromey@cygnus.com>
+
+ * configure.in: Manually add MULTISUBDIR.
+ * configure: Regenerate.
+ * src/Makefile.am (MULTISUBDIR): Add the lesser evil of Tom's two
+ "Eww" hacks to get multilib installs working correctly.
+ ($(headers): Test for MULTISUBDIR before installing.
+ * Makefile.am (AM_MAKEFLAGS): Don't define MULTISUBDIR, instead
+ have configure hack it in.
+ * Makefile.in: Regenerate.
+ * acinclude.m4 (GLIBCPP_CXXFLAGS): Tweak wording.
+ Add enabling bits for native Cygwin ctypes, and other newlib-based
+ Oses.
+
+2000-02-17 Benjamin Kosnik <bkoz@decepticon.cygnus.com>
+
+ * mkc++config (OUT_H): Remove EOF in cygwin.
+ * acinclude.m4 (LIBS): Tweaks to allow cygwin to configure.
+
+ Tom Tromey <tromey@cygnus.com>
+ * src/Makefile.am: Tweaks for installing multilibs.
+
+2000-02-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * src/Makefile.am:
+ (toolexeclib_LTLIBRARIES): Use this instead of lib_LTLIBRARIES.
+ Add USE_LIBDIR bits here, not...
+ * src/Makefile.in: Regenerate.
+ * Makefile.am: ...here.
+ * Makefile.in: Regenerate.
+
+2000-02-17 Benjamin Kosnik <bkoz@gnu.org>
+
+ * acinclude.m4 (LIBS): Fix typos.
+ * configure.in: _GLIBCPP_BUGGY_FLOAT_COMPLEX,
+ _GLIBCPP_BUGGY_COMPLEX for crosses.
+ * src/Makefile.am (std_headers): Add libio.h as install include,
+ as with _G_config.h
+ * src/Makefile.in: Regenerate.
+
+ * mkcheck.in: Add bits to set CXX to cross compiler.
+
+ * src/complex_io.cc: Tweak.
+ * configure.in: _GLIBCPP_BUGGY_COMPLEX for crosses.
+ * configure: Regenerate.
+
+ * config/newlib/ctype.cc: Tweaks.
+ * config/newlib/bits/ctype_base.h (ctype_base): Set mask to char,
+ not const char.
+ * src/complex_io.cc (operator>>(istream, complex): Define out if
+ BUGGY_COMPLEX.
+
+2000-02-16 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * config/newlib/bits/ctype_base.h: Correct _S_table.
+
+ Reconfigure ctype support for "C" libraries that don't use arrays.
+ * testsuite/22_locale/ctype_char_members.cc: New file. Test for
+ basic ctype<char> functionality.
+ * src/locale.cc: Move host-specific ctype functions that are not
+ inlines to config/*/ctype.cc files.
+ (ctype<char>::do_tolower): For instance.
+ (ctype<char>::do_toupper): For instance.
+ (ctype<wchar_t>::do_tolower): For instance.
+ (ctype<wchar_t>::do_toupper): For instance.
+ * config/gnu-linux/ctype.cc: Modify.
+ * config/default/ctype.cc: Modify.
+ * config/newlib/ctype.cc: Modify.
+ * config/solaris/solaris2.6/ctype.cc: Modify.
+ * config/solaris/solaris2.7/ctype.cc: Modify.
+
+ * bits/locale_facets.h (ctype<char>::is): Mark inline, move
+ out-of-line.
+ (ctype<char>::scan_is): Here too.
+ (ctype<char>::scan_not): Here too.
+ Move out of line defs to config/*/bits/ctype_specializations.h.
+ * config/gnu-linux/bits/ctype_specializations.h: ...here. New file.
+ * config/default/bits/ctype_specializations.h: ...here. New file.
+ * config/newlib/bits/ctype_specializations.h: ...here. New file.
+ * config/solaris/solaris2.6/bits/ctype_specializations.h: New file.
+ * config/solaris/solaris2.7/bits/ctype_specializations.h: New file.
+ * src/Makefile.am (headers): Add ctype_specializations.h.
+ * src/Makefile.in: Regenerate.
+
+ Aaron Weiss <weiss@clearway.com>
+ * Makefile.am (AM_MAKEFLAGS): Add NM_FOR_BUILD, NM_FOR_TARGET, and
+ CONFIG_NM for Solaris builds.
+ * Makefile.in: Regenerate.
+
+ * src/locale.cc: Tweak formatting.
+
+2000-02-15 Benjamin Kosnik <bkoz@cygnus.com>
+
+ Jim Parsons <parsons@clearway.com>
+ * testsuite/27_io/istream_unformatted.cc (test06): Add test.
+ * bits/istream.tcc (read): Set failbit if !good(). Don't increment
+ gcount if eof.
+ (readsome): Same.
+
+ Michel Decima <michel.decima@cnet.francetelecom.fr>
+ * testsuite/27_io/streambuf.cc: Add test.
+ * bits/streambuf.tcc (xsgetn): Don't test for valid mode.
+ (xsputn): Same.
+
+ * src/Makefile.am (AM_CXXFLAGS): Pass down AC_CXXFLAGS,
+ OPTIMIZE_CXXFLAGS, etc. So --enable-debug and --enable-namespaces
+ will work correctly, for instance.
+ * src/Makefile.in: Regenerate.
+
+ * bits/locale_facets.h: Fix merge error.
+ (num_put::put(unsigned long long): And here.
+ * mknumeric_limits (trait_name): Same.
+
+2000-02-15 Chip Salzenberg <chip@valinux.com>
+
+ Support 'configure --enable-long-long'.
+ * bits/c++config.h (_GLIBCPP_USE_LONG_LONG): Remove.
+ * stl/bits/stl_config.h (__STL_LONG_LONG): Remove '#if 0'.
+ * acconfig.h (_GLIBCPP_USE_LONG_LONG): Add. Default to undef.
+ * acinclude.m4 (GLIBCPP_ENABLE_LONG_LONG): Define flag macro.
+ * configure.in (GLIBCPP_ENABLE_LONG_LONG): Use it.
+
+ * aclocal.m4: Regenerate.
+ * config.h.in: Regenerate.
+ * configure: Regenerate.
+
+2000-02-15 Chip Salzenberg <chip@valinux.com>
+
+ Improve (complete?) 'long long' support.
+ * mknumeric_limits: Call $CXX with $CPPFLAGS. Define statics
+ for {,unsigned} long long if the limits header declares them.
+ * src/gen-num-limits.cc: Include <bits/c++config.h> early.
+ (__USE_GNU, _GNU_SOURCE): Define if _GLIBC_USE_LONG_LONG.
+ (long long, unsigned long long): Gen limits if _GLIBC_USE_LONG_LONG.
+ * bits/locale_facets.h (num_get<>::get(..., long long &)): Define.
+ (num_put<>::put(..., long long)): Likewise.
+ (num_put<>::put(..., unsigned long long)): Likewise.
+ * bits/locale_facets.tcc (_S_format): Rename from _S_format_long.
+ Templatize last parameter to support 'long long'.
+ (num_put<>::put(...)): Call _S_format with new name.
+ (num_put<>::put(..., long long)): Define.
+ (num_put<>::put(..., unsigned long long)): Likewise.
+ * src/locale-inst.cc (_S_format): Instantiate under new name.
+
+2000-02-15 Petter Urkedal <petter@matfys.lth.se>
+
+ * src/complex.cc (operator<<, operator>>): Moved from here...
+ * src/complex_io.cc: ...to new file.
+ (operator>>): Stub replaced by the real thing.
+ * src/Makefile.am (sources): Inserted complex_io.cc.
+ * src/Makefile.in: Regenerate.
+ * testsuite/26_numerics/complex_inserters_extractors.cc: Check it.
+
+2000-02-14 Benjamin Kosnik <bkoz@gnu.org>
+
+ Add in ctype information for newlib "C" libraries.
+ * config/newlib: New directory
+ * config/newlib/bits/ctype_base.h: New file.
+ * config/newlib/ctype.cc: New file.
+
+ * ctype/config/linux/*: Rename, move to...
+ * ctype/config/gnu-linux/*: Here.
+
+ Finish off multilib work.
+ * configure.in: Don't set CXX if not Canadian cross.
+ * configure: Regenerate.
+ * acinclude.m4 (GLIBCPP_CHECK_LIBIO): Tweak messages.
+ * aclocal.m4: Regenerate.
+ * config.h.in: Regenerate.
+
+ * install-sh: Remove, as AC_CONFIG_AUX_DIR(..) picks this out of
+ the top-level gcc directory now.
+ * mkinstalldirs: Remove.
+ * missing: Remove
+ * ltconfig: Remove.
+ * ltmain.sh: Remove.
+ * config.guess: Remove.
+ * config.sub: Remove.
+
+2000-02-13 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * configure.in (glibcpp_basedir): Add glibcpp_basedir.
+ * Makefile.am: Move mutlilib stuff to src/Makefile.am.
+ * Makefile.in: Regenerate.
+ * src/Makefile.am: Add multilib bits.
+ * src/Makefile.in: Regenerate.
+
+2000-02-12 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * configure.in: Clean, add some multilib support.
+ * configure: Regenerate.
+ * configure.host: New file.
+
+ * acinclude.m4: GLIBCPP_CHECK_LIBIO. Take bits from configure.in and
+ roll a new function, checks for presence of libio.
+ GLIBCPP_CHECK_COMPILER_VERSION: Same.
+ GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT: Same.
+ GLIBCPP_CHECK_MATH_SUPPORT: Same.
+ GLIBCPP_CHECK_WCHAR_T_SUPPORT: Same.
+ GLIBCPP_CHECK_LIBIO: Same.
+ GLIBCPP_CHECK_CTYPE: Same.
+ * aclocal.m4: Regenerate.
+ * config.h.in: Regenerate.
+
+ * Makefile.am: Tweaks.
+ * Makefile.in: Regenerate.
+
+2000-02-11 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * configure.in: Make outputing the libio/Makefile
+ conditional. Haha, yeah right. Anyway, we instead do this thing
+ where if libio is found, then we build a null library, as there is
+ no point in duplicating the found libio.
+ * Makefile.am: Tweak.
+ * Makefile: Regenerate.
+ * libio/Makefile.am: Add _G_config.h stuff. Now cross compilers
+ are happy happy happy.
+ * libio/Makefile.am: Regenerate.
+ * libio/gen-params: New file.
+ * src/Makefile.am: Make libio.la non-conditional, as it is now a
+ null library if it's not needed. At least we are being consistent,
+ if not as elegant as we could be.
+ * src/Makefile: Regenerate.
+
+2000-02-10 Benjamin Kosnik <bkoz@gnu.org>
+
+ * Makefile.am (SUBDIRS): Add libio again.
+ * Makefile.in: Regenerate.
+ * configure.in (BUILD_LIBIO_INCLUDE): And here.
+ (AC_OUTPUT): Generate libio/Makefile again.
+ * configure: Regnerate.
+ * src/Makefile.am (libstdc___la_LIBADD): Change path so that
+ libio.la is referring back to the libio subdir again.
+ (LIBIO_INCLUDES): And here.
+ * src/Makefile.in: Regenerate.
+
+2000-02-09 Benjamin Kosnik <bkoz@decepticon.cygnus.com>
+
+ * math/complex-stub.h: Missed one. Change __mycabs* to cabs*.
+
+2000-02-09 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/valarray_array.h (<bits/std_new.h>): #include.
+ (__valarray_get_memory): New function.
+ (__valarray_release_memory): Likewise.
+ (__valarray_default_construct): New functions.
+ (__valarray_fill_construct): New function.
+ (__valarray_copy_construct): New funstions.
+ (__valarray_destroy_elements): New function.
+
+ * bits/valarray_array.tcc (__valarray_copy_construct): New
+ functions.
+
+ * bits/std_valarray.h (valarray<>::valarray): Use
+ __valarray_get_memory and __valarray_fill_construct,
+ __valarray_copy_construct, __valarray_default_construct to
+ properly construct valarrays.
+ (valarray<>::~valarray): Use __valarray_destroy_elements to
+ destroy elements and __valarray_release_memory to return memory.
+ (valarray<>::shift): Tweak.
+ (valarray<>::cshift): Likewise.
+ (valarray<>::resize): Robustify.
+
+2000-02-09 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * mknumeric_limits (XCOMPILE): Add support for cross compiling.
+ * bits/limits_generic.h: New file, defaults.
+ * src/limits_generic.cc: New file, defaults.
+ * configure.in (LIBS): Run mknumeric_limits at configure time.
+ * acconfig.h: Remove PACKAGE VERSION HAVE_COMPLEX
+ HAVE_LC_MESSAGES, tidy, clean, etc.
+ * src/Makefile.am (geberated_sources): Remove.
+
+ * bits/fpos.h: Use _GLIBCPP_USE_LIBIO guards for libio typenames
+ (_IO_off_t, _IO_ssize_t)
+
+ * src/complex.cc: Use glibc's <complex.h> if
+ possible. . . apparently this was not being done before. Include
+ tweaks.
+ (abs): Enable cabs if it's around, instead of mycabs.
+ * src/complexf.cc (FCT): Add global scope to match complex.cc.
+ * src/complexl.cc (FCT): Same.
+ * math/Makefile.am (EXTRA_LONG_DOUBLE_yes): Change mycabsl to cabsl.
+ (libmath_la_SOURCES): And here.
+ * math/(mycabs.c, mycabsf.c, mycabsl.c): Move to. . .
+ * math/(cabs.c, cabsf.c, cabsl.c): . . . Here.
+ * math/complex-stub.h: Move c_log declarations into. . .
+ * math/mathconf.h: Here. This is because glibc's <complex.h>
+ declares cclog, not c_log. The case of the dueling standards. . .
+ * math/mathconf.h: Add _GLIBCPP_HAVE_* to macros.
+ * math/Makefile.am: Change.
+ * math/nan.c (nan): Change signature.
+ * math/mathconf.h (NAN): Same.
+ * math/complex-stub.h (nan): And here.
+
+ * Makefile.am (rebuild-stamp): Remove libio and libio
+ dependancies. Plan to take out libio subdir and just merge with
+ libio in top level gcc directory. Of course, this assumes there is
+ a libio in the top level directory (ie ../src_dir). This will
+ probably change the way this library is configured by default.
+ * libio/*: Remove.
+
+2000-02-09 Chip Salzenberg <chip@valinux.com>
+
+ * localefwd.h (locale): Make public: facet, id, category.
+
+2000-02-09 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * testsuite/26_numerics/buggy_complex.cc: Fix Origin:.
+
+ * acinclude.m4: Patch only once!
+
+2000-02-09 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * testsuite/26_numerics/buggy_complex.cc: New file.
+
+2000-02-05 Petter Urkedal <petter@matfys.lth.se>
+
+ * acinclude.m4: New GLIBCPP_CHECK_COMPLEX_SUPPORT macro. Based
+ on the 1999-11-21 entries by Mumit Khan.
+ * configure.in: Use.
+ * acconfig.h: New _GLIBCPP_BUGGY_COMPLEX macro.
+ * bits/std_complex.h: Use.
+
+2000-02-04 Philip Martin <pm@corris.dircon.co.uk>
+
+ * stl/bits/stl_algobase.h: Add traits based dispatch for
+ __normal_iterator in the copy_backward()algorithm
+ * stl/bits/stl_vector.h: Reduce use of __normal_iterator
+ base() function.
+
+2000-02-04 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * src/gen-num-limits.cc (signal_handler): Work around signal
+ handling problem on Cygwin.
+ Thanks to Chris Faylor <cgf@cygnus.com>.
+
+2000-02-03 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * configure.in: Add (preliminary) support for cross compiles and
+ multilibs.
+ Remove AC_C_BIGENDIAN tests. Why is this necessary? Cross
+ compilation freaks on this.
+ * configure: Regenerate.
+ * src/Makefile.am: Add support for cross compiles.
+ * src/Makefile: Regenerate.
+ * Makefile.am: Add support for cross compiles.
+ * Makefile.in: Regenerate.
+
+2000-02-02 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * configure.in (LIBS): Remove unused subdirs.
+ * configure: Regenerate.
+ * Makefile.am (SUBDIRS): And here.
+ * Makefile.in: Regenerate.
+ * src/Makefile.am (sources): And here.
+ * src/Makefile.in: Regenerate.
+ * string/*: Remove.
+ * amm1/*: Remove.
+ * generic/*: Remove.
+ * glibc/*: Remove.
+ * mkcheck.in (INC_PATH): Include $BUILD_DIR before any source dirs.
+
+ * libtool: Update to libtool-1.3.4.
+ * ltconfig: Same
+ * ltmain.sh: Same
+ * config.sub: Same.
+ * config.guess: Same.
+
+2000-02-02 Benjamin Kosnik <bkoz@cygnus.com>
+ Alexandre Petit-Bianco <apbianco@cygnus.com>
+
+ * mkc++config: New file. Put autoconf macros into _GLIBCPP_
+ namespace instead of polluting global namespace with duplicate
+ autoconf output.
+ * configure.in (AC_OUTPUT): Don't need to generate bits/config.h
+ here anymore. . .
+ (AC_OUTPUT_COMMANDS): Make it here.
+ * configure: Regenerate.
+ * bits/c++config.h.in (_CPP_CPPCONFIG): Change. Tweak. Remove
+ endif, as now we will add it manually.
+ Move to this file. . .
+ * bits/c++config.h: New file. Same as old c++config.h.in except
+ the ending macro guard is now appended manually.
+
+ * bits/locale_facets.tcc: Change HAVE_* macros to _GLIBCPP_HAVE_*.
+ * bits/std_cmath.h: Same here.
+ * bits/std_cwchar.h: And here.
+ * src/locale.cc: And here.
+ * src/complexl.cc: And here.
+ * math/mathconf.h: Change to include "config.h" instead of
+ bits/c++config.h.
+
+2000-02-01 Benjamin Kosnik <bkoz@gnu.org>
+
+ * configure.in: Add support for threads. Try a model closer to
+ libjava, as hopefully if the thread bits are added carefully
+ enough, the source code will not have gross hacks. Besides, the
+ libstdc++-v2 model could be easily emulated without the necessity
+ of linking files in (as currently done)--all that needs to be done
+ is AC_DEFINE(-D_PTHREADS) etc. However, let's try something
+ new. . . and see if we arrive at a more elegant solution.
+ * configure: Regenerated.
+ * config/threads-no.h: New file.
+ * config/threads-posix.h: New file.
+ * src/Makefile.am (myinstallheaders): Install c++threads.h.
+ * src/Makefile.in: Regenerated.
+
+2000-01-31 Benjamin Kosnik <bkoz@gnu.org>
+
+ META-QUESTION: Can we just make a "header.html" file and a
+ "footer.html" and just include them in all the doc sub-pages. The
+ duplication of the header info is kind of gross, and weak
+ considering that if you change order or layout then all this stuff
+ has to be changed in all the sub-files.
+
+ * docs/17_intro/contribute.html: Take out duplicate file info.
+ * README: Should just contain a link to the docs/index.html
+ page. Duplicate information removed.
+ * docs/faq/index.html: Remove indexes into HOWTOS.
+ * docs/17_intro/howto.html: Make intro and docs part more
+ centralized. Move intro stuff to documentation.html.
+ * docs/how.html: Tweak. Does this file need to exist? What calls it?
+ * docs/README.html: Move documentation files to
+ documentation.html. Should this file be renamed
+ "config_and_install.html" as that is what is apparently covered
+ here. . .
+ * docs/install.html: Yes. New file, moved and renamed README.html.
+ * docs/documentation.html: New file. This is the index file for
+ the documentation.
+ * docs/index.html: Edit sidebar order. Insert new link to new
+ documentation spine, documentation.html.
+
+2000-01-31 Scott Snyder <snyder@fnal.gov>
+
+ * bits/istream.tcc (operator>>(istream&, string&)): Set failbit if
+ we don't extract any characters.
+ * testsuite/21_strings/inserters_extractors.cc (main): New tests.
+
+2000-01-31 Anders Widell <awl@hem.passagen.se>
+
+ * stl/bits/std_bitset.h (_M_do_left_shift): Handle case when shift
+ step is a multiple of the word size.
+ (_M_do_right_shift): Same.
+ * testsuite/23_containers/bitset_shift.cc: New file.
+
+2000-01-31 Nathan Myers <ncm@zembu.com>
+
+ * README (Documentation): Add path info, fix typos.
+
+2000-01-26 Benjamin Kosnik <bkoz@redhat.com>
+
+ * bits/locale_facets.tcc (num_get::_M_extract): Add the freaking
+ crazy group checking for numpunct, for real this time. At some
+ point, the local variable __grp should probably get replaced a
+ char array, or something a bit more lightweight.
+ (num_get::do_get(bool)): Simplify. Don't set bool reference to
+ parsed value unless err isn't failbit.
+ (num_get::do_get(*)): Same, make consistent.
+
+ Nathan Myers <ncm@zembu.com>
+ Jim Parsons <parsons@clearway.com>
+ * testsuite/27_io/istream_extractor_arith.cc (test08): Add
+ more grouping tests, tweak, scold, wine.
+
+2000-01-24 Benjamin Kosnik <bkoz@gnu.org>
+
+ * testsuite/27_io/istream_extractor_arith.cc (test07): Add
+ grouping tests.
+ * bits/locale_facets.tcc (num_get::_M_extract): Change to fix
+ grouping bugs. Only allow thousands_sep if _M_use_groupings is
+ true.
+
+ via <llewelly@198.dsl.xmission.com>
+ * stl/bits/stl_vector.h (vector::_M_range_check): Throw
+ out_of_range instead of range_error.
+
+2000-01-17 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/std_iomanip.h (setw): Fix typo.
+
+2000-01-14 Benjamin Kosnik <bkoz@gnu.org>
+
+ * testsuite/27_io/istream_extractor_arith.cc: Fix.
+ * bits/locale_facets.tcc (do_get(...void)): Change to strtoul.
+ * testsuite/27_io/istream_unformatted.cc (test04): Tweak.
+
+2000-01-14 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * docs/README.html: Reformat, more installation instructions.
+ * docs/gccrebuild.html: New file.
+ * docs/faq/index.html: Update for new testsuite output filenames.
+ * docs/faq/index.txt: Regenerate.
+
+2000-01-14 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * Makefile.am (rebuild-stamp, all-local): New targets.
+ * Makefile.in: Regenerated.
+ * acinclude.m4: New macro, GLIBCPP_ENABLE_RELIBGCC.
+ * aclocal.m4: Regenerated.
+ * configure.in: Call new macro. Also do some sanity checks
+ for combinations of --enable's that may not make sense.
+ * configure: Regenerated.
+
+2000-01-13 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * testsuite/27_io/istream_extractor_arith.cc: Add checks for void*.
+ * bits/locale_facets.tcc (do_get::(...void)): Set fmtflags
+ correctly for hex-formatted input.
+
+ * testsuite/27_io/istream_manip.cc (test01): Fix, as per setting
+ eofbit instead of eofbit | failbit.
+ * testsuite/27_io/istream_unformatted.cc (test04): Fix, as
+ ifstreams now are opened or'd with ios_base::in (as is correct).
+ * bits/fstream.tcc (filebuf::seekoff): Simplify.
+ * testsuite/27_io/ios_base_members_static.cc (test01): Fix thinko.
+
+2000-01-12 Benjamin Kosnik <bkoz@gnu.org>
+
+ * bits/std_fstream.h: Add ios_base as a friend to basic_filebuf.
+ * bits/basic_file.h (basic_file::filepos_cur): Remove incorrect
+ (misleading) code.
+ (__basic_file::filepos_valid): Same.
+ (__basic_file::filepos_beg): Same.
+ (__baseic_file::get_fileno): New function.
+ * bits/ios_base.h (ios_base::sync_with_stdio): Implement, including
+ feedback from LWG 49.
+ * src/ios.cc: Move definition here.
+ * testsuite/27_io/ios_base_members_static.cc (test01): Add tests.
+
+ * bits/std_sstream.h (_M_really_sync): Simplify argument list. Set
+ output part of internal buffer based on string size, so that
+ _M_out_end is set consistently with filebufs. Correct comments.
+ * bits/sstream.tcc (stringbuf::overflow): Update here too.
+ * testsuite/27_io/stringbuf.cc: Changes.
+
+2000-01-11 Benjamin Kosnik <bkoz@gnu.org>
+
+ * bits/sstream.tcc (seekoff): Set based on end of written buffer,
+ not buffer size.
+ * testsuite/27_io/stringbuf.cc: Add tests for seekoff(end).
+
+ * bits/std_fstream.h (ifstream::open): Add ios_base::in to openmode.
+ (ofstream::open): Add ios_base::out to openmode.
+
+ * bits/locale_facets.tcc (_M_extract): Have consistency between
+ istream::sentry and extractors, where failbit | eofbit is
+ set. Don't change this, but instead change. . (do some formatting
+ tweaks.)
+ * bits/istream.tcc (istream::sentry): Only set eofbit.
+
+2000-01-10 Benjamin Kosnik <bkoz@gnu.org>
+
+ * testsuite/27_io/istringstream_members.cc: New file.
+
+2000-01-09 Benjamin Kosnik <bkoz@gnu.org>
+
+ * bits/istream.tcc (istream::sentry): Flush.
+
+ * configure.in (AC_OUTPUT_COMMANDS): Simplify.
+ * configure: Regenerate.
+ * src/Makefile.am (generated_headers): Remove bits/c++config.h so
+ that make clean will not delete it.
+ * src/Makefile: Regenerate.
+
+2000-01-07 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * mkcheck.in: Use host-specific invocation of size(1);
+ GNU binutils isn't necessarily there (more's the pity).
+
+2000-01-06 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * configure.in (LIBS): Better tests for solaris2.6.
+ * configure: Regenerate.
+
+ <vakatov@ncbi.nlm.nih.gov>
+ * bits/std_sstream.h: As per libstdc++20.
+
+2000-01-06 Benjamin Kosnik <bkoz@gnu.org>
+
+ Break out configuration on solaris.
+ * configure.in (ctype_solaris): Add in bits for solaris2.6 and 2.7.
+ * config/solaris/ctype.cc: Delete and move to proper version.
+ * config/solaris/bits: Same.
+ * config/solaris/solaris2.5: Add this directory, with subdir bits
+ and file ctype.cc. Probably doesn't work.
+ * config/solaris/solaris2.6: Same.
+ * config/solaris/solaris2.7: Same, as per specs via Phil Edwards.
+
+ * Makefile.am: Change paths to mkcheck.
+ * Makefile: Regenerate.
+ * configure.in (AC_OUTPUT_COMMANDS): Build mkcheck here.
+ * configure: Regenerate.
+ * src/Makefile.am (generated_headers): Add bits/c++config.h.
+
+ * mkcheck: Now autogenerated by configure and renamed. . .
+ * mkcheck.in (INC_PATH): Add glue for ctype_include_dir.
+ Have longer-style dates.
+ Raja R Harinath <harinath@cs.umn.edu>
+ * mkcheck: Change path to #!/usr/clocal/bin/bash.
+
+ * docs/README.html: Correct links, maybe. FAQ, install notes, and
+ general documentation need to be organized around each other, not
+ fight against each other. . .
+
+2000-01-04 Phil Edwards <pme@sourceware.cygnus.com>
+ Nicolai Josuttis <nicolai.josuttis@braunschweig.netsurf.de>
+
+ * README: Add a note referring to README.html.
+ * docs/README.html: New file from Nicolai.
+ * docs/faq/index.html: Move "how to get a copy" to here.
+ * docs/gentop/footchunk.html: Update.
+ * docs/gentop/headchunk.html: New links according to
+ bkoz's idea for "How to..." stuff.
+ * docs/gentop/thanks: Actually put people here.
+ * docs/download.html: Regenerated.
+ * docs/index.html, docs/links.html, docs/mail.html,
+ docs/status.html, docs/thanks.html, docs/faq/index.txt: Ditto.
+ * docs/how.html: Ditto. (This file should go away soon.)
+
+1999-12-26 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * docs/gentop/status: Add snapshot version column, update
+ for Solaris 7.
+ * docs/status.html: Regenerated.
+
+1999-12-26 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * docs/faq/index.html: Turn README and RELEASE-NOTES into links
+ from installation FAQ, and specify location of text files.
+ * docs/faq/index.txt: Regenerated.
+
+1999-12-23 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * docs/gentop/download: Add links to prebuilds for Cygwin/Mingw32.
+ * docs/download.html: Regenerated.
+
+1999-12-22 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * docs/faq/index.html: Update 'what works' for .7 snapshot,
+ clean up various links.
+ * docs/faq/index.txt: Regenerated.
+ * docs/gentop/gentop: Smarter regeneration script.
+ * docs/gentop/{head,foot}chunk.html: Updated with new
+ contributors link and mod date.
+ * docs/gentop/index: Snapshot relase date.
+ * docs/gentop/thanks: New contributors page added.
+ * docs/{download,how,index,links,mail,status,thanks}.html:
+ Regenerated from gentop; thanks.html created.
+
+1999-12-21 Benjamin Kosnik <bkoz@decepticon.cygnus.com>
+
+ * bits/c++config.h.in (__GLIBCPP__): 19991221.
+ * docs/index.html: Add correct information.
+
+ * config/irix: New directory.
+ * config/irix/ctype.cc: Add irix-6.5 info. Not tested.
+ * config/irix/bits/ctype_base.h: And here.
+
+ * config/aix: New directory.
+ * config/aix/ctype.cc: Add aix-4.2 info. Not tested.
+ * config/aix/bits/ctype_base.h: And here.
+
+1999-12-21 Philip Martin <pm@corris.dircon.co.uk>
+
+ * bits/basic_string.h: Add special case handling for integral
+ "iterators".
+ * bits/std_string.h: include type_traits.h
+ * testsuite/21_strings/ctor_copy_dtor.cc: Tweak.
+
+1999-12-21 Benjamin Kosnik <bkoz@decepticon.cygnus.com>
+
+ * bits/fstream.tcc (seekoff): Output buffer based on _M_*_in and
+ _M_*_end now.
+ * bits/std_fstream.h (sync): And here.
+ * testsuite/27_io/filebuf.cc: Revisions.
+ * testsuite/27_io/filebuf-2.tst: Correct, remove weird character
+ at the end of the file.
+ * testsuite/27_io/filebuf-3.tst: Correct.
+
+1999-12-21 Phil Edwards <pedwards@jaj.com>
+
+ * docs/gentop/index: Hold off on .7 announcement date.
+ * docs/index.html: Regenerate.
+
+1999-12-21 Benjamin Kosnik <bkoz@kcygnus.com>
+
+ * bits/std_fstream.h (sync): Move _M_file->sync() to
+ _M_really_overflow().
+ * bits/fstream.tcc (seekoff): Call sync, not _M_really_overflow so
+ as to get the _M_file->sync action, which forces the external
+ buffer to update itself.
+ (underflow): Same here.
+
+1999-12-21 Phil Edwards <pedwards@jaj.com>
+
+ * bits/c++config.h.in: Uncomment _GLIBCPP_USE_NAMESPACES and move...
+ * acconfig.h: ...to here.
+ * config.h.in: Regenerate from aclocal.
+ * acinclude.m4: Add GLIBCPP_ENABLE_DEBUG, GLIBCPP_ENABLE_NAMESPACES.
+ * aclocal.m4: Regenerate from acinclude.
+ * configure.in: Use ENABLE macros here.
+ * configure: Regenerate.
+ * src/Makefile.am: Use results from ENABLE macros.
+ * src/Makefile.in: Regenerate.
+
+1999-12-20 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * mkcheck (SRC_DIR): Now have to include config/* dir if "make
+ check" and not "make check-install." Temporarily hack in linux
+ support.
+
+ * bits/std_streambuf.h: Tweaks.
+ * bits/streambuf.tcc (xsgetn): Tweaks.
+ * bits/std_fstream.h (sync): Make _M_really_overflow consistent.
+ * bits/fstream.tcc (filebuf::underflow): Simplify.
+ * bits/std_sstream.h (streambuf::underflow): Minor change to make
+ checks for read position precisely implement the standard.
+ * bits/basic_file.h (filepos_cur): Base this on _offset.
+ * testsuite/21_strings/inserters_extractors.cc (test05): Tweaks.
+ * testsuite/27_io/filebuf.cc: Tweak.
+
+1999-12-20 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * docs/17_intro/RELEASE-NOTES: Fix typos.
+
+ * bits/locale_facets.h (ctype): Modify, use __to_type to abstract
+ out platform-specific bits.
+ * config/default/ctype.cc: And here.
+ * config/defaults/bits/ctype_base.h: And here.
+ * config/linux/ctype.cc: And here.
+ * config/linux/bits/ctype_base.h (ctype_base): And here.
+ * config/solaris/bits/ctype_base.h (ctype_base): Add
+ __to_type. Comment, as it looks like this is for solaris2.6 and
+ above: solaris2.5.1 doesn't seem to have the same definitions.
+ * config/solaris/ctype.cc: And here.
+
+1999-12-19 Benjamin Kosnik <bkoz@cygnus.com>
+ Ulrich Drepper <drepper@cygnus.com>
+
+ * acconfig.h: Remove _GLIBCPP_USE_CTYPE_ISBIT.
+
+ * src/locale.cc: Take out platform-specific hacks.
+ * config/linux/ctype.cc: Put here.
+ * config/solaris/ctype.cc: Put here.
+ * config/default/ctype.cc: Put here.
+
+ * bits/locale_facets.h: Take out platform-specific hacks.
+ * config/linux/bits/ctype_base.h: Put here.
+ * config/solaris/bits/ctype_base.h: Put here.
+ * config/default/bits/ctype_base.h: Put here.
+
+ * configure.in: Bump version.
+ Add tests for top-level config directory.
+ * configure: Regenerated.
+ * src/Makefile.am (INCLUDES): Add platform-specific dir.
+ * src/Makefile: Regenerate.
+
+1999-12-19 Benjamin Kosnik <bkoz@cygnus.com>
+ Ulrich Drepper <drepper@cygnus.com>
+
+ * bits/locale_facets.h: Hack in solaris support.
+ * src/locale.cc: Here too.
+
+1999-12-18 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * docs/17_intro/TODO: Update
+ * docs/17_intro/RELEASE-NOTES (New): Update.
+
+1999-12-17 Benjamin Kosnik <bkoz@milou.cygnus.com>
+
+ * bits/c++config.h.in (__GLIBCPP__): Bump.
+ * docs/17_intro/RELEASE-NOTES: Update, Gaby please add your stuff.
+ * docs/17_intro/TODO: Update.
+
+ * bits/locale_facets.h: Touch this too.
+ * bits/localefwd.h: Add typedefs for loooooong vector names.
+ * bits/locale_facets.tcc (locale::operator()): Need parens.
+ (has_facet): Simplify.
+ * src/locale-inst.cc: Add instantiations.
+ * src/locale.cc: Tweaks.
+
+ * bits/std_streambuf.h: Move indeterminates into. .
+ * bits/std_fstream.h: Here.
+ * bits/fstream.tcc (underflow): Rewind just for ios_base::out
+ streams.
+ * bits/sstream.tcc: Very minor formatting tweaks.
+ * bits/std_streambuf.h (_M_set_determinate): If exclusively an
+ input buffer, set _M_buf to offset.
+ * bits/istream.tcc (std): Tweaks.
+ * testsuite/27_io/istream_unformatted.cc (test05): More tweaks,
+ include fstream.
+ * testsuite/27_io/filebuf.cc: Tweaks.
+
+1999-12-17 Phil Edwards <pedwards@jaj.com>
+
+ * configure.in: Add OPTLEVEL, -O2 for gcc 2.96+, nothing otherwise.
+ * configure: Regenerate.
+ * src/Makefile.am: Use OPTLEVEL in CXXFLAGS.
+ * src/Makefile.in: Regenerate. Also picks up OTHER_CXXFLAGS rename
+ to OPTIMIZE_CXXFLAGS from a previous revision (1.96) to Makefile.am.
+
+1999-12-17 Phil Edwards <pedwards@jaj.com>
+
+ * docs/21_strings/stringtok_std_h.txt: New algorithm
+ suggested by Chris King.
+ * docs/21_strings/howto.html: Link to new version.
+
+1999-12-16 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/valarray_array.h (__valarray_sum): Use operator+=, not
+ operator+.
+ * docs/17_intro/TODO: Update.
+
+1999-12-15 Phil Edwards <pme@sourceware.cygnus.com>
+
+ * docs/gentop/footchunk.html: Updated, fixed CRLFs.
+ * docs/gentop/gentop: Ditto.
+ * docs/gentop/headchunk.html: Ditto.
+ * docs/*.html: Regenerated from gentop.
+ * docs/*/howto.html: Updated as test.
+ * docs/faq/index.html: Updated, fixed CRLFs.
+ * docs/faq/index.txt: Regenerated.
+
+1999-12-15 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * mknumeric_limits (OUT_C): restart only if $OUT_C is present.
+
+ * bits/std_complex.h
+ (complex<float>::complex(const complex<double>&),
+ complex<float>::complex(const complex<long double>&)): Define.
+
+ * docs/17_intro/TODO: Update.
+
+1999-12-13 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/istream.tcc (seekg): Don't set _M_gcount.
+ (tellg): Same.
+ * bits/fstream.tcc (filebuf::underflow): Re-sync
+ external byte sequence's input buffer only. . .
+ * testsuite/27_io/istream_unformatted.cc (test04): New tests for
+ tellg, seekg and filebufs.
+ (test05): Same for stringbufs.
+ * testsuite/27_io/istream_unformatted-2.tst: New file.
+ * testsuite/27_io/istream_unformatted-1.tst: New file.
+ * testsuite/27_io/istream_unformatted-1.txt: New file.
+ * testsuite/21_strings/inserters_extractors.cc (test05): Change
+ output file.
+
+1999-12-13 Phil Edwards <pedwards@jaj.com>
+
+ * docs/gentop/*: New directory, containing bits for the homepages.
+ * docs/*.html: Regenerated from gentop.
+ * docs/*/*.html: Entries added and regenerated.
+
+1999-12-13 Benjamin Kosnik <bkoz@gnu.org>
+
+ Efforts to get -O2 to work with -Winline -Werrors.
+ * bits/valarray_array.h (__valarray_fill(_Tp*, size_t, const
+ _Tp&): Remove inline declaration, as cannot be inlined and
+ -Winline -Werror complains. An interesting question is why this
+ cannot be inlined, as I can see no real reason to disqualify it.
+ (__valarray_product(const _Tp*, const _Tp*)): Same here.
+ * bits/std_valarray.h (valarray::operator[](size_t)): Same here.
+
+ * docs/17_intro/TODO: Update.
+
+1999-12-12 Benjamin Kosnik <bkoz@gnu.org>
+
+ * bits/std_fstream.h (seekpos): Tweaks, fixes. Move definition to
+ fstream.tcc.
+ * bits/basic_file.h (filepos_cur()): Make pointers themselves be
+ the resultant position.
+ * bits/fstream.tcc (seekoff): Explicitly set return value to
+ resultant external byte sequence position, not value returned from
+ _M_file->seekoff. Need to make
+ (seekpos): New definition.
+
+ * bits/istream.tcc (seekg): As per Library Issues List 136, set to
+ just istream. Necessary, or else tellg will give an invalid stream
+ position, but seekg will return a valid stream position, which is
+ not groovy: see testcase addition.
+ * bits/ostream.tcc (seekp): Same.
+
+ * bits/streambuf.tcc (_S_copy_streambufs): Simplify.
+ * bits/sstream.tcc: Tweaks.
+ * bits/locale_facets.tcc: Tweaks.
+ (num_put::do_put(iter_type, ios_base, char_type, const void*)):
+ Re-write in a way that is easier for the inliner to work with.
+ * bits/ios_base.h: Use explicit static_cast<int>(...) notation.
+
+1999-12-10 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/locale_facets.tcc: Tweaks.
+ * bits/locale_facets.h (use_facet): Can't inline, remove inline
+ from declaration.
+ * bits/localefwd.h: And here.
+ * bits/std_ostream.h: Tweaks, sentry ctor can't be inlined.
+ * bits/ostream.tcc: Put here.
+
+ Frank Ch. Eigler <fche@cygnus.com>
+ * src/Makefile.am: Adjust CXXFLAGS, add AM_CXXFLAGS.
+
+1999-12-08 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/sstream.tcc (stringbuf::seekoff): Long overdue revamp. Make
+ in and out buffers update independantly.
+
+ * bits/basic_ios.h: Minor formatting.
+ * bits/fstream.tcc (std): Fix indentation.
+
+1999-12-08 Chip Salzenberg <chip@valinux.com>
+
+ * bits/char_traits.h (char_traits<>): Move not_eof() functions
+ after corresponding eof() functions, so they're easier for the
+ compiler to inline.
+ * bits/locale_facets.h (money_base::__default_pattern): Move
+ static variable out of inline functions.
+ (_Moneypunct<>::do_{pos,neg}_format): Use it.
+ * src/locale-inst.cc (money_base::__default_pattern): Define it.
+
+1999-12-08 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_fstream.h (filebuf::open): Tweak.
+ * bits/fstream.tcc (filebuf::seekoff): Simplify, fix.
+ * bits/std_ios.h: Minor tweaks for headers.
+
+1999-12-06 Benjamin Kosnik <bkoz@gnu.org>
+
+ * bits/c++config.h.in (_GLIBCPP_FULLY_COMPLIANT_HEADERS): New macro.
+ * src/string-inst.cc: Add guards . . .
+ * src/misc-inst.cc: And here.
+ * bits/std_sstream.h: And here.
+ * bits/std_fstream.h: And here.
+ * bits/std_streambuf.h: And here.
+ * bits/std_istream.h: And here.
+ * bits/std_ostream.h: And here.
+
+1999-12-06 Scott Snyder <snyder@fnal.gov>
+
+ * bits/istream.tcc (basic_istream::read): Try to handle __n == 0
+ case.
+ (basic_istream::readsome): And here as well.
+ * testsuite/27_io/istream_unformatted.cc: Test a zero-length
+ read().
+
+1999-12-06 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * bits/istream.tcc (basic_istream::ignore): streamsize is not
+ necessarily an `int'.
+
+1999-12-06 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * mknumeric_limits: Don't use $CXXFLAGS when building
+ gen-num-limits. It's definitely wrong to use it since $CXXFLAGS
+ generally instructs the compiler not to emit template
+ instantiations and we end up with undefined symbols. Sigh.
+
+1999-12-05 Benjamin Kosnik <bkoz@gnu.org>
+
+ * bits/locale_facets.tcc: Tweak.
+ (_S_format_long): Adjust showpos formatting for hex and oct.
+ * bits/std_ostream.h (operator<<(short)): Correctly deal with hex
+ and oct by formatting as unsigned.
+ (operator<<(int)): Same here.
+ * bits/ostream.tcc (operator<<(long)): Same.
+ (operator<<(long long)): Same.
+ (_S_pad_char): Actually treat ios_base::internal as something
+ worth doing correctly. Remove const designation on ios argument.
+ * testsuite/27_io/ios_manip_basefield.cc (test02): Add tests.
+ * testsuite/27_io/ostream_inserter_arith.cc (test03): Add tests.
+
+1999-12-04 Benjamin Kosnik <bkoz@gnu.org>
+
+ * bits/std_sstream.h (streambuf::underflow): Check for mode == in.
+
+1999-12-03 Benjamin Kosnik <bkoz@gnu.org>
+
+ * bits/locale_facets.tcc (num_put::do_put(bool): Fix.
+
+ * bits/sstream.tcc (streambuf::seekoff): Add parens.
+ * bits/istream.tcc (istream::get(sb)): Handle exceptional events.
+ (operator>>(istream, _CharT*)): Change streamsize to int_type.
+ (operator>>(istream, _CharT&)): Fix typedef'd type to be _CharT.
+ * bits/ostream.tcc (ostream::operator<<(const char*)): Stub out
+ unused argument.
+ (ostream::operator<<(_CharT)): Fix.
+
+ * bits/std_sstream.h: Temporarily disable including sstream.tcc to
+ see if this will increase compile speed.
+ * bits/std_ostream.h: Likewise. . .
+ * bits/std_istream.h: And here.
+ * bits/std_fstream.h: And here.
+ * src/misc-inst.cc: Add relevant header file includes for
+ instantiation purposes.
+ * src/string-inst.cc: And here.
+ * testsuite/27_io/ostream_inserter_arith.cc: Add test case.
+
+1999-12-02 Benjamin Kosnik <bkoz@gnu.org>
+
+ * testsuite/27_io/istream_unformatted.cc (test03): Add tests.
+ * bits/istream.tcc (get(streambuf)): More fixes.
+ (istream::ignore): Get specific about numeric_limits<int>::max()
+ requirements.
+
+ * bits/fstream.tcc (filebuf::open): Tweaks for _M_last_overflowed.
+ (filebuf::close): Same.
+ * testsuite/27_io/filebuf.cc: Add tests for ios_base::ate.
+
+1999-12-01 Phil Edwards <pedwards@jaj.com>
+
+ * mkcheck: Support for compilation/execution timing.
+ * testsuite/printnow.c: New file.
+
+1999-12-01 Phil Edwards <pedwards@jaj.com>
+
+ * bits/std_cwchar.h: Test for _GLIBCPP_USE_WCHAR_T.
+ * configure.in: Test for presence of wchar.h before testing
+ for any of its features.
+ * configure: Regenerate.
+
+1999-11-30 Benjamin Kosnik <bkoz@gnu.org>
+
+ Preliminary istream validations complete.
+ * bits/istream.tcc (istream::getline): Fixes. Tweaks to make
+ formatting more consistent. Removal of if-statements inside of for
+ loops.
+ (ignore): Fix.
+ (get): Same.
+ (putback): Same.
+ * bits/std_istream.h: Same.
+ * bits/sstream.tcc (stringbuf::pbackfail): Fix.
+ * testsuite/27_io/stringbuf.cc: Tweak.
+ * testsuite/27_io/istream_unformatted.cc (test02): Mo' tests.
+
+ * bits/ostream.tcc (ostream::operator<<(arith)): Set badbit, not
+ failbit on failure, as per 27.6.2.5.2.
+
+ * stl/bits/std_vector.h: Allow bool specializations. Should move
+ ext/std_bvector to bits, not ext, maybe.
+
+1999-11-30 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * configure.in: Fix checks for mbstate_t and WCHAR_MIN/MAX.
+ * configure: Regenerate.
+
+999-11-29 Benjamin Kosnik <bkoz@gnu.org>
+
+ * bits/istream.tcc (get(streambuf, char)): Fix.
+ * testsuite/27_io/istream_unformatted.cc (test03): Add tests.
+
+1999-11-29 Scott Snyder <snyder@fnal.gov>
+
+ * bits/basic_string.h (append(const _Char*, size_type)): The
+ length of the appended string is given exactly by the second arg,
+ regardless of the data in the character array.
+ * bits/string.tcc (basic_string(const _CharT*, size_type, const
+ _Alloc&)): Likewise.
+ * testsuite/21_strings/append.cc (test01): Remove erroneous test
+ of basic_string::append.
+
+1999-11-29 Chip Salzenberg <chip@valinux.com>
+
+ * Makefile.in: Tweaks for CXXFLAGS.
+ * */Makefile.in: Same.
+
+1999-11-29 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * conficd bgure.in: Check for wide character support.
+ * bits/c++config.h.in (_GLIBC_USE_WCHAR_T): Move from here ...
+ * acconfig.h (_GLIBC_USE_WCHAR_T): to here.
+ * bits/string.tcc (wstring::_S_find): Guard wchar_t specialization.
+
+1999-11-29 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * acinclude.m4: Fix typo.
+ * src/complex.cc: Fix macro line continuation.
+
+1999-11-29 Petter Urkedal <petter@matfys.lth.se>
+
+ * src/Makefile.am (CXXFLAGS): Add -Wno-format to allow non-
+ string literals in format, as used in locale-facets.tcc.
+
+1999-11-28 Benjamin Kosnik <bkoz@gnu.org>
+
+ * testsuite/27_io/istream_unformatted.cc (test03): Add tests.
+ * bits/istream.tcc (istream::get): Extract to argument minus one.
+ Various tweaks and fixes.
+
+1999-11-22 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * bits/locale_facets.tcc: Workaround for compiler crash on
+ ix86-*-mingw32.
+
+1999-11-21 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * acinclude.m4: New file. New _GLIBCPP_CHECK_FLOAT_SUPPORT macro.
+ * configure.in: Use.
+ * acconfig.h: New _GLIBCPP_BUGGY_FLOAT_COMPLEX macro.
+ * src/complexf.cc: New _GLIBCPP_FLOAT_SPECIALIZATION macro.
+ * bits/std_complex.h: Use.
+ * src/complex.cc: Use.
+
+1999-11-19 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * testsuite/18_support/numeric_limits.cc: Add missing std:: prefix.
+ * testsuite/21_strings/inserters_extractors.cc: Likewise.
+ * testsuite/22_locale/ctype.cc: Likewise.
+ * testsuite/23_containers/multiset.cc: Likewise.
+ * testsuite/23_containers/vector_ctor.cc: Likewise.
+ * testsuite/26_numerics/binary_closure.cc: Likewise.
+ * testsuite/27_io/fpos.cc: Likewise.
+ * testsuite/27_io/ios_base_callbacks.cc: Likewise.
+ * testsuite/27_io/istream_extractor_arith.cc: Likewise.
+ * testsuite/27_io/istream_extractor_char.cc: Likewise.
+ * testsuite/27_io/istream_extractor_other.cc: Likewise.
+ * testsuite/27_io/istream_sentry.cc: Likewise.
+ * testsuite/27_io/ostream_inserter_char.cc: Likewise.
+ * testsuite/27_io/ostream_inserter_other.cc: Likewise.
+ * testsuite/27_io/streambuf.cc: Likewise.
+ * testsuite/27_io/stringstream.cc: Likewise.
+
+1999-11-19 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/valarray_meta.h: Don't forget to define tanh
+
+1999-11-18 Philip Martin <pm@corris.dircon.co.uk>
+
+ * src/stl-inst.cc: Use typedef to refer to iterator
+ * stl/bits/stl_algobase.h: Add traits based dispatch for
+ __normal_iterator in the copy()algorithm
+ * stl/bits/type_traits.h: Add _Is_normal_iterator trait support
+
+1999-11-18 Kevin Ediger <kediger@licor.com>
+
+ * src/locale.cc (locale::_Imp::_Imp): Use auto_ptr to make
+ constructors for locale::_Impl exception safe.
+
+1999-11-18 Scott Snyder <snyder@fnal.gov>
+
+ * stl/bits/stl_queue.h: The C++ standard gives the default for the
+ _Sequence template argument of priority_queue<> as vector<>, not
+ deque<>.
+
+1999-11-18 Benjamin Kosnik <bkoz@gnu.org>
+
+ * bits/std_sstream.h (stringbuf::_M_really_sync): Add __iend as a
+ parameter.
+ * bits/sstream.tcc: Adjust here too.
+
+1999-11-17 Benjamin Kosnik <bkoz@gnu.org>
+
+ * bits/sbuf_iter.h (istreambuf_iter::equal): Tweak.
+ * bits/istream.tcc (operator>>): Replace iostate(0) with
+ iostate(ios_base::goodbit), which is the same thing, but hopefully
+ a bit clearer.
+ * bits/locale_facets.tcc (do_get(bool)): Streamline, deal with
+ libraries issue list 17.
+ (do_gets): Don't set goodbit explicitly, instead only set on
+ failures as good bit is the default setting.
+ * bits/ios_base.h (setf): Set correctly.
+ * bits/fstream.tcc: Tweak.
+ * bits/std_sstream.h (_M_really_sync): Fix ibuffer positioning for
+ in|out bufs that are empty. . .
+ * testsuite/27_io/istream_extractor_arith.cc (test03): Add.
+
+1999-11-16 Benjamin Kosnik <bkoz@gnu.org>
+
+ * testsuite/27_io/streambuf.cc (class testbuf): Don't set _M_buf_size.
+ * bits/std_streambuf.h (setp): Set _M_buf_size, _M_mode.
+ Add comments "all about _M_buf."
+ (setg): Set _M_mode.
+
+1999-11-16 Kevin Ediger <kediger@licor.com>
+
+ * bits/locale_facets.tcc (_S_build_float_format): New function.
+ (_S_output_float): New function.
+ (num_put::do_put(double)): Use 'em.
+ (num_put::do_put(long double)): Use 'em.
+ * testsuite/27_io/ostream_inserter_arith.cc: New file.
+
+1999-11-15 Scott Snyder <snyder@fnal.gov>
+
+ * bits/basic_file.h: Type of __off parm should be __c_streampos, to
+ match how libio is calling us.
+ * src/basic_file.cc (sys_seek): Likewise.
+ * bits/std_fstream.h (basic_filebuf::sync): Restore sync call.
+
+1999-11-15 Benjamin Kosnik <bkoz@gnu.org>
+
+ * docs/17_intro/contribute.html: Add link to assignment form.
+ * docs/17_intro/libstdc++-assign.txt: New file.
+
+ * mkcheck (TESTS_FILE): Move a copy of test files as well as
+ output files.
+
+ * bits/std_streambuf.h (_M_buf_bump): New function.
+ * bits/streambuf.tcc: Mods to support _M_buf_bump.
+ (xsputn): Here. Also add checks for output valid.
+ (xsgetn): Add checks for input valid.
+ (sputc): Here.
+ (sgetc): Set _M_in_end to _M_buf + _M_buf_end.
+ * bits/std_sstream.h (_M_really_sync): Set _M_buf.
+ Set _M_out_end to variable-length-end.
+ * bits/sstream.tcc (overflow): Use _M_buf_bump.
+ (seekpos): Same.
+ (seekoff): Same.
+ * bits/fstream.tcc (std): Tweak formatting.
+ (filebuf::overflow): Simplify.
+ (filebuf::showmanyc): Same.
+ (filebuf::underflow): Same.
+ * testsuite/27_io/filebuf.cc: Fix.
+ * testsuite/27_io/ostream_inserter_other.cc: Fix.
+ * testsuite/27_io/ostream_inserter_other-2.tst: New file.
+ * testsuite/27_io/stringbuf.cc: Tweak.
+ * testsuite/27_io/streambuf.cc: Tweak.
+ * testsuite/27_io/istream_extractor_other.cc: Fix.
+
+1999-11-11 Matthias Klose <doko@cs.tu-berlin.de>
+
+ * stl_deque.h: Use static_casts<size_type>(signed_type).
+
+1999-11-11 Benjamin Kosnik <bkoz@gnu.org>
+
+ Cleanups for callbacks, more regression hunting. Remaining
+ failures (1) due to last unresolved stringstream issues, not
+ regressions per se.
+ * bits/std_fstream.h: Revert. Disable call to _M_file->sync as
+ killing 27_io/filebuf.cc tests. . . need another solution.
+
+ * bits/streambuf.tcc (_S_copy_streambufs): Fix.
+ * testsuite/27_io/istream_extractor_other.cc: Tweak comments.
+
+ * bits/basic_ios.h: Add cached facets here. UGH. The standard
+ foils all attempts at a graceful, minimal implementation.
+ * bits/basic_ios.tcc: Tweaks.
+ * bits/istream.tcc: Fix.
+ * bits/ostream.tcc: Fix.
+ * bits/std_istream.h: Fix.
+ * bits/std_ostream.h: Fix.
+ * src/ios.cc (ios_base::imbue): Set _M_locale_ios before calling
+ callbacks.
+ * bits/locale_facets.tcc (std): Minor, minor formatting tweak.
+ (_S_pad_numeric): Make comprehensible.
+
+1999-11-10 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_ostream.h: Add callbacks for _M_fnumput.
+ (_S_ostream_fcache): New function.
+ Move functions out-of-line.
+ * bits/ostream.tcc: Put here.
+
+ * bits/std_istream.h: Add callbacks for _M_fnumget.
+ (_S_istream_fcache): New function.
+ Move functions out-of-line.
+ * bits/istream.tcc: Put here.
+
+ * bits/basic_ios.tcc (basic_ios::imbue): Tweaks, remove call to
+ _M_call_callbacks(), as ios_base::imbue does this already.
+ * src/ios.cc (register_callback): Clean.
+ (_M_call_callbacks): Same.
+ * bits/ios_base.h: Callback work.
+ * testsuite/27_io/ios_base_callbacks.cc (test01): New file.
+
+1999-11-10 Benjamin Kosnik <bkoz@cygnus.com>
+ Matthias Klose <doko@cs.tu-berlin.de>
+
+ * stl/ext/stl_rope.h: Fix initialization order.
+
+1999-11-09 Scott Snyder <snyder@fnal.gov>
+
+ * bits/std_fstream.h (basic_filebuf::sync): Unconditionally call
+ _M_file->sync() so that redirection works correctly.
+
+1999-11-09 Benjamin Kosnik <bkoz@gnu.org>
+
+ * bits/istream.tcc: Re-order.
+ * bits/std_istream.h: Fix getline problems.
+ * testsuite/27_io/istream_unformatted.cc: New tests.
+
+ Clean up regressions.
+ * bits/std_sstream.h: Set initial stringbufs correctly.
+
+1999-11-09 Scott Snyder <snyder@fnal.gov>
+
+ * stl_vector.h (_M_range_insert): Fix mixing pointers and
+ vector::iterator.
+ * testsuite/23_containers/vector_modifiers.cc (test01): New file,
+ tests.
+
+1999-11-09 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * src/Makefile.am (CXXFLAGS): Add -Winline.
+ * src/Makefile.in: Regenerate.
+
+1999-11-05 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/valarray_meta.h (_DEFINE_EXPR_UNARY_FUNCTION): When
+ building meta-expressions don't forget to take the contained
+ closures.
+
+1999-11-02 Benjamin Kosnik <benjamin@cygnus.com>
+
+ * configure: Regenerate.
+
+1999-11-02 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/valarray_meta.h (_Expr<>::sum): Tweak. Use copy-initialization
+ syntax.
+ * bits/valarray_meta.h (min): Likewise.
+ * bits/valarray_meta.h (max): Likewise.
+
+1999-11-01 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_sstream.h (_M_really_sync): Take into account in | out bufs.
+ * bits/std_streambuf.h (_S_copy_streambufs): New function.
+ * bits/streambuf.tcc: Define.
+ * bits/istream.tcc (istream::operator>>(streambuf)): Rewrite.
+ * bits/ostream.tcc (ostream::operator<<(streambuf)): Rewrite.
+ * testsuite/27_io/ostream_inserter_other.cc: Add tests.
+ * testsuite/27_io/ostream_inserter_other-1.tst: New file.
+
+ * bits/basic_string.h: Explicitly cast npos to unsigned type,
+ reported by Richard Atterer.
+ * bits/char_traits.h: For consistency's sake, here too.
+
+ * configure.in: Bump version to 2.90.7.
+
+1999-10-31 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * testsuite/27_io/ostream_inserter_char-1.tst: Check file output.
+ * testsuite/27_io/ostream_inserter_char.cc (test05, test01): Add tests.
+ * bits/streambuf.tcc (xsputn): Treat--size const char for long loops.
+ (xsgetn): Same.
+ * bits/sstream.tcc (seekpos): Tricks, mostly: check _M_mode before
+ writing into buffer.
+ (seekoff): Same.
+
+1999-10-29 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/valarray_array.h (__valarray_sum): New function.
+ * bits/valarray_array.h (__valarray_product): Same.
+
+ * bits/std_valarray.h (valarray<T>::product): Comment out.
+ * bits/std_valarray.h (valarray<T>::sum): Use __valarray_sum
+ instead of accumulate.
+
+ * src/valarray-inst.cc: Remove explicit intantiation of
+ class multiplies<size_t>, accumulate, valarray<size_t>::product.
+ * src/valarray-inst.cc (__valarray_product): Instantiate
+ explicitly.
+ * src/valarray-inst.cc (__valarray_product(const
+ valarray<size_t>&)): New function.
+ * src/valarray-inst.cc (gslice::_Indexer::_Indexer): Don't use
+ valarray<size_t>::product. Use __valarray_product instead.
+
+
+1999-10-25 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_ostream.h (ostream.inserters.char): Correctly pad output.
+ (_S_pad_char): New function. Not done: ios_base::internal.
+ * bits/ostream.tcc: Clean for above.
+ * bits/locale_facets.tcc (_S_fill): Remove ostreambufiterator
+ specialization that was commented out, as ostreams now have to
+ correctly deal with padding.
+ * testsuite/27_io/ostream_inserter_char.cc (main): Add tests.
+
+ * testsuite/21_strings/ctor_copy_dtor.cc(test02): Add test case
+ from mailing list. This is a bug, and should be fixed.
+ * testsuite/21_strings/inserters_extractors.cc (main): Tweak, fix typo.
+
+1999-10-22 Petter Urkedal <petter@matfys.lth.se>
+
+ * stl/bits/stl_numeric.h (__power): Replaced argument name `__opr'
+ to avoid conflict with gcc name mangling.
+ * stl/bits/stl_algo.h (__transform): Same.
+
+1999-10-21 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/ios_base.h: Change argument names.
+ * docs/17_intro/BADNAMES: Add __opr.
+
+1999-10-20 Benjamin Kosnik <bkoz@decepticon.cygnus.com>
+
+ Work on compilation slowdowns from 10-5 to 10-12, which are
+ related to the _Callback_list inlining/merge-ifcation, which is
+ still a pending issue, but this stuff is necessary cleanup anyway.
+
+ * src/ios.cc: Re-arrange.
+ * bits/ios_base.h: Tweak.
+ * bits/basic_ios.tcc: Move out of line definitions here, move
+ small out-of-line definitions inline.
+ * bits/basic_ios.h: From here.
+
+ * bits/streambuf.tcc (pbackfail, overflow): Move back inline.
+ * bits/std_streambuf.h: From here.
+
+1999-10-19 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * testsuite/27_io/istream_extractor_char.cc: Add tests.
+ * bits/std_istream.h: Tweaks--set eofbit on eof condition.
+ * bits/istream.tcc (operator>>(istream&, string&): Remove
+ vestigial issspace hacks and use ctype::is instead.
+ (getline): Remove unnecessary loops, fortify and pasteurize.
+ (ws): Same.
+
+1999-10-18 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/istream.tcc (operator>>): Tweak.
+ * bits/std_istream.h: Fix according to library issues list 68.
+ Add typedefs.
+
+ * bits/locale_facets.h: Fix table_size to be non-zero.
+
+1999-10-18 Vadim Egorov <egorovv@HotPOP.com>
+
+ * src/basic_file.cc: ifdef instead of comment for binary mode
+
+1999-10-18 Russell Davidson <russell@qed.econ.queensu.ca>
+
+ * bits/std_sstream.h: Stringbuf initialization based on actual,
+ not allocated, size.
+ * testsuite/21_strings/inserters_extractors.cc (test06): Add test
+ case.
+
+1999-10-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * testsuite/26_numerics/c_math.cc (test03): Tweak.
+ * testsuite/27_io/istream_manip.cc (test01): Corrections due to
+ sentry change.
+ * testsuite/21_strings/inserters_extractors.cc (test01): Same.
+
+1999-10-14 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_istream.h: Tweaks.
+ * bits/istream.tcc (istream::sentry::sentry()): Simplify, correct
+ as per issues list addition--set failbit, eof on empty buffers.
+ * testsuite/27_io/istream_sentry.cc: New file.
+
+1999-10-12 Chris Prince <prince@wcug.wwu.edu>
+
+ * bits/std_cstdio.h: Remove Solaris hacks.
+
+1999-10-12 Phil Edwards <philip.edwards@sn.wpafb.af.mil>
+
+ * docs/index.html: Fix minor typos and tweaks.
+ * docs/17_intro/contribute.html: Ditto.
+ * docs/*/howto.html: Ditto. More "EGCS"->"GCC" conversion, notes on
+ thread safety and binary I/O, links to external sites.
+ * docs/faq/index.html: EGCS/GCC cleanup, new entries for Cygwin
+ and MT.
+
+1999-10-12 Petter Urkedal <petter@matfys.lth.se>
+
+ * bits/std_cmath.h (abs(float)): When ::absf is not present, call
+ ::fabs(double) rather than ::abs(int).
+
+1999-10-11 Benjamin Kosnik <bkoz@milou.cygnus.com>
+
+ * bits/std_streambuf.h: Fix minor blip--should explicitly return
+ *gptr(), not the result of underflow.
+ (pbackfail): Conform to default behavior.
+ (overflow): Same.
+ * bits/streambuf.tcc: Add out-of-line streambuf members.
+ (xsputn): Tweak.
+ (xsgetn): Tweak.
+ * testsuite/27_io/streambuf.cc: New file.
+ * testsuite/27_io/filebuf.cc: Correct test.
+
+1999-10-08 Benjamin Kosnik <bkoz@haight.constant.com>
+
+ * bits/std_cmath.h: Correctly cast int to double.
+ * testsuite/26_numerics/c_math.cc: Add test.
+
+ * mknumeric_limits (OUT_C): Tweaks.
+ * src/gen-num-limits.cc: Checks for WCHAR_MIN, WCHAR_MAX before
+ trying to instantiate type_traits<wchar_t>.
+ * acconfig.h: Add _GLIBCPP_HAS_WCHAR_MIN_MAX.
+ * configure.in (LIBS): Plus checks for WCHAR_MIN, WCHAR_MAX.
+ * configure: Regenerate.
+
+1999-10-06 Benjamin Kosnik <bkoz@milou.cygnus.com>
+
+ * bits/streambuf.tcc (streambuf::xsgetn): Rewrite.
+ (streambuf::xsputn): Put in break.
+ Aiming for parity between these two (mostly) similar functions.
+ Need to re-write tests.
+
+ * bits/ios_base.h (ios_base::_M_copy_base): Remove declaration.
+ Make data members protected, not private.
+ * src/ios.cc (ios_base::_M_copy_base): Move _Callback_list into
+ ios_base.h. As called only once, collapse into . . .
+ * bits/basic_ios.h (basic_ios::copyfmt): Fix.
+ (basic_ios::clear): Throw ios_base::failure on occasion.
+ (basic_ios::exceptions): Fix.
+ * testsuite/27_io/ios_members.cc (test02): Add tests.
+
+ * bits/fpos.h: Default initialize.
+ * testsuite/27_io/fpos.cc (test03): Add test.
+
+1999-10-04 Russell Davidson <russell@qed.econ.queensu.ca>
+
+ * src/basic_file.cc: Fix open modes.
+
+1999-10-04 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/locale_facets.tcc (num_get<>::do_get): Fix typo.
+
+1999-09-23 Benjamin Kosnik <bkoz@milou.cygnus.com>
+
+ * bits/streambuf.tcc: Yea. Fix this for real.
+ * testsuite/27_io/ostream_inserter_other.cc: Add file.
+ * src/Makefile.*: Regenerate.
+
+1999-09-22 Benjamin Kosnik <bkoz@milou.cygnus.com>
+
+ * bits/std_cstdlib.h: Add more linux-specif hacks to the header
+ files so that stdtof and strtold will be declared. Some hacks
+ already exits in bits/std_cctype.h -- these should all be removed
+ at a later date.
+ * bits/locale_facets.tcc: Add cstring.h include.
+ _S_format_long: Use long, not int.
+ Add std_limits.h include, for numeric_limits.
+ * testsuite/27_io/istream.cc: Make instantiations work when using
+ -fhonor-std.
+ * testsuite/27_io/ostream.cc: Same.
+
+1999-09-21 Benjamin Kosnik <bkoz@milou.cygnus.com>
+
+ * bits/fpos.h (fpos::operator streamoff): Make const, don't return
+ a reference. Same for operators == and !=.
+ * testsuite/27_io/fpos.cc: Add tests.
+
+1999-09-21 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/valarray_array.h: Fix typo.
+
+ * mknumeric_limits: Make sure we are regenerating things from
+ scratch. Otherwise things get redefined. Not good.
+
+1999-09-20 Benjamin Kosnik <bkoz@milou.cygnus.com>
+
+ * bits/std_ostream.h: Fix typo.
+ * bits/std_istream.h: Same.
+ * bits/std_iomanip.h: Same.
+
+ * bits/istream.tcc (sentry::sentry()): Remove optional tie with
+ ostream, as happens with underflow anyway.
+ * testsuite/27_io/istream.cc (main): New file.
+ * testsuite/27_io/ostream.cc (main): New file.
+ * testsuite/27_io/istream_unformatted.cc: Add tests.
+
+ * src/Makefile.am (headers): Add new file.
+ * src/Makefile.in (headers): Regenerated.
+
+ * bits/basic_ios.h: Remove local-related files.
+ * bits/basic_ios.tcc: New file, add locale-related items.
+ * src/misc-inst.cc: Add include of basic_ios.tcc, as a hack for now.
+ * testsuite/27_io/ios_members_static.cc: Change to
+ * testsuite/27_io/ios_base_members_static.cc: This.
+ * testsuite/27_io/ios_members.cc: New file.
+ * testsuite/27_io/stdios_basefield_manip: Change to
+ * testsuite/27_io/ios_manip_basefield.cc: This.
+ * testsuite/27_io/stdios_fmtflags_manip: Change to
+ * testsuite/27_io/ios_manip_fmtflags.cc: This.
+
+ * bits/fpos.h: Fix discarding qualifiers on this when
+ using _M_position with a const fpos.
+ * bits/std_iosfwd.h: Tweak.
+ * testsuite/27_io/fpos.cc: New file.
+
+1999-09-17 Benjamin Kosnik <bkoz@milou.cygnus.com>
+
+ * bits/streambuf.tcc (streambuf::xsputn): Tweak.
+ * bits/ostream.tcc: Tweak.
+ * testsuite/21_strings/inserters_extractors.cc (test04, test05):
+ Add new regressions.
+
+1999-09-16 Benjamin Kosnik <bkoz@milou.cygnus.com>
+
+ * bits/basic_ios.h: Inline, tweak.
+ * bits/fstream.tcc (basic_filebuf::_M_really_overflow): Tweak,
+ pass back accurate return value to basic_filebuf::overflow.
+ * bits/streambuf.tcc (streambuf::xsputn): Fix overflow accounting.
+ This fixes sstream problems reported in libstdc++/9, but screws up
+ filebufs. That solution is pending.
+
+1999-09-15 Vadim Egorov <egorovv@1c.ru>
+
+ * bits/streambuf.tcc (basic_streambuf::xsputn): Add check for
+ zero count puts.
+ * testsuite/21_strings/inserters_extractors.cc (test01): Add test.
+
+1999-09-08 Benjamin Kosnik <bkoz@milou.cygnus.com>
+
+ * bits/c++config.h.in: Add emacs hints.
+
+ * stl/bits/stl_range_errors.h: Don't define here, for now define
+ in stdexcept.cc along with string inlines __length_error, etc.
+ * src/stdexcept.cc: Define here.
+ * stl/bits/stl_config.h (__STL_CAN_THROW_RANGE_ERRORS): Enable, so
+ at(size_t) will be declared/defined.
+ (__STL_THREADS): Fix mess surrounding use of this, enable.
+
+1999-08-31 Benjamin Kosnik <bkoz@milou.cygnus.com>
+
+ * testsuite/27_io/istream_extractor_arith.cc: Fix.
+ * src/localename.cc: Tweak formatting, fix assignment to
+ const compiler errors.
+
+1999-08-25 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * acconfig.h: Add absf, cosf.
+ * configure.in (use_builtin_sinf): Same.
+ * configure: Regenerate.
+ * bits/std_cmath.h: Add mess of defines.
+ * testsuite/26_numerics/modf_float.cc: Change to
+ * testsuite/26_numerics/c_math.cc: This.
+
+ * src/locale.cc: Change.
+ * bits/locale_facets.h: Fix.
+ * testsuite/22_locale/ctype.cc: Add temporary tests.
+
+1999-08-24 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/fpos.h: Test.
+
+ * docs/index.html: Add powerpc-linux-gnu results with gcc-2.95.1.
+ Fix database name for "libstdc++".
+
+1999-08-23 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * mknumeric_limits (numeric_limits): Add default definitions to
+ member functions.
+ * testsuite/18_support/numeric_limits.cc: New file.
+
+1999-08-18 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_istream.h: Correct initialization.
+ * bits/std_ostream.h: Likewise.
+ * bits/std_sstream.h: Likewise.
+ * bits/std_fstream.h: Likewise.
+ * testsuite/27_io/stringstream.cc: Add test case.
+
+ * bits/std_sstream.h: Replace ____string_type with __string_type.
+ * bits/basic_ios.h (basic_ios::rdbuf(sb*): Call clear(), as required.
+ * bits/std_ostream.h: Tweak dtor.
+
+1999-08-17 Benjamin Kosnik <bkoz@decepticon.cygnus.com>
+
+ * src/Makefile.am (CXXFLAGS): Add -O2.
+ * src/Makefile.in: Likewise.
+
+ * src/gen-num-limits.cc: Conditionally allow wchar_t. See what
+ this breaks. . .
+ * mknumeric_limits (numeric_limits): Uglify.
+
+ * bits/std_istream.h: Fix warnings.
+ * bits/locale_facets.tcc: Collateral damage from
+ char_traits<char>::int_type change.
+
+ * testsuite/27_io/istream_extractor_char.cc: Terminate strings.
+
+1999-08-17 Benjamin Kosnik <bkoz@decepticon.cygnus.com>
+
+ * docs/index.html: Add mailing list form.
+ * docs/27_io/howto.html: Add link to iostreams_hierarchy.pdf.
+
+1999-08-16 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/streambuf.tcc (streambuf::xsputn): Allow copies to continue
+ if overflow successfully allocates more space.
+ * bits/std_sstream.h: Adjust comments.
+ * bits/sstream.tcc (stringbuf::overflow): Copy buffer into string
+ before overflow forces a resize.
+ * testsuite/27_io/ostream_inserter_char.cc: New file.
+
+ * bits/std_fstream.h: Remove declaration.
+ * bits/fstream.tcc: Move uflow.
+ * bits/std_streambuf.h: To here.
+ * bits/streambuf.tcc: Make consistent.
+
+ * src/Makefile.am (WERROR): Enable.
+ * src/Makefile.in: Regenerate.
+ * bits/sbuf_iter.h: Tweak.
+ * bits/char_traits.h: (char_traits<wchar_t>::eof): Use WEOF.
+ Use unsigned int as char_traits<char>::int_type.
+
+ * bits/ostream.tcc (ostream::putc(char)): Tweak.
+ * testsuite/27_io/iostream_objects.cc: Terminate string.
+ Move cin::operator>>(char*) test to extractor_char.cc.
+ * testsuite/27_io/stringstream.cc: Add stringstream instantiation.
+ * bits/std_istream.h (basic_iostream): Make explicit definition
+ for default ctor.
+ * bits/std_sstream.h: Fix typos.
+ * bits/fstream.tcc (_M_init_filebuf): Set to indeterminate for
+ basic_filebuf ctor with fileno open arguments. Thus, filebufs are
+ initialized in a consistent manner, no matter if the underlying
+ FILE/bit bucket is a tty or a text file or some other imaginary
+ construct. This and setting _M_buf_size to 1 for cin allows
+ istream::get(char) to work in a manner consistent with what others
+ expect.
+
+ * docs/index.html: Link Stroustrup's C++ page.
+
+1999-08-12 Michael Cook <cook@sightpath.com>
+
+ * bits/fstream.tcc: Fix signed/unsigned -Wall warning.
+ * bits/istream.tcc: ditto.
+ * bits/sbuf_iter.h: ditto.
+ * bits/std_istream.h: ditto.
+ * src/Makefile.am: Add -Wall to CXXFLAGS.
+ * src/Makefile.in: ditto.
+
+1999-08-12 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+ Russell Davidson <russell@ehess.cnrs-mrs.fr>
+
+ * bits/locale_facets.tcc (_M_extract): Finish off patch from yesterday.
+ * src/Makefile.am (myinstallheaders): Tweak, remove PHONY.
+
+1999-08-11 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * testsuite/27_io/istream_unformatted.cc: New file.
+
+ * testsuite/27_io/istream_extractor_arith.cc (test02): Add more
+ elaborate tests for int types with noskipws.
+
+ * testsuite/27_io/istream_extractor_other-1.txt: New file.
+ * testsuite/27_io/istream_extractor_other-1.tst: New file.
+ * testsuite/27_io/istream_extractor_other-2.tst: New file.
+ * testsuite/27_io/istream_extractor_other.cc: Add tests.
+ * bits/istream.tcc: Fix operator>>(streambuf*).
+
+ * testsuite/23_containers/vector_ctor.cc (test01): Add.
+
+ * docs/index.html: Remove references to egcs.
+ * docs/17_intro/DESIGN: Same.
+ * docs/17_intro/contribute.html: Same.
+ * docs/17_intro/RELEASE-NOTES: Ditto.
+ * docs/17_intro/howto.html: Same here.
+
+ Russell Davidson <russell@ehess.cnrs-mrs.fr>
+ * stl/bits/stl_vector.h (_M_insert_aux):
+ * bits/locale_facets.tcc (_M_extract): Tweaks for preliminary
+ decimal/floating point support.
+ * bits/locale_facets.h: Change _M_extract prototype.
+ * bits/char_traits.h (char_traits::to_int_type): Cast to unsigned.
+ * bits/std_istream.h (istream::read(char_type, streamsize)): Fix.
+
+1999-08-10 Michael Cook <cook@sightpath.com>
+
+ * bits/fstream.tcc: Fix for unused variable warning (-Wall).
+ * bits/ios_base.h: ditto.
+ * bits/istream.tcc: ditto.
+ * bits/locale_facets.h: ditto.
+ * bits/locale_facets.tcc: ditto.
+ * bits/std_streambuf.h: ditto.
+ * src/basic_file.cc: ditto.
+ * src/locale.cc: ditto.
+ * src/localename.cc: ditto.
+
+1999-08-10 Kirat Singh <singhki@jany.gs.com>
+
+ * bits/std_iomanip.h: Inline.
+
+1999-08-10 Alfred Minarik <a8601248@unet.univie.ac.at>
+
+ * bits/std_streambuf.h: Correct member initialization order.
+ * src/ios.cc: Add definitions for ios_base data members.
+
+1999-08-06 Phil Edwards <pedwards@ball.com>
+
+ * docs/index.html: Seventh snapshot updates. Minor tweaks.
+ * docs/faq/index.html: Ditto. Removed bugs sections that have
+ been fixed for a long time... Lots of "egcs" references still
+ exist.
+ * docs/faq/index.txt: Regenerated.
+
+1999-08-05 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+ Andreas Amann <amann@physik.tu-berlin.de>
+
+ * testsuite/26_numerics/binary_closure.cc (main): new test.
+
+1999-07-29 Andreas Amann <amann@physik.tu-berlin.de>
+
+ * bits/valarray_meta.h: (_BinClos<>::_Binclos): fix typo causing
+ segmentation fault.
+
+1999-08-04 Benjamin Kosnik <bkoz@decepticon.cygnus.com>
+
+ * docs/index.html (host): Put in testing status.
+
+1999-08-03 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * docs/index.html: Update for libstdc++-2.90.6 release.
+ * docs/17_intro/RELEASE-NOTES (New): Update.
+ * docs/17_intro/BUGS: Update.
+ * bits/c++config.h.in (__GLIBCPP__): Bump version number.
+ * README (file): Update.
+
+1999-08-03 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * src/Makefile.am (generated_headers): Remove bits/c++config.h as
+ a target.
+ ($(generated_headers)): Same.
+ * src/gen-c++config.cc: Remove, rename to
+ * bits/c++config.h.in: New file. Bump version number.
+ * configure.in: Generate bits/c++config.h at configure time.
+ * math/mathconf.h: include bits/c++config.h, not config.h.
+
+ * bits/std_cmath.h: Fix remaining link error for solaris shared
+ builds. _GLIBCPP_HAS_BUILTIN_SINF has to be disabled for the time
+ being, as on Solaris this silently calls sinf, which does not
+ exist.
+
+ * src/complex.cc: More tweaks.
+
+1999-08-03 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * src/complex.cc: Same.
+ * math/complex-stub.h: Change.
+ * math/c_log10*.c: Change back to clog10*.c.
+
+ * configure.in (NEED_C_LOG10): Delete.
+ * configure: Regenerate.
+ * math/Makefile.am: Change.
+
+1999-07-30 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * math/Makefile.am: Fix, for real.
+ * configure.in (use_builtin_sinf): Ok, make autoconf solution.
+ * math/clog.c: Move to c_log.c.
+ * math/clog*: Ditto.
+ * math/c_log10l.c (c_log10l): Change function name.
+ * math/c_log10f.c (c_log10f): Change function name.
+ * math/c_log10.c (c_log10): Change function name.
+
+ * math/complex-stub.h: Change to c_log* variants.
+ * src/complex.cc: And here.
+
+1999-07-29 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * testsuite/27_io/istream_extractor_other.cc: Correct last test.
+ * bits/sstream.tcc (stringbuf::overflow): Don't update the input
+ sequence, just the output sequence.
+ * bits/std_sstream.h (stringbuf::str()): Only in stringbufs return
+ the original string, all others use complicated heuristic.
+
+ * src/complex.cc: Assume c_log10.
+ * math/Makefile.am (EXTRA_yes): Fix c_log/c_logf unresolved
+ symbols in shared libraries by making c_log/c_log10 part of the
+ "must cmpile" sources. This may not work on solaris, must check.
+
+1999-07-29 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/istream.tcc (operator>>(streambuf*)): Re-do.
+ * bits/std_istream.h: Fix char extractors.
+ * testsuite/27_io/istream_extractor_char.cc: Change.
+ * testsuite/27_io/istream_extractor_other.cc: Add tests.
+
+1999-07-28 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_cctype.h: Fix for solaris2.6 builds.
+
+ * bits/istream.tcc: Fix, thanks Alfred.
+ * bits/std_istream.h: Formatting changes.
+
+ * libio/Makefile.am (libio_la_SOURCES): Remove cleanup.c, so that
+ _IO_cleanup will not be undefined.
+ * libio/*: Regenerate.
+
+ * bits/basic_string.h: More namespace-safety stuff.
+ * testsuite/27_io/istream_extractor_char.cc: Fix.
+ * testsuite/27_io/istream_extractor_arith.cc: Fix.
+ * testsuite/27_io/iostream_objects.cc: Fix.
+ * testsuite/27_io/ios_ctor.cc: Fix.
+ * testsuite/27_io/istream_manip.cc: Make namespace safe.
+ * testsuite/27_io/istream_extractor_other.cc: New file.
+
+ * mkcheck (TESTS_FILE): Tweaks.
+
+1999-07-27 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * src/gen-c++config.cc: Note here, change version.
+ * acconfig.h( _GLIBCPP_USE_CTYPE_ISBIT): New macro.
+ * src/locale.cc: Used here.
+ * configure.in (use_builtin_sinf): Check for _ISBit using autoconf.
+
+ * aclocal.m4: Regenerate by running `aclocal -I m4.`
+
+ * bits/istream.tcc: Fix.
+ * bits/std_istream.h: More changes to extractors.
+
+ * testsuite/27_io/istream_extractor_char.cc: More.
+ * testsuite/21_strings/inserters_extractors.cc (test01): Fix logic
+ error in testsuite construction.
+
+ * bits/std_istream.h: Partially revert.
+ * bits/std_ostream.h: Same.
+ * bits/std_sstream.h: Revert.
+
+1999-07-26 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_sstream.h: Change initialization.
+ * bits/std_ostream.h: Make default ctor/assign/operator= private.
+ * bits/std_istream.h: Same, also correct sentry args.
+ * bits/istream.tcc: Add correct sentry args.
+
+ * testsuite/27_io/istream_extractor_char.cc: New file.
+ * testsuite/27_io/istream_extractor_arith.cc: New file, old file,
+ name changes making me dizzy.
+
+1999-07-26 Ulrich Drepper <drepper@happy.cygnus.com>
+ Benjamin Kosnik <bkoz@cygnus.com>
+
+ * aclocal.m4, config.guess, config.sub, ltconfig ltmain.sh: Update
+ to libtool 1.3.3.
+
+1999-07-26 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/std_complex.h: Tweak. Make the primary template class
+ complex work with user-defined numerical types. Provide member
+ definitions. Restructure.
+ (class complex<float>): Uglify. Remove __value(). Rename __val
+ to _M_value. Rename __complex_value_type to _ComplexT. Make it
+ private. Remove dependency on __value(). Fix various explicit
+ specialization syntax. Declare a some functions friend. Now the
+ implementation is nearly comforming.
+ (class complex<double>): Likewise.
+ (class complex<long double>): Likewise.
+
+ * src/complex.cc: Tweak. Remove dependency on complex::__value().
+ (sin, sinh, tan, than): Fix call to corresponding C9x function
+ syntax.
+
+1999-07-24 Benjamin Kosnik <bkoz@fidel.cygnus.com>
+
+ * bits/istream.tcc (ws): Fix error with failbit being set.
+
+ Disabled due to egcs/gcc-2_95 internal compiler errors.
+ * src/Makefile.am (CXXFLAGS): Add -fsquangle -fhonor-std
+ -fnew-exceptions. Compiling with namespaces enabled will now be
+ the default.
+ * mkcheck (CXX_FLAG): Same.
+ * src/gen-c++config.cc (_GLIBCPP_USE_NAMESPACES): Yup. New macro.
+ * bits/std_cctype.h: Not enough to just define in namespace std if
+ ctype-isms are macros. Need to also define in namespace std:: if
+ the C functions are just plain functions.
+
+ * src/gen-num-limits.cc: Fix spelling inconsistencies.
+
+1999-07-24 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * docs/18_support/howto.html: Start documentation. Need to keep
+ track of the ongoing discussion in th LWG reflector.
+
+ * src/gen-num-limits.cc: Tweak.
+ (class predicate): New class.
+ (class value): Likewise.
+ Make the whole machinery more flexible. Add comments.
+
+1999-07-23 Benjamin Kosnik <bkoz@fidel.cygnus.com>
+
+ * bits/ios_base.h: Move state/exception functions into basic_ios.
+ * bits/basic_ios.h: Same.
+ * src/ios.cc: And here. Callbacks don't attempt to reset
+ state now.
+
+ * bits/std_streambuf.h: Separate ios and streambuf locale data
+ members and cached facets. Using this convention: _M_locale_buf for
+ the streambuf-related classes, and _M_locale_ios for the ios
+ hierarchy.
+ * bits/fstream.tcc: And here.
+ * bits/basic_ios.h: And here. Also, add cached ctype.
+ * src/ios.cc: Ditto.
+ * bits/ios_base.h: Ditto.
+ * bits/std_istream.h: Use cached ctype facet.
+ * docs/27_io/iostreams_hierarchy.pdf: Update for new data member
+ arraignment.
+
+ * testsuite/27_io/ios_ctor.cc: New file.
+ * src/ios.cc: Move _M_state init to basic_ios::init().
+ * bits/basic_ios.h: To here.
+
+ Attempt for some consistency in naming for testsuite/27_io/*.cc.
+ * testsuite/27_io/boolfmt.cc: Rename to stdios_fmtflags_manip.cc
+ * testsuite/27_io/octfmt.cc: Rename to stdios_basefield_manip.cc
+ * testsuite/27_io/istream_manip.cc: Rename to istringstream_manip.cc.
+ * testsuite/27_io/ostream_manip.cc: Rename to ostringstream_manip.cc.
+
+1999-07-22 Benjamin Kosnik <bkoz@fidel.cygnus.com>
+
+ * src/ios.cc: Tweak initializations of standard iostream
+ objects to closely match the standard. Tie cin/wcin, set flags on
+ cerr/wcerr
+ * bits/char_traits.h: Change from size_t to int_type, as per
+ standard. As per wide streams.
+ * bits/basic_ios.h: Infect with __ctype_type, as a preparation
+ for caching a bunch of ctype info. For instance, ctype_base::space
+ info needs to be stored somewhere, somehow.
+ * bits/std_istream.h: Also here.
+ * bits/std_ostream.h: Ditto.
+ * bits/std_istream.h (operator>>(istream, char): Aggh. Fixup.
+ * testsuite/27_io/iostream_objects.cacc (test01): Oh yeah. Fix
+ stream states.
+
+ * bits/istream.tcc (ws): Fix.
+ * testsuite/27_io/istream_manip.cc: New file, test ws.
+ * testsuite/27_io/ostream_manip.cc: New file, test endl, ends, flush.
+
+ * bits/basic_string.h: Provide a specialized member function for
+ _S_find<char> using strchr.
+ * src/string-inst.cc: Put specializations here.
+ * bits/string.tcc: Small fix for find, remove typo.
+ * testsuite/21_strings/find.cc (test01): Add tests to catch this
+ find bug. . .
+
+1999-07-20 Benjamin Kosnik <bkoz@decepticon.cygnus.com>
+
+ * bits/basic_ios.h: Put into basic_ios namespace.
+ Tweak widen/narrow.
+
+1999-07-19 Benjamin Kosnik <bkoz@decepticon.cygnus.com>
+
+ * bits/std_sstream.h (stringbuf::sync): Change to _M_really_sync,
+ adjust _M_*_cur pointers inside the function, so callee doesn't
+ have to adjust.
+ * bits/sstream.tcc (stringbuf::overflow): Tweak.
+
+ * mkcheck: Tweak. Add execution time field, even though it is not
+ implemented yet. Simplify pass/fail status notation.
+
+1999-07-18 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * configure.in: Check for float.h and underscored version of
+ math functions.
+ * acconfig.h: Add @BOTTOM@ section for handling underscored
+ math functions.
+ * configure: Regenerate.
+ * config.h.in: Regenerate.
+ * math/mathconf.h (float.h): Include conditionally.
+ (M_PI): Define conditionally.
+ (INFINITE_P): Define for Mingw.
+ * bits/locale_facets.tcc: Workaround for compiler crash on
+ ix86-*-mingw32.
+ * bits/std_cwchar.h (bits/std_cstddef.h): Include.
+ * src/locale.cc (bits/std_istream.h): Include.
+ (bits/std_ostream.h): Likewise.
+
+1999-07-18 Phil Edwards <pedwards@ball.com>
+
+ * docs/faq/index.html: Updated __black_count notes, fixed typos.
+ * docs/faq/index.txt: Regenerated.
+
+1999-07-15 Benjamin Kosnik <bkoz@decepticon.cygnus.com>
+
+ * testsuite/27_io/stringbuf.cc: Cccchanges, latent bugs.
+
+ * bits/sstream.tcc (stringbuf::overflow): Modify accounting of
+ newly-allocated buffer.
+ * bits/streambuf.tcc (streambuf::xsgetn): Aaaaaah. Fix final
+ overflow condition bits.
+
+1999-07-14 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_sstream.h (stringbuf::_M_init_stringbuf): Set
+ _M_buf_size to initial _M_string.size(), even though for
+ ostringstreams it is pretty pointless. It's necessary for
+ istringstreams.
+ (stringbuf::str()): Adjust.
+ (stringbuf::str()): Adjust, call _M_init_stringbuf.
+ * bits/streambuf.tcc (streambuf::xsgetn): Adjust return value for
+ overflow's possible success.
+ (streambuf::xsputn): Adjust.
+
+ * testsuite/27_io/filebuf.cc: Adjust for the xsgetn re-write from
+ yesterday.
+ * testsuite/27_io/stringbuf.cc: Tweak.
+ * testsuite/21_strings/inserters_extractors.cc (test01): Remove
+ notes to myself.
+ * testsuite/23_containers/vector_cons.cc: Rename to be consistent
+ with other constructor tests to. . .
+ * testsuite/23_containers/vector_ctor.cc: New file.
+
+1999-07-14 Alfred Minarik <a8601248@unet.univie.ac.at>
+
+ * testsuite/*: Changes to make the testsuit compilable with
+ -fhonor-std. Contains direct qualification of library names with
+ std::.
+
+1999-07-13 Benjamin Kosnik <bkoz@decepticon.cygnus.com>
+
+ * bits/streambuf.tcc: Tweaks.
+ (streambuf::xsputn): Optimize, fix for sstreams.
+ (streambuf::xsgetn): Same.
+ * bits/sstream.tcc (stringbuf::overflow): Adjust _M_buf_size
+ correctly, handle overflow/reallocate conditions correctly.
+ * bits/std_sstream.h: Fix typo.
+ _M_init_stringbuf(): Fix _M_buf_size initialization.
+ (stringbuf::str()): Construct return string if output has occurred.
+
+ * bits/basic_string.h: Fix typo from yesterday's patch.
+
+1999-07-12 Ryszard Kabatek <kabatek@chemie.uni-halle.de>
+
+ * bits/string.tcc: _M_mutate - clear _M_state again.
+ * bits/basic_string.h: In the three functions that return
+ an iterator set _M_state to -1 before return.
+ Also optimized two cases of operator+.
+
+1999-07-12 Phil Edwards <pedwards@ball.com>
+
+ * docs/index.html: Expand egcs-1.1.2 notes/links.
+ * docs/faq/index.html: And here. Add links to LWG issues-list.
+ * docs/faq/index.txt: Regenerate. (lynx rocks)
+ * docs/21_strings/howto.html: Fix notes on case conversion.
+ * docs/21_strings/stringtok_h.txt: Goodly spelling...
+ * docs/23_containers/howto.html: Stub for bitmasks.
+ * docs/27_io/howto.html: Add section on buffering, stub binary.
+
+1999-07-12 Nathan Myers <ncm@cantrip.org>
+
+ * stl/bits/stl_tree.h (__black_count): Optimize.
+
+1999-07-09 Vadim Egorov <egorovv@1c.ru>
+
+ * src/basic_file.cc: Cleanup in __basic_file destructor.
+
+1999-07-08 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_streambuf.h: Changes. . .
+ * bits/streambuf.tcc: Merge xsputn from filebuf into xsputn in
+ basic_streambuf, to be used for both filebufs and streambufs.
+ * bits/std_fstream.h (_M_init_filebuf): New function.
+ Take out specialized xsputn, put into basic_streambuf.
+ * bits/fstream.tcc: Define, call from both ctors.
+ * bits/std_sstream.h (_M_init_stringbuf): New function.
+ * bits/sstream.tcc: Tweak.
+
+ * docs/27_io/iostreams_heirarchy.pdf: New file.
+
+ * docs/17_intro/CHECKLIST (basic_string<char>): Validation and
+ acceptance. Wooo-hoo!
+
+ * bits/char_traits.h: Change int_type for char_traits general
+ template, so that 21_strings/capacity.cc will compile.
+ * testsuite/21_strings/capacity.cc: Add operators.
+
+ * bits/string.tcc (string::compare): Clean up, re-implement.
+ * testsuite/21_strings/compare.cc: Tweak.
+
+ * bits/string.tcc (string:_M_mutate): Keep leaked value in
+ _M_state, which means that whenever begin() or end() has been
+ called, the string is unshareable, period. By doing this, insert
+ and erase member functions that return iterators can remain
+ footloose and fancy free.
+ * testsuite/21_strings/invariants.cc: Update.
+
+ * bits/basic_string.h (string::append): Fix self-referential
+ problems, ie when "this" is also an argument to a member function.
+ * bits/string.tcc: Tweak, same.
+ * testsuite/21_strings/append.cc: New file.
+
+1999-07-07 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/char_traits.h: Tweaks.
+ * bits/basic_string.h: Tweak.
+ * bits/fstream.tcc: Remove warning for _M_buf_size assignment.
+
+1999-07-06 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_streambuf.h: Absorb/acquire data members previously
+ working in basic_filebuf.
+ * bits/streambuf.tcc: Tweaks.
+ * bits/fstream.tcc: Adjust.
+ * bits/std_fstream.h: Move and rename the following functions:
+ _M_set_ideterminate, _M_is_indeterminate, _M_set_determinate are
+ now declared and defined in the base class, basic_streambuf. Oh
+ fuck it, move data members _M_buf, and _M_buf_size into
+ basic_streambuf as well.
+
+ * bits/ostream.tcc: Tweak.
+ * bits/locale_facets.tcc: Fix typo in comments.
+
+ * testsuite/21_strings/inserters_extractors.cc (test01): Change
+ state from good to not good, as eof() is set.
+
+1999-07-05 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/char_traits.h (char_traits::compare). Fix.
+
+ * config.guess, config.sub: Update.
+
+1999-07-02 Ryszard Kabatek <kabatek@chemie.uni-halle.de>
+
+ * bits/string.tcc: Check the __res_arg for a length error.
+
+1999-07-01 Benjamin Kosnik <bkoz@nabi.net>
+
+ * bits/std_streambuf.h: Tweaks. Need to move _M_is_indeterminate
+ and related functions into basic_streambuf, from basic_filebuf to
+ take care of ostringstreams and empty strings. So that's groovy,
+ or will be groovy.
+ * bits/std_istream.h: Tweaks.
+ * bits/istream.tcc: Implement ws, getline, operator>> for string.
+ * bits/std_ostream.h: And here.
+ * bits/ostream.tcc: Same.
+ * src/misc-inst.cc: Add instantiations for ws.
+
+ * src/string-inst.cc: Add instantiations for inserters and
+ extractors (operators << and >>, getline).
+
+ * testsuite/21_strings/inserters_extractors.cc: Amazingly enough,
+ a testcase for getline and operators << and >>. Ostream tests are
+ failing right now, but istream tests should work. . .
+
+ * bits/string.tcc: Change _S_max_size, as GNU malloc won't budge.
+ * bits/std_sstream.h: Revert.
+
+ * testsuite/17_intro: header_[iosfwd, ios, iostream, iomanip,
+ istream, ostream, streambuf, fstream, sstream].cc: New files.
+
+1999-06-30 Ryszard Kabatek <kabatek@chemie.uni-halle.de>
+
+ * bits/std_sstream.h (stringbuf::sync): Don't use string::begin()
+ and string::end().
+
+ * bits/basic_string.h (basic_string<>::_S_copy_chars): Add
+ specializations for _CharT*, iterator and const_iterator.
+ * src/string-inst.cc: Remove explicit instantiation, as
+ now explicitly specialized.
+
+ * bits/basic_string.h: Add a size_type parameter to _M_clone with
+ a default value set to 0.
+ * bits/string.tcc: In _M_clone by the call of _S_create add the
+ value of the new parameter to _M_length. In reserve check
+ _M_state and use _M_clone instead of _M_mutate.
+
+1999-06-30 Benjamin Kosnik <bkoz@happy.cygnus.com>
+
+ * bits/basic_string.h: Fix _S_max_size.
+ * bits/string.tcc: Add def here.
+ * testsuite/21_strings/insert.cc: Fix.
+
+ * bits/sbuf_iter.h: Remove detritus.
+ * testsuite/24_iterators/istreambuf_iterator.cc: Add tests.
+
+ * src/locale-inst.cc: Elaborate iterator/locale instantiations
+ to resolve alpha-osf4 build problems.
+
+1999-06-29 Benjamin Kosnik <bkoz@happy.cygnus.com>
+
+ * bits/string.tcc: Fix signed/unsigned issues in compares.
+ * stl/bits/stl_deque.h: And here.
+ * stl/bits/stl_string_fwd.h: Remove __get_c_string.
+
+1999-06-29 Ryszard Kabatek <kabatek@chemie.uni-halle.de>
+
+ * bits/string.tcc: New implementation and interface of _M_mutate.
+ Adapt the change in all functions that call _M_mutate.
+ * bits/basic_string.h: And here.
+
+1999-06-29 Benjamin Kosnik <bkoz@happy.cygnus.com>
+
+ * testsuite/21_strings/capacity.cc (test01): Fix.
+
+1999-06-29 Phil Edwards <pedwards@ball.com>
+
+ * mknumeric_limits: Exit script if gen-num-limits isn't built.
+
+1999-06-29 Andreas Gruenbacher <agruenba@pent224.infosys.tuwien.ac.at>
+
+ * stl/bits/stl_vector.h: Fix.
+ * testsuite/23_containers/vector_cons.cc: Add.
+
+1999-06-29 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * mknumeric_limits (LDFLAGS): fix.
+
+1999-06-29 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * mknumeric_limits (LDFLAGS): set it according to the system.
+
+ * math/mathconf.h (NAN): Check whether host is running under
+ Cygwin and make the appropriate definition.
+ * math/complex-stub.h (nan): protect declaration.
+
+1999-06-28 Benjamin Kosnik <bkoz@haight.constant.com>
+
+ * bits/sbuf_iter.h: Rename internal data structure to prevent
+ confusion between basic_ios and istreambuf_iterators internal
+ basic_streambuf data member.
+ * testsuite/24_iterators/istreambuf_iterator.cc: New file.
+
+ * bits/basic_string.h: Remove conditionals, add input_iterator
+ version of S_construct again.
+ * bits/string.tcc: Same.
+ * src/string-inst.cc: And add explicit instantiation here.
+
+ * src/gen-c++config.cc (_GNU_SOURCE): Take out both _GNU_SOURCE
+ and __USE_GNU macro defines, as single __USE_GNU use leading to
+ confusion on glibc2.1 systems (ie, RedHat 6.0).
+
+ * src/Makefile.am (headers): Add std_utility to installed headers.
+
+1999-06-25 John Potter <jpotter@eagle.lhup.edu>
+
+ * stl/bits/stl_tree.h (insert_unique): Revert, just fix insert_equal.
+
+1999-06-25 Gilles Zunino <Gilles.Zunino@hei.fr>
+
+ * mknumeric_limits (LDFLAGS): Swap -lc and -lgcc.
+
+1999-06-24 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * src/gen-c++config.cc (_GLIBCPP_*): Change all
+ macros to include _GLIBCPP as a distinct namespace.
+ * bits/*: And here.
+ * src/*: And here.
+
+ * stl/bits/std_stdexcept.h: Forward-declare __Named_exception ctor.
+ * bits/basic_string.h: Remove __get_c_string.
+ * src/stdexcept.cc: Define ctor here.
+ * bits/ios_base.h: And fix ios_base::failure as well.
+ * src/ios.cc: Define here.
+
+ * bits/std_streambuf.h: Add a private copy ctor and assignment
+ operator wrapped in _G_RESOLVE_LIB_DEFECTS.
+ * bits/ios_base.h: And here too.
+
+ * bits/basic_string.h: Tweak.
+ * testsuite/21_strings/nonmember.cc: Add operator+ tests.
+
+ * src/valarray.cc: Rename to. . .
+ * src/valarray-inst.cc: This.
+ * src/Makefile.am (sources): Change here.
+ * src/Makefile.in: Regenerated.
+
+1999-06-24 Vadim Egorov <egorovv@1c.ru>
+
+ * bits/string.tcc(basic_string<>::_Rep::_S_create): Fixed
+ allocated size
+
+1999-06-24 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+ Tom Tromey <tromey@cygnus.com>
+
+ * configure.in (use_glibc2): Eek, correct for non-glibc systems.
+ Use AM_CONDITIONAL to get us out of this jam. .
+ * libio/Makefile.am: Same.
+ * */Makefile: Regenerated.
+
+1999-06-24 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+ John Potter <jpotter@eagle.lhup.edu>
+
+ * stl/bits/stl_tree.h (insert_equal): Fix.
+ * testsuite/23_containers/multiset.cc: New file.
+
+1999-06-23 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * configure.in (test for glibc2): Correct AC_TRY_COMPILE so that
+ this works correctly on glibc-2 systems. This should allow
+ simplified linking on these systems, and successful linking on Red
+ Hat 6.0 systems.
+ * configure, Makefile: Regenerate.
+
+ * bits/std_cwctype.h: Add missing 'w' to _S_iswpunct_helper name.
+
+ * testsuite/ext: New directory.
+ * testsuite/ext/headers.cc: New file.
+
+1999-06-23 Vadim Egorov <egorovv@1c.ru>
+
+ * stl/ext/hash_set: include missing headers
+ * stl/ext/hash_map: Same
+ * stl/ext/slist: Same
+
+1999-06-17 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/std_cmath.h: comment out modf. Kills build on hpux10.20
+
+1999-06-15 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * src/Makefile.am (sources): Regenerate.
+ * mkcheck: Add TESTS_FILE as a way of controlling what testcases
+ are run.
+
+1999-06-14 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * src/string-inst.cc: Change _S_construct signature, to
+ track requested allocation size versus valid input iterator range.
+ * bits/basic_string.h: Here too.
+ * bits/string.tcc: And here.
+
+1999-06-12 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * mkcheck (LOG_FILE): Correctly append errors.
+
+ * stl/bits/stl_iterator.h: Revert previous, delirious, change.
+
+ * bits/basic_string.h: Change _Rep::_M_data to _Rep::_M_refdata,
+ to clarify differences between basic_string::_M_data() calls and
+ _Rep::_M_data() calls.
+ * bits/std_string.h: Fix.
+ Put in check for out_of_range in substr.
+ * bits/string.tcc: Fix for _S_find.
+
+ * testsuite/21_strings/compare.cc: Add tests.
+ * testsuite/21_strings/find.cc: New file.
+ * testsuite/21_strings/substr: New file.
+ * testsuite/21_strings/replace.cc: New file.
+
+1999-06-11 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/valarray_array.h: __restrict__ify pointers.
+
+ * bits/std_valarray.h: Tweak.
+ (valarray<T>::cshift, valarray<T>::shift): use __builtin_alloca.
+
+ * bits/gslice_array.h: Tweak. Reflect changes in bits/gslice.h
+
+ * bits/gslice.h: Tweak.
+ (class gslice::_Indexer): new class.
+ (gslice::gslice(const gslice&)): implement copy-ctor to support
+ ref-counted index.
+ (gslice::operator=(const gslice&)): support ref-counted index.
+ (gslice::_M_convert_to_index): delete.
+
+ * src/valarray.cc: New file.
+ (__gslice_to_index): turn a gslice into a valarray<size_t>
+ (ctor gslice::_Indexer::_Indexer): implement.
+
+ * src/Makefile.am (sources): add valarray.cc
+ * src/Makefile.in: regenerate.
+
+1999-06-08 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * stl/bits/stl_iterator.h (__normal_iterator::const_iterator
+ ctor): Put in a const_cast.
+
+ * testsuite/21_strings/invariants.cc: New file.
+
+ * testsuite/21_strings/insert.cc: Add exception handling bits.
+ * testsuite/21_strings/ctor_copy_dtor.cc: Same.
+
+ * src/wstring-inst.cc: Add c++config.h include.
+
+ * bits/basic_string.h: Fix const operator[] for size == pos.
+ Add _M_leak for rbegin, non-const.
+ Add _M_leak for rend, non-const.
+ Make member function at standards conformant.
+ Add _S_terminal to _Rep for operator[] const, add this into
+ c_str() as well.
+ * bits/string.tcc: Add static member definition here,
+ temporarily.
+
+ * testsuite/21_strings/element_access.cc: Add tests.
+
+1999-06-08 Vadim Egorov <egorovv@1c.ru>
+
+ * bits/fstream.tcc (_M_really_overflow): Fixed size of
+ conversion buffer.
+
+1999-06-08 Phil Edwards <pedwards@ball.com>
+
+ * bits/fstream.tcc (basic_filebuf::xsputn): Fix off-by-one count
+ caused when __testinit is true.
+ * bits/ostream.tcc (basic_ostream::op<<(streambuf*)): Write buffer
+ using rdbuf()->sputn rather than _M_fnumput->put.
+
+1999-06-08 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * testsuite/23_containers/bitset_ctor.cc: New file.
+ * stl/bits/std_bitset.h (__BITSET_WORDS): Fix integration bug.
+
+1999-06-08 Phil Edwards <pedwards@ball.com>
+
+ * bits/fstream.tcc (basic_filebuf::underflow): Fix, rename local vars.
+
+1999-06-07 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * testsuite/21_strings/element_access.cc: Finish off these tests.
+ * testsuite/21_strings/insert.cc (test01): Uncomment.
+ * testsuite/21_strings/ctor_copy_dtor.cc (test01): Finish off ctors.
+ * bits/basic_string.h: Tweak, okay, fix for real this time.
+ * bits/string.tcc: Same.
+ * bits/char_traits.h: Tweak.
+
+1999-06-07 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * bits/std_cmath.h: Example of how to use the generated macro.
+ * acconfig.h: Add macro for sinf here.
+ * configure.in (LIBS): Add test for builtin math function sinf.
+ * configure: Regenerated.
+
+ * bits/basic_string.h: Fix _S_max_size.
+
+1999-06-06 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * bits/basic_string.h: Fixes for out-of-memory segv for large strings.
+ Remove _S_construct signature for forward_iterator_tag and
+ input_iterator_tag.
+ Clean _M_fold.
+ * src/string-inst.cc: Same, tweaks.
+ * bits/string.tcc: Same, tweaks.
+
+ * testsuite/21_strings/ctor_copy_dtor.cc: Add/clarify tests.
+ * mkcheck (LOG_FILE): Fix filebuf-[2,3].tst checks.
+ * mknumeric_limits (LD_FLAGS): Add -nodefaultlibs -lc -lgcc as per
+ Gaby.
+
+ * src/locale.cc: Final separation for char/wchar_t bits.
+
+1999-06-05 Phil Edwards <pedwards@ball.com>
+
+ * docs/index.html: Added link to book upon request'n'agreement.
+ * docs/23_containers/wrappers_h.txt: Added.
+ * docs/{23_containers,27_io}/howto.html: Added sections.
+
+ * bits/std_fstream.h: Tweak.
+
+1999-06-05 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * src/ios.cc: Same here.
+ * bits/std_iosfwd.h: More wchar_t defines.
+
+ * bits/basic_string.h: Tweaks.
+ * bits/string.tcc: Tweak. Fix _S_construct to check for max_size
+ when doing error checking, as per LWG defect #83.
+
+ * src/gen-c++config.cc: Fix comment.
+
+ * testsuite/21_strings/ctor_copy_dtor.cc: New file, checks ctors,
+ assignments, dtors.
+ * testsuite/21_strings/element_access.cc: New file, checks for
+ operator[], at(...).
+ * testsuite/21_strings/insert.cc: New file, tests string::insert.
+ * testsuite/21_strings/char_traits.cc: New file, tests
+ for char_traits<char>.
+
+ * bits/utility.h: Remove, again.
+ * src/Makefile.am (std_headers): Remove utility.h.
+ * src/Makefile.in (std_headers): Regenerate.
+
+ Alfred Minarik <a8601248@unet.univie.ac.at>
+ * bits/basic_string.h: Move __out_of_range and __length_error into
+ namespace std.
+
+1999-06-05 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * testsuite/26_numerics/modf_float.cc: New file.
+
+ * bits/std_cmath.h (modf(float, float*)): Fix signature. Correct
+ typo: use ::modff, not ::modf.
+
+1999-06-03 Vadim Egorov <egorovv@1c.ru>
+
+ * bits/string.tcc (basic_string::_M_mutate): Fixed memory
+ allocation error
+ * testsuite/21_strings/capacity.cc (test01): Test.
+
+1999-06-03 Phil Edwards <pedwards@ball.com>
+
+ * bits/fstream.tcc: Re-order inits to stop warnings. Comment/move
+ unused variables to within #if 0 blocks to do the same.
+ * bits/std_fstream.h: Fix typos (one prevents compilation).
+
+1999-06-03 Benjamin Kosnik <bkoz@pacifica.cygnus.com>
+
+ * src/wstring-inst.cc: Fix.
+
+1999-06-02 Benjamin Kosnik <bkoz@madcow.cygnus.com>
+
+ * bits/char_traits.h: Add _G_USE_WCHAR_T macro guards.
+ * stl/bits/stl_string_fwd.h: Same.
+ * bits/locale_facets.h: Same.
+ * bits/locale_facets.tcc: Same.
+ * src/wstring-inst.cc: And here.
+
+ * src/gen-c++config.cc: Comment _G_USE_WCHAR_T. Leading to
+ problems on HPUX 10.20.
+ * your-build-directory-here/bits/c++config.h: Just kidding, do it
+ here as a temporary hack till the compiler/host problems get
+ worked out.
+
+ * bits/locale_facets.tcc (num_get::do_get): Change from ifdef
+ HAVE_STRTOLD to HAVE_STRTOLD && !(__hpux). Apparently, problems
+ converting "long double" to struct long_double. Probably should be
+ done with one macro (HAVE_STRTOLD) at configure time.
+
+ * bits/std_cmath.h: Comment out pow(double, int) defintion as
+ gives re-declaration under hpux10.20. Revert previous change, as
+ kills linux/x86, solaris 2.7, hpux builds. These should be done
+ using autoconf, see std_cctype.h and the solutions started in
+ configure.in (see config.h for the generated file.)
+
+ * mknumeric_limits (LDFLAGS): Remove '-nodefaultlibs -lc', as
+ -nodefaultlibs prevents linking under HPUX 10.20 as __main is not
+ defined.
+
+ * docs/index.html: Add some useful links.
+ * docs/17_intro/contribute.html: Fix broken links.
+
+1999-06-02 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * mkcheck (LOG_FILE): Add !/bin/bash instead of cygnus-style
+ paths. The rest of the world should be able to run this script
+ now.
+
+ * src/Makefile.am ($(generated_headers)): Remove comment.
+ * Makefile*: Regenerate.
+
+ * bits/std_locale.h: Remove detritus.
+ * bits/localefwd.h: Add <cctype> include to undefine the isspace
+ macro.
+
+1999-06-01 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * src/gen-c++config.cc: New file. Making c++config.h at configure
+ time by catting this file (nee bits/config.h) with the build
+ directories config.h. This is not a complete or perfect solution
+ but is better than what was in place previously.
+ * bits/c++config.h: Rename/move to above.
+ * src/Makefile.am (headers): Remove c++config.h.
+ (myinstallheaders). Add.
+ * Makefile*: Regenerated.
+
+ * bits/std_cwchar.h: Add include of c++config.h for HAVE_*
+ definitions, so that wmemcmp, wcslen, wmemchr, etc are properly
+ declared only if not present in the host's wchar.h.
+
+ * bits/locale_facets.tcc (std): Change _G_USE_STRTO* to HAVE_STRTO*.
+
+ * bits/std_cmath.h: Define out, for the moment. Linux has no
+ __buitin_fsqrtl? Probably need some kind of configure trickery
+ here as well.
+
+ * src/Makefile.*: Regenerate.
+ * bits/c++config.h: Add config.h include.
+
+ * bits/std_cwchar.h: Remove remaining #error guard.
+
+ * acconfig.h: Add bits for HAVE_LC_MESSAGES.
+
+ * configure.in (LIBS): Replace previous effort for mbstate_t and
+ strtold/strtof with this implementation.
+
+1999 06-01 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/std_cmath.h: Tweak. Add more functions. Use __builtin_xxx
+ whenever possible.
+
+1999-05-28 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/locale_facets.tcc (std): Eek: this left in. Autoconf bits
+ for determining mbstate_t differences across various hosts not
+ finished.
+
+1999-05-26 Benjamin Kosnik <bkoz@nabi.net>
+
+ * bits/locale_facets.tcc: Change to ifdef.
+
+ * bits/std_sstream.h (stringbuf::setbuf): Remove dynamic_cast.
+ * bits/std_fstream.h (filebuf::setbuf): Same.
+
+ * bits/std_istream.h: Add ws declaration.
+ * bits/istream.tcc: Stub out definition.
+
+ * docs/index.html: Fix broken link for design.txt.
+
+ * configure.in: Test for mbstate_t. If wchar.h doesn't have it,
+ then set _G_NEED_MBSTATE_T.
+ * configure: Regenerate.
+ * bits/c++config.h: Move mbstate_t define.
+ * bits/std_cwchar.h: To here.
+
+1999-05-25 Ryszard Kabatek <kabatek@chemie.uni-halle.de>
+
+ * bits/std_sstream.h:
+ basic_stringbuf<>::basic_stringbuf: fix.
+ basic_stringbuf<>::setbuf:
+ remove the temporary __string_type object,
+ remove the unnecessary dynymic_cast in the return value,
+ change the type of the returned value from __streambuf_type*
+ to basic_stringbuf<_CharT, _Traits, _Alloc>*.
+
+1999-05-25 Phil Edwards <pedwards@ball.com>
+
+ * bits/std_streambuf.h (streambuf::setbuf): Always return streambuf*.
+
+1999-04-25 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/std_cmath.h: Tweak. Add float versions of the math functions
+ in <math.h>. <cmath> still incomplete and incorrekt.
+
+1999-05-24 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * mknumeric_limits (LDFLAGS): set appropriate link flags.
+
+1999-05-23 Phil Edwards <pedwards@ball.com>
+
+ * docs/17_intro/howto.html: Added links to text docs,
+ e.g., BUGS.
+ * docs/21_strings/howto.html: Updated sections and links.
+ * docs/21_strings/{gotw29a.txt,stringtok_h.txt}: Added.
+ * docs/faq/index.html: Updated what-works for sixth
+ snapshot. Also a number of "internal" links have been
+ fixed, now that the web pages are the docs directory...
+ * docs/faq/index.txt: Regenerated.
+
+1999-05-21 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * bits/basic_string.h: Add Nathan's documentation on the string class.
+
+ * testsuite/27_io/ios_members_static.cc: New file, for testing
+ ios_base::sync_with_stdio.
+
+1999-05-21 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * bits/std_locale.h: Simplify includes.
+ * bits/loccore.h: Delete.
+ * bits/localefwd.h: Renamed, trimmed.
+ * bits/locfacets.h: Delete.
+ * bits/locale_facets.h: Rename, expanded.
+ * bits/loccore.tcc: Deleted.
+ * bits/locfacets.tcc: Deleted.
+ * bits/locale_facets.tcc: Resultant merge.
+ * bits/std_fstream.h: Modify include.
+ * bits/ostream.tcc: Same.
+ * bits/istream.tcc: Same.
+
+ * src/locale-inst.cc: And here.
+ * src/locale.cc: Ditto.
+ * src/Makefile.am: Updated.
+ * src/Makefile.in: Rengenerated.
+
+ * bits/std_istream.h: Move istream::sentry ctor definition.
+ * bits/istream.tcc: Move istream::sentry ctor here.
+ Add more detailed locale include here for ctype member functions.
+ * bits/ostream.tcc (std): And here.
+
+ * bits/sbuf_iter.h: Include std_streambuf.h
+
+ * bits/locfacets.h: Start separating this into a localeimp.h file.
+ * bits/loccore.h: Start separating this into a localefwd.h file.
+ Add std_climits for CHAR_BIT.
+
+ * bits/ios_base.h (ios_base::sync_with_stdio): Stub in.
+
+ * bits/char_traits.h: Tweak.
+
+ * bits/ios_base.h: Remove INT_MAX, use 1<<16.
+
+ * bits/std_ostream.h: Remove c++config.h include.
+ * bits/std_istream.h: Same.
+ * bits/std_streambuf.h: Same.
+ * bits/std_fstream.h: Same.
+ * bits/std_sstream.h: And here.
+
+ * bits/std_iosfwd.h: Add _G_RESOLVE_LIB_DEFECTS here for streampos.
+ * bits/char_traits.h: Add include of std_cwchar.h for mbstate_t.
+ * bits/fpos.h: Tweak, format.
+
+ * std/ciso646: New file.
+ * bits/std_ciso646.h: New file.
+ * src/Makefile.am (std_headers): Add ciso646.
+ (headers): Add bits/std_ciso646.h.
+ * src/Makefile.in: Regenerate.
+ * testsuite/17_intro/header_ciso646.cc: New file, disable
+ equivalance tests.
+
+ * bits/fpos.h: Remove libio.h include.
+ * bits/basic_file.h: And here.
+ * bits/std_ios.h: Put here.
+
+ * src/ios.cc: Simplify includes, tweak.
+ * bits/std_ios.h: Simplify include order.
+ * bits/ios_base.h: Modify ios_base::failure.
+
+ * stl/bits/std_numeric.h: Change include from stl_iterator to
+ std_iterator.
+
+1999-05-19 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * std/iostream: Remove static member __ioint.
+ * bits/std_iostream.h: Put here.
+
+ * stl/bits/std_numeric.h: Remove unneccessary std_iostream.h include.
+ * stl/bits/stl_algobase.h: Same.
+ * testsuite/27_io/iostream_objects.cc: Regression tests.
+ * testsuite/27_io/hello.cc: Remove, subset of above.
+
+1999-05-19 Phil Edwards <pedwards@ball.com>
+
+ * docs/index.html: Tweak, update.
+
+1999-05-18 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * docs/17_intro/RELEASE-NOTES: remove outdated
+ documentation about numeric_limits. Correct CXXINCLUDE setting
+ documentation.
+
+1999-05-18 Phil Edwards <pedwards@ball.com>
+
+ * docs/{17_intro,18_support,19_diagnostics,20_util,21_strings,
+ 22_locale,23_containers,24_iterators,25_algorithms,26_numerics,
+ 27_io}/howto.html: Created, with some initial entries.
+ * docs/faq/index.html: Fixed some links.
+ * docs/faq/index.txt: Regenerated.
+
+1999-05-18 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * bits/c++config.h (__GLIBCPP__): Set version to 19990518.
+
+ * docs/17_intro/RELEASE-NOTES: Update.
+ * docs/index.html: Correct link to mailing list help page, update News.
+ * docs/faq/index.html: Change fifth to sixth for snapshot.
+
+ * src/Makefile.am (myinstallheaders): Bring over Gaby's changes to
+ install $(top_builddir)/bits/std_limits.h into
+ $(myincludepfx)/bits. This was mistakenly omitted from yesterday's
+ Makefile.am changes.
+ * *Makefile*: Regenerate using automake.
+
+ * mkcheck (LOG_FILE): Fix filebuf directory oddness.
+ * testsuite/27_io/filebuf.cc: Same.
+
+1999-05-18 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * docs/17_intro/CHECKLIST: update.
+ * docs/17_intro/TODO: update.
+
+1999-05-17 Phil Edwards <pedwards@ball.com>
+
+ * docs/{17_intro,18_support,19_diagnostics,20_util,21_strings,
+ 22_locale,23_containers,24_iterators,25_algorithms,26_numerics,
+ 27_io}/howto.html: Created, with some initial entries.
+ * docs/faq/index.html: Fixed some links.
+ * docs/faq/index.txt: Regenerated.
+
+1999-05-17 Benjamin Kosnik <bkoz@unhappy.cygnus.com>
+
+ * src/Makefile.am (myinstallheaders): Missed removing missing.h.
+ * Makefile.in*: Regenerate.
+
+1999-05-17 Benjamin Kosnik <bkoz@happy.cygnus.com>
+
+ * bits/std_streambuf.h: Same.
+
+ * bits/loccore.h (_Bad_use_facet): Remove bits warned about.
+ * bits/locfacets.h (std): Same.
+ * bits/sstream.tcc: Same.
+ * testsuite/27_io/stringstream.cc: Tweak.
+
+ * testsuite/27_io/filebuf.cc: Adjust.
+ * testsuite/21_strings/capacity.cc (test01): Add more
+ string::reserve tests.
+
+ * bits/c++config.h: Remove broken CCTYPE.
+ * bits/std_cctype.h: Tweak, remove de-macroization, enable
+ sequestered topper implementation.
+ * bits/std_cwctype.h: Same.
+
+ * bits/missing.h: Remove.
+ * bits/std_locale.h: Remove missing.h include.
+
+ * stl/bits/std_bitset.h (bitset::bitset(string): Tweak to compile.
+
+ * src/Makefile.am (headers): Add bits/std_cwctype.h.
+ INCLUDES: Add top_builddir.
+ * src/Makefile.in: Regenerate.
+
+ * Makefile.am: Add check and check-install as new targets.
+ * testsuite/make_check_libfree++: Move to. . .
+ * mkcheck: Here.
+ * configure.in: Tweak versions.
+ * mknumeric_limits: Set paths correctly.
+
+1999-05-17 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * src/Makefile.in (myinstallheaders): add rule to install
+ std_limits.h.
+
+ * bits/slice.h (class slice): don't const-qualify data members
+ since the copy and assignment operator is implicitly used. The
+ valarray specification is definitively a bad one.
+
+ * Makefile.in (generate-limits-sources): fix typo.
+
+ * docs/text/TODO: update.
+ * docs/text/CHECKLIST: update.
+
+ * bits/gslice.h (gslice): fix bugglet.
+ (gslice::gslice): set _M_index_size to 0 whenever given lengths
+ (lj) of size zero.
+
+ * src/Makefile.am (libstdc___la_SOURCES): add gen-num-limits.
+ * src/Makefile.in (libstdc___la_SOURCES): keep in sync.
+ [Note: **/Makefile.in should be generated from the corresponding
+ Makefile.am. The current situation is a litte chaotic. ]
+
+1999-05-16 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * mknumeric_limits: tweak.
+
+ * Makefile.in (all): add target generate-limits-sources.
+ (generate-limits-sources): make a directory bits/ in top_builddir
+ where the generated std_limits.h is put; generate limitsMEMBERs.cc
+ directly under $(top_builddir)/src. Remains to put the appropriate
+ rule for installing std_limits.h.
+
+ * src/Makefile.in (headers): remove bits/std_limits.h to this list.
+ (INCLUDES): add -I$(top_builddir) for bits/std_limits.h which is
+ now generated at build-time in the build directory
+ (libstdc___la_SOURCES): remove limitsMEMBERS.cc form this list
+ * src/Makefile.am: reflect changes in src/Makefile.in
+
+1999-05-12 Phil Edwards <pedwards@ball.com>
+
+ * docs/faq/index.html: Add more entries (5.4,5.5), finish
+ all but one empty entry. Add links for HOWTOs, but no files yet.
+ (Corrected HOWTO links are for bkoz's new scheme.)
+ * docs/faq/index.txt: Regenerated.
+
+1999-05-12 Benjamin Kosnik <bkoz@happy.cygnus.com>
+
+ * testsuite/17_intro/headers.cc: New file.
+ * stl/bits/std_queue.h: Change stl_bvector.h include path.
+ * bits/std_cwctype.h: New file.
+
+ * testsuite/27_io/filebuf.cc: Need to tweak directory structure.
+
+1999-05-11 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * stl/bits/stl_config.h (__USE_MALLOC): Change underlying allocator.
+ Check __USE_MALLOC before defining specializations containing
+ __default_alloc_template.
+ * src/stl-inst.cc: Here too.
+
+ * bits/basic_string.h: Change.
+
+ * testsuite/make_check_libfree++: More tweaks.
+ * testsuite/21/capacity.cc: New file.
+
+ * src/string.cc: Rename to be consistent with other inst files.
+ Rename to string-inst.cc.
+ * src/string*.cc: Change include.
+ * src/wstring.cc: Rename to wstring-inst.cc.
+ * src/wstring*.cc: Ditto.
+ * src/Makefile.in: Also here.
+ * src/Makefile.am: Ditto.
+
+ * src/traits.cc: Remove.
+ * src/wtraits.cc: Same.
+
+ Try a new way of organizing documentation, one with synchronicity
+ between testsuites and docs subdirectories, and see who yelps.
+ * docs/html: Remove, use chapter and subject specific directories
+ instead of forcing things immediately into format of
+ documentation.
+ * docs/text: Same.
+ * docs/image: Same.
+ * docs/faq/text, docs/faq/html: Remove, put in the docs/faq
+ directory and sort by filename and extension.
+ * docs/17_intro, 18_support, 19_diagnostics, 20_util, 21_strings,
+ 22_locale, 23_containers, 24_iterators, 25_algorithms,
+ 26_numerics, 27_io: Add.
+ * docs/17_intro/*: Populate with all the text files. . .
+ * docs/index.html: Construct.
+
+ * testsuite/*: Update with same names as the docs subdir.
+ * testsuite/results: Where to stash conformance results for the
+ different snapshots, so that progress/size/speed issues can be
+ tracked over time.
+
+1999-05-10 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * src/string.cc: Add _S_copy_chars instantiation, as well as
+ string::binary operators !=, ==, etc.
+
+ * src/Makefile.am (CXXFLAGS): Remove -fvtable-thunks.
+ * src/Makefile.in (CXXFLAGS): Same here.
+ * testsuite/make_check_libfree++ (CXX_FLAG): And here.
+
+1999-05-07 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * src/string.cc: Add missing member functions to instantiation list.
+
+1999-05-07 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * src/misc-inst.cc: Remove unused string instantiations.
+
+ * bits/string.tcc: Tweak, fix.
+ * bits/basic_string.h: Format. Fix reported error with c_str().
+
+ * testsuite/make_check_libfree++: Tweak for shared builds.
+ * testsuite/21/operations.cc: New file for testing c_str() etc.
+
+1999-05-06 Benjamin Kosnik <bkoz@cygnus.com>
+ Ryszard Kabatek <kabatek@chemie.uni-halle.de>
+
+ * stl/bits/stl_vector.h: Fix the code of vector<> for usage with
+ an iterator class. Delineate pointer versus iterator differences
+ in implementation.
+ * 23/vector_capacity.cc: New file, tests for above.
+
+1999-05-06 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * mknumeric_limits: Fix typo. 'unsigned lont' should read
+ 'unsigned long'.
+ * src/Makefile.am (libstdc___la_SOURCES): add limitsMEMBERS.cc,
+ generated by mknumeric_limits to the list. Now std_limits.h is
+ basically working.
+ * src/Makefile.in (generate-numeric-limits): new target to handle
+ automatic generation of bits/std_limits.h and src/limitsMEMBERS.cc.
+ (all): add target generate-numeric-limits.
+ (libstdc___la_OBJECTS): add limitsMEMBERS.lo
+ (libstdc___la_SOURCES): add limitsMEMBERS.cc
+
+1999-05-05 Benjamin Kosnik <bkoz@cygnus.com>
+
+ Irix build issues.
+ * bits/c++config.h (_G_USE_CTYPE_ISBIT): Defines new macro for
+ mask values in ctype_base. Move hacks for _ISBit to locfacets.h.
+ * bits/locfacts.h: Here.
+
+1999-05-05 Benjamin Kosnik <bkoz@cygnus.com>
+ Ulrich Drepper <drepper@cygnus.com>
+
+ Solaris build issues.
+ * bits/c++config.h: Define new macros, _G_USE_STRTOF and
+ _G_USE_STRTOLD.
+
+ * bits/locfacets.tcc (num_get::do_get): Tweak long double and
+ float overloads to use the above macros. Account for the lack of
+ strtold on some systems, and revert back to using sscanf.
+
+1999-05-04 Ryszard Kabatek <kabatek@chemie.uni-halle.de>
+
+ * bits/locfacets.tcc (num_get::do_get): Check the errno variable.
+ Use strtoul/strtoull for unsigned types. Check the ranges for
+ short/unsigned short and if necessary for int/unsigned int.
+
+1999-05-04 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * src/gen-num-limits.cc (round_style): Need to use mknumericlimits
+ to generate bits/std_limits.h now, as the SGI std_limits.h is
+ being depricated. Not done, but should be done immediately: need
+ to make sure this script is run as part of the configuration
+ process, because without it "make" in a configured build directory
+ will fail. Also tweaked: added a space for float_round_style, and
+ used static_cast of zero to default-initialize, which should be ok
+ according to the standard. (see 8.5 p5 and 20.1.3).
+ * mknumeric_limits (OUT_C): Need this for x86 long
+ double extensions.
+
+ * bits/basic_file.h: Include libio.h, not libioP.h.
+ * src/basic_file.cc: And add libioP.h include here, so that
+ _IO_init, et. al are well-declared.
+
+ * testsuite/make_check_libfree++ (LIB_PATH): Test installed
+ headers, not source directory headers.
+
+ * src/Makefile.am (headers): Add stl_range_errors.h, also adjust
+ for ext/*. Also add basic_file.h.
+ * src/Makefile.in (headers): Same.
+
+ * bits/std_string.h: Reduce dependencies for faster
+ pre-processing. Move istream and ostream specific defines into
+ istream.tcc and ostream.tcc respectively.
+ * bits/string.tcc: And here.
+ * bits/basic_string.h: Move getline inline out-of-line, and to
+ istream.tcc.
+ * bits/istream.tcc: Move string::getline and operator>> here.
+ * bits/ostream.tcc: And here too.
+
+ * bits/utility.h: Remove, as clashes with a standard header. Put
+ __OUTOFRANGE and __LENGTHERROR macros into string.tcc for the time
+ being, until this can be combined with SGI's approach.
+ * bits/string.tcc: Add macros, as above.
+ * bits/loccore.h: Add _Count_ones defines.
+ * bits/std_string.h: And here too.
+ * bits/std_locale.h: And here.
+ * bits/std_ios.h: Take out include here.
+ * src/Makefile.am (headers): Remove utility.h
+ * src/Makefile.in (headers): Remove utility.h
+
+ * stl/bits/*: Update to SGI STL 3.20.
+ * stl/ext/pthread_alloc: Delete this file.
+
+1999-05-04 Phil Edwards <pedwards@ball.com>
+
+ * docs/faq/html/index.html: Add more entries
+ * docs/faq/html/index.txt: regenerated.
+
+1999-05-04 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * src/gen-num-limits.cc (DO_DEFINE_MIN_MAX): fix typo.
+
+1999-04-29 Benjamin Kosnik <bkoz@haight.cygnus.com>
+
+ * bits/locfacets.tcc (num_get::do_get): Re-implement, with input
+ from Ulrich and Nathan. Remove extraneous string class usage,
+ tweak, clean, simplify and consolidate with a eye towards removing
+ duplcate code. Use strto[l, ll, f, d, ld] instead of sscanf.
+ Not done: dealing with leading zeros, wchar_t work.
+ * bits/locfacets.h: And here too.
+
+ * doc: Remove.
+
+1999-04-29 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * docs/: add a FAQ.
+ * docs/faq/: New directory.
+ * docs/faq/html/: Likewise.
+ * docs/faq/text/: Likewise.
+ * docs/faq/html/index.html: New file.
+ * docs/faq/html/index.txt: Likewise. Generated from
+ docs/faq/html/index.html by lynx.
+
+1999-04-28 Benjamin Kosnik <bkoz@happy.cygnus.com>
+ Ryszard Kabatek and Branko Cibej
+
+ * bits/locfacets.tcc: Modify.
+
+1999-04-27 Benjamin Kosnik <bkoz@happy.cygnus.com>
+
+ * bits/sbuf_iter.h: Clean, fix istreambuf_iterator, make
+ conformant to 14882, wrap non-standard extensions with
+ _G_RESOLVE_LIB_DEFECTS, remove detritus and cruft, rennovate.
+ * bits/locfacets.tcc (num_get::do_get(bool)): Return correct iterator.
+
+ * testsuite/27/istringstream_formatted.cc: Add tests.
+
+ * bits/locfacets.h: Remove cruft from _Format_cache, continue
+ commenting, simplify.
+ * bits/locfacets.tcc: Same.
+
+ 1999-04-27 Ryszard Kabatek <kabatek@chemie.uni-halle.de>
+ * bits/locfacets.tcc (num_get::do_get):
+ Fix the sscanf format parameter
+ for long long 'll' (as in C9X) instead of 'l'.
+ Fix the order of sscanf format parameters: "%dl" --> "%ld".
+ Change the type of the local variable '__conv' from 'string'
+ to 'const char*' and adapt the change.
+
+1999-04-26 Benjamin Kosnik <bkoz@happy.cygnus.com>
+
+ * bits/locfacets.h: Document _Format_cache, and name data members
+ after the corresponding functions in numpunct. For instance:
+ _M_grsep -> _M_thousands_sep, and _M_decsep -> _M_decimal_point.
+ Break apart _M_boolnames{2] into _M_truename and _M_falsename.
+ * bits/locfacets.tcc: Same.
+
+ * bits/locfacets.h (num_get::_M_extract): Don't allow groupings to
+ stop parsing--store for later analysis.
+ * testsuite/27/istringstream_formatted.cc: Add cases.
+
+1999-04-25 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/valarray_meta.h: tweak.
+ (_UnFunBase, _BinFunBase, _BinFunBase1, _BinFunBase2, _BinBase1,
+ _BinFunBase2): rename typedef-name _Tp to _Vt to keep the compiler
+ happy -- boggus warning.
+ * bits/std_valarray.h: Fix.
+ (valarray<T>::shift): Fix. Update comment.
+ (valarray<T>::cshift): Fix.
+
+1999-04-23 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * testsuite/27filebuf-2.txt: Delete.
+ * testsuite/27/filebuf.cc: Put output files directly into the
+ correct subdirectory (27).
+
+ Alexandre Petit-Bianco <apbianco@cygnus.com>
+ * testsuite/make_check_libfree++: Check generated (*.txt) file
+ against stored results file (*.tst).
+
+1999-04-22 Benjamin Kosnik <bkoz@nabi.net>
+
+ * bits/locfacets.tcc: Fix.
+
+ * bits/fstream.tcc (filebuf::seekoff): Output current out pointer.
+ (filebuf::overflow): Simplify.
+ (filebuf::xsputn): Correctly handle indeterminate state.
+
+ * testsuite/27/istringstream_formatted.cc: Tweak.
+ * testsuite/27/filebuf.cc: Tweak.
+ * testsuite/27/filebuf-3.tst: Correct: this is the canonical
+ results file, please use this in the future to guarantee filebuf
+ positioning accuracy.
+ * testsuite/27/filebuf-2.tst: Same.
+
+1999-04-21 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/fstream.tcc (filebuf::xsputn): Add.
+ * bits/std_fstream.h: Declare.
+
+ * src/basic_file.cc (__basic_file::open): Add O_CREAT to open
+ calls using ios_base::trunc.
+
+ * bits/sstream.tcc (streambuf::overflow): Fix crasher.
+
+ * testsuite/make_check_libfree++ (LOG_FILE): Ugh. Another fix.
+ * testsuite/27/27stringstream.cc: Same.
+ * testsuite/27/27stringbuf.cc: More tweaks.
+ * testsuite/27/27filebuf-2.txt: Remove.
+
+ * testsuite/27/27filebuf-1.tst: Append, to force byte size over
+ BUFSIZE so that overflows/underflow can be tested with default
+ buffer setting.
+ * testsuite/27/27filebuf-1.tst: Add.
+
+ * testsuite/*/*: Remove pre-pended chapter names, as they
+ duplicate the chapter info contained in the enclosing directory
+ anyway.
+
+1999-04-20 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/streambuf.tcc (streambuf::xsputn): Re-implement to conform
+ to sputc conditions.
+
+ * bits/ios_base.h: Define here.
+ * src/ios.cc (ios_base::_M_clear): Remove hack.
+ * bits/basic_ios.h: Fix rdstate().
+
+ * bits/sstream.tcc (streambuf::seekoff): Fix.
+ * bits/fstream.tcc (filebuf::seekoff): Tweak comments.
+
+ * testsuite/make_check_libfree++ (LOG_FILE): More c-c-c-changes.
+ * testsuite/24/24iterator.cc: Add/Fixes for DEBUG_ASSERT.
+ * testsuite/27/27stringstream.cc: Same.
+ * testsuite/27/27stringbuf.cc: Same.
+ * testsuite/27/27istringstream_formatted.cc: Same.
+ * testsuite/27/27filebuf.cc: Same.
+
+ * bits/locfacets.h: Remove specializations for messages<char> and
+ messages<wchar_t> ctors. Same for moneypunct. Not required, not used.
+ * src/locale.cc: Remove definitions for above.
+ * src/misc-inst.cc: Revert, take out iomanip.h include.
+ * bits/std_iomanip.h: Tweak, format.
+
+1999-04-19 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/loccore.h: Format, move inline.
+ * bits/locfacets.tcc: Same.
+ * bits/locfacets.h: Same.
+
+ Ulrich Drepper <drepper@cygnus.com>
+ * aclocal.m4: Re-generate.
+ * configure, configure.in: Same.
+ * m4/lc_messages.m4: New file.
+
+1999-04-18 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_ostream.h: Fix typedef for wchar_t instantiations.
+ * bits/sstream.tcc: Tweak.
+
+ * std/iostream: Put __ioinit inside macro guards.
+
+ * src/stlinst.cc: Delete and move to . . .
+ * src/stl-inst.cc: New file, plus wrapping in namespace std.
+ * src/Makefile.in: Change.
+ * src/Makefile.am: Same.
+ * src/misc-inst.cc: Add istringstream/ostringstream instantiations.
+
+ * testsuite/make_check_libfree++: Efficiently format for minimal
+ space. Enforce stricter execution tests by enabling
+ -DDEBUG_ASSERT.
+
+1999-04-16 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * docs/text/RELEASE-NOTES: Fix include typo.
+
+ * src/Makefile.am (headers): Add istream.tcc.
+ * src/Makefile.in (headers): Add istream.tcc.
+
+ * ltconfig, ltmain.sh, libtool: Update to libtool-1.2g.
+
+1999-04-16 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/locfacets.tcc (num_get::do_get(long)): Finish roughing in.
+ * bits/locfacets.h (num_get::_M_extract): New functin:
+ consolidate logic for do_get(...) members.
+
+ * bits/sbuf_iter.h (istreambuf_iterator::operator++()): Fix.
+ * testsuite/27/27istringstream_formatted.cc: Add.
+
+1999-04-16 Martin v. Loewis <martin@mira.isdn.cs.tu-berlin.de>
+
+ * src/basic_file.cc (__basic_file::open): Fix thinko in
+ _G_HAVE_IO_FILE_OPEN bits.
+ * bits/std_istream.h (sentry::sentry(istream, bool)): Fix isspace bug.
+ * bits/std_cmath.h: Add stdlib.h include for ldiv_t.
+ * src/complex.cc (FCT): Qualify all functions with global namespace.
+ * src/locale.cc: Don't qualify memcpy and setlocale.
+ * src/stdexcept.cc (__out_of_range): Qualify out_of_range with std::.
+ (__length_error): Likewise, for length_error.
+ * src/stlinst.cc: Qualify instantiations with std::.
+
+1999-04-15 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * C++STYLE: Add ChangeLog guidelines for member functions.
+
+ * doc/* : Delete.
+ * BADNAMES, BUGS, C++STYLE, CHECKLIST, COPYING,
+ DESIGN, HEADER_POLICY, PROBLEMS, RELEASE-NOTES, TODO: Moved into
+ docs/text and made less strident.
+
+ * bits/fstream.tcc: Change non-standard ctor to match Sun's sematics.
+ * bits/std_fstream.h: Same.
+ * src/ios.cc: Same.
+
+ * bits/locfacets.h: Touch.
+
+1999-04-15 Ulrich Drepper <drepper@cygnus.com>
+
+ * math/cexp.c (cexp): Use NAN instead of nan("").
+ Reported by joel reed <joelreed@yahoo.com>.
+
+ * libio/libioP.h: Define _IO_seek_fpos_t and _IO_seek_off_t based on
+ _G_IO_IO_FILE_VERSION. Use these types in the prototypes.
+ * libio/fileops.c: Use _IO_seek_fpos_t and _IO_seek_off_t types
+ instead of #if cascades.
+ * libio/genops.c: Likewise.
+ * libio/ioseekoff.c: Likewise.
+ * libio/ioseekpos.c: Likewise.
+ * libio/strops.c: Likewise.
+ Patch by Chip Salzenberg <chip@perlsupport.com>.
+
+1999-04-15 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * docs: New directory.
+ * docs/html: Likewise.
+ * docs/text: Likewise.
+ * docs/image: Likewise.
+
+ * bits/std_cmath.h: Add new functions.
+ (abs): overload for long and double.
+ (div): overload for long.
+
+ * bits/valarray_array.h: Fix.
+ * bits/gslice.h: Adjust friend.
+ * bits/slice_array.h: likewise.
+ * bits/valarray_meta.h: likewise.
+
+1999-04-13 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * bits/locfacets.h: More changes, for num_get for insertion
+ operators for integral types. Comment fields in _Format_cache.
+ * bits/locfacets.tcc: And here too: add preliminary long version.
+ * testsuite/27/27istringstream_formatted.cc: Add cases.
+
+1999-04-13 Mark Elbrecht <snowball3@usa.net>
+
+ * configure.in: Add locale.h to AC_CHECK_HEADERS argument. Call
+ AC_LC_MESSAGES macro.
+ * aclocal.m4 (AC_LC_MESSAGES): New. Determines if a target
+ supports LC_MESSAGES.
+ * config.h.in: Add entry for HAVE_LC_MESSAGES.
+ * src/locale.cc (locale::_S_normalize_category): Use the
+ HAVE_LC_MESSAGES macro to check for LC_MESSAGES support instead of
+ _G_NO_CLOCALE_HAS_MESSAGES.
+ * aclocal.m4 (AM_PROG_LD): For DOS style paths, simplify test to
+ '?:' from '?:\\' so any path beginning with a drive name matches.
+
+1999-04-12 Mark Elbrecht <snowball3@usa.net>
+
+ * src/basic_file.cc(sys_open) [O_BINARY]: Declare __testb.
+
+1999-04-12 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * bits/locfacets.h: Tweak.
+ * bits/locfacets.tcc(do_get): Clean/fix bool method.
+
+ * testsuite/21/21nonmember.cc: Same.
+ * testsuite/21/21compare.cc: Fix license.
+ * testsuite/27/27istringstream_formatted.cc: New file.
+
+1999-04-12 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/valarray_meta.h: _BinFunBase1, _BinFunBase2, _BinBase1,
+ _BinBase2: new template classes; put in there to work around a
+ compiler limitation. The whole valarray architecture is now
+ working.
+
+1999-04-08 Benjamin Kosnik <bkoz@haight.constant.com>
+
+ * bits/locfacets.tcc: Fix, format.
+ * bits/locfacets.h: Fix.
+ * src/locale.cc: Same, plus format.
+
+ * bits/basic_string.h: Re-add definition here.
+ * src/string.cc: Take out.
+
+1999-04-08 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/std_valarray.h: tweak.
+ * bits/valarray_array.h tweak. use _Expr.
+ * bits/slice_array.h: likewise.
+ * bits/gslice_array.h: likewise.
+ * bits/mask_array.h: likewise.
+ * bits/indirect_array.h: likewise.
+ * bits/valarray_meta.h: tweak.
+ _UnFunBase, _UnFunClos, _BinFunBase, _FunBase, _ValFunClos,
+ _RefFunClos, _UnBase, _UnClos, _BinBase, _BinClos, _SClos, _GClos,
+ _IClos: new template classes.
+ _Meta: renamed to _Expr. Made template with args.
+ _Constant: made template with two args.
+
+1999-04-05 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/valarray_array.h: tweak.
+
+1999-04-06 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/basic_string.h: Whoops--fix blip.
+
+1999-04-06 Benjamin Kosnik <bkoz@cygnus.com>
+
+ Update to SGI STL 3.13
+ * bits/basic_string.h: Add __get_c_string definition.
+ * stl/bits/stl_range_errors.h: New file.
+ * stl/bits/std_bvector.h: Same.
+ * stl/bits/*: Update.
+
+1999-04-04 1999 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/slice_array.h: tweak.
+ * bits/gslice_array.h: tweak.
+ * bits/mask_array.h: tweak.
+ * bits/indirect_array.h: tweak.
+ * bits/valarray_array.h: tweak.
+ (__valarray_copy): replace copy with memcpy.
+ * bits/std_valarray.h: use __valarray_copy whenever possible.
+ use __valarray_fill instead of fill.
+
+1999-04-02 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * src/gen-num-limits.cc: new file
+ * mknumeric_limits: Ditto.
+
+1999-03-30 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/locfacets.tcc: Do a stub version of num_get for short, int,
+ and long types.
+ * bits/locfacets.h: Add num_get::get methods overloaded for int
+ and short, to resolve ambiguous overloads in istream insertion
+ operators.
+
+1999-03-30 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_istream.h: Fix.
+ * bits/istream.tcc: Fix.
+
+1999-03-30 Philip Martin <pm@corris.dircon.co.uk>
+
+ * testsuite/24/24iterator.cc: fix ++/-- tests
+
+1999-03-29 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_ostream.h: Looks like this, actually: Fix up eh-isms.
+ * bits/ostream.tcc: Same.
+
+ * bits/std_istream.h: Bring over ostream changes, implement member
+ functions. Baseline.
+ * bits/istream.tcc: New file.
+
+1999-03-26 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/gslice.h (class gslice): fix friends template.
+
+1999-03-23 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_ostream.h: Fix sentry objects, implement seekp, tellp,
+ delete cruft, etc.
+ * bits/ostream.tcc: Same.
+
+ * bits/std_istream.h: Minor tweaks.
+
+1999-03-18 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * src/locale-inst.cc: Remove duplicate instantiations.
+ * bits/locfacets.tcc: Tweak definitions of static member.
+
+1999-03-18 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_fstream.h: Format: prepend "__" in front of
+ non-standard typedefs.
+ * bits/fstream.tcc: Match.
+ * bits/std_streambuf.h: Format: prepend "__" in front of
+ non-standard typedefs.
+
+ * bits/sstream.tcc: Match.
+ * bits/std_istream.h: Format.
+ * src/locale-inst.cc: Add num_get instantiations.
+
+ * bits/std_sstream.h: Fix crash in stringstreams. Remove member
+ _M_sb, a basic_stringbuf object, and use the basic_ios pointer
+ _M_streambuf instead. Make initializations sane. Fix
+ allocation/deallocation of _M_streambuf.
+ * bits/std_ostream.h: Fix initialization code.
+ (ctor): Eliminate redundant this->init(), let base class initialize.
+ (default ctor): New. Assume base classes already initialzed.
+ * bits/std_istream.h: Parallel work to ostream.
+ (ctor): Eliminate redundant this->init(), let base class initialize.
+ (default ctor): New. Assume base classes already initialzed.
+ Fix initialization of basic_iostream.
+
+ * bits/std_fstream.h: While we're at it, make initializations sane
+ here too. Now matches sstream.h.
+
+ * bits/string.tcc: Fix crash in basic_string::compare.
+ * bits/basic_string.h: And here.
+ * bits/c++config.h: Add comment about _G_USE_EXCEPTIONS.
+
+ * testsuite/make_check_libfree++: Check shared as well.
+ * testsuite/27/27stringstream.cc: Add bits.
+ * testsuite/27/27boolfmt.cc: Add bits.
+ * testsuite/27/27octfmt.cc: Add bits.
+
+1999-03-17 Benjamin Kosnik <bkoz@happy.cygnus.com>
+
+ * configure.in (USE_LONG_DOUBLE): signbitl link error.
+
+ * bits/locfacets.h: Fix errors that cause build problems
+ with current egcs (template parameters have class scope).
+ * bits/locfacets.tcc: Same.
+ * src/locale-inst.cc: Same, clean.
+ * src/misc-inst.cc: Same, clean.
+
+1999-03-17 Ryszard Kabatek <kabatek@chemie.uni-halle.de>
+
+ * stl/bits/std_memory.h: Modify auto_ptr::reset to reflect the
+ standard. Re-apply this previous patch.
+
+1999-03-17 Philip Martin <pm@corris.dircon.co.uk>
+
+ * bits/basic_string.h: Use __normal_iterator<> for iterators.
+ * bits/std_sstream.h: Support __normal_iterator<> iterators.
+ * bits/string.tcc: Ditto.
+ * src/misc-inst.cc: Ditto.
+ * src/locale-inst.cc: Ditto.
+ * stl/bits/stl_iterator.h: Add __normal_iterator<>.
+ * stl/bits/stl_vector.h: Use __normal_iterator<> for iterators.
+ * testsuite/24/24iterator.cc: Add test cases for basic_string and
+ vector iterators.
+
+1999-03-16 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/locfacets.tcc: Remove macro hack.
+ * bits/locfacets.h: Tweaks.
+ * src/misc-inst.cc: Weed out locale-related instantiations.
+ * src/locale-inst.cc: Same.
+
+ * RELEASE-NOTES: Make more changes.
+ * bits/c++config.h: Bump version number.
+
+ * testsuite/make_check_libfree++: Collect diagnostics.
+
+ * bits/std_ostream.h: Fix ostream initialization/destruction
+ problem, related to dtor cleanup and new cached facets, agggggggh.
+ * bits/ostream.tcc: Tweak.
+ * bits/locfacets.h: Remove all friends of iostream classes.
+ * bits/ios_base.h: Same.
+ * bits/streambuf.tcc: Tweak.
+ * bits/std_streambuf.h: Tweak.
+ * bits/std_fstream.h: Tweak.
+ * bits/fstream.tcc: Tweak.
+ * src/stdstreams.cc: Tweak.
+ * src/ios.cc: Close streams.
+
+ * math/Makefile.in: Add missing files for shared link errors.
+ * math/Makefile.am: Same.
+
+1999-03-15 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * src/locale-inst.cc: More wchar_t instantiations.
+ * src/misc-inst.cc: Missed a few bits.
+ * testsuite/make_check_libfree++: Add static and shared runs.
+ * src/ios.cc: Add clarity to ios_base::Init::~Init().
+
+1999-03-15 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_ostream.h: Format, expunge, simplify. Add cached
+ facets. Resolve link errors.
+ * bits/ostream.tcc: Same.
+ * src/misc-inst.cc: Add ostream, wostream instantiations.
+ * src/Makefile.am: Add missing bits for stdstreams.cc.
+ * src/Makefile.in: Same.
+ * bits/std_iosfwd.h: Format.
+ * bits/locfacets.h (num_put): Add basic_ostream as a friend to
+ num_put so that cached _M_fnumput pointer can be deleted in
+ basic_ostream's dtor. Now everybody plays nice.
+
+1999-03-12 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * bits/gslice.h (class gslice): Make friends valarray,
+ gslice_array and _GliceExpression.
+
+1999-03-11 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * RELEASE-NOTES: Update.
+ * src/ios.cc: Use do proper init.
+ * bits/std_streambuf.h: Tweak.
+ * bits/std_iostream.h: Take out static member.
+ * std/iostream: Put here.
+ * bits/std_ostream.h: Non-default ctor shouldn't smash _M_streambuf.
+ * bits/std_istream.h: Ditto.
+ * bits/basic_ios.h: Format.
+ * bits/ostream.tcc(write): Fix.
+ * bits/fstream.tcc: Fix stdstreams ctor to do a proper
+ initialization of the fstream class.
+ * src/stdstreams.cc: I'm baaaaaaaack.
+
+1999-03-10 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * bits/ios_base.h: Correct comments. Add ios_base::init()
+ functionality. Format, tweak, expunge, clean, bathe, and hang to dry.
+ * src/misc-inst.cc: Add instantiations here.
+ * src/ios.cc: Clean.
+ * bits/std_iostream.h: Add wrappers, global ios_base::Init object.
+ * src/stdstreams.cc: Delete this file, as now unnecessary.
+ * bits/fstream.tcc: Add missing initialization bits for ctor.
+ * src/Makefile.am (libstdc___la_SOURCES): Delete here as well.
+ * src/Makefile.in (libstdc___la_OBJECTS): And here.
+
+ * bits/streambuf.tcc: Tweak.
+ * bits/sstream.tcc: Here too.
+
+ * bits/fstream.tcc: And change definition as well.
+ * bits/std_fstream.h: Change ctor.
+ * src/basic_file.cc (sys_open): Add call that opens a specific fileno.
+ * bits/basic_file.h: Add declarations.
+
+ * testsuite/27/27hello.cc: New file.
+
+ * bits/std_ostream.h: Move flush() inline.
+ * bits/ostream.tcc: From here.
+
+ * bits/char_traits.h: Add include of fpos.h for streamoff/streampos.
+ * bits/std_ios.h: Change include libio to only when necessary.
+ * bits/fpos.h: Like here.
+ * ios_base.h: And here.
+
+ * bits/locfacets.h: Change _Iostate to _Ios_Iostate.
+ * bits/locfacets.tcc: Same.
+ * bits/std_locale.h: Include std_ios.h not std_iosfwd.h.
+ * bits/std_iosfwd.h: Move _Ios_Iostate to ios_base.h
+
+1999-03-09 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * bits/basic_ios.h: Change _M_ctype to _M_fctype.
+
+ * bits/std_streambuf.h: Clean, tweak.
+ * bits/std_fstream.h: Same.
+ * bits/std_sstream.h: Same.
+ * bits/streambuf.tcc: Move most member functions out-of-line.
+ * bits/fstream.tcc: Same.
+ * bits/streambuf.tcc: Same.
+
+ * bits/basic_file.h(filepos_cur): Set correctly.
+ (filepos_beg): Same.
+ (seekpos): Change to __c_streampos.
+ * src/basic_file.cc (std): Change to __c_streampos.
+
+ * testsuite/27/27filebuf.cc: Round one is finished.
+ * testsuite/27/27filebuf-2.tst: New file, final output should match.
+ * testsuite/27/27filebuf-3.tst: Same.
+
+1999-03-08 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * bits/basic_file.h: Fix typo, add comments about what to expect
+ from the various member functions in __basic_file.
+
+ * bits/std_fstream.h: Re-do sync/underflow to work
+ together. Change from sys_read to xsgetn and from sys_write to
+ xsputn. As it should have been from the beginning. . .
+
+1999-03-06 Benjamin Kosnik <bkoz@haight.constant.com>
+
+ * bits/c++config.h (__GLIBCPP__): Add versioning macro.
+
+ * bits/basic_file.h(file_beg): New function.
+ (file_cur): Ditto.
+
+ * testsuite/27/27filebuf.cc: Test in, out, in | out.
+ * bits/std_fstream.h: More _M_mode refinements.
+ (synch): Add bits for out mode only.
+ * bits/std_streambuf.h(xsputn): Correct for filebufs.
+ * bits/std_sstream.h: Ditto.
+
+1999-03-03 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_fstream.h: Fix _M_mode AND with ios_base::openmode.
+ * testsuite/27/27filebuf.cc: Modify.
+ * bits/c++config.h: Fix.
+
+1999-03-02 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * bits/c++config.h: New macro, _G_RESOLVE_LIB_DEFECTS, used to put
+ code in place that diverges from the final standard, but has been
+ brought up on the library mailing list.
+
+ * bits/std_fstream.h(underflow): Position all three internal
+ buffer pointers at the same initial position. Re-implement with
+ basic_filebuf abstraction.
+ (overflow): Ditto.
+ (seekoff): Ditto.
+ (seekpos): Ditto.
+ * bits/std_sstream.h: Move _M_mode down into base class
+ basic_streambuf.
+ * bits/sstream.tcc: Ditto.
+ * bits/std_streambuf.h: Ditto.
+
+ * testsuite/27/27filebuf.cc: Tweak.
+
+1999-02-27 Benjamin Kosnik <bkoz@slap-happy.cygnus.com>
+
+ * bits/std_sstream.h: Ditto.
+ * bits/std_fstream.h: Fix blip.
+
+1999-02-26 Benjamin Kosnik <bkoz@happy.cygnus.com>
+
+ * C++STYLE: Add cases.
+ * bits/std_fstream.h: Format.
+ * bits/std_streambuf.h: Ditto.
+ * bits/std_sstream.h: Ditto.
+
+ * src/basic_file.cc(sys_seek): Fix stack delirium, by keeping
+ return type for _IO_file_seek and __basic_file::seek the same size.
+ * bits/basic_file.h: Ditto.
+
+1999-02-26 Benjamin Kosnik <bkoz@happy.cygnus.com>
+
+ * bits/fstream.tcc: Add include guards.
+ * src/misc-inst.cc: Add instantiations for shared libes.
+ * src/locale-inst.cc: Add instantiaions for use_facet.
+ * bits/loccore.h: Remove specialization foward decls for
+ use_facet<ctype>: perhaps add the whole lot of them later on.
+ * bits/std_fstream.h: Fix.
+ * bits/locfacets.h: Ditto.
+ * src/stdstreams.cc: Disable wide streams for now.
+
+ * src/Makefile.am (CXXFLAGS): Change up.
+ * src/Makefile.in (CXXFLAGS): Ditto.
+
+1999-02-25 Benjamin Kosnik <bkoz@happy.cygnus.com>
+
+ * src/basic_file.cc: Change to ios_base::seekdir from int.
+ * bits/basic_file.h: Ditto.
+ * bits/locfacets.h : Fix blip with new guard macros.
+
+1999-02-25 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * stl/bits/stl_config.h (__STL_USE_STD_ALLOCATORS): Minor tweaking.
+ * bits/c++config.h: Clean. Remove _G_NO_STREAMBUF_ITERATORS and
+ _G_USE_NAMESPACE.
+ * amm1/locale: Remove unused defines.
+ * generic/locale: Ditto.
+ * src/ios.cc: Ditto.
+ * src/locale.cc: Ditto.
+ * src/locale-inst.cc: Ditto.
+ * src/localename.cc: Ditto.
+ * src/stdstreams.cc: And here.
+
+ * bits/c++config.h (_G_USE_WCHAR_T): Fix.
+ * bits/loccore.h: Simplify, clean, add wchar_t guards.
+ * bits/loccore.tcc: Ditto.
+ * bits/locfacets.h: Ditto.
+ * src/locale-inst.cc: Ditto.
+ * bits/locfacets.tcc: Add do_put long long here.
+
+1999-02-24 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_streambuf.h: Add cached ctype facet, _M_ctype.
+ * bits/basic_ios.h: Clean. Replace _M_strbuf with
+ _M_streambuf. Use cached _M_cvt in basic_streambuf.
+ * bits/std_istream.h: Replace _M_strbuf with _M_streambuf.
+ * bits/std_fstream.h: Tweak.
+
+ * bits/char_traits.h: Remove fpos definitions from here. . .
+ * bits/fpos.h: New file, put them here. Eventually, this may allow
+ the severing of char_traits and fpos dependancies.
+ * src/Makefile.in: Add fpos.h.
+ * src/Makefile.am: Ditto.
+ * bits/std_string.h: Add fpos.h include here.
+ * bits/std_ios.h: And here.
+
+ * bits/std_streambuf.h: Change _M_init to _M_initialized.
+ * bits/ios_base.h: Remove cstdio include.
+ * bits/std_ios.h: ... Place here.
+
+1999-02-23 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * src/Makefile.in (CXXFLAGS): Re-add -fvtable-thunks.
+ * src/Makefile.am (CXXFLAGS): Re-add -fvtable-thunks.
+
+ * bits/basic_file.h: Comment, adjust arguments.
+ * src/basic_file.cc: Ditto.
+
+ * bits/std_fstream.h(seekoff): Error is of fpos type, not integral
+ type: check and convert accordingly. Re-interpet "resultant stream
+ position" to indicate external byte sequence location, not internal
+ buffer info.
+
+1999-02-22 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * mkcshadow: And change copyright here.
+ * src/Makefile.am (CXXFLAGS): Add -g -O2. Add new header
+ dependencies for stl_pthread_alloc.h, pthread_allocimpl.h,
+ stl_thread.h, and stl_iterator_base.h.
+ * src/Makefile.in (CXXFLAGS): Ditto.
+ * stl/backward/pthread_alloc.h: Remove.
+
+1999-02-19 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * bits/std_streambuf.h (sungetc): Use standard defs for putback
+ position.
+ * bits/std_fstream.h (pbackfail): Correct.
+ (sungetc): Test.
+ (seekoff): Implement.
+ (seekpos): Re-do.
+ * testsuite/27/27filebuf.cc: Add test cases.
+
+1999-02-18 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * bits/std_fstream.h: Go with basic_file's interfaces for dealing
+ with the external buffers, and stop mucking around with setting
+ and re-setting the external buf's pointers. Aka, clarity and
+ simplicity rule the day.
+ * src/locale.cc: Use memcpy in codecvt::do_in and codecvt::do_out.
+ Remove partial result and support code.
+
+1999-02-18 Ulrich Drepper <drepper@cygnus.com>
+
+ * configure.in: Add hypot, hypotf, atan2f, expf, and copysignf to
+ list of function which have to be replaced.
+ Remove expf from list of functions to test for.
+ Define USE_LONG_DOUBLE in case the libm has partial support for long
+ doubles.
+ * Makefile.in: Regenerated.
+ * config.h.in: Likewise.
+ * configure: Likewise.
+ * libio/Makefile.am (LIBIO_SRCS): Add missing backslash.
+ * libio/Makefile.in: Regenerated.
+ * src/Makefile.in: Regenerated.
+ * string/Makefile.in: Regenerated.
+ * math/Makefile.am (EXTRA_DIST): Add hypot.c, hypotf.c, hypotl.c,
+ atan2f.c, expf.c, and $(EXTRA_yes).
+ (EXTRA_yes): Add signbitl.c mycabsl.c.
+ (libmath_la_LIBADD): Add $(EXTRA_$(USE_LONG_DOUBLE)).
+ (libmath_la_SOURCES): remove long double versions.
+ * math/Makefile.in: Regnerated.
+ * math/atan2f.c: New file.
+ * math/copysignf.c: New file.
+ * math/expf.c: New file.
+ * math/hypot.c: New file.
+ * math/hypotf.c: New file.
+ * math/hypotl.c: New file.
+ * math/cargf.c: Use correct function and macro names.
+ * math/ccos.c: Likewise.
+ * math/ccosh.c: Likewise.
+ * math/ccoshf.c: Likewise.
+ * math/ccoshl.c: Likewise.
+ * math/cexp.c: Likewise.
+ * math/cexpf.c: Likewise.
+ * math/cexpl.c: Likewise.
+ * math/clog.c: Likewise.
+ * math/clog10.c: Likewise.
+ * math/clog10f.c: Likewise.
+ * math/clog10l.c: Likewise.
+ * math/clogf.c: Likewise.
+ * math/clogl.c: Likewise.
+ * math/copysignf.c: Likewise.
+ * math/csin.c: Likewise.
+ * math/csinf.c: Likewise.
+ * math/csinh.c: Likewise.
+ * math/csinhf.c: Likewise.
+ * math/csinhl.c: Likewise.
+ * math/csinl.c: Likewise.
+ * math/csqrt.c: Likewise.
+ * math/csqrtf.c: Likewise.
+ * math/csqrtl.c: Likewise.
+ * math/ctan.c: Likewise.
+ * math/ctanf.c: Likewise.
+ * math/ctanh.c: Likewise.
+ * math/ctanhf.c: Likewise.
+ * math/ctanhl.c: Likewise.
+ * math/ctanl.c: Likewise.
+
+1999-02-17 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * testsuite/27/27filebuf.cc: Add cases.
+ * testsuite/27/27filebuf-1.txt: Remove inadvertent garbage.
+ * bits/std_streambuf.h: Simplify, always have one return statement.
+ * bits/std_fstream.h: Tweak comments in underflow.
+
+1999-02-17 Ulrich Drepper <drepper@cygnus.com>
+
+ * ltmain.sh: Update from libtool 1.2d and fix Solaris problems.
+ * ltconfig: Likewise.
+
+1999-02-16 Christophe Pierret <cpierret@businessobjects.com>
+
+ * src/locale.cc: Fix assert.
+
+1999-02-16 Benjamin Kosnik <bkoz@cygnus.com>
+
+ FIXME: Still need some kind of solution for undefined math symbols.
+ * src/Makefile.in (locale-inst.lo): Compile with
+ -fimplicit-templates to fix Solaris link problem.
+ * src/Makefile.am: Ditto.
+ * libio/Makefile.in: Add stdfiles.c so that _IO_list_all is defined.
+ * libio/Makefile.am: Ditto.
+ * src/locale.cc: Provide some kind of def for _S_tolower.
+ * bits/locfacets.h: Fix declarations of ctype<wchar_t> to
+ match ctype<char> for _S_tolower, _S_toupper, _S_table.
+
+1999-02-10 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/loccore.tcc: Move member-template ctor inline...
+ * bits/loccore.h: ...here.
+ * src/locale-inst.cc: Add instantiation here.
+
+ * testsuite/27/27stringstream.cc: Tweak.
+
+ * bits/ostream.tcc: Include sbuf_iter.h.
+
+ * bits/ostream.tcc: Convert *this to ostreambuf_iterator before
+ passing to num_put, as num_put's first argument is an interator,
+ not basic_ostream.
+
+ * testsuite/make_check_libfree++: New file, runs through the
+ existing test files in the testsuite directory and makes sure
+ they link.
+
+1999-02-10 Brendan Kehoe <brendan@cygnus.com>
+
+ * testsuite/21/21compare.cc: Fix typo.
+ * src/locale.cc (ctype<wchar_t>::_S_{toupper,tolower,table}):
+ Don't try to provide non-linux versions, since it's impossible to
+ initialize their const references with the integer 0, no matter
+ how we try to cast it.
+
+1999-02-10 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_locale.h: Move std_vector.h dependency.
+ * bits/std_ios.h: ...from here.
+ * bits/std_string.h: ...and here.
+ * src/locale.cc: ..to here.
+ * bits/loccore.h: Ditto, add vector forward declaration,
+ make locale::_Impl data members pointers not containers.
+ * bits/loccore.tcc: Move out-of-line for now.
+ * bits/locfacets.h: Move vector dependency from here...
+ * bits/locfacets.tcc: ...to here.
+ * src/localename.cc: ..and here.
+ * src/locale-inst.cc: Add include of locfacets.tcc here.
+
+ * stl/bits/stl_string_fwd.h: Make __get_c_string non-static.
+ * bits/basic_string.h: Can't use sizeof on an incomplete type.
+ * bits/string.tcc: Tweak.
+ * src/string.cc: And add __get_c_string def here.
+
+ * bits/std_fstream.h: Yeah, comment the fill_n idea out as impractical.
+
+ * src/stlinst.cc: Add include of stl_config.h.
+
+1999-02-09 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * stl/bits/std_bitset.h: Update to SGI STL 3.12.
+ * stl/bits/stl_config.h: Tweak, update.
+ * stl/bits/std_stdexcept.h: Ditto, change stl_exception to
+ std_exception.
+ * stl/bits/std_memory.h: Reconstructed auto_ptr, Ditto.
+ * stl/bits/std_functional.h: Ditto.
+
+ * stl/bits/stl_string.h: New file, SGI's string
+ implementation. For reference only, corresponding to string in
+ 3.12 source.
+ * stl/bits/stl_char_traits.h: As above.
+
+ * stl/bits/pthread_allocimpl.h: New file corresponding to
+ pthread_alloc.
+ * stl/bits/stl_pthread_alloc.h: New file corresponding to
+ pthread_alloc.h
+ * stl/bits/stl_threads.h: New file.
+
+ Note that SGI STL 3.12's file iterator.h is not used.
+ * stl/bits/std_iterator.h: Ditto.
+ * stl/bits/stl_iterator.h: Drop in replace.
+ * stl/bits/stl_iterator_base.h: New file, drop in replace.
+
+ * stl/bits/stl_queue.h, stl_rope.h, stl_set.h, stl_stack.h,
+ stl_string_fwd.h, stl_tempbuf.h, stl_tree.h, stl_vector.h,
+ stl_pair.h, stl_multimap.h, stl_multiset.h, stl_list.h,
+ stl_hashtable.h, stl_hash_set.h, stl_hash_map.h, stl_function.h,
+ stl_deque.h, stl_alloc.h, stl_algo.h, stl_algobase.h, ropeimpl.h:
+ Drop-in replace (ie, stop changing __SGI_STL_* to _CPP_BITS_* for
+ preprocessor guards, but fixup include paths and names according
+ to new directory layout).
+
+1999-02-05 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_fstream.h: Remove _M_open data member.
+ * bits/fstream.tcc: Ditto.
+
+ * src/locale.cc: Tweak.
+
+ * bits/std_sstream.h: Simplify.
+
+ * bits/std_streambuf.h: Simplify.
+ (sputc): Use correct definition of "write area."
+
+ * bits/std_fstream.h: Fix uflow.
+ * src/basic_file.cc: Tweak.
+ * testsuite/27/27filebuf.cc: Add tests.
+ * testsuite/27/27filebuf-3.txt: Rename to *-2.txt.
+
+1999-02-02 Ryszard Kabatek <kabatek@chemie.uni-halle.de>
+
+ * bits/ios_base.h: Make protected.
+
+1999-02-01 Ryszard Kabatek <kabatek@chemie.uni-halle.de>
+
+ * bits/ios_base.h: Changes in the class ios_base:
+ Rename _M_exceptions member to _M_exceptions_data.
+ Make the member functions rdstate(), clear(), exceptions()
+ and exceptions(iostate) protected and add the "_M_" prefix.
+ * src/ios.cc: Ditto.
+ * bits/basic_ios.h: Adapt the changes from ios_base.
+
+1999-01-29 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_fstream.h: Remove _M_flags, _M_equilibrate as unnecessary.
+ * bits/fstream.tcc: Ditto.
+
+ * bits/std_fstream.h (underflow): Resize deallocates memory and
+ resets pointers in the internal cache according to new _M_buf. . dooh!
+ * src/locale.cc: Mas changes with codecvt::do_in, do_out.
+
+1999-01-29 Ryszard Kabatek <kabatek@chemie.uni-halle.de>
+
+ * stl/bits/std_memory.h: Modify auto_ptr::reset to reflect the
+ standard.
+
+1999-01-28 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * src/locale.cc (codecvt::do_in): Finer-grained tuning to take
+ into account partial returns.
+ (codecvt::do_out): Likewise.
+
+ * bits/char_traits.h: Change streamsize to be a signed type, as
+ required by 27.4.1 Types p 2. (Changing to _IO_ssize_t.)
+ * bits/std_streambuf.h: Make
+ in_avail() and showmanyc() have streamsize as return types, so
+ that showmanyc()'s return of eof won't underflow in_avail's return
+ value and give a bogus result.
+ * src/misc-inst.cc: And more changes. . .
+
+ * bits/std_streambuf.h (basic_streambuf): Add _M_buf_unified to keep
+ track of joint in/out pointers into the internal buffer.
+ (sbumpc): Add check for _M_buf_unified.
+ (sputbackc): Ditto.
+ (sungetc): Ditto.
+
+ * testsuite/27/27filebuf.cc: Add cases.
+ * testsuite/27/27stringbuf.cc: Add showmanyc case.
+
+ * bits/std_fstream.h (close): Fix logic error.
+ (open): Initialize internal pointers based on _M_buf and _M_buf_size.
+ (showmanyc): Add underflow component, to match the standard.
+
+ * bits/fstream.tcc: Ditto.
+
+1999-01-27 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/basic_file.h: Match vtables w/ _IO_FILE_plus.
+ * src/basic_file.cc: Ditto.
+ * src/Makefile.in: Add -fvtable-thunks to CXXFLAGS: preferred
+ format for dealing with _IO_file in libio.
+
+1999-01-27 Ulrich Drepper <drepper@cygnus.com>
+
+ * src/basic_file.cc: Include fcntl.h.
+
+1999-01-27 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * libio/Makefile.in: Add fileops.lo, genops.lo to objects to debug
+ libio calls.
+ * bits/std_streambuf.h: Redefine read posion.
+
+ * bits/std_fstream.h: Temporary hack to get vtables working again.
+ * bits/basic_file.h: Revert.
+ * src/basic_file.cc: Ditto.
+ * testsuite/27/27filebuf.cc: Tweak.
+
+1999-01-26 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/basic_file.h: Add showmanyc, underflow. .
+ * src/basic_file.cc: Ditto.
+
+ * bits/std_fstream.h (showmanyc): Add bits to ping libio to see if more
+ chars can be read.
+
+ * testsuite/27/27filebuf.cc: Add testcases.
+ * src/basic_file.cc: Add O_CREAT to open calls with
+ ios_base::trunc as part of the open mode.
+
+1999-01-26 Ryszard Kabatek <kabatek@chemie.uni-halle.de>
+
+ * bits/basic_ios.h: fix basic_ios::exceptions(iostate)
+
+1999-01-25 Benjamin Kosnik <bkoz@nabi.net>
+
+ * src/ios.cc (clear): Correct typo.
+ * bits/ios_base.h: Tweak spacing.
+
+1999-01-25 Ryszard Kabatek <kabatek@chemie.uni-halle.de>
+
+ * bits/basic_ios.h: fix basic_ios::fail()
+
+1999-01-25 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * bits/basic_file.h: Include libioP.h from libio instead of here.
+ * bits/iolibio.h: Remove.
+ * bits/libio.h: Remove.
+
+1999-01-22 Benjamin Kosnik <bkoz@lunatic.cygnus.com>
+
+ * bits/std_fstream.h: Tweak cvt-> in call for newer egcs compilers.
+
+1999-01-22 Ulrich Drepper <drepper@cygnus.com>
+
+ * Makefile.am (SUBDIRS): Add libio.
+ * configure.in: Add rule to test for glibc2.
+
+ * src/Makefile.am (INCLUDES): Add -I to libio subdir.
+ (libstdc___la_LIBADD): Add libio.la.
+
+1999-01-21 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/basic_file.h: Make new abstraction for underlying C library
+ FILE, named __basic_file.
+ * src/basic_file.cc: New file.
+ * bits/os_raw.h: Delete.
+ * src/os_raw.cc: Delete.
+ * src/Makefile.in: Tweak.
+ * src/Makefile.am: Tweak.
+ * bits/iolibio.h: Add this here, for the time being.
+ * bits/libioP.h: Ditto.
+
+ * bits/ios_base.h: Delete unused defines.
+ * src/locale.cc (codecvt<char, char, mbstate_t>::do_in): Use
+ strcpy to copy between the two buffers.
+
+ * testsuite/27/27stringbuf.cc: Change license, fix in_avail tests.
+ * testsuite/27/27filebuf.cc: New file.
+ * testsuite/27/27filebuf-1.txt: Data file for above test.
+ * testsuite/27/27filebuf-2.txt: Ditto.
+
+ * bits/std_streambuf.h (uflow): Re-implement default.
+ * bits/std_fstream.h: Set _M_buf_size based on cstdio's BUFSIZ.
+ Re-implement virtual functions.
+ * bits/fstream.tcc: Delete unused mf's.
+
+1998-12-31 Benjamin Kosnik <bkoz@lunatic.cygnus.com>
+
+ * bits/fstream.tcc: Add fstream ctor for cin/cout/etc.
+ * bits/std_fstream.h: Ditto.
+ * src/stdstreams.cc: Ditto.
+
+ * math/cpowl.c: Fix header typo with last change.
+
+1998-12-31 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * COPYING: New file (GPL v 2).
+ * LICENSE.STD: Remove.
+ * ./*: Change license.
+
+1998-12-30 Benjamin Kosnik <bkoz@haight.constant.com>
+
+ * bits/std_streambuf.h (std): Remove static on _M_init.
+ * bits/streambuf.tcc (std): Ditto.
+
+ * bits/std_fstream.h: Add changes as discussed with Nathan, including
+ state_type and codecvt_type members, the allocation of an internal
+ buffer, the streamlined codecvt calls, etc.
+
+1998-12-21 Benjamin Kosnik <bkoz@haight.constant.com>
+
+ * bits/std_sstream.h: Tweak.
+ * bits/fstream.tcc: Remove unused stubs.
+ * bits/std_fstream.h: Tweak.
+
+1998-12-17 Benjamin Kosnik <bkoz@tintin.cygnus.com>
+
+ * bits/std_streambuf.h: Move _IO_file_flags into basic_filebuf.
+ Remove unused _IO_* members, possibly put into filebuf, which may
+ need them.
+ * bits/std_fstream.h: Add _M_flag.
+ * bits/sbuf_iter.h: Tweak.
+
+ * bits/std_cstdio.h: Add SEEK_SET, SEEK_END, SEEK_CUR.
+ * bits/ios_base.h: Use.
+
+ * src/stdstreams.cc: Modify to reflect standard ctors for
+ filebuf.
+ * src/misc-inst.cc: Ditto.
+
+ * bits/os_raw.h: Wrap in std namespace. Model parameters on
+ underlying C library calls instead of the underlying unix
+ filesystem.
+ * src/os_raw.cc (_S_os_open): Use fopen, and compute a mode
+ string as per p.659.
+ (_S_os_close): Model on fopen.
+ (_S_os_read): Model on fread.
+ (_S_os_write): Model on fwrite.
+ (_S_os_seek): Model on fseek.
+
+ * bits/ios_base.h: Tweak.
+ * bits/std_iosfwd.h: Wrap libio.h include with extern "C".
+ * bits/std_sstream.h: Tweak.
+ * bits/sstream.tcc: Remove old, uncalled code.
+ * bits/std_fstream.h: Major reconstruction.
+ * bits/fstream.tcc: Disable for the time being.
+
+1998-12-11 Benjamin Kosnik <bkoz@haight.constant.com>
+
+ * bits/basic_string.h: Fix insert method.
+ * stl/bits/stl_iterator.h: Remove previous hack.
+ * bits/std_streambuf.h (sbumpc): Correct increment/return oddness.
+ * bits/std_sstream.h: Fix more regressions.
+ * testsuite/27/27stringbuf.C: Add (almost) complete tests.
+
+1998-12-09 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * bits/basic_string.h: Tweak.
+
+ * stl/bits/stl_iterator.h: Specialize iterator_traits for int so
+ that string::append can be instantiated. HACK--checkin
+ basic_string::iterator class.
+
+1998-12-07 Benjamin Kosnik <bkoz@haight.constant.com>
+
+ * bits/std_sstream.h: Tweak.
+ * bits/sstream.tcc: Tweak ctors.
+
+ FIXME invalid friend defs. . WHERE ARE THEY??
+
+ * bits/sbuf_iter.h (istreambuf_iterator::equal): Change to new
+ names for basic_streambuf data members.
+
+ * bits/std_streambuf.h: Add getloc() initialization bits.
+ basic_streambuf(): Initialize with global locale data.
+ imbue(): Set _M_init.
+
+ * bits/std_streambuf.h(seekoff, seekpos): Complete with invalid
+ stream pos == pos_type(off_type(-1)).
+ in_avail(): Complete default implementation.
+ snextc, sbumpc, sputbackc, sungetc, sputc, setg, xsputn,
+ underflow, uflow, xsgetn, showmany, sync: Ditto.
+
+ * bits/std_streambuf.h: _M_snextc_helper(): Remove.
+
+ * bits/streambuf.tcc (sputbackc): Temporarily remove, need to
+ re-populate with in-line member functions that are too big. Add
+ initialization for _M_init.
+
+1998-12-03 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/sstream.tcc: Convert _Allocator to _Alloc. Add typedefs
+ for basic_string and basic_streambuf. Scope _IO_buf_* pointers to
+ streambuf_type.
+
+ * src/stdstreams.cc (std): Disable wchar_t instantiations.
+
+ * bits/c++config.h (_G_DEPRICATED): Add.
+ (_G_USE_WCHAR_T): Add.
+ * bits/std_streambuf.h: Radical reconstruction of basic_streambuf.
+ Take out _Streambuf_base. Put _IO_FILE data member in basic_filebuf.
+ * bits/streambuf.tcc (sputbackc): Remove ctor anti-def, Tweak.
+ * bits/std_fstream.h: Add comment for implementation.
+ * src/streambuf.cc: Remove.
+ * src/Makefile.in: Remove streambuf.lo.
+ * src/misc-inst.cc: Tweak.
+
+1998-12-02 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/std_sstream.h: Add const_cast to rdbuf returns.
+ * testsuite/27stringstream.C: Modify.
+
+1998-11-25 Benjamin Kosnik <bkoz@haight.constant.com>
+
+ * src/Makefile.in (libstdc___la_OBJECTS): Add streambuf.lo.
+ (libstdc___la_SOURCES): Ditto.
+
+ * bits/streambuf.tcc: Tweak.
+
+ * src/streambuf.cc: New file, add out-of-line definitions for
+ _Streambuf_base.
+
+ * src/misc-inst.cc: Remove _Streambuf_base instantiations.
+ Comment out wchar_t versions of the buffer instantiations, for now.
+
+ * bits/std_streambuf.h: Wrap libio.h include with extern "C".
+ Remove template wrapper around _Streambuf_base.
+ Move IO_* data members into _Streambuf_base.
+ Move _Streambuf_base members into streambuf.tcc.
+
+ * bits/c++config.h (_G_USE_LIBIO): Enable.
+
+1998-11-02 Nathan Myers <ncm@cantrip.org>
+
+ * CHECKLIST: downgrade iterator implementations
+ * DESIGN: fill out notes about unimplemented features
+
+1998-10-31 Nathan Myers <ncm@cantrip.org>
+
+ * CHECKLIST: itemized list of all interfaces, and status of each.
+
+1998-10-30 Nathan Myers <ncm@cantrip.org>
+
+ * RELEASE-NOTES: add notes about optional includes, linking, running
+ * src/Makefile.am: handle header installs properly
+ * src/Makefile.in: regenerate from new src/Makefile.am
+
+1998-10-30 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * bits/basic_string.h: Revert npos pending ciso646.
+ * src/Makefile.am: Revert CXX flags for now.
+ * src/Makefile.in: Ditto.
+
+1998-10-30 Brendan Kehoe <brendan@cygnus.com>
+
+ * bits/std_sstream.h: Re-order ctors to put base before member
+ inits.
+
+1998-10-30 Ryszard Kabatek <kabatek@chemie.uni-halle.de>
+
+ * stl/bits/std_memory.h: Fix typo.
+
+1998-10-30 Nathan Myers <ncm@cantrip.org>
+
+ * src/string[A-Z]+.cc: change back to include "string.cc".
+ * src/Makefile.am: revert filename changes. We need a different
+ way to keep filenames in std/ from confusing Make.
+ * bits/basic_string.h: define _S_max_size right, return it from
+ string::max_size(); churn definition of npos again.
+ * bits/string.tcc: fix _S_frob_size to avoid uint overflow.
+ * bits/ios.cc: remove #ifdef on ios_base locale member initialization
+ * BUGS: clear cruft.
+ * C++STYLE: Touchup for release.
+ * CHECKLIST: Touchup for release.
+ * DESIGN: New file.
+ * LICENSE.STD: Add requirement to retain copyrights and to provide
+ the license with any copies.
+ * README: Update for release.
+ * TODO: Minor touchup for release.
+ * RELEASE-NOTES: prepare for release
+
+1998-10-29 Ulrich Drepper <drepper@cygnus.com>
+
+ * src/string[A-Z]+.cc: Include stdstring.cc, not string.cc.
+
+ * src/Makefile.am (CXXFLAGS): Define _GNU_SOURCE.
+
+ * src/Makefile.am (CXXLINK): New variable. Make sure we don't use
+ CXX to generate the shared object.
+
+ * src/Makefile.am (headers): Remove duplicated char_traits.h.
+
+1998-10-29 Brendan Kehoe <brendan@cygnus.com>
+
+ * bits/basic_string.h (basic_string<>::max_size): Subtract 1, not
+ 2, from npos, solving infinite loop problems.
+
+1998-10-29 18:41 Ulrich Drepper <drepper@cygnus.com>
+
+ * src/Makefile.am: Add rules to install headers.
+
+1998-10-29 Nathan Myers <ncm@cantrip.org>
+
+ * bits/std_ostream.h: Remove #ifdef on operator<< for long double
+ * bits/ostream.tcc: Remove #ifdef on operator<< for long double
+ * shadow/libio.h:
+ * shadow/unistd.h:
+ * shadow/bits/wrap_libio.h:
+ * shadow/bits/wrap_unistd.h: New files.
+
+1998-10-29 Brendan Kehoe <brendan@cygnus.com>
+
+ * bits/ostream.tcc (operator<<): Wrap with #ifdef
+ _G_HAVE_LONG_DOUBLE_IO, to match bits/std_ostream.h.
+
+1998-10-29 Ulrich Drepper <drepper@cygnus.com>
+
+ * src/Makefile.am: Add temporarily rules to make sure misc-inst.cc
+ is not compiled with -fno-implicit-templates in effect.
+
+ * src/Makefile.am (EXTRA_SOURCES): Add string.cc and wstring.cc here.
+ (libstdc___la_SOURCES): Add all the string*.cc and wstring*.cc files.
+ * src/stringADDCS.cc: Wrapper around string.cc to define individual
+ function.
+ * src/stringADDPS.cc: Likewise.
+ * src/stringADDSC.cc: Likewise.
+ * src/stringADDSP.cc: Likewise.
+ * src/stringADDSS.cc: Likewise.
+ * src/stringBIST.cc: Likewise.
+ * src/stringBOST.cc: Likewise.
+ * src/stringCHTR.cc: Likewise.
+ * src/stringEQPS.cc: Likewise.
+ * src/stringEQSP.cc: Likewise.
+ * src/stringEQSS.cc: Likewise.
+ * src/stringEXTRA.cc: Likewise.
+ * src/stringGEPS.cc: Likewise.
+ * src/stringGESP.cc: Likewise.
+ * src/stringGESS.cc: Likewise.
+ * src/stringGETLI.cc: Likewise.
+ * src/stringGTPS.cc: Likewise.
+ * src/stringGTSP.cc: Likewise.
+ * src/stringGTSS.cc: Likewise.
+ * src/stringINSER.cc: Likewise.
+ * src/stringLEPS.cc: Likewise.
+ * src/stringLESP.cc: Likewise.
+ * src/stringLESS.cc: Likewise.
+ * src/stringLTPS.cc: Likewise.
+ * src/stringLTSP.cc: Likewise.
+ * src/stringLTSS.cc: Likewise.
+ * src/stringMAIN.cc: Likewise.
+ * src/stringNEPS.cc: Likewise.
+ * src/stringNESP.cc: Likewise.
+ * src/stringNESS.cc: Likewise.
+ * src/stringSCOPY.cc: Likewise.
+ * src/wstringADDCS.cc: Wrapper around wstring.cc to define individual
+ functions.
+ * src/wstringADDPS.cc: Likewise.
+ * src/wstringADDSC.cc: Likewise.
+ * src/wstringADDSP.cc: Likewise.
+ * src/wstringADDSS.cc: Likewise.
+ * src/wstringBIST.cc: Likewise.
+ * src/wstringBOST.cc: Likewise.
+ * src/wstringCHTR.cc: Likewise.
+ * src/wstringEQPS.cc: Likewise.
+ * src/wstringEQSP.cc: Likewise.
+ * src/wstringEQSS.cc: Likewise.
+ * src/wstringEXTRA.cc: Likewise.
+ * src/wstringGEPS.cc: Likewise.
+ * src/wstringGESP.cc: Likewise.
+ * src/wstringGESS.cc: Likewise.
+ * src/wstringGETLI.cc: Likewise.
+ * src/wstringGTPS.cc: Likewise.
+ * src/wstringGTSP.cc: Likewise.
+ * src/wstringGTSS.cc: Likewise.
+ * src/wstringINSER.cc: Likewise.
+ * src/wstringLEPS.cc: Likewise.
+ * src/wstringLESP.cc: Likewise.
+ * src/wstringLESS.cc: Likewise.
+ * src/wstringLTPS.cc: Likewise.
+ * src/wstringLTSP.cc: Likewise.
+ * src/wstringLTSS.cc: Likewise.
+ * src/wstringMAIN.cc: Likewise.
+ * src/wstringNEPS.cc: Likewise.
+ * src/wstringNESP.cc: Likewise.
+ * src/wstringNESS.cc: Likewise.
+ * src/wstringSCOPY.cc: Likewise.
+ * src/string.cc: Remove now unneeded #defines now.
+
+1998-10-29 Nathan Myers <ncm@cantrip.org>
+
+ * bits/locfacets.tcc: Define num_put::put(... const void*), improve
+ integer formatting.
+ * bits/ostream.tcc: Delete cruft, rewrite various op<< as members,
+ add definitions for double, long double, const void*.
+ * bits/std_ostream.h: Move op<<'s back into class ostream,
+ define some in-line.
+ * bits/string.tcc: fix unnecessary-copying bug in op[], typos in
+ string construction from input iterators that Brendan reported.
+
+
+1998-10-28 Brendan Kehoe <brendan@cygnus.com>
+
+ * stl/bits/stl_pair.h (op!=, op>, p<=, op>=): Add missing definitions.
+
+ * bits/valarray_meta.h (class _Constant): Move declaration to the
+ top, so the rest of the file can grok it.
+ (_ApplyBinaryFunction::operator[]): Add missing parenthesis.
+
+ * bits/std_sstream.h (basic_ostringstream::str): Fix typo of extra
+ semicolon.
+ (basic_stringstream::str, both instances): Likewise.
+
+1998-10-28 Nathan Myers <ncm@cantrip.org>
+
+ * bits/locfacets.h: fix num_put<>::falsename()
+ * bits/locfacets.tcc: fix _Format_cache<>::_M_populate bool name init
+ * testsuite/27/27octfmt.C, testsuite/27/27octfmt.C: new tests
+ * bits/locfacets.tcc: touch up _S_group_digits.
+ * src/misc-inst.cc: adjust _S_group_digits insts to match.
+
+1998-10-27 Nathan Myers <ncm@cantrip.org>
+
+ * stl/bits/stl_config.h: Turn off long long support, for now.
+ * src/locale-inst.cc: Instantiate num_put<> only for
+ ostreambuf_iterator, num_get only for istreambuf_iterator.
+ * src/misc-inst.cc: Delete duplicate locale-related instantiations,
+ add lots of new instantiations for num_put support function templates;
+ remove junk about __match_parallel for ostreambuf_iterator.
+
+1998-10-27 Nathan Myers <ncm@cantrip.org>
+
+ * bits/locfacets.tcc: Make num_put's digit grouping work.
+ * bits/string.tcc: More uglification.
+ * src/ios.cc: initialize format cache right
+
+1998-10-26 Nathan Myers <ncm@cantrip.org>
+
+ * bits/basic_string.h: Uglify more names.
+ * bits/fstream.tcc: Rewrite some filebut output handling.
+ * bits/ios_base.h: Cosmetic.
+ * bits/locfacets.h: Changes to _Format_cache for support of num_put.
+ Also, specialize its default ctor for optimal default case.
+ #ifdef out "long long" prototypes for now.
+ * bits/locfacets.tcc: Do complete, optimized num_put<>::do_put
+ implementation for integer types. (Still needs optimized
+ std::copy() applied to ostreambuf_iterator to be optimal.)
+ * bits/ostream.tcc: Write operator<< for long, bool types.
+ Make other operators<< non-members, per spec. (Many still
+ not implemented.) Identify those that fail to create a sentry.
+ * bits/sbuf_iter: Cosmetic.
+ * bits/std_fstream.h: Add some filebuf members.
+ * bits/std_locale.h: Include <limits> for use in bits/locfacets.h
+ * bits/std_ostream.h: Make member operators<< global, per spec.
+ (Should do the same in std_istream.h.)
+ * bits/std_string.h: Include <limits> for use in bits/locfacets.h
+ * bits/string.tcc: Uglify names
+ * shadow/bits/std_cstdlib.h: Optimize std::div and std::ldiv.
+ * src/ios.cc: Specialize _Format_cache<> for char and wchar_t,
+ for optimal default behavior.
+
+1998-10-26 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * src/Makefile.in (libstdc___la_SOURCES): Add misc-inst.cc again.
+
+1998-10-21 Nathan Myers <ncm@cantrip.org>
+
+ * src/locale.cc: make ctype operations actually work for glibc
+ * CHECKLIST: add a comprehensive (i.e. huge) implementation
+ checklist of stdlib facilities. Not filled in yet.
+
+1998-10-20 Nathan Myers <ncm@cantrip.org>
+
+ * bits/string.tcc: fix patching NULs on string ends.
+
+1998-10-19 Nathan Myers <ncm@cantrip.org>
+
+ * bits/std_iosfwd.h: eliminate "basic_" prefix on streambuf
+ iterator forward declarations
+ * bits/sbuf_iter.h: eliminate default template argument definitions
+ on streambuf iterators (rely on <iosfwd> decls).
+ * TODO: add note about lazy facet construction
+ * bits/basic_ios.h: hit operator void* again. This should be the
+ last time we need to touch it.
+ * bits/basic_ios.h: copyfmt now returns *this.
+ * bits/basic_string.h: fix npos again. npos cannot be defined as zero.
+ * bits/basic_string.h: put back overloaded constructors; adjust
+ behavior for default allocator on copy constructor.
+ * bits/char_traits.h: make not_eof return correct type.
+ * bits/loccore.h: remove call to bits/std_stdexcept.h; subincludes
+ cannot be in non-standard headers or we get include loops (bad)
+ * bits/loccore.h: delete ifdef'd out workarounds for old compiler bugs.
+ * bits/loccore.h: add apparatus to support lazy construction of
+ facets.
+ * bits/locfacets.tcc: Uglify names in __match_parallel decl.
+ * bits/std_ios.h: add include of <typeinfo> to get bad_cast for
+ locale use_facet<> failure.
+ * bits/std_locale.h: same.
+ * bits/std_string.h: same.
+ * bits/std_stdexcept.h: change exception member __msg from a
+ reference to a regular object.
+ * bits/string.tcc: add pasting a NUL on the end of strings after
+ each operation. We had already left room for it, but previously
+ plugged it only on a call to c_str(), but the WG changed the
+ requirement when I wasn't looking. (Can't leave them alone for
+ a second without they break something else.)
+ * bits/valarray_meta.h: add Gaby's changes from 981018.
+ * src/locale.cc: add new type _Bad_use_facet to be thrown on
+ failure of use_facet<>().
+ * src/stdexcept.cc: remove pragma, remove bkoz's #if 0,
+ comment out leftover member definitions
+
+1998-10-16 Ulrich Drepper <drepper@cygnus.com>
+
+ * string/Makefile.am: Revert last change.
+ * math/Makefile.am: Likewise.
+
+1998-10-15 Benjamin Kosnik <bkoz@haight.constant.com>
+
+ * bits/std_sstream.h: Fix typo.
+
+1998-10-15 Benjamin Kosnik <bkoz@haight.constant.com>
+
+ * src/Makefile.am (libstdc___la_SOURCES): Add misc-inst.cc.
+
+ * bits/std_sstream.h: Add typedefs, member definitions. Clean.
+ * bits/std_stdexcept.h: Remove.
+
+1998-10-15 Benjamin Kosnik <bkoz@haight.constant.com>
+
+ * src/misc-inst.cc: Tweak again.
+
+ * bits/std_sstream.h: Move out-of-line definitions to sstream.tcc.
+ * bits/sstream.tcc: New file.
+
+1998-10-15 Ulrich Drepper <drepper@cygnus.com>
+
+ * configure.in: Test for machine/param.h, sys/machine.h and fp.h.
+ Don't run AC_C_BIGENDIAN if machine/param.h or sys/machine.h are
+ available.
+
+ * math/mathconf.h: Include sys/machine.h, machine/param.h and fp.h
+ if available.
+ (INFINITE_P): Use IS_INF macro if available.
+
+1998-10-15 Ulrich Drepper <drepper@cygnus.com>
+
+ * math/Makefile.am (EXTRA_LTLIBRARIES): Renamed from
+ noinst_LTLIBRARIES.
+ * string/Makefile.am: Likewise.
+
+1998-10-15 Ulrich Drepper <drepper@cygnus.com>
+
+ * configure.in (AC_CHECK_FUNCS): Add finite, qfinite, fpclass, and
+ qfpclass.
+ (AC_CHECK_HEADERS): Add machine/endian.h. If no header specifying
+ endianess is available run AC_C_BIGENDIAN.
+
+ * math/clog10l.c: Add ugly hack around bug in Irix 6.2 header until
+ fixincludes is fixed.
+ * math/clogl.c: Likewise.
+ * math/csqrtl.c: Likewise.
+ * math/mycabsl.c: Likewise.
+
+ * math/mathconf.h: Include machine/endian.h if possible. If no
+ header describing endianess is available rely on WORDS_BIGENDIAN
+ macro.
+ (FINITE_P, FINITEF_P, FINITEL_P): Use finite functino if available.
+ (INFINITE_P, INFINITEF_P, INFINITEL_P): Use fpclass function if
+ available.
+
+ * src/complex.cc (polar): Don't use sincos on OSF machines.
+
+1998-10-09 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * src/locale-inst.cc: Don't instantiate time_get for
+ ostreambuf_iterators as time_get::do_get_weekday and
+ time_get::do_get_monthname use __match_parallel, which is illegal
+ for ostreambuf_iterators to use, as they don't have operator== or
+ operator!=.
+ * bits/std_stdexcept.h: Add dtor definitions.
+ Use stl/bits/std_stdexcept.h instead of this file?
+ * bits/sbuf_iter.h : Tweak.
+ * src/misc-inst.cc: Tweak.
+
+1998-10-09 Benjamin Kosnik <bkoz@haight.constant.com>
+
+ * bits/std_stdexcept.h: New file.
+ * src/stdexcept.cc: Define the following:
+ logic_error::what()
+ runtime_error::what()
+
+ * src/misc-inst.cc: New file.
+ * src/Makefile.in (libstdc___la_SOURCES): Add misc-inst.cc.
+ (libstdc___la_OBJECTS): Add misc-inst.lo.
+
+ * bits/basic_string.h: Disable non-standard ctor declarations.
+ * bits/string.tcc: Disable definitions as well.
+ * src/string.cc: Disable <ios> dependancies.
+ * bits/sbuf_iter.h (std): Add default to template parameter for
+ ostreambuf_iterator and istreambuf_iterator.
+ * bits/std_iosfwd.h: Change istreambuf_iterator to
+ basic_istreambuf_iterator. Likewise for ostreambuf.
+ * bits/locfacets.tcc (__match_parallel): Fix typo.
+ * src/ios.cc (imbue): Remove the _G_HAVE_LOCALE guards around
+ ios_base::imbue.
+ * bits/std_streambuf.h: Define _Streambuf_base::getloc().
+ * bits/std_istream.h: Define the following:
+ get (basic_streambuf<char_type,_Traits>& __sb, char_type __delim)
+ get (char_type* __s, streamsize __n, char_type __delim);
+ getline (char_type* __s, streamsize __n, char_type __delim)
+ * bits/loccore.h : FIXME friend template code for use_facet.
+ Add std_stdexcept.h include so that range_error will be defined.
+ Add explicit conversion to string for range_error throws. (HACK?)
+
+1998-10-8 Ulrich Drepper <drepepr@cygnus.com>
+
+ * configure.in: Check for sincos, sincosf, and sincosl.
+ * src/complex.cc (polar): Use sincos if available.
+
+ * bits/c++config.h: Fix hack to get LONG_LONG* definitions on Linux.
+ * stl/bits/std_limits.h: Include bits/c++config.h. HACK!!!
+
+ * math/clog10.c: Fix typo (FP_INIFITE_P -> INFINITE_P).
+
+ * math/cpow.c: Use c_log, not clog.
+ * math/cpowf.c: Likewise.
+ * math/cpowl.c: Likewise.
+
+ * math/cexp.c: Remove unused fpclassify calls. Use FINITE_P instead
+ of isfinite call.
+
+ * math/mathconf.h (FINITE_P, FINITEF_P, FINITEL_P): Define using
+ isfinite macro if it is available.
+ (INFINITE_P, INFINITEF_P, INFINITEL_P): Define using isinf macro.
+
+ * math/ccosf.c: Use appropriate test macros for this type.
+ * math/ccoshf.c: Likewise.
+ * math/ccoshl.c: Likewise.
+ * math/ccosl.c: Likewise.
+ * math/cexpf.c: Likewise.
+ * math/cexpl.c: Likewise.
+ * math/clog10f.c: Likewise.
+ * math/clog10l.c: Likewise.
+ * math/clogf.c: Likewise.
+ * math/clogl.c: Likewise.
+ * math/csinf.c: Likewise.
+ * math/csinhf.c: Likewise.
+ * math/csinhl.c: Likewise.
+ * math/csinl.c: Likewise.
+ * math/csqrtf.c: Likewise.
+ * math/csqrtl.c: Likewise.
+ * math/ctanf.c: Likewise.
+ * math/ctanhf.c: Likewise.
+ * math/ctanhl.c: Likewise.
+ * math/ctanl.c: Likewise.
+
+1998-10-06 Benjamin Kosnik <bkoz@bliss.nabi.net>
+
+ * bits/basic_ios.h: Fix previous change.
+
+1998-10-06 Benjamin Kosnik <bkoz@bliss.nabi.net>
+
+ * bits/basic_ios.h: Add const_cast<basic_ios&>
+ (operator void*): As per 5.2.9 p 2, make sure static_cast is
+ well-formed.
+ * bits/char_traits.h: No _CharT for specialization, change to 0.
+ * bits/basic_string.h: As per 9.4.2 p4, initialize with
+ constant-initializer.
+ * bits/locfacets.tcc: Add template parameter to initialization list.
+
+1998-10-02 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * bits/basic_string.h: Should just be <, not <=.
+
+1998-10-01 Benjamin Kosnik <bkoz@bliss.nabi.net>
+
+ * bits/string.tcc (compare): Fix for strings that are similar, but
+ not the same length.
+
+1998-09-04 Brendan Kehoe <brendan@cygnus.com>
+
+ * bits/c++config.h: For __linux__, define _GNU_SOURCE. This is
+ required for us to get LONG_LONG_{MIN,MAX} out of gcc's limits.h.
+ We can't check for __GLIBC__ here, since this header can be read
+ before any system one (that would lead to features.h) being used.
+
+ * stl/bits/stl_config.h (__STL_LONG_LONG): Re-enabled
+
+ * stl/bits/std_limits.h [__STL_LONG_LONG]: Fix usage to use
+ LONG_LONG_MIN, LONG_LONG_MAX, and ULONG_LONG_MAX.
+
+ * stl/bits/stl_config.h: Don't do __STL_LONG_LONG, it uses
+ LONGLONG_{MIN,MAX} which I can't find the origin of.
+
+1998-09-03 Brendan Kehoe <brendan@cygnus.com>
+
+ * stl/bits/stl_iterator.h: Add extern decl of cin for now; where
+ should this come from, if not iostream.h?
+ (class istream_iterator): Make the new operator!= a friend also.
+
+ * stl/bits/stl_config.h: Define __STL_HAS_WCHAR_T,
+ __STL_MEMBER_TEMPLATE_CLASSES, and __STL_LONG_LONG. Don't include
+ _G_config.h like the egcs one does.
+
+1998-09-01 Brendan Kehoe <brendan@cygnus.com>
+
+ * bits/string.tcc: Call `_M_destroy' instead of `destroy'.
+
+ * bits/valarray_meta.h: Throughout, rename _Expr typedefs to be
+ _Expr1 (or _Expr_def if it's taken), and change definitions.
+ Avoids redecl of the template parm.
+
+ * bits/string.tcc (basic_string copy ctor): Fix typo in declaration.
+ (operator>>): Initialize __ERROR with ios_base::goodbit, not 0.
+
+ * bits/std_streambuf.h (_POSIX_SOURCE): Only define if it's not
+ already done.
+
+ * src/locale-inst.cc: New file, **TOTAL HACK**. There has GOT to
+ be a better way to do this.
+
+ * src/stlinst.cc: New file.
+
+ * BUGS: New file, with various discovered bugs that need to be
+ fixed.
+
+ * Makefile.in, math/Makefile.in, string/Makefile.in,
+ src/Makefile.in: Reran automake.
+
+ Workarounds, these may not all be the final fixes:
+
+ * bits/basic_ios.h (class basic_ios): Make _M_strbuf be protected,
+ not private, for basic_istream::get() in std_istream.h to be able
+ to use it.
+ (basic_ios::operator void*): Don't use static_cast for the false
+ case.
+ (basic_ios::copyfmt): Fix `rhs.except' to be `rhs.exceptions ()'.
+ This appears to have been in sep94, but didn't get corrected
+ afterwards.
+
+ * bits/basic_string.h (npos): Don't init here.
+ * bits/string.tcc: Instead, do initialization here, to -1 instead
+ of the size_type destructor.
+
+ * src/traits.cc, src/wtraits.cc: New files.
+ * bits/char_traits.h: For char_traits<char> and
+ char_traits<wchar_t>, declare static, but define over in the src
+ files.
+
+ * bits/gslice.h: Comment out forward decls of _Array, valarray,
+ gslice_array, and _GsliceExpression.
+
+ * bits/std_cstdio.h [__sparc__ && __svr4__]: #undef all of
+ clearerr, feof, ferror, getc, getchar, putc, putchar, stdin,
+ stdout, and stderr. Note we do get unresolved refs to stdin, but
+ that'll get fixed by the "true" solution.
+
+ * bits/std_ios.h: Include <bits/std_streambuf.h> to get the
+ definition of basic_streambuf.h, which is used in basic_ios.h to
+ call pubimbue.
+
+ * bits/std_streambuf.h: Don't include libio.h for now.
+ (class basic_streambuf): Define missing methods pubimbue and
+ getloc.
+
+ * src/Makefile.am (libstdc___la_SOURCES): Add stdexcept.cc,
+ ios.cc, os_raw.cc, stdstreams.cc, locale.cc, localename.cc,
+ locale-inst.cc, stlinst.cc, traits.cc, wtraits.cc.
+
+ * src/ios.cc: Instantiate basic_ios<char> and basic_ios<wchar_t>.
+
+ * src/locale.cc: Come up with munged versions of _S_toupper,
+ _S_tolower, and _S_table instead of the glibc-specific ones, so
+ they're at least defined, if not necessarily usable. The glibc
+ ones on any other system will yield unresolved refs to
+ __ctype_{b,toupper,tolower}.
+
+ * src/string.cc: Define all of ADDCS, ADDPS, et al. Add
+ basic_ios, basic_istream, basic_ostream. Don't do char_traits
+ anymore cuz of the explicit specialization in char_traits.h.
+ Also add _S_string_copy, but this doesn't fix it -- cf the BUGS
+ file for the details.
+
+ * stl/bits/stl_algobase.h (equal): Fix to do `! (x==y)'.
+ * stl/bits/stl_iterator.h (__distance): Likewise.
+
+ * stl/bits/stl_iterator.h: As with 8/18 set, define missing op!=,
+ op>, op<=, and op>= for reverse_iterator. Also add op!= for
+ istream_iterator.
+
+1998-08-26 Brendan Kehoe <brendan@cygnus.com>
+
+ * bits/string.tcc (basic_string::compare (const char*)): Fix to
+ return 0, not 1.
+
+1998-08-25 Brendan Kehoe <brendan@cygnus.com>
+
+ This should really be fixed with __asm__ directives renaming the
+ symbol, but keeping the function.
+ * math/clogf.c (c_logf): Renamed from `clogf'.
+ * math/clogl.c (c_logl): Renamed from `clogl'.
+ * math/complex-stub.h (c_logf, c_logl): Change decls.
+
+ * bits/locfacets.h (class _Numeric_get): For friend decls, rename
+ _CharT and _InIter parms, since they duplicate the enclosing ones.
+
+1998-08-19 Brendan Kehoe <brendan@cygnus.com>
+
+ Deal with conflict of the iostreams `clog' and our internal
+ complex number `clog'.
+ * src/complex.cc: Call `c_log' instead of `clog'.
+ * math/clog.c (c_log):: Renamed from clog.
+ * math/complex-stub.h (c_log): Renamed from clog decl.
+
+ * bits/locfacets.h (class _Numeric_get): Tweak fwd decls of the
+ get/put classes.
+ (num_put::put): #if 0 long long version, since we don't declare or
+ define the long long version of do_put.
+
+1998-08-18 Nathan Myers <ncm@cantrip.org>
+
+ * bits/basic_string.h: add basic_string<>::push_back(), fix return
+ type of get_allocator (thanks to Ryszard Kabatek).
+ * bits/char_traits.h: make init order of fpos<> members
+ match decl order.
+ * bits/ios_base.h: fix decls of ios_base bitmask & enum types, add
+ flags _S_fd_in etc. for special filebuf ctor.
+ * bits/locfacets.h: make _Numeric_get and _Format_cache public
+ to work around problems in friend declarations.
+ * bits/locfacets.tcc: qualify _S_get_cache in num_get<>::get(..bool&),
+ fix random type errors & typos
+ * bits/std_fstream.h: major refitting to bypass libio (for now),
+ instrument to use bits/fstream.tcc template definitions
+ * bits/std_iosfwd.h: mess with wrappers
+ * bits/std_istream.h: remove meaningless comment
+ * bits/std_ostream.h: instrument to work with ostream.tcc.
+ * bits/std_streambuf.h: instrument to work with streambuf.tcc
+ * bits/fstream.tcc: template defs for <fstream>
+ * bits/ostream.tcc: template defs for <ostream>
+ * bits/streambuf.tcc: template defs for <streambuf>
+ * bits/os_raw.h: thin OS interface wrapper, to bypass libio (for now).
+ * Delete .cc files, replace with bits/*.tcc
+ src/fstream.cc
+ src/istream.cc
+ src/ostream.cc
+ src/streambuf.cc
+ * Add files:
+ src/os_raw.cc: thin interface to OS, to bypass libio (for now).
+ src/stdstreams.cc: cout, cin, etc. definitions
+ (these still need work: must be init'd before user statics.)
+
+
+1998-08-18 Brendan Kehoe <brendan@cygnus.com>
+
+ Sent to SGI before checkin:
+ * stl/bits/stl_vector.h (operator!=, operator>, operator<=,
+ operator>=): Define.
+ * stl/bits/stl_bvector.h (vector<bool>::flip): Define method.
+ * stl/bits/stl_deque.h (operator!=, operator>, operator<=,
+ operator>=): Define.
+ (operator==, operator<): Add inline.
+ * stl/bits/stl_map.h (operator!=, operator<, operator<=,
+ operator>=): Define.
+ * stl/bits/stl_multimap.h (operator!=, operator<, operator<=,
+ operator>=): Define.
+ * stl/bits/stl_list.h (operator!=, operator<, operator<=,
+ operator>=): Define.
+ * stl/bits/stl_set.h (operator!=, operator<, operator<=,
+ operator>=): Define.
+ * stl/bits/stl_multiset.h (operator!=, operator<, operator<=,
+ operator>=): Define.
+
+ * bits/std_valarray.h (_Shift_left, _Shift_right): Inherit from
+ unary_function.
+
+1998-08-15 Nathan Myers <ncm@cantrip.org>
+
+ * bits/ios_base.h: change nominal bitmask and enum types to real enums
+ * bits/locfacets.h: make _Format_cache bool names usable by num_get
+ * bits/locfacets.tcc: make num_get<>::get(... bool&) use _Format_cache
+ * bits/std_fstream.h: minor cleanups: ctors delegate to open()
+ * bits/std_iosfwd.h: more bitmask changes, for ios_base::iostate
+ * bits/std_sstream.h: formatting cleanups
+
+1998-08-14 Nathan Myers <ncm@cantrip.org>
+
+ * bits/locfacets.tcc: implement num_get<>::do_get(..., bool&)
+ * bits/locfacets.tcc: implement time_get<>::do_get_weekday
+ * bits/locfacets.tcc: implement time_get<>::do_get_monthname
+ * bits/locfacets.h: fix missing argument in do_get_monthname
+ (this is a bug in the standard, ref. 36 in my list.)
+ * bits/locfacets.h: make month and day name caches mutable
+ * bits/locfacets.tcc: various typos in get() functions
+ * bits/sbuf_iter.h: fix omission in istreambuf_iterator::op++().
+ * bits/std_streambuf.h: fix typo in sgetn (Brendan)
+
+1998-08-12 Nathan Myers <ncm@cantrip.org>
+ * move streambuf iterators to bits/sbuf_iter.h
+ * optimize streambuf iterators
+ * begin generalizing streambuf
+ * begin implementing num_get<>::get (starting with bool)
+ * patch stl/bits/stl_config.h so that relops operators are
+ contained properly, out of the way.
+
+1998-07-24 Nathan Myers <ncm@cantrip.org>
+ * Fold in SGI 3.11 changes (uglified names, some algorithm
+ improvements, very minor bug fixes.)
+ * Uglify names elsewhere to match (s/_T/_Tp/).
+ * Begin work on optimized streambuf
+ * Put complex.cc in namespace std:: (thanks Martin)
+
+1998-07-17 Nathan Myers <ncm@cantrip.org>
+
+ * bits/char_traits.h: add _Char_traits_match template.
+ * bits/string.tcc: fix bugs in various find_last* members.
+ * bits/basic_string.h: redeclare member _S_find.
+ * stl/bits/stl_iterator.h: change member names in nonstandard
+ templates bidirectional_reverse_iterator and
+ random_access_reverse_iterator to match expected changes
+ in upstream source.
+ * src/string.cc: fix definitions of stream operators.
+
+1998-07-14 16:06 Ulrich Drepper <drepper@cygnus.com>
+
+ * Makefile.am (SUBDIRS): Add string.
+
+ * configure.in: Test for long double functions separately. Test for
+ ISO C 89 float functions. Test for endian.h and sys/isa_defs.h.
+ Generate string/Makefile.
+
+ * bits/c++config.h: Define mbstate_t for Solaris.
+
+ * bits/char_traits.h: Remove unused #if.
+
+ * bits/std_cwchar.h: Declare wide char string functions.
+
+ * m4/stringfcts.m4: New file.
+
+ * math/complex-stub.h: Declare nan.
+ * math/nan.c: New file.
+
+ * math/mathconf.h: Hack around missing endian.h file.
+ Handle missing NAN definition.
+ Handle missing float math functions.
+
+ * src/Makefile.am (libstdc___la_LIBADD): Add libstring.la.
+ (libstdc___la_LDFLAGS): Set version information.
+
+ * src/complexl.cc: Don't compile any code if no long double functions
+ are available.
+
+ * string/Makefile.am: New file.
+ * string/dummy.c: New file.
+ * string/wmemchr.c: New file.
+ * string/wmemcmp.c: New file.
+ * string/wmemcpy.c: New file.
+ * string/wmemmove.c: New file.
+ * string/wmemset.c: New file.
+
+1998-07-14 10:45 Ulrich Drepper <drepper@cygnus.com>
+
+ * configure.in: Make it work.
+ * install-sh: New file.
+ * missing: New file.
+ * mkinstalldirs: New file.
+ * m4/mathfcts.m4: New file.
+ * math/Makefile.am: New file.
+
+ * bits/std_complex.h (conj): Mark specializations as inline.
+
+ * math/carg.c: New file.
+ * math/cargf.c: New file.
+ * math/cargl.c: New file.
+ * math/mycabs.c: New file.
+ * math/mycabsf.c: New file.
+ * math/mycabsl.c: New file.
+ * math/signbit.c: New file.
+ * math/signbitf.c: New file.
+ * math/signbitl.c: New file.
+
+ * math/ccos.c: Avoid ISO C 9x functionality.
+ * math/ccosf.c: Likewise.
+ * math/ccosh.c: Likewise.
+ * math/ccoshf.c: Likewise.
+ * math/ccoshl.c: Likewise.
+ * math/ccosl.c: Likewise.
+ * math/cexp.c: Likewise.
+ * math/cexpf.c: Likewise.
+ * math/cexpl.c: Likewise.
+ * math/clog.c: Likewise.
+ * math/clog10.c: Likewise.
+ * math/clog10f.c: Likewise.
+ * math/clog10l.c: Likewise.
+ * math/clogf.c: Likewise.
+ * math/clogl.c: Likewise.
+ * math/cpow.c: Likewise.
+ * math/cpowf.c: Likewise.
+ * math/cpowl.c: Likewise.
+ * math/csin.c: Likewise.
+ * math/csinf.c: Likewise.
+ * math/csinh.c: Likewise.
+ * math/csinhf.c: Likewise.
+ * math/csinhl.c: Likewise.
+ * math/csinl.c: Likewise.
+ * math/csqrt.c: Likewise.
+ * math/csqrtf.c: Likewise.
+ * math/csqrtl.c: Likewise.
+ * math/ctan.c: Likewise.
+ * math/ctanf.c: Likewise.
+ * math/ctanh.c: Likewise.
+ * math/ctanhf.c: Likewise.
+ * math/ctanhl.c: Likewise.
+ * math/ctanl.c: Likewise.
+
+ * math/complex-stub.h: New file.
+
+ * math/mathconf.h: New file.
+
+ * src/Makefile.am: New file.
+
+ * src/complex.cc: Use mathconf.h instead of complex.h.
+ Don't use cabs, always use __mycabs.
+
+1998-02-13 Brendan Kehoe <brendan@cygnus.com>
+
+ * iterator (class reverse_iterator): Do some tweaks to be in sync
+ w/ the FDIS.
diff --git a/libstdc++-v3/Makefile.am b/libstdc++-v3/Makefile.am
new file mode 100644
index 000000000000..674782b149ce
--- /dev/null
+++ b/libstdc++-v3/Makefile.am
@@ -0,0 +1,147 @@
+## Makefile for the toplevel directory of the GNU C++ Standard library.
+##
+## Copyright (C) 1997,1998, 1999, 2000 Free Software Foundation, Inc.
+##
+## This file is part of the libstdc++ version 3 distribution.
+## Process this file with automake to produce Makefile.in.
+
+## This file is part of the GNU ISO C++ Library. This library is free
+## software; you can redistribute it and/or modify it under the
+## terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option)
+## any later version.
+
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License along
+## with this library; see the file COPYING. If not, write to the Free
+## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+## USA.
+
+AUTOMAKE_OPTIONS = 1.3 cygnus
+MAINT_CHARSET = latin1
+
+# This helps subvert libstdcxx_interface, as calculated by devo/config.if
+# Needed so that g++ can find the correct include subdir automatically.
+INTERFACE = v3
+gxx_include_dir=$(includedir)/g++
+
+SUBDIRS = math libio src
+
+check: $(top_builddir)/mkcheck
+ $(top_builddir)/mkcheck 0 $(top_builddir) $(top_srcdir)
+
+check-install: $(top_builddir)/mkcheck
+ $(top_builddir)/mkcheck 1 $(top_builddir) $(top_srcdir) $(prefix)
+
+#all-local: stamp-rebuild
+
+# This has already been sanity-checked by configure to a certain extent
+#stamp-rebuild: $(top_builddir)/config.status
+# if test "$(GCC_OBJDIR)" != "no"; then \
+# (cd "$(GCC_OBJDIR)/gcc" && \
+# if test -f libgcc2.ready ; then \
+# rm -f libgcc2.ready libgcc.a libgcc2.a ; \
+# $(MAKE) libgcc2.a TARGET_LIBGCC2_CFLAGS='@NAMESPACES@' ; \
+# $(MAKE) libgcc.a ; \
+# else \
+# echo '** There does not appear to be a previously-built' ; \
+# echo '** library here. Please see' ; \
+# echo '** <http://sourceware.cygnus.com/libstdc++/install.html>' ; \
+# echo '** In particular, the "Building and Installing' ; \
+# echo '** the library (without GCC sources)" section.' ; \
+# exit 1 ; \
+# fi \
+# ) \
+# fi
+# touch stamp-rebuild
+
+# Multilib support.
+MAKEOVERRIDES=
+
+# Multilib variables.
+MULTISRCTOP =
+MULTIBUILDTOP =
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+
+# Multilib Makefile bits.
+.PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \
+ maintainer-clean-multi
+
+all-am: all-multi
+install-am: install-multi
+mostlyclean-am: mostlyclean-multi
+clean-am: clean-multi
+distclean-am: distclean-multi
+maintainer-clean-am: maintainer-clean-multi
+
+all-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
+install-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do
+mostlyclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean
+clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean
+distclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean
+maintainer-clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean
+
+# Work around what appears to be a GNU make bug handling MAKEFLAGS
+# values defined in terms of make variables, as is the case for CC and
+# friends when we are called from the top level Makefile.
+AM_MAKEFLAGS = \
+ "AR_FLAGS=$(AR_FLAGS)" \
+ "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
+ "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
+ "CFLAGS=$(CFLAGS)" \
+ "CXXFLAGS=$(CXXFLAGS)" \
+ "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
+ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
+ "INSTALL=$(INSTALL)" \
+ "INSTALL_DATA=$(INSTALL_DATA)" \
+ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+ "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
+ "LDFLAGS=$(LDFLAGS)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
+ "MAKE=$(MAKE)" \
+ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
+ "PICFLAG=$(PICFLAG)" \
+ "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
+ "SHELL=$(SHELL)" \
+ "EXPECT=$(EXPECT)" \
+ "RUNTEST=$(RUNTEST)" \
+ "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
+ "exec_prefix=$(exec_prefix)" \
+ "infodir=$(infodir)" \
+ "libdir=$(libdir)" \
+ "includedir=$(includedir)" \
+ "prefix=$(prefix)" \
+ "tooldir=$(tooldir)" \
+ "AR=$(AR)" \
+ "AS=$(AS)" \
+ "CC=$(CC)" \
+ "CXX=$(CXX)" \
+ "LD=$(LD)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "PICFLAG=$(PICFLAG)" \
+ "RANLIB=$(RANLIB)" \
+ "NM=$(NM)" \
+ "NM_FOR_BUILD=$(NM_FOR_BUILD)" \
+ "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
+ "DESTDIR=$(DESTDIR)"
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in
new file mode 100644
index 000000000000..d8cdb513a49b
--- /dev/null
+++ b/libstdc++-v3/Makefile.in
@@ -0,0 +1,509 @@
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = .
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
+host_alias = @host_alias@
+host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
+AR = @AR@
+AS = @AS@
+BUILD_LIBIO_INCLUDE = @BUILD_LIBIO_INCLUDE@
+CC = @CC@
+CPP = @CPP@
+CSTDIO_CC = @CSTDIO_CC@
+CSTDIO_H = @CSTDIO_H@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+DEBUGFLAGS = @DEBUGFLAGS@
+DLLTOOL = @DLLTOOL@
+EXEEXT = @EXEEXT@
+GCC_OBJDIR = @GCC_OBJDIR@
+GLIBCPP_CFLAGS = @GLIBCPP_CFLAGS@
+GLIBCPP_CXXFLAGS = @GLIBCPP_CXXFLAGS@
+LIBMATHOBJS = @LIBMATHOBJS@
+LIBSTRINGOBJS = @LIBSTRINGOBJS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+NAMESPACES = @NAMESPACES@
+OBJDUMP = @OBJDUMP@
+OPTLEVEL = @OPTLEVEL@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+THREADDEPS = @THREADDEPS@
+THREADINCS = @THREADINCS@
+THREADLIBS = @THREADLIBS@
+THREADOBJS = @THREADOBJS@
+THREADSPEC = @THREADSPEC@
+USE_LONG_DOUBLE = @USE_LONG_DOUBLE@
+VERSION = @VERSION@
+WERRORSUPPRESS = @WERRORSUPPRESS@
+cpu_include_dir = @cpu_include_dir@
+ctype_include_dir = @ctype_include_dir@
+glibcpp_basedir = @glibcpp_basedir@
+
+AUTOMAKE_OPTIONS = 1.3 cygnus
+MAINT_CHARSET = latin1
+
+# This helps subvert libstdcxx_interface, as calculated by devo/config.if
+# Needed so that g++ can find the correct include subdir automatically.
+INTERFACE = v3
+gxx_include_dir = $(includedir)/g++
+
+SUBDIRS = math libio src
+
+#all-local: stamp-rebuild
+
+# This has already been sanity-checked by configure to a certain extent
+#stamp-rebuild: $(top_builddir)/config.status
+# if test "$(GCC_OBJDIR)" != "no"; then \
+# (cd "$(GCC_OBJDIR)/gcc" && \
+# if test -f libgcc2.ready ; then \
+# rm -f libgcc2.ready libgcc.a libgcc2.a ; \
+# $(MAKE) libgcc2.a TARGET_LIBGCC2_CFLAGS='@NAMESPACES@' ; \
+# $(MAKE) libgcc.a ; \
+# else \
+# echo '** There does not appear to be a previously-built' ; \
+# echo '** library here. Please see' ; \
+# echo '** <http://sourceware.cygnus.com/libstdc++/install.html>' ; \
+# echo '** In particular, the "Building and Installing' ; \
+# echo '** the library (without GCC sources)" section.' ; \
+# exit 1 ; \
+# fi \
+# ) \
+# fi
+# touch stamp-rebuild
+
+# Multilib support.
+MAKEOVERRIDES =
+
+# Multilib variables.
+MULTISRCTOP =
+MULTIBUILDTOP =
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+
+# Work around what appears to be a GNU make bug handling MAKEFLAGS
+# values defined in terms of make variables, as is the case for CC and
+# friends when we are called from the top level Makefile.
+AM_MAKEFLAGS = \
+ "AR_FLAGS=$(AR_FLAGS)" \
+ "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
+ "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
+ "CFLAGS=$(CFLAGS)" \
+ "CXXFLAGS=$(CXXFLAGS)" \
+ "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
+ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
+ "INSTALL=$(INSTALL)" \
+ "INSTALL_DATA=$(INSTALL_DATA)" \
+ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+ "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
+ "LDFLAGS=$(LDFLAGS)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
+ "MAKE=$(MAKE)" \
+ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
+ "PICFLAG=$(PICFLAG)" \
+ "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
+ "SHELL=$(SHELL)" \
+ "EXPECT=$(EXPECT)" \
+ "RUNTEST=$(RUNTEST)" \
+ "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
+ "exec_prefix=$(exec_prefix)" \
+ "infodir=$(infodir)" \
+ "libdir=$(libdir)" \
+ "includedir=$(includedir)" \
+ "prefix=$(prefix)" \
+ "tooldir=$(tooldir)" \
+ "AR=$(AR)" \
+ "AS=$(AS)" \
+ "CC=$(CC)" \
+ "CXX=$(CXX)" \
+ "LD=$(LD)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "PICFLAG=$(PICFLAG)" \
+ "RANLIB=$(RANLIB)" \
+ "NM=$(NM)" \
+ "NM_FOR_BUILD=$(NM_FOR_BUILD)" \
+ "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
+ "DESTDIR=$(DESTDIR)"
+
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = mkcheck
+DIST_COMMON = README ./stamp-h.in ChangeLog Makefile.am Makefile.in \
+acconfig.h acinclude.m4 aclocal.m4 config.h.in configure configure.in \
+mkcheck.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = gtar
+GZIP_ENV = --best
+all: all-redirect
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4
+ cd $(srcdir) && $(ACLOCAL)
+
+config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+ cd $(srcdir) && $(AUTOCONF)
+
+config.h: stamp-h
+ @if test ! -f $@; then \
+ rm -f stamp-h; \
+ $(MAKE) stamp-h; \
+ else :; fi
+stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES= CONFIG_HEADERS=config.h \
+ $(SHELL) ./config.status
+ @echo timestamp > stamp-h 2> /dev/null
+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in
+ @if test ! -f $@; then \
+ rm -f $(srcdir)/stamp-h.in; \
+ $(MAKE) $(srcdir)/stamp-h.in; \
+ else :; fi
+$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
+ cd $(top_srcdir) && $(AUTOHEADER)
+ @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
+
+mostlyclean-hdr:
+
+clean-hdr:
+
+distclean-hdr:
+ -rm -f config.h
+
+maintainer-clean-hdr:
+mkcheck: $(top_builddir)/config.status mkcheck.in
+ cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+
+@SET_MAKE@
+
+all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive install-info-recursive \
+check-recursive installcheck-recursive info-recursive dvi-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+ rev="$$subdir $$rev"; \
+ test "$$subdir" = "." && dot_seen=yes; \
+ done; \
+ test "$$dot_seen" = "no" && rev=". $$rev"; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ -rm -rf $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
+ mkdir $(distdir)/=build
+ mkdir $(distdir)/=inst
+ dc_install_base=`cd $(distdir)/=inst && pwd`; \
+ cd $(distdir)/=build \
+ && ../configure --srcdir=.. --prefix=$$dc_install_base \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) dist
+ -rm -rf $(distdir)
+ @banner="$(distdir).tar.gz is ready for distribution"; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ echo "$$dashes"
+dist: distdir
+ -chmod -R a+r $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+ -rm -rf $(distdir)
+dist-all: distdir
+ -chmod -R a+r $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+ -rm -rf $(distdir)
+distdir: $(DISTFILES)
+ -rm -rf $(distdir)
+ mkdir $(distdir)
+ -chmod 777 $(distdir)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ cp -pr $$d/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+ for subdir in $(SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ chmod 777 $(distdir)/$$subdir; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
+ || exit 1; \
+ fi; \
+ done
+info-am:
+info: info-recursive
+dvi-am:
+dvi: dvi-recursive
+check-am:
+check: check-recursive
+installcheck-am:
+installcheck: installcheck-recursive
+install-info-am:
+install-info: install-info-recursive
+all-recursive-am: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+install-exec-am:
+install-exec: install-exec-recursive
+
+install-data-am:
+install-data: install-data-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-recursive
+uninstall-am:
+uninstall: uninstall-recursive
+all-am: Makefile config.h
+all-redirect: all-recursive-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs: installdirs-recursive
+installdirs-am:
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
+
+mostlyclean: mostlyclean-recursive
+
+clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
+
+clean: clean-recursive
+
+distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
+ -rm -f libtool
+
+distclean: distclean-recursive
+ -rm -f config.status
+
+maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
+ maintainer-clean-generic distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f config.status
+
+.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
+install-data-recursive uninstall-data-recursive install-exec-recursive \
+uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
+all-recursive check-recursive installcheck-recursive info-recursive \
+dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
+maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
+dvi-am dvi check check-am installcheck-am installcheck install-info-am \
+install-info all-recursive-am install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs-am installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
+
+
+check: $(top_builddir)/mkcheck
+ $(top_builddir)/mkcheck 0 $(top_builddir) $(top_srcdir)
+
+check-install: $(top_builddir)/mkcheck
+ $(top_builddir)/mkcheck 1 $(top_builddir) $(top_srcdir) $(prefix)
+
+# Multilib Makefile bits.
+.PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \
+ maintainer-clean-multi
+
+all-am: all-multi
+install-am: install-multi
+mostlyclean-am: mostlyclean-multi
+clean-am: clean-multi
+distclean-am: distclean-multi
+maintainer-clean-am: maintainer-clean-multi
+
+all-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
+install-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do
+mostlyclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean
+clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean
+distclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean
+maintainer-clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libstdc++-v3/README b/libstdc++-v3/README
new file mode 100644
index 000000000000..1a941683f498
--- /dev/null
+++ b/libstdc++-v3/README
@@ -0,0 +1,94 @@
+file: isolib/README
+
+New users may wish to point their web browsers to the file index.html
+in the 'docs' subdirectory. It contains brief building instructions
+and notes on how to configure the library in interesting ways.
+
+
+Instructions for configuring and building this snapshot appear
+in install.html.
+
+This directory contains the files needed to create [a still broken
+subset of] an ISO Standard C++ Library.
+
+It has subdirectories:
+
+ bits
+ Files included by standard headers and by other files in
+ the bits directory. Includes a set of files bits/std_xxxx.h
+ that implement the standard headers <xxxx>.
+
+ std
+ Files meant to be found by #include <name> directives in
+ standard-conforming user programs. These headers are not
+ referred to by other headers, because such dependencies
+ confuse Make (leading it to delete them, all too often).
+ Installations may substitute symbolic links in place of
+ these files.
+
+ ext
+ Headers that define extensions to the standard library. No
+ standard header refers to any of them.
+
+ backward
+ Headers provided for backward compatibility, such as <iostream.h>.
+ They are not used in this library.
+
+ src
+ Files that are used in constructing the library, but are not
+ installed.
+
+ testsuites/17_* to 27_*
+ Test programs are here, and may be used to begin to exercise the
+ library. Support for "make check" and "make check-install" is
+ complete, and runs through all the subdirectories here when this
+ command is issued from the build directory. Please note that
+ "make check" calls the script mkcheck, which requires bash, and which
+ may need the paths to bash adjusted to work properly, as /bin/bash is
+ assumed.
+
+ shadow
+ Headers intended to shadow standard C headers provided by an
+ underlying OS or C library, and other headers depended on directly
+ by C++ headers (e.g. unistd.h). These are meant to wrap the names
+ defined there into the _CSwamp namespace.
+ [NB: this is still experimental, and is not currently used.]
+
+ cshadow
+ The contents of this directory are constructed by scripts which
+ examine the underlying C headers to discover other headers they
+ depend on. These headers are wrappers for them.
+ [NB: this is still experimental, and is not currently used.]
+
+Other subdirectories contain variant versions of certain files
+that are meant to be copied or linked by the configure script.
+Currently these are:
+
+ amm1 generic glibc math
+
+Files needed only to construct the library, but not installed,
+are in src/. Files to be copied as part of an installation are
+all found in the subdirectories mentioned above. (A configure
+script may link files from another directory into one of these.)
+
+In a normal installation the bits/ directory is copied
+under the std/ directory, and arranged to be searched only
+when an include directive specifies a filename of "bits/..."
+or <bits/...>. When building the library, we use
+
+ -Istd -I. -Iconfig/* -Iconfig/cpu/*
+
+to get the same effect.
+
+Note that glibc also has a bits/ subdirectory. We will either
+need to be careful not to collide with names in its bits/
+directory; or rename bits to (e.g.) cppbits/.
+
+To install libstdc++ you need GNU make. The makefiles do not work with
+any other make.
+
+In files throughout the system, lines marked with an "XXX" indicate
+a bug or incompletely-implemented feature. Lines marked "XXX MT"
+indicate a place that may require attention for multi-thread safety.
+(Warning: places that need an atomic read are not so marked yet.)
+
diff --git a/libstdc++-v3/acconfig.h b/libstdc++-v3/acconfig.h
new file mode 100644
index 000000000000..b7ef8c050169
--- /dev/null
+++ b/libstdc++-v3/acconfig.h
@@ -0,0 +1,199 @@
+// acconfig.h symbols and macros for libstdc++ v3 -*- C++ -*-
+
+// If using the namespace std, you need this. Eventually this should
+// not be an option. In the meantime, and as things like std_ctype.h
+// need to be hacked out, give people the option. If this is set to 1,
+// CXXFLAGS should include -fhonor-std. If this is undefined, CXXFLAGS
+// should include -fno-honor-std.
+#undef _GLIBCPP_USE_NAMESPACES
+
+// Include support for 'long long' and 'unsigned long long'.
+#undef _GLIBCPP_USE_LONG_LONG
+
+// Define if the host has a type mbstate_t defined in
+// wchar.h, as required by 21.1.3.1. Some systems, namely
+// hppa-hp-hpux10.20 do not meet this requirement, and must be worked
+// around.
+#undef _GLIBCPP_NEED_MBSTATE_T
+
+// Define if WCHAR_MIN and WCHAR_MAX are in the <cwchar_t>
+// header. Presently, this is needed so that solaris won't
+// instantitate numeric_limits<wchar_t>
+#undef _GLIBCPP_HAS_WCHAR_MIN_MAX
+
+// Define if code specialized for wchar_t should be used.
+#undef _GLIBCPP_USE_WCHAR_T
+
+// Define if the compiler/host combination has __builtin_sinf defined.
+#undef _GLIBCPP_HAS_BUILTIN_SINF
+
+// Define if the compiler/host combination has __builtin_cosf defined.
+#undef _GLIBCPP_HAS_BUILTIN_COSF
+
+// Define if the compiler/host combination has __builtin_fabsf defined.
+#undef _GLIBCPP_HAS_BUILTIN_FABSF
+
+// Define if the compiler/host combination has __builtin_fabsf defined.
+#undef _GLIBCPP_HAS_BUILTIN_SQRTF
+
+// Define if GCC support for __complex__ float is buggy.
+#undef _GLIBCPP_BUGGY_FLOAT_COMPLEX
+
+// Define if GCC support for __complex__ is buggy.
+#undef _GLIBCPP_BUGGY_COMPLEX
+
+// Define if LC_MESSAGES is available in <locale.h>.
+#undef HAVE_LC_MESSAGES
+
+// Define if <float.h> exists.
+#undef HAVE_FLOAT_H
+
+// Define if modf is present in <math.h>
+#undef HAVE_MODF
+
+// @BOTTOM@
+//
+// Systems that have certain non-standard functions prefixed with an
+// underscore, we'll handle those here. Must come after config.h.in.
+//
+
+#if defined (HAVE__ISNAN) && ! defined (HAVE_ISNAN)
+# define HAVE_ISNAN 1
+# define isnan _isnan
+#endif
+
+#if defined (HAVE__ISNANF) && ! defined (HAVE_ISNANF)
+# define HAVE_ISNANF 1
+# define isnanf _isnanf
+#endif
+
+#if defined (HAVE__ISNANL) && ! defined (HAVE_ISNANL)
+# define HAVE_ISNANL 1
+# define isnanl _isnanl
+#endif
+
+#if defined (HAVE__ISINF) && ! defined (HAVE_ISINF)
+# define HAVE_ISINF 1
+# define isinf _isinf
+#endif
+
+#if defined (HAVE__ISINFF) && ! defined (HAVE_ISINFF)
+# define HAVE_ISINFF 1
+# define isinff _isinff
+#endif
+
+#if defined (HAVE__ISINFL) && ! defined (HAVE_ISINFL)
+# define HAVE_ISINFL 1
+# define isinfl _isinfl
+#endif
+
+#if defined (HAVE__COPYSIGN) && ! defined (HAVE_COPYSIGN)
+# define HAVE_COPYSIGN 1
+# define copysign _copysign
+#endif
+
+#if defined (HAVE__COPYSIGNL) && ! defined (HAVE_COPYSIGNL)
+# define HAVE_COPYSIGNL 1
+# define copysignl _copysignl
+#endif
+
+#if defined (HAVE__COSF) && ! defined (HAVE_COSF)
+# define HAVE_COSF 1
+# define cosf _cosf
+#endif
+
+#if defined (HAVE__COSHF) && ! defined (HAVE_COSHF)
+# define HAVE_COSHF 1
+# define coshf _coshf
+#endif
+
+#if defined (HAVE__LOGF) && ! defined (HAVE_LOGF)
+# define HAVE_LOGF 1
+# define logf _logf
+#endif
+
+#if defined (HAVE__LOG10F) && ! defined (HAVE_LOG10F)
+# define HAVE_LOG10F 1
+# define log10f _log10f
+#endif
+
+#if defined (HAVE__POWF) && ! defined (HAVE_POWF)
+# define HAVE_POWF 1
+# define powf _powf
+#endif
+
+#if defined (HAVE__SINF) && ! defined (HAVE_SINF)
+# define HAVE_SINF 1
+# define sinf _sinf
+#endif
+
+#if defined (HAVE__SINHF) && ! defined (HAVE_SINHF)
+# define HAVE_SINHF 1
+# define sinhf _sinhf
+#endif
+
+#if defined (HAVE__SQRTF) && ! defined (HAVE_SQRTF)
+# define HAVE_SQRTF 1
+# define sqrtf _sqrtf
+#endif
+
+#if defined (HAVE__TANF) && ! defined (HAVE_TANF)
+# define HAVE_TANF 1
+# define tanf _tanf
+#endif
+
+#if defined (HAVE__TANHF) && ! defined (HAVE_TANHF)
+# define HAVE_TANHF 1
+# define tanhf _tanhf
+#endif
+
+#if defined (HAVE__STRTOF) && ! defined (HAVE_STRTOF)
+# define HAVE_STRTOF 1
+# define strtof _strtof
+#endif
+
+#if defined (HAVE__STRTOLD) && ! defined (HAVE_STRTOLD)
+# define HAVE_STRTOLD 1
+# define strtold _strtold
+#endif
+
+#if defined (HAVE__FABSF) && ! defined (HAVE_FABSF)
+# define HAVE_FABSF 1
+# define fabsf _fabsf
+#endif
+
+#if defined (HAVE__SINCOS) && ! defined (HAVE_SINCOS)
+# define HAVE_SINCOS 1
+# define sincos _sincos
+#endif
+
+#if defined (HAVE__SINCOSF) && ! defined (HAVE_SINCOSF)
+# define HAVE_SINCOSF 1
+# define sincosf _sincosf
+#endif
+
+#if defined (HAVE__SINCOSL) && ! defined (HAVE_SINCOSL)
+# define HAVE_SINCOSL 1
+# define sincosl _sincosl
+#endif
+
+#if defined (HAVE__FINITE) && ! defined (HAVE_FINITE)
+# define HAVE_FINITE 1
+# define finite _finite
+#endif
+
+#if defined (HAVE__QFINITE) && ! defined (HAVE_QFINITE)
+# define HAVE_QFINITE 1
+# define qfinite _qfinite
+#endif
+
+#if defined (HAVE__FPCLASS) && ! defined (HAVE_FPCLASS)
+# define HAVE_FPCLASS 1
+# define fpclass _fpclass
+#endif
+
+#if defined (HAVE__QFPCLASS) && ! defined (HAVE_QFPCLASS)
+# define HAVE_QFPCLASS 1
+# define qfpclass _qfpclass
+#endif
+
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
new file mode 100644
index 000000000000..8b9a45473900
--- /dev/null
+++ b/libstdc++-v3/acinclude.m4
@@ -0,0 +1,881 @@
+dnl
+dnl Initialize configure bits.
+dnl
+dnl Define OPTLEVEL='-O2' if new inlining code present.
+dnl
+dnl GLIBCPP_CONFIGURE
+AC_DEFUN(GLIBCPP_CONFIGURE, [
+ dnl Default to --enable-multilib
+ AC_ARG_ENABLE(multilib,
+ [ --enable-multilib build hella library versions (default)],
+ [case "${enableval}" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
+ esac], [multilib=yes])dnl
+
+ dnl We may get other options which we dont document:
+ dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
+ if test "[$]{srcdir}" = "."; then
+ if test "[$]{with_target_subdir}" != "."; then
+ glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
+ else
+ glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
+ fi
+ else
+ glibcpp_basedir="[$]{srcdir}/$1"
+ fi
+ AC_SUBST(glibcpp_basedir)
+
+ AC_CANONICAL_HOST
+
+ AM_INIT_AUTOMAKE(libstdc++, 2.90.8)
+
+# FIXME: We temporarily define our own version of AC_PROG_CC. This is
+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
+# are probably using a cross compiler, which will not be able to fully
+# link an executable. This should really be fixed in autoconf
+# itself.
+
+AC_DEFUN(LIB_AC_PROG_CC,
+[AC_BEFORE([$0], [AC_PROG_CPP])dnl
+dnl Fool anybody using AC_PROG_CC.
+AC_PROVIDE([AC_PROG_CC])
+AC_CHECK_PROG(CC, gcc, gcc)
+if test -z "$CC"; then
+ AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
+ test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
+fi
+
+AC_PROG_CC_GNU
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+dnl Check whether -g works, even if CFLAGS is set, in case the package
+dnl plays around with CFLAGS (such as to build both debugging and
+dnl normal versions of a library), tasteless as that idea is.
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=
+ AC_PROG_CC_G
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ elif test $ac_cv_prog_cc_g = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-O2"
+ fi
+else
+ GCC=
+ test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+])
+
+LIB_AC_PROG_CC
+
+# Likewise for AC_PROG_CXX.
+AC_DEFUN(LIB_AC_PROG_CXX,
+[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
+dnl Fool anybody using AC_PROG_CXX.
+AC_PROVIDE([AC_PROG_CXX])
+AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
+test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
+
+AC_PROG_CXX_GNU
+
+if test $ac_cv_prog_gxx = yes; then
+ GXX=yes
+dnl Check whether -g works, even if CXXFLAGS is set, in case the package
+dnl plays around with CXXFLAGS (such as to build both debugging and
+dnl normal versions of a library), tasteless as that idea is.
+ ac_test_CXXFLAGS="${CXXFLAGS+set}"
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS=
+ AC_PROG_CXX_G
+ if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ elif test $ac_cv_prog_cxx_g = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-O2"
+ fi
+else
+ GXX=
+ test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
+fi
+])
+
+LIB_AC_PROG_CXX
+
+# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we dont
+# run it explicitly here, it will be run implicitly before
+# LIBGCJ_CONFIGURE, which doesn't work because that means that it will
+# be run before AC_CANONICAL_HOST.
+AC_CANONICAL_BUILD
+
+AC_CHECK_TOOL(AS, as)
+AC_CHECK_TOOL(AR, ar)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+
+AC_PROG_INSTALL
+
+AM_MAINTAINER_MODE
+
+# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
+# at least currently, we never actually build a program, so we never
+# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
+# fails, because we are probably configuring with a cross compiler
+# which cant create executables. So we include AC_EXEEXT to keep
+# automake happy, but we dont execute it, since we dont care about
+# the result.
+if false; then
+ AC_EXEEXT
+fi
+
+# configure.host sets the following important variables
+# glibcpp_cflags - host specific C compiler flags
+# glibcpp_cxxflags - host specific C++ compiler flags
+
+glibcpp_cflags=
+glibcpp_cxxflags=
+
+. [$]{glibcpp_basedir}/configure.host
+
+case [$]{glibcpp_basedir} in
+/* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
+*) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
+esac
+
+GLIBCPP_CFLAGS="[$]{glibcpp_cflags}"
+GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}"
+AC_SUBST(GLIBCPP_CFLAGS)
+AC_SUBST(GLIBCPP_CXXFLAGS)
+])
+
+
+dnl
+dnl Check to see if g++ can compile this library.
+dnl
+dnl Define OPTLEVEL='-O2' if new inlining code present.
+dnl
+dnl GLIBCPP_CHECK_COMPILER_VERSION
+AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
+ AC_MSG_CHECKING([for g++ that will successfullly compile this code])
+ AC_EGREP_CPP([ok], [
+ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+ ok
+ #endif
+ ], gpp_satisfactory=yes, AC_MSG_ERROR("please upgrade to gcc-2.95 or above"))
+ AC_MSG_RESULT($gpp_satisfactory)
+
+ AC_MSG_CHECKING([for g++ that supports new inlining mechanism])
+ AC_EGREP_CPP([ok], [
+ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
+ ok
+ #endif
+ ], [OPTLEVEL='-O2'
+ WERRORSUPPRESS=
+ ], [OPTLEVEL=
+ WERRORSUPPRESS=-Wno-error
+ ])
+ if test "$OPTLEVEL" = ""; then
+ AC_MSG_RESULT(no)
+ else
+ AC_MSG_RESULT(yes)
+ fi
+ AC_SUBST(OPTLEVEL)
+ AC_SUBST(WERRORSUPPRESS)
+])
+
+
+dnl
+dnl Check to see what builtin math functions are supported
+dnl
+dnl Define _GLIBCPP_HAS_BUILTIN_SINF if __builtin_sinf
+dnl Define _GLIBCPP_HAS_BUILTIN_COSF if __builtin_cosf
+dnl Define _GLIBCPP_HAS_BUILTIN_FABSF if __builtin_fabsf
+dnl Define _GLIBCPP_HAS_BUILTIN_SQRTF if __builtin_sqrtf
+dnl
+dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
+AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
+ dnl Test for builtin math functions.
+ AC_MSG_CHECKING([for __builtin_sinf])
+ AC_TRY_COMPILE([#include <math.h>],
+ [float foo(void) { __builtin_sinf(0.0); }],
+ use_builtin_sinf=yes, use_builtin_sinf=no)
+ AC_MSG_RESULT($use_builtin_sinf)
+ if test $use_builtin_sinf = "yes"; then
+ AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SINF)
+ fi
+
+ AC_MSG_CHECKING([for __builtin_cosf])
+ AC_TRY_COMPILE([#include <math.h>],
+ [float foo(void) { __builtin_cosf(0.0); }],
+ use_builtin_cosf=yes, use_builtin_cosf=no)
+ AC_MSG_RESULT($use_builtin_cosf)
+ if test $use_builtin_cosf = "yes"; then
+ AC_DEFINE(_GLIBCPP_HAS_BUILTIN_COSF)
+ fi
+
+ AC_MSG_CHECKING([for __builtin_fabsf])
+ AC_TRY_COMPILE([#include <math.h>],
+ [float foo(void) { __builtin_fabsf(0.0); }],
+ use_builtin_fabsf=yes, use_builtin_fabsf=no)
+ AC_MSG_RESULT($use_builtin_fabsf)
+ if test $use_builtin_fabsf = "yes"; then
+ AC_DEFINE(_GLIBCPP_HAS_BUILTIN_FABSF)
+ fi
+
+ AC_MSG_CHECKING([for __builtin_sqrtf])
+ AC_TRY_COMPILE([#include <math.h>],
+ [float foo(void) { __builtin_sqrtf(0.0); }],
+ use_builtin_sqrtf=yes, use_builtin_sqrtf=no)
+ AC_MSG_RESULT($use_builtin_sqrtf)
+ if test $use_builtin_sqrtf = "yes"; then
+ AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SQRTF)
+ fi
+])
+
+
+dnl
+dnl Check to see what architecture we are compiling for. If it's
+dnl supported, use special hand-crafted routines to provide thread
+dnl primitives.
+dnl
+dnl Depending on what is found, select various configure/cpu/*/atomicity.h
+dnl If not found, select configure/cpu/generic/atomicity.h
+dnl
+dnl GLIBCPP_CHECK_CPU
+AC_DEFUN(GLIBCPP_CHECK_CPU, [
+ AC_MSG_CHECKING([for cpu primitives directory])
+ case "$target_cpu" in
+ alpha*)
+ cpu_include_dir="config/cpu/alpha"
+ ;;
+ arm*)
+ cpu_include_dir="config/cpu/arm"
+ ;;
+ i486 | i586 | i686 | i786)
+ cpu_include_dir="config/cpu/i386"
+ ;;
+ powerpc | rs6000)
+ cpu_include_dir="config/cpu/powerpc"
+ ;;
+ sparc64 | ultrasparc)
+ cpu_include_dir="config/cpu/sparc/sparc64"
+ ;;
+ sparc*)
+ cpu_include_dir="config/cpu/sparc/sparc32"
+ ;;
+ *)
+ cpu_include_dir="config/cpu/generic"
+ ;;
+ esac
+ AC_MSG_RESULT($cpu_include_dir)
+ AC_SUBST(cpu_include_dir)
+])
+
+
+dnl
+dnl Check to see what the underlying c library's interface to ctype looks
+dnl like. Bits of locale rely on things like isspace, toupper, etc. This
+dnl stuff makes sure the right bits from the clibrary get called.
+dnl
+dnl Depending on what is found, select various configure/*/bits/ctype_base.h
+dnl Depending on what is found, select various configure/*/ctype.cc
+dnl
+dnl GLIBCPP_CHECK_CTYPE
+AC_DEFUN(GLIBCPP_CHECK_CTYPE, [
+ AC_CHECK_HEADER(ctype.h, [
+
+ dnl If doesn't match any specified, go with defaults.
+ ctype_default=yes
+
+ dnl Test for <ctype> functionality -- gnu-linux
+ AC_MSG_CHECKING([for gnu-linux <ctype>])
+ AC_TRY_COMPILE([#include <ctype.h>],
+ [int
+ foo (int a)
+ { return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \
+ + _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \
+ + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}], \
+ ctype_linux=yes, ctype_linux=no)
+ AC_MSG_RESULT($ctype_linux)
+ if test $ctype_linux = "yes"; then
+ ctype_include_dir="config/gnu-linux"
+ ctype_default=no
+ fi
+
+ dnl Test for <ctype> functionality -- solaris 2.6 and 2.7
+ if test $ctype_default = "yes"; then
+ AC_MSG_CHECKING([for solaris 2.6 or 2.7 <ctype>])
+ AC_TRY_COMPILE([#include <ctype.h>],
+ [int
+ foo (int a)
+ { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
+ + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
+ + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \
+ ctype_solaris=yes, ctype_solaris=no)
+ AC_MSG_RESULT($ctype_solaris)
+
+ if test $ctype_solaris = "yes"; then
+ AC_MSG_CHECKING([ for version])
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([#include <ctype.h>],
+ [typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\
+ ctype_solaris26=yes, ctype_solaris26=no)
+ AC_LANG_C
+ if test $ctype_solaris26 = "yes"; then
+ ctype_include_dir="config/solaris/solaris2.6"
+ AC_MSG_RESULT("solaris2.6")
+ ctype_default=no
+ else
+ ctype_include_dir="config/solaris/solaris2.7"
+ AC_MSG_RESULT("solaris2.7")
+ ctype_default=no
+ fi
+ fi
+ fi
+
+ dnl Test for <ctype> functionality -- solaris 2.5.1
+ if test $ctype_default = "yes"; then
+ AC_MSG_CHECKING([for solaris 2.5.1 <ctype>])
+ AC_TRY_COMPILE([#include <ctype.h>],
+ [int
+ foo (int a)
+ { return _U + _L + _N + _S + _P + _C + _X + _B \
+ + __ctype[a];}], \
+ ctype_solaris25=yes, ctype_solaris25=no)
+ AC_MSG_RESULT($ctype_solaris25)
+ if test $ctype_solaris25 = "yes"; then
+ ctype_include_dir="config/solaris/solaris2.5"
+ ctype_default=no
+ fi
+ fi
+
+ dnl Test for <ctype> functionality -- aix
+ if test $ctype_default = "yes"; then
+ AC_MSG_CHECKING([for aix <ctype>])
+ AC_TRY_COMPILE([#include <ctype.h>],
+ [int
+ foo (int a)
+ { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
+ + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
+ + _VALC('a') + _IS('c', 0);}], \
+ ctype_aix=yes, ctype_aix=no)
+ AC_MSG_RESULT($ctype_aix)
+ if test $ctype_aix = "yes"; then
+ ctype_include_dir="config/aix"
+ ctype_default=no
+ fi
+ fi
+
+ dnl Test for <ctype> functionality -- newlib
+ if test $ctype_default = "yes"; then
+ AC_MSG_CHECKING([for newlib <ctype>])
+ AC_TRY_COMPILE([#include <ctype.h>],
+ [int
+ foo (int a)
+ { return _U + _L + _N + _S + _P + _C + _X + _B \
+ + _ctype_[a];}], \
+ ctype_newlib=yes, ctype_newlib=no)
+ AC_MSG_RESULT($ctype_newlib)
+ if test $ctype_newlib = "yes"; then
+ ctype_include_dir="config/newlib"
+ ctype_default=no
+ fi
+ fi
+
+ if test $ctype_default = "yes"; then
+ ctype_include_dir="config/generic"
+ AC_MSG_WARN("Using default ctype headers.")
+ fi
+ AC_SUBST(ctype_include_dir)
+ ])
+])
+
+
+dnl
+dnl Check to see what the underlying c library or math library is like.
+dnl
+dnl Define HAVE_CARGF etc if "cargf" is found.
+dnl
+dnl GLIBCPP_CHECK_MATH_SUPPORT
+AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
+ AC_CHECK_LIB(m, sin, libm="-lm")
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $libm"
+
+ dnl Check for complex versions of math functions of platform.
+ AC_CHECK_HEADERS([complex.h])
+ AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \
+ clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \
+ ctan ctanf ctanh ctanhf \
+ carg cargf nan hypot hypotf atan2f expf copysignf)
+
+ dnl We compile the long double complex functions only if the function
+ dnl provides the non-complex functions.
+ USE_LONG_DOUBLE=no
+ AC_CHECK_FUNC(sinl,
+ USE_LONG_DOUBLE=yes
+ AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl cpowl csinhl csinl \
+ csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l))
+ AC_SUBST(USE_LONG_DOUBLE)
+
+ dnl Check to see if basic C math functions have faster float versions.
+ AC_CHECK_FUNCS(modf isnan isnanf isnanl isinf isinff isinfl copysign \
+ copysignl cosf coshf logf log10f powf sinf sinhf sqrtf tanf tanhf \
+ strtof strtold fabsf sincos sincosf sincosl finite finite fqfinite \
+ fpclass qfpclass)
+
+#Some runtimes have these functions with a preceding underscore. Please
+# keep this sync'd with the one above. And if you add any new symbol,
+# please add the corresponding block in the @BOTTOM@ section of
+# acconfig.h.
+AC_CHECK_FUNCS(_modf _isnan _isnanf _isnanl _isinf _isinff _isinfl _copysign \
+_copysignl _cosf _coshf _logf _log10f _powf _sinf _sinhf _sqrtf _tanf _tanhf \
+_strtof _strtold _fabsf _sincos _sincosf _sincosl _finite _finitef _qfinite \
+_fpclass _qfpclass)
+
+LIBS="$save_LIBS"
+])
+
+
+dnl
+dnl Check to see if this target can enable the wchar_t parts of libstdc++.
+dnl
+dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
+dnl Define _GLIBCPP_NEED_MBSTATE_T if mbstate_t is not in wchar.h
+dnl Define _GLIBCPP_HAS_WCHAR_MIN_MAX if WCHAR_MIN, WCHAR_MAX in wchar.h
+dnl
+dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
+AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
+ AC_CHECK_HEADER(wchar.h,[
+ dnl Test wchar.h for mbstate_t, which is needed for char_traits and others.
+ AC_MSG_CHECKING([for native mbstate_t])
+ AC_TRY_COMPILE([#include <wchar.h>],
+ [mbstate_t teststate;],
+ use_native_mbstatet=yes, use_native_mbstatet=no)
+ AC_MSG_RESULT($use_native_mbstatet)
+ if test $use_native_mbstatet = "no"; then
+ AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
+ fi
+
+ dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
+ dnl numeric_limits can instantiate type_traits<wchar_t>
+ AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
+ AC_TRY_COMPILE([#include <wchar.h>],
+ [int i = WCHAR_MIN; int j = WCHAR_MAX;],
+ has_wchar_minmax=yes, has_wchar_minmax=no)
+ AC_MSG_RESULT($has_wchar_minmax)
+ if test $has_wchar_minmax = "yes"; then
+ AC_DEFINE(_GLIBCPP_HAS_WCHAR_MIN_MAX)
+ fi
+
+ # Test wchar.h for WEOF, which is what we use to determine whether
+ # to specialize for wchar_t or not.
+ AC_MSG_CHECKING([for WEOF])
+ AC_TRY_COMPILE([
+ #include <wchar.h>
+ #include <stddef.h>],
+ [wint_t i = WEOF;],
+ has_weof=yes, has_weof=no)
+ AC_MSG_RESULT($has_weof)
+
+ dnl Tests for wide character functions.
+ AC_REPLACE_STRINGFUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset)
+
+ AC_MSG_CHECKING([for wide character support])
+ if test $has_weof = "yes" && test $has_wchar_minmax = "yes"; then
+ AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
+ AC_MSG_RESULT(ok)
+ else
+ AC_MSG_RESULT("not specializing for wchar_t")
+ fi
+ ],[
+ AC_MSG_WARN([<wchar.h> not found])
+ AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
+ ])
+])
+
+
+dnl
+dnl Check to see if this version of GNU C++ is afflicted by bugs in
+dnl __complex__ float support.
+dnl
+dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
+dnl
+dnl GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT
+AC_DEFUN(GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT, [
+ AC_REQUIRE([AC_PROG_CXX])
+ AC_MSG_CHECKING([for GNU C++ __complex__ float support])
+ AC_CACHE_VAL(glibcpp_cv_float_complex, [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ rm -f conftest.h
+ cat > conftest.h <<EOB
+ //
+ // Check for buggy __complex__ that causes ICE in most versions of egcs
+ // and gcc-2.95.x on certain platforms (eg., x86-win32).
+ //
+ // See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for
+ // more info on the bug itself.
+ //
+ struct
+ float_complex
+ {
+ __complex__ float m_value;
+ float_complex (float = 0.0f, float = 0.0f);
+ float_complex (__complex__ float val) : m_value (val) {}
+ float_complex foo (const float_complex &val)
+ { return float_complex (~val.m_value); }
+ };
+EOB
+ AC_TRY_COMPILE([#include "conftest.h"], ,
+ glibcpp_cv_float_complex=ok,
+ glibcpp_cv_float_complex=buggy
+ )
+ AC_LANG_RESTORE
+ ])
+ AC_MSG_RESULT($glibcpp_cv_float_complex)
+ if test $glibcpp_cv_float_complex = buggy; then
+ AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
+ fi
+])
+
+
+dnl
+dnl
+dnl Check to see if this version of GNU C++ is afflicted by bugs in
+dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
+dnl gcc-2.95.x when using the library, unless we define the default copy
+dnl ctor in the specializations of complex<>.
+dnl
+dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
+dnl
+dnl GLIBCPP_CHECK_COMPLEX_SUPPORT
+AC_DEFUN(GLIBCPP_CHECK_COMPLEX_SUPPORT, [
+ AC_REQUIRE([AC_PROG_CXX])
+ AC_MSG_CHECKING([for GNU C++ __complex__ support])
+ AC_CACHE_VAL(glibcpp_cv_complex, [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
+ dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
+ [ dcomplex x; f(x); ],
+ glibcpp_cv_complex=ok,
+ glibcpp_cv_complex=buggy
+ )
+ AC_LANG_RESTORE
+ ])
+ AC_MSG_RESULT($glibcpp_cv_complex)
+ if test $glibcpp_cv_complex = buggy; then
+ AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
+ fi
+])
+
+
+dnl
+dnl Check for certain special build configurations.
+dnl
+dnl GLIBCPP_ENABLE_DEBUG
+dnl --enable-debug sets '-ggdb -O0'.
+dnl --disable-debug sets '-g' and whatever optimization options the
+dnl compiler can handle.
+dnl + Perhaps --enable-maintainer-mode should automatically turn this on?
+dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
+dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
+dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
+dnl defaults to `no'.
+AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
+define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
+AC_ARG_ENABLE(debug,
+changequote(<<, >>)dnl
+<< --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
+changequote([, ])dnl
+[case "$enableval" in
+ yes) enable_debug=yes ;;
+ no) enable_debug=no ;;
+ *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
+ esac],
+enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
+dnl Option parsed, now set things appropriately
+case "$enable_debug" in
+ yes) DEBUGFLAGS='-ggdb -O0'
+ ;;
+ no) DEBUGFLAGS='-g'
+ ;;
+esac
+AC_SUBST(DEBUGFLAGS)
+])
+
+
+dnl
+dnl Check for certain special build configurations.
+dnl
+dnl GLIBCPP_ENABLE_NAMESPACES
+dnl --enable-namespaces sets '-fhonor-std' and defines _GLIBCPP_USE_NAMESPACES
+dnl --disable-namespaces sets '-fno-honor-std' (the macro should be
+dnl undefined by default in whatever.h.in).
+dnl + Eventually, this will go away.
+dnl + Usage: GLIBCPP_ENABLE_NAMESPACES[(DEFAULT)]
+dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
+dnl defaults to `no'.
+AC_DEFUN(GLIBCPP_ENABLE_NAMESPACES, [dnl
+define([GLIBCPP_ENABLE_NAMESPACES_DEFAULT], ifelse($1, yes, yes, no))dnl
+AC_ARG_ENABLE(namespaces,
+changequote(<<, >>)dnl
+<< --enable-namespaces turns on 'std' [default=>>GLIBCPP_ENABLE_NAMESPACES_DEFAULT],
+changequote([, ])dnl
+[case "$enableval" in
+ yes) enable_namespaces=yes ;;
+ no) enable_namespaces=no ;;
+ *) AC_MSG_ERROR([Unknown argument to enable/disable namespaces]) ;;
+ esac],
+enable_namespaces=GLIBCPP_ENABLE_NAMESPACES_DEFAULT)dnl
+dnl Option parsed, now set things appropriately
+case "$enable_namespaces" in
+ yes) NAMESPACES='-fhonor-std'
+ AC_DEFINE(_GLIBCPP_USE_NAMESPACES)
+ ;;
+ no) NAMESPACES='-fno-honor-std'
+ ;;
+esac
+AC_SUBST(NAMESPACES)
+])
+
+
+dnl
+dnl Check for instructions to automatically rebuild libgcc.a. Requires,
+dnl of course, the location of the gcc objdir. Note that if --disable-
+dnl namespaces is in effect, rebuilding libgcc.a is an expensive no-op.
+dnl
+dnl GLIBCPP_ENABLE_RELIBGCC
+dnl --enable-libgcc-rebuild=/absolute/path/to/gcc/objdir sets GCC_OBJDIR
+dnl (presumably in the top-level Makefile) to /absol.../objdir
+dnl --disable-libgcc-rebuild will not touch libgcc.a at all (maybe print
+dnl a warning if this is given along with --enable-namespaces), by
+dnl setting GCC_OBJDIR to `no'.
+dnl + Doing this by default is going to be interesting. What default
+dnl "on" value can there be?
+dnl + Usage: GLIBCPP_ENABLE_RELIBGCC[(DEFAULT)]
+dnl The default path should be ../.. if bundled with GCC source.
+dnl If ommitted, it defaults to `no'.
+dnl
+AC_DEFUN(GLIBCPP_ENABLE_RELIBGCC, [dnl
+define([GLIBCPP_ENABLE_RELIBGCC_DEFAULT], ifelse($1,, no, $1))dnl
+AC_ARG_ENABLE(libgcc-rebuild,
+changequote(<<, >>)dnl
+<< --enable-libgcc-rebuild=DIR also rebuild libgcc.a; DIR is
+ the GCC objdir; see install.html>>,
+changequote([, ])dnl
+[case "$enableval" in
+ yes) AC_MSG_ERROR([--enable-libgcc-rebuild needs a pathname]) ;;
+ no) enable_libgcc_rebuild=no ;;
+ *) if test -d "$enableval" && test -d "${enableval}/gcc" && \
+ test -d "${enableval}/libiberty"
+ then
+ enable_libgcc_rebuild="$enableval"
+ else
+ AC_MSG_ERROR(["$enableval" does not appear to be the GCC objdir])
+ fi
+ ;;
+ esac],
+enable_libgcc_rebuild=GLIBCPP_ENABLE_RELIBGCC_DEFAULT)dnl
+GCC_OBJDIR="$enable_libgcc_rebuild"
+AC_SUBST(GCC_OBJDIR)
+])
+
+
+dnl
+dnl Check for certain special build configurations.
+dnl
+dnl GLIBCPP_ENABLE_CSTDIO
+dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
+dnl
+dnl default is libio
+dnl
+AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
+ AC_MSG_CHECKING([for cstdio to use])
+ AC_ARG_ENABLE(cstdio,
+ [ --enable-cstdio enable GNU libio for target io package. (default)
+ --enable-cstdio=LIB use LIB target-speific io package.],
+ if test x$enable_cstdio = xno; then
+ enable_cstdio=libio
+ fi,
+ enable_cstdio=libio)
+
+ enable_cstdio_flag=$enable_cstdio
+
+ dnl Check if a valid thread package
+ case x${enable_cstdio_flag} in
+ xlibio | x | xno | xnone | xyes)
+ # default
+ CSTDIO_H=c_io_libio.h
+ CSTDIO_CC=c_io_libio.cc
+ AC_MSG_RESULT(libio)
+
+ # see if we are on a system with libio native (ie, linux)
+ AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
+ if test $has_libio = "yes"; then
+ BUILD_LIBIO_INCLUDE=
+ need_libio=no
+ else
+ BUILD_LIBIO_INCLUDE='-I../libio'
+ need_libio=yes
+ fi
+ AC_SUBST(BUILD_LIBIO_INCLUDE)
+ ;;
+ xwince)
+ CSTDIO_H=c_io_wince.h
+ CSTDIO_CC=c_io_wince.cc
+ AC_MSG_RESULT(wince)
+
+ need_libio=no
+ BUILD_LIBIO_INCLUDE=
+ AC_SUBST(BUILD_LIBIO_INCLUDE)
+ ;;
+ *)
+ echo "$enable_cstdio is an unknown io package" 1>&2
+ exit 1
+ ;;
+ esac
+ AC_SUBST(CSTDIO_H)
+ AC_SUBST(CSTDIO_CC)
+ AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
+])
+
+
+dnl
+dnl Check for certain special build configurations.
+dnl
+dnl GLIBCPP_ENABLE_THREADS
+dnl --enable-threads=posix sets config/threads-posix.h et. al.
+dnl
+dnl default is no threads
+dnl
+AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
+ dnl Note this comes from the gcc/config.in and libjava/config.in
+ dnl Efforts should be made to keep this in sync.
+ AC_MSG_CHECKING([for threads package to use])
+ AC_ARG_ENABLE(threads,
+ [ --enable-threads enable thread usage for target GCC.
+ --enable-threads=LIB use LIB thread package for target GCC.],
+ if test x$enable_threads = xno; then
+ enable_threads=''
+ fi,
+ enable_threads='')
+
+ enable_threads_flag=$enable_threads
+
+ dnl Check if a valid thread package
+ case x${enable_threads_flag} in
+ x | xno | xnone)
+ # No threads
+ target_thread_file='single'
+ ;;
+ xyes)
+ # default
+ target_thread_file=''
+ ;;
+ xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
+ xsolaris | xwin32 | xdce | xvxworks)
+ target_thread_file=$enable_threads_flag
+ ;;
+ *)
+ echo "$enable_threads is an unknown thread package" 1>&2
+ exit 1
+ ;;
+ esac
+
+ dnl Check for thread package actually supported in libstdc++
+ case "$target_thread_file" in
+ no | none | single)
+ THREADS=none
+ ;;
+ posix | pthreads)
+ THREADS=posix
+ case "$host" in
+ *-*-linux*)
+ ;;
+ esac
+ ;;
+ decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
+ AC_MSG_ERROR(thread package $THREADS not yet supported)
+ ;;
+ *)
+ AC_MSG_ERROR($THREADS is an unknown thread package)
+ ;;
+ esac
+ AC_MSG_RESULT($THREADS)
+
+ THREADLIBS=
+ THREADINCS=
+ THREADDEPS=
+ THREADOBJS=
+ THREADH=
+ THREADSPEC=
+ case "$THREADS" in
+ posix)
+ AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
+ THREADLIBS=-lpthread
+ THREADSPEC=-lpthread
+ dnl Not presently used
+ dnl THREADOBJS=threads-posix.lo
+ THREADH=threads-posix.h
+ ;;
+ none)
+ dnl Not presently used
+ dnl THREADOBJS=threads-no.lo
+ THREADH=threads-no.h
+ ;;
+ esac
+ AC_SUBST(THREADLIBS)
+ AC_SUBST(THREADINCS)
+ AC_SUBST(THREADDEPS)
+ AC_SUBST(THREADOBJS)
+ AC_SUBST(THREADSPEC)
+])
+
+
+dnl
+dnl Check for certain special build configurations.
+dnl
+dnl GLIBCPP_ENABLE_LONG_LONG
+dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
+dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
+dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
+dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
+dnl defaults to `no'.
+dnl
+dnl GLIBCPP_ENABLE_LONG_LONG
+AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
+ define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
+ AC_ARG_ENABLE(long-long,
+ changequote(<<, >>)dnl
+ <<--enable-long_long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
+ changequote([, ])dnl
+ [case "$enableval" in
+ yes) enable_long_long=yes ;;
+ no) enable_long_long=no ;;
+ *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
+ esac],
+ enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
+ dnl Option parsed, now set things appropriately
+ case "$enable_long_long" in
+ yes) AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
+ ;;
+ esac
+])
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/aclocal.m4 b/libstdc++-v3/aclocal.m4
new file mode 100644
index 000000000000..00ff575d40b9
--- /dev/null
+++ b/libstdc++-v3/aclocal.m4
@@ -0,0 +1,1503 @@
+dnl aclocal.m4 generated automatically by aclocal 1.4
+
+dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+dnl
+dnl Initialize configure bits.
+dnl
+dnl Define OPTLEVEL='-O2' if new inlining code present.
+dnl
+dnl GLIBCPP_CONFIGURE
+AC_DEFUN(GLIBCPP_CONFIGURE, [
+ dnl Default to --enable-multilib
+ AC_ARG_ENABLE(multilib,
+ [ --enable-multilib build hella library versions (default)],
+ [case "${enableval}" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
+ esac], [multilib=yes])dnl
+
+ dnl We may get other options which we dont document:
+ dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
+ if test "[$]{srcdir}" = "."; then
+ if test "[$]{with_target_subdir}" != "."; then
+ glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
+ else
+ glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
+ fi
+ else
+ glibcpp_basedir="[$]{srcdir}/$1"
+ fi
+ AC_SUBST(glibcpp_basedir)
+
+ AC_CANONICAL_HOST
+
+ AM_INIT_AUTOMAKE(libstdc++, 2.90.8)
+
+# FIXME: We temporarily define our own version of AC_PROG_CC. This is
+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
+# are probably using a cross compiler, which will not be able to fully
+# link an executable. This should really be fixed in autoconf
+# itself.
+
+AC_DEFUN(LIB_AC_PROG_CC,
+[AC_BEFORE([$0], [AC_PROG_CPP])dnl
+dnl Fool anybody using AC_PROG_CC.
+AC_PROVIDE([AC_PROG_CC])
+AC_CHECK_PROG(CC, gcc, gcc)
+if test -z "$CC"; then
+ AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
+ test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
+fi
+
+AC_PROG_CC_GNU
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+dnl Check whether -g works, even if CFLAGS is set, in case the package
+dnl plays around with CFLAGS (such as to build both debugging and
+dnl normal versions of a library), tasteless as that idea is.
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=
+ AC_PROG_CC_G
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ elif test $ac_cv_prog_cc_g = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-O2"
+ fi
+else
+ GCC=
+ test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+])
+
+LIB_AC_PROG_CC
+
+# Likewise for AC_PROG_CXX.
+AC_DEFUN(LIB_AC_PROG_CXX,
+[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
+dnl Fool anybody using AC_PROG_CXX.
+AC_PROVIDE([AC_PROG_CXX])
+AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
+test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
+
+AC_PROG_CXX_GNU
+
+if test $ac_cv_prog_gxx = yes; then
+ GXX=yes
+dnl Check whether -g works, even if CXXFLAGS is set, in case the package
+dnl plays around with CXXFLAGS (such as to build both debugging and
+dnl normal versions of a library), tasteless as that idea is.
+ ac_test_CXXFLAGS="${CXXFLAGS+set}"
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS=
+ AC_PROG_CXX_G
+ if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ elif test $ac_cv_prog_cxx_g = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-O2"
+ fi
+else
+ GXX=
+ test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
+fi
+])
+
+LIB_AC_PROG_CXX
+
+# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we dont
+# run it explicitly here, it will be run implicitly before
+# LIBGCJ_CONFIGURE, which doesn't work because that means that it will
+# be run before AC_CANONICAL_HOST.
+AC_CANONICAL_BUILD
+
+AC_CHECK_TOOL(AS, as)
+AC_CHECK_TOOL(AR, ar)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+
+AC_PROG_INSTALL
+
+AM_MAINTAINER_MODE
+
+# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
+# at least currently, we never actually build a program, so we never
+# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
+# fails, because we are probably configuring with a cross compiler
+# which cant create executables. So we include AC_EXEEXT to keep
+# automake happy, but we dont execute it, since we dont care about
+# the result.
+if false; then
+ AC_EXEEXT
+fi
+
+# configure.host sets the following important variables
+# glibcpp_cflags - host specific C compiler flags
+# glibcpp_cxxflags - host specific C++ compiler flags
+
+glibcpp_cflags=
+glibcpp_cxxflags=
+
+. [$]{glibcpp_basedir}/configure.host
+
+case [$]{glibcpp_basedir} in
+/* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
+*) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
+esac
+
+GLIBCPP_CFLAGS="[$]{glibcpp_cflags}"
+GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}"
+AC_SUBST(GLIBCPP_CFLAGS)
+AC_SUBST(GLIBCPP_CXXFLAGS)
+])
+
+
+dnl
+dnl Check to see if g++ can compile this library.
+dnl
+dnl Define OPTLEVEL='-O2' if new inlining code present.
+dnl
+dnl GLIBCPP_CHECK_COMPILER_VERSION
+AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
+ AC_MSG_CHECKING([for g++ that will successfullly compile this code])
+ AC_EGREP_CPP([ok], [
+ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+ ok
+ #endif
+ ], gpp_satisfactory=yes, AC_MSG_ERROR("please upgrade to gcc-2.95 or above"))
+ AC_MSG_RESULT($gpp_satisfactory)
+
+ AC_MSG_CHECKING([for g++ that supports new inlining mechanism])
+ AC_EGREP_CPP([ok], [
+ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
+ ok
+ #endif
+ ], [OPTLEVEL='-O2'
+ WERRORSUPPRESS=
+ ], [OPTLEVEL=
+ WERRORSUPPRESS=-Wno-error
+ ])
+ if test "$OPTLEVEL" = ""; then
+ AC_MSG_RESULT(no)
+ else
+ AC_MSG_RESULT(yes)
+ fi
+ AC_SUBST(OPTLEVEL)
+ AC_SUBST(WERRORSUPPRESS)
+])
+
+
+dnl
+dnl Check to see what builtin math functions are supported
+dnl
+dnl Define _GLIBCPP_HAS_BUILTIN_SINF if __builtin_sinf
+dnl Define _GLIBCPP_HAS_BUILTIN_COSF if __builtin_cosf
+dnl Define _GLIBCPP_HAS_BUILTIN_FABSF if __builtin_fabsf
+dnl Define _GLIBCPP_HAS_BUILTIN_SQRTF if __builtin_sqrtf
+dnl
+dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
+AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
+ dnl Test for builtin math functions.
+ AC_MSG_CHECKING([for __builtin_sinf])
+ AC_TRY_COMPILE([#include <math.h>],
+ [float foo(void) { __builtin_sinf(0.0); }],
+ use_builtin_sinf=yes, use_builtin_sinf=no)
+ AC_MSG_RESULT($use_builtin_sinf)
+ if test $use_builtin_sinf = "yes"; then
+ AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SINF)
+ fi
+
+ AC_MSG_CHECKING([for __builtin_cosf])
+ AC_TRY_COMPILE([#include <math.h>],
+ [float foo(void) { __builtin_cosf(0.0); }],
+ use_builtin_cosf=yes, use_builtin_cosf=no)
+ AC_MSG_RESULT($use_builtin_cosf)
+ if test $use_builtin_cosf = "yes"; then
+ AC_DEFINE(_GLIBCPP_HAS_BUILTIN_COSF)
+ fi
+
+ AC_MSG_CHECKING([for __builtin_fabsf])
+ AC_TRY_COMPILE([#include <math.h>],
+ [float foo(void) { __builtin_fabsf(0.0); }],
+ use_builtin_fabsf=yes, use_builtin_fabsf=no)
+ AC_MSG_RESULT($use_builtin_fabsf)
+ if test $use_builtin_fabsf = "yes"; then
+ AC_DEFINE(_GLIBCPP_HAS_BUILTIN_FABSF)
+ fi
+
+ AC_MSG_CHECKING([for __builtin_sqrtf])
+ AC_TRY_COMPILE([#include <math.h>],
+ [float foo(void) { __builtin_sqrtf(0.0); }],
+ use_builtin_sqrtf=yes, use_builtin_sqrtf=no)
+ AC_MSG_RESULT($use_builtin_sqrtf)
+ if test $use_builtin_sqrtf = "yes"; then
+ AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SQRTF)
+ fi
+])
+
+
+dnl
+dnl Check to see what architecture we are compiling for. If it's
+dnl supported, use special hand-crafted routines to provide thread
+dnl primitives.
+dnl
+dnl Depending on what is found, select various configure/cpu/*/atomicity.h
+dnl If not found, select configure/cpu/generic/atomicity.h
+dnl
+dnl GLIBCPP_CHECK_CPU
+AC_DEFUN(GLIBCPP_CHECK_CPU, [
+ AC_MSG_CHECKING([for cpu primitives directory])
+ case "$target_cpu" in
+ alpha*)
+ cpu_include_dir="config/cpu/alpha"
+ ;;
+ arm*)
+ cpu_include_dir="config/cpu/arm"
+ ;;
+ i486 | i586 | i686 | i786)
+ cpu_include_dir="config/cpu/i386"
+ ;;
+ powerpc | rs6000)
+ cpu_include_dir="config/cpu/powerpc"
+ ;;
+ sparc64 | ultrasparc)
+ cpu_include_dir="config/cpu/sparc/sparc64"
+ ;;
+ sparc*)
+ cpu_include_dir="config/cpu/sparc/sparc32"
+ ;;
+ *)
+ cpu_include_dir="config/cpu/generic"
+ ;;
+ esac
+ AC_MSG_RESULT($cpu_include_dir)
+ AC_SUBST(cpu_include_dir)
+])
+
+
+dnl
+dnl Check to see what the underlying c library's interface to ctype looks
+dnl like. Bits of locale rely on things like isspace, toupper, etc. This
+dnl stuff makes sure the right bits from the clibrary get called.
+dnl
+dnl Depending on what is found, select various configure/*/bits/ctype_base.h
+dnl Depending on what is found, select various configure/*/ctype.cc
+dnl
+dnl GLIBCPP_CHECK_CTYPE
+AC_DEFUN(GLIBCPP_CHECK_CTYPE, [
+ AC_CHECK_HEADER(ctype.h, [
+
+ dnl If doesn't match any specified, go with defaults.
+ ctype_default=yes
+
+ dnl Test for <ctype> functionality -- gnu-linux
+ AC_MSG_CHECKING([for gnu-linux <ctype>])
+ AC_TRY_COMPILE([#include <ctype.h>],
+ [int
+ foo (int a)
+ { return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \
+ + _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \
+ + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}], \
+ ctype_linux=yes, ctype_linux=no)
+ AC_MSG_RESULT($ctype_linux)
+ if test $ctype_linux = "yes"; then
+ ctype_include_dir="config/gnu-linux"
+ ctype_default=no
+ fi
+
+ dnl Test for <ctype> functionality -- solaris 2.6 and 2.7
+ if test $ctype_default = "yes"; then
+ AC_MSG_CHECKING([for solaris 2.6 or 2.7 <ctype>])
+ AC_TRY_COMPILE([#include <ctype.h>],
+ [int
+ foo (int a)
+ { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
+ + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
+ + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \
+ ctype_solaris=yes, ctype_solaris=no)
+ AC_MSG_RESULT($ctype_solaris)
+
+ if test $ctype_solaris = "yes"; then
+ AC_MSG_CHECKING([ for version])
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([#include <ctype.h>],
+ [typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\
+ ctype_solaris26=yes, ctype_solaris26=no)
+ AC_LANG_C
+ if test $ctype_solaris26 = "yes"; then
+ ctype_include_dir="config/solaris/solaris2.6"
+ AC_MSG_RESULT("solaris2.6")
+ ctype_default=no
+ else
+ ctype_include_dir="config/solaris/solaris2.7"
+ AC_MSG_RESULT("solaris2.7")
+ ctype_default=no
+ fi
+ fi
+ fi
+
+ dnl Test for <ctype> functionality -- solaris 2.5.1
+ if test $ctype_default = "yes"; then
+ AC_MSG_CHECKING([for solaris 2.5.1 <ctype>])
+ AC_TRY_COMPILE([#include <ctype.h>],
+ [int
+ foo (int a)
+ { return _U + _L + _N + _S + _P + _C + _X + _B \
+ + __ctype[a];}], \
+ ctype_solaris25=yes, ctype_solaris25=no)
+ AC_MSG_RESULT($ctype_solaris25)
+ if test $ctype_solaris25 = "yes"; then
+ ctype_include_dir="config/solaris/solaris2.5"
+ ctype_default=no
+ fi
+ fi
+
+ dnl Test for <ctype> functionality -- aix
+ if test $ctype_default = "yes"; then
+ AC_MSG_CHECKING([for aix <ctype>])
+ AC_TRY_COMPILE([#include <ctype.h>],
+ [int
+ foo (int a)
+ { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
+ + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
+ + _VALC('a') + _IS('c', 0);}], \
+ ctype_aix=yes, ctype_aix=no)
+ AC_MSG_RESULT($ctype_aix)
+ if test $ctype_aix = "yes"; then
+ ctype_include_dir="config/aix"
+ ctype_default=no
+ fi
+ fi
+
+ dnl Test for <ctype> functionality -- newlib
+ if test $ctype_default = "yes"; then
+ AC_MSG_CHECKING([for newlib <ctype>])
+ AC_TRY_COMPILE([#include <ctype.h>],
+ [int
+ foo (int a)
+ { return _U + _L + _N + _S + _P + _C + _X + _B \
+ + _ctype_[a];}], \
+ ctype_newlib=yes, ctype_newlib=no)
+ AC_MSG_RESULT($ctype_newlib)
+ if test $ctype_newlib = "yes"; then
+ ctype_include_dir="config/newlib"
+ ctype_default=no
+ fi
+ fi
+
+ if test $ctype_default = "yes"; then
+ ctype_include_dir="config/generic"
+ AC_MSG_WARN("Using default ctype headers.")
+ fi
+ AC_SUBST(ctype_include_dir)
+ ])
+])
+
+
+dnl
+dnl Check to see what the underlying c library or math library is like.
+dnl
+dnl Define HAVE_CARGF etc if "cargf" is found.
+dnl
+dnl GLIBCPP_CHECK_MATH_SUPPORT
+AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
+ AC_CHECK_LIB(m, sin, libm="-lm")
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $libm"
+
+ dnl Check for complex versions of math functions of platform.
+ AC_CHECK_HEADERS([complex.h])
+ AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \
+ clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \
+ ctan ctanf ctanh ctanhf \
+ carg cargf nan hypot hypotf atan2f expf copysignf)
+
+ dnl We compile the long double complex functions only if the function
+ dnl provides the non-complex functions.
+ USE_LONG_DOUBLE=no
+ AC_CHECK_FUNC(sinl,
+ USE_LONG_DOUBLE=yes
+ AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl cpowl csinhl csinl \
+ csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l))
+ AC_SUBST(USE_LONG_DOUBLE)
+
+ dnl Check to see if basic C math functions have faster float versions.
+ AC_CHECK_FUNCS(modf isnan isnanf isnanl isinf isinff isinfl copysign \
+ copysignl cosf coshf logf log10f powf sinf sinhf sqrtf tanf tanhf \
+ strtof strtold fabsf sincos sincosf sincosl finite finite fqfinite \
+ fpclass qfpclass)
+
+#Some runtimes have these functions with a preceding underscore. Please
+# keep this sync'd with the one above. And if you add any new symbol,
+# please add the corresponding block in the @BOTTOM@ section of
+# acconfig.h.
+AC_CHECK_FUNCS(_modf _isnan _isnanf _isnanl _isinf _isinff _isinfl _copysign \
+_copysignl _cosf _coshf _logf _log10f _powf _sinf _sinhf _sqrtf _tanf _tanhf \
+_strtof _strtold _fabsf _sincos _sincosf _sincosl _finite _finitef _qfinite \
+_fpclass _qfpclass)
+
+LIBS="$save_LIBS"
+])
+
+
+dnl
+dnl Check to see if this target can enable the wchar_t parts of libstdc++.
+dnl
+dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
+dnl Define _GLIBCPP_NEED_MBSTATE_T if mbstate_t is not in wchar.h
+dnl Define _GLIBCPP_HAS_WCHAR_MIN_MAX if WCHAR_MIN, WCHAR_MAX in wchar.h
+dnl
+dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
+AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
+ AC_CHECK_HEADER(wchar.h,[
+ dnl Test wchar.h for mbstate_t, which is needed for char_traits and others.
+ AC_MSG_CHECKING([for native mbstate_t])
+ AC_TRY_COMPILE([#include <wchar.h>],
+ [mbstate_t teststate;],
+ use_native_mbstatet=yes, use_native_mbstatet=no)
+ AC_MSG_RESULT($use_native_mbstatet)
+ if test $use_native_mbstatet = "no"; then
+ AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
+ fi
+
+ dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
+ dnl numeric_limits can instantiate type_traits<wchar_t>
+ AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
+ AC_TRY_COMPILE([#include <wchar.h>],
+ [int i = WCHAR_MIN; int j = WCHAR_MAX;],
+ has_wchar_minmax=yes, has_wchar_minmax=no)
+ AC_MSG_RESULT($has_wchar_minmax)
+ if test $has_wchar_minmax = "yes"; then
+ AC_DEFINE(_GLIBCPP_HAS_WCHAR_MIN_MAX)
+ fi
+
+ # Test wchar.h for WEOF, which is what we use to determine whether
+ # to specialize for wchar_t or not.
+ AC_MSG_CHECKING([for WEOF])
+ AC_TRY_COMPILE([
+ #include <wchar.h>
+ #include <stddef.h>],
+ [wint_t i = WEOF;],
+ has_weof=yes, has_weof=no)
+ AC_MSG_RESULT($has_weof)
+
+ dnl Tests for wide character functions.
+ AC_REPLACE_STRINGFUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset)
+
+ AC_MSG_CHECKING([for wide character support])
+ if test $has_weof = "yes" && test $has_wchar_minmax = "yes"; then
+ AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
+ AC_MSG_RESULT(ok)
+ else
+ AC_MSG_RESULT("not specializing for wchar_t")
+ fi
+ ],[
+ AC_MSG_WARN([<wchar.h> not found])
+ AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
+ ])
+])
+
+
+dnl
+dnl Check to see if this version of GNU C++ is afflicted by bugs in
+dnl __complex__ float support.
+dnl
+dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
+dnl
+dnl GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT
+AC_DEFUN(GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT, [
+ AC_REQUIRE([AC_PROG_CXX])
+ AC_MSG_CHECKING([for GNU C++ __complex__ float support])
+ AC_CACHE_VAL(glibcpp_cv_float_complex, [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ rm -f conftest.h
+ cat > conftest.h <<EOB
+ //
+ // Check for buggy __complex__ that causes ICE in most versions of egcs
+ // and gcc-2.95.x on certain platforms (eg., x86-win32).
+ //
+ // See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for
+ // more info on the bug itself.
+ //
+ struct
+ float_complex
+ {
+ __complex__ float m_value;
+ float_complex (float = 0.0f, float = 0.0f);
+ float_complex (__complex__ float val) : m_value (val) {}
+ float_complex foo (const float_complex &val)
+ { return float_complex (~val.m_value); }
+ };
+EOB
+ AC_TRY_COMPILE([#include "conftest.h"], ,
+ glibcpp_cv_float_complex=ok,
+ glibcpp_cv_float_complex=buggy
+ )
+ AC_LANG_RESTORE
+ ])
+ AC_MSG_RESULT($glibcpp_cv_float_complex)
+ if test $glibcpp_cv_float_complex = buggy; then
+ AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
+ fi
+])
+
+
+dnl
+dnl
+dnl Check to see if this version of GNU C++ is afflicted by bugs in
+dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
+dnl gcc-2.95.x when using the library, unless we define the default copy
+dnl ctor in the specializations of complex<>.
+dnl
+dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
+dnl
+dnl GLIBCPP_CHECK_COMPLEX_SUPPORT
+AC_DEFUN(GLIBCPP_CHECK_COMPLEX_SUPPORT, [
+ AC_REQUIRE([AC_PROG_CXX])
+ AC_MSG_CHECKING([for GNU C++ __complex__ support])
+ AC_CACHE_VAL(glibcpp_cv_complex, [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
+ dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
+ [ dcomplex x; f(x); ],
+ glibcpp_cv_complex=ok,
+ glibcpp_cv_complex=buggy
+ )
+ AC_LANG_RESTORE
+ ])
+ AC_MSG_RESULT($glibcpp_cv_complex)
+ if test $glibcpp_cv_complex = buggy; then
+ AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
+ fi
+])
+
+
+dnl
+dnl Check for certain special build configurations.
+dnl
+dnl GLIBCPP_ENABLE_DEBUG
+dnl --enable-debug sets '-ggdb -O0'.
+dnl --disable-debug sets '-g' and whatever optimization options the
+dnl compiler can handle.
+dnl + Perhaps --enable-maintainer-mode should automatically turn this on?
+dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
+dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
+dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
+dnl defaults to `no'.
+AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
+define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
+AC_ARG_ENABLE(debug,
+changequote(<<, >>)dnl
+<< --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
+changequote([, ])dnl
+[case "$enableval" in
+ yes) enable_debug=yes ;;
+ no) enable_debug=no ;;
+ *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
+ esac],
+enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
+dnl Option parsed, now set things appropriately
+case "$enable_debug" in
+ yes) DEBUGFLAGS='-ggdb -O0'
+ ;;
+ no) DEBUGFLAGS='-g'
+ ;;
+esac
+AC_SUBST(DEBUGFLAGS)
+])
+
+
+dnl
+dnl Check for certain special build configurations.
+dnl
+dnl GLIBCPP_ENABLE_NAMESPACES
+dnl --enable-namespaces sets '-fhonor-std' and defines _GLIBCPP_USE_NAMESPACES
+dnl --disable-namespaces sets '-fno-honor-std' (the macro should be
+dnl undefined by default in whatever.h.in).
+dnl + Eventually, this will go away.
+dnl + Usage: GLIBCPP_ENABLE_NAMESPACES[(DEFAULT)]
+dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
+dnl defaults to `no'.
+AC_DEFUN(GLIBCPP_ENABLE_NAMESPACES, [dnl
+define([GLIBCPP_ENABLE_NAMESPACES_DEFAULT], ifelse($1, yes, yes, no))dnl
+AC_ARG_ENABLE(namespaces,
+changequote(<<, >>)dnl
+<< --enable-namespaces turns on 'std' [default=>>GLIBCPP_ENABLE_NAMESPACES_DEFAULT],
+changequote([, ])dnl
+[case "$enableval" in
+ yes) enable_namespaces=yes ;;
+ no) enable_namespaces=no ;;
+ *) AC_MSG_ERROR([Unknown argument to enable/disable namespaces]) ;;
+ esac],
+enable_namespaces=GLIBCPP_ENABLE_NAMESPACES_DEFAULT)dnl
+dnl Option parsed, now set things appropriately
+case "$enable_namespaces" in
+ yes) NAMESPACES='-fhonor-std'
+ AC_DEFINE(_GLIBCPP_USE_NAMESPACES)
+ ;;
+ no) NAMESPACES='-fno-honor-std'
+ ;;
+esac
+AC_SUBST(NAMESPACES)
+])
+
+
+dnl
+dnl Check for instructions to automatically rebuild libgcc.a. Requires,
+dnl of course, the location of the gcc objdir. Note that if --disable-
+dnl namespaces is in effect, rebuilding libgcc.a is an expensive no-op.
+dnl
+dnl GLIBCPP_ENABLE_RELIBGCC
+dnl --enable-libgcc-rebuild=/absolute/path/to/gcc/objdir sets GCC_OBJDIR
+dnl (presumably in the top-level Makefile) to /absol.../objdir
+dnl --disable-libgcc-rebuild will not touch libgcc.a at all (maybe print
+dnl a warning if this is given along with --enable-namespaces), by
+dnl setting GCC_OBJDIR to `no'.
+dnl + Doing this by default is going to be interesting. What default
+dnl "on" value can there be?
+dnl + Usage: GLIBCPP_ENABLE_RELIBGCC[(DEFAULT)]
+dnl The default path should be ../.. if bundled with GCC source.
+dnl If ommitted, it defaults to `no'.
+dnl
+AC_DEFUN(GLIBCPP_ENABLE_RELIBGCC, [dnl
+define([GLIBCPP_ENABLE_RELIBGCC_DEFAULT], ifelse($1,, no, $1))dnl
+AC_ARG_ENABLE(libgcc-rebuild,
+changequote(<<, >>)dnl
+<< --enable-libgcc-rebuild=DIR also rebuild libgcc.a; DIR is
+ the GCC objdir; see install.html>>,
+changequote([, ])dnl
+[case "$enableval" in
+ yes) AC_MSG_ERROR([--enable-libgcc-rebuild needs a pathname]) ;;
+ no) enable_libgcc_rebuild=no ;;
+ *) if test -d "$enableval" && test -d "${enableval}/gcc" && \
+ test -d "${enableval}/libiberty"
+ then
+ enable_libgcc_rebuild="$enableval"
+ else
+ AC_MSG_ERROR(["$enableval" does not appear to be the GCC objdir])
+ fi
+ ;;
+ esac],
+enable_libgcc_rebuild=GLIBCPP_ENABLE_RELIBGCC_DEFAULT)dnl
+GCC_OBJDIR="$enable_libgcc_rebuild"
+AC_SUBST(GCC_OBJDIR)
+])
+
+
+dnl
+dnl Check for certain special build configurations.
+dnl
+dnl GLIBCPP_ENABLE_CSTDIO
+dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
+dnl
+dnl default is libio
+dnl
+AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
+ AC_MSG_CHECKING([for cstdio to use])
+ AC_ARG_ENABLE(cstdio,
+ [ --enable-cstdio enable GNU libio for target io package. (default)
+ --enable-cstdio=LIB use LIB target-speific io package.],
+ if test x$enable_cstdio = xno; then
+ enable_cstdio=libio
+ fi,
+ enable_cstdio=libio)
+
+ enable_cstdio_flag=$enable_cstdio
+
+ dnl Check if a valid thread package
+ case x${enable_cstdio_flag} in
+ xlibio | x | xno | xnone | xyes)
+ # default
+ CSTDIO_H=c_io_libio.h
+ CSTDIO_CC=c_io_libio.cc
+ AC_MSG_RESULT(libio)
+
+ # see if we are on a system with libio native (ie, linux)
+ AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
+ if test $has_libio = "yes"; then
+ BUILD_LIBIO_INCLUDE=
+ need_libio=no
+ else
+ BUILD_LIBIO_INCLUDE='-I../libio'
+ need_libio=yes
+ fi
+ AC_SUBST(BUILD_LIBIO_INCLUDE)
+ ;;
+ xwince)
+ CSTDIO_H=c_io_wince.h
+ CSTDIO_CC=c_io_wince.cc
+ AC_MSG_RESULT(wince)
+
+ need_libio=no
+ BUILD_LIBIO_INCLUDE=
+ AC_SUBST(BUILD_LIBIO_INCLUDE)
+ ;;
+ *)
+ echo "$enable_cstdio is an unknown io package" 1>&2
+ exit 1
+ ;;
+ esac
+ AC_SUBST(CSTDIO_H)
+ AC_SUBST(CSTDIO_CC)
+ AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
+])
+
+
+dnl
+dnl Check for certain special build configurations.
+dnl
+dnl GLIBCPP_ENABLE_THREADS
+dnl --enable-threads=posix sets config/threads-posix.h et. al.
+dnl
+dnl default is no threads
+dnl
+AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
+ dnl Note this comes from the gcc/config.in and libjava/config.in
+ dnl Efforts should be made to keep this in sync.
+ AC_MSG_CHECKING([for threads package to use])
+ AC_ARG_ENABLE(threads,
+ [ --enable-threads enable thread usage for target GCC.
+ --enable-threads=LIB use LIB thread package for target GCC.],
+ if test x$enable_threads = xno; then
+ enable_threads=''
+ fi,
+ enable_threads='')
+
+ enable_threads_flag=$enable_threads
+
+ dnl Check if a valid thread package
+ case x${enable_threads_flag} in
+ x | xno | xnone)
+ # No threads
+ target_thread_file='single'
+ ;;
+ xyes)
+ # default
+ target_thread_file=''
+ ;;
+ xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
+ xsolaris | xwin32 | xdce | xvxworks)
+ target_thread_file=$enable_threads_flag
+ ;;
+ *)
+ echo "$enable_threads is an unknown thread package" 1>&2
+ exit 1
+ ;;
+ esac
+
+ dnl Check for thread package actually supported in libstdc++
+ case "$target_thread_file" in
+ no | none | single)
+ THREADS=none
+ ;;
+ posix | pthreads)
+ THREADS=posix
+ case "$host" in
+ *-*-linux*)
+ ;;
+ esac
+ ;;
+ decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
+ AC_MSG_ERROR(thread package $THREADS not yet supported)
+ ;;
+ *)
+ AC_MSG_ERROR($THREADS is an unknown thread package)
+ ;;
+ esac
+ AC_MSG_RESULT($THREADS)
+
+ THREADLIBS=
+ THREADINCS=
+ THREADDEPS=
+ THREADOBJS=
+ THREADH=
+ THREADSPEC=
+ case "$THREADS" in
+ posix)
+ AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
+ THREADLIBS=-lpthread
+ THREADSPEC=-lpthread
+ dnl Not presently used
+ dnl THREADOBJS=threads-posix.lo
+ THREADH=threads-posix.h
+ ;;
+ none)
+ dnl Not presently used
+ dnl THREADOBJS=threads-no.lo
+ THREADH=threads-no.h
+ ;;
+ esac
+ AC_SUBST(THREADLIBS)
+ AC_SUBST(THREADINCS)
+ AC_SUBST(THREADDEPS)
+ AC_SUBST(THREADOBJS)
+ AC_SUBST(THREADSPEC)
+])
+
+
+dnl
+dnl Check for certain special build configurations.
+dnl
+dnl GLIBCPP_ENABLE_LONG_LONG
+dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
+dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
+dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
+dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
+dnl defaults to `no'.
+dnl
+dnl GLIBCPP_ENABLE_LONG_LONG
+AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
+ define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
+ AC_ARG_ENABLE(long-long,
+ changequote(<<, >>)dnl
+ <<--enable-long_long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
+ changequote([, ])dnl
+ [case "$enableval" in
+ yes) enable_long_long=yes ;;
+ no) enable_long_long=no ;;
+ *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
+ esac],
+ enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
+ dnl Option parsed, now set things appropriately
+ case "$enable_long_long" in
+ yes) AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
+ ;;
+ esac
+])
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Do all the work for Automake. This macro actually does too much --
+# some checks are only needed if your package does certain things.
+# But this isn't really a big deal.
+
+# serial 1
+
+dnl Usage:
+dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+
+AC_DEFUN(AM_INIT_AUTOMAKE,
+[AC_REQUIRE([AC_PROG_INSTALL])
+PACKAGE=[$1]
+AC_SUBST(PACKAGE)
+VERSION=[$2]
+AC_SUBST(VERSION)
+dnl test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+ifelse([$3],,
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
+AC_REQUIRE([AM_SANITY_CHECK])
+AC_REQUIRE([AC_ARG_PROGRAM])
+dnl FIXME This is truly gross.
+missing_dir=`cd $ac_aux_dir && pwd`
+AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
+AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
+AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
+AC_REQUIRE([AC_PROG_MAKE_SET])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+AC_DEFUN(AM_SANITY_CHECK,
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "[$]*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "[$]*" != "X $srcdir/configure conftestfile" \
+ && test "[$]*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "[$]2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+rm -f conftest*
+AC_MSG_RESULT(yes)])
+
+dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
+dnl The program must properly implement --version.
+AC_DEFUN(AM_MISSING_PROG,
+[AC_MSG_CHECKING(for working $2)
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if ($2 --version) < /dev/null > /dev/null 2>&1; then
+ $1=$2
+ AC_MSG_RESULT(found)
+else
+ $1="$3/missing $2"
+ AC_MSG_RESULT(missing)
+fi
+AC_SUBST($1)])
+
+# Add --enable-maintainer-mode option to configure.
+# From Jim Meyering
+
+# serial 1
+
+AC_DEFUN(AM_MAINTAINER_MODE,
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+ dnl maintainer-mode is disabled by default
+ AC_ARG_ENABLE(maintainer-mode,
+[ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer],
+ USE_MAINTAINER_MODE=$enableval,
+ USE_MAINTAINER_MODE=no)
+ AC_MSG_RESULT($USE_MAINTAINER_MODE)
+ AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
+ MAINT=$MAINTAINER_MODE_TRUE
+ AC_SUBST(MAINT)dnl
+]
+)
+
+# Define a conditional.
+
+AC_DEFUN(AM_CONDITIONAL,
+[AC_SUBST($1_TRUE)
+AC_SUBST($1_FALSE)
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi])
+
+# Check for functions in math library.
+# Ulrich Drepper <drepper@cygnus.com>, 1998.
+#
+# This file can be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
+AC_DEFUN(AC_REPLACE_MATHFUNCS,
+[AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
+AC_SUBST(LIBMATHOBJS)dnl
+])
+
+# Check for string functions.
+# Ulrich Drepper <drepper@cygnus.com>, 1998.
+#
+# This file can be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
+AC_DEFUN(AC_REPLACE_STRINGFUNCS,
+[AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
+AC_SUBST(LIBSTRINGOBJS)dnl
+])
+
+
+# serial 40 AC_PROG_LIBTOOL
+AC_DEFUN(AC_PROG_LIBTOOL,
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+
+# Save cache, so that ltconfig can load it
+AC_CACHE_SAVE
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
+DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+|| AC_MSG_ERROR([libtool configure failed])
+
+# Reload cache, that may have been modified by ltconfig
+AC_CACHE_LOAD
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+AC_DEFUN(AC_LIBTOOL_SETUP,
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_RANLIB])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+dnl
+
+case "$target" in
+NONE) lt_target="$host" ;;
+*) lt_target="$target" ;;
+esac
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
+[libtool_flags="$libtool_flags --enable-dlopen"])
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[libtool_flags="$libtool_flags --enable-win32-dll"])
+AC_ARG_ENABLE(libtool-lock,
+ [ --disable-libtool-lock avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case "$lt_target" in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+])
+esac
+])
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
+
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_ENABLE_SHARED[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_SHARED, [dnl
+define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)])
+
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_ENABLE_STATIC[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_STATIC, [dnl
+define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
+
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
+define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN(AC_PROG_LD,
+[AC_ARG_WITH(gnu-ld,
+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$ac_cv_prog_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by GCC])
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+changequote(,)dnl
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+changequote([,])dnl
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(ac_cv_path_LD,
+[if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ ac_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ ac_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$ac_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])
+
+AC_DEFUN(AC_PROG_LD_GNU,
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ ac_cv_prog_gnu_ld=yes
+else
+ ac_cv_prog_gnu_ld=no
+fi])
+])
+
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN(AC_PROG_NM,
+[AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(ac_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ ac_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -B"
+ break
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -p"
+ break
+ else
+ ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+fi])
+NM="$ac_cv_path_NM"
+AC_MSG_RESULT([$NM])
+])
+
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN(AC_CHECK_LIBM,
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case "$lt_target" in
+*-*-beos* | *-*-cygwin*)
+ # These system don't have libm
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, main, LIBM="-lm")
+ ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library, adds --enable-ltdl-convenience to
+# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
+# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
+# to be `${top_builddir}/libltdl'. Make sure you start DIR with
+# '${top_builddir}/' (note the single quotes!) if your package is not
+# flat, and, if you're not using automake, define top_builddir as
+# appropriate in the Makefiles.
+AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case "$enable_ltdl_convenience" in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
+ INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library, and adds --enable-ltdl-install to
+# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
+# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
+# to be `${top_builddir}/libltdl'. Make sure you start DIR with
+# '${top_builddir}/' (note the single quotes!) if your package is not
+# flat, and, if you're not using automake, define top_builddir as
+# appropriate in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, main,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
+ INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ INCLTDL=
+ fi
+])
+
+dnl old names
+AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
+AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
+AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
+
+dnl This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])dnl
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file.
+
+AC_DEFUN(AM_CONFIG_HEADER,
+[AC_PREREQ([2.12])
+AC_CONFIG_HEADER([$1])
+dnl When config.status generates a header, we must update the stamp-h file.
+dnl This file resides in the same directory as the config header
+dnl that is generated. We must strip everything past the first ":",
+dnl and everything past the last "/".
+AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
+ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
+<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
+<<am_indx=1
+for am_file in <<$1>>; do
+ case " <<$>>CONFIG_HEADERS " in
+ *" <<$>>am_file "*<<)>>
+ echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
+ ;;
+ esac
+ am_indx=`expr "<<$>>am_indx" + 1`
+done<<>>dnl>>)
+changequote([,]))])
+
+# Check whether LC_MESSAGES is available in <locale.h>.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# This file file be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+AC_DEFUN(AC_LC_MESSAGES,
+ [if test $ac_cv_header_locale_h = yes; then
+ AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
+ [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+ ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
+ if test $ac_cv_val_LC_MESSAGES = yes; then
+ AC_DEFINE(HAVE_LC_MESSAGES)
+ fi
+ fi])
+
diff --git a/libstdc++-v3/backward/algo.h b/libstdc++-v3/backward/algo.h
new file mode 100644
index 000000000000..b46d3242309f
--- /dev/null
+++ b/libstdc++-v3/backward/algo.h
@@ -0,0 +1,114 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_ALGO_H
+#define _CPP_BACKWARD_ALGO_H 1
+
+#include "algobase.h"
+#include "tempbuf.h"
+#include <bits/stl_algo.h>
+#include <bits/stl_numeric.h>
+
+#ifdef __STL_USE_NAMESPACES
+
+// Names from <stl_algo.h>
+using __STD::for_each;
+using __STD::find;
+using __STD::find_if;
+using __STD::adjacent_find;
+using __STD::count;
+using __STD::count_if;
+using __STD::search;
+using __STD::search_n;
+using __STD::swap_ranges;
+using __STD::transform;
+using __STD::replace;
+using __STD::replace_if;
+using __STD::replace_copy;
+using __STD::replace_copy_if;
+using __STD::generate;
+using __STD::generate_n;
+using __STD::remove;
+using __STD::remove_if;
+using __STD::remove_copy;
+using __STD::remove_copy_if;
+using __STD::unique;
+using __STD::unique_copy;
+using __STD::reverse;
+using __STD::reverse_copy;
+using __STD::rotate;
+using __STD::rotate_copy;
+using __STD::random_shuffle;
+using __STD::random_sample;
+using __STD::random_sample_n;
+using __STD::partition;
+using __STD::stable_partition;
+using __STD::sort;
+using __STD::stable_sort;
+using __STD::partial_sort;
+using __STD::partial_sort_copy;
+using __STD::nth_element;
+using __STD::lower_bound;
+using __STD::upper_bound;
+using __STD::equal_range;
+using __STD::binary_search;
+using __STD::merge;
+using __STD::inplace_merge;
+using __STD::includes;
+using __STD::set_union;
+using __STD::set_intersection;
+using __STD::set_difference;
+using __STD::set_symmetric_difference;
+using __STD::min_element;
+using __STD::max_element;
+using __STD::next_permutation;
+using __STD::prev_permutation;
+using __STD::find_first_of;
+using __STD::find_end;
+using __STD::is_sorted;
+using __STD::is_heap;
+
+// Names from stl_heap.h
+using __STD::push_heap;
+using __STD::pop_heap;
+using __STD::make_heap;
+using __STD::sort_heap;
+
+// Names from stl_numeric.h
+using __STD::accumulate;
+using __STD::inner_product;
+using __STD::partial_sum;
+using __STD::adjacent_difference;
+using __STD::power;
+using __STD::iota;
+
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_ALGO_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/algobase.h b/libstdc++-v3/backward/algobase.h
new file mode 100644
index 000000000000..b5c807a882fb
--- /dev/null
+++ b/libstdc++-v3/backward/algobase.h
@@ -0,0 +1,71 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_ALGOBASE_H
+#define _CPP_BACKWARD_ALGOBASE_H 1
+
+#ifndef _CPP_BACKWARD_PAIR_H
+#include "pair.h"
+#endif
+#ifndef _CPP_BACKWARD_ITERATOR_H
+#include "iterator.h"
+#endif
+#ifndef _CPP_BITS_STL__ALGOBASE_H
+#include <bits/stl_algobase.h>
+#endif
+#ifndef _CPP_BITS_STL_UNINITIALIZED_H
+#include <bits/stl_uninitialized.h>
+#endif
+
+#ifdef __STL_USE_NAMESPACES
+
+// Names from stl_algobase.h
+using __STD::iter_swap;
+using __STD::swap;
+using __STD::min;
+using __STD::max;
+using __STD::copy;
+using __STD::copy_backward;
+using __STD::copy_n;
+using __STD::fill;
+using __STD::fill_n;
+using __STD::mismatch;
+using __STD::equal;
+using __STD::lexicographical_compare;
+using __STD::lexicographical_compare_3way;
+
+// Names from stl_uninitialized.h
+using __STD::uninitialized_copy;
+using __STD::uninitialized_copy_n;
+using __STD::uninitialized_fill;
+using __STD::uninitialized_fill_n;
+
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_ALGOBASE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/alloc.h b/libstdc++-v3/backward/alloc.h
new file mode 100644
index 000000000000..d0e4ba3766c1
--- /dev/null
+++ b/libstdc++-v3/backward/alloc.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1996-1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_ALLOC_H
+#define _CPP_BACKWARD_ALLOC_H 1
+
+#ifndef _CPP_BITS_STL_CONFIG_H
+#include <bits/stl_config.h>
+#endif
+#ifndef _CPP_BITS_STL_ALLOC_H
+#include <bits/stl_alloc.h>
+#endif
+
+#ifdef __STL_USE_NAMESPACES
+
+using __STD::__malloc_alloc_template;
+using __STD::malloc_alloc;
+using __STD::simple_alloc;
+using __STD::debug_alloc;
+using __STD::__default_alloc_template;
+using __STD::alloc;
+using __STD::single_client_alloc;
+#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
+using __STD::__malloc_alloc_oom_handler;
+#endif /* __STL_STATIC_TEMPLATE_MEMBER_BUG */
+#ifdef __STL_USE_STD_ALLOCATORS
+using __STD::allocator;
+#endif /* __STL_USE_STD_ALLOCATORS */
+
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_ALLOC_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/bvector.h b/libstdc++-v3/backward/bvector.h
new file mode 100644
index 000000000000..ed9225404858
--- /dev/null
+++ b/libstdc++-v3/backward/bvector.h
@@ -0,0 +1,51 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_BVECTOR_H
+#define _CPP_BACKWARD_BVECTOR_H 1
+
+#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
+#include "vector.h"
+#else
+#include "algobase.h"
+#include "alloc.h"
+#endif
+
+#include <bits/stl_bvector.h>
+
+#ifdef __STL_USE_NAMESPACES
+
+using __STD::bit_vector;
+
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_BVECTOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
+
diff --git a/libstdc++-v3/backward/defalloc.h b/libstdc++-v3/backward/defalloc.h
new file mode 100644
index 000000000000..8edee690bc6f
--- /dev/null
+++ b/libstdc++-v3/backward/defalloc.h
@@ -0,0 +1,87 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+// Inclusion of this file is DEPRECATED. This is the original HP
+// default allocator. It is provided only for backward compatibility.
+// This file WILL BE REMOVED in a future release.
+//
+// DO NOT USE THIS FILE unless you have an old container implementation
+// that requires an allocator with the HP-style interface.
+//
+// Standard-conforming allocators have a very different interface. The
+// standard default allocator is declared in the header <memory>.
+
+#ifndef _CPP_BACKWARD_DEFALLOC_H
+#define _CPP_BACKWARD_DEFALLOC_H 1
+
+#include "new.h"
+#include <stddef.h>
+#include <stdlib.h>
+#include <limits.h>
+#include "iostream.h"
+#include "algobase.h"
+
+
+template <class _Tp>
+inline _Tp* allocate(ptrdiff_t __size, _Tp*) {
+ set_new_handler(0);
+ _Tp* __tmp = (_Tp*)(::operator new((size_t)(__size * sizeof(_Tp))));
+ if (__tmp == 0) {
+ cerr << "out of memory" << endl;
+ exit(1);
+ }
+ return __tmp;
+}
+
+
+template <class _Tp>
+inline void deallocate(_Tp* __buffer) {
+ ::operator delete(__buffer);
+}
+
+template <class _Tp>
+class allocator {
+public:
+ typedef _Tp value_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ pointer allocate(size_type __n) {
+ return ::allocate((difference_type)__n, (pointer)0);
+ }
+ void deallocate(pointer __p) { ::deallocate(__p); }
+ pointer address(reference __x) { return (pointer)&__x; }
+ const_pointer const_address(const_reference __x) {
+ return (const_pointer)&__x;
+ }
+ size_type init_page_size() {
+ return max(size_type(1), size_type(4096/sizeof(_Tp)));
+ }
+ size_type max_size() const {
+ return max(size_type(1), size_type(UINT_MAX/sizeof(_Tp)));
+ }
+};
+
+class allocator<void> {
+public:
+ typedef void* pointer;
+};
+
+
+
+#endif /* _CPP_BACKWARD_DEFALLOC_H */
diff --git a/libstdc++-v3/backward/deque.h b/libstdc++-v3/backward/deque.h
new file mode 100644
index 000000000000..fc47056c5ee4
--- /dev/null
+++ b/libstdc++-v3/backward/deque.h
@@ -0,0 +1,42 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_DEQUE_H
+#define _CPP_BACKWARD_DEQUE_H 1
+
+#include "algobase.h"
+#include "alloc.h"
+#include <bits/std_deque.h>
+
+#ifdef __STL_USE_NAMESPACES
+using __STD::deque;
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_DEQUE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/function.h b/libstdc++-v3/backward/function.h
new file mode 100644
index 000000000000..7988ae99c2b2
--- /dev/null
+++ b/libstdc++-v3/backward/function.h
@@ -0,0 +1,118 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_FUNCTION_H
+#define _CPP_BACKWARD_FUNCTION_H 1
+
+#ifndef _CPP_BITS_STL_CONFIG_H
+#include <bits/stl_config.h>
+#endif
+#ifndef _CPP_BITS_STL_RELOPS
+#include <bits/stl_relops.h>
+#endif
+#include <stddef.h>
+#ifndef _CPP_BITS_STL_FUNCTION_H
+#include <bits/stl_function.h>
+#endif
+
+#ifdef __STL_USE_NAMESPACE_FOR_RELOPS
+
+// Names from stl_relops.h
+using __STD_RELOPS::operator!=;
+using __STD_RELOPS::operator>;
+using __STD_RELOPS::operator<=;
+using __STD_RELOPS::operator>=;
+
+#endif /* __STL_USE_NAMESPACE_FOR_RELOPS */
+
+#ifdef __STL_USE_NAMESPACES
+
+// Names from stl_function.h
+using __STD::unary_function;
+using __STD::binary_function;
+using __STD::plus;
+using __STD::minus;
+using __STD::multiplies;
+using __STD::divides;
+using __STD::identity_element;
+using __STD::modulus;
+using __STD::negate;
+using __STD::equal_to;
+using __STD::not_equal_to;
+using __STD::greater;
+using __STD::less;
+using __STD::greater_equal;
+using __STD::less_equal;
+using __STD::logical_and;
+using __STD::logical_or;
+using __STD::logical_not;
+using __STD::unary_negate;
+using __STD::binary_negate;
+using __STD::not1;
+using __STD::not2;
+using __STD::binder1st;
+using __STD::binder2nd;
+using __STD::bind1st;
+using __STD::bind2nd;
+using __STD::unary_compose;
+using __STD::binary_compose;
+using __STD::compose1;
+using __STD::compose2;
+using __STD::pointer_to_unary_function;
+using __STD::pointer_to_binary_function;
+using __STD::ptr_fun;
+using __STD::identity;
+using __STD::select1st;
+using __STD::select2nd;
+using __STD::project1st;
+using __STD::project2nd;
+using __STD::constant_void_fun;
+using __STD::constant_unary_fun;
+using __STD::constant_binary_fun;
+using __STD::constant0;
+using __STD::constant1;
+using __STD::constant2;
+using __STD::subtractive_rng;
+using __STD::mem_fun_t;
+using __STD::const_mem_fun_t;
+using __STD::mem_fun_ref_t;
+using __STD::const_mem_fun_ref_t;
+using __STD::mem_fun1_t;
+using __STD::const_mem_fun1_t;
+using __STD::mem_fun1_ref_t;
+using __STD::const_mem_fun1_ref_t;
+using __STD::mem_fun;
+using __STD::mem_fun_ref;
+using __STD::mem_fun1;
+using __STD::mem_fun1_ref;
+
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_FUNCTION_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/hash_map.h b/libstdc++-v3/backward/hash_map.h
new file mode 100644
index 000000000000..ebf0cb8f84be
--- /dev/null
+++ b/libstdc++-v3/backward/hash_map.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+#ifndef _CPP_BACKWARD_HASH_MAP_H
+#define _CPP_BACKWARD_HASH_MAP_H 1
+
+#ifndef _CPP_BITS_STL_HASHTABLE_H
+#include <bits/stl_hashtable.h>
+#endif
+
+#include "algobase.h"
+#include <bits/stl_hash_map.h>
+
+#ifdef __STL_USE_NAMESPACES
+using __STD::hash;
+using __STD::hashtable;
+using __STD::hash_map;
+using __STD::hash_multimap;
+#endif /* __STL_USE_NAMESPACES */
+
+
+#endif /* _CPP_BACKWARD_HASH_MAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/hash_set.h b/libstdc++-v3/backward/hash_set.h
new file mode 100644
index 000000000000..140ce6048c6d
--- /dev/null
+++ b/libstdc++-v3/backward/hash_set.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+#ifndef _CPP_BACKWARD_HASH_SET_H
+#define _CPP_BACKWARD_HASH_SET_H 1
+
+#ifndef _CPP_BITS_STL_HASHTABLE_H
+#include <bits/stl_hashtable.h>
+#endif
+
+#include "algobase.h"
+#include <bits/stl_hash_set.h>
+
+#ifdef __STL_USE_NAMESPACES
+using __STD::hash;
+using __STD::hashtable;
+using __STD::hash_set;
+using __STD::hash_multiset;
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_HASH_SET_H */
diff --git a/libstdc++-v3/backward/hashtable.h b/libstdc++-v3/backward/hashtable.h
new file mode 100644
index 000000000000..bd0f4f47433f
--- /dev/null
+++ b/libstdc++-v3/backward/hashtable.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _CPP_BACKWARD_HASHTABLE_H
+#define _CPP_BACKWARD_HASHTABLE_H 1
+
+#include <bits/stl_hashtable.h>
+#include "algo.h"
+#include "alloc.h"
+#include "vector.h"
+
+#ifdef __STL_USE_NAMESPACES
+using __STD::hash;
+using __STD::hashtable;
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_HASHTABLE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/heap.h b/libstdc++-v3/backward/heap.h
new file mode 100644
index 000000000000..0256fc62e7ed
--- /dev/null
+++ b/libstdc++-v3/backward/heap.h
@@ -0,0 +1,46 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_HEAP_H
+#define _CPP_BACKWARD_HEAP_H 1
+
+#include <bits/stl_config.h>
+#include <bits/stl_heap.h>
+
+#ifdef __STL_USE_NAMESPACES
+
+using __STD::push_heap;
+using __STD::pop_heap;
+using __STD::make_heap;
+using __STD::sort_heap;
+
+#endif /* __STL_USE_NAMESPACES */
+
+
+#endif /* _CPP_BACKWARD_HEAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/iostream.h b/libstdc++-v3/backward/iostream.h
new file mode 100644
index 000000000000..617cde418e6b
--- /dev/null
+++ b/libstdc++-v3/backward/iostream.h
@@ -0,0 +1,55 @@
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_BACKWARD_IOSTREAM_H
+#define _CPP_BACKWARD_IOSTREAM_H 1
+
+#include <bits/std_iostream.h>
+
+#ifdef __STL_USE_NAMESPACES
+using __STD::iostream;
+using __STD::ostream;
+using __STD::istream;
+using __STD::ios;
+using __STD::streambuf;
+
+using __STD::cout;
+using __STD::cin;
+using __STD::cerr;
+using __STD::clog;
+using __STD::wcout;
+using __STD::wcin;
+using __STD::wcerr;
+using __STD::wclog;
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_IOSTREAM_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/iterator.h b/libstdc++-v3/backward/iterator.h
new file mode 100644
index 000000000000..40185036b3be
--- /dev/null
+++ b/libstdc++-v3/backward/iterator.h
@@ -0,0 +1,104 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_ITERATOR_H
+#define _CPP_BACKWARD_ITERATOR_H 1
+
+#ifndef _CPP_BACKWARD_FUNCTION_H
+#include "function.h"
+#endif
+#include <stddef.h>
+#include "iostream.h"
+#ifndef _CPP_BITS_STL_ITERATOR_H
+#include <bits/stl_iterator.h>
+#endif
+#ifndef _CPP_BITS_TYPE_TRAITS_H
+#include <bits/type_traits.h>
+#endif
+#ifndef _CPP_BITS_STL_CONSTRUCT_H
+#include <bits/stl_construct.h>
+#endif
+#ifndef _CPP_BITS_STL_RAW_STORAGE_ITERATOR_H
+#include <bits/stl_raw_storage_iter.h>
+#endif
+
+#ifdef __STL_USE_NAMESPACES
+
+// Names from stl_iterator.h
+
+using __STD::input_iterator_tag;
+using __STD::output_iterator_tag;
+using __STD::forward_iterator_tag;
+using __STD::bidirectional_iterator_tag;
+using __STD::random_access_iterator_tag;
+
+#if 0
+using __STD::iterator;
+#endif
+using __STD::input_iterator;
+using __STD::output_iterator;
+using __STD::forward_iterator;
+using __STD::bidirectional_iterator;
+using __STD::random_access_iterator;
+
+#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
+using __STD::iterator_traits;
+#endif
+
+using __STD::iterator_category;
+using __STD::distance_type;
+using __STD::value_type;
+
+using __STD::distance;
+using __STD::advance;
+
+using __STD::insert_iterator;
+using __STD::front_insert_iterator;
+using __STD::back_insert_iterator;
+using __STD::inserter;
+using __STD::front_inserter;
+using __STD::back_inserter;
+
+using __STD::reverse_iterator;
+using __STD::reverse_bidirectional_iterator;
+
+using __STD::istream_iterator;
+using __STD::ostream_iterator;
+
+// Names from stl_construct.h
+using __STD::construct;
+using __STD::destroy;
+
+// Names from stl_raw_storage_iter.h
+using __STD::raw_storage_iterator;
+
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/list.h b/libstdc++-v3/backward/list.h
new file mode 100644
index 000000000000..9a719ff95941
--- /dev/null
+++ b/libstdc++-v3/backward/list.h
@@ -0,0 +1,42 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_LIST_H
+#define _CPP_BACKWARD_LIST_H 1
+
+#include <bits/stl_algobase.h>
+#include "alloc.h"
+#include <bits/std_list.h>
+
+#ifdef __STL_USE_NAMESPACES
+using __STD::list;
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_LIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/map.h b/libstdc++-v3/backward/map.h
new file mode 100644
index 000000000000..cf0fe2bc6388
--- /dev/null
+++ b/libstdc++-v3/backward/map.h
@@ -0,0 +1,41 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_MAP_H
+#define _CPP_BACKWARD_MAP_H 1
+
+#include "tree.h"
+#include <bits/stl_map.h>
+
+#ifdef __STL_USE_NAMESPACES
+using __STD::map;
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_MAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/multimap.h b/libstdc++-v3/backward/multimap.h
new file mode 100644
index 000000000000..157e3331aa90
--- /dev/null
+++ b/libstdc++-v3/backward/multimap.h
@@ -0,0 +1,41 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_MULTIMAP_H
+#define _CPP_BACKWARD_MULTIMAP_H 1
+
+#include "tree.h"
+#include <bits/stl_multimap.h>
+
+#ifdef __STL_USE_NAMESPACES
+using __STD::multimap;
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_MULTIMAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/multiset.h b/libstdc++-v3/backward/multiset.h
new file mode 100644
index 000000000000..270a5da8ca34
--- /dev/null
+++ b/libstdc++-v3/backward/multiset.h
@@ -0,0 +1,41 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_MULTISET_H
+#define _CPP_BACKWARD_MULTISET_H 1
+
+#include "tree.h"
+#include <bits/stl_multiset.h>
+
+#ifdef __STL_USE_NAMESPACES
+using __STD::multiset;
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_MULTISET_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/new.h b/libstdc++-v3/backward/new.h
new file mode 100644
index 000000000000..20e57dee8de6
--- /dev/null
+++ b/libstdc++-v3/backward/new.h
@@ -0,0 +1,46 @@
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_BACKWARD_NEW_H
+#define _CPP_BACKWARD_NEW_H 1
+
+#include <bits/std_new.h>
+
+#ifdef __STL_USE_NAMESPACES
+using __STD::bad_alloc;
+using __STD::nothrow_t;
+using __STD::nothrow;
+using __STD::new_handler;
+using __STD::set_new_handler;
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_NEW_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/pair.h b/libstdc++-v3/backward/pair.h
new file mode 100644
index 000000000000..275a205bb6ea
--- /dev/null
+++ b/libstdc++-v3/backward/pair.h
@@ -0,0 +1,51 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_PAIR_H
+#define _CPP_BACKWARD_PAIR_H 1
+
+#ifndef _CPP_BITS_STL_CONFIG_H
+#include <bits/stl_config.h>
+#endif
+#ifndef _CPP_BITS_STL_RELOPS_H
+#include <bits/stl_relops.h>
+#endif
+#ifndef _CPP_BITS_STL_PAIR_H
+#include <bits/stl_pair.h>
+#endif
+
+#ifdef __STL_USE_NAMESPACES
+
+using __STD::pair;
+using __STD::make_pair;
+
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_PAIR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/rope.h b/libstdc++-v3/backward/rope.h
new file mode 100644
index 000000000000..7d32f87497ed
--- /dev/null
+++ b/libstdc++-v3/backward/rope.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_ROPE_H
+#define _CPP_BACKWARD_ROPE_H 1
+
+#include "hashtable.h"
+#include <bits/stl_rope.h>
+
+#ifdef __STL_USE_NAMESPACES
+
+using __STD::char_producer;
+using __STD::sequence_buffer;
+using __STD::rope;
+using __STD::crope;
+using __STD::wrope;
+
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_ROPE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/set.h b/libstdc++-v3/backward/set.h
new file mode 100644
index 000000000000..e05890e046ef
--- /dev/null
+++ b/libstdc++-v3/backward/set.h
@@ -0,0 +1,41 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_SET_H
+#define _CPP_BACKWARD_SET_H 1
+
+#include "tree.h"
+#include <bits/stl_set.h>
+
+#ifdef __STL_USE_NAMESPACES
+using __STD::set;
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_SET_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/slist.h b/libstdc++-v3/backward/slist.h
new file mode 100644
index 000000000000..8c63282d1ca0
--- /dev/null
+++ b/libstdc++-v3/backward/slist.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+#ifndef _CPP_BACKWARD_SLIST_H
+#define _CPP_BACKWARD_SLIST_H 1
+
+#include <ext/slist>
+
+#ifdef __STL_USE_NAMESPACES
+using __STD::slist;
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_SLIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/stack.h b/libstdc++-v3/backward/stack.h
new file mode 100644
index 000000000000..4140f409970c
--- /dev/null
+++ b/libstdc++-v3/backward/stack.h
@@ -0,0 +1,46 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_STACK_H
+#define _CPP_BACKWARD_STACK_H 1
+
+#include "vector.h"
+#include "deque.h"
+#include "heap.h"
+#include <bits/stl_stack.h>
+#include <bits/stl_queue.h>
+
+#ifdef __STL_USE_NAMESPACES
+using __STD::stack;
+using __STD::queue;
+using __STD::priority_queue;
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_STACK_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/tempbuf.h b/libstdc++-v3/backward/tempbuf.h
new file mode 100644
index 000000000000..82e5c8e811b1
--- /dev/null
+++ b/libstdc++-v3/backward/tempbuf.h
@@ -0,0 +1,62 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_TEMPBUF_H
+#define _CPP_BACKWARD_TEMPBUF_H 1
+
+#ifndef _CPP_BACKWARD_PAIR_H
+#include "pair.h"
+#endif
+#include <iterator.h>
+#include <limits.h>
+#include <stddef.h>
+#include <stdlib.h>
+#ifndef _CPP_BITS_TYPE_TRAITS_H
+#include <bits/type_traits.h>
+#endif
+#ifndef _CPP_BITS_STL_CONSTRUCT_H
+#include <bits/stl_construct.h>
+#endif
+#ifndef _CPP_BITS_STL_UNINITIALIZED_H
+#include <bits/stl_uninitialized.h>
+#endif
+#ifndef _CPP_BITS_STL_TEMPBUF_H
+#include <bits/stl_tempbuf.h>
+#endif
+
+#ifdef __STL_USE_NAMESPACES
+
+using __STD::get_temporary_buffer;
+using __STD::return_temporary_buffer;
+using __STD::_Temporary_buffer;
+
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_TEMPBUF_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/tree.h b/libstdc++-v3/backward/tree.h
new file mode 100644
index 000000000000..64e89ad36fe8
--- /dev/null
+++ b/libstdc++-v3/backward/tree.h
@@ -0,0 +1,46 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ */
+
+#ifndef _CPP_BACKWARD_TREE_H
+#define _CPP_BACKWARD_TREE_H 1
+
+#ifndef _CPP_BITS_STL_TREE_H
+#include <bits/stl_tree.h>
+#endif
+#include "algobase.h"
+#include "alloc.h"
+
+#ifdef __STL_USE_NAMESPACES
+using __STD::rb_tree;
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_TREE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/backward/vector.h b/libstdc++-v3/backward/vector.h
new file mode 100644
index 000000000000..8a7e8f940401
--- /dev/null
+++ b/libstdc++-v3/backward/vector.h
@@ -0,0 +1,42 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BACKWARD_VECTOR_H
+#define _CPP_BACKWARD_VECTOR_H 1
+
+#include "algobase.h"
+#include "alloc.h"
+#include <bits/stl_vector.h>
+
+#ifdef __STL_USE_NAMESPACES
+using __STD::vector;
+#endif /* __STL_USE_NAMESPACES */
+
+#endif /* _CPP_BACKWARD_VECTOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/basic_file.h b/libstdc++-v3/bits/basic_file.h
new file mode 100644
index 000000000000..71fdb018f3e0
--- /dev/null
+++ b/libstdc++-v3/bits/basic_file.h
@@ -0,0 +1,174 @@
+// Wrapper of C-language FILE struct -*- C++ -*-
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.8 File-based streams
+//
+
+#ifndef _CPP_BASIC_FILE
+#define _CPP_BASIC_FILE 1
+
+#include <bits/c++config.h>
+#include <bits/std_ios.h>
+
+namespace std {
+
+ // Some of these member functions are based on libio/filebuf.cc.
+ // Also note that the order and number of virtual functions has to precisely
+ // match the order and number in the _IO_jump_t struct defined in libioP.h.
+#if _GLIBCPP_BASIC_FILE_INHERITANCE
+ class __basic_file: public __c_file_type
+#else
+ class __basic_file
+#endif
+ {
+#if _GLIBCPP_BASIC_FILE_ENCAPSULATION
+ int _M_fileno;
+ __c_file_type* _M_cfile;
+#endif
+
+ public:
+ __basic_file(__c_lock* __lock = 0);
+
+ // Eqivalent to the normal fopen function.
+ __basic_file*
+ open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
+
+ // Used for opening the standard streams, cin, cout, cerr, clog,
+ // and their wide-stream equivalents. Instead of calling open, it
+ // just sets __c_file_type->_fileno and the respective _flags bits, and
+ // returns.
+ __basic_file*
+ sys_open(int __fd, ios_base::openmode __mode);
+
+ __basic_file*
+ close();
+
+ bool
+ is_open();
+
+ // Needed by ios_base::sync_with_stdio.
+ int get_fileno(void);
+
+ // NB: Must match FILE specific jump table starting here--this
+ // means all virtual functions starting with the dtor must match,
+ // slot by slot. For glibc-based dystems, this means the _IO_FILE
+ // as the FILE struct and _IO_jump_t as the jump table.
+ virtual
+ ~__basic_file(); // Takes the place of __finish.
+
+ virtual int
+ overflow(int __c = EOF);
+
+ virtual int
+ underflow();
+
+ virtual int
+ uflow();
+
+ virtual int
+ pbackfail(int __c);
+
+ // A complex "write" function that sets all of __c_file_type's
+ // ponters and associated data members correctly and manages it's
+ // relation to the external byte sequence.
+ virtual streamsize
+ xsputn(const char* __s, streamsize __n);
+
+ // A complex "read" function that sets all of __c_file_type's
+ // ponters and associated data members correctly and manages it's
+ // relation to the external byte sequence.
+ virtual streamsize
+ xsgetn(char* __s, streamsize __n);
+
+ // A complex "seekoff" function that sets all of __c_file_type's
+ // ponters and associated data members correctly and manages it's
+ // relation to the external byte sequence.
+ virtual __c_streampos
+ seekoff(streamoff __off, ios_base::seekdir __way,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+
+ // A complex "seekpos" function that sets all of __c_file_type's
+ // pointers and associated data members correctly and manages it's
+ // relation to the external byte sequence.
+ virtual __c_streampos
+ seekpos(__c_streampos __pos,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+
+ virtual streambuf*
+ setbuf(char* __b, int __len);
+
+ virtual int
+ sync();
+
+ virtual int
+ doallocate();
+
+ // A simple read function for the external byte sequence, that
+ // does no mucking around with or setting of the pointers or flags
+ // in __c_file_type.
+ virtual streamsize
+ sys_read(char* __s, streamsize __n);
+
+ // A simple write function for the external byte sequence, that
+ // does no mucking around with or setting of the pointers or flags
+ // in __c_file_type.
+ virtual streamsize
+ sys_write(const char* __s, streamsize __n);
+
+ // A simple seek function for the external byte sequence, that
+ // does no mucking around with or setting of the pointers or flags
+ // in __c_file_type.
+ virtual __c_streampos
+ sys_seek(__c_streampos __off, ios_base::seekdir __way);
+
+ virtual int
+ sys_close();
+
+ virtual int
+ sys_stat(void* __v);
+
+ virtual int
+ showmanyc();
+
+ virtual void
+ imbue(void* __v);
+ };
+
+} // namespace std
+
+#endif /* _CPP_BASIC_FILE */
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/basic_ios.h b/libstdc++-v3/bits/basic_ios.h
new file mode 100644
index 000000000000..8168ec0827b8
--- /dev/null
+++ b/libstdc++-v3/bits/basic_ios.h
@@ -0,0 +1,216 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_BITS_BASICIOS_H
+#define _CPP_BITS_BASICIOS_H 1
+
+#include <bits/sbuf_iter.h>
+
+namespace std {
+
+ // 27.4.5 Template class basic_ios
+ template<typename _CharT, typename _Traits>
+ class basic_ios : public ios_base
+ {
+ public:
+
+ // Types:
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ // Non-standard Types:
+ typedef ctype<_CharT> __ctype_type;
+ // From ostream
+ typedef ostreambuf_iterator<_CharT> __ostreambuf_iter;
+ typedef num_put<_CharT, __ostreambuf_iter> __numput_type;
+ typedef istreambuf_iterator<_CharT> __istreambuf_iter;
+ typedef num_get<_CharT, __istreambuf_iter> __numget_type;
+
+ // Data members:
+ private:
+ basic_ostream<_CharT, _Traits>* _M_tie;
+ char_type _M_fill;
+ iostate _M_exception;
+
+ protected:
+ basic_streambuf<_CharT, _Traits>* _M_streambuf;
+ iostate _M_streambuf_state;
+
+ // Cached use_facet<ctype>, which is based on the current locale info.
+ const __ctype_type* _M_fctype_ios;
+ // From ostream.
+ const __numput_type* _M_fnumput;
+ // From istream.
+ const __numget_type* _M_fnumget;
+
+ public:
+
+ inline const __ctype_type*
+ _M_get_fctype_ios(void)
+ { return _M_fctype_ios; }
+
+ inline const __numget_type*
+ _M_get_fnumget(void)
+ { return _M_fnumget; }
+
+ inline const __numput_type*
+ _M_get_fnumput(void)
+ { return _M_fnumput; }
+
+ operator void*() const
+ { return this->fail() ? 0 : const_cast<basic_ios*>(this); }
+
+ inline bool
+ operator!() const
+ { return this->fail(); }
+
+ inline iostate
+ rdstate() const
+ { return _M_streambuf_state; }
+
+ inline void
+ clear(iostate __state = goodbit)
+ {
+ if (this->rdbuf())
+ _M_streambuf_state = __state;
+ else
+ _M_streambuf_state = __state | badbit;
+ if ((this->rdstate() & this->exceptions()))
+ throw failure("basic_ios::clear(iostate) caused exception");
+ }
+
+ inline void
+ setstate(iostate __state)
+ { this->clear(this->rdstate() | __state); }
+
+ inline bool
+ good() const
+ { return this->rdstate() == 0; }
+
+ inline bool
+ eof() const
+ { return (this->rdstate() & eofbit) != 0; }
+
+ inline bool
+ fail() const
+ { return (this->rdstate() & (badbit | failbit)) != 0; }
+
+ inline bool
+ bad() const
+ { return (this->rdstate() & badbit) != 0; }
+
+ inline iostate
+ exceptions() const
+ { return _M_exception; }
+
+ inline void
+ exceptions(iostate __except)
+ {
+ _M_exception = __except;
+ this->clear(_M_streambuf_state);
+ }
+
+ // Constructor/destructor:
+ explicit
+ basic_ios(basic_streambuf<_CharT, _Traits>* __sb) : ios_base()
+ { this->init(__sb); }
+
+ virtual
+ ~basic_ios() { }
+
+ // Members:
+ inline basic_ostream<_CharT, _Traits>*
+ tie() const
+ { return _M_tie; }
+
+ inline basic_ostream<_CharT, _Traits>*
+ tie(basic_ostream<_CharT, _Traits>* __tiestr)
+ {
+ basic_ostream<_CharT, _Traits>* __old = _M_tie;
+ _M_tie = __tiestr;
+ return __old;
+ }
+
+ inline basic_streambuf<_CharT, _Traits>*
+ rdbuf() const
+ { return _M_streambuf; }
+
+ basic_streambuf<_CharT, _Traits>*
+ rdbuf(basic_streambuf<_CharT, _Traits>* __sb);
+
+ basic_ios&
+ copyfmt(const basic_ios& __rhs);
+
+ inline char_type
+ fill() const
+ { return _M_fill; }
+
+ inline char_type
+ fill(char_type __ch)
+ {
+ char_type __old = _M_fill;
+ _M_fill = __ch;
+ return __old;
+ }
+
+ // Locales:
+ locale
+ imbue(const locale& __loc);
+
+ char
+ narrow(char_type __c, char __dfault) const;
+
+ char_type
+ widen(char __c) const;
+
+ protected:
+ // 27.4.5.1 basic_ios constructors
+ basic_ios() : ios_base()
+ { }
+
+ void
+ init(basic_streambuf<_CharT, _Traits>* __sb);
+ };
+
+} // namespace std
+
+#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
+# define export
+//#include <bits/basic_ios.tcc>
+#endif
+
+#endif /* _CPP_BITS_BASICIOS_H */
+
+
+
+
+
diff --git a/libstdc++-v3/bits/basic_ios.tcc b/libstdc++-v3/bits/basic_ios.tcc
new file mode 100644
index 000000000000..3c24e243ffdd
--- /dev/null
+++ b/libstdc++-v3/bits/basic_ios.tcc
@@ -0,0 +1,142 @@
+// basic_ios locale and locale-related member functions -*- C++ -*-
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_BITS_BASICIOS_TCC
+#define _CPP_BITS_BASICIOS_TCC 1
+
+namespace std {
+
+ template<typename _CharT, typename _Traits>
+ basic_streambuf<_CharT, _Traits>*
+ basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __sb)
+ {
+ basic_streambuf<_CharT, _Traits>* __old = _M_streambuf;
+ _M_streambuf = __sb;
+ this->clear();
+ return __old;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ios<_CharT, _Traits>&
+ basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
+ {
+ // Per 27.1.1.1, do not call imbue, yet must trash all caches
+ // associated with imbue()
+
+ // Alloc any new word array first, so if it fails we have "rollback".
+ _Words* __words = (__rhs._M_word_limit <= _S_local_words) ?
+ _M_word_array : new _Words[__rhs._M_word_limit];
+
+ // XXX This is the only reason _Callback_list was defined
+ // inline. The suspicion is that this increased compilation
+ // times dramatically for functions that use this member
+ // function (inserters_extractors, ios_manip_fmtflags). FIX ME,
+ // clean this stuff up. Callbacks are broken right now, anyway.
+
+ // Bump refs before doing callbacks, for safety.
+ _Callback_list* __cb = __rhs._M_callbacks;
+ if (__cb)
+ __cb->_M_add_reference();
+ _M_call_callbacks(erase_event);
+ if (_M_words != _M_word_array)
+ delete [] _M_words;
+ _M_dispose_callbacks();
+
+ _M_callbacks = __cb; // NB: Don't want any added during above.
+ for (int __i = 0; __i < __rhs._M_word_limit; ++__i)
+ __words[__i] = __rhs._M_words[__i];
+ if (_M_words != _M_word_array)
+ delete [] _M_words;
+ _M_words = __words;
+ _M_word_limit = __rhs._M_word_limit;
+
+ this->flags(__rhs.flags());
+ this->width(__rhs.width());
+ this->precision(__rhs.precision());
+ this->tie(__rhs.tie());
+ this->fill(__rhs.fill());
+ // The next is required to be the last assignment.
+ this->exceptions(__rhs.exceptions());
+
+ _M_call_callbacks(copyfmt_event);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ char
+ basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
+ { return _M_fctype_ios->narrow(__c, __dfault); }
+
+ template<typename _CharT, typename _Traits>
+ _CharT
+ basic_ios<_CharT, _Traits>::widen(char __c) const
+ { return _M_fctype_ios->widen(__c); }
+
+ // Locales:
+ template<typename _CharT, typename _Traits>
+ locale
+ basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
+ {
+ locale __old(this->getloc());
+ ios_base::imbue(__loc);
+ _M_fctype_ios = &use_facet<__ctype_type>(__loc);
+ _M_fnumput = &use_facet<__numput_type>(__loc);
+ _M_fnumget = &use_facet<__numget_type>(__loc);
+ if (this->rdbuf() != 0)
+ this->rdbuf()->pubimbue(__loc);
+ return __old;
+ }
+
+ template<typename _CharT, typename _Traits>
+ void
+ basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb)
+ {
+ // NB: This may be called more than once on the same object.
+ ios_base::_M_init();
+ locale __loc = this->getloc();
+ _M_fctype_ios = &use_facet<__ctype_type>(__loc);
+ // Should be filled in by ostream and istream, respectively.
+ _M_fnumput = &use_facet<__numput_type>(__loc);
+ _M_fnumget = &use_facet<__numget_type>(__loc);
+ _M_tie = 0;
+ _M_fill = this->widen(' ');
+ _M_exception = goodbit;
+ _M_streambuf = __sb;
+ iostate __state = __sb ? goodbit : badbit;
+ _M_streambuf_state = __state;
+ }
+
+} // namespace std
+
+#endif /* _CPP_BITS_BASICIOS_TCC */
+
+
+
+
+
diff --git a/libstdc++-v3/bits/basic_string.h b/libstdc++-v3/bits/basic_string.h
new file mode 100644
index 000000000000..f80cc94465a7
--- /dev/null
+++ b/libstdc++-v3/bits/basic_string.h
@@ -0,0 +1,1039 @@
+// Components for manipulating sequences of characters -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 21 Strings library
+//
+
+#ifndef _CPP_BITS_STRING_H
+#define _CPP_BITS_STRING_H 1
+
+#include <bits/exception_support.h>
+#include <atomicity.h>
+
+namespace std {
+
+ // Documentation? What's that?
+ // Nathan Myers <ncm@cantrip.org>.
+ //
+ // A string looks like this:
+ //
+ // [_Rep]
+ // _M_length
+ // [basic_string<char_type>] _M_capacity
+ // _M_dataplus _M_state
+ // _M_p ----------------> unnamed array of char_type
+
+ // Where the _M_p points to the first character in the string, and
+ // you cast it to a pointer-to-_Rep and subtract 1 to get a
+ // pointer to the header.
+
+ // This approach has the enormous advantage that a string object
+ // requires only one allocation. All the ugliness is confined
+ // within a single pair of inline functions, which each compile to
+ // a single "add" instruction: _Rep::_M_data(), and
+ // string::_M_rep(); and the allocation function which gets a
+ // block of raw bytes and with room enough and constructs a _Rep
+ // object at the front.
+
+ // The reason you want _M_data pointing to the character array and
+ // not the _Rep is so that the debugger can see the string
+ // contents. (Probably we should add a non-inline member to get
+ // the _Rep for the debugger to use, so users can check the actual
+ // string length.)
+
+ // Note that the _Rep object is a POD so that you can have a
+ // static "empty string" _Rep object already "constructed" before
+ // static constructors have run. The reference-count encoding is
+ // chosen so that a 0 indicates one reference, so you never try to
+ // destroy the empty-string _Rep object.
+
+ // All but the last paragraph is considered pretty conventional
+ // for a C++ string implementation.
+
+ // 21.3 Template class basic_string
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class basic_string
+ {
+ // Types:
+ public:
+ typedef _Traits traits_type;
+ typedef typename _Traits::char_type value_type;
+ typedef _Alloc allocator_type;
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef typename _Alloc::reference reference;
+ typedef typename _Alloc::const_reference const_reference;
+ typedef typename _Alloc::pointer pointer;
+ typedef typename _Alloc::const_pointer const_pointer;
+ typedef __normal_iterator<pointer, basic_string> iterator;
+ typedef __normal_iterator<const_pointer, basic_string> const_iterator;
+ typedef reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef reverse_iterator<iterator> reverse_iterator;
+
+ // Data Members:
+ // NB: This is an unsigned type, and thus represents the maximum
+ // size that the allocator can hold.
+ static const size_type npos = static_cast<size_type>(-1);
+
+ private:
+ // _Rep: string representation
+ // Invariants:
+ // 1. String really contains _M_length + 1 characters; last is set
+ // to 0 only on call to c_str(). We avoid instantiating
+ // _CharT() where the interface does not require it.
+ // 2. _M_capacity >= _M_length
+ // Allocated memory is always _M_capacity + (1 * sizeof(_CharT)).
+ // 3. _M_state has three states:
+ // -1: leaked, one reference, no ref-copies allowed, non-const.
+ // 0: one reference, non-const.
+ // n>0: n + 1 references, operations require a lock, const.
+ // 4. All fields==0 is an empty string, given the extra storage
+ // beyond-the-end for a null terminator; thus, the shared
+ // empty string representation needs no constructor.
+
+ struct _Rep
+ {
+ // Types:
+ typedef typename _Alloc::rebind<char>::other _Raw_bytes_alloc;
+
+ // NB: Would be better if atomicity.h defined type(s) itself.
+ typedef uint32_t _State_type;
+ typedef int32_t _Signed_state_type;
+
+ // (Public) Data members:
+
+ // The maximum number of individual char_type elements of an
+ // individual string is determined by _S_max_size. This is the
+ // value that will be returned by max_size(). (Whereas npos
+ // is the maximum number of bytes the allocator can allocate.)
+ // If one was to divvy up the theoretical largest size string,
+ // with a terminating character and m _CharT elements, it'd
+ // look like this:
+ // npos = sizeof(_Rep) + (m * sizeof(_CharT)) + sizeof(_CharT)
+ // Solving for m:
+ // m = ((npos - sizeof(_Rep))/sizeof(CharT)) - 1
+ // In addition, this implementation quarters this ammount.
+ static size_type _S_max_size;
+ static _CharT _S_terminal;
+
+ size_type _M_length;
+ size_type _M_capacity;
+ _State_type _M_state;
+
+ bool
+ _M_is_leaked() const
+ { return static_cast<_Signed_state_type>(_M_state) < 0; }
+
+ bool
+ _M_is_shared() const
+ { return static_cast<_Signed_state_type>(_M_state) > 0; }
+
+ void
+ _M_set_leaked()
+ { _M_state = _State_type(-1); }
+
+ void
+ _M_set_sharable()
+ { _M_state = 0; }
+
+ _CharT*
+ _M_refdata() throw()
+ { return reinterpret_cast<_CharT*> (this + 1); }
+
+ _CharT&
+ operator[](size_t __s) throw()
+ { return _M_refdata() [__s]; }
+
+ _CharT*
+ _M_grab(const _Alloc& __alloc1, const _Alloc& __alloc2)
+ { return (!_M_is_leaked() && __alloc1 == __alloc2) ?
+ _M_refcopy() : _M_clone(__alloc1); }
+
+ // Create & Destroy
+ static _Rep*
+ _S_create(size_t, const _Alloc&);
+
+ void
+ _M_dispose(const _Alloc& __a)
+ {
+ if (_Signed_state_type(exchange_and_add(&_M_state, -1)) <= 0)
+ _M_destroy(__a);
+ } // XXX MT
+
+ void
+ _M_destroy(const _Alloc&) throw();
+
+ _CharT*
+ _M_refcopy() throw()
+ {
+ atomic_add(&_M_state, 1);
+ return _M_refdata();
+ } // XXX MT
+
+ _CharT*
+ _M_clone(const _Alloc&, size_type __res = 0);
+
+#if _GLIBCPP_ALLOC_CONTROL
+ // These function pointers allow you to modify the allocation
+ // policy used by the string classes. By default they expand by
+ // powers of two, but this may be excessive for space-critical
+ // applications.
+
+ // Returns true if ALLOCATED is too much larger than LENGTH
+ static bool (*_S_excess_slop) (size_t __length, size_t __allocated);
+
+ inline static bool
+ __default_excess(size_t, size_t);
+#else
+ inline static bool
+ _S_excess_slop(size_t, size_t);
+#endif
+ };
+
+ // Use empty-base optimization: http://www.cantrip.org/emptyopt.html
+ struct _Alloc_hider : _Alloc
+ {
+ _Alloc_hider(_CharT* __dat, const _Alloc& __a)
+ : _Alloc(__a), _M_p(__dat) { }
+
+ _CharT* _M_p; // The actual data.
+ };
+
+ mutable _Alloc_hider _M_dataplus;
+
+ _CharT*
+ _M_data() const
+ { return _M_dataplus._M_p; }
+
+ _CharT*
+ _M_data(_CharT* __p)
+ { return (_M_dataplus._M_p = __p); }
+
+ _Rep*
+ _M_rep() const
+ { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); }
+
+ // For the internal use we have functions similar to `begin'/`end'
+ // but they do not call _M_leak.
+ iterator
+ _M_ibegin() const { return iterator(_M_data()); }
+
+ iterator
+ _M_iend() const { return iterator(_M_data() + this->size()); }
+
+ void
+ _M_leak() // for use in begin() & non-const op[]
+ {
+ if (!_M_rep()->_M_is_leaked())
+ _M_leak_hard();
+ }
+
+ iterator
+ _M_check(size_type __pos) const
+ {
+ __OUTOFRANGE(__pos > this->size());
+ return _M_ibegin() + __pos;
+ }
+
+ // NB: _M_fold doesn't check for a bad __pos1 value.
+ iterator
+ _M_fold(size_type __pos, size_type __off) const
+ {
+ bool __testoff = __off < this->size() - __pos;
+ size_type __newoff = __testoff ? __off : this->size() - __pos;
+ return (_M_ibegin() + __pos + __newoff);
+ }
+
+ // _S_copy_chars is a separate template to permit specialization
+ // to optimize for the common case of pointers as iterators.
+ template<class _Iterator>
+ static void
+ _S_copy_chars(_CharT* __p, _Iterator __j1, _Iterator __j2)
+ {
+ for (; __j1 != __j2; ++__j1, ++__p)
+ traits_type::assign(*__p, *__j1); //these types are off
+ }
+
+ static void
+ _S_copy_chars(_CharT* __p, iterator __j1, iterator __j2)
+ { _S_copy_chars(__p, __j1.base(), __j2.base()); }
+
+ static void
+ _S_copy_chars(_CharT* __p, const_iterator __j1, const_iterator __j2)
+ { _S_copy_chars(__p, __j1.base(), __j2.base()); }
+
+ static void
+ _S_copy_chars(_CharT* __p, _CharT* __j1, _CharT* __j2)
+ { traits_type::copy(__p, __j1, __j2 - __j1); }
+
+ static void
+ _S_copy_chars(_CharT* __p, const _CharT* __j1, const _CharT* __j2)
+ { traits_type::copy(__p, __j1, __j2 - __j1); }
+
+ void
+ _M_mutate(size_type __pos, size_type __len1, size_type __len2);
+
+ void
+ _M_leak_hard();
+
+ // The following storage is init'd to 0 by the linker, resulting
+ // (carefully) in an empty string with one reference.
+ static size_type _S_empty_rep_storage[
+ (sizeof(_Rep) + sizeof(_CharT) + sizeof(size_type)-1)/sizeof(size_type)];
+
+ static _Rep&
+ _S_empty_rep()
+ { return *reinterpret_cast<_Rep*> (&_S_empty_rep_storage); }
+
+ public:
+ // Construct/copy/destroy:
+ // NB: We overload ctors in some cases instead of using default
+ // arguments, per 17.4.4.4 para. 2 item 2.
+
+ inline
+ basic_string();
+
+ explicit
+ basic_string(const _Alloc& __a);
+
+ // NB: per LWG issue 42, semantics different from IS:
+ basic_string(const basic_string& __str);
+ basic_string(const basic_string& __str, size_type __pos,
+ size_type __n = npos);
+ basic_string(const basic_string& __str, size_type __pos,
+ size_type __n, const _Alloc& __a);
+
+ basic_string(const _CharT* __s, size_type __n,
+ const _Alloc& __a = _Alloc());
+ basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
+ basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc());
+
+ template<class _InputIterator>
+ basic_string(_InputIterator __begin, _InputIterator __end,
+ const _Alloc& __a = _Alloc());
+
+ ~basic_string()
+ { _M_rep()->_M_dispose(this->get_allocator()); }
+
+ basic_string&
+ operator=(const basic_string& __str) { return this->assign(__str); }
+
+ basic_string&
+ operator=(const _CharT* __s) { return this->assign(__s); }
+
+ basic_string&
+ operator=(_CharT __c) { return this->assign(1, __c); }
+
+ // Iterators:
+ iterator
+ begin()
+ {
+ _M_leak();
+ return iterator(_M_data());
+ }
+
+ const_iterator
+ begin() const
+ { return const_iterator(_M_data()); }
+
+ iterator
+ end()
+ {
+ _M_leak();
+ return iterator(_M_data() + this->size());
+ }
+
+ const_iterator
+ end() const
+ { return const_iterator(_M_data() + this->size()); }
+
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(this->end()); }
+
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(this->end()); }
+
+ reverse_iterator
+ rend()
+ { return reverse_iterator(this->begin()); }
+
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(this->begin()); }
+
+ public:
+ // Capacity:
+ size_type
+ size() const { return _M_rep()->_M_length; }
+
+ size_type
+ length() const { return _M_rep()->_M_length; }
+
+ size_type
+ max_size() const { return _Rep::_S_max_size; }
+
+ void
+ resize(size_type __n, _CharT __c);
+
+ void
+ resize(size_type __n) { this->resize(__n, _CharT()); }
+
+ size_type
+ capacity() const { return _M_rep()->_M_capacity; }
+
+ void
+ reserve(size_type __res_arg = 0);
+
+ void
+ clear() { _M_mutate(0, this->size(), 0); }
+
+ bool
+ empty() const { return this->size() == 0; }
+
+ // Element access:
+ const_reference
+ operator[] (size_type __pos) const
+ { return _M_data()[__pos]; }
+
+ reference
+ operator[](size_type __pos)
+ {
+ _M_leak();
+ return _M_data()[__pos];
+ }
+
+ const_reference
+ at(size_type __n) const
+ {
+ __OUTOFRANGE(__n >= this->size());
+ return _M_data()[__n];
+ }
+
+ reference
+ at(size_type __n)
+ {
+ __OUTOFRANGE(__n >= size());
+ _M_leak();
+ return _M_data()[__n];
+ }
+
+ // Modifiers:
+ basic_string&
+ operator+=(const basic_string& __str) { return this->append(__str); }
+
+ basic_string&
+ operator+=(const _CharT* __s) { return this->append(__s); }
+
+ basic_string&
+ operator+=(_CharT __c) { return this->append(size_type(1), __c); }
+
+ basic_string&
+ append(const basic_string& __str);
+
+ basic_string&
+ append(const basic_string& __str, size_type __pos, size_type __n);
+
+ basic_string&
+ append(const _CharT* __s, size_type __n);
+
+ basic_string&
+ append(const _CharT* __s)
+ { return this->append(__s, traits_type::length(__s)); }
+
+ basic_string&
+ append(size_type __n, _CharT __c);
+
+ template<class _InputIterator>
+ basic_string&
+ append(_InputIterator __first, _InputIterator __last)
+ { return this->replace(_M_iend(), _M_iend(), __first, __last); }
+
+ void
+ push_back(_CharT __c)
+ { this->replace(_M_iend(), _M_iend(), 1, __c); }
+
+ basic_string&
+ assign(const basic_string& __str);
+
+ basic_string&
+ assign(const basic_string& __str, size_type __pos, size_type __n)
+ {
+ return this->assign(__str._M_check(__pos), __str._M_fold(__pos, __n));
+ }
+
+ basic_string&
+ assign(const _CharT* __s, size_type __n)
+ { return this->assign(__s, __s + __n); }
+
+ basic_string&
+ assign(const _CharT* __s)
+ { return this->assign(__s, __s + traits_type::length(__s)); }
+
+ basic_string&
+ assign(size_type __n, _CharT __c)
+ { return this->replace(_M_ibegin(), _M_iend(), __n, __c); }
+
+ template<class _InputIterator>
+ basic_string&
+ assign(_InputIterator __first, _InputIterator __last)
+ { return this->replace(_M_ibegin(), _M_iend(), __first, __last); }
+
+ void
+ insert(iterator __p, size_type __n, _CharT __c)
+ { this->replace(__p, __p, __n, __c); }
+
+ template<class _InputIterator>
+ void insert(iterator __p, _InputIterator __beg, _InputIterator __end)
+ { this->replace(__p, __p, __beg, __end); }
+
+ basic_string&
+ insert(size_type __pos1, const basic_string& __str)
+ {
+ iterator __p = _M_check(__pos1);
+ this->replace(__p, __p, __str._M_ibegin(), __str._M_iend());
+ return *this;
+ }
+
+ basic_string&
+ insert(size_type __pos1, const basic_string& __str,
+ size_type __pos2, size_type __n)
+ {
+ iterator __p = _M_check(__pos1);
+ this->replace(__p, __p, __str._M_check(__pos2),
+ __str._M_fold(__pos2, __n));
+ return *this;
+ }
+
+ basic_string&
+ insert(size_type __pos, const _CharT* __s, size_type __n)
+ {
+ iterator __p = _M_check(__pos);
+ this->replace(__p, __p, __s, __s + __n);
+ return *this;
+ }
+
+ basic_string&
+ insert(size_type __pos, const _CharT* __s)
+ { return this->insert(__pos, __s, traits_type::length(__s)); }
+
+ basic_string&
+ insert(size_type __pos, size_type __n, _CharT __c)
+ {
+ this->insert(_M_check(__pos), __n, __c);
+ return *this;
+ }
+
+ iterator
+ insert(iterator __p, _CharT __c = _CharT())
+ {
+ size_type __pos = __p - _M_ibegin();
+ this->insert(_M_check(__pos), size_type(1), __c);
+ _M_rep()->_M_set_leaked();
+ return this->_M_ibegin() + __pos;
+ }
+
+ basic_string&
+ erase(size_type __pos = 0, size_type __n = npos)
+ {
+ return this->replace(_M_check(__pos), _M_fold(__pos, __n),
+ _M_data(), _M_data());
+ }
+
+ iterator
+ erase(iterator __position)
+ {
+ size_type __i = __position - _M_ibegin();
+ this->replace(__position, __position + 1, _M_data(), _M_data());
+ _M_rep()->_M_set_leaked();
+ return _M_ibegin() + __i;
+ }
+
+ iterator
+ erase(iterator __first, iterator __last)
+ {
+ size_type __i = __first - _M_ibegin();
+ this->replace(__first, __last, _M_data(), _M_data());
+ _M_rep()->_M_set_leaked();
+ return _M_ibegin() + __i;
+ }
+
+ basic_string&
+ replace(size_type __pos, size_type __n, const basic_string& __str)
+ {
+ return this->replace(_M_check(__pos), _M_fold(__pos, __n),
+ __str.begin(), __str.end());
+ }
+
+ basic_string&
+ replace(size_type __pos1, size_type __n1, const basic_string& __str,
+ size_type __pos2, size_type __n2);
+
+ basic_string&
+ replace(size_type __pos, size_type __n1, const _CharT* __s,
+ size_type __n2)
+ {
+ return this->replace(_M_check(__pos), _M_fold(__pos, __n1),
+ __s, __s + __n2);
+ }
+
+ basic_string&
+ replace(size_type __pos, size_type __n1, const _CharT* __s)
+ {
+ return this->replace(_M_check(__pos), _M_fold(__pos, __n1),
+ __s, __s + traits_type::length(__s));
+ }
+
+ basic_string&
+ replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
+ {
+ return this->replace(_M_check(__pos), _M_fold(__pos, __n1), __n2, __c);
+ }
+
+ basic_string&
+ replace(iterator __i1, iterator __i2, const basic_string& __str)
+ { return this->replace(__i1, __i2, __str.begin(), __str.end()); }
+
+ basic_string&
+ replace(iterator __i1, iterator __i2,
+ const _CharT* __s, size_type __n)
+ { return this->replace(__i1, __i2, __s, __s + __n); }
+
+ basic_string&
+ replace(iterator __i1, iterator __i2, const _CharT* __s)
+ { return this->replace(__i1, __i2, __s,
+ __s + traits_type::length(__s)); }
+
+ basic_string&
+ replace(iterator __i1, iterator __i2, size_type __n, _CharT __c);
+
+ template<class _InputIterator>
+ basic_string&
+ replace(iterator __i1, iterator __i2,
+ _InputIterator __j1, _InputIterator __j2)
+ { return _M_replace(__i1, __i2, __j1, __j2,
+ typename iterator_traits<_InputIterator>::iterator_category()); }
+
+ private:
+ template<class _InputIterator>
+ basic_string&
+ _M_replace(iterator __i1, iterator __i2, _InputIterator __j1,
+ _InputIterator __j2, input_iterator_tag);
+
+ template<class _FwdIterator>
+ basic_string&
+ _M_replace(iterator __i1, iterator __i2, _FwdIterator __j1,
+ _FwdIterator __j2, forward_iterator_tag);
+
+ // _S_construct_aux is used to implement the 21.3.1 para 15 which
+ // requires special behaviour if _InIter is an integral type
+ template<class _InIter>
+ static _CharT*
+ _S_construct_aux(_InIter __beg, _InIter __end, const _Alloc& __a,
+ __false_type)
+ {
+ typedef typename iterator_traits<_InIter>::iterator_category _Tag;
+ return _S_construct(__beg, __end, __a, _Tag());
+ }
+
+ template<class _InIter>
+ static _CharT*
+ _S_construct_aux(_InIter __beg, _InIter __end, const _Alloc& __a,
+ __true_type)
+ {
+ return _S_construct(static_cast<size_type>(__beg),
+ static_cast<value_type>(__end), __a);
+ }
+
+ template<class _InIter>
+ static _CharT*
+ _S_construct(_InIter __beg, _InIter __end, const _Alloc& __a)
+ {
+ typedef typename _Is_integer<_InIter>::_Integral _Integral;
+ return _S_construct_aux(__beg, __end, __a, _Integral());
+ }
+
+ // For Input Iterators, used in istreambuf_iterators, etc.
+ template<class _InIter>
+ static _CharT*
+ _S_construct(_InIter __beg, _InIter __end, const _Alloc& __a,
+ input_iterator_tag);
+
+ // For forward_iterators up to random_access_iterators, used for
+ // string::iterator, _CharT*, etc.
+ template<class _FwdIter>
+ static _CharT*
+ _S_construct(_FwdIter __end, _FwdIter __beg, const _Alloc& __a,
+ forward_iterator_tag);
+
+ static _CharT*
+ _S_construct(size_type __req, _CharT __c, const _Alloc& __a);
+
+ public:
+
+ size_type
+ copy(_CharT* __s, size_type __n, size_type __pos = 0) const;
+
+ void
+ swap(basic_string<_CharT, _Traits, _Alloc>& __s);
+
+ // String operations:
+ const _CharT*
+ c_str() const
+ {
+ // MT: This assumes concurrent writes are OK.
+ size_type __n = this->size();
+ traits_type::assign(_M_data()[__n], _Rep::_S_terminal);
+ return _M_data();
+ }
+
+ const _CharT*
+ data() const { return _M_data(); }
+
+ allocator_type
+ get_allocator() const { return _M_dataplus; }
+
+ size_type
+ find(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ size_type
+ find(const basic_string& __str, size_type __pos = 0) const
+ { return this->find(__str.data(), __pos, __str.size()); }
+
+ size_type
+ find(const _CharT* __s, size_type __pos = 0) const
+ { return this->find(__s, __pos, traits_type::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 this->rfind(__str.data(), __pos, __str.size()); }
+
+ 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 this->rfind(__s, __pos, traits_type::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 this->find_first_of(__str.data(), __pos, __str.size()); }
+
+ 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 this->find_first_of(__s, __pos, traits_type::length(__s)); }
+
+ size_type
+ find_first_of(_CharT __c, size_type __pos = 0) const
+ { return this->find(__c, __pos); }
+
+ size_type
+ find_last_of(const basic_string& __str, size_type __pos = npos) const
+ { return this->find_last_of(__str.data(), __pos, __str.size()); }
+
+ 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 this->find_last_of(__s, __pos, traits_type::length(__s)); }
+
+ size_type
+ find_last_of(_CharT __c, size_type __pos = npos) const
+ { return this->rfind(__c, __pos); }
+
+ size_type
+ find_first_not_of(const basic_string& __str, size_type __pos = 0) const
+ { return this->find_first_not_of(__str.data(), __pos, __str.size()); }
+
+ 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 this->find_first_not_of(__s, __pos, traits_type::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 this->find_last_not_of(__str.data(), __pos, __str.size()); }
+
+ 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 this->find_last_not_of(__s, __pos, traits_type::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
+ {
+ __OUTOFRANGE(__pos > this->size());
+ return basic_string(*this, __pos, __n);
+ }
+
+ int
+ compare(const basic_string& __str) const
+ {
+ size_type __size = this->size();
+ size_type __osize = __str.size();
+ size_type __len = min(__size, __osize);
+
+ int __r = traits_type::compare(_M_data(), __str.data(), __len);
+ if (!__r)
+ __r = __size - __osize;
+ return __r;
+ }
+
+ int
+ compare(size_type __pos, size_type __n, const basic_string& __str) const;
+
+ int
+ compare(size_type __pos1, size_type __n1, const basic_string& __str,
+ size_type __pos2, size_type __n2) const;
+
+ int
+ compare(const _CharT* __s) const;
+
+ int
+ compare(size_type __pos, size_type __n1, const _CharT* __s,
+ size_type __n2 = npos) const;
+
+ private:
+ static const _CharT*
+ _S_find (const _CharT* __beg, const _CharT* __end, _CharT __c);
+ };
+
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline basic_string<_CharT, _Traits, _Alloc>::
+ basic_string()
+ : _M_dataplus(_S_empty_rep()._M_refcopy(), _Alloc()) { }
+
+ // operator+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>
+ operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ {
+ basic_string<_CharT, _Traits, _Alloc> __str(__lhs);
+ __str.append(__rhs);
+ return __str;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT,_Traits,_Alloc>
+ operator+(const _CharT* __lhs,
+ const basic_string<_CharT,_Traits,_Alloc>& __rhs);
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT,_Traits,_Alloc>
+ operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs);
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline basic_string<_CharT, _Traits, _Alloc>
+ operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const _CharT* __rhs)
+ {
+ basic_string<_CharT, _Traits, _Alloc> __str(__lhs);
+ __str.append(__rhs);
+ return __str;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline basic_string<_CharT, _Traits, _Alloc>
+ operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
+ {
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ __string_type __str(__lhs);
+ __str.append(__string_type::size_type(1), __rhs);
+ return __str;
+ }
+
+ // operator ==
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __lhs.compare(__rhs) == 0; }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator==(const _CharT* __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __rhs.compare(__lhs) == 0; }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) == 0; }
+
+ // operator !=
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __rhs.compare(__lhs) != 0; }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator!=(const _CharT* __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __rhs.compare(__lhs) != 0; }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) != 0; }
+
+ // operator <
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __lhs.compare(__rhs) < 0; }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) < 0; }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator<(const _CharT* __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __rhs.compare(__lhs) > 0; }
+
+ // operator >
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __lhs.compare(__rhs) > 0; }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) > 0; }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator>(const _CharT* __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __rhs.compare(__lhs) < 0; }
+
+ // operator <=
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __lhs.compare(__rhs) <= 0; }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) <= 0; }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator<=(const _CharT* __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __rhs.compare(__lhs) >= 0; }
+
+ // operator >=
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __lhs.compare(__rhs) >= 0; }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) >= 0; }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator>=(const _CharT* __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __rhs.compare(__lhs) <= 0; }
+
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline void
+ swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT, _Traits, _Alloc>& __str);
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const basic_string<_CharT, _Traits, _Alloc>& __str);
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_istream<_CharT,_Traits>&
+ getline(basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim);
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline basic_istream<_CharT,_Traits>&
+ getline(basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT, _Traits, _Alloc>& __str);
+
+} // namespace std
+
+#endif /* _CPP_BITS_STRING_H */
diff --git a/libstdc++-v3/bits/c++config.h b/libstdc++-v3/bits/c++config.h
new file mode 100644
index 000000000000..780d3e11cb10
--- /dev/null
+++ b/libstdc++-v3/bits/c++config.h
@@ -0,0 +1,66 @@
+// Predefined symbols and macros -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_CPPCONFIG
+#define _CPP_CPPCONFIG 1
+
+// The current version of the C++ library in compressed ISO date format.
+#define __GLIBCPP__ 20000324
+
+// This flag controls the error handling in string, and perhaps other
+// bits as time goes on: check out bits/basic_string.h for more
+// info. It also helps alleviate the circular dependency between
+// string and exception.
+# define _GLIBCPP_USE_EXCEPTIONS 1
+
+// This is necessary until Egcs supports separate template
+// compilation.
+#define _GLIBCPP_NO_TEMPLATE_EXPORT 1
+
+// This is a hack around not having either pre-compiled headers or
+// export compilation. If defined, the io, string, and valarray
+// headers will include all the necessary bits. If not defined, the
+// implementation optimizes the headers for the most commonly-used
+// types. For the io library, this means that larger, out-of-line
+// member functions are only declared, and definitions are not parsed
+// by the compiler, but instead instantiated into the library binary.
+//#define _GLIBCPP_FULLY_COMPLIANT_HEADERS 1
+
+// To enable older, ARM-style iostreams and other anachronisms use this.
+//#define _GLIBCPP_DEPRICATED 1
+
+// Use corrected code from the committee library group's issues list.
+# define _GLIBCPP_RESOLVE_LIB_DEFECTS 1
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/char_traits.h b/libstdc++-v3/bits/char_traits.h
new file mode 100644
index 000000000000..3943e6e6cb74
--- /dev/null
+++ b/libstdc++-v3/bits/char_traits.h
@@ -0,0 +1,327 @@
+// Character Traits for use by standard string and iostream
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 21 Strings library
+//
+
+#ifndef _CPP_BITS_CHAR_TRAITS_H
+#define _CPP_BITS_CHAR_TRAITS_H 1
+
+#include <bits/std_cwchar.h> // For mbstate_t.
+#include <bits/std_cstring.h> // For memmove, memset, memchr
+#include <bits/fpos.h> // For streamoff, streamsize
+
+namespace std {
+
+ // Same as iosfwd
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ // Can't have self-recursive types for streampos.
+ // 21.1.3.1 char_traits sets size_type to streampos
+ // 27.4.1
+ // And here, where streampos is typedefed to fpos<traits::state_type>
+ typedef fpos<mbstate_t> streampos;
+# ifdef _GLIBCPP_USE_WCHAR_T
+ typedef fpos<mbstate_t> wstreampos;
+# endif
+#endif
+
+ // 21.1.2 Basis for explicit _Traits specialization
+ // NB: That for any given actual character type this definition is
+ // probably wrong.
+
+ template<class _CharT>
+ struct char_traits
+ {
+ typedef _CharT char_type;
+ // Unsigned as wint_t in unsigned.
+ typedef unsigned long int_type;
+ typedef streampos pos_type;
+ typedef streamoff off_type;
+ typedef mbstate_t state_type;
+
+ static void
+ assign(char_type& __c1, const char_type& __c2)
+ { __c1 = __c2; }
+
+ static bool
+ eq(const char_type& __c1, const char_type& __c2)
+ { return __c1 == __c2; }
+
+ static bool
+ lt(const char_type& __c1, const char_type& __c2)
+ { return __c1 < __c2; }
+
+ static int
+ compare(const char_type* __s1, const char_type* __s2, int_type __n)
+ {
+ for (int_type __i = 0; __i < __n; ++__i)
+ if (!eq(__s1[__i],__s2[__i]))
+ return lt(__s1[__i],__s2[__i]) ? -1 : 1;
+ return 0;
+ }
+
+ static size_t
+ length(const char_type* __s)
+ {
+ const char_type* __p = __s;
+ while (*__p) ++__p;
+ return (__p - __s);
+ }
+
+ static const char_type*
+ find(const char_type* __s, int __n, const char_type& __a)
+ {
+ for (const char_type* __p = __s; __p < __s+__n; ++__p)
+ if (*__p == __a) return __p;
+ return 0;
+ }
+
+ static char_type*
+ move(char_type* __s1, const char_type* __s2, int_type __n)
+ { return (char_type*) memmove(__s1, __s2, __n * sizeof(char_type)); }
+
+ static char_type*
+ copy(char_type* __s1, const char_type* __s2, int_type __n)
+ { return (char_type*) memcpy(__s1, __s2, __n * sizeof(char_type)); }
+
+ static char_type*
+ assign(char_type* __s, int_type __n, char_type __a)
+ {
+ for (char_type* __p = __s; __p - __s < __n; ++__p)
+ assign(*__p, __a);
+ return __s;
+ }
+
+ static char_type
+ to_char_type(const int_type& __c)
+ { return char_type(__c); }
+
+ static int_type
+ to_int_type(const char_type& __c) { return int_type(__c); }
+
+ static bool
+ eq_int_type(const int_type& __c1, const int_type& __c2)
+ { return __c1 == __c2; }
+
+ static state_type
+ get_state (pos_type __pos) { return __pos.state(); }
+
+ static int_type
+ eof() { return static_cast<int_type>(-1); }
+
+ static int_type
+ eos() { return int_type(); }
+
+ static int_type
+ not_eof(const int_type& __c)
+ { return eq_int_type(__c, eof()) ? int_type(0) : __c; }
+ };
+
+ // 21.1.4 char_traits specializations
+ template<>
+ struct char_traits<char>
+ {
+ typedef char char_type;
+ typedef unsigned int int_type;
+ typedef streampos pos_type;
+ typedef streamoff off_type;
+ typedef mbstate_t state_type;
+
+ static void
+ assign(char_type& __c1, const char_type& __c2)
+ { __c1 = __c2; }
+
+ static bool
+ eq(const char_type& __c1, const char_type& __c2)
+ { return __c1 == __c2; }
+
+ static bool
+ lt(const char_type& __c1, const char_type& __c2)
+ { return __c1 < __c2; }
+
+ static int
+ compare(const char_type* __s1, const char_type* __s2, int_type __n)
+ { return memcmp(__s1, __s2, __n); }
+
+ static size_t
+ length(const char_type* __s)
+ { return strlen(__s); }
+
+ static const char_type*
+ find(const char_type* __s, int __n, const char_type& __a)
+ { return static_cast<char*>(memchr(__s, __a, __n)); }
+
+ static char_type*
+ move(char_type* __s1, const char_type* __s2, int_type __n)
+ { return static_cast<char*>(memmove(__s1, __s2, __n)); }
+
+ static char_type*
+ copy(char_type* __s1, const char_type* __s2, int_type __n)
+ { return static_cast<char*>(memcpy(__s1, __s2, __n)); }
+
+ static char_type*
+ assign(char_type* __s, int_type __n, char_type __a)
+ { return static_cast<char*>(memset(__s, __a, __n)); }
+
+ static char_type
+ to_char_type(const int_type& __c)
+ { return static_cast<char>(__c); }
+
+ // To keep both the byte 0xff and the eof symbol 0xffffffff
+ // from ending up as 0xffffffff.
+ static int_type
+ to_int_type(const char_type& __c)
+ { return static_cast<int_type>(static_cast<unsigned char>(__c)); }
+
+ static bool
+ eq_int_type(const int_type& __c1, const int_type& __c2)
+ { return __c1 == __c2; }
+
+ static state_type
+ get_state(pos_type __pos) { return __pos.state(); }
+
+ static int_type
+ eof() { return static_cast<int_type>(EOF); }
+
+ static int_type
+ eos() { return '\0'; }
+
+ static int_type
+ not_eof(const int_type& __c)
+ { return (__c == eof()) ? 0 : __c; }
+ };
+
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ struct char_traits<wchar_t>
+ {
+ typedef wchar_t char_type;
+ typedef wint_t int_type;
+ typedef wstreamoff off_type;
+ typedef wstreampos pos_type;
+ typedef mbstate_t state_type;
+
+ static void
+ assign(char_type& __c1, const char_type& __c2)
+ { __c1 = __c2; }
+ static bool
+ eq(const char_type& __c1, const char_type& __c2)
+ { return __c1 == __c2; }
+ static bool
+ lt(const char_type& __c1, const char_type& __c2)
+ { return __c1 < __c2; }
+
+ static int
+ compare(const char_type* __s1, const char_type* __s2, int_type __n)
+ {
+ for (int_type __i = 0; __i < __n; ++__i)
+ if (!eq(__s1[__i], __s2[__i]))
+ return lt(__s1[__i], __s2[__i]) ? -1 : 1;
+ return 0;
+ }
+
+ static size_t
+ length(const char_type* __s)
+ {
+ const char_type* __p = __s;
+ while (*__p)
+ ++__p;
+ return (__p - __s);
+ }
+
+ static const char_type*
+ find (const char_type* __s, int __n, const char_type& __a)
+ {
+ for (const char_type* __p = __s; __p < __s+__n; ++__p)
+ if (*__p == __a)
+ return __p;
+ return 0;
+ }
+
+ static char_type*
+ move(char_type* __s1, const char_type* __s2, int_type __n)
+ { return static_cast<wchar_t*>(memmove(__s1, __s2,
+ __n * sizeof(wchar_t))); }
+
+ static char_type*
+ copy(char_type* __s1, const char_type* __s2, int_type __n)
+ { return static_cast<wchar_t*>(memcpy(__s1, __s2,
+ __n * sizeof(wchar_t))); }
+
+ static char_type*
+ assign(char_type* __s, int_type __n, char_type __a)
+ {
+ for (char_type* __p = __s; __p < __s + __n; ++__p)
+ assign(*__p, __a);
+ return __s;
+ }
+
+ static char_type
+ to_char_type(const int_type& __c) { return char_type(__c); }
+
+ static int_type
+ to_int_type(const char_type& __c) { return int_type(__c); }
+
+ static bool
+ eq_int_type(const int_type& __c1, const int_type& __c2)
+ { return __c1 == __c2; }
+
+ static state_type
+ get_state(pos_type __pos) { return __pos.state(); }
+
+ static int_type
+ eof() { return static_cast<int_type>(WEOF); }
+
+ static int_type
+ eos() { return int_type(); }
+
+ static int_type
+ not_eof(const int_type& __c)
+ { return eq_int_type(__c, eof()) ? 0 : __c; }
+ };
+#endif //_GLIBCPP_USE_WCHAR_T
+
+ template<typename _CharT, typename _Traits>
+ struct _Char_traits_match
+ {
+ _CharT _M_c;
+ _Char_traits_match(_CharT const& __c) : _M_c(__c) { }
+
+ bool
+ operator()(_CharT const& __a) { return _Traits::eq(_M_c,__a); }
+ };
+
+} // namespace std
+
+
+#endif /* _CPP_BITS_CHAR_TRAITS_H */
+
+
diff --git a/libstdc++-v3/bits/cpp_type_traits.h b/libstdc++-v3/bits/cpp_type_traits.h
new file mode 100644
index 000000000000..2b62ee8926e2
--- /dev/null
+++ b/libstdc++-v3/bits/cpp_type_traits.h
@@ -0,0 +1,301 @@
+// The -*- C++ -*- type traits classes for internal use in libstdc++
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Written by Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+#ifndef _CPP_BITS_CPP_TYPE_TRAITS_H
+#define _CPP_BITS_CPP_TYPE_TRAITS_H 1
+
+//
+// This file provides some compile-time information about various types.
+// These informations were designed, on purpose, to be constant-expressions
+// and not types as found in <stl/bits/type_traits.h>. In particular, they
+// can be used in control structures and the optimizer hopefully will do
+// the obvious thing.
+//
+// Why integral expressions, and not functions nor types?
+// Firstly, these compile-time information entities are used as
+// template-arguments so function return values won't work. We
+// need compile-time entities. We're left with types and constant
+// integral expressions.
+// Secondly, from the point of view of ease of use type-based compile-time
+// information is -not- *that* convenient. On has to write lots of
+// overloaded functions and to hope that the compiler will select the right
+// one. As a net effect, the overall structure isn't very clear at first
+// glance.
+// Thirdly, partial ordering and overload resolution (of template functions)
+// is very costly in terms of compiler-resource. It is a Good Thing to
+// keep these resource consumption as least as possible.
+//
+// -- Gaby (dosreis@cmla.ens-cachan.fr) 2000-03-06.
+//
+
+namespace std {
+
+ template<typename _Tp>
+ struct __is_void
+ {
+ enum
+ {
+ _M_type = 0
+ };
+ };
+
+ template<>
+ struct __is_void<void>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+ //
+ // Integer types
+ //
+ template<typename _Tp>
+ struct __is_integer
+ {
+ enum
+ {
+ _M_type = 0
+ };
+ };
+
+ // Thirteen specializations (yes there are eleven standard integer
+ // types; 'long long' and 'unsigned long long' are supported as
+ // extensions)
+ template<>
+ struct __is_integer<bool>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+ template<>
+ struct __is_integer<char>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+ template<>
+ struct __is_integer<signed char>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+ template<>
+ struct __is_integer<unsigned char>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+# ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ struct __is_integer<wchar_t>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+# endif
+
+ template<>
+ struct __is_integer<short>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+ template<>
+ struct __is_integer<unsigned short>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+ template<>
+ struct __is_integer<int>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+ template<>
+ struct __is_integer<unsigned int>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+ template<>
+ struct __is_integer<long>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+ template<>
+ struct __is_integer<unsigned long>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+# ifdef _GLIBCPP_USE_LONG_LONG
+ template<>
+ struct __is_integer<long long>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+ template<>
+ struct __is_integer<unsigned long long>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+# endif
+
+ //
+ // Floating point types
+ //
+ template<typename _Tp>
+ struct __is_floating
+ {
+ enum
+ {
+ _M_type = 0
+ };
+ };
+
+ // three specializations (float, double and 'long double')
+ template<>
+ struct __is_floating<float>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+ template<>
+ struct __is_floating<double>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+ template<>
+ struct __is_floating<long double>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+ //
+ // An arithmetic type is an integer type or a floating point type
+ //
+ template<typename _Tp>
+ struct __is_arithmetic
+ {
+ enum
+ {
+ _M_type = __is_integer<_Tp>::_M_type || __is_floating<_Tp>::_M_type
+ };
+ };
+
+ //
+ // A fundamental type is `void' or and arithmetic type
+ //
+ template<typename _Tp>
+ struct __is_fundamental
+ {
+ enum
+ {
+ _M_type = __is_void<_Tp>::_M_type || __is_arithmetic<_Tp>::_M_type
+ };
+ };
+
+ //
+ // For the immediate use, the following is a good approximation
+ //
+ template<typename _Tp>
+ struct __is_pod
+ {
+ enum
+ {
+ _M_type = __is_fundamental<_Tp>::_M_type
+ };
+ };
+
+} // namespace std
+
+
+#endif //_CPP_BITS_CPP_TYPE_TRAITS_H
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/exception_support.h b/libstdc++-v3/bits/exception_support.h
new file mode 100644
index 000000000000..e4d033c9ada8
--- /dev/null
+++ b/libstdc++-v3/bits/exception_support.h
@@ -0,0 +1,79 @@
+// Methods and support infrastructure for exceptions -*- C++ -*-
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 15 Exception handling
+//
+
+// This file declares functions whose only purpose is to throw an
+// exception. They help break a circularity between <string> and
+// <stdexcept>. See src/stdexcept.cc, where these functions are
+// defined.
+
+// XXX: These functions serve a similar purpose to those in
+// stl/bits/stl_range_errors.h . Eventually the two approaches should
+// be merged.
+
+#ifndef _CPP_EXCEPTION_SUPPORT_H
+#define _CPP_EXCEPTION_SUPPORT_H 1
+
+namespace std {
+
+#if _GLIBCPP_USE_EXCEPTIONS
+ // Internal functions for string implementation.
+ extern void __out_of_range(const char *__str);
+ extern void __length_error(const char *__str);
+
+# define __OUTOFRANGE(__cond) \
+ do { if (__cond) __out_of_range(#__cond); } while (0)
+# define __LENGTHERROR(__cond) \
+ do { if (__cond) __length_error(#__cond); } while (0)
+#else
+# include <bits/std_cassert.h>
+# define __OUTOFRANGE(__cond) assert(!(__cond))
+# define __LENGTHERROR(__cond) assert(!(__cond))
+#endif
+
+} // namespace std
+
+#endif /* _CPP_EXCEPTION_SUPPORT_H */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/fpos.h b/libstdc++-v3/bits/fpos.h
new file mode 100644
index 000000000000..27792b04a847
--- /dev/null
+++ b/libstdc++-v3/bits/fpos.h
@@ -0,0 +1,121 @@
+// File position object and stream types
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27 Input/output library
+//
+
+#ifndef _CPP_BITS_FPOS_H
+#define _CPP_BITS_FPOS_H 1
+
+// Need this here as well as in std_ios because fpos is used in
+// char_traits, and char_traits is used by string, which may or may
+// not have included the std_ios file.
+#include <bits/c++io.h>
+
+namespace std {
+
+ // 27.4.1 Types
+
+ // 27.4.3 Template class fpos
+ template<typename _StateT>
+ class fpos
+ {
+ public:
+
+ // Types:
+ typedef _StateT __state_type;
+
+ __state_type
+ state() const { return _M_st; }
+
+ void
+ state(__state_type __st) { _M_st = __st; }
+
+ // NB: The standard defines only the implicit copy ctor and the
+ // previous two members. The rest is a "conforming extension".
+ fpos(): _M_st(__state_type()), _M_pos(streamoff()) { }
+
+ fpos(streamoff __pos, __state_type __st)
+ : _M_st(__st), _M_pos(__pos) { }
+
+ fpos(streamoff __pos)
+ : _M_st(), _M_pos(__pos) { }
+
+ operator streamoff() const { return _M_pos; }
+
+ fpos&
+ operator+=(streamoff __off) { _M_pos += __off; return *this; }
+
+ fpos&
+ operator-=(streamoff __off) { _M_pos -= __off; return *this; }
+
+ bool
+ operator==(const fpos& __pos2) const { return _M_pos == __pos2._M_pos; }
+
+ bool
+ operator!=(const fpos& __pos2) const { return _M_pos != __pos2._M_pos; }
+
+ streamoff
+ _M_position() const { return _M_pos; }
+
+ void
+ _M_position(streamoff __pos) { _M_pos = __pos; }
+
+ private:
+ __state_type _M_st;
+ streamoff _M_pos;
+ };
+
+ template<typename _State>
+ inline fpos<_State>
+ operator+(const fpos<_State>& __pos, streamoff __off)
+ {
+ fpos<_State> t(__pos);
+ return t += __off;
+ }
+
+ template<typename _State>
+ inline fpos<_State>
+ operator-(const fpos<_State>& __pos, streamoff __off)
+ {
+ fpos<_State> t(__pos);
+ return t -= __off;
+ }
+
+ template<typename _State>
+ inline streamoff
+ operator-(const fpos<_State>& __pos1, const fpos<_State>& __pos2)
+ { return __pos1._M_position() - __pos2._M_position(); }
+
+} // namespace std
+
+#endif /* _CPP_BITS_FPOS_H */
+
+
diff --git a/libstdc++-v3/bits/fstream.tcc b/libstdc++-v3/bits/fstream.tcc
new file mode 100644
index 000000000000..52d71f5e2f89
--- /dev/null
+++ b/libstdc++-v3/bits/fstream.tcc
@@ -0,0 +1,568 @@
+// File based streams -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.8 File-based streams
+//
+
+#ifndef _CPP_BITS_FSTREAM_TCC
+#define _CPP_BITS_FSTREAM_TCC 1
+
+namespace std
+{
+ template<typename _CharT, typename _Traits>
+ void
+ basic_filebuf<_CharT, _Traits>::
+ _M_init_filebuf(void)
+ {
+ _M_buf_unified = true; // Tie input to output for basic_filebuf.
+ _M_buf_size = static_cast<int_type>(BUFSIZ * sizeof(char_type));
+ try {
+ _M_file = new __file_type(&_M_lock);
+ }
+ catch(...) {
+ delete _M_file;
+ throw;
+ }
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_filebuf<_CharT, _Traits>::
+ basic_filebuf()
+ : __streambuf_type(), _M_file(NULL), _M_last_overflowed(false),
+ _M_state_cur(), _M_state_beg()
+ { _M_fcvt = &use_facet<__codecvt_type>(this->getloc()); }
+
+
+ template<typename _CharT, typename _Traits>
+ basic_filebuf<_CharT, _Traits>::
+ basic_filebuf(int __fd, const char* /*__name*/, ios_base::openmode __mode)
+ : __streambuf_type(), _M_last_overflowed(false),
+ _M_state_cur(), _M_state_beg()
+ {
+ _M_fcvt = &use_facet<__codecvt_type>(this->getloc());
+ _M_init_filebuf();
+ _M_file->sys_open(__fd, __mode);
+ if (this->is_open() && _M_buf_size)
+ {
+ _M_mode = __mode;
+ // XXX So that istream::getc() will only need to get 1 char,
+ // as opposed to BUF_SIZE.
+ if (__fd == 0)
+ _M_buf_size = 1;
+
+ try {
+ _M_buf = new char_type[_M_buf_size];
+ }
+ catch(...) {
+ delete [] _M_buf;
+ throw;
+ }
+
+ this->_M_set_indeterminate();
+ }
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_filebuf<_CharT, _Traits>::__filebuf_type*
+ basic_filebuf<_CharT, _Traits>::
+ open(const char* __s, ios_base::openmode __mode)
+ {
+ __filebuf_type *__retval = NULL;
+ if (!this->is_open())
+ {
+ _M_init_filebuf();
+ _M_file->open(__s, __mode);
+ if (this->is_open() && _M_buf_size)
+ {
+ _M_mode = __mode;
+
+ try {
+ _M_buf = new char_type[_M_buf_size];
+ }
+ catch(...) {
+ delete [] _M_buf;
+ throw;
+ }
+
+ // For time being, set both (in/out) sets of pointers.
+ _M_set_indeterminate();
+ if (__mode & ios_base::ate
+ && this->seekoff(0, ios_base::end, __mode) < 0)
+ this->close();
+ __retval = this;
+ }
+ }
+ return __retval;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_filebuf<_CharT, _Traits>::__filebuf_type*
+ basic_filebuf<_CharT, _Traits>::
+ close()
+ {
+ __filebuf_type *__retval = NULL;
+ if (this->is_open())
+ {
+ bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
+ if (__testput)
+ _M_really_overflow(traits_type::eof());
+
+#if 0
+ // XXX not done
+ if (_M_last_overflowed)
+ {
+ _M_output_unshift();
+ _M_really_overflow(traits_type::eof());
+ }
+#endif
+
+ if (_M_file->close())
+ {
+ _M_mode = ios_base::openmode(0);
+ if (_M_buf_size)
+ delete [] _M_buf;
+ _M_buf = NULL;
+ this->setg(NULL, NULL, NULL);
+ this->setp(NULL, NULL);
+ __retval = this;
+ }
+ }
+ _M_last_overflowed = false;
+ return __retval;
+ }
+
+ template<typename _CharT, typename _Traits>
+ streamsize
+ basic_filebuf<_CharT, _Traits>::
+ showmanyc()
+ {
+ streamsize __retval = -1;
+ bool __testin = _M_mode & ios_base::in;
+
+ if (__testin)
+ {
+ bool __testeof = false;
+ if (_M_in_cur >= _M_in_end)
+ __testeof = this->underflow() == traits_type::eof();
+ if (!__testeof)
+ __retval = (_M_in_end - _M_in_cur) / sizeof(char_type);
+ }
+ _M_last_overflowed = false;
+ return __retval;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_filebuf<_CharT, _Traits>::int_type
+ basic_filebuf<_CharT, _Traits>::
+ underflow()
+ {
+ int_type __retval = traits_type::eof();
+ bool __testget = _M_in_cur && _M_in_beg < _M_in_cur;
+ bool __testinit = _M_is_indeterminate();
+ bool __testout = _M_mode & ios_base::out;
+ bool __testin = _M_mode & ios_base::in;
+
+ if (__testin)
+ {
+ // Sync internal and external buffers.
+ // NB: __testget -> __testput as _M_buf_unified here.
+ if (__testget)
+ {
+ if (__testout)
+ _M_really_overflow();
+ else
+ _M_file->seekoff(_M_in_cur - _M_in_beg, ios_base::cur,
+ ios_base::in);
+ }
+
+ if (__testinit || __testget)
+ {
+ // Part one: (Re)fill external buf (_M_file->_IO_*) from
+ // external byte sequence (whatever physical byte sink or
+ // FILE actually is.)
+ char __conv_buf[_M_buf_size];
+ int_type __size = _M_file->xsgetn(__conv_buf, _M_buf_size);
+
+ // Part two: (Re)fill internal buf contents from external buf.
+ if (0 < __size)
+ {
+ _M_set_determinate(__size);
+
+ char* __conv_cur = __conv_buf;
+ _M_state_beg = _M_state_cur;
+ __res_type __r = _M_fcvt->in(_M_state_cur,
+ __conv_buf,
+ __conv_buf + __size,
+ const_cast<const char*&>(__conv_cur),
+ _M_in_beg, _M_in_end, _M_in_cur);
+
+ if (__r == codecvt_base::partial)
+ {
+ // XXX Retry with larger _M_buf size.
+ }
+
+ // Set pointers to internal and external buffers
+ // correctly. . .
+ if (__r != codecvt_base::error)
+ {
+ if (__testout)
+ _M_out_cur = _M_in_cur;
+ __retval = traits_type::to_int_type(*_M_in_cur);
+ }
+
+ // Part three: Sync the current internal buffer
+ // position with the (now overshot) external buffer
+ // position.
+ pos_type __p = _M_file->seekoff(0 - __size, ios_base::cur,
+ ios_base::in);
+ if (__p._M_position() == -1)
+ {
+ // XXX Something is wrong, do error checking.
+ }
+ }
+ }
+ }
+ _M_last_overflowed = false;
+ return __retval;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_filebuf<_CharT, _Traits>::int_type
+ basic_filebuf<_CharT, _Traits>::
+ pbackfail(int_type __i)
+ {
+ int_type __retval = traits_type::eof();
+ char_type __c = traits_type::to_char_type(__i);
+ bool __testeof = traits_type::eq_int_type(__i, traits_type::eof());
+ bool __testout = _M_mode & ios_base::out;
+ bool __testin = _M_mode & ios_base::in;
+
+ if (__testin)
+ {
+ if (!_M_is_indeterminate())
+ {
+ bool __testpb = _M_in_beg < _M_in_cur;
+ bool __testeq = traits_type::eq(__c, this->gptr()[-1]);
+
+ // Try to put back __c into input sequence in one of three ways.
+ // Order these tests done in is unspecified by the standard.
+ if (!__testeof && __testpb && __testeq)
+ {
+ --_M_in_cur;
+ if (__testout)
+ --_M_out_cur;
+ __retval = __i;
+ }
+ else if (!__testeof && __testpb && __testout)
+ {
+ --_M_in_cur;
+ if (__testout)
+ --_M_out_cur;
+ *_M_in_cur = __c;
+ __retval = __i;
+ }
+ else if (__testeof && __testpb)
+ {
+ --_M_in_cur;
+ if (__testout)
+ --_M_out_cur;
+ __retval = traits_type::not_eof(__i);
+ }
+ }
+ else
+ {
+ // Need to make a putback position available.
+ this->seekoff(-1, ios_base::cur);
+ this->underflow();
+ if (!__testeof)
+ {
+ *_M_in_cur = __c;
+ __retval = __c;
+ }
+ else
+ __retval = traits_type::not_eof(__i);
+ }
+ }
+ _M_last_overflowed = false;
+ return __retval;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_filebuf<_CharT, _Traits>::int_type
+ basic_filebuf<_CharT, _Traits>::
+ overflow(int_type __c)
+ {
+ int_type __retval = traits_type::eof();
+ bool __testpos = _M_out_cur && _M_out_cur >= _M_buf + _M_buf_size;
+ bool __testout = _M_mode & ios_base::out;
+
+ if (__testout)
+ {
+ if (!__testpos)
+ {
+ *_M_out_cur = traits_type::to_char_type(__c);
+ _M_buf_bump(1);
+ __retval = traits_type::not_eof(__c);
+ }
+ else
+ __retval = this->_M_really_overflow(__c);
+ }
+
+ _M_last_overflowed = false; // Set in _M_really_overflow, below.
+ return __retval;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_filebuf<_CharT, _Traits>::int_type
+ basic_filebuf<_CharT, _Traits>::
+ _M_really_overflow(int_type __c)
+ {
+ int_type __retval = traits_type::eof();
+ bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
+ bool __testeof = traits_type::eq_int_type(__c, traits_type::eof());
+
+ if (__testput)
+ {
+ // Part one: Allocate temporary conversion buffer on
+ // stack. Convert internal buffer plus __c (ie,
+ // "pending sequence") to temporary conversion buffer.
+ int __plen = _M_out_end - _M_out_beg;
+ char_type __pbuf[__plen + sizeof(char_type)];
+ traits_type::copy(__pbuf, this->pbase(), __plen);
+ if (!__testeof)
+ {
+ __pbuf[__plen] = traits_type::to_char_type(__c);
+ ++__plen;
+ }
+
+ char_type* __pend;
+ char __conv_buf[__plen];
+ char* __conv_end;
+ _M_state_beg = _M_state_cur;
+
+ __res_type __r = _M_fcvt->out(_M_state_cur,
+ __pbuf, __pbuf + __plen,
+ const_cast<const char_type*&>(__pend),
+ __conv_buf, __conv_buf + __plen,
+ __conv_end);
+
+ // Part two: (Re)spill converted "pending sequence"
+ // contents (now in temporary conversion buffer) to
+ // external buffer (_M_file->_IO_*) using
+ // _M_file->sys_write(), and do error (minimal) checking.
+ if (__r != codecvt_base::error)
+ {
+ streamsize __r = _M_file->xsputn(__conv_buf, __plen);
+ // NB: Need this so that external byte sequence reflects
+ // internal buffer.
+ _M_file->sync();
+ if (__r == __plen)
+ {
+ _M_set_indeterminate();
+ __retval = traits_type::not_eof(__c);
+ }
+ }
+ }
+ _M_last_overflowed = true;
+ return __retval;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_filebuf<_CharT, _Traits>::pos_type
+ basic_filebuf<_CharT, _Traits>::
+ seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode)
+ {
+ pos_type __retval = pos_type(off_type(-1));
+ bool __testopen = this->is_open();
+ bool __testin = __mode & ios_base::in && _M_mode & ios_base::in;
+ bool __testout = __mode & ios_base::out && _M_mode & ios_base::out;
+ int __width = _M_fcvt->encoding();
+ if (__width < 0)
+ __width = 0;
+ bool __testfail = __off != 0 && __width <= 0;
+
+ if (__testopen && !__testfail && (__testin || __testout))
+ {
+ if (__way != ios_base::cur || __off != 0)
+ {
+ off_type __computed_off = __width * __off;
+
+ bool __testget = _M_in_cur && _M_in_beg < _M_in_end;
+ bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
+ // Sync the internal and external streams.
+ // out
+ if (__testput || _M_last_overflowed)
+ {
+ // Part one: update the output sequence.
+ this->sync();
+ // Part two: output unshift sequence.
+ _M_output_unshift();
+ }
+ //in
+ // NB: underflow() rewinds the external buffer.
+ else if (__testget && __way == ios_base::cur)
+ __computed_off += _M_in_cur - _M_in_beg;
+
+ __retval = _M_file->seekoff(__computed_off, __way, __mode);
+ if (__retval._M_position() == -1)
+ __retval == pos_type(off_type(-1));
+ _M_set_indeterminate();
+ }
+ // NB: Need to do this in case _M_file in indeterminate
+ // state, ie _M_file->_offset == -1
+ else
+ {
+ __retval = _M_file->seekoff(__off, ios_base::cur, __mode);
+ __retval += max(_M_out_cur, _M_in_cur) - _M_buf;
+ }
+ }
+ _M_last_overflowed = false;
+ return __retval;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_filebuf<_CharT, _Traits>::pos_type
+ basic_filebuf<_CharT, _Traits>::
+ seekpos(pos_type __pos, ios_base::openmode __mode)
+ {
+ pos_type __retval;
+ off_type __off = __pos;
+
+ __retval = this->seekoff(__off, ios_base::beg, __mode);
+
+ _M_last_overflowed = false;
+ return __retval;
+ }
+
+ template<typename _CharT, typename _Traits>
+ void
+ basic_filebuf<_CharT, _Traits>::
+ _M_output_unshift()
+ {
+#if 0
+ // XXX Not complete, or correct.
+ int __width = _M_fcvt->encoding();
+
+ if (__width < 0)
+ {
+ // Part one: call codecvt::unshift
+ int __unsft_len = 0;
+ char_type __unsft_buf[_M_buf_size];
+ char_type* __unsft_cur; // XXX Set to external buf.
+ _M_state_beg = _M_state_cur;
+ __res_type __r = _M_fcvt->unshift(_M_state_cur,
+ __unsft_buf,
+ __unsft_buf + _M_buf_size,
+ __unsft_cur);
+
+ // Note, for char_type == char, wchar_t unshift
+ // should store no charachers.
+ if (__r == codecvt_base::ok || __r == codecvt_base::noconv)
+ __unsft_len = __unsft_cur - __unsft_buf;
+
+ // "Output the resulting sequence."
+ if (__unsft_len)
+ {
+ int __plen = _M_out_cur - _M_out_beg;
+ int __rlen = __plen + __unsft_len;
+ char_type __rbuf[__rlen];
+ char_type* __rend;
+ traits_type::copy(__rbuf, this->pbase(), __plen);
+ traits_type::copy(__rbuf + __plen, __unsft_buf,
+ __unsft_len);
+
+ char __conv_buf[__rlen];
+ char* __conv_end;
+
+ _M_state_beg = _M_state_cur; // XXX Needed?
+ __r = _M_fcvt->out(_M_state_cur,
+ __rbuf, __rbuf + __rlen,
+ const_cast<const char_type*&>(__rend),
+ __conv_buf,
+ __conv_buf + __rlen,
+ __conv_end);
+
+ if (__r != codecvt_base::error)
+ {
+ streamsize __r = _M_file->xsputn(__conv_buf,
+ __rlen);
+ if (__r == __rlen)
+ {
+ _M_out_cur = _M_out_beg;
+ if (_M_mode & ios_base::in)
+ _M_in_cur = _M_out_cur;
+ }
+ else
+ {
+ // XXX Throw "wig out and die exception?"
+ }
+ }
+ }
+ }
+#endif
+ }
+
+ template<typename _CharT, typename _Traits>
+ void
+ basic_filebuf<_CharT, _Traits>::
+ imbue(const locale& __loc)
+ {
+ bool __testbeg = gptr() == eback() && pptr() == pbase();
+ bool __teststate = _M_fcvt->encoding() == -1;
+
+ _M_locale_set = true;
+ if (__testbeg && !__teststate && _M_locale_buf != __loc)
+ {
+ // XXX Will need to save these older values.
+ _M_locale_buf = __loc;
+ _M_fcvt = &use_facet<__codecvt_type>(_M_locale_buf);
+ // XXX Necessary?
+ _M_fctype_buf = &use_facet<__ctype_type>(_M_locale_buf);
+ }
+ // NB this may require the reconversion of previously
+ // converted chars. This in turn may cause the reconstruction
+ // of the original file. YIKES!!
+ // XXX The part in the above comment is not done.
+ _M_last_overflowed = false;
+ }
+
+} // namespace std
+
+#endif // _CPP_BITS_FSTREAM_TCC
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/generic_shadow.h b/libstdc++-v3/bits/generic_shadow.h
new file mode 100644
index 000000000000..4aa3d4a06d6c
--- /dev/null
+++ b/libstdc++-v3/bits/generic_shadow.h
@@ -0,0 +1,57 @@
+// generic C header shadow file -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// This file is included by all the standard C <foo.h> headers
+// after defining _SHADOW_NAME.
+
+#ifdef _IN_C_SWAMP_ /* sub-included by a C header */
+
+ // get out of the "swamp"
+ } // close extern "C"
+ } // close namespace _C_Swamp::
+
+# undef _IN_C_SWAMP_
+# include _SHADOW_NAME
+
+ // dive back into the "swamp"
+ namespace _C_Swamp {
+ extern "C" {
+# define _IN_C_SWAMP_
+
+#else /* not _IN_C_SWAMP_: directly included by user program */
+
+# include _SHADOW_NAME
+
+ // expose global C names, including non-standard ones, but shadow
+ // some names and types with the std:: C++ version.
+
+ using namespace ::_C_Swamp::_C_Shadow;
+
+#endif /* _IN_C_SWAMP_ */
+
diff --git a/libstdc++-v3/bits/gslice.h b/libstdc++-v3/bits/gslice.h
new file mode 100644
index 000000000000..737254c9da7c
--- /dev/null
+++ b/libstdc++-v3/bits/gslice.h
@@ -0,0 +1,117 @@
+// The template and inlines for the -*- C++ -*- gslice class.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _CPP_BITS_GSLICE_H
+#define _CPP_BITS_GSLICE_H
+
+namespace std {
+
+ class gslice
+ {
+ public:
+ gslice ();
+ gslice (size_t, const valarray<size_t>&, const valarray<size_t>&);
+ // XXX: the IS says the copy-ctor and copy-assignment operators are
+ // synthetized by the compiler but they are just unsuitable
+ // for a ref-counted semantic
+ gslice(const gslice&);
+ ~gslice();
+
+ // XXX: See the note above.
+ gslice& operator= (const gslice&);
+
+ size_t start () const;
+ valarray<size_t> size () const;
+ valarray<size_t> stride () const;
+
+ private:
+ struct _Indexer {
+ size_t _M_count;
+ size_t _M_start;
+ valarray<size_t> _M_size;
+ valarray<size_t> _M_stride;
+ valarray<size_t> _M_index;
+ _Indexer(size_t, const valarray<size_t>&,
+ const valarray<size_t>&);
+ void _M_increment_use() { ++_M_count; }
+ size_t _M_decrement_use() { return --_M_count; }
+ };
+
+ _Indexer* _M_index;
+
+ template<typename _Tp> friend class valarray;
+ };
+
+ inline size_t
+ gslice::start () const
+ { return _M_index ? _M_index->_M_start : 0; }
+
+ inline valarray<size_t>
+ gslice::size () const
+ { return _M_index ? _M_index->_M_size : valarray<size_t>(); }
+
+ inline valarray<size_t>
+ gslice::stride () const
+ { return _M_index ? _M_index->_M_stride : valarray<size_t>(); }
+
+ inline gslice::gslice () : _M_index(0) {}
+
+ inline
+ gslice::gslice(size_t __o, const valarray<size_t>& __l,
+ const valarray<size_t>& __s)
+ : _M_index(new gslice::_Indexer(__o, __l, __s)) {}
+
+ inline
+ gslice::gslice(const gslice& __g) : _M_index(__g._M_index)
+ { if (_M_index) _M_index->_M_increment_use(); }
+
+ inline
+ gslice::~gslice()
+ { if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index; }
+
+ inline gslice&
+ gslice::operator= (const gslice& __g)
+ {
+ if (__g._M_index) __g._M_index->_M_increment_use();
+ if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index;
+ _M_index = __g._M_index;
+ return *this;
+ }
+
+
+} // std::
+
+
+#endif /* _CPP_BITS_GSLICE_H */
+
+// Local Variables:
+// mode:c++
+// End:
diff --git a/libstdc++-v3/bits/gslice_array.h b/libstdc++-v3/bits/gslice_array.h
new file mode 100644
index 000000000000..cad3485631a9
--- /dev/null
+++ b/libstdc++-v3/bits/gslice_array.h
@@ -0,0 +1,169 @@
+// The template and inlines for the -*- C++ -*- gslice_array class.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _CPP_BITS_GSLICE_ARRAY
+#define _CPP_BITS_GSLICE_ARRAY 1
+
+namespace std {
+
+ template<typename _Tp> class gslice_array
+ {
+ public:
+ typedef _Tp value_type;
+
+ void operator= (const valarray<_Tp>&) const;
+ void operator*= (const valarray<_Tp>&) const;
+ void operator/= (const valarray<_Tp>&) const;
+ void operator%= (const valarray<_Tp>&) const;
+ void operator+= (const valarray<_Tp>&) const;
+ void operator-= (const valarray<_Tp>&) const;
+ void operator^= (const valarray<_Tp>&) const;
+ void operator&= (const valarray<_Tp>&) const;
+ void operator|= (const valarray<_Tp>&) const;
+ void operator<<=(const valarray<_Tp>&) const;
+ void operator>>=(const valarray<_Tp>&) const;
+ void operator=(const _Tp&);
+
+ template<class _Dom>
+ void operator= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator*= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator/= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator%= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator+= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator-= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator^= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator&= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator|= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator<<= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator>>= (const _Expr<_Dom,_Tp>&) const;
+
+ private:
+ _Array<_Tp> _M_array;
+ const valarray<size_t>& _M_index;
+
+ friend class valarray<_Tp>;
+
+ gslice_array (_Array<_Tp>, const valarray<size_t>&);
+
+ // this constructor needs to be implemented.
+ gslice_array (const gslice_array&);
+
+ // not implemented
+ gslice_array();
+ gslice_array& operator= (const gslice_array&);
+ };
+
+ template<typename _Tp>
+ inline
+ gslice_array<_Tp>::gslice_array (_Array<_Tp> __a,
+ const valarray<size_t>& __i)
+ : _M_array (__a), _M_index (__i) {}
+
+
+ template<typename _Tp>
+ inline
+ gslice_array<_Tp>::gslice_array (const gslice_array<_Tp>& __a)
+ : _M_array (__a._M_array), _M_index (__a._M_index) {}
+
+
+ template<typename _Tp>
+ inline void
+ gslice_array<_Tp>::operator= (const _Tp& __t)
+ {
+ __valarray_fill (_M_array, _Array<size_t>(_M_index),
+ _M_index.size(), __t);
+ }
+
+ template<typename _Tp>
+ inline void
+ gslice_array<_Tp>::operator= (const valarray<_Tp>& __v) const
+ {
+ __valarray_copy (_Array<_Tp> (__v), __v.size (),
+ _M_array, _Array<size_t>(_M_index));
+ }
+
+ template<typename _Tp>
+ template<class E>
+ inline void
+ gslice_array<_Tp>::operator= (const _Expr<E, _Tp>& __e) const
+ {
+ __valarray_copy (__e, _M_index.size(), _M_array,
+ _Array<size_t>(_M_index));
+ }
+
+#undef _DEFINE_VALARRAY_OPERATOR
+#define _DEFINE_VALARRAY_OPERATOR(op, name) \
+template<typename _Tp> \
+inline void \
+gslice_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const \
+{ \
+ _Array_augmented_##name (_M_array, _Array<size_t>(_M_index), \
+ _Array<_Tp> (__v), __v.size ()); \
+} \
+ \
+template<typename _Tp> template<class E> \
+inline void \
+gslice_array<_Tp>::operator##op##= (const _Expr<E, _Tp>& __e) const \
+{ \
+ _Array_augmented_##name (_M_array, _Array<size_t>(_M_index), __e, \
+ _M_index.size()); \
+}
+
+_DEFINE_VALARRAY_OPERATOR(*, multiplies)
+_DEFINE_VALARRAY_OPERATOR(/, divides)
+_DEFINE_VALARRAY_OPERATOR(%, modulus)
+_DEFINE_VALARRAY_OPERATOR(+, plus)
+_DEFINE_VALARRAY_OPERATOR(-, minus)
+_DEFINE_VALARRAY_OPERATOR(^, xor)
+_DEFINE_VALARRAY_OPERATOR(&, and)
+_DEFINE_VALARRAY_OPERATOR(|, or)
+_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
+_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
+
+#undef _DEFINE_VALARRAY_OPERATOR
+
+} // std::
+
+#endif /* _CPP_BITS_GSLICE_ARRAY */
+
+// Local Variables:
+// mode:c++
+// End:
diff --git a/libstdc++-v3/bits/indirect_array.h b/libstdc++-v3/bits/indirect_array.h
new file mode 100644
index 000000000000..73d382a61c13
--- /dev/null
+++ b/libstdc++-v3/bits/indirect_array.h
@@ -0,0 +1,160 @@
+// The template and inlines for the -*- C++ -*- indirect_array class.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _CPP_BITS_INDIRECT_ARRAY_H
+#define _CPP_BITS_INDIRECT_ARRAY_H
+
+namespace std {
+
+ template <class _Tp> class indirect_array
+ {
+ public:
+ typedef _Tp value_type;
+
+ void operator= (const valarray<_Tp>&) const;
+ void operator*= (const valarray<_Tp>&) const;
+ void operator/= (const valarray<_Tp>&) const;
+ void operator%= (const valarray<_Tp>&) const;
+ void operator+= (const valarray<_Tp>&) const;
+ void operator-= (const valarray<_Tp>&) const;
+ void operator^= (const valarray<_Tp>&) const;
+ void operator&= (const valarray<_Tp>&) const;
+ void operator|= (const valarray<_Tp>&) const;
+ void operator<<= (const valarray<_Tp>&) const;
+ void operator>>= (const valarray<_Tp>&) const;
+ void operator= (const _Tp&);
+ // ~indirect_array();
+
+ template<class _Dom>
+ void operator= (const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator*= (const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator/= (const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator%= (const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator+= (const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator-= (const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator^= (const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator&= (const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator|= (const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator<<= (const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator>>= (const _Expr<_Dom, _Tp>&) const;
+
+ private:
+ indirect_array (const indirect_array&);
+ indirect_array (_Array<_Tp>, size_t, _Array<size_t>);
+
+ friend class valarray<_Tp>;
+ friend class gslice_array<_Tp>;
+
+ const size_t _M_sz;
+ const _Array<size_t> _M_index;
+ const _Array<_Tp> _M_array;
+
+ // not implemented
+ indirect_array ();
+ indirect_array& operator= (const indirect_array&);
+ };
+
+ template<typename _Tp>
+ inline indirect_array<_Tp>::indirect_array(const indirect_array<_Tp>& __a)
+ : _M_sz (__a._M_sz), _M_index (__a._M_index),
+ _M_array (__a._M_array) {}
+
+ template<typename _Tp>
+ inline
+ indirect_array<_Tp>::indirect_array (_Array<_Tp> __a, size_t __s,
+ _Array<size_t> __i)
+ : _M_sz (__s), _M_index (__i), _M_array (__a) {}
+
+ // template<typename _Tp>
+ // inline indirect_array<_Tp>::~indirect_array() {}
+
+ template<typename _Tp>
+ inline void
+ indirect_array<_Tp>::operator= (const _Tp& __t)
+ { __valarray_fill(_M_array, _M_index, _M_sz, __t); }
+
+ template<typename _Tp>
+ inline void
+ indirect_array<_Tp>::operator= (const valarray<_Tp>& __v) const
+ { __valarray_copy (_Array<_Tp> (__v), _M_sz, _M_array, _M_index); }
+
+ template<typename _Tp>
+ template<class _Dom>
+ inline void
+ indirect_array<_Tp>::operator= (const _Expr<_Dom,_Tp>& __e) const
+ { __valarray_copy (__e, _M_sz, _M_array, _M_index); }
+
+#undef _DEFINE_VALARRAY_OPERATOR
+#define _DEFINE_VALARRAY_OPERATOR(op, name) \
+template<typename _Tp> \
+inline void \
+indirect_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const \
+{ \
+ _Array_augmented_##name (_M_array, _M_index, _Array<_Tp> (__v), _M_sz); \
+} \
+ \
+template<typename _Tp> template<class _Dom> \
+inline void \
+indirect_array<_Tp>::operator##op##= (const _Expr<_Dom,_Tp>& __e) const \
+{ \
+ _Array_augmented_##name (_M_array, _M_index, __e, _M_sz); \
+}
+
+_DEFINE_VALARRAY_OPERATOR(*, multiplies)
+_DEFINE_VALARRAY_OPERATOR(/, divides)
+_DEFINE_VALARRAY_OPERATOR(%, modulus)
+_DEFINE_VALARRAY_OPERATOR(+, plus)
+_DEFINE_VALARRAY_OPERATOR(-, minus)
+_DEFINE_VALARRAY_OPERATOR(^, xor)
+_DEFINE_VALARRAY_OPERATOR(&, and)
+_DEFINE_VALARRAY_OPERATOR(|, or)
+_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
+_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
+
+#undef _DEFINE_VALARRAY_OPERATOR
+
+} // std::
+
+#endif /* _CPP_BITS_INDIRECT_ARRAY_H */
+
+// Local Variables:
+// mode:c++
+// End:
diff --git a/libstdc++-v3/bits/ios_base.h b/libstdc++-v3/bits/ios_base.h
new file mode 100644
index 000000000000..ee257c67c30d
--- /dev/null
+++ b/libstdc++-v3/bits/ios_base.h
@@ -0,0 +1,576 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.8 File-based streams
+//
+
+#ifndef _CPP_BITS_IOSBASE_H
+#define _CPP_BITS_IOSBASE_H 1
+
+namespace std {
+
+ // The following definitions of bitmask types are enums, not ints,
+ // as permitted (but not required) in the standard, in order to provide
+ // better type safety in iostream calls. A side effect is that
+ // expressions involving them are no longer compile-time constants.
+ enum _Ios_Fmtflags { _S_ios_fmtflags_end = 1<<16 };
+
+ inline _Ios_Fmtflags
+ operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
+ { return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
+
+ inline _Ios_Fmtflags
+ operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
+ { return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
+
+ inline _Ios_Fmtflags
+ operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
+ { return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
+
+ inline _Ios_Fmtflags
+ operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
+ { return __a = __a | __b; }
+
+ inline _Ios_Fmtflags
+ operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
+ { return __a = __a & __b; }
+
+ inline _Ios_Fmtflags
+ operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
+ { return __a = __a ^ __b; }
+
+ inline _Ios_Fmtflags
+ operator~(_Ios_Fmtflags __a)
+ { return _Ios_Fmtflags(~static_cast<int>(__a)); }
+
+
+ enum _Ios_Openmode { _S_ios_openmode_end = 1<<16 };
+
+ inline _Ios_Openmode
+ operator&(_Ios_Openmode __a, _Ios_Openmode __b)
+ { return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
+
+ inline _Ios_Openmode
+ operator|(_Ios_Openmode __a, _Ios_Openmode __b)
+ { return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
+
+ inline _Ios_Openmode
+ operator^(_Ios_Openmode __a, _Ios_Openmode __b)
+ { return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
+
+ inline _Ios_Openmode
+ operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
+ { return __a = __a | __b; }
+
+ inline _Ios_Openmode
+ operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
+ { return __a = __a & __b; }
+
+ inline _Ios_Openmode
+ operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
+ { return __a = __a ^ __b; }
+
+ inline _Ios_Openmode
+ operator~(_Ios_Openmode __a)
+ { return _Ios_Openmode(~static_cast<int>(__a)); }
+
+
+ enum _Ios_Iostate { _S_ios_iostate_end = 1<<16 };
+
+ inline _Ios_Iostate
+ operator&(_Ios_Iostate __a, _Ios_Iostate __b)
+ { return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
+
+ inline _Ios_Iostate
+ operator|(_Ios_Iostate __a, _Ios_Iostate __b)
+ { return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
+
+ inline _Ios_Iostate
+ operator^(_Ios_Iostate __a, _Ios_Iostate __b)
+ { return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
+
+ inline _Ios_Iostate
+ operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
+ { return __a = __a | __b; }
+
+ inline _Ios_Iostate
+ operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
+ { return __a = __a & __b; }
+
+ inline _Ios_Iostate
+ operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
+ { return __a = __a ^ __b; }
+
+ inline _Ios_Iostate
+ operator~(_Ios_Iostate __a)
+ { return _Ios_Iostate(~static_cast<int>(__a)); }
+
+ enum _Ios_Seekdir { _S_ios_Seekdir_end = 1<<16 };
+
+ // 27.4.2 Class ios_base
+ class ios_base
+ {
+ public:
+
+ // 27.4.2.1.1 Class ios_base::failure
+ class failure : public exception
+ {
+ public:
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ // Can't do exception(_msg) as defined in 27.4.2.1.1
+ explicit
+ failure(const string& __str);
+
+ virtual
+ ~failure() { };
+
+ virtual const
+ char* what() const throw() { return _M_name; }
+
+ private:
+ enum { _M_bufsize = 256 };
+ char _M_name[_M_bufsize];
+#endif
+ };
+
+ // 27.4.2.1.2 Type ios_base::fmtflags
+ typedef _Ios_Fmtflags fmtflags;
+ // 27.4.2.1.2 Type fmtflags
+ static const fmtflags boolalpha = fmtflags(__ios_flags::_S_boolalpha);
+ static const fmtflags dec = fmtflags(__ios_flags::_S_dec);
+ static const fmtflags fixed = fmtflags(__ios_flags::_S_fixed);
+ static const fmtflags hex = fmtflags(__ios_flags::_S_hex);
+ static const fmtflags internal = fmtflags(__ios_flags::_S_internal);
+ static const fmtflags left = fmtflags(__ios_flags::_S_left);
+ static const fmtflags oct = fmtflags(__ios_flags::_S_oct);
+ static const fmtflags right = fmtflags(__ios_flags::_S_right);
+ static const fmtflags scientific = fmtflags(__ios_flags::_S_scientific);
+ static const fmtflags showbase = fmtflags(__ios_flags::_S_showbase);
+ static const fmtflags showpoint = fmtflags(__ios_flags::_S_showpoint);
+ static const fmtflags showpos = fmtflags(__ios_flags::_S_showpos);
+ static const fmtflags skipws = fmtflags(__ios_flags::_S_skipws);
+ static const fmtflags unitbuf = fmtflags(__ios_flags::_S_unitbuf);
+ static const fmtflags uppercase = fmtflags(__ios_flags::_S_uppercase);
+ static const fmtflags adjustfield = fmtflags(__ios_flags::_S_adjustfield);
+ static const fmtflags basefield = fmtflags(__ios_flags::_S_basefield);
+ static const fmtflags floatfield = fmtflags(__ios_flags::_S_floatfield);
+
+ // 27.4.2.1.3 Type ios_base::iostate
+ typedef _Ios_Iostate iostate;
+ static const iostate badbit = iostate(__ios_flags::_S_badbit);
+ static const iostate eofbit = iostate(__ios_flags::_S_eofbit);
+ static const iostate failbit = iostate(__ios_flags::_S_failbit);
+ static const iostate goodbit = iostate(0);
+
+ // 27.4.2.1.4 Type openmode
+ typedef _Ios_Openmode openmode;
+ static const openmode app = openmode(__ios_flags::_S_app);
+ static const openmode ate = openmode(__ios_flags::_S_ate);
+ static const openmode binary = openmode(__ios_flags::_S_bin);
+ static const openmode in = openmode(__ios_flags::_S_in);
+ static const openmode out = openmode(__ios_flags::_S_out);
+ static const openmode trunc = openmode(__ios_flags::_S_trunc);
+
+ // 27.4.2.1.5 Type seekdir
+ typedef _Ios_Seekdir seekdir;
+ static const seekdir beg = seekdir(0);
+ static const seekdir cur = seekdir(SEEK_CUR);
+ static const seekdir end = seekdir(SEEK_END);
+
+#ifdef _GLIBCPP_DEPRICATED
+ typedef int io_state;
+ typedef int open_mode;
+ typedef int seek_dir;
+#endif
+
+ // Callbacks;
+ enum event
+ {
+ erase_event,
+ imbue_event,
+ copyfmt_event
+ };
+
+ typedef void (*event_callback) (event, ios_base&, int);
+
+ void
+ register_callback(event_callback __fn, int __index);
+
+ protected:
+ // Data Members
+ streamsize _M_precision;
+ streamsize _M_width;
+ fmtflags _M_flags;
+
+ // 27.4.2.6 Members for callbacks
+ // 27.4.2.6 ios_base callbacks
+
+ struct _Callback_list
+ {
+ // Data Members
+ _Callback_list* _M_next;
+ ios_base::event_callback _M_fn;
+ int _M_index;
+ int _M_refcount; // 0 means one reference.
+
+ _Callback_list(ios_base::event_callback __fn, int __index,
+ _Callback_list* __cb)
+ : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }
+
+ void
+ _M_add_reference() { ++_M_refcount; } // XXX MT
+
+ int
+ _M_remove_reference() { return _M_refcount--; } // 0 => OK to delete
+ };
+
+ _Callback_list* _M_callbacks;
+
+ void
+ _M_call_callbacks(event __ev) throw();
+
+ void
+ _M_dispose_callbacks(void);
+
+ // 27.4.2.5 Members for iword/pword storage
+ struct _Words
+ {
+ void* _M_pword;
+ long _M_iword;
+ };
+
+ static const int _S_local_words = 8;
+ _Words _M_word_array[_S_local_words]; // Guaranteed storage
+ _Words _M_dummy; // Only for failed iword/pword calls.
+ _Words* _M_words;
+ int _M_word_limit;
+
+ _Words&
+ _M_grow_words(int __index);
+
+ // Members for locale and locale caching.
+ locale _M_locale_ios;
+
+ void
+ _M_init();
+
+ public:
+ // 27.4.2.1.6 Class ios_base::Init
+ // Used to initialize standard streams. In theory, g++ could use
+ // -finit-priority to order this stuff correctly without going
+ // through these machinations.
+
+ class Init
+ {
+ friend class ios_base;
+ public:
+ Init();
+ ~Init();
+ private:
+ static int _M_ios_base_init;
+ filebuf* _M_cout;
+ filebuf* _M_cin;
+ filebuf* _M_cerr;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ wfilebuf* _M_wcout;
+ wfilebuf* _M_wcin;
+ wfilebuf* _M_wcerr;
+#endif
+ };
+
+ // Fmtflags state:
+ inline fmtflags
+ flags() const { return _M_flags; }
+
+ inline fmtflags
+ flags(fmtflags __fmtfl)
+ {
+ fmtflags __old = _M_flags;
+ _M_flags = __fmtfl;
+ return __old;
+ }
+
+ inline fmtflags
+ setf(fmtflags __fmtfl)
+ {
+ fmtflags __old = _M_flags;
+ _M_flags |= __fmtfl;
+ return __old;
+ }
+
+ inline fmtflags
+ setf(fmtflags __fmtfl, fmtflags __mask)
+ {
+ fmtflags __old = _M_flags;
+ _M_flags &= ~__mask;
+ _M_flags |= (__fmtfl & __mask);
+ return __old;
+ }
+
+ inline void
+ unsetf(fmtflags __mask) { _M_flags &= ~__mask; }
+
+ inline streamsize
+ precision() const { return _M_precision; }
+
+ inline streamsize
+ precision(streamsize __prec)
+ {
+ streamsize __old = _M_precision;
+ _M_precision = __prec;
+ return __old;
+ }
+
+ inline streamsize
+ width() const { return _M_width; }
+
+ inline streamsize
+ width(streamsize __wide)
+ {
+ streamsize __old = _M_width;
+ _M_width = __wide;
+ return __old;
+ }
+
+ static bool
+ sync_with_stdio(bool __sync = true);
+
+ // Locales:
+ locale
+ imbue(const locale& __loc);
+
+ inline locale
+ getloc() const { return _M_locale_ios; }
+
+ // Storage:
+ static int
+ xalloc() throw();
+
+ inline long&
+ iword(int __ix)
+ {
+ _Words& __word = (__ix < _M_word_limit)
+ ? _M_words[__ix] : _M_grow_words(__ix);
+ return __word._M_iword;
+ }
+
+ inline void*&
+ pword(int __ix)
+ {
+ _Words& __word = (__ix < _M_word_limit)
+ ? _M_words[__ix] : _M_grow_words(__ix);
+ return __word._M_pword;
+ }
+
+ // Destructor
+ ~ios_base();
+
+ protected:
+ ios_base();
+
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ private:
+ ios_base(const ios_base&);
+
+ ios_base&
+ operator=(const ios_base&);
+#endif
+ };
+
+ // 27.4.5.1 fmtflags manipulators:
+ inline ios_base&
+ boolalpha(ios_base& __base)
+ {
+ __base.setf(ios_base::boolalpha);
+ return __base;
+ }
+
+ inline ios_base&
+ noboolalpha(ios_base& __base)
+ {
+ __base.unsetf(ios_base::boolalpha);
+ return __base;
+ }
+
+ inline ios_base&
+ showbase(ios_base& __base)
+ {
+ __base.setf(ios_base::showbase);
+ return __base;
+ }
+
+ inline ios_base&
+ noshowbase(ios_base& __base)
+ {
+ __base.unsetf(ios_base::showbase);
+ return __base;
+ }
+
+ inline ios_base&
+ showpoint(ios_base& __base)
+ {
+ __base.setf(ios_base::showpoint);
+ return __base;
+ }
+
+ inline ios_base&
+ noshowpoint(ios_base& __base)
+ {
+ __base.unsetf(ios_base::showpoint);
+ return __base;
+ }
+
+ inline ios_base&
+ showpos(ios_base& __base)
+ {
+ __base.setf(ios_base::showpos);
+ return __base;
+ }
+
+ inline ios_base&
+ noshowpos(ios_base& __base)
+ {
+ __base.unsetf(ios_base::showpos);
+ return __base;
+ }
+
+ inline ios_base&
+ skipws(ios_base& __base)
+ {
+ __base.setf(ios_base::skipws);
+ return __base;
+ }
+
+ inline ios_base&
+ noskipws(ios_base& __base)
+ {
+ __base.unsetf(ios_base::skipws);
+ return __base;
+ }
+
+ inline ios_base&
+ uppercase(ios_base& __base)
+ {
+ __base.setf(ios_base::uppercase);
+ return __base;
+ }
+
+ inline ios_base&
+ nouppercase(ios_base& __base)
+ {
+ __base.unsetf(ios_base::uppercase);
+ return __base;
+ }
+
+ inline ios_base&
+ unitbuf(ios_base& __base)
+ {
+ __base.setf(ios_base::unitbuf);
+ return __base;
+ }
+
+ inline ios_base&
+ nounitbuf(ios_base& __base)
+ {
+ __base.unsetf(ios_base::unitbuf);
+ return __base;
+ }
+
+ // 27.4.5.2 adjustfield anipulators:
+ inline ios_base&
+ internal(ios_base& __base)
+ {
+ __base.setf(ios_base::internal, ios_base::adjustfield);
+ return __base;
+ }
+
+ inline ios_base&
+ left(ios_base& __base)
+ {
+ __base.setf(ios_base::left, ios_base::adjustfield);
+ return __base;
+ }
+
+ inline ios_base&
+ right(ios_base& __base)
+ {
+ __base.setf(ios_base::right, ios_base::adjustfield);
+ return __base;
+ }
+
+ // 27.4.5.3 basefield anipulators:
+ inline ios_base&
+ dec(ios_base& __base)
+ {
+ __base.setf(ios_base::dec, ios_base::basefield);
+ return __base;
+ }
+
+ inline ios_base&
+ hex(ios_base& __base)
+ {
+ __base.setf(ios_base::hex, ios_base::basefield);
+ return __base;
+ }
+
+ inline ios_base&
+ oct(ios_base& __base)
+ {
+ __base.setf(ios_base::oct, ios_base::basefield);
+ return __base;
+ }
+
+ // 27.4.5.4 floatfield anipulators:
+ inline ios_base&
+ fixed(ios_base& __base)
+ {
+ __base.setf(ios_base::fixed, ios_base::floatfield);
+ return __base;
+ }
+
+ inline ios_base&
+ scientific(ios_base& __base)
+ {
+ __base.setf(ios_base::scientific, ios_base::floatfield);
+ return __base;
+ }
+
+} // namespace std
+
+#endif /* _CPP_BITS_IOSBASE_H */
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/istream.tcc b/libstdc++-v3/bits/istream.tcc
new file mode 100644
index 000000000000..71cc96147aec
--- /dev/null
+++ b/libstdc++-v3/bits/istream.tcc
@@ -0,0 +1,1216 @@
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.6.2 Output streams
+//
+
+#include <bits/std_locale.h>
+
+namespace std {
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>::sentry::
+ sentry(basic_istream<_CharT, _Traits>& __in, bool __noskipws)
+ {
+ if (__in.good())
+ {
+ if (__in.tie())
+ __in.tie()->flush();
+ if (!__noskipws && (__in.flags() & ios_base::skipws))
+ {
+ const __int_type __eof = traits_type::eof();
+ __int_type __c = __int_type(0);
+ __streambuf_type* __sb = __in.rdbuf();
+ const __ctype_type* __ctype = __in._M_get_fctype_ios();
+ bool __testsp = true;
+ bool __testeof = false;
+
+ while (!__testeof && __testsp)
+ {
+ __c = __sb->sbumpc();
+ __testeof = __c == __eof;
+ __testsp = __ctype->is(ctype_base::space, __c);
+ }
+
+ if (!__testeof && !__testsp)
+ __sb->sputbackc(__c);
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+//195. Should basic_istream::sentry's constructor ever set eofbit?
+ else
+ __in.setstate(ios_base::eofbit);
+#endif
+ }
+ }
+ _M_ok = __in.good();
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(__istream_type& (*__pf)(__istream_type&))
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ __pf(*this);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(__ios_type& (*__pf)(__ios_type&))
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ __pf(*this);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(ios_base& (*__pf)(ios_base&))
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ __pf(*this);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(bool& __n)
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ iostate __err = iostate(ios_base::goodbit);
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(short& __n)
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ iostate __err = iostate(ios_base::goodbit);
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(unsigned short& __n)
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ iostate __err = iostate(ios_base::goodbit);
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(int& __n)
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ iostate __err = iostate(ios_base::goodbit);
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(unsigned int& __n)
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ iostate __err = iostate(ios_base::goodbit);
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(long& __n)
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ iostate __err = iostate(ios_base::goodbit);
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(unsigned long& __n)
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ iostate __err = iostate(ios_base::goodbit);
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(long long& __n)
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ iostate __err = iostate(ios_base::goodbit);
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(unsigned long long& __n)
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ iostate __err = iostate(ios_base::goodbit);
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+#endif
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(float& __n)
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ iostate __err = iostate(ios_base::goodbit);
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(double& __n)
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ iostate __err = iostate(ios_base::goodbit);
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(long double& __n)
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ iostate __err = iostate(ios_base::goodbit);
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(void*& __n)
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ try {
+ iostate __err = iostate(ios_base::goodbit);
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(__streambuf_type* __sbout)
+ {
+ streamsize __xtrct = 0;
+ __streambuf_type* __sbin = this->rdbuf();
+ sentry __cerb(*this, false);
+ if (__sbout && __cerb)
+ __xtrct = _S_copy_streambufs(*this, __sbin, __sbout);
+ if (!__sbout || !__xtrct)
+ this->setstate(ios_base::failbit);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>::int_type
+ basic_istream<_CharT, _Traits>::
+ get(void)
+ {
+ const int_type __eof = traits_type::eof();
+ int_type __c = __eof;
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ try {
+ __c = this->rdbuf()->sbumpc();
+ // 27.6.1.1 paragraph 3
+ if (__c != __eof)
+ _M_gcount = 1;
+ else
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+ }
+ catch(exception& __fail){
+ // 27.6.1.3 paragraph 1
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return __c;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ get(char_type& __c)
+ {
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ const int_type __eof = traits_type::eof();
+ int_type __bufval;
+ try {
+ __bufval = this->rdbuf()->sbumpc();
+ // 27.6.1.1 paragraph 3
+ if (__bufval != __eof)
+ {
+ _M_gcount = 1;
+ __c = traits_type::to_char_type(__bufval);
+ }
+ else
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+ }
+ catch(exception& __fail){
+ // 27.6.1.3 paragraph 1
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ get(char_type* __s, streamsize __n, char_type __delim)
+ {
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb && __n > 1)
+ {
+ try {
+ int_type __idelim = traits_type::to_int_type(__delim);
+ __streambuf_type* __sb = this->rdbuf();
+ int_type __c = __sb->sbumpc();
+ const int_type __eof = traits_type::eof();
+ bool __testdelim = __c == __idelim;
+ bool __testeof = __c == __eof;
+
+ while (_M_gcount < __n - 1 && !__testeof && !__testdelim)
+ {
+ *__s++ = traits_type::to_char_type(__c);
+ ++_M_gcount;
+ __c = __sb->sbumpc();
+ __testeof = __c == __eof;
+ __testdelim = __c == __idelim;
+ }
+ if (__testdelim || _M_gcount == __n - 1)
+ __sb->sputbackc(__c);
+ if (__testeof)
+ this->setstate(ios_base::eofbit);
+ }
+ catch(exception& __fail){
+ // 27.6.1.3 paragraph 1
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ *__s = char_type(NULL);
+ if (!_M_gcount)
+ this->setstate(ios_base::failbit);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ get(__streambuf_type& __sb, char_type __delim)
+ {
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ __streambuf_type* __this_sb = this->rdbuf();
+ int_type __c;
+ try {
+ int_type __idelim = traits_type::to_int_type(__delim);
+ __c = __this_sb->sbumpc();
+ const int_type __eof = traits_type::eof();
+ bool __testdelim = __c == __idelim;
+ bool __testeof = __c == __eof;
+ bool __testput = true;
+ streamsize __n = __this_sb->in_avail();
+
+ while (_M_gcount <= __n
+ && !__testeof
+ && !__testdelim
+ && (__testput = __sb.sputc(traits_type::to_char_type(__c))
+ != __eof))
+ {
+ ++_M_gcount;
+ __c = __this_sb->sbumpc();
+ __testeof = __c == __eof;
+ __testdelim = __c == __idelim;
+ }
+ if (__testdelim || !__testput)
+ __this_sb->sputbackc(traits_type::to_char_type(__c));
+ if (__testeof)
+ this->setstate(ios_base::eofbit);
+ }
+ catch(exception& __fail){
+ // Exception may result from sputc->overflow.
+ __this_sb->sputbackc(traits_type::to_char_type(__c));
+ }
+ }
+ if (!_M_gcount)
+ this->setstate(ios_base::failbit);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ getline(char_type* __s, streamsize __n, char_type __delim)
+ {
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ try {
+ int_type __idelim = traits_type::to_int_type(__delim);
+ __streambuf_type* __sb = this->rdbuf();
+ int_type __c = __sb->sbumpc();
+ const int_type __eof = traits_type::eof();
+ bool __testdelim = __c == __idelim;
+ bool __testeof = __c == __eof;
+
+ while (_M_gcount < __n - 1 && !__testeof && !__testdelim)
+ {
+ *__s++ = traits_type::to_char_type(__c);
+ ++_M_gcount;
+ __c = __sb->sbumpc();
+ __testeof = __c == __eof;
+ __testdelim = __c == __idelim;
+ }
+ if (_M_gcount == __n - 1 && !__testeof && !__testdelim)
+ {
+ __sb->sputbackc(traits_type::to_char_type(__c));
+ this->setstate(ios_base::failbit);
+ }
+ if (__testdelim)
+ ++_M_gcount;
+ if (__testeof)
+ this->setstate(ios_base::eofbit);
+ }
+ catch(exception& __fail){
+ // 27.6.1.3 paragraph 1
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ *__s = char_type(NULL);
+ if (!_M_gcount || _M_gcount == __n - 1)
+ this->setstate(ios_base::failbit);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ ignore(streamsize __n, int_type __delim)
+ {
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb && __n > 0)
+ {
+ try {
+ int_type __idelim = traits_type::to_int_type(__delim);
+ __streambuf_type* __sb = this->rdbuf();
+ int_type __c = __sb->sbumpc();
+ const int_type __eof = traits_type::eof();
+ bool __testdelim = __c == __idelim;
+ bool __testeof = __c == __eof;
+
+ __n = min(__n, numeric_limits<streamsize>::max());
+ while (_M_gcount < __n - 1 && !__testeof && !__testdelim)
+ {
+ ++_M_gcount;
+ __c = __sb->sbumpc();
+ __testeof = __c == __eof;
+ __testdelim = __c == __idelim;
+ }
+ if ((_M_gcount == __n - 1 && !__testeof) || __testdelim)
+ ++_M_gcount;
+ if (__testeof)
+ this->setstate(ios_base::eofbit);
+ }
+ catch(exception& __fail){
+ // 27.6.1.3 paragraph 1
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>::int_type
+ basic_istream<_CharT, _Traits>::
+ peek(void)
+ {
+ int_type __c = traits_type::eof();
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ try {
+ __c = this->rdbuf()->sgetc();
+ }
+ catch(exception& __fail){
+ // 27.6.1.3 paragraph 1
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return __c;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ read(char_type* __s, streamsize __n)
+ {
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ if (__n > 0)
+ {
+ try {
+ __streambuf_type* __sb = this->rdbuf();
+ int_type __c = __sb->sbumpc();
+ const int_type __eof = traits_type::eof();
+ bool __testeof = __c == __eof;
+
+ while (_M_gcount < __n - 1 && !__testeof)
+ {
+ *__s++ = traits_type::to_char_type(__c);
+ ++_M_gcount;
+ __c = __sb->sbumpc();
+ __testeof = __c == __eof;
+ }
+ if (__testeof)
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+ else
+ {
+ // _M_gcount == __n - 1
+ *__s++ = traits_type::to_char_type(__c);
+ ++_M_gcount;
+ }
+ }
+ catch(exception& __fail){
+ // 27.6.1.3 paragraph 1
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ }
+ else
+ this->setstate(ios_base::failbit);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ streamsize
+ basic_istream<_CharT, _Traits>::
+ readsome(char_type* __s, streamsize __n)
+ {
+ const int_type __eof = traits_type::eof();
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ if (__n > 0)
+ {
+ try {
+ streamsize __num = this->rdbuf()->in_avail();
+ if (__num != static_cast<streamsize>(__eof))
+ {
+ __num = min(__num, __n);
+ _M_gcount = this->rdbuf()->sgetn(__s, __num);
+ }
+ else
+ this->setstate(ios_base::eofbit);
+ }
+
+ catch(exception& __fail){
+ // 27.6.1.3 paragraph 1
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ }
+ else
+ this->setstate(ios_base::failbit);
+ return _M_gcount;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ putback(char_type __c)
+ {
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ try {
+ const int_type __eof = traits_type::eof();
+ __streambuf_type* __sb = this->rdbuf();
+ if (!__sb || __sb->sputbackc(__c) == __eof)
+ this->setstate(ios_base::badbit);
+ }
+ catch(exception& __fail){
+ // 27.6.1.3 paragraph 1
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ else
+ this->setstate(ios_base::failbit);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ unget(void)
+ {
+ const int_type __eof = traits_type::eof();
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ try {
+ __streambuf_type* __sb = this->rdbuf();
+ if (!__sb || __eof == __sb->sungetc())
+ this->setstate(ios_base::badbit);
+ }
+ catch(exception& __fail){
+ // 27.6.1.3 paragraph 1
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ else
+ this->setstate(ios_base::failbit);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ int
+ basic_istream<_CharT, _Traits>::
+ sync(void)
+ {
+ int __retval = traits_type::eof();
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ try {
+ __streambuf_type* __sb = this->rdbuf();
+ if (!__sb || __retval == __sb->pubsync())
+ this->setstate(ios_base::badbit);
+ else
+ __retval = 0;
+ }
+ catch(exception& __fail){
+ // 27.6.1.3 paragraph 1
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return __retval;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_istream<_CharT, _Traits>::pos_type
+ basic_istream<_CharT, _Traits>::
+ tellg(void)
+ {
+ pos_type __retval = pos_type(-1);
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ try {
+ __retval = this->rdbuf()->pubseekoff(0, ios_base::cur,
+ ios_base::in);
+ }
+ catch(exception& __fail){
+ // 27.6.1.3 paragraph 1
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return __retval;
+ }
+
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ seekg(pos_type __pos)
+ {
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ try {
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+// 136. seekp, seekg setting wrong streams?
+ this->rdbuf()->pubseekpos(__pos, ios_base::in);
+#endif
+ }
+ catch(exception& __fail){
+ // 27.6.1.3 paragraph 1
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ seekg(off_type __off, ios_base::seekdir __dir)
+ {
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ try {
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+// 136. seekp, seekg setting wrong streams?
+ this->rdbuf()->pubseekoff(__off, __dir, ios_base::in);
+#endif
+ }
+ catch(exception& __fail){
+ // 27.6.1.3 paragraph 1
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ // 27.6.1.2.3 Character extraction templates
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
+ {
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ __istream_type::sentry __cerb(__in, false);
+ if (__cerb)
+ {
+ try {
+ __in.get(__c);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ __in.setstate(ios_base::badbit);
+ if ((__in.exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ else
+ __in.setstate(ios_base::failbit);
+ return __in;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
+ {
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::__streambuf_type __streambuf_type;
+ typedef typename _Traits::int_type int_type;
+ typedef _CharT char_type;
+ typedef ctype<_CharT> __ctype_type;
+ int_type __extracted = 0;
+
+ __istream_type::sentry __cerb(__in, false);
+ if (__cerb)
+ {
+ try {
+ // Figure out how many characters to extract.
+ int_type __num = static_cast<int_type>(__in.width());
+ if (__num <= 0)
+ __num = basic_string<_CharT, _Traits>::npos;
+
+ __streambuf_type* __sb = __in.rdbuf();
+ const __ctype_type* __ctype = __in._M_get_fctype_ios();
+ int_type __c = __sb->sbumpc();
+ const int_type __eof = _Traits::eof();
+ bool __testsp = __ctype->is(ctype_base::space, __c);
+ bool __testeof = __c == __eof;
+
+ while (__extracted < __num - 1 && !__testeof && !__testsp)
+ {
+ *__s++ = __c;
+ ++__extracted;
+ __c = __sb->sbumpc();
+ __testeof = __c == __eof;
+ __testsp = __ctype->is(ctype_base::space, __c);
+ }
+
+ if (!__testeof)
+ __sb->sputbackc(__c);
+ else
+ __in.setstate(ios_base::eofbit);
+
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+//68. Extractors for char* should store null at end
+ *__s = char_type();
+#endif
+ __in.width(0);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ __in.setstate(ios_base::badbit);
+ if ((__in.exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ if (!__extracted)
+ __in.setstate(ios_base::failbit);
+ return __in;
+ }
+
+ // 27.6.1.4 Standard basic_istream manipulators
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT,_Traits>&
+ ws(basic_istream<_CharT,_Traits>& __in)
+ {
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::__streambuf_type __streambuf_type;
+ typedef typename __istream_type::__ctype_type __ctype_type;
+ typedef typename __istream_type::int_type __int_type;
+ typedef typename __istream_type::char_type __char_type;
+
+ __streambuf_type* __sb = __in.rdbuf();
+ const __ctype_type* __ctype = __in._M_get_fctype_ios();
+ const __int_type __eof = _Traits::eof();
+ __int_type __c;
+ bool __testeof;
+ bool __testsp;
+
+ do
+ {
+ __c = __sb->sbumpc();
+ __testeof = __c == __eof;
+ __testsp = __ctype->is(ctype_base::space, __c);
+ }
+ while (!__testeof && __testsp);
+
+ if (!__testeof && !__testsp)
+ __sb->sputbackc(__c);
+ else
+ __in.setstate(ios_base::eofbit);
+
+ return __in;
+ }
+
+ // 21.3.7.8 basic_string::getline and operators
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __in,
+ basic_string<_CharT, _Traits, _Alloc>& __str)
+ {
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::int_type __int_type;
+ typedef typename __istream_type::__streambuf_type __streambuf_type;
+ typedef typename __istream_type::__ctype_type __ctype_type;
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ typedef typename __string_type::size_type __size_type;
+ __int_type __extracted = 0;
+
+ __istream_type::sentry __cerb(__in, false);
+ if (__cerb)
+ {
+ __str.erase();
+ streamsize __w = __in.width();
+ __size_type __n;
+ __n = __w > 0 ? static_cast<__size_type>(__w) : __str.max_size();
+
+ __streambuf_type* __sb = __in.rdbuf();
+ const __ctype_type* __ctype = __in._M_get_fctype_ios();
+ __int_type __c = __sb->sbumpc();
+ const __int_type __eof = _Traits::eof();
+ bool __testsp = __ctype->is(ctype_base::space, __c);
+ bool __testeof = __c == __eof;
+
+ while (__extracted <= __n && !__testeof && !__testsp)
+ {
+ __str += _Traits::to_char_type(__c);
+ ++__extracted;
+ __c = __sb->sbumpc();
+ __testeof = __c == __eof;
+ __testsp = __ctype->is(ctype_base::space, __c);
+ }
+ if (!__testeof)
+ __sb->sputbackc(__c);
+ else
+ __in.setstate(ios_base::eofbit);
+ __in.width(0);
+ }
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+// 2000-02-01 Number to be determined
+ if (!__extracted)
+ __in.setstate (ios_base::failbit);
+#endif
+ return __in;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_istream<_CharT, _Traits>&
+ getline(basic_istream<_CharT, _Traits>& __in,
+ basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim)
+ {
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::int_type __int_type;
+ typedef typename __istream_type::__streambuf_type __streambuf_type;
+ typedef typename __istream_type::__ctype_type __ctype_type;
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ typedef typename __string_type::size_type __size_type;
+
+ __size_type __extracted = 0;
+ bool __testdelim = false;
+ __istream_type::sentry __cerb(__in, true);
+ if (__cerb)
+ {
+ __str.erase();
+ __size_type __n = __str.max_size();
+
+ __int_type __idelim = _Traits::to_int_type(__delim);
+ __streambuf_type* __sb = __in.rdbuf();
+ __int_type __c = __sb->sbumpc();
+ const __int_type __eof = _Traits::eof();
+ __testdelim = __c == __idelim;
+ bool __testeof = __c == __eof;
+
+ while (__extracted <= __n && !__testeof && !__testdelim)
+ {
+ __str += _Traits::to_char_type(__c);
+ ++__extracted;
+ __c = __sb->sbumpc();
+ __testeof = __c == __eof;
+ __testdelim = __c == __idelim;
+ }
+ if (__testeof)
+ __in.setstate(ios_base::eofbit);
+ }
+ if (!__extracted && !__testdelim)
+ __in.setstate(ios_base::failbit);
+ return __in;
+ }
+
+ template<class _CharT, class _Traits, class _Alloc>
+ inline basic_istream<_CharT,_Traits>&
+ getline(basic_istream<_CharT, _Traits>& __in,
+ basic_string<_CharT,_Traits,_Alloc>& __str)
+ { return getline(__in, __str, __in.widen('\n')); }
+
+} // namespace std
+
+// Local Variables:
+// mode:C++
+// End:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/limits_generic.h b/libstdc++-v3/bits/limits_generic.h
new file mode 100644
index 000000000000..4538e210a478
--- /dev/null
+++ b/libstdc++-v3/bits/limits_generic.h
@@ -0,0 +1,786 @@
+// The template and inlines for the -*- C++ -*- numeric_limits classes.
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Note: this is not a conforming implementation.
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
+
+//
+// ISO 14882:1998
+// 18.2.1
+//
+
+#ifndef _CPP_NUMERIC_LIMITS
+#define _CPP_NUMERIC_LIMITS 1
+
+#include <bits/c++config.h>
+#include <bits/std_cfloat.h>
+#include <bits/std_climits.h>
+#if defined( _GLIBCPP_USE_WCHAR_T) && defined(_GLIBCPP_HAS_WCHAR_MIN_MAX)
+#include <bits/std_cwchar.h>
+#endif
+
+namespace std {
+
+ enum float_round_style {
+ round_indeterminate = -1,
+ round_toward_zero = 0,
+ round_to_nearest = 1,
+ round_toward_infinity = 2,
+ round_toward_neg_infinity = 3
+ };
+
+ enum float_denorm_style {
+ denorm_indeterminate = -1,
+ denorm_absent = 0,
+ denorm_present = 1
+ };
+
+ template<typename _T> struct numeric_limits {
+ static const bool is_specialized = false;
+
+ static _T min() throw() { return static_cast<_T>(0); }
+ static _T max() throw() { return static_cast<_T>(0); }
+
+ static const int digits = 0;
+ static const int digits10 = 0;
+ static const bool is_signed = false;
+ static const bool is_integer = false;
+ static const bool is_exact = false;
+ static const int radix = 0;
+
+ static _T epsilon() throw() { return static_cast<_T>(0); }
+ static _T round_error() throw() { return static_cast<_T>(0); }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static _T infinity() throw() { return static_cast<_T>(0); }
+ static _T quiet_NaN() throw() { return static_cast<_T>(0); }
+ static _T signaling_NaN() throw() { return static_cast<_T>(0); }
+ static _T denorm_min() throw() { return static_cast<_T>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = false;
+ static const bool is_modulo = false;
+
+ static const bool traps = false;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ template<typename _T> _T __limits_infinity();
+ template<typename _T> _T __limits_quiet_NaN();
+ template<typename _T> _T __limits_signaling_NaN();
+ template<typename _T> _T __limits_denorm_min();
+
+ template<> struct numeric_limits<bool> {
+ static const bool is_specialized = true;
+
+ static bool min() throw()
+ { return false; }
+ static bool max() throw()
+ { return true; }
+
+ static const int digits = 8;
+ static const int digits10 = 2;
+ static const bool is_signed = false;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static bool epsilon() throw()
+ { return 0; }
+ static bool round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static bool infinity() throw()
+ { return static_cast<bool>(0); }
+ static bool quiet_NaN() throw()
+ { return static_cast<bool>(0); }
+ static bool signaling_NaN() throw()
+ { return static_cast<bool>(0); }
+ static bool denorm_min() throw()
+ { return static_cast<bool>(0); }
+
+ static const bool is_iec559 = true;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = false;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ template<> struct numeric_limits<char> {
+ static const bool is_specialized = true;
+
+ static char min() throw()
+ { return CHAR_MIN; }
+ static char max() throw()
+ { return CHAR_MAX; }
+
+ static const int digits = 7;
+ static const int digits10 = 2;
+ static const bool is_signed = true;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static char epsilon() throw()
+ { return 0; }
+ static char round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static char infinity() throw()
+ { return static_cast<char>(0); }
+ static char quiet_NaN() throw()
+ { return static_cast<char>(0); }
+ static char signaling_NaN() throw()
+ { return static_cast<char>(0); }
+ static char denorm_min() throw()
+ { return static_cast<char>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = false;
+
+ static const bool traps = false;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ template<> struct numeric_limits<signed char> {
+ static const bool is_specialized = true;
+
+ static signed char min() throw()
+ { return SCHAR_MIN; }
+ static signed char max() throw()
+ { return SCHAR_MAX; }
+
+ static const int digits = 7;
+ static const int digits10 = 2;
+ static const bool is_signed = true;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static signed char epsilon() throw()
+ { return 0; }
+ static signed char round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static signed char infinity() throw()
+ { return static_cast<signed char>(0); }
+ static signed char quiet_NaN() throw()
+ { return static_cast<signed char>(0); }
+ static signed char signaling_NaN() throw()
+ { return static_cast<signed char>(0); }
+ static signed char denorm_min() throw()
+ { return static_cast<signed char>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = false;
+
+ static const bool traps = false;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ template<> struct numeric_limits<unsigned char> {
+ static const bool is_specialized = true;
+
+ static unsigned char min() throw()
+ { return 0; }
+ static unsigned char max() throw()
+ { return UCHAR_MAX; }
+
+ static const int digits = 8;
+ static const int digits10 = 2;
+ static const bool is_signed = false;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static unsigned char epsilon() throw()
+ { return 0; }
+ static unsigned char round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static unsigned char infinity() throw()
+ { return static_cast<unsigned char>(0); }
+ static unsigned char quiet_NaN() throw()
+ { return static_cast<unsigned char>(0); }
+ static unsigned char signaling_NaN() throw()
+ { return static_cast<unsigned char>(0); }
+ static unsigned char denorm_min() throw()
+ { return static_cast<unsigned char>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = true;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+#if defined( _GLIBCPP_USE_WCHAR_T) && defined(_GLIBCPP_HAS_WCHAR_MIN_MAX)
+ template<> struct numeric_limits<wchar_t> {
+ static const bool is_specialized = true;
+
+ static wchar_t min() throw()
+ { return WCHART_MIN; }
+ static wchar_t max() throw()
+ { return WCHART_MAX; }
+
+ static const int digits = 31;
+ static const int digits10 = 9;
+ static const bool is_signed = true;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static wchar_t epsilon() throw()
+ { return 0; }
+ static wchar_t round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static wchar_t infinity() throw()
+ { return static_cast<wchar_t>(0); }
+ static wchar_t quiet_NaN() throw()
+ { return static_cast<wchar_t>(0); }
+ static wchar_t signaling_NaN() throw()
+ { return static_cast<wchar_t>(0); }
+ static wchar_t denorm_min() throw()
+ { return static_cast<wchar_t>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = false;
+
+ static const bool traps = false;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+#endif
+
+ template<> struct numeric_limits<short> {
+ static const bool is_specialized = true;
+
+ static short min() throw()
+ { return SHRT_MIN; }
+ static short max() throw()
+ { return SHRT_MAX; }
+
+ static const int digits = 15;
+ static const int digits10 = 4;
+ static const bool is_signed = true;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static short epsilon() throw()
+ { return 0; }
+ static short round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static short infinity() throw()
+ { return static_cast<short>(0); }
+ static short quiet_NaN() throw()
+ { return static_cast<short>(0); }
+ static short signaling_NaN() throw()
+ { return static_cast<short>(0); }
+ static short denorm_min() throw()
+ { return static_cast<short>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = false;
+
+ static const bool traps = false;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ template<> struct numeric_limits<unsigned short> {
+ static const bool is_specialized = true;
+
+ static unsigned short min() throw()
+ { return 0; }
+ static unsigned short max() throw()
+ { return USHRT_MAX; }
+
+ static const int digits = 16;
+ static const int digits10 = 4;
+ static const bool is_signed = false;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static unsigned short epsilon() throw()
+ { return 0; }
+ static unsigned short round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static unsigned short infinity() throw()
+ { return static_cast<unsigned short>(0); }
+ static unsigned short quiet_NaN() throw()
+ { return static_cast<unsigned short>(0); }
+ static unsigned short signaling_NaN() throw()
+ { return static_cast<unsigned short>(0); }
+ static unsigned short denorm_min() throw()
+ { return static_cast<unsigned short>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = true;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ template<> struct numeric_limits<int> {
+ static const bool is_specialized = true;
+
+ static int min() throw()
+ { return INT_MIN; }
+ static int max() throw()
+ { return INT_MAX; }
+
+ static const int digits = 31;
+ static const int digits10 = 9;
+ static const bool is_signed = true;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static int epsilon() throw()
+ { return 0; }
+ static int round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static int infinity() throw()
+ { return static_cast<int>(0); }
+ static int quiet_NaN() throw()
+ { return static_cast<int>(0); }
+ static int signaling_NaN() throw()
+ { return static_cast<int>(0); }
+ static int denorm_min() throw()
+ { return static_cast<int>(0); }
+
+ static const bool is_iec559 = true;
+ static const bool is_bounded = true;
+ static const bool is_modulo = false;
+
+ static const bool traps = false;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ template<> struct numeric_limits<unsigned int> {
+ static const bool is_specialized = true;
+
+ static unsigned int min() throw()
+ { return 0; }
+ static unsigned int max() throw()
+ { return UINT_MAX; }
+
+ static const int digits = 32;
+ static const int digits10 = 9;
+ static const bool is_signed = false;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static unsigned int epsilon() throw()
+ { return 0; }
+ static unsigned int round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static unsigned int infinity() throw()
+ { return static_cast<unsigned int>(0); }
+ static unsigned int quiet_NaN() throw()
+ { return static_cast<unsigned int>(0); }
+ static unsigned int signaling_NaN() throw()
+ { return static_cast<unsigned int>(0); }
+ static unsigned int denorm_min() throw()
+ { return static_cast<unsigned int>(0); }
+
+ static const bool is_iec559 = true;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = true;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ template<> struct numeric_limits<long> {
+ static const bool is_specialized = true;
+
+ static long min() throw()
+ { return LONG_MIN; }
+ static long max() throw()
+ { return LONG_MAX; }
+
+ static const int digits = 31;
+ static const int digits10 = 9;
+ static const bool is_signed = true;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static long epsilon() throw()
+ { return 0; }
+ static long round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static long infinity() throw()
+ { return static_cast<long>(0); }
+ static long quiet_NaN() throw()
+ { return static_cast<long>(0); }
+ static long signaling_NaN() throw()
+ { return static_cast<long>(0); }
+ static long denorm_min() throw()
+ { return static_cast<long>(0); }
+
+ static const bool is_iec559 = true;
+ static const bool is_bounded = true;
+ static const bool is_modulo = false;
+
+ static const bool traps = false;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ template<> struct numeric_limits<unsigned long> {
+ static const bool is_specialized = true;
+
+ static unsigned long min() throw()
+ { return 0; }
+ static unsigned long max() throw()
+ { return ULONG_MAX; }
+
+ static const int digits = 32;
+ static const int digits10 = 9;
+ static const bool is_signed = false;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static unsigned long epsilon() throw()
+ { return 0; }
+ static unsigned long round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static unsigned long infinity() throw()
+ { return static_cast<unsigned long>(0); }
+ static unsigned long quiet_NaN() throw()
+ { return static_cast<unsigned long>(0); }
+ static unsigned long signaling_NaN() throw()
+ { return static_cast<unsigned long>(0); }
+ static unsigned long denorm_min() throw()
+ { return static_cast<unsigned long>(0); }
+
+ static const bool is_iec559 = true;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = true;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ template<> struct numeric_limits<float> {
+ static const bool is_specialized = true;
+
+ static float min() throw()
+ { return FLT_MIN; }
+ static float max() throw()
+ { return FLT_MAX; }
+
+ static const int digits = FLT_MANT_DIG;
+ static const int digits10 = FLT_DIG;
+ static const bool is_signed = true;
+ static const bool is_integer = false;
+ static const bool is_exact = false;
+ static const int radix = FLT_RADIX;
+ static float epsilon() throw()
+ { return FLT_EPSILON; }
+ static float round_error() throw()
+ { return FLT_ROUNDS; }
+
+ static const int min_exponent = FLT_MIN_EXP;
+ static const int min_exponent10 = FLT_MIN_10_EXP;
+ static const int max_exponent = FLT_MAX_EXP;
+ static const int max_exponent10 = FLT_MAX_10_EXP;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static float infinity() throw()
+ { return static_cast<float>(0); }
+ static float quiet_NaN() throw()
+ { return static_cast<float>(0); }
+ static float signaling_NaN() throw()
+ { return static_cast<float>(0); }
+ static float denorm_min() throw()
+ { return static_cast<float>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = false;
+
+ static const bool traps = false;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ template<> struct numeric_limits<double> {
+ static const bool is_specialized = true;
+
+ static double min() throw()
+ { return DBL_MIN; }
+ static double max() throw()
+ { return DBL_MAX; }
+
+ static const int digits = DBL_MANT_DIG;
+ static const int digits10 = DBL_DIG;
+ static const bool is_signed = true;
+ static const bool is_integer = false;
+ static const bool is_exact = false;
+ static const int radix = 2;
+ static double epsilon() throw()
+ { return DBL_EPSILON; }
+ static double round_error() throw()
+ { return 1.0; }
+
+ static const int min_exponent = DBL_MIN_EXP;
+ static const int min_exponent10 = DBL_MIN_10_EXP;
+ static const int max_exponent = DBL_MAX_EXP;
+ static const int max_exponent10 = DBL_MAX_10_EXP;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static double infinity() throw()
+ { return static_cast<double>(0); }
+ static double quiet_NaN() throw()
+ { return static_cast<double>(0); }
+ static double signaling_NaN() throw()
+ { return static_cast<double>(0); }
+ static double denorm_min() throw()
+ { return static_cast<double>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = false;
+
+ static const bool traps = false;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ template<> struct numeric_limits<long double> {
+ static const bool is_specialized = true;
+
+ static double min() throw()
+ { return LDBL_MIN; }
+ static double max() throw()
+ { return LDBL_MAX; }
+
+ static const int digits = LDBL_MANT_DIG;
+ static const int digits10 = LDBL_DIG;
+ static const bool is_signed = true;
+ static const bool is_integer = false;
+ static const bool is_exact = false;
+ static const int radix = 2;
+ static double epsilon() throw()
+ { return LDBL_EPSILON; }
+ static double round_error() throw()
+ { return 1.0L; }
+
+ static const int min_exponent = LDBL_MIN_EXP;
+ static const int min_exponent10 = LDBL_MIN_10_EXP;
+ static const int max_exponent = LDBL_MAX_EXP;
+ static const int max_exponent10 = LDBL_MAX_10_EXP;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static double infinity() throw()
+ { return static_cast<double>(0); }
+ static double quiet_NaN() throw()
+ { return static_cast<double>(0); }
+ static double signaling_NaN() throw()
+ { return static_cast<double>(0); }
+ static double denorm_min() throw()
+ { return static_cast<double>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = false;
+
+ static const bool traps = false;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+} // namespace std
+
+#endif // _CPP_NUMERIC_LIMITS
diff --git a/libstdc++-v3/bits/locale_facets.h b/libstdc++-v3/bits/locale_facets.h
new file mode 100644
index 000000000000..ec40d0f31ca9
--- /dev/null
+++ b/libstdc++-v3/bits/locale_facets.h
@@ -0,0 +1,1935 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Warning: this file is not meant for user inclusion. Use <locale>.
+
+#ifndef _CPP_BITS_LOCFACETS_H
+#define _CPP_BITS_LOCFACETS_H 1
+
+#include <bits/std_ctime.h> // For struct tm
+#include <bits/std_typeinfo.h> // For bad_cast, which shouldn't be here.
+#include <bits/std_ios.h> // For ios_base
+
+namespace std
+{
+
+ // XXX This function is to be specialized for the "required" facets to
+ // be constructed lazily. The specializations must be declared after
+ // the definitions of the facets themselves; but they shouldn't be
+ // inline. Corresponding new's in locale::classic() should then be
+ // eliminated. Note that ctype<> should not get this treatment;
+ // see the use_facet<> specializations below.
+ //
+ struct _Bad_use_facet : public bad_cast
+ {
+ _Bad_use_facet() throw() {}
+
+ _Bad_use_facet(_Bad_use_facet const& __b) throw()
+ : bad_cast(__b) { }
+
+ _Bad_use_facet&
+ operator=(_Bad_use_facet const& __b) throw()
+ {
+ static_cast<bad_cast*>(this)->operator=(__b);
+ return *this;
+ }
+
+ virtual char const*
+ what() const throw();
+
+ virtual
+ ~_Bad_use_facet() throw();
+ };
+
+ template<typename _Facet>
+ const _Facet&
+ _Use_facet_failure_handler(const locale&)
+ { throw _Bad_use_facet(); }
+
+ // 22.2.1 The ctype category
+ // Include host-specific ctype enums for ctype_base.
+ #include <bits/ctype_base.h>
+
+ // 22.2.1.1 Template class ctype
+ // _Ctype_nois is the common base for ctype<char>. It lacks "do_is"
+ // and related virtuals. These are filled in by _Ctype, below.
+ template<typename _CharT>
+ class _Ctype_nois : public locale::facet, public ctype_base
+ {
+ // Types:
+ typedef _CharT char_type;
+
+ public:
+ char_type
+ toupper(char_type __c) const
+ { return this->do_toupper(__c); }
+
+ const char_type*
+ toupper(char_type *__low, const char_type* __high) const
+ { return this->do_toupper(__low, __high); }
+
+ char_type
+ tolower(char_type __c) const
+ { return this->do_tolower(__c); }
+
+ const char_type*
+ tolower(char_type* __low, const char_type* __high) const
+ { return this->do_tolower(__low, __high); }
+
+ char_type
+ widen(char __c) const
+ { return this->do_widen(__c); }
+
+ const char*
+ widen(const char* __low, const char* __high, char_type* __to) const
+ { return this->do_widen(__low, __high, __to); }
+
+ char
+ narrow(char_type __c, char __dfault) const
+ { return this->do_narrow(__c, __dfault); }
+
+ const char_type*
+ narrow(const char_type* __low, const char_type* __high,
+ char __dfault, char *__to) const
+ { return this->do_narrow(__low, __high, __dfault, __to); }
+
+ protected:
+ explicit
+ _Ctype_nois(size_t __refs = 0): locale::facet(__refs) { }
+
+ virtual
+ ~_Ctype_nois() { }
+
+ virtual char_type
+ do_toupper(char_type) const = 0;
+
+ virtual const char_type*
+ do_toupper(char_type* __low, const char_type* __high) const = 0;
+
+ virtual char_type
+ do_tolower(char_type) const = 0;
+
+ virtual const char_type*
+ do_tolower(char_type* __low, const char_type* __high) const = 0;
+
+ virtual char_type
+ do_widen(char) const = 0;
+
+ virtual const char*
+ do_widen(const char* __low, const char* __high,
+ char_type* __dest) const = 0;
+
+ virtual char
+ do_narrow(char_type, char __dfault) const = 0;
+
+ virtual const char_type*
+ do_narrow(const char_type* __low, const char_type* __high,
+ char __dfault, char* __dest) const = 0;
+ };
+
+
+ template<typename _CharT>
+ class _Ctype : public _Ctype_nois<_CharT>
+ {
+ public:
+
+ // Types:
+ typedef _CharT char_type;
+ typedef typename _Ctype_nois<_CharT>::mask mask;
+
+ bool
+ is(mask __m, char_type __c) const
+ { return this->do_is(__m, __c); }
+
+ const char_type*
+ is(const char_type *__lo, const char_type *__hi, mask *__vec) const
+ { return this->do_is(__lo, __hi, __vec); }
+
+ const char_type*
+ scan_is(mask __m, const char_type* __lo, const char_type* __hi) const
+ { return this->do_scan_is(__m, __lo, __hi); }
+
+ const char_type*
+ scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
+ { return this->do_scan_not(__m, __lo, __hi); }
+
+ protected:
+ explicit
+ _Ctype(size_t __refs = 0) : _Ctype_nois<_CharT>(__refs) { }
+
+ virtual
+ ~_Ctype() { }
+
+ virtual bool
+ do_is(mask __m, char_type __c) const = 0;
+
+ virtual const char_type*
+ do_is(const char_type* __lo, const char_type* __hi,
+ mask* __vec) const = 0;
+
+ virtual const char_type*
+ do_scan_is(mask __m, const char_type* __lo,
+ const char_type* __hi) const = 0;
+
+ virtual const char_type*
+ do_scan_not(mask __m, const char_type* __lo,
+ const char_type* __hi) const = 0;
+ };
+
+ template<typename _CharT>
+ class ctype : public _Ctype<_CharT>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef typename ctype::mask mask;
+
+ explicit
+ ctype(size_t __refs = 0) : _Ctype<_CharT>(__refs) { }
+
+ static locale::id id;
+
+ protected:
+ virtual
+ ~ctype() { }
+
+ virtual bool
+ do_is(mask, char_type) const
+ {
+ // XXX Need definitions for these abstract mf's.
+ }
+
+ virtual const char_type*
+ do_is(const char_type*, const char_type*, mask*) const
+ {
+ // XXX Need definitions for these abstract mf's.
+ }
+
+ virtual const char_type*
+ do_scan_is(mask, const char_type*, const char_type*) const
+ {
+ // XXX Need definitions for these abstract mf's.
+ }
+
+ virtual const char_type*
+ do_scan_not(mask, const char_type*, const char_type*) const
+ {
+ // XXX Need definitions for these abstract mf's.
+ }
+
+ virtual char_type
+ do_toupper(char_type) const
+ {
+ // XXX Need definitions for these abstract mf's.
+ }
+
+ virtual const char_type*
+ do_toupper(char_type*, const char_type*) const
+ {
+ // XXX Need definitions for these abstract mf's.
+ }
+
+ virtual char_type
+ do_tolower(char_type) const
+ {
+ // XXX Need definitions for these abstract mf's.
+ }
+
+ virtual const char_type*
+ do_tolower(char_type*, const char_type*) const
+ {
+ // XXX Need definitions for these abstract mf's.
+ }
+
+ virtual char_type
+ do_widen(char) const
+ {
+ // XXX Need definitions for these abstract mf's.
+ }
+
+ virtual const char*
+ do_widen(const char*, const char*, char_type*) const
+ {
+ // XXX Need definitions for these abstract mf's.
+ }
+
+ virtual char
+ do_narrow(char_type, char) const
+ {
+ // XXX Need definitions for these abstract mf's.
+ }
+
+ virtual const char_type*
+ do_narrow(const char_type*, const char_type*, char, char*) const
+ {
+ // XXX Need definitions for these abstract mf's.
+ }
+ };
+
+
+ // 22.2.1.3 ctype specializations
+ // NB: Can use _Ctype_nois to actually implement the is
+ // functionality in the non-virtual (thus inline-able) member
+ // fuctions.
+ template<>
+ class ctype<char> : public _Ctype_nois<char>
+ {
+ public:
+ // Types:
+ typedef char char_type;
+ typedef ctype::mask mask;
+ typedef size_t __table_type;
+
+ private:
+ // Data Members:
+ bool _M_del;
+ __to_type const& _M_toupper;
+ __to_type const& _M_tolower;
+ const mask* const& _M_ctable;
+ const mask* _M_table;
+
+ public:
+ static locale::id id;
+ static const __table_type table_size = 1 +static_cast<unsigned char>(-1);
+
+ explicit
+ ctype(const mask* __table = 0, bool __del = false,
+ size_t __refs = 0) throw();
+
+ inline bool
+ is(mask __m, char __c) const throw();
+
+ inline const char*
+ is(const char* __low, const char* __high, mask* __vec) const throw();
+
+ inline const char*
+ scan_is(mask __m, const char* __low, const char* __high) const throw();
+
+ inline const char*
+ scan_not(mask __m, const char* __low, const char* __high) const throw();
+
+ protected:
+ virtual
+ ~ctype();
+
+ inline const mask*
+ table() const throw()
+ { return _M_table; }
+
+ inline const mask*
+ classic_table() throw()
+ { return _M_ctable; }
+
+ virtual char_type
+ do_toupper(char_type) const;
+
+ virtual const char_type*
+ do_toupper(char_type* __low, const char_type* __high) const;
+
+ virtual char_type
+ do_tolower(char_type) const;
+
+ virtual const char_type*
+ do_tolower(char_type* __low, const char_type* __high) const;
+
+ virtual char_type
+ do_widen(char) const;
+
+ virtual const char*
+ do_widen(const char* __low, const char* __high,
+ char_type* __dest) const;
+
+ virtual char
+ do_narrow(char_type, char __dfault) const;
+
+ virtual const char_type*
+ do_narrow(const char_type* __low, const char_type* __high,
+ char __dfault, char* __dest) const;
+ };
+
+ template<>
+ const ctype<char>&
+ use_facet<const ctype<char> > (const locale& __loc);
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ // ctype<wchar_t> specialization
+ template<>
+ class ctype<wchar_t> : public _Ctype<wchar_t>
+ {
+ public:
+ // Types:
+ typedef wchar_t char_type;
+ typedef ctype::mask mask;
+ typedef size_t __table_type;
+
+ private:
+ __to_type const& _M_toupper;
+ __to_type const& _M_tolower;
+ const mask* const& _M_ctable;
+ static const __table_type _S_table_size = ctype<char>::table_size;
+
+ public:
+ static locale::id id;
+
+ explicit
+ ctype(size_t __refs = 0) throw();
+
+ protected:
+ virtual
+ ~ctype();
+
+ virtual bool
+ do_is(mask __m, char_type __c) const;
+
+ virtual const char_type*
+ do_is(const char_type* __lo, const char_type* __hi,
+ mask* __vec) const;
+
+ virtual const char_type*
+ do_scan_is(mask __m, const char_type* __lo,
+ const char_type* __hi) const;
+
+ virtual const char_type*
+ do_scan_not(mask __m, const char_type* __lo,
+ const char_type* __hi) const;
+
+ virtual char_type
+ do_toupper(char_type) const;
+
+ virtual const char_type*
+ do_toupper(char_type* __low, const char_type* __high) const;
+
+ virtual char_type
+ do_tolower(char_type) const;
+
+ virtual const char_type*
+ do_tolower(char_type* __low, const char_type* __high) const;
+
+ virtual char_type
+ do_widen(char) const;
+
+ virtual const char*
+ do_widen(const char* __low, const char* __high,
+ char_type* __dest) const;
+
+ virtual char
+ do_narrow(char_type, char __dfault) const;
+
+ virtual const char_type*
+ do_narrow(const char_type* __low, const char_type* __high,
+ char __dfault, char* __dest) const;
+
+ };
+
+ template<>
+ const ctype<wchar_t>&
+ use_facet< const ctype<wchar_t> > (const locale& __loc);
+#endif //_GLIBCPP_USE_WCHAR_T
+
+ // Include host-specific ctype specializations.
+ #include <bits/ctype_specializations.h>
+
+ // 22.2.1.2 Template class ctype_byname
+ template<typename _CharT>
+ class ctype_byname : public ctype<_CharT>
+ {
+ public:
+ typedef _CharT char_type;
+
+ explicit
+ ctype_byname(const char*, size_t __refs = 0);
+
+ protected:
+ virtual
+ ~ctype_byname() { }
+ };
+
+ // 22.2.1.4 Class ctype_byname specializations
+ template<>
+ ctype_byname<char>::ctype_byname(const char*, size_t refs);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ ctype_byname<wchar_t>::ctype_byname(const char*, size_t refs);
+#endif
+
+
+ // 22.2.1.5 Template class codecvt
+ class codecvt_base
+ {
+ public:
+ enum result
+ {
+ ok,
+ partial,
+ error,
+ noconv
+ };
+ };
+
+ template<typename _InternT, typename _ExternT, typename _StateT>
+ class _Codecvt : public locale::facet, public codecvt_base
+ {
+ public:
+ // Types:
+ typedef _InternT intern_type;
+ typedef _ExternT extern_type;
+ typedef _StateT state_type;
+
+ protected:
+ explicit
+ _Codecvt (size_t __refs = 0) : locale::facet(__refs) { }
+
+ public:
+ result
+ out(state_type& __state, const intern_type* __from,
+ const intern_type* __from_end, const intern_type* &__from_next,
+ extern_type* __to, extern_type* __to_limit,
+ extern_type*& __to_next) const
+ {
+ return do_out(__state, __from, __from_end, __from_next, __to,
+ __to_limit, __to_next);
+ }
+
+ result
+ unshift(state_type& __state, extern_type* __to, extern_type* __to_limit,
+ extern_type*& __to_next) const
+ { return do_unshift(__state, __to,__to_limit,__to_next); }
+
+ result
+ in(state_type& __state, const extern_type* __from,
+ const extern_type* __from_end, const extern_type*& __from_next,
+ intern_type* __to, intern_type* __to_limit,
+ intern_type*& __to_next) const
+ {
+ return do_in(__state, __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ int
+ encoding() const throw()
+ { return do_encoding(); }
+
+ bool
+ always_noconv() const throw()
+ { return do_always_noconv(); }
+
+ int
+ length(const state_type& __state, const extern_type* __from,
+ const extern_type* __end, size_t __max) const
+ { return do_length(__state, __from, __end, __max); }
+
+ int
+ max_length() const throw()
+ { return do_max_length(); }
+
+ protected:
+ virtual
+ ~_Codecvt() { }
+
+ virtual result
+ do_out(state_type& __state,
+ const intern_type* __from, const intern_type* __from_end,
+ const intern_type*& __from_next,
+ extern_type* __to, extern_type* __to_limit,
+ extern_type*& __to_next) const = 0;
+
+ virtual result
+ do_unshift(state_type& __state,
+ extern_type* __to, extern_type* __to_limit,
+ extern_type*& __to_next) const = 0;
+
+ virtual result
+ do_in(state_type& __state,
+ const extern_type* __from, const extern_type* __from_end,
+ const extern_type*& __from_next,
+ intern_type* __to, intern_type* __to_limit,
+ intern_type*& __to_next) const = 0;
+
+ virtual int
+ do_encoding() const throw() = 0;
+
+ virtual bool
+ do_always_noconv() const throw() = 0;
+
+ virtual int
+ do_length(const state_type&, const extern_type* __from,
+ const extern_type* __end, size_t __max) const = 0;
+
+ virtual int
+ do_max_length() const throw() = 0;
+ };
+
+
+ template<typename _InternT, typename _ExternT, typename _StateT>
+ class codecvt : public _Codecvt<_InternT,_ExternT,_StateT>
+ {
+ public:
+ // Types:
+ typedef _InternT intern_type;
+ typedef _ExternT extern_type;
+ typedef _StateT state_type;
+
+ // Data Members:
+ static locale::id id;
+
+ explicit
+ codecvt(size_t __refs = 0)
+ : _Codecvt<_InternT,_ExternT,_StateT> (__refs) { }
+
+ protected:
+ virtual
+ ~codecvt() { }
+ };
+
+ // codecvt<char,char,mbstate_t> specialization
+ template<>
+ class codecvt<char, char, mbstate_t>
+ : public _Codecvt<char, char, mbstate_t>
+ {
+ public:
+ // Types:
+ typedef char intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ explicit codecvt (size_t __refs = 0);
+ static locale::id id;
+
+ protected:
+ virtual ~codecvt();
+ virtual result
+ do_out(state_type& __state, const intern_type* __from,
+ const intern_type* __from_end, const intern_type*& __from_next,
+ extern_type* __to, extern_type* __to_limit,
+ extern_type*& __to_next) const;
+
+ virtual result
+ do_unshift(state_type& __state, extern_type* __to,
+ extern_type* __to_limit, extern_type*& __to_next) const;
+
+ virtual result
+ do_in(state_type& __state, const extern_type* __from,
+ const extern_type* __from_end, const extern_type*& __from_next,
+ intern_type* __to, intern_type* __to_limit,
+ intern_type*& __to_next) const;
+
+ virtual int do_encoding() const throw();
+ virtual bool do_always_noconv() const throw();
+ virtual int do_length(const state_type&, const extern_type* __from,
+ const extern_type* __end, size_t __max) const;
+ virtual int do_max_length() const throw();
+ };
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ class codecvt<wchar_t,char,mbstate_t>
+ : public _Codecvt<wchar_t,char,mbstate_t>
+ {
+ public:
+ // Types:
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ explicit codecvt(size_t __refs = 0);
+ static locale::id id;
+
+ protected:
+ virtual ~codecvt();
+ virtual result
+ do_out(state_type& __state, const intern_type* __from,
+ const intern_type* __from_end, const intern_type*& __from_next,
+ extern_type* __to, extern_type* __to_limit,
+ extern_type*& __to_next) const;
+
+ virtual result
+ do_unshift(state_type& __state,
+ extern_type* __to, extern_type* __to_limit,
+ extern_type*& __to_next) const;
+
+ virtual result
+ do_in(state_type& __state,
+ const extern_type* __from, const extern_type* __from_end,
+ const extern_type*& __from_next,
+ intern_type* __to, intern_type* __to_limit,
+ intern_type*& __to_next) const;
+
+ virtual int do_encoding() const throw();
+ virtual bool do_always_noconv() const throw();
+ virtual int do_length(const state_type&, const extern_type* __from,
+ const extern_type* __end, size_t __max) const;
+ virtual int do_max_length() const throw();
+ };
+#endif //_GLIBCPP_USE_WCHAR_T
+
+
+ // 22.2.1.6 Template class codecvt_byname
+ template<typename _InternT, typename _ExternT, typename _StateT>
+ class codecvt_byname : public codecvt<_InternT,_ExternT,_StateT>
+ {
+ public:
+ explicit
+ codecvt_byname(const char*, size_t __refs = 0)
+ : codecvt<_InternT,_ExternT,_StateT> (__refs) { }
+ protected:
+ virtual
+ ~codecvt_byname() { }
+ };
+
+ template<>
+ class codecvt_byname<char,char,mbstate_t>
+ : public codecvt<char,char,mbstate_t>
+ {
+ public:
+ explicit
+ codecvt_byname(const char*, size_t __refs = 0);
+
+ protected:
+ virtual
+ ~codecvt_byname();
+ };
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ class codecvt_byname<wchar_t,char,mbstate_t>
+ : public codecvt<wchar_t,char,mbstate_t>
+ {
+ public:
+ explicit
+ codecvt_byname(const char*, size_t __refs = 0);
+
+ protected:
+ virtual
+ ~codecvt_byname();
+ };
+#endif
+
+ template<typename _CharT, typename _InIter>
+ class _Numeric_get; // forward
+
+ // _Format_cache holds the information extracted from the numpunct<>
+ // and moneypunct<> facets in a form optimized for parsing and
+ // formatting. It is stored via a void* pointer in the pword()
+ // array of an iosbase object passed to the _get and _put facets.
+ // NB: contains no user-serviceable parts.
+ template<typename _CharT>
+ class _Format_cache
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef char_traits<_CharT> traits_type;
+ typedef basic_string<_CharT> string_type;
+ typedef string_type::size_type size_type;
+
+ // Forward decls and Friends:
+ friend class locale;
+ template<typename _Char, typename _InIter>
+ friend class _Numeric_get;
+ friend class num_get<_CharT>;
+ friend class num_put<_CharT>;
+ friend class time_get<_CharT>;
+ friend class money_get<_CharT>;
+ friend class time_put<_CharT>;
+ friend class money_put<_CharT>;
+
+ // Data Members:
+
+ // ios_base::pword() reserved cell
+ static int _S_pword_ix;
+
+ // True iff data members are consistent with the current locale,
+ // ie imbue sets this to false.
+ bool _M_valid;
+
+ // A list of valid numeric literals: for the standard "C" locale,
+ // this would usually be: "-+xX0123456789abcdef0123456789ABCDEF"
+ static const char _S_literals[];
+
+ // NB: Code depends on the order of definitions of the names
+ // these are indices into _S_literals, above.
+ // This string is formatted for putting, not getting. (output, not input)
+ enum
+ {
+ _S_minus,
+ _S_plus,
+ _S_ecks,
+ _S_Ecks,
+ _S_digits,
+ _S_digits_end = _S_digits + 16,
+ _S_udigits = _S_digits_end,
+ _S_udigits_end = _S_udigits + 16,
+ _S_ee = _S_digits + 14, // For scientific notation, 'E'
+ _S_Ee = _S_udigits + 14 // For scientific notation, 'e'
+ };
+
+ // The sign used to separate decimal values: for standard US
+ // locales, this would usually be: "."
+ // Abstracted from numpunct::decimal_point().
+ char_type _M_decimal_point;
+
+ // The sign used to separate groups of digits into smaller
+ // strings that the eye can parse with less difficulty: for
+ // standard US locales, this would usually be: ","
+ // Abstracted from numpunct::thousands_sep().
+ char_type _M_thousands_sep;
+
+ // However the US's "false" and "true" are translated.
+ // From numpunct::truename() and numpunct::falsename(), respectively.
+ string_type _M_truename;
+ string_type _M_falsename;
+
+ // If we are checking groupings. This should be equivalent to
+ // numpunct::groupings().size() != 0
+ bool _M_use_grouping;
+
+ // If we are using numpunct's groupings, this is the current
+ // grouping string in effect (from numpunct::grouping()).
+ string _M_grouping;
+
+ _Format_cache();
+
+ ~_Format_cache() throw() { }
+
+ // Given a member of the ios heirarchy as an argument, extract
+ // out all the current formatting information into a
+ // _Format_cache object and return a pointer to it.
+ static _Format_cache<_CharT>*
+ _S_get(ios_base& __ios);
+
+ void
+ _M_populate(ios_base&);
+
+ static void
+ _S_callback(ios_base::event __event, ios_base& __ios, int __ix) throw();
+ };
+
+ template<> _Format_cache<char>::_Format_cache();
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<> _Format_cache<wchar_t>::_Format_cache();
+#endif
+
+ // _Numeric_get is used by num_get, money_get, and time_get to help
+ // in parsing out numbers.
+ template<typename _CharT, typename _InIter>
+ class _Numeric_get
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _InIter iter_type;
+
+ // Forward decls and Friends:
+ template<typename _Char, typename _InIterT>
+ friend class num_get;
+ template<typename _Char, typename _InIterT>
+ friend class time_get;
+ template<typename _Char, typename _InIterT>
+ friend class money_get;
+ template<typename _Char, typename _InIterT>
+ friend class num_put;
+ template<typename _Char, typename _InIterT>
+ friend class time_put;
+ template<typename _Char, typename _InIterT>
+ friend class money_put;
+
+ private:
+ explicit
+ _Numeric_get() { }
+
+ virtual
+ ~_Numeric_get() { }
+
+ iter_type
+ _M_get_digits(iter_type __in, iter_type __end) const;
+ };
+
+ template<typename _CharT, typename _InIter>
+ class num_get : public locale::facet
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _InIter iter_type;
+ typedef char_traits<_CharT> __traits_type;
+
+ explicit
+ num_get(size_t __refs = 0) : locale::facet(__refs) { }
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, bool& __v) const
+ { return do_get(__in, __end, __io, __err, __v); }
+
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, short& __v) const
+ { return do_get(__in, __end, __io, __err, __v); }
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, int& __v) const
+ { return do_get(__in, __end, __io, __err, __v); }
+#endif
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, long& __v) const
+ { return do_get(__in, __end, __io, __err, __v); }
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, long long& __v) const
+ { return do_get(__in, __end, __io, __err, __v); }
+#endif
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned short& __v) const
+ { return do_get(__in, __end, __io, __err, __v); }
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned int& __v) const
+ { return do_get(__in, __end, __io, __err, __v); }
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned long& __v) const
+ { return do_get(__in, __end, __io, __err, __v); }
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned long long& __v) const
+ { return do_get(__in, __end, __io, __err, __v); }
+#endif
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, float& __v) const
+ { return do_get(__in, __end, __io, __err, __v); }
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, double& __v) const
+ { return do_get(__in, __end, __io, __err, __v); }
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, long double& __v) const
+ { return do_get(__in, __end, __io, __err, __v); }
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, void*& __v) const
+ { return do_get(__in, __end, __io, __err, __v); }
+ static locale::id id;
+
+ protected:
+ virtual ~num_get() { }
+
+ // This consolidates the extraction, storage and
+ // error-processing parts of the do_get(...) overloaded member
+ // functions. NB: this is specialized for char.
+ void
+ _M_extract(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, char* __xtrc,
+ int& __base, bool __fp = true) const;
+
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const;
+
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, short&) const;
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, int&) const;
+#endif
+ virtual iter_type
+ do_get (iter_type, iter_type, ios_base&, ios_base::iostate&, long&) const;
+#ifdef _GLIBCPP_USE_LONG_LONG
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
+ long long&) const;
+#endif
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
+ unsigned short&) const;
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&,
+ ios_base::iostate& __err, unsigned int&) const;
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&,
+ ios_base::iostate& __err, unsigned long&) const;
+#ifdef _GLIBCPP_USE_LONG_LONG
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&,
+ ios_base::iostate& __err, unsigned long long&) const;
+#endif
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
+ float&) const;
+
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
+ double&) const;
+
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&,
+ ios_base::iostate& __err, long double&) const;
+
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
+ void*&) const;
+ };
+
+ // Declare specialized extraction member function.
+ template<>
+ void
+ num_get<char, istreambuf_iterator<char> >::
+ _M_extract(istreambuf_iterator<char> __beg,
+ istreambuf_iterator<char> __end, ios_base& __io,
+ ios_base::iostate& __err, char* __xtrc,
+ int& __base, bool __fp) const;
+
+ // _Numeric_put is used by num_put, money_put, and time_put
+ // to help in formatting out numbers.
+ template<typename _CharT, typename _OutIter>
+ class _Numeric_put
+ {
+ public:
+ typedef _CharT char_type;
+ typedef _OutIter iter_type;
+ protected:
+ explicit
+ _Numeric_put() { }
+
+ virtual
+ ~_Numeric_put() { }
+ };
+
+ template<typename _CharT, typename _OutIter>
+ class num_put : public locale::facet
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _OutIter iter_type;
+
+ explicit
+ num_put(size_t __refs = 0) : locale::facet(__refs) { }
+
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill, bool __v) const
+ { return do_put(__s, __f, __fill, __v); }
+
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill, long __v) const
+ { return do_put(__s, __f, __fill, __v); }
+
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill,
+ unsigned long __v) const
+ { return do_put(__s, __f, __fill, __v); }
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill, long long __v) const
+ { return do_put(__s, __f, __fill, __v); }
+
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill,
+ unsigned long long __v) const
+ { return do_put(__s, __f, __fill, __v); }
+#endif
+
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill, double __v) const
+ { return do_put(__s, __f, __fill, __v); }
+
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill,
+ long double __v) const
+ { return do_put(__s, __f, __fill, __v); }
+
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill,
+ const void* __v) const
+ { return do_put(__s, __f, __fill, __v); }
+
+ static locale::id id;
+
+ protected:
+ virtual
+ ~num_put() { };
+
+ virtual iter_type
+ do_put(iter_type, ios_base&, char_type __fill, bool __v) const;
+
+ virtual iter_type
+ do_put(iter_type, ios_base&, char_type __fill, long __v) const;
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ virtual iter_type
+ do_put(iter_type, ios_base&, char_type __fill, long long __v) const;
+#endif
+
+ virtual iter_type
+ do_put(iter_type, ios_base&, char_type __fill, unsigned long) const;
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ virtual iter_type
+ do_put(iter_type, ios_base&, char_type __fill, unsigned long long) const;
+#endif
+
+ virtual iter_type
+ do_put(iter_type, ios_base&, char_type __fill, double __v) const;
+
+ virtual iter_type
+ do_put(iter_type, ios_base&, char_type __fill, long double __v) const;
+
+ virtual iter_type
+ do_put(iter_type, ios_base&, char_type __fill, const void* __v) const;
+ };
+
+ template<typename _CharT>
+ class _Punct : public locale::facet
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+
+ char_type
+ decimal_point() const
+ { return do_decimal_point(); }
+
+ char_type
+ thousands_sep() const
+ { return do_thousands_sep(); }
+
+ string
+ grouping() const
+ { return do_grouping(); }
+ protected:
+
+ explicit
+ _Punct(size_t __refs = 0) : locale::facet(__refs) { }
+
+ virtual
+ ~_Punct() { }
+
+ virtual char_type
+ do_decimal_point() const
+ { return _M_decimal_point; }
+
+ virtual char_type
+ do_thousands_sep() const
+ { return _M_thousands_sep; }
+
+ virtual string
+ do_grouping() const
+ { return _M_grouping; }
+
+ private:
+ char_type _M_decimal_point;
+ char_type _M_thousands_sep;
+ string _M_grouping;
+
+ protected:
+ // for use at construction time only:
+ void
+ _M_init(char_type __d, char_type __t, const string& __g)
+ {
+ _M_decimal_point = __d;
+ _M_thousands_sep = __t;
+ _M_grouping = __g;
+ }
+
+ };
+
+ template<typename _CharT>
+ class _Numpunct : public _Punct<_CharT>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+
+ string_type
+ truename() const
+ { return do_truename(); }
+
+ string_type
+ falsename() const
+ { return do_falsename(); }
+
+ protected:
+ explicit
+ _Numpunct(size_t __refs = 0) : _Punct<_CharT> (__refs) { }
+
+ virtual
+ ~_Numpunct() { }
+
+ virtual string_type
+ do_truename() const
+ { return _M_truename; }
+
+ virtual string_type
+ do_falsename() const
+ { return _M_falsename; }
+
+ private:
+ string_type _M_truename;
+ string_type _M_falsename;
+
+ protected:
+ // For use only during construction
+ void
+ _M_init_boolnames(const string_type& __t, const string_type& __f)
+ {
+ _M_truename = __t;
+ _M_falsename = __f;
+ }
+
+ };
+
+ template<typename _CharT>
+ class numpunct : public _Numpunct<_CharT>
+ {
+ public:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+
+ static locale::id id;
+
+ explicit
+ numpunct(size_t __refs = 0) : _Numpunct<_CharT>(__refs) { }
+ protected:
+
+ virtual
+ ~numpunct() { }
+ };
+
+ template<>
+ numpunct<char>::numpunct(size_t __refs): _Numpunct<char>(__refs)
+ {
+ _M_init('.', ',', "");
+ _M_init_boolnames("true", "false");
+ }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ numpunct<wchar_t>::numpunct(size_t __refs): _Numpunct<wchar_t>(__refs)
+ {
+ _M_init(L'.', L',', "");
+ _M_init_boolnames(L"true", L"false");
+ }
+#endif
+
+ template<typename _CharT>
+ class numpunct_byname : public numpunct<_CharT>
+ {
+ public:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+
+ explicit
+ numpunct_byname(const char*, size_t __refs = 0);
+
+ protected:
+ virtual
+ ~numpunct_byname() { }
+ };
+
+ template<>
+ numpunct_byname<char>::numpunct_byname(const char*, size_t __refs);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ numpunct_byname<wchar_t>::numpunct_byname(const char*, size_t __refs);
+#endif
+
+ template<typename _CharT>
+ class _Collate : public locale::facet
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+
+ int
+ compare(const _CharT* __lo1, const _CharT* __hi1,
+ const _CharT* __lo2, const _CharT* __hi2) const
+ { return do_compare(__lo1, __hi1, __lo2, __hi2); }
+
+ string_type
+ transform(const _CharT* __lo, const _CharT* __hi) const
+ { return do_transform(__lo, __hi); }
+
+ long
+ hash(const _CharT* __lo, const _CharT* __hi) const
+ { return do_hash(__lo, __hi); }
+
+ protected:
+ explicit
+ _Collate(size_t __refs = 0) : locale::facet(__refs) { }
+
+ ~_Collate() { } // virtual
+
+ virtual int
+ do_compare(const _CharT* __lo1, const _CharT* __hi1,
+ const _CharT* __lo2, const _CharT* __hi2) const = 0;
+
+ virtual string_type
+ do_transform(const _CharT* __lo, const _CharT* __hi) const = 0;
+
+ virtual long
+ do_hash(const _CharT* __lo, const _CharT* __hi) const = 0;
+ };
+
+ template<typename _CharT>
+ class collate : public _Collate<_CharT>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+
+ explicit
+ collate(size_t __refs = 0) : _Collate<_CharT> (__refs) { }
+
+ static locale::id id;
+
+ protected:
+ virtual
+ ~collate() { }
+ };
+
+ template<>
+ class collate<char> : public _Collate<char>
+ {
+ public:
+ // Types:
+ typedef char char_type;
+ typedef basic_string<char> string_type;
+
+ explicit
+ collate(size_t __refs = 0);
+
+ static locale::id id;
+
+ protected:
+ virtual
+ ~collate();
+
+ virtual int
+ do_compare(const char* __lo1, const char* __hi1,
+ const char* __lo2, const char* __hi2) const;
+
+ virtual string_type
+ do_transform(const char* __lo, const char* __hi) const;
+
+ virtual long
+ do_hash(const char* __lo, const char* __hi) const;
+ };
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ class collate<wchar_t> : public _Collate<wchar_t>
+ {
+ public:
+ // Types:
+ typedef wchar_t char_type;
+ typedef basic_string<wchar_t> string_type;
+
+ explicit
+ collate(size_t __refs = 0);
+
+ static locale::id id;
+
+ protected:
+ virtual
+ ~collate();
+
+ virtual int
+ do_compare(const wchar_t* __lo1, const wchar_t* __hi1,
+ const wchar_t* __lo2, const wchar_t* __hi2) const;
+
+ virtual string_type
+ do_transform(const wchar_t* __lo, const wchar_t* __hi) const;
+
+ virtual long
+ do_hash(const wchar_t* __lo, const wchar_t* __hi) const;
+ };
+#endif
+
+ template<typename _CharT>
+ class collate_byname : public collate<_CharT>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+
+ explicit
+ collate_byname(const char*, size_t __refs = 0);
+
+ protected:
+ virtual
+ ~collate_byname() { }
+ };
+
+ template<>
+ collate_byname<char>::collate_byname(const char*, size_t __refs);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ collate_byname<wchar_t>::collate_byname(const char*, size_t __refs);
+#endif
+
+ class time_base
+ {
+ public:
+ enum dateorder { no_order, dmy, mdy, ymd, ydm };
+ };
+
+ template<typename _CharT, typename _InIter>
+ class time_get : public locale::facet, public time_base
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _InIter iter_type;
+
+ explicit
+ time_get(size_t __refs = 0)
+ : locale::facet (__refs), _M_daynames(0), _M_monthnames(0) { }
+
+ dateorder
+ date_order() const
+ { return do_date_order(); }
+
+ iter_type
+ get_time(iter_type __s, iter_type __end, ios_base& __f,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_time(__s, __end, __f, __err, __t); }
+
+ iter_type
+ get_date(iter_type __s, iter_type __end, ios_base& __f,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_date(__s, __end, __f, __err, __t); }
+
+ iter_type
+ get_weekday(iter_type __s, iter_type __end, ios_base& __f,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_weekday(__s,__end,__f,__err,__t); }
+
+ iter_type
+ get_monthname(iter_type __s, iter_type __end, ios_base& __f,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_monthname(__s,__end,__f,__err,__t); }
+
+ iter_type
+ get_year(iter_type __s, iter_type __end, ios_base& __f,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_year(__s,__end,__f,__err,__t); }
+
+ static locale::id id;
+
+ protected:
+ virtual
+ ~time_get()
+ {
+ delete [] _M_monthnames;
+ delete [] _M_daynames;
+ }
+
+ virtual dateorder
+ do_date_order() const
+ { return time_base::ymd; }
+
+ virtual iter_type
+ do_get_time(iter_type __s, iter_type /*__end*/, ios_base&,
+ ios_base::iostate& /*__err*/, tm* /*__t*/) const
+ { return __s; }
+
+ virtual iter_type
+ do_get_date(iter_type __s, iter_type /*__end*/, ios_base&,
+ ios_base::iostate& /*__err*/, tm* /*__t*/) const
+ { return __s; }
+
+ virtual iter_type
+ do_get_weekday(iter_type __s, iter_type __end, ios_base&,
+ ios_base::iostate& __err, tm* __t) const;
+
+ virtual iter_type
+ do_get_monthname(iter_type __s, iter_type __end, ios_base&,
+ ios_base::iostate& __err, tm* __t) const;
+
+ virtual iter_type
+ do_get_year(iter_type __s, iter_type /*__end*/, ios_base&,
+ ios_base::iostate& /*__err*/, tm* /*__t*/) const
+ { return __s; }
+
+ mutable basic_string<_CharT>* _M_daynames;
+ mutable basic_string<_CharT>* _M_monthnames;
+ };
+
+ template<typename _CharT, typename _InIter>
+ class time_get_byname : public time_get<_CharT, _InIter>
+ {
+ public:
+ typedef _CharT char_type;
+ typedef _InIter iter_type;
+
+ explicit
+ time_get_byname(const char*, size_t __refs = 0)
+ : time_get<_CharT, _InIter>(__refs) { }
+ protected:
+ virtual
+ ~time_get_byname() { }
+ };
+
+ template<typename _CharT, typename _OutIter>
+ class time_put : public locale::facet, public time_base
+ {
+ public:
+ typedef _CharT char_type;
+ typedef _OutIter iter_type;
+
+ explicit
+ time_put(size_t __refs = 0) : locale::facet (__refs) { }
+
+ // NB: this is a nonvirtual, calls do_put in a loop.
+ iter_type
+ put(iter_type __s, ios_base& /*__f*/, char_type /*__fill*/,
+ const tm* /*__tmb*/, const _CharT* /*__pattern*/,
+ const _CharT* /*__pat_end*/) const
+ { return __s; }
+
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill,
+ const tm* __tmb, char __format, char __modifier = 0) const
+ { return do_put(__s, __f, __fill, __tmb, __format, __modifier); }
+
+ static locale::id id;
+
+ protected:
+ virtual
+ ~time_put() { }
+
+ virtual iter_type
+ do_put(iter_type __s, ios_base&, char_type, const tm* /*__t*/,
+ char /*__format*/, char /*__mod*/) const
+ { return __s; }
+ };
+
+ template<typename _CharT, typename _OutIter>
+ class time_put_byname : time_put<_CharT, _OutIter>
+ {
+ public:
+ typedef _CharT char_type;
+ typedef _OutIter iter_type;
+
+ explicit
+ time_put_byname(const char*, size_t __refs = 0)
+ : time_put<_CharT, _OutIter> (__refs) { }
+ protected:
+ virtual
+ ~time_put_byname() { }
+ };
+
+
+ template<typename _CharT, typename _InIter>
+ class money_get : public locale::facet
+ {
+ public:
+ typedef _CharT char_type;
+ typedef _InIter iter_type;
+ typedef basic_string<_CharT> string_type;
+
+ explicit
+ money_get(size_t __refs = 0) : locale::facet(__refs) { }
+
+ iter_type
+ get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __f, ios_base::iostate& __err, long double& __units) const
+ { return do_get(__s, __end, __intl, __f, __err, __units); }
+
+ iter_type
+ get(iter_type __s, iter_type __end, bool __intl, ios_base& __f,
+ ios_base::iostate& __err, string_type& __digits) const
+ { return do_get(__s, __end, __intl, __f, __err, __digits); }
+
+ static locale::id id;
+
+ protected:
+ virtual
+ ~money_get() { }
+
+ virtual iter_type
+ do_get(iter_type __s, iter_type /*__end*/, bool /*__intl*/,
+ ios_base& /*__io*/, ios_base::iostate& /*__err*/,
+ long double& /*__units*/) const
+ { return __s; }
+
+ virtual iter_type
+ do_get(iter_type __s, iter_type /*__end*/, bool /*__intl*/,
+ ios_base& /*__io*/, ios_base::iostate& /*__err*/,
+ string_type& /*__digits*/) const
+ { return __s; }
+ };
+
+ template<typename _CharT, typename _OutIter>
+ class money_put : public locale::facet
+ {
+ public:
+ typedef _CharT char_type;
+ typedef _OutIter iter_type;
+ typedef basic_string<_CharT> string_type;
+
+ explicit
+ money_put(size_t __refs = 0) : locale::facet(__refs) { }
+
+ iter_type
+ put(iter_type __s, bool __intl, ios_base& __f,
+ char_type __fill, long double __units) const
+ { return do_put(__s, __intl, __f, __fill, __units); }
+
+ iter_type
+ put(iter_type __s, bool __intl, ios_base& __f,
+ char_type __fill, const string_type& __digits) const
+ { return do_put(__s, __intl, __f, __fill, __digits); }
+
+ static locale::id id;
+
+ protected:
+ virtual
+ ~money_put() { }
+
+ virtual iter_type
+ do_put(iter_type __s, bool, ios_base& /*__io*/, char_type /*__fill*/,
+ long double /*__units*/) const
+ { return __s; }
+
+ virtual iter_type
+ do_put(iter_type __s, bool, ios_base& /*__io*/, char_type /*__fill*/,
+ const string_type& /*__digits*/) const
+ { return __s; }
+ };
+
+ struct money_base
+ {
+ enum part { none, space, symbol, sign, value };
+ struct pattern { char field[4]; };
+
+ static const pattern __default_pattern;
+ };
+
+ template<typename _CharT>
+ class _Moneypunct : public _Punct<_CharT>, public money_base
+ {
+ public:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+
+ string_type
+ curr_symbol() const
+ { return do_curr_symbol(); }
+
+ string_type
+ positive_sign() const
+ { return do_positive_sign(); }
+
+ string_type
+ negative_sign() const
+ { return do_negative_sign(); }
+
+ int
+ frac_digits() const
+ { return do_frac_digits(); }
+
+ pattern
+ pos_format() const
+ { return do_pos_format(); }
+
+ pattern
+ neg_format() const
+ { return do_neg_format(); }
+
+ protected:
+ explicit
+ _Moneypunct(size_t __refs = 0) : _Punct<_CharT> (__refs) { }
+
+ virtual
+ ~_Moneypunct() { }
+
+ virtual string_type
+ do_curr_symbol() const
+ { return basic_string<_CharT>(); }
+
+ virtual string_type
+ do_positive_sign() const
+ { return basic_string<_CharT>(); }
+
+ virtual string_type
+ do_negative_sign() const
+ { return basic_string<_CharT>(); }
+
+ virtual int
+ do_frac_digits() const
+ { return 0; }
+
+ virtual pattern
+ do_pos_format() const
+ {
+ return money_base::__default_pattern;
+ }
+
+ virtual pattern
+ do_neg_format() const
+ {
+ return money_base::__default_pattern;
+ }
+
+ };
+
+ template<typename _CharT, bool _Intl>
+ class moneypunct : public _Moneypunct<_CharT>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+
+ static const bool intl = _Intl;
+ static locale::id id;
+
+ explicit
+ moneypunct(size_t __refs = 0) : _Moneypunct<_CharT> (__refs) { }
+ protected:
+ virtual
+ ~moneypunct() { }
+ };
+
+ template<typename _CharT, bool _Intl>
+ class moneypunct_byname : public moneypunct<_CharT,_Intl>
+ {
+ public:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+ static const bool intl = _Intl;
+
+ explicit
+ moneypunct_byname(const char*, size_t __refs = 0);
+
+ protected:
+ virtual
+ ~moneypunct_byname() { }
+ };
+
+ template<>
+ moneypunct_byname<char, false>::
+ moneypunct_byname(const char*, size_t __refs);
+ template<>
+ moneypunct_byname<char, true>::
+ moneypunct_byname(const char*, size_t __refs);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ moneypunct_byname<wchar_t,false>::
+ moneypunct_byname(const char*, size_t __refs);
+ template<>
+ moneypunct_byname<wchar_t,true>::
+ moneypunct_byname (const char*, size_t __refs);
+#endif
+
+ struct messages_base
+ {
+ typedef int catalog;
+ };
+
+ template<typename _CharT>
+ class _Messages : public locale::facet, public messages_base
+ {
+ public:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+
+ catalog
+ open(const basic_string<char>& __s, const locale& __loc) const
+ { return do_open(__s, __loc); }
+
+ string_type
+ get(catalog __c, int __set, int __msgid, const string_type& __s) const
+ { return do_get(__c,__set,__msgid,__s); }
+
+ void
+ close(catalog __c) const
+ { return do_close(__c); }
+
+ protected:
+ explicit
+ _Messages(size_t __refs = 0) : locale::facet(__refs) { }
+
+ virtual
+ ~_Messages() { }
+
+ // NB: Probably these should be pure, and implemented only in
+ // specializations of messages<>. But for now...
+ virtual catalog
+ do_open(const basic_string<char>&, const locale&) const
+ { return 0; }
+
+ virtual string_type
+ do_get(catalog, int, int /*__msgid*/, const string_type& __dfault) const
+ { return __dfault; }
+
+ virtual void
+ do_close (catalog) const { }
+ };
+
+ template<typename _CharT>
+ class messages : public _Messages<_CharT>
+ {
+ public:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+ static locale::id id;
+
+ explicit
+ messages(size_t __refs = 0) : _Messages<_CharT> (__refs) { }
+ protected:
+ virtual
+ ~messages() { }
+ };
+
+ template<typename _CharT>
+ class messages_byname : public messages<_CharT>
+ {
+ public:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+
+ explicit
+ messages_byname(const char*, size_t __refs = 0);
+
+ protected:
+ virtual
+ ~messages_byname() { }
+ };
+
+ template<>
+ messages_byname<char>::messages_byname(const char*, size_t __refs);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ messages_byname<wchar_t>::messages_byname(const char*, size_t __refs);
+#endif
+
+ // Subclause convenience interfaces, inlines
+ // NB: these are inline
+ // because, when used in a loop, some compilers can hoist the body
+ // out of the loop; then it's just as fast as the C is*() function.
+ template<typename _CharT>
+ inline bool
+ isspace(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::space, __c); }
+
+ template<typename _CharT>
+ inline bool
+ isprint(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::print, __c); }
+
+ template<typename _CharT>
+ inline bool
+ iscntrl(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::cntrl, __c); }
+
+ template<typename _CharT>
+ inline bool
+ isupper(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::upper, __c); }
+
+ template<typename _CharT>
+ inline bool islower(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::lower, __c); }
+
+ template<typename _CharT>
+ inline bool
+ isalpha(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::alpha, __c); }
+
+ template<typename _CharT>
+ inline bool
+ isdigit(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::digit, __c); }
+
+ template<typename _CharT>
+ inline bool
+ ispunct(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::punct, __c); }
+
+ template<typename _CharT>
+ inline bool
+ isxdigit(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::xdigit, __c); }
+
+ template<typename _CharT>
+ inline bool
+ isalnum(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::alnum, __c); }
+
+ template<typename _CharT>
+ inline bool
+ isgraph(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> > (__loc).is(ctype_base::graph, __c); }
+
+ template<typename _CharT>
+ inline _CharT
+ toupper(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> > (__loc).toupper(__c); }
+
+ template<typename _CharT>
+ inline _CharT
+ tolower(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> > (__loc).tolower(__c); }
+
+} // namespace std
+
+#endif /* _CPP_BITS_LOCFACETS_H */
+
+// Local Variables:
+// mode:c++
+// End:
+
diff --git a/libstdc++-v3/bits/locale_facets.tcc b/libstdc++-v3/bits/locale_facets.tcc
new file mode 100644
index 000000000000..3772f0678738
--- /dev/null
+++ b/libstdc++-v3/bits/locale_facets.tcc
@@ -0,0 +1,1440 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Warning: this file is not meant for user inclusion. Use <locale>.
+
+#ifndef _CPP_BITS_LOCFACETS_TCC
+#define _CPP_BITS_LOCFACETS_TCC 1
+
+#include <bits/std_cerrno.h>
+#include <bits/std_cstdlib.h> // For strof, strtold
+#include <bits/std_limits.h> // For numeric_limits
+#include <bits/std_vector.h>
+#include <bits/std_memory.h> // For auto_ptr
+#include <bits/sbuf_iter.h> // For streambuf_iterators
+
+namespace std
+{
+ template<typename _Facet>
+ locale
+ locale::combine(const locale& __other)
+ {
+ locale __copy(*this);
+ __copy._M_impl->_M_replace_facet(__other._M_impl, &_Facet::id);
+ __copy._M_impl->_M_has_name = false;
+ return __copy;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ bool
+ locale::operator()(const basic_string<_CharT,_Traits,_Alloc>& __s1,
+ const basic_string<_CharT,_Traits,_Alloc>& __s2) const
+ {
+ // XXX should not need to qualify here.
+ // typedef collate<_CharT> __collate_type;
+ typedef std::collate<_CharT> __collate_type;
+ const __collate_type* __fcoll = &use_facet<__collate_type>(*this);
+ return (__fcoll->compare(__s1.data(), __s1.data() + __s1.length(),
+ __s2.data(), __s2.data() + __s2.length()) < 0);
+ }
+
+ template<typename _Facet>
+ const _Facet&
+ use_facet(const locale& __loc)
+ {
+ const locale::facet* __fp = (const _Facet*)0; // check derivation
+ locale::id& __id = _Facet::id; // check member id
+ size_t __i = __id._M_index;
+ const locale::_Impl* __tmp = __loc._M_impl;
+ if (__id._M_index >= __loc._M_impl->_M_facets->size()
+ || (__fp = (*(__tmp->_M_facets))[__i]) == 0)
+ return _Use_facet_failure_handler<_Facet>(__loc);
+ return static_cast<const _Facet&>(*__fp);
+ }
+
+ template<typename _Facet>
+ bool
+ has_facet(const locale& __loc) throw()
+ {
+ typedef locale::_Impl::__vec_facet __vec_facet;
+ locale::id& __id = _Facet::id; // check member id
+ size_t __i = __id._M_index;
+ __vec_facet* __tmpv = __loc._M_impl->_M_facets;
+ return (__i < __tmpv->size() && (*__tmpv)[__i] != 0);
+ }
+
+ // __match_parallel
+ // matches input __s against a set of __ntargs strings in __targets,
+ // placing in __matches a vector of indices into __targets which
+ // match, and in __remain the number of such matches. If it hits
+ // end of sequence before it minimizes the set, sets __eof.
+ // Empty strings are never matched.
+ template<typename _InIter, typename _CharT>
+ _InIter
+ __match_parallel(_InIter __s, _InIter __end, int __ntargs,
+ const basic_string<_CharT>* __targets,
+ int* __matches, int& __remain, bool& __eof)
+ {
+ typedef basic_string<_CharT> __string_type;
+ __eof = false;
+ for (int __ti = 0; __ti < __ntargs; ++__ti)
+ __matches[__ti] = __ti;
+ __remain = __ntargs;
+ size_t __pos = 0;
+ do
+ {
+ {
+ int __ti = 0;
+ for (;__ti < __remain &&
+ __pos == __targets[__matches[__ti]].size(); ++__ti)
+ { }
+ if (__ti == __remain)
+ {
+ if (__pos == 0) __remain = 0;
+ return __s;
+ }
+ }
+ if (__s == __end)
+ __eof = true;
+ bool __matched = false;
+ for (int __ti = 0; __ti < __remain; )
+ {
+ const __string_type& __target = __targets[__matches[__ti]];
+ if (__pos < __target.size())
+ {
+ if (__eof || __target[__pos] != *__s)
+ {
+ __matches[__ti] = __matches[--__remain];
+ continue;
+ }
+ __matched = true;
+ }
+ ++__ti;
+ }
+ if (__matched)
+ {
+ ++__s;
+ ++__pos;
+ }
+ for (int __ti = 0; __ti < __remain;)
+ {
+ if (__pos > __targets[__matches[__ti]].size())
+ {
+ __matches[__ti] = __matches[--__remain];
+ continue;
+ }
+ ++__ti;
+ }
+ }
+ while (__remain);
+ return __s;
+ }
+
+ template<typename _CharT>
+ locale::id ctype<_CharT>::id;
+
+ template<typename _InternT, typename _ExternT, typename _StateT>
+ locale::id codecvt<_InternT,_ExternT,_StateT>::id;
+
+ template<typename _CharT>
+ int _Format_cache<_CharT>::_S_pword_ix;
+
+ template<typename _CharT>
+ const char _Format_cache<_CharT>::
+ _S_literals[] = "-+xX0123456789abcdef0123456789ABCDEF";
+
+ template<typename _CharT>
+ _Format_cache<_CharT>::_Format_cache()
+ : _M_valid(true), _M_use_grouping(false)
+ { }
+
+ template<>
+ _Format_cache<char>::_Format_cache()
+ : _M_valid(true),
+ _M_decimal_point('.'), _M_thousands_sep(','),
+ _M_truename("true"), _M_falsename("false"), _M_use_grouping(false)
+ { }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ _Format_cache<wchar_t>::_Format_cache()
+ : _M_valid(true),
+ _M_decimal_point(L'.'), _M_thousands_sep(L','),
+ _M_truename(L"true"), _M_falsename(L"false"), _M_use_grouping(false)
+ { }
+#endif
+
+ template<typename _CharT>
+ void
+ _Format_cache<_CharT>::_M_populate(ios_base& __io)
+ {
+ locale __loc = __io.getloc ();
+ numpunct<_CharT> const& __np = use_facet<numpunct<_CharT> >(__loc);
+ _M_truename = __np.truename();
+ _M_falsename = __np.falsename();
+ _M_thousands_sep = __np.thousands_sep();
+ _M_decimal_point = __np.decimal_point();
+ _M_grouping = __np.grouping();
+ _M_use_grouping = _M_grouping.size() != 0 && _M_grouping.data()[0] != 0;
+ _M_valid = true;
+ }
+
+ // This function is always called via a pointer installed in
+ // an ios_base by ios_base::register_callback.
+ template<typename _CharT>
+ void
+ _Format_cache<_CharT>::
+ _S_callback(ios_base::event __ev, ios_base& __ios, int __ix) throw()
+ {
+ void*& __p = __ios.pword(__ix);
+ switch (__ev)
+ {
+ case ios_base::erase_event:
+ delete static_cast<_Format_cache<_CharT>*> (__p); __p = 0;
+ break;
+ case ios_base::copyfmt_event:
+ // If just stored zero, the callback would get registered again.
+ try {
+ __p = new _Format_cache<_CharT>;
+ }
+ catch(...) {
+ }
+ break;
+ case ios_base::imbue_event:
+ static_cast<_Format_cache<_CharT>*>(__p)->_M_valid = false;
+ break;
+ }
+ }
+
+ template<typename _CharT>
+ _Format_cache<_CharT>*
+ _Format_cache<_CharT>::_S_get(ios_base& __ios)
+ {
+ if (!_S_pword_ix)
+ _S_pword_ix = ios_base::xalloc(); // XXX MT
+ void*& __p = __ios.pword(_S_pword_ix);
+
+ // XXX What if pword fails? must check failbit, throw.
+ if (__p == 0) // XXX MT? maybe sentry takes care of it
+ {
+ auto_ptr<_Format_cache<_CharT> > __ap(new _Format_cache<_CharT>);
+ __ios.register_callback(&_Format_cache<_CharT>::_S_callback,
+ _S_pword_ix);
+ __p = __ap.release();
+ }
+ _Format_cache<_CharT>* __ncp = static_cast<_Format_cache<_CharT>*>(__p);
+ if (!__ncp->_M_valid)
+ __ncp->_M_populate(__ios);
+
+ return __ncp;
+ }
+
+ template<typename _CharT, typename _InIter>
+ locale::id num_get<_CharT, _InIter>::id;
+
+ // This member function takes an (w)istreambuf_iterator object and
+ // parses it into a generic char array suitable for parsing with
+ // strto[l,ll,f,d]. The thought was to encapsulate the conversion
+ // into this one function, and thus the num_get::do_get member
+ // functions can just adjust for the type of the overloaded
+ // argument and process the char array returned from _M_extract.
+ // Other things were also considered, including a fused
+ // multiply-add loop that would obviate the need for any call to
+ // strto... at all: however, it would b e a bit of a pain, because
+ // you'd have to be able to return either floating or integral
+ // types, etc etc. The current approach seems to be smack dab in
+ // the middle between an unoptimized approach using sscanf, and
+ // some kind of hyper-optimized approach alluded to above.
+
+ // XXX
+ // Need to do partial specialization to account for differences
+ // between character sets. For char, this is pretty
+ // straightforward, but for wchar_t, the conversion to a plain-jane
+ // char type is a bit more involved.
+ template<typename _CharT, typename _InIter>
+ void
+ num_get<_CharT, _InIter>::
+ _M_extract(iter_type /*__beg*/, iter_type /*__end*/, ios_base& /*__io*/,
+ ios_base::iostate& /*__err*/, char* /*__xtrc*/,
+ int& /*__base*/, bool /*__fp*/) const
+ {
+ // XXX Not currently done: need to expand upon char version below.
+ }
+
+ template<>
+ void
+ num_get<char, istreambuf_iterator<char> >::
+ _M_extract(istreambuf_iterator<char> __beg,
+ istreambuf_iterator<char> __end, ios_base& __io,
+ ios_base::iostate& __err, char* __xtrc,
+ int& __base, bool __fp) const
+ {
+ typedef _Format_cache<char> __cache_type;
+
+ // Stage 1: determine a conversion specifier.
+ ios_base::fmtflags __basefield = __io.flags() & ios_base::basefield;
+ if (__basefield == ios_base::oct)
+ __base = 8;
+ else if (__basefield == ios_base::hex)
+ __base = 16;
+ else
+ __base = 10;
+
+ // Stage 2: extract characters.
+ __cache_type const* __fmt = __cache_type::_S_get(__io);
+ bool __valid = __beg != __end;
+ string __grp;
+ int __sep_pos = 0;
+ int __pos = 0;
+ bool __testdec = false;
+ const char* __lits = __fmt->_S_literals;
+
+ while (__valid && __beg != __end)
+ {
+ __valid = false;
+ char __c = *__beg;
+ char* __p = strchr(__fmt->_S_literals, __c);
+
+ // NB: strchr returns true for __c == 0x0
+ if (__p && __c)
+ {
+ if ((__p >= &__lits[__cache_type::_S_digits + __base]
+ && __p < &__lits[__cache_type::_S_digits_end]) ||
+ (__p >= &__lits[__cache_type::_S_udigits+__base]
+ && __p < &__lits[__cache_type::_S_udigits_end]))
+ {
+ if (!(__fp && (__p == &__lits[__cache_type::_S_ee]
+ || __p == &__lits[__cache_type::_S_Ee])))
+ break;
+ }
+ __xtrc[__pos] = __c;
+ ++__pos;
+ ++__sep_pos;
+ __valid = true;
+ }
+ else if (__c == __fmt->_M_thousands_sep
+ && __fmt->_M_use_grouping && !__testdec)
+ {
+ // NB: Thousands separator at the beginning of a string
+ // is a no-no, as is two consecutive thousands
+ // separators, as is thousands separator to the right of
+ // a decimal point.
+ if (__sep_pos && !__testdec)
+ {
+ __grp += static_cast<char>(__sep_pos);
+ __sep_pos = 0;
+ __valid = true;
+ }
+ else
+ __err |= ios_base::failbit;
+ }
+ else if (__c == __fmt->_M_decimal_point
+ && __fp && !__testdec)
+ {
+ __xtrc[__pos] = '.';
+ ++__pos;
+ if (__fmt->_M_use_grouping && !__grp.empty())
+ {
+ __grp += static_cast<char>(__sep_pos);
+ __sep_pos = 0;
+ }
+ __testdec = true;
+ __valid = true;
+ }
+ if (__valid)
+ ++__beg;
+ }
+ __xtrc[__pos] = '\0';
+ if (__beg == __end)
+ __err |= ios_base::eofbit;
+
+ // Digit grouping is checked. If _M_groupings() doesn't
+ // match, then get very very upset, and set failbit.
+ if (__fmt->_M_use_grouping && !__grp.empty())
+ {
+ // Add the ending grouping if the decimal point hasn't
+ // already delineated the end of the sequence that grouping
+ // cares about.
+ if (!__testdec)
+ __grp += static_cast<char>(__sep_pos);
+
+ // __grp is parsed L to R
+ // 1,222,444 == __grp of "/1/3/3"
+ // __fmt->_M_grouping is parsed R to L
+ // 1,222,444 == __fmt->_M_grouping of "/3" == "/3/3/3"
+ int __i = 0;
+ int __j = 0;
+ const int __len = __fmt->_M_grouping.size();
+ int __n = __grp.size();
+ bool __test = true;
+
+ // Parsed number groupings have to match the
+ // numpunct::grouping string exactly, starting at the
+ // right-most point of the parsed sequence of elements ...
+ while (__test && __i < __n - 1)
+ for (__j = 0; __test && __j < __len && __i < __n - 1; ++__j, ++__i)
+ __test &= __fmt->_M_grouping[__j] == __grp[__n - __i - 1];
+ // ... but the last parsed grouping can be <= numpunct
+ // grouping.
+ __j == __len ? __j = 0 : __j;
+ __test &= __fmt->_M_grouping[__j] >= __grp[__n - __i - 1];
+
+ if (!__test)
+ __err |= ios_base::failbit;
+ }
+ }
+
+ // NB: This is an unresolved library defect #17
+ // _GLIBCPP_RESOLVE_LIB_DEFECTS
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, bool& __v) const
+ {
+ // Parse bool values as long
+ if (!(__io.flags() & ios_base::boolalpha))
+ {
+ // NB: We can't just call do_get(long) here, as it might
+ // refer to a derived class.
+
+ // Stage 1: extract and determine the conversion specifier.
+ // Assuming leading zeros eliminated, thus the size of 32 for
+ // integral types.
+ char __xtrc[32]= {'\0'};
+ int __base;
+ _M_extract(__beg, __end, __io, __err, __xtrc, __base, false);
+
+ // Stage 2: convert and store results.
+ char* __sanity;
+ errno = 0;
+ long __l = strtol(__xtrc, &__sanity, __base);
+ if (!(__err & ios_base::failbit)
+ && __l <= 1
+ && __sanity != __xtrc && *__sanity == '\0' && errno == 0)
+ __v = __l;
+ else
+ __err |= ios_base::failbit;
+ }
+
+ // Parse bool values as alphanumeric
+ else
+ {
+ typedef _Format_cache<char_type> __fcache_type;
+ __fcache_type* __fmt = __fcache_type::_S_get(__io);
+ const char_type* __true = __fmt->_M_truename.c_str();
+ const char_type* __false = __fmt->_M_falsename.c_str();
+ const size_t __truelen = __traits_type::length(__true) - 1;
+ const size_t __falselen = __traits_type::length(__false) - 1;
+
+ for (size_t __pos = 0; __beg != __end; ++__pos)
+ {
+ char_type __c = *__beg++;
+ bool __testf = __c == __false[__pos];
+ bool __testt = __c == __true[__pos];
+ if (!(__testf || __testt))
+ {
+ __err |= ios_base::failbit;
+ break;
+ }
+ else if (__testf && __pos == __falselen)
+ {
+ __v = 0;
+ break;
+ }
+ else if (__testt && __pos == __truelen)
+ {
+ __v = 1;
+ break;
+ }
+ }
+ if (__beg == __end)
+ __err |= ios_base::eofbit;
+ }
+
+ return __beg;
+ }
+
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, short& __v) const
+ {
+ // Stage 1: extract and determine the conversion specifier.
+ // Assuming leading zeros eliminated, thus the size of 32 for
+ // integral types.
+ char __xtrc[32]= {'\0'};
+ int __base;
+ _M_extract(__beg, __end, __io, __err, __xtrc, __base, false);
+
+ // Stage 2: convert and store results.
+ char* __sanity;
+ errno = 0;
+ long __l = strtol(__xtrc, &__sanity, __base);
+ if (!(__err & ios_base::failbit)
+ && __sanity != __xtrc && *__sanity == '\0' && errno == 0
+ && __l >= SHRT_MIN && __l <= SHRT_MAX)
+ __v = static_cast<short>(__l);
+ else
+ __err |= ios_base::failbit;
+
+ return __beg;
+ }
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, int& __v) const
+ {
+ // Stage 1: extract and determine the conversion specifier.
+ // Assuming leading zeros eliminated, thus the size of 32 for
+ // integral types.
+ char __xtrc[32] = {'\0'};
+ int __base;
+ _M_extract(__beg, __end, __io, __err, __xtrc, __base, false);
+
+ // Stage 2: convert and store results.
+ char* __sanity;
+ errno = 0;
+ long __l = strtol(__xtrc, &__sanity, __base);
+ if (!(__err & ios_base::failbit)
+ && __sanity != __xtrc && *__sanity == '\0' && errno == 0
+ && __l >= INT_MIN && __l <= INT_MAX)
+ __v = static_cast<int>(__l);
+ else
+ __err |= ios_base::failbit;
+
+ return __beg;
+ }
+#endif
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, long& __v) const
+ {
+ // Stage 1: extract and determine the conversion specifier.
+ // Assuming leading zeros eliminated, thus the size of 32 for
+ // integral types.
+ char __xtrc[32]= {'\0'};
+ int __base;
+ _M_extract(__beg, __end, __io, __err, __xtrc, __base, false);
+
+ // Stage 2: convert and store results.
+ char* __sanity;
+ errno = 0;
+ long __l = strtol(__xtrc, &__sanity, __base);
+ if (!(__err & ios_base::failbit)
+ && __sanity != __xtrc && *__sanity == '\0' && errno == 0)
+ __v = __l;
+ else
+ __err |= ios_base::failbit;
+
+ return __beg;
+ }
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, long long& __v) const
+ {
+ // Stage 1: extract and determine the conversion specifier.
+ // Assuming leading zeros eliminated, thus the size of 32 for
+ // integral types.
+ char __xtrc[32]= {'\0'};
+ int __base;
+ _M_extract(__beg, __end, __io, __err, __xtrc, __base, false);
+
+ // Stage 2: convert and store results.
+ char* __sanity;
+ errno = 0;
+ long long __ll = strtoll(__xtrc, &__sanity, __base);
+ if (!(__err & ios_base::failbit)
+ && __sanity != __xtrc && *__sanity == '\0' && errno == 0)
+ __v = __ll;
+ else
+ __err |= ios_base::failbit;
+
+ return __beg;
+ }
+#endif
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned short& __v) const
+ {
+ // Stage 1: extract and determine the conversion specifier.
+ // Assuming leading zeros eliminated, thus the size of 32 for
+ // integral types.
+ char __xtrc[32]= {'\0'};
+ int __base;
+ _M_extract(__beg, __end, __io, __err, __xtrc, __base, false);
+
+ // Stage 2: convert and store results.
+ char* __sanity;
+ errno = 0;
+ unsigned long __ul = strtoul(__xtrc, &__sanity, __base);
+ if (!(__err & ios_base::failbit)
+ && __sanity != __xtrc && *__sanity == '\0' && errno == 0
+ && __ul <= USHRT_MAX)
+ __v = static_cast<unsigned short>(__ul);
+ else
+ __err |= ios_base::failbit;
+
+ return __beg;
+ }
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned int& __v) const
+ {
+ // Stage 1: extract and determine the conversion specifier.
+ // Assuming leading zeros eliminated, thus the size of 32 for
+ // integral types.
+ char __xtrc[32]= {'\0'};
+ int __base;
+ _M_extract(__beg, __end, __io, __err, __xtrc, __base, false);
+
+ // Stage 2: convert and store results.
+ char* __sanity;
+ errno = 0;
+ unsigned long __ul = strtoul(__xtrc, &__sanity, __base);
+ if (!(__err & ios_base::failbit)
+ && __sanity != __xtrc && *__sanity == '\0' && errno == 0
+ && __ul <= UINT_MAX)
+ __v = static_cast<unsigned int>(__ul);
+ else
+ __err |= ios_base::failbit;
+
+ return __beg;
+ }
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned long& __v) const
+ {
+ // Stage 1: extract and determine the conversion specifier.
+ // Assuming leading zeros eliminated, thus the size of 32 for
+ // integral types.
+ char __xtrc[32] = {'\0'};
+ int __base;
+ _M_extract(__beg, __end, __io, __err, __xtrc, __base, false);
+
+ // Stage 2: convert and store results.
+ char* __sanity;
+ errno = 0;
+ unsigned long __ul = strtoul(__xtrc, &__sanity, __base);
+ if (!(__err & ios_base::failbit)
+ && __sanity != __xtrc && *__sanity == '\0' && errno == 0)
+ __v = __ul;
+ else
+ __err |= ios_base::failbit;
+
+ return __beg;
+ }
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned long long& __v) const
+ {
+ // Stage 1: extract and determine the conversion specifier.
+ // Assuming leading zeros eliminated, thus the size of 32 for
+ // integral types.
+ char __xtrc[32]= {'\0'};
+ int __base;
+ _M_extract(__beg, __end, __io, __err, __xtrc, __base, false);
+
+ // Stage 2: convert and store results.
+ char* __sanity;
+ errno = 0;
+ unsigned long long __ull = strtoull(__xtrc, &__sanity, __base);
+ if (!(__err & ios_base::failbit)
+ && __sanity != __xtrc && *__sanity == '\0' && errno == 0)
+ __v = __ull;
+ else
+ __err |= ios_base::failbit;
+
+ return __beg;
+ }
+#endif
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, float& __v) const
+ {
+ // Stage 1: extract and determine the conversion specifier.
+ // Assuming leading zeros eliminated, thus the size of 256 for
+ // floating-point types.
+ char __xtrc[32]= {'\0'};
+ int __base;
+ _M_extract(__beg, __end, __io, __err, __xtrc, __base, true);
+
+ // Stage 2: convert and store results.
+ char* __sanity;
+ errno = 0;
+#ifdef _GLIBCPP_HAVE_STRTOF
+ float __f = strtof(__xtrc, &__sanity);
+#else
+ float __f = static_cast<float>(strtod(__xtrc, &__sanity));
+#endif
+ if (!(__err & ios_base::failbit)
+ && __sanity != __xtrc && *__sanity == '\0' && errno == 0)
+ __v = __f;
+ else
+ __err |= ios_base::failbit;
+
+ return __beg;
+ }
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, double& __v) const
+ {
+ // Stage 1: extract and determine the conversion specifier.
+ // Assuming leading zeros eliminated, thus the size of 256 for
+ // floating-point types.
+ char __xtrc[32]= {'\0'};
+ int __base;
+ _M_extract(__beg, __end, __io, __err, __xtrc, __base, true);
+
+ // Stage 2: convert and store results.
+ char* __sanity;
+ errno = 0;
+ double __d = strtod(__xtrc, &__sanity);
+ if (!(__err & ios_base::failbit)
+ && __sanity != __xtrc && *__sanity == '\0' && errno == 0)
+ __v = __d;
+ else
+ __err |= ios_base::failbit;
+
+ return __beg;
+ }
+
+#if defined(_GLIBCPP_HAVE_STRTOLD) && !defined(__hpux)
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, long double& __v) const
+ {
+ // Stage 1: extract and determine the conversion specifier.
+ // Assuming leading zeros eliminated, thus the size of 256 for
+ // floating-point types.
+ char __xtrc[32]= {'\0'};
+ int __base;
+ _M_extract(__beg, __end, __io, __err, __xtrc, __base, true);
+
+ // Stage 2: convert and store results.
+ char* __sanity;
+ errno = 0;
+ long double __ld = strtold(__xtrc, &__sanity);
+ if (!(__err & ios_base::failbit)
+ && __sanity != __xtrc && *__sanity == '\0' && errno == 0)
+ __v = __ld;
+ else
+ __err |= ios_base::failbit;
+
+ return __beg;
+ }
+#else
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, long double& __v) const
+ {
+ // Stage 1: extract
+ char __xtrc[32]= {'\0'};
+ int __base;
+ _M_extract(__beg, __end, __io, __err, __xtrc, __base, true);
+
+ // Stage 2: determine a conversion specifier.
+ ios_base::fmtflags __basefield = __io.flags() & ios_base::basefield;
+ const char* __conv;
+ if (__basefield == ios_base::oct)
+ __conv = "%Lo";
+ else if (__basefield == ios_base::hex)
+ __conv = "%LX";
+ else if (__basefield == 0)
+ __conv = "%Li";
+ else
+ __conv = "%Lg";
+
+ // Stage 3: store results.
+ long double __ld;
+ int __p = sscanf(__xtrc, __conv, &__ld);
+ if (__p
+ && static_cast<__traits_type::int_type>(__p) != __traits_type::eof())
+ __v = __ld;
+ else
+ __err |= ios_base::failbit;
+
+ return __beg;
+ }
+#endif
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, void*& __v) const
+ {
+ // Prepare for hex formatted input
+ typedef ios_base::fmtflags fmtflags;
+ fmtflags __fmt = __io.flags();
+ fmtflags __fmtmask = ~(ios_base::showpos | ios_base::basefield
+ | ios_base::uppercase | ios_base::internal);
+ __io.flags(__fmt & __fmtmask | (ios_base::hex | ios_base::showbase));
+
+ // Stage 1: extract and determine the conversion specifier.
+ // Assuming leading zeros eliminated, thus the size of 32 for
+ // integral types.
+ char __xtrc[32]= {'\0'};
+ int __base;
+ _M_extract(__beg, __end, __io, __err, __xtrc, __base, false);
+
+ // Stage 2: convert and store results.
+ char* __sanity;
+ errno = 0;
+ void* __vp = reinterpret_cast<void*>(strtoul(__xtrc, &__sanity, __base));
+ if (!(__err & ios_base::failbit)
+ && __sanity != __xtrc && *__sanity == '\0' && errno == 0)
+ __v = __vp;
+ else
+ __err |= ios_base::failbit;
+
+ // Reset from hex formatted input
+ __io.flags(__fmt);
+ return __beg;
+ }
+
+ template <typename _CharT, typename _OutIter>
+ locale::id num_put<_CharT, _OutIter>::id;
+
+ // _S_fill is specialized for ostreambuf_iterator, random access iterator.
+ template <typename _CharT, typename _OutIter>
+ inline _OutIter
+ _S_fill(_OutIter __s, _CharT __fill, int __padding);
+
+ template <typename _CharT, typename _RaIter>
+ _RaIter
+ _S_fill(_RaIter __s, _CharT __fill, int __padding,
+ random_access_iterator_tag)
+ {
+ fill_n(__s, __fill);
+ return __s + __padding;
+ }
+
+ template <typename _CharT, typename _OutIter, typename _Tag>
+ _OutIter
+ _S_fill(_OutIter __s, _CharT __fill, int __padding, _Tag)
+ {
+ while (--__padding >= 0) { *__s = __fill; ++__s; }
+ return __s;
+ }
+
+ template <typename _CharT, typename _OutIter>
+ inline _OutIter
+ _S_fill(_OutIter __s, _CharT __fill, int __padding)
+ {
+ return _S_fill(__s, __fill, __padding,
+ iterator_traits<_OutIter>::iterator_category());
+ }
+
+ template <typename _CharT, typename _OutIter>
+ _OutIter
+ _S_pad_numeric(_OutIter __s, ios_base::fmtflags __flags,
+ _CharT __fill, int __width, _CharT const* __first,
+ _CharT const* __middle, _CharT const* __last)
+ {
+ int __padding = __width - (__last - __first);
+ if (__padding < 0)
+ __padding = 0;
+ ios_base::fmtflags __aflags = __flags & ios_base::adjustfield;
+ bool __testfield = __padding == 0 || __aflags == ios_base::left
+ || __aflags == ios_base::internal;
+
+ // This was needlessly complicated.
+ if (__first != __middle)
+ {
+ if (!__testfield)
+ {
+ _S_fill(__s, __fill, __padding);
+ __padding = 0;
+ }
+ copy(__first, __middle, __s);
+ }
+ _OutIter __s2 = __s;
+
+ if (__padding && __aflags != ios_base::left)
+ {
+ _S_fill(__s2, __fill, __padding);
+ __padding = 0;
+ }
+ _OutIter __s3 = copy(__middle, __last, __s2);
+ if (__padding)
+ _S_fill(__s3, __fill, __padding);
+ return __s3;
+ }
+
+ template <typename _CharT, typename _OutIter>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const
+ {
+ const _Format_cache<_CharT>* __fmt = _Format_cache<_CharT>::_S_get(__io);
+ ios_base::fmtflags __flags = __io.flags();
+
+ if ((__flags & ios_base::boolalpha) == 0)
+ {
+ unsigned long __uv = __v;
+ return _S_format(__s, __io, __fill, false, __uv);
+ }
+ else
+ {
+ const char_type* __first;
+ const char_type* __last;
+ if (__v)
+ {
+ __first = __fmt->_M_truename.data();
+ __last = __first + __fmt->_M_truename.size();
+ }
+ else
+ {
+ __first = __fmt->_M_falsename.data();
+ __last = __first + __fmt->_M_falsename.size();
+ }
+ copy(__first, __last, __s);
+ }
+ return __s;
+ }
+
+ // _S_group_digits inserts "group separator" characters into an array
+ // of characters. It's recursive, one iteration per group. It moves
+ // the characters in the buffer this way: "xxxx12345" -> "12,345xxx".
+ // Call this only with __grouping != __grend.
+ template <typename _CharT>
+ _CharT*
+ _S_group_digits(_CharT* __s, _CharT __grsep, char const* __grouping,
+ char const* __grend, _CharT const* __first,
+ _CharT const* __last)
+ {
+ if (__last - __first > *__grouping)
+ {
+ __s = _S_group_digits(__s, __grsep,
+ (__grouping + 1 == __grend ? __grouping : __grouping + 1),
+ __grend, __first, __last - *__grouping);
+ __first = __last - *__grouping;
+ *__s++ = __grsep;
+ }
+ do
+ {
+ *__s++ = *__first++;
+ }
+ while (__first != __last);
+ return __s;
+ }
+
+ template <typename _CharT, typename _OutIter, typename _ValueT>
+ _OutIter
+ _S_format(_OutIter __s, ios_base& __io, _CharT __fill, bool __neg,
+ _ValueT __v)
+ {
+ // Leave room for "+/-," "0x," and commas.
+ const long _M_room = numeric_limits<_ValueT>::digits10 * 2 + 4;
+ _CharT __digits[_M_room];
+ _CharT* __front = __digits + _M_room;
+ ios_base::fmtflags __flags = __io.flags();
+ const _Format_cache<_CharT>* __fmt = _Format_cache<_CharT>::_S_get(__io);
+ char const* __table = __fmt->_S_literals + __fmt->_S_digits;
+
+ ios_base::fmtflags __basefield = (__flags & __io.basefield);
+ _CharT* __sign_end = __front;
+ if (__basefield == ios_base::hex)
+ {
+ if (__flags & ios_base::uppercase)
+ __table += 16; // use ABCDEF
+ do
+ *--__front = __table[__v & 15];
+ while ((__v >>= 4) != 0);
+ __sign_end = __front;
+ if (__flags & ios_base::showbase)
+ {
+ *--__front = __fmt->_S_literals[__fmt->_S_ecks +
+ ((__flags & ios_base::uppercase) ? 1 : 0)];
+ *--__front = __table[0];
+ }
+ }
+ else if (__basefield == ios_base::oct)
+ {
+ do
+ *--__front = __table[__v & 7];
+ while ((__v >>= 3) != 0);
+ if (__flags & ios_base::showbase
+ && static_cast<char>(*__front) != __table[0])
+ *--__front = __table[0];
+ __sign_end = __front;
+ }
+ else
+ {
+ // NB: This is _lots_ faster than using ldiv.
+ do
+ *--__front = __table[__v % 10];
+ while ((__v /= 10) != 0);
+ __sign_end = __front;
+ // NB: ios_base:hex || ios_base::oct assumed to be unsigned.
+ if (__neg || (__flags & ios_base::showpos))
+ *--__front = __fmt->_S_literals[__fmt->_S_plus - __neg];
+ }
+
+ // XXX should specialize!
+ if (!__fmt->_M_use_grouping && !__io.width())
+ return copy(__front, __digits + _M_room, __s);
+
+ if (!__fmt->_M_use_grouping)
+ return _S_pad_numeric(__s, __flags, __fill, __io.width(0),
+ __front, __sign_end, __digits + _M_room);
+
+ _CharT* __p = __digits;
+ while (__front < __sign_end)
+ *__p++ = *__front++;
+ const char* __gr = __fmt->_M_grouping.data();
+ __front = _S_group_digits(__p, __fmt->_M_thousands_sep, __gr,
+ __gr + __fmt->_M_grouping.size(), __sign_end, __digits + _M_room);
+ return _S_pad_numeric(__s, __flags, __fill, __io.width(0),
+ __digits, __p, __front);
+ }
+
+ template <typename _CharT, typename _OutIter>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ do_put(iter_type __s, ios_base& __io, char_type __fill, long __v) const
+ {
+ unsigned long __uv = __v;
+ bool __neg = false;
+ if (__v < 0)
+ {
+ __neg = true;
+ __uv = -__uv;
+ }
+ return _S_format(__s, __io, __fill, __neg, __uv);
+ }
+
+ template <typename _CharT, typename _OutIter>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ do_put(iter_type __s, ios_base& __io, char_type __fill,
+ unsigned long __v) const
+ { return _S_format(__s, __io, __fill, false, __v); }
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ template <typename _CharT, typename _OutIter>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ do_put(iter_type __s, ios_base& __b, char_type __fill, long long __v) const
+ {
+ unsigned long long __uv = __v;
+ bool __neg = false;
+ if (__v < 0)
+ {
+ __neg = true;
+ __uv = -__uv;
+ }
+ return _S_format(__s, __b, __fill, __neg, __uv);
+ }
+
+ template <typename _CharT, typename _OutIter>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ do_put(iter_type __s, ios_base& __io, char_type __fill,
+ unsigned long long __v) const
+ { return _S_format(__s, __io, __fill, false, __v); }
+#endif
+
+ // The following code uses sprintf() to convert floating point
+ // values for insertion into a stream. The current implementation
+ // replicates the code in _S_pad_numeric() (in _S_output_float()) in
+ // order to prevent having to create a "wide" buffer in addition to
+ // the "narrow" buffer passed to sprintf(). An optimization would be
+ // to replace sprintf() with code that works directly on a wide
+ // buffer and then use _S_pad_numeric() to do the padding. It would
+ // be good to replace sprintf() anyway to avoid accidental buffer
+ // overruns and to gain back the efficiency that C++ provides by
+ // knowing up front the type of the values to insert. This
+ // implementation follows the C++ standard fairly directly as
+ // outlined in 22.2.2.2 [lib.locale.num.put]
+ bool
+ _S_build_float_format(ios_base& __io, char* __fptr, char __modifier,
+ streamsize __prec)
+ {
+ bool __incl_prec = false;
+ ios_base::fmtflags __flags = __io.flags();
+ *__fptr++ = '%';
+ // [22.2.2.2.2] Table 60
+ if (__flags & ios_base::showpos)
+ *__fptr++ = '+';
+ if (__flags & ios_base::showpoint)
+ *__fptr++ = '#';
+ // As per [22.2.2.2.2.11]
+ if (__flags & ios_base::fixed || __prec > 0)
+ {
+ *__fptr++ = '.';
+ *__fptr++ = '*';
+ __incl_prec = true;
+ }
+ if (__modifier)
+ *__fptr++ = __modifier;
+ ios_base::fmtflags __fltfield = __flags & ios_base::floatfield;
+ // [22.2.2.2.2] Table 58
+ if (__fltfield == ios_base::fixed)
+ *__fptr++ = 'f';
+ else if (__fltfield == ios_base::scientific)
+ *__fptr++ = (__flags & ios_base::uppercase) ? 'E' : 'e';
+ else
+ *__fptr++ = (__flags & ios_base::uppercase) ? 'G' : 'g';
+ *__fptr = '\0';
+ return __incl_prec;
+ }
+
+ template<typename _CharT,typename _OutIter>
+ _OutIter
+ _S_output_float(_OutIter __s, ios_base& __io,_CharT __fill,
+ const char* __sptr, size_t __slen)
+ {
+ size_t __padding = __io.width() > streamsize(__slen) ?
+ __io.width() -__slen : 0;
+ locale __loc = __io.getloc();
+ ctype<_CharT> const& __ct = use_facet<ctype<_CharT> >(__loc);
+ ios_base::fmtflags __adjfield = __io.flags() & ios_base::adjustfield;
+ const char* const __eptr = __sptr + __slen;
+ // [22.2.2.2.2.19] Table 61
+ if (__adjfield == ios_base::internal)
+ {
+ // [22.2.2.2.2.14]; widen()
+ if (__sptr < __eptr && (*__sptr == '+' || *__sptr == '-'))
+ {
+ __s = __ct.widen(*__sptr);
+ ++__s;
+ ++__sptr;
+ }
+ __s = _S_fill(__s, __fill, __padding);
+ __padding = 0;
+ }
+ else if (__adjfield != ios_base::left)
+ {
+ __s = _S_fill(__s, __fill, __padding);
+ __padding = 0;
+ }
+ // the "C" locale decimal character
+ char __decimal_point = *(localeconv()->decimal_point);
+ const _Format_cache<_CharT>* __fmt = _Format_cache<_CharT>::_S_get(__io);
+ for (; __sptr != __eptr; ++__s, ++__sptr)
+ {
+ // [22.2.2.2.2.17]; decimal point conversion
+ if (*__sptr == __decimal_point)
+ __s = __fmt->_M_decimal_point;
+ // [22.2.2.2.2.14]; widen()
+ else
+ __s = __ct.widen(*__sptr);
+ }
+ // [22.2.2.2.2.19] Table 61
+ if (__padding)
+ _S_fill(__s, __fill, __padding);
+ __io.width(0);
+ return __s;
+ }
+
+ template <typename _CharT, typename _OutIter>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const
+ {
+ const streamsize __max_prec = numeric_limits<double>::digits10 + 3;
+ streamsize __prec = __io.precision();
+ // Protect against sprintf() buffer overflows.
+ if (__prec > __max_prec)
+ __prec = __max_prec;
+ // The *2 provides for signs, exp, 'E', and pad.
+ char __sbuf[__max_prec*2];
+ size_t __slen;
+ // Long enough for the max format spec.
+ char __fbuf[16];
+ if (_S_build_float_format(__io, __fbuf, 0, __prec))
+ __slen = sprintf(__sbuf, __fbuf, __prec, __v);
+ else
+ __slen = sprintf(__sbuf, __fbuf, __v);
+ // [22.2.2.2.2] Stages 2-4.
+ return _S_output_float(__s, __io, __fill, __sbuf, __slen);
+ }
+
+ template <typename _CharT, typename _OutIter>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ do_put(iter_type __s, ios_base& __io, char_type __fill,
+ long double __v) const
+ {
+ const streamsize __max_prec = numeric_limits<long double>::digits10 + 3;
+ streamsize __prec = __io.precision();
+ // Protect against sprintf() buffer overflows.
+ if (__prec > __max_prec)
+ __prec = __max_prec;
+ // The *2 provides for signs, exp, 'E', and pad.
+ char __sbuf[__max_prec*2];
+ size_t __slen;
+ // Long enough for the max format spec.
+ char __fbuf[16];
+ // 'L' as per [22.2.2.2.2] Table 59
+ if ( _S_build_float_format(__io, __fbuf, 'L', __prec))
+ __slen = sprintf(__sbuf, __fbuf, __prec, __v);
+ else
+ __slen = sprintf(__sbuf, __fbuf, __v);
+ // [22.2.2.2.2] Stages 2-4
+ return _S_output_float(__s, __io, __fill, __sbuf, __slen);
+ }
+
+ template <typename _CharT, typename _OutIter>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ do_put(iter_type __s, ios_base& __io, char_type __fill,
+ const void* __v) const
+ {
+ typedef ios_base::fmtflags fmtflags;
+ fmtflags __fmt = __io.flags();
+ fmtflags __fmtmask = ~(ios_base::showpos | ios_base::basefield
+ | ios_base::uppercase | ios_base::internal);
+ __io.flags(__fmt & __fmtmask | (ios_base::hex | ios_base::showbase));
+ try {
+ _OutIter __s2 = _S_format(__s, __io, __fill, false,
+ reinterpret_cast<unsigned long>(__v));
+ __io.flags(__fmt);
+ return __s2;
+ }
+ catch (...) {
+ __io.flags(__fmt);
+ throw;
+ }
+ }
+
+ template<typename _CharT>
+ locale::id numpunct<_CharT>::id;
+
+ template<typename _CharT>
+ locale::id collate<_CharT>::id;
+
+ // Support for time_get:
+ // Note that these partial specializations could, and maybe should,
+ // be changed to full specializations (by eliminating the _Dummy
+ // argument) and moved to a .cc file.
+ template<typename _CharT, typename _Dummy = int>
+ struct _Weekdaynames;
+
+ template<typename _Dummy>
+ struct _Weekdaynames<char, _Dummy>
+ { static const char* const _S_names[14]; };
+
+ template<typename _Dummy>
+ const char* const
+ _Weekdaynames<char,_Dummy>::_S_names[14] =
+ {
+ "Sun", "Sunday",
+ "Mon", "Monday", "Tue", "Tuesday", "Wed", "Wednesday",
+ "Thu", "Thursday", "Fri", "Friday", "Sat", "Saturday"
+ };
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<typename _Dummy>
+ struct _Weekdaynames<wchar_t,_Dummy>
+ { static const wchar_t* const _S_names[14]; };
+
+ template<typename _Dummy>
+ const wchar_t* const
+ _Weekdaynames<wchar_t,_Dummy>::_S_names[14] =
+ {
+ L"Sun", L"Sunday",
+ L"Mon", L"Monday", L"Tue", L"Tuesday", L"Wed", L"Wednesday",
+ L"Thu", L"Thursday", L"Fri", L"Friday", L"Sat", L"Saturday"
+ };
+#endif
+
+ template<typename _CharT, typename _Dummy = int>
+ struct _Monthnames;
+
+ template<typename _Dummy>
+ struct _Monthnames<char,_Dummy>
+ { static const char* const _S_names[24]; };
+
+ template<typename _Dummy>
+ const char* const
+ _Monthnames<char,_Dummy>::_S_names[24] =
+ {
+ "Jan", "January", "Feb", "February", "Mar", "March",
+ "Apr", "April", "May", "May", "Jun", "June",
+ "Jul", "July", "Aug", "August", "Sep", "September",
+ "Oct", "October", "Nov", "November", "Dec", "December"
+ };
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<typename _Dummy>
+ struct _Monthnames<wchar_t, _Dummy>
+ { static const wchar_t* const _S_names[24]; };
+
+ template<typename _Dummy>
+ const wchar_t* const
+ _Monthnames<wchar_t,_Dummy>::_S_names[24] =
+ {
+ L"Jan", L"January", L"Feb", L"February", L"Mar", L"March",
+ L"Apr", L"April", L"May", L"May", L"Jun", L"June",
+ L"Jul", L"July", L"Aug", L"August", L"Sep", L"September",
+ L"Oct", L"October", L"Nov", L"November", L"Dec", L"December"
+ };
+#endif
+
+ template<typename _CharT, typename _InIter>
+ locale::id time_get<_CharT, _InIter>::id;
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ time_get<_CharT, _InIter>::
+ do_get_weekday(iter_type __s, iter_type __end,
+ ios_base& __io, ios_base::iostate& __err, tm* __t) const
+ {
+ if (!_M_daynames)
+ {
+ _M_daynames = new basic_string<_CharT>[14];
+ for (int __i = 0; __i < 14; ++__i)
+ _M_daynames[__i] = _Weekdaynames<_CharT>::_S_names[__i];
+ }
+ bool __at_eof = false;
+ int __remain = 0;
+ int __matches[14];
+ iter_type __out = __match_parallel(__s, __end, 14, _M_daynames,
+ __matches, __remain, __at_eof);
+ __err = ios_base::iostate(0);
+ if (__at_eof) __err |= __io.eofbit;
+ if (__remain == 1 ||
+ __remain == 2 && (__matches[0]>>1) == (__matches[1]>>1))
+ __t->tm_wday = (__matches[0]>>1);
+ else
+ __err |= __io.failbit;
+ return __out;
+ }
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ time_get<_CharT, _InIter>::
+ do_get_monthname(iter_type __s, iter_type __end,
+ ios_base& __io, ios_base::iostate& __err, tm* __t) const
+ {
+ if (!_M_monthnames)
+ {
+ _M_monthnames = new basic_string<_CharT>[24];
+ for (int __i = 0; __i < 24; ++__i)
+ _M_monthnames[__i] = _Monthnames<_CharT>::_S_names[__i];
+ }
+ bool __at_eof = false;
+ int __remain = 0;
+ int __matches[24];
+ iter_type __out = __match_parallel( __s, __end, 24, _M_monthnames,
+ __matches, __remain, __at_eof);
+ __err = ios_base::iostate(0);
+ if (__at_eof) __err |= __io.eofbit;
+ if (__remain == 1 ||
+ __remain == 2 && (__matches[0]>>1) == (__matches[1]>>1))
+ __t->tm_mon = (__matches[0]>>1);
+ else
+ __err |= __io.failbit;
+ return __out;
+ }
+
+ template<typename _CharT, typename _OutIter>
+ locale::id time_put<_CharT, _OutIter>::id;
+
+ template<typename _CharT, typename _InIter>
+ locale::id money_get<_CharT, _InIter>::id;
+
+ template<typename _CharT, typename _OutIter>
+ locale::id money_put<_CharT, _OutIter>::id;
+
+ template<typename _CharT, bool _Intl>
+ locale::id moneypunct<_CharT,_Intl>::id;
+
+ template<typename _CharT>
+ locale::id messages<_CharT>::id;
+
+ template<>
+ const ctype<char>&
+ use_facet<const ctype<char> > (const locale& __loc)
+ {
+ size_t __i = ctype<char>::id._M_index;
+ const locale::_Impl* __tmp = __loc._M_impl;
+ return static_cast<const ctype<char>&>(* (*(__tmp->_M_facets))[__i]);
+ }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ const ctype<wchar_t>&
+ use_facet< const ctype<wchar_t> > (const locale& __loc)
+ {
+ size_t __i = ctype<wchar_t>::id._M_index;
+ const locale::_Impl* __tmp = __loc._M_impl;
+ return static_cast<const ctype<wchar_t>&>(* (*(__tmp->_M_facets))[__i]);
+ }
+#endif
+
+} // std::
+
+#endif /* _CPP_BITS_LOCFACETS_TCC */
+
+// Local Variables:
+// mode:c++
+// End:
+
+
+
+
+
diff --git a/libstdc++-v3/bits/localefwd.h b/libstdc++-v3/bits/localefwd.h
new file mode 100644
index 000000000000..7f12457c8bc2
--- /dev/null
+++ b/libstdc++-v3/bits/localefwd.h
@@ -0,0 +1,497 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+#ifndef _CPP_BITS_LOCCORE_H
+#define _CPP_BITS_LOCCORE_H 1
+
+#include <bits/c++config.h>
+#include <bits/std_climits.h> // For CHAR_BIT
+#include <bits/std_string.h> // For string
+#include <bits/std_cctype.h> // For isspace, etc.
+
+namespace std
+{
+
+ // _Count_ones: compile-time computation of number of 1-bits in a value N
+ // This takes only 5 (or 6) instantiations, doing recursive descent
+ // in parallel -- ncm
+ template<unsigned _Num, int _Shift = (sizeof(unsigned) * CHAR_BIT)/2,
+ unsigned _Mask = (~0u >> _Shift) >
+ struct _Count_ones;
+
+ template<unsigned _Num, unsigned _Mask>
+ struct _Count_ones<_Num,0,_Mask>
+ { static const unsigned _S_count = _Num; };
+
+ template<unsigned _Num, int _Shift, unsigned _Mask>
+ struct _Count_ones
+ {
+ static const unsigned _S_halfcount =
+ _Count_ones<_Num, _Shift/2, (_Mask^((~_Mask)>>(_Shift/2))) >::_S_count;
+ static const unsigned _S_count
+ = (_S_halfcount&_Mask) + ((_S_halfcount>>_Shift)&_Mask);
+ };
+
+ // 22.1.1 Locale
+ template<typename _Tp> class allocator;
+ template<typename _Tp, typename _Alloc> class vector;
+ class locale;
+
+ template<typename _Facet>
+ const _Facet&
+ use_facet(const locale&);
+
+ template<typename _Facet>
+ bool
+ has_facet(const locale&) throw();
+
+ // 22.1.3 Convenience interfaces
+ template<typename _CharT>
+ inline bool
+ isspace(_CharT, const locale&);
+
+ template<typename _CharT>
+ inline bool
+ isprint(_CharT, const locale&);
+
+ template<typename _CharT>
+ inline bool
+ iscntrl(_CharT, const locale&);
+
+ template<typename _CharT>
+ inline bool
+ isupper(_CharT, const locale&);
+
+ template<typename _CharT>
+ inline bool
+ islower(_CharT, const locale&);
+
+ template<typename _CharT>
+ inline bool
+ isalpha(_CharT, const locale&);
+
+ template<typename _CharT>
+ inline bool
+ isdigit(_CharT, const locale&);
+
+ template<typename _CharT>
+ inline bool
+ ispunct(_CharT, const locale&);
+
+ template<typename _CharT>
+ inline bool
+ isxdigit(_CharT, const locale&);
+
+ template<typename _CharT>
+ inline bool
+ isalnum(_CharT, const locale&);
+
+ template<typename _CharT>
+ inline bool
+ isgraph(_CharT, const locale&);
+
+ template<typename _CharT>
+ inline _CharT
+ toupper(_CharT, const locale&);
+
+ template<typename _CharT>
+ inline _CharT
+ tolower(_CharT, const locale&);
+
+
+ // 22.2.1 and 22.2.1.3 ctype
+ class ctype_base;
+ template<typename _CharT>
+ class ctype;
+ template<> class ctype<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<> class ctype<wchar_t>;
+#endif
+
+ template<typename _CharT>
+ class ctype_byname;
+ // NB: Specialized for char and wchar_t in locfacets.h.
+
+ class codecvt_base;
+ template<typename _InternT, typename _ExternT, typename _StateT>
+ class codecvt;
+ template<> class codecvt<char, char, mbstate_t>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<> class codecvt<wchar_t, char, mbstate_t>;
+#endif
+
+ template<typename _InternT, typename _ExternT, typename _StateT>
+ class codecvt_byname;
+ template<> class codecvt_byname<char, char, mbstate_t>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<> class codecvt_byname<wchar_t, char, mbstate_t>;
+#endif
+
+ // 22.2.2 and 22.2.3 numeric
+ template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
+ class num_get;
+ template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
+ class num_put;
+ template<typename _CharT> class numpunct;
+ template<typename _CharT> class numpunct_byname;
+
+ // 22.2.4 collation
+ template<typename _CharT>
+ class collate;
+ template<> class collate<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<> class collate<wchar_t>;
+#endif
+ template<typename _CharT> class
+ collate_byname;
+
+ // 22.2.5 date and time
+ class time_base;
+ template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
+ class time_get;
+ template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
+ class time_get_byname;
+ template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
+ class time_put;
+ template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
+ class time_put_byname;
+
+ // 22.2.6 money
+ class money_base;
+ template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
+ class money_get;
+ template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
+ class money_put;
+ template<typename _CharT, bool _Intl = false>
+ class moneypunct;
+ template<typename _CharT, bool _Intl = false>
+ class moneypunct_byname;
+
+ // 22.2.7 message retrieval
+ class messages_base;
+ template<typename _CharT>
+ class messages;
+ template<typename _CharT>
+ class messages_byname;
+
+
+ // 22.1.1 Class locale
+ class locale
+ {
+ // Forwrd decls and friends:
+ class _Impl;
+ friend _Impl;
+
+ template<typename _Facet>
+ friend const _Facet&
+ use_facet(const locale&);
+
+ template<typename _Facet>
+ friend bool
+ has_facet(const locale&) throw();
+
+ public:
+ // Types:
+ class facet;
+ class id;
+ typedef int category;
+
+ // Category values:
+ // NB much depends on the order in which these appear:
+ static const category none = 0;
+ static const category collate = 0x0100;
+ static const category ctype = 0x0200;
+ static const category monetary = 0x0400;
+ static const category numeric = 0x0800;
+ static const category time = 0x1000;
+ static const category messages = 0x2000;
+ static const category all = (collate | ctype | monetary |
+ numeric | time | messages);
+
+ // Construct/copy/destroy:
+ inline
+ locale() throw();
+
+ inline
+ locale(const locale& __other) throw();
+
+ explicit
+ locale(const char* __std_name);
+
+ locale(const locale& __other, const char* __std_name, category __cats);
+
+ locale(const locale& __other, const locale& __one, category __cats);
+
+ template<typename _Facet>
+ locale(const locale& __other, _Facet* __f);
+
+ inline
+ ~locale() throw();
+
+ const locale&
+ operator=(const locale& __other) throw();
+
+ template<typename _Facet>
+ locale
+ combine(const locale& __other);
+
+ // Locale operations:
+ string
+ name() const;
+
+ bool
+ operator==(const locale& __other) const throw ();
+
+ inline bool
+ operator!=(const locale& __other) const throw ()
+ { return !(operator==(__other)); }
+
+ template<typename _Char, typename _Traits, typename _Alloc>
+ bool
+ operator()(const basic_string<_Char,_Traits,_Alloc>& __s1,
+ const basic_string<_Char,_Traits,_Alloc>& __s2) const;
+
+ // Global locale objects:
+ static locale
+ global(const locale&);
+
+ static const locale&
+ classic();
+
+ private:
+ _Impl* _M_impl; // The (shared) implementation
+
+ static _Impl* _S_classic; // The one true C reference locale
+ static _Impl* _S_global; // Current global reference locale
+
+ explicit
+ locale(_Impl*) throw();
+
+ static inline void
+ _S_initialize()
+ { if (!_S_classic) classic(); }
+
+ static int
+ _S_normalize_category(int);
+
+ static const int
+ _S_num_categories = _Count_ones<all>::_S_count;
+ };
+
+
+ // locale implementation object
+ class locale::_Impl
+ {
+ typedef vector<facet*, allocator<facet*> > __vec_facet;
+ typedef vector<string, allocator<string> > __vec_string;
+
+ // Friends:
+ friend class locale;
+ friend class facet;
+
+ template<typename _Facet>
+ friend const _Facet&
+ use_facet(const locale&);
+
+ template<typename _Facet>
+ friend bool
+ has_facet(const locale&) throw();
+
+ size_t _M_num_references;
+ __vec_facet* _M_facets;
+ __vec_string* _M_category_names;
+ bool _M_has_name;
+ bool _M_cached_name_ok;
+ string _M_cached_name;
+
+ inline void
+ _M_add_reference() throw()
+ { ++_M_num_references; } // XXX MT
+
+ inline void
+ _M_remove_reference() throw()
+ {
+ if (_M_num_references-- == 0) // XXX MT
+ {
+ try {
+ delete this;
+ }
+ catch(...) {
+ }
+ }
+ }
+
+ _Impl(const _Impl&, size_t __refs);
+ _Impl(const _Impl&, const string&, category, size_t __refs);
+ _Impl(size_t __facets, size_t __refs);
+ ~_Impl() throw();
+
+ void
+ _M_replace_categories(const _Impl*, category);
+
+ void
+ _M_replace_category(const _Impl*, const locale::id* const*);
+
+ void
+ _M_replace_facet(const _Impl*, const locale::id*);
+
+ void
+ _M_install_facet(const locale::id*, facet*);
+
+ template<typename _Facet>
+ inline void
+ _M_init_facet(_Facet* __facet)
+ { _M_install_facet(&_Facet::id, __facet); }
+
+ void
+ _M_construct_collate(const char*);
+
+ void
+ _M_construct_ctype(const char*);
+
+ void
+ _M_construct_monetary(const char*);
+
+ void
+ _M_construct_numeric(const char*);
+
+ void
+ _M_construct_time(const char*);
+
+ void
+ _M_construct_messages(const char*);
+
+ category
+ _M_normalize_category_names(const string&, category __cats);
+
+ static const locale::id* const _S_id_collate[];
+ static const locale::id* const _S_id_ctype[];
+ static const locale::id* const _S_id_monetary[];
+ static const locale::id* const _S_id_numeric[];
+ static const locale::id* const _S_id_time[];
+ static const locale::id* const _S_id_messages[];
+ static const locale::id* const* const _S_facet_categories[];
+ };
+
+ // class locale inlines, that need declaration of locale::_Imp
+ locale::locale() throw()
+ {
+ _S_initialize();
+ (_M_impl = _S_global)->_M_add_reference();
+ } // XXX MT
+
+ locale::locale(const locale& __other) throw()
+ { (_M_impl = __other._M_impl)->_M_add_reference(); }
+
+ template<typename _Facet>
+ locale::locale(const locale& __other, _Facet* __f)
+ {
+ _M_impl = new _Impl(*__other._M_impl, 0);
+ _M_impl->_M_install_facet(&_Facet::id, __f);
+ _M_impl->_M_has_name = false;
+ }
+
+ locale::~locale() throw()
+ { _M_impl->_M_remove_reference(); }
+
+ // 22.1.1.1.2 Class locale::facet
+ class locale::facet
+ {
+ friend class locale;
+ friend class locale::_Impl;
+
+ protected:
+ explicit
+ facet(size_t __refs = 0) throw();
+
+ virtual
+ ~facet() {};
+
+ private:
+ size_t _M_num_references;
+
+ void
+ _M_add_reference() throw();
+
+ void
+ _M_remove_reference() throw();
+
+ facet(const facet&); // not defined
+
+ void
+ operator=(const facet&); // not defined
+ };
+
+
+ // 22.1.1.1.3 Class locale::id
+ class locale::id
+ {
+ friend class locale;
+ friend class locale::_Impl;
+ template<typename _Facet>
+ friend const _Facet&
+ use_facet(const locale&);
+ template<typename _Facet>
+ friend bool
+ has_facet(const locale&) throw ();
+ public:
+ id() {};
+ private:
+ // NB: there is no accessor for _M_index because it may be used
+ // before the constructor is run; the effect of calling a member
+ // function (even an inline) would be undefined.
+ mutable size_t _M_index;
+ static size_t _S_highwater; // last id number assigned
+
+ void
+ operator=(const id&); // not defined
+
+ id(const id&); // not defined
+ };
+
+ template<typename _Facet>
+ const _Facet&
+ use_facet(const locale& __loc);
+
+ template<typename _Facet>
+ bool
+ has_facet(const locale& __loc) throw();
+
+} // namespace std
+
+#endif /* _CPP_BITS_LOCCORE_H */
+
+// Local Variables:
+// mode:c++
+// End:
+
diff --git a/libstdc++-v3/bits/mask_array.h b/libstdc++-v3/bits/mask_array.h
new file mode 100644
index 000000000000..5654a2fc09c2
--- /dev/null
+++ b/libstdc++-v3/bits/mask_array.h
@@ -0,0 +1,160 @@
+// The template and inlines for the -*- C++ -*- mask_array class.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _CPP_BITS_MASK_ARRAY_H
+#define _CPP_BITS_MASK_ARRAY_H 1
+
+namespace std {
+
+ template <class _Tp> class mask_array
+ {
+ public:
+ typedef _Tp value_type;
+
+ void operator= (const valarray<_Tp>&) const;
+ void operator*= (const valarray<_Tp>&) const;
+ void operator/= (const valarray<_Tp>&) const;
+ void operator%= (const valarray<_Tp>&) const;
+ void operator+= (const valarray<_Tp>&) const;
+ void operator-= (const valarray<_Tp>&) const;
+ void operator^= (const valarray<_Tp>&) const;
+ void operator&= (const valarray<_Tp>&) const;
+ void operator|= (const valarray<_Tp>&) const;
+ void operator<<=(const valarray<_Tp>&) const;
+ void operator>>=(const valarray<_Tp>&) const;
+ void operator= (const _Tp&);
+
+ // ~mask_array ();
+
+ template<class _Dom>
+ void operator= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator*= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator/= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator%= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator+= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator-= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator^= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator&= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator|= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator<<=(const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator>>=(const _Expr<_Dom,_Tp>&) const;
+
+ private:
+ mask_array (_Array<_Tp>, size_t, _Array<bool>);
+ friend class valarray<_Tp>;
+
+ const size_t _M_sz;
+ const _Array<bool> _M_mask;
+ const _Array<_Tp> _M_array;
+
+ mask_array (const mask_array&);
+
+ // not implemented
+ mask_array ();
+ mask_array& operator= (const mask_array&);
+ };
+
+
+ template<typename _Tp>
+ inline mask_array<_Tp>::mask_array (const mask_array<_Tp>& a)
+ : _M_sz (a._M_sz), _M_mask (a._M_mask), _M_array (a._M_array) {}
+
+ template<typename _Tp>
+ inline
+ mask_array<_Tp>::mask_array (_Array<_Tp> __a, size_t __s, _Array<bool> __m)
+ : _M_sz (__s), _M_mask (__m), _M_array (__a) {}
+
+ // template<typename _Tp>
+ // inline mask_array<_Tp>::~mask_array () {}
+
+ template<typename _Tp>
+ inline void
+ mask_array<_Tp>::operator= (const _Tp& __t)
+ { __valarray_fill (_M_array, _M_sz, _M_mask, __t); }
+
+ template<typename _Tp>
+ inline void
+ mask_array<_Tp>::operator= (const valarray<_Tp>& __v) const
+ { __valarray_copy (_Array<_Tp> (__v), __v.size (), _M_array, _M_mask); }
+
+ template<typename _Tp>
+ template<class E>
+ inline void
+ mask_array<_Tp>::operator= (const _Expr<E, _Tp>& __e) const
+ { __valarray_copy (__e, __e.size (), _M_array, _M_mask); }
+
+#undef _DEFINE_VALARRAY_OPERATOR
+#define _DEFINE_VALARRAY_OPERATOR(op, name) \
+template<typename _Tp> \
+inline void \
+mask_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const \
+{ \
+ _Array_augmented_##name (_M_array, _M_mask, \
+ _Array<_Tp> (__v), __v.size ()); \
+} \
+ \
+template<typename _Tp> template<class E> \
+inline void \
+mask_array<_Tp>::operator##op##= (const _Expr<E, _Tp>& __e) const \
+{ \
+ _Array_augmented_##name (_M_array, _M_mask, __e, __e.size ()); \
+}
+
+_DEFINE_VALARRAY_OPERATOR(*, multiplies)
+_DEFINE_VALARRAY_OPERATOR(/, divides)
+_DEFINE_VALARRAY_OPERATOR(%, modulus)
+_DEFINE_VALARRAY_OPERATOR(+, plus)
+_DEFINE_VALARRAY_OPERATOR(-, minus)
+_DEFINE_VALARRAY_OPERATOR(^, xor)
+_DEFINE_VALARRAY_OPERATOR(&, and)
+_DEFINE_VALARRAY_OPERATOR(|, or)
+_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
+_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
+
+#undef _DEFINE_VALARRAY_OPERATOR
+
+} // std::
+
+#endif /* _CPP_BITS_MASK_ARRAY_H */
+
+// Local Variables:
+// mode:c++
+// End:
diff --git a/libstdc++-v3/bits/ostream.tcc b/libstdc++-v3/bits/ostream.tcc
new file mode 100644
index 000000000000..2ac775351512
--- /dev/null
+++ b/libstdc++-v3/bits/ostream.tcc
@@ -0,0 +1,673 @@
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.6.2 Output streams
+//
+
+#include <bits/std_locale.h>
+
+namespace std {
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>::sentry::
+ sentry(basic_ostream<_CharT,_Traits>& __os)
+ : _M_ok(__os.good()), _M_os(__os)
+ {
+ // XXX MT
+ if (_M_ok && __os.tie())
+ __os.tie()->flush();
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::
+ operator<<(__ostream_type& (*__pf)(__ostream_type&))
+ {
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ try {
+ __pf(*this);
+ }
+ catch(exception& __fail){
+ // 27.6.2.5.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::
+ operator<<(__ios_type& (*__pf)(__ios_type&))
+ {
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ try {
+ __pf(*this);
+ }
+ catch(exception& __fail){
+ // 27.6.2.5.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::
+ operator<<(ios_base& (*__pf)(ios_base&))
+ {
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ try {
+ __pf(*this);
+ }
+ catch(exception& __fail){
+ // 27.6.2.5.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::operator<<(bool __n)
+ {
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ try {
+ if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::operator<<(long __n)
+ {
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ try {
+ bool __f;
+ ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
+ if (__fmt & ios_base::oct || __fmt & ios_base::hex)
+ __f = _M_fnumput->put(*this, *this, this->fill(),
+ static_cast<unsigned long>(__n)).failed();
+ else
+ __f = _M_fnumput->put(*this, *this, this->fill(), __n).failed();
+
+ if (__f)
+ this->setstate(ios_base::badbit);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
+ {
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ try {
+ if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::operator<<(long long __n)
+ {
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ try {
+ bool __f;
+ ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
+ if (__fmt & ios_base::oct || __fmt & ios_base::hex)
+ __f = _M_fnumput->put(*this, *this, this->fill(),
+ static_cast<unsigned long long>(__n)).failed();
+ else
+ __f = _M_fnumput->put(*this, *this, this->fill(), __n).failed();
+
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
+ {
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ try {
+ if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+#endif
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::operator<<(double __n)
+ {
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ try {
+ if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::operator<<(long double __n)
+ {
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ try {
+ if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
+ {
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ try {
+ if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ this->setstate(ios_base::badbit);
+ if ((this->exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type* __sbin)
+ {
+ streamsize __xtrct = 0;
+ __streambuf_type* __sbout = this->rdbuf();
+ sentry __cerb(*this);
+ if (__sbin && __cerb)
+ __xtrct = _S_copy_streambufs(*this, __sbin, __sbout);
+ if (!__sbin || !__xtrct)
+ this->setstate(ios_base::failbit);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::put(char_type __c)
+ {
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ int_type __put = rdbuf()->sputc(__c);
+ if (__put != traits_type::to_int_type(__c))
+ this->setstate(ios_base::badbit);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::write(const _CharT* __s, streamsize __n)
+ {
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ streamsize __put = this->rdbuf()->sputn(__s, __n);
+ if ( __put != __n)
+ this->setstate(ios_base::badbit);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::flush()
+ {
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ if (this->rdbuf() && this->rdbuf()->pubsync() == -1)
+ this->setstate(ios_base::badbit);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_ostream<_CharT, _Traits>::pos_type
+ basic_ostream<_CharT, _Traits>::tellp()
+ {
+ pos_type __retval = pos_type(-1);
+ bool __testok = this->fail() != true;
+
+ if (__testok)
+ __retval = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out);
+ return __retval;
+ }
+
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
+ {
+ bool __testok = this->fail() != true;
+
+ if (__testok)
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+// 136. seekp, seekg setting wrong streams?
+ this->rdbuf()->pubseekpos(__pos, ios_base::out);
+#endif
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::
+ seekp(off_type __off, ios_base::seekdir __d)
+ {
+ bool __testok = this->fail() != true;
+
+ if (__testok)
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+// 136. seekp, seekg setting wrong streams?
+ rdbuf()->pubseekoff(__off, __d, ios_base::out);
+#endif
+ return *this;
+ }
+
+ // 27.6.2.5.4 Character inserters
+
+ // Construct correctly padded string, as per 22.2.2.2.2
+ // Similar in theory to _S_pad_numeric, from num_put, but it doesn't
+ // use _S_fill: perhaps it should.
+ // Assumes
+ // __newlen > __oldlen
+ // __news is allocated for __newlen size
+ template<typename _CharT, typename _Traits>
+ static void
+ _S_pad_char(basic_ios<_CharT, _Traits>& __ios,
+ _CharT* __news, const _CharT* __olds,
+ const streamsize __newlen, const streamsize __oldlen)
+ {
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+
+ int_type __plen = static_cast<size_t>(__newlen - __oldlen);
+ char_type __pads[__plen];
+ traits_type::assign(__pads, __plen, __ios.fill());
+
+ char_type* __beg;
+ char_type* __end;
+ size_t __mod = 0;
+ size_t __beglen; //either __plen or __oldlen
+ ios_base::fmtflags __fmt = __ios.flags() & ios_base::adjustfield;
+
+ if (__fmt == ios_base::left)
+ {
+ // Padding last.
+ __beg = const_cast<char_type*>(__olds);
+ __beglen = __oldlen;
+ __end = __pads;
+ }
+ else if (__fmt == ios_base::internal)
+ {
+ // Pad after the sign, if there is one.
+ // Pad after 0[xX], if there is one.
+ // Who came up with these rules, anyway? Jeeze.
+ typedef _Format_cache<_CharT> __cache_type;
+ __cache_type const* __fmt = __cache_type::_S_get(__ios);
+ const char_type* __minus = traits_type::find(__olds, __oldlen,
+ __fmt->_S_minus);
+ const char_type* __plus = traits_type::find(__olds, __oldlen,
+ __fmt->_S_plus);
+ bool __testsign = __minus || __plus;
+ bool __testhex = __olds[0] == '0'
+ && (__olds[1] == 'x' || __olds[1] == 'X');
+
+ if (__testhex)
+ {
+ __news[0] = __olds[0];
+ __news[1] = __olds[1];
+ __mod += 2;
+ __beg = const_cast<char_type*>(__olds + __mod);
+ __beglen = __oldlen - __mod;
+ __end = __pads;
+ }
+ else if (__testsign)
+ {
+ __mod += __plen;
+ const char_type* __sign = __minus ? __minus + 1: __plus + 1;
+ __beg = const_cast<char_type*>(__olds);
+ __beglen = __sign - __olds;
+ __end = const_cast<char_type*>(__sign + __plen);
+ traits_type::copy(__news + __beglen, __pads, __plen);
+ }
+ else
+ {
+ // Padding first.
+ __beg = __pads;
+ __beglen = __plen;
+ __end = const_cast<char_type*>(__olds);
+ }
+ }
+ else
+ {
+ // Padding first.
+ __beg = __pads;
+ __beglen = __plen;
+ __end = const_cast<char_type*>(__olds);
+ }
+
+ traits_type::copy(__news, __beg, __beglen);
+ traits_type::copy(__news + __beglen, __end, __newlen - __beglen - __mod);
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
+ {
+ typedef basic_ostream<_CharT, _Traits> __ostream_type;
+ __ostream_type::sentry __cerb(__out);
+ if (__cerb)
+ {
+ try {
+ streamsize __w = __out.width();
+ _CharT __pads[__w];
+ __pads[0] = __c;
+ streamsize __len = 1;
+ if (__w > __len)
+ {
+ _S_pad_char(__out, __pads, &__c, __w, __len);
+ __len = __w;
+ }
+ __out.write(__pads, __len);
+ __out.width(0);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ __out.setstate(ios_base::badbit);
+ if ((__out.exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return __out;
+ }
+
+ // Specialization
+ template <class _Traits>
+ basic_ostream<char, _Traits>&
+ operator<<(basic_ostream<char, _Traits>& __out, char __c)
+ {
+ typedef basic_ostream<char, _Traits> __ostream_type;
+ __ostream_type::sentry __cerb(__out);
+ if (__cerb)
+ {
+ try {
+ streamsize __w = __out.width();
+ char __pads[__w + 1];
+ __pads[0] = __c;
+ streamsize __len = 1;
+ if (__w > __len)
+ {
+ _S_pad_char(__out, __pads, &__c, __w, __len);
+ __len = __w;
+ }
+ __out.write(__pads, __len);
+ __out.width(0);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ __out.setstate(ios_base::badbit);
+ if ((__out.exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return __out;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
+ {
+ typedef basic_ostream<_CharT, _Traits> __ostream_type;
+ __ostream_type::sentry __cerb(__out);
+ if (__cerb)
+ {
+ try {
+ streamsize __w = __out.width();
+ _CharT __pads[__w];
+ streamsize __len = static_cast<streamsize>(_Traits::length(__s));
+ if (__w > __len)
+ {
+ _S_pad_char(__out, __pads, __s, __w, __len);
+ __s = __pads;
+ __len = __w;
+ }
+ __out.write(__s, __len);
+ __out.width(0);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ __out.setstate(ios_base::badbit);
+ if ((__out.exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return __out;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __out, const char* /*__s*/)
+ {
+#if 0
+ typedef basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename _Traits::state_type __state_type;
+ typedef codecvt<char, _CharT, __state_type> __codecvt_type;
+ typedef typename __ostream_type::char_type __char_type;
+
+ __ostream_type::sentry __cerb(__out);
+ if (__cerb)
+ {
+ const __codecvt_type* __fcvt = &use_facet<__codecvt_type>(__out.getloc());
+ try {
+ streamsize __n = char_traits<char>::length(__s);
+ __char_type __conv[__n];
+ __state_type __state_cur;
+ __char_type __pbuf[__n];
+ __char_type* __pend;
+ char* __send;
+ __fcvt->out(__state_cur,
+ __pbuf, __pbuf + __n,
+ const_cast<const __char_type*&>(__pend),
+ const_cast<char*>(__s),
+ const_cast<char*>(__s + __n),
+ __send);
+ __out.write(__pbuf, __n);
+ }
+#endif
+ return __out;
+ }
+
+ // Partial specializationss
+ template<class _Traits>
+ basic_ostream<char, _Traits>&
+ operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
+ {
+ typedef basic_ostream<char, _Traits> __ostream_type;
+ __ostream_type::sentry __cerb(__out);
+ if (__cerb)
+ {
+ try {
+ streamsize __w = __out.width();
+ char __pads[__w];
+ streamsize __len = static_cast<streamsize>(_Traits::length(__s));
+ if (__w > __len)
+ {
+ _S_pad_char(__out, __pads, __s, __w, __len);
+ __s = __pads;
+ __len = __w;
+ }
+ __out.write(__s, __len);
+ __out.width(0);
+ }
+ catch(exception& __fail){
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ __out.setstate(ios_base::badbit);
+ if ((__out.exceptions() & ios_base::badbit) != 0)
+ throw;
+ }
+ }
+ return __out;
+ }
+
+ // 21.3.7.8 basic_string::operator<<
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __out,
+ const basic_string<_CharT, _Traits, _Alloc>& __s)
+ { return (__out << __s.c_str()); }
+
+} // namespace std
+
+// Local Variables:
+// mode:C++
+// End:
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/pthread_allocimpl.h b/libstdc++-v3/bits/pthread_allocimpl.h
new file mode 100644
index 000000000000..3b63127ced7f
--- /dev/null
+++ b/libstdc++-v3/bits/pthread_allocimpl.h
@@ -0,0 +1,495 @@
+/*
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BITS_PTHREAD_ALLOCIMPL_H
+#define _CPP_BITS_PTHREAD_ALLOCIMPL_H 1
+
+// Pthread-specific node allocator.
+// This is similar to the default allocator, except that free-list
+// information is kept separately for each thread, avoiding locking.
+// This should be reasonably fast even in the presence of threads.
+// The down side is that storage may not be well-utilized.
+// It is not an error to allocate memory in thread A and deallocate
+// it in thread B. But this effectively transfers ownership of the memory,
+// so that it can only be reallocated by thread B. Thus this can effectively
+// result in a storage leak if it's done on a regular basis.
+// It can also result in frequent sharing of
+// cache lines among processors, with potentially serious performance
+// consequences.
+
+#include <bits/std_cerrno.h>
+#include <bits/stl_config.h>
+#include <bits/stl_alloc.h>
+#ifndef __RESTRICT
+# define __RESTRICT
+#endif
+
+#ifndef __STL_NO_BAD_ALLOC
+# include <bits/std_new.h>
+#endif
+
+__STL_BEGIN_NAMESPACE
+
+#define __STL_DATA_ALIGNMENT 8
+
+union _Pthread_alloc_obj {
+ union _Pthread_alloc_obj * __free_list_link;
+ char __client_data[__STL_DATA_ALIGNMENT]; /* The client sees this. */
+};
+
+// Pthread allocators don't appear to the client to have meaningful
+// instances. We do in fact need to associate some state with each
+// thread. That state is represented by
+// _Pthread_alloc_per_thread_state<_Max_size>.
+
+template<size_t _Max_size>
+struct _Pthread_alloc_per_thread_state {
+ typedef _Pthread_alloc_obj __obj;
+ enum { _S_NFREELISTS = _Max_size/__STL_DATA_ALIGNMENT };
+ _Pthread_alloc_obj* volatile __free_list[_S_NFREELISTS];
+ _Pthread_alloc_per_thread_state<_Max_size> * __next;
+ // Free list link for list of available per thread structures.
+ // When one of these becomes available for reuse due to thread
+ // termination, any objects in its free list remain associated
+ // with it. The whole structure may then be used by a newly
+ // created thread.
+ _Pthread_alloc_per_thread_state() : __next(0)
+ {
+ memset((void *)__free_list, 0, (size_t) _S_NFREELISTS * sizeof(__obj *));
+ }
+ // Returns an object of size __n, and possibly adds to size n free list.
+ void *_M_refill(size_t __n);
+};
+
+// Pthread-specific allocator.
+// The argument specifies the largest object size allocated from per-thread
+// free lists. Larger objects are allocated using malloc_alloc.
+// Max_size must be a power of 2.
+template <size_t _Max_size = 128>
+class _Pthread_alloc_template {
+
+public: // but only for internal use:
+
+ typedef _Pthread_alloc_obj __obj;
+
+ // Allocates a chunk for nobjs of size size. nobjs may be reduced
+ // if it is inconvenient to allocate the requested number.
+ static char *_S_chunk_alloc(size_t __size, int &__nobjs);
+
+ enum {_S_ALIGN = __STL_DATA_ALIGNMENT};
+
+ static size_t _S_round_up(size_t __bytes) {
+ return (((__bytes) + (int) _S_ALIGN-1) & ~((int) _S_ALIGN - 1));
+ }
+ static size_t _S_freelist_index(size_t __bytes) {
+ return (((__bytes) + (int) _S_ALIGN-1)/(int)_S_ALIGN - 1);
+ }
+
+private:
+ // Chunk allocation state. And other shared state.
+ // Protected by _S_chunk_allocator_lock.
+ static pthread_mutex_t _S_chunk_allocator_lock;
+ static char *_S_start_free;
+ static char *_S_end_free;
+ static size_t _S_heap_size;
+ static _Pthread_alloc_per_thread_state<_Max_size>* _S_free_per_thread_states;
+ static pthread_key_t _S_key;
+ static bool _S_key_initialized;
+ // Pthread key under which per thread state is stored.
+ // Allocator instances that are currently unclaimed by any thread.
+ static void _S_destructor(void *instance);
+ // Function to be called on thread exit to reclaim per thread
+ // state.
+ static _Pthread_alloc_per_thread_state<_Max_size> *_S_new_per_thread_state();
+ // Return a recycled or new per thread state.
+ static _Pthread_alloc_per_thread_state<_Max_size> *_S_get_per_thread_state();
+ // ensure that the current thread has an associated
+ // per thread state.
+ class _M_lock;
+ friend class _M_lock;
+ class _M_lock {
+ public:
+ _M_lock () { pthread_mutex_lock(&_S_chunk_allocator_lock); }
+ ~_M_lock () { pthread_mutex_unlock(&_S_chunk_allocator_lock); }
+ };
+
+public:
+
+ /* n must be > 0 */
+ static void * allocate(size_t __n)
+ {
+ __obj * volatile * __my_free_list;
+ __obj * __RESTRICT __result;
+ _Pthread_alloc_per_thread_state<_Max_size>* __a;
+
+ if (__n > _Max_size) {
+ return(malloc_alloc::allocate(__n));
+ }
+ if (!_S_key_initialized ||
+ !(__a = (_Pthread_alloc_per_thread_state<_Max_size>*)
+ pthread_getspecific(_S_key))) {
+ __a = _S_get_per_thread_state();
+ }
+ __my_free_list = __a -> __free_list + _S_freelist_index(__n);
+ __result = *__my_free_list;
+ if (__result == 0) {
+ void *__r = __a -> _M_refill(_S_round_up(__n));
+ return __r;
+ }
+ *__my_free_list = __result -> __free_list_link;
+ return (__result);
+ };
+
+ /* p may not be 0 */
+ static void deallocate(void *__p, size_t __n)
+ {
+ __obj *__q = (__obj *)__p;
+ __obj * volatile * __my_free_list;
+ _Pthread_alloc_per_thread_state<_Max_size>* __a;
+
+ if (__n > _Max_size) {
+ malloc_alloc::deallocate(__p, __n);
+ return;
+ }
+ if (!_S_key_initialized ||
+ !(__a = (_Pthread_alloc_per_thread_state<_Max_size> *)
+ pthread_getspecific(_S_key))) {
+ __a = _S_get_per_thread_state();
+ }
+ __my_free_list = __a->__free_list + _S_freelist_index(__n);
+ __q -> __free_list_link = *__my_free_list;
+ *__my_free_list = __q;
+ }
+
+ static void * reallocate(void *__p, size_t __old_sz, size_t __new_sz);
+
+} ;
+
+typedef _Pthread_alloc_template<> pthread_alloc;
+
+
+template <size_t _Max_size>
+void _Pthread_alloc_template<_Max_size>::_S_destructor(void * __instance)
+{
+ _M_lock __lock_instance; // Need to acquire lock here.
+ _Pthread_alloc_per_thread_state<_Max_size>* __s =
+ (_Pthread_alloc_per_thread_state<_Max_size> *)__instance;
+ __s -> __next = _S_free_per_thread_states;
+ _S_free_per_thread_states = __s;
+}
+
+template <size_t _Max_size>
+_Pthread_alloc_per_thread_state<_Max_size> *
+_Pthread_alloc_template<_Max_size>::_S_new_per_thread_state()
+{
+ /* lock already held here. */
+ if (0 != _S_free_per_thread_states) {
+ _Pthread_alloc_per_thread_state<_Max_size> *__result =
+ _S_free_per_thread_states;
+ _S_free_per_thread_states = _S_free_per_thread_states -> __next;
+ return __result;
+ } else {
+ return new _Pthread_alloc_per_thread_state<_Max_size>;
+ }
+}
+
+template <size_t _Max_size>
+_Pthread_alloc_per_thread_state<_Max_size> *
+_Pthread_alloc_template<_Max_size>::_S_get_per_thread_state()
+{
+ /*REFERENCED*/
+ _M_lock __lock_instance; // Need to acquire lock here.
+ int __ret_code;
+ _Pthread_alloc_per_thread_state<_Max_size> * __result;
+ if (!_S_key_initialized) {
+ if (pthread_key_create(&_S_key, _S_destructor)) {
+ __THROW_BAD_ALLOC; // defined in stl_alloc.h
+ }
+ _S_key_initialized = true;
+ }
+ __result = _S_new_per_thread_state();
+ __ret_code = pthread_setspecific(_S_key, __result);
+ if (__ret_code) {
+ if (__ret_code == ENOMEM) {
+ __THROW_BAD_ALLOC;
+ } else {
+ // EINVAL
+ abort();
+ }
+ }
+ return __result;
+}
+
+/* We allocate memory in large chunks in order to avoid fragmenting */
+/* the malloc heap too much. */
+/* We assume that size is properly aligned. */
+template <size_t _Max_size>
+char *_Pthread_alloc_template<_Max_size>
+::_S_chunk_alloc(size_t __size, int &__nobjs)
+{
+ {
+ char * __result;
+ size_t __total_bytes;
+ size_t __bytes_left;
+ /*REFERENCED*/
+ _M_lock __lock_instance; // Acquire lock for this routine
+
+ __total_bytes = __size * __nobjs;
+ __bytes_left = _S_end_free - _S_start_free;
+ if (__bytes_left >= __total_bytes) {
+ __result = _S_start_free;
+ _S_start_free += __total_bytes;
+ return(__result);
+ } else if (__bytes_left >= __size) {
+ __nobjs = __bytes_left/__size;
+ __total_bytes = __size * __nobjs;
+ __result = _S_start_free;
+ _S_start_free += __total_bytes;
+ return(__result);
+ } else {
+ size_t __bytes_to_get =
+ 2 * __total_bytes + _S_round_up(_S_heap_size >> 4);
+ // Try to make use of the left-over piece.
+ if (__bytes_left > 0) {
+ _Pthread_alloc_per_thread_state<_Max_size>* __a =
+ (_Pthread_alloc_per_thread_state<_Max_size>*)
+ pthread_getspecific(_S_key);
+ __obj * volatile * __my_free_list =
+ __a->__free_list + _S_freelist_index(__bytes_left);
+
+ ((__obj *)_S_start_free) -> __free_list_link = *__my_free_list;
+ *__my_free_list = (__obj *)_S_start_free;
+ }
+# ifdef _SGI_SOURCE
+ // Try to get memory that's aligned on something like a
+ // cache line boundary, so as to avoid parceling out
+ // parts of the same line to different threads and thus
+ // possibly different processors.
+ {
+ const int __cache_line_size = 128; // probable upper bound
+ __bytes_to_get &= ~(__cache_line_size-1);
+ _S_start_free = (char *)memalign(__cache_line_size, __bytes_to_get);
+ if (0 == _S_start_free) {
+ _S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get);
+ }
+ }
+# else /* !SGI_SOURCE */
+ _S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get);
+# endif
+ _S_heap_size += __bytes_to_get;
+ _S_end_free = _S_start_free + __bytes_to_get;
+ }
+ }
+ // lock is released here
+ return(_S_chunk_alloc(__size, __nobjs));
+}
+
+
+/* Returns an object of size n, and optionally adds to size n free list.*/
+/* We assume that n is properly aligned. */
+/* We hold the allocation lock. */
+template <size_t _Max_size>
+void *_Pthread_alloc_per_thread_state<_Max_size>
+::_M_refill(size_t __n)
+{
+ int __nobjs = 128;
+ char * __chunk =
+ _Pthread_alloc_template<_Max_size>::_S_chunk_alloc(__n, __nobjs);
+ __obj * volatile * __my_free_list;
+ __obj * __result;
+ __obj * __current_obj, * __next_obj;
+ int __i;
+
+ if (1 == __nobjs) {
+ return(__chunk);
+ }
+ __my_free_list = __free_list
+ + _Pthread_alloc_template<_Max_size>::_S_freelist_index(__n);
+
+ /* Build free list in chunk */
+ __result = (__obj *)__chunk;
+ *__my_free_list = __next_obj = (__obj *)(__chunk + __n);
+ for (__i = 1; ; __i++) {
+ __current_obj = __next_obj;
+ __next_obj = (__obj *)((char *)__next_obj + __n);
+ if (__nobjs - 1 == __i) {
+ __current_obj -> __free_list_link = 0;
+ break;
+ } else {
+ __current_obj -> __free_list_link = __next_obj;
+ }
+ }
+ return(__result);
+}
+
+template <size_t _Max_size>
+void *_Pthread_alloc_template<_Max_size>
+::reallocate(void *__p, size_t __old_sz, size_t __new_sz)
+{
+ void * __result;
+ size_t __copy_sz;
+
+ if (__old_sz > _Max_size
+ && __new_sz > _Max_size) {
+ return(realloc(__p, __new_sz));
+ }
+ if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p);
+ __result = allocate(__new_sz);
+ __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
+ memcpy(__result, __p, __copy_sz);
+ deallocate(__p, __old_sz);
+ return(__result);
+}
+
+template <size_t _Max_size>
+_Pthread_alloc_per_thread_state<_Max_size> *
+_Pthread_alloc_template<_Max_size>::_S_free_per_thread_states = 0;
+
+template <size_t _Max_size>
+pthread_key_t _Pthread_alloc_template<_Max_size>::_S_key;
+
+template <size_t _Max_size>
+bool _Pthread_alloc_template<_Max_size>::_S_key_initialized = false;
+
+template <size_t _Max_size>
+pthread_mutex_t _Pthread_alloc_template<_Max_size>::_S_chunk_allocator_lock
+= PTHREAD_MUTEX_INITIALIZER;
+
+template <size_t _Max_size>
+char *_Pthread_alloc_template<_Max_size>
+::_S_start_free = 0;
+
+template <size_t _Max_size>
+char *_Pthread_alloc_template<_Max_size>
+::_S_end_free = 0;
+
+template <size_t _Max_size>
+size_t _Pthread_alloc_template<_Max_size>
+::_S_heap_size = 0;
+
+#ifdef __STL_USE_STD_ALLOCATORS
+
+template <class _Tp>
+class pthread_allocator {
+ typedef pthread_alloc _S_Alloc; // The underlying allocator.
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+ template <class _NewType> struct rebind {
+ typedef pthread_allocator<_NewType> other;
+ };
+
+ pthread_allocator() __STL_NOTHROW {}
+ pthread_allocator(const pthread_allocator& a) __STL_NOTHROW {}
+ template <class _OtherType>
+ pthread_allocator(const pthread_allocator<_OtherType>&)
+ __STL_NOTHROW {}
+ ~pthread_allocator() __STL_NOTHROW {}
+
+ pointer address(reference __x) const { return &__x; }
+ const_pointer address(const_reference __x) const { return &__x; }
+
+ // __n is permitted to be 0. The C++ standard says nothing about what
+ // the return value is when __n == 0.
+ _Tp* allocate(size_type __n, const void* = 0) {
+ return __n != 0 ? static_cast<_Tp*>(_S_Alloc::allocate(__n * sizeof(_Tp)))
+ : 0;
+ }
+
+ // p is not permitted to be a null pointer.
+ void deallocate(pointer __p, size_type __n)
+ { _S_Alloc::deallocate(__p, __n * sizeof(_Tp)); }
+
+ size_type max_size() const __STL_NOTHROW
+ { return size_t(-1) / sizeof(_Tp); }
+
+ void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
+ void destroy(pointer _p) { _p->~_Tp(); }
+};
+
+template<>
+class pthread_allocator<void> {
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef void* pointer;
+ typedef const void* const_pointer;
+ typedef void value_type;
+
+ template <class _NewType> struct rebind {
+ typedef pthread_allocator<_NewType> other;
+ };
+};
+
+template <size_t _Max_size>
+inline bool operator==(const _Pthread_alloc_template<_Max_size>&,
+ const _Pthread_alloc_template<_Max_size>&)
+{
+ return true;
+}
+
+template <class _T1, class _T2>
+inline bool operator==(const pthread_allocator<_T1>&,
+ const pthread_allocator<_T2>& a2)
+{
+ return true;
+}
+
+template <class _T1, class _T2>
+inline bool operator!=(const pthread_allocator<_T1>&,
+ const pthread_allocator<_T2>&)
+{
+ return false;
+}
+
+template <class _Tp, size_t _Max_size>
+struct _Alloc_traits<_Tp, _Pthread_alloc_template<_Max_size> >
+{
+ static const bool _S_instanceless = true;
+ typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max_size> > _Alloc_type;
+ typedef __allocator<_Tp, _Pthread_alloc_template<_Max_size> >
+ allocator_type;
+};
+
+template <class _Tp, class _Atype, size_t _Max>
+struct _Alloc_traits<_Tp, __allocator<_Atype, _Pthread_alloc_template<_Max> > >
+{
+ static const bool _S_instanceless = true;
+ typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max> > _Alloc_type;
+ typedef __allocator<_Tp, _Pthread_alloc_template<_Max> > allocator_type;
+};
+
+template <class _Tp, class _Atype>
+struct _Alloc_traits<_Tp, pthread_allocator<_Atype> >
+{
+ static const bool _S_instanceless = true;
+ typedef simple_alloc<_Tp, _Pthread_alloc_template<> > _Alloc_type;
+ typedef pthread_allocator<_Tp> allocator_type;
+};
+
+
+#endif /* __STL_USE_STD_ALLOCATORS */
+
+__STL_END_NAMESPACE
+
+#endif /* _CPP_BITS_PTHREAD_ALLOCIMPL_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/sbuf_iter.h b/libstdc++-v3/bits/sbuf_iter.h
new file mode 100644
index 000000000000..a028f230023a
--- /dev/null
+++ b/libstdc++-v3/bits/sbuf_iter.h
@@ -0,0 +1,264 @@
+// Streambuf iterators
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// XXX Should specialize copy, find algorithms for streambuf iterators.
+
+#ifndef _CPP_BITS_SBUF_ITER_H
+#define _CPP_BITS_SBUF_ITER_H 1
+
+namespace std
+{
+
+ template<typename _CharT, typename _Traits>
+ class ostreambuf_iterator
+#if 0 // XXX this is standard:
+ : public iterator<output_iterator_tag,_CharT,void,void,void>
+#else
+ : public output_iterator
+#endif
+ {
+ public:
+
+ // Types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_streambuf<_CharT, _Traits> streambuf_type;
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
+
+ inline
+ ostreambuf_iterator(ostream_type& __s) throw ()
+ : _M_sbuf(__s.rdbuf()), _M_failed(false) { }
+
+ ostreambuf_iterator(streambuf_type* __s) throw ()
+ : _M_sbuf(__s), _M_failed(false) { }
+
+ ostreambuf_iterator&
+ operator=(_CharT __c);
+
+ ostreambuf_iterator&
+ operator*() throw()
+ { return *this; }
+
+ ostreambuf_iterator&
+ operator++(int) throw()
+ { return *this; }
+
+ ostreambuf_iterator&
+ operator++() throw()
+ { return *this; }
+
+ bool
+ failed() const throw()
+ { return _M_failed; }
+
+ private:
+ streambuf_type* _M_sbuf;
+ bool _M_failed;
+
+#if 0
+ template<>
+ friend char const*
+ copy(char const* __first, char const* __last,
+ ostreambuf_iterator<char,char_traits<char> > __to);
+ template<>
+ friend wchar_t const*
+ copy(wchar_t const* __first, wchar_t const* __last,
+ ostreambuf_iterator<wchar_t,char_traits<wchar_t> > __to);
+#endif
+ };
+
+ template<typename _CharT, typename _Traits>
+ inline ostreambuf_iterator<_CharT, _Traits>&
+ ostreambuf_iterator<_CharT, _Traits>::operator=(_CharT __c)
+ {
+ if (!_M_failed &&
+ _Traits::eq_int_type(_M_sbuf->sputc(__c),_Traits::eof()))
+ _M_failed = true;
+ return *this;
+ }
+
+
+#if 0
+ // Optimized specializations of standard algorithms
+ // These are specialized only for standard types
+ // (with no unbound arguments) to avoid creating
+ // overload problems with user specializations.
+
+ template<>
+ char const*
+ copy(char const* __first, char const* __last,
+ ostreambuf_iterator<char,char_traits<char> > __to)
+ {
+ if (!__to._M_failed)
+ __to._M_sbuf->sputn(__first, __last-__first);
+ return __last;
+ }
+
+ template<>
+ wchar_t const*
+ copy(wchar_t const* __first, wchar_t const* __last,
+ ostreambuf_iterator<whar_t,char_traits<wchar_t> > __to)
+ {
+ if (!__to._M_failed)
+ __to._M_sbuf->sputn(__first, __last-__first);
+ return __last;
+ }
+#endif
+
+ // 24.5.3 Template class istreambuf_iterator
+ template<class _CharT, class _Traits>
+ class istreambuf_iterator
+ : public iterator<input_iterator_tag, _CharT, typename _Traits::off_type,
+ _CharT*, _CharT&>
+ {
+ public:
+
+ // Types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename _Traits::int_type int_type;
+ typedef basic_streambuf<_CharT, _Traits> streambuf_type;
+ typedef basic_istream<_CharT, _Traits> istream_type;
+ // Non-standard Types:
+ typedef istreambuf_iterator<_CharT, _Traits> __istreambufiter_type;
+
+ istreambuf_iterator() throw()
+ : _M_istreambuf(NULL), _M_c(-2) { }
+
+ istreambuf_iterator(istream_type& __s) throw()
+ : _M_istreambuf(__s.rdbuf()), _M_c(-2) { }
+
+ istreambuf_iterator(streambuf_type* __s) throw()
+ : _M_istreambuf(__s), _M_c(-2) { }
+
+ // NB: This should really have an int_type return
+ // value, so "end of stream" postion can be checked without
+ // hacking.
+ char_type
+ operator*() const
+ {
+ // The result of operator*() on an end of stream is undefined.
+ char_type __retval;
+ if (_M_istreambuf && _M_c != static_cast<int_type>(-2))
+ __retval = _M_c;
+ else if (_M_istreambuf)
+ __retval = traits_type::to_char_type(_M_istreambuf->sgetc());
+ else
+ __retval = static_cast<char_type>(traits_type::eof());
+ return __retval;
+ }
+
+ __istreambufiter_type&
+ operator++()
+ {
+ if (_M_istreambuf)
+ _M_istreambuf->sbumpc();
+ _M_c = -2;
+ return *this;
+ }
+
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ // 14882 says return a proxy object. It should be a const
+ // proxy object, but since this class is not mandated, it
+ // should allow this signature:
+ const __istreambufiter_type
+ operator++(int)
+ {
+ if (_M_istreambuf)
+ _M_c = _M_istreambuf->sbumpc();
+ return *this;
+ }
+#endif
+
+ bool
+ equal(const __istreambufiter_type& __b)
+ {
+ int_type __eof = traits_type::eof();
+ bool __thiseof = !_M_istreambuf || _M_istreambuf->sgetc() == __eof;
+ bool __beof = !__b._M_istreambuf
+ || __b._M_istreambuf->sgetc() == __eof;
+ return (__thiseof && __beof || (!__thiseof && !__beof));
+ }
+
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ // 110 istreambuf_iterator::equal not const
+ // NB: there is also number 111 pending on this function.
+ bool
+ equal(const __istreambufiter_type& __b) const
+ {
+ int_type __eof = traits_type::eof();
+ bool __thiseof = !_M_istreambuf || _M_istreambuf->sgetc() == __eof;
+ bool __beof = !__b._M_istreambuf
+ || __b._M_istreambuf->sgetc() == __eof;
+ return (__thiseof && __beof || (!__thiseof && !__beof));
+ }
+#endif
+
+ private:
+ // 24.5.3 istreambuf_iterator
+ // p 1
+ // If the end of stream is reached (streambuf_type::sgetc()
+ // returns traits_type::eof()), the iterator becomes equal to
+ // the "end of stream" iterator value.
+ // NB: This implementation assumes the "end of stream" value
+ // is EOF, or -1.
+ streambuf_type* _M_istreambuf;
+ int_type _M_c;
+ };
+
+ template<typename _CharT, typename _Traits>
+ inline bool
+ operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
+ const istreambuf_iterator<_CharT, _Traits>& __b)
+ { return __a.equal(__b); }
+
+ template<typename _CharT, typename _Traits>
+ inline bool
+ operator!=(const istreambuf_iterator<_CharT, _Traits>& __a,
+ const istreambuf_iterator<_CharT, _Traits>& __b)
+ { return !__a.equal(__b); }
+
+} // std::
+
+#endif /* _CPP_BITS_SBUF_ITER_H */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/slice.h b/libstdc++-v3/bits/slice.h
new file mode 100644
index 000000000000..3e4f7a743f6d
--- /dev/null
+++ b/libstdc++-v3/bits/slice.h
@@ -0,0 +1,77 @@
+// The template and inlines for the -*- C++ -*- slice class.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _CPP_BITS_SLICE_H
+#define _CPP_BITS_SLICE_H
+
+namespace std {
+
+class slice
+{
+public:
+ slice ();
+ slice (size_t, size_t, size_t);
+
+ size_t start () const;
+ size_t size () const;
+ size_t stride () const;
+
+private:
+ size_t _M_off; // offset
+ size_t _M_sz; // size
+ size_t _M_st; // stride unit
+};
+
+inline slice::slice () {}
+
+inline slice::slice (size_t __o, size_t __d, size_t __s)
+ : _M_off (__o), _M_sz (__d), _M_st (__s) {}
+
+inline size_t
+slice::start () const
+ { return _M_off; }
+
+inline size_t
+slice::size () const
+ { return _M_sz; }
+
+inline size_t
+slice::stride () const
+ { return _M_st; }
+
+} // std::
+
+
+#endif /* _CPP_BITS_SLICE_H */
+
+// Local Variables:
+// mode:c++
+// End:
diff --git a/libstdc++-v3/bits/slice_array.h b/libstdc++-v3/bits/slice_array.h
new file mode 100644
index 000000000000..04efd5ff9d94
--- /dev/null
+++ b/libstdc++-v3/bits/slice_array.h
@@ -0,0 +1,161 @@
+// The template and inlines for the -*- C++ -*- slice_array class.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _CPP_BITS_SLICE_ARRAY_H
+#define _CPP_BITS_SLICE_ARRAY_H 1
+
+namespace std {
+
+ template<typename _Tp>
+ class slice_array
+ {
+ public:
+ typedef _Tp value_type;
+
+ void operator= (const valarray<_Tp>&) const;
+ void operator*= (const valarray<_Tp>&) const;
+ void operator/= (const valarray<_Tp>&) const;
+ void operator%= (const valarray<_Tp>&) const;
+ void operator+= (const valarray<_Tp>&) const;
+ void operator-= (const valarray<_Tp>&) const;
+ void operator^= (const valarray<_Tp>&) const;
+ void operator&= (const valarray<_Tp>&) const;
+ void operator|= (const valarray<_Tp>&) const;
+ void operator<<= (const valarray<_Tp>&) const;
+ void operator>>= (const valarray<_Tp>&) const;
+ void operator= (const _Tp &);
+ // ~slice_array ();
+
+ template<class _Dom>
+ void operator= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator*= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator/= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator%= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator+= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator-= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator^= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator&= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator|= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator<<= (const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator>>= (const _Expr<_Dom,_Tp>&) const;
+
+ private:
+ friend class valarray<_Tp>;
+ slice_array(_Array<_Tp>, const slice&);
+
+ const size_t _M_sz;
+ const size_t _M_stride;
+ const _Array<_Tp> _M_array;
+
+ // this constructor is implemented since we need to return a value.
+ slice_array (const slice_array&);
+
+ // not implemented
+ slice_array ();
+ slice_array& operator= (const slice_array&);
+ };
+
+ template<typename _Tp>
+ inline slice_array<_Tp>::slice_array (_Array<_Tp> __a, const slice& __s)
+ : _M_sz (__s.size ()), _M_stride (__s.stride ()),
+ _M_array (__a.begin () + __s.start ()) {}
+
+
+ template<typename _Tp>
+ inline slice_array<_Tp>::slice_array(const slice_array<_Tp>& a)
+ : _M_sz(a._M_sz), _M_stride(a._M_stride), _M_array(a._M_array) {}
+
+ // template<typename _Tp>
+ // inline slice_array<_Tp>::~slice_array () {}
+
+ template<typename _Tp>
+ inline void
+ slice_array<_Tp>::operator= (const _Tp& __t)
+ { __valarray_fill (_M_array, _M_sz, _M_stride, __t); }
+
+ template<typename _Tp>
+ inline void
+ slice_array<_Tp>::operator= (const valarray<_Tp>& __v) const
+ { __valarray_copy (_Array<_Tp> (__v), _M_array, _M_sz, _M_stride); }
+
+ template<typename _Tp>
+ template<class _Dom>
+ inline void
+ slice_array<_Tp>::operator= (const _Expr<_Dom,_Tp>& __e) const
+ { __valarray_copy (__e, _M_sz, _M_array, _M_stride); }
+
+#undef _DEFINE_VALARRAY_OPERATOR
+#define _DEFINE_VALARRAY_OPERATOR(op, name) \
+template<typename _Tp> \
+inline void \
+slice_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const \
+{ \
+ _Array_augmented_##name (_M_array, _M_sz, _M_stride, _Array<_Tp> (__v));\
+} \
+ \
+template<typename _Tp> template<class _Dom> \
+inline void \
+slice_array<_Tp>::operator##op##= (const _Expr<_Dom,_Tp>& __e) const \
+{ \
+ _Array_augmented_##name (_M_array, _M_stride, __e, _M_sz); \
+}
+
+
+_DEFINE_VALARRAY_OPERATOR(*, multiplies)
+_DEFINE_VALARRAY_OPERATOR(/, divides)
+_DEFINE_VALARRAY_OPERATOR(%, modulus)
+_DEFINE_VALARRAY_OPERATOR(+, plus)
+_DEFINE_VALARRAY_OPERATOR(-, minus)
+_DEFINE_VALARRAY_OPERATOR(^, xor)
+_DEFINE_VALARRAY_OPERATOR(&, and)
+_DEFINE_VALARRAY_OPERATOR(|, or)
+_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
+_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
+
+#undef _DEFINE_VALARRAY_OPERATOR
+
+} // std::
+
+#endif /* _CPP_BITS_SLICE_ARRAY_H */
+
+// Local Variables:
+// mode:c++
+// End:
diff --git a/libstdc++-v3/bits/sstream.tcc b/libstdc++-v3/bits/sstream.tcc
new file mode 100644
index 000000000000..6596c4b6d08a
--- /dev/null
+++ b/libstdc++-v3/bits/sstream.tcc
@@ -0,0 +1,221 @@
+// String based streams -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.7 String-based streams
+//
+
+#ifndef _CPP_BITS_SSTREAM_TCC
+#define _CPP_BITS_SSTREAM_TCC 1
+
+#include <bits/std_sstream.h>
+
+namespace std {
+
+ template <class _CharT, class _Traits, class _Alloc>
+ basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
+ basic_stringbuf<_CharT, _Traits, _Alloc>::
+ pbackfail(int_type __c)
+ {
+ int_type __retval = traits_type::eof();
+ bool __testeof = traits_type::eq_int_type(__c, traits_type::eof());
+ bool __testpos = _M_in_cur && _M_in_beg < _M_in_cur;
+
+ // Try to put back __c into input sequence in one of three ways.
+ // Order these tests done in is unspecified by the standard.
+ if (!__testeof && __testpos
+ && traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]))
+ {
+ --_M_in_cur;
+ __retval = __c;
+ }
+ else if (!__testeof && __testpos)
+ {
+ --_M_in_cur;
+ *_M_in_cur = traits_type::to_char_type(__c);
+ __retval = __c;
+ }
+ else if (__testeof && __testpos)
+ {
+ --_M_in_cur;
+ __retval = traits_type::not_eof(__c);
+ }
+ return __retval;
+ }
+
+ template <class _CharT, class _Traits, class _Alloc>
+ basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
+ basic_stringbuf<_CharT, _Traits, _Alloc>::
+ overflow(int_type __c)
+ {
+ int_type __retval = traits_type::eof();
+ bool __testeof = traits_type::eq_int_type(__c, __retval);
+ bool __testwrite = _M_out_cur < _M_buf + _M_buf_size;
+ bool __testout = _M_mode & ios_base::out;
+
+ // Try to append __c into output sequence in one of two ways.
+ // Order these tests done in is unspecified by the standard.
+ if (__testout)
+ {
+ if (!__testeof)
+ {
+ // NB: Start ostringstream buffers at 1024 bytes. This
+ // is an experimental value (pronounced "arbitrary" in
+ // some of the hipper english-speaking countries), and
+ // can be changed to suite particular needs.
+ __size_type __len = max(_M_buf_size, static_cast<int_type>(512));
+ __len *= 2;
+
+ if (__testwrite)
+ __retval = this->sputc(__c);
+ else if (__len <= _M_string.max_size())
+ {
+ // Force-allocate, re-sync.
+ _M_string = this->str();
+ _M_string.reserve(__len);
+ _M_buf_size = static_cast<int_type>(__len);
+ _M_really_sync(_M_in_cur - _M_in_beg,
+ _M_out_cur - _M_out_beg);
+ *_M_out_cur = traits_type::to_char_type(__c);
+ _M_buf_bump(1);
+ __retval = __c;
+ }
+ }
+ else
+ __retval = traits_type::not_eof(__c);
+ }
+ return __retval;
+ }
+
+ template <class _CharT, class _Traits, class _Alloc>
+ basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type
+ basic_stringbuf<_CharT, _Traits, _Alloc>::
+ seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode)
+ {
+ pos_type __retval = pos_type(off_type(-1));
+ bool __testin = __mode & ios_base::in && _M_mode & ios_base::in;
+ bool __testout = __mode & ios_base::out && _M_mode & ios_base::out;
+ bool __testboth = __testin && __testout && __way != ios_base::cur;
+
+ if (_M_buf_size && ((__testin != __testout) || __testboth))
+ {
+ char_type* __beg = _M_buf;
+ char_type* __curi = NULL;
+ char_type* __curo = NULL;
+ char_type* __endi = NULL;
+ char_type* __endo = NULL;
+
+ if (__testin)
+ {
+ __curi = this->gptr();
+ __endi = this->egptr();
+ }
+ if (__testout)
+ {
+ __curo = this->pptr();
+ __endo = this->epptr();
+ }
+
+ off_type __newoffi = 0;
+ off_type __newoffo = 0;
+ if (__way == ios_base::cur)
+ {
+ __newoffi = __curi - __beg;
+ __newoffo = __curo - __beg;
+ }
+ else if (__way == ios_base::end)
+ {
+ __newoffi = __endi - __beg;
+ __newoffo = __endo - __beg;
+ }
+
+ if (__testin
+ && __newoffi + __off >= 0 && __endi - __beg >= __newoffi + __off)
+ {
+ _M_in_cur = __beg + __newoffi + __off;
+ __retval = pos_type(__newoffi);
+ }
+ if (__testout
+ && __newoffo + __off >= 0 && __endo - __beg >= __newoffo + __off)
+ {
+ _M_buf_bump(__newoffo + __off - (_M_out_cur - __beg));
+ __retval = pos_type(__newoffo);
+ }
+ }
+ return __retval;
+ }
+
+ template <class _CharT, class _Traits, class _Alloc>
+ basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type
+ basic_stringbuf<_CharT, _Traits, _Alloc>::
+ seekpos(pos_type __sp, ios_base::openmode __mode)
+ {
+ pos_type __retval = pos_type(off_type(-1));
+ off_type __pos = __sp._M_position();
+ char_type* __beg = NULL;
+ char_type* __end = NULL;
+ bool __testin = __mode & ios_base::in && _M_mode & ios_base::in;
+ bool __testout = __mode & ios_base::out && _M_mode & ios_base::out;
+
+ if (__testin)
+ {
+ __beg = this->eback();
+ __end = this->egptr();
+ }
+ if (__testout)
+ {
+ __beg = this->pbase();
+ __end = _M_buf + _M_buf_size;
+ }
+
+ if (0 <= __pos && __pos <= __end - __beg)
+ {
+ // Need to set both of these if applicable
+ if (__testin)
+ _M_in_cur = _M_in_beg + __pos;
+ if (__testout)
+ _M_buf_bump((__pos) - (_M_out_cur - __beg));
+ __retval = pos_type(off_type(__pos));
+ }
+
+ return __retval;
+ }
+
+} // namespace std
+
+#endif /* _CPP_BITS_SSTREAM_TCC */
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_algorithm.h b/libstdc++-v3/bits/std_algorithm.h
new file mode 100644
index 000000000000..3f0842655066
--- /dev/null
+++ b/libstdc++-v3/bits/std_algorithm.h
@@ -0,0 +1,40 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_ALGORITHM
+#define _CPP_ALGORITHM 1
+
+#include <bits/stl_algobase.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_uninitialized.h>
+#include <bits/stl_tempbuf.h>
+#include <bits/stl_algo.h>
+
+#endif /* _CPP_ALGORITHM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/std_bitset.h b/libstdc++-v3/bits/std_bitset.h
new file mode 100644
index 000000000000..ffd147d433a3
--- /dev/null
+++ b/libstdc++-v3/bits/std_bitset.h
@@ -0,0 +1,1216 @@
+/*
+ * 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 _CPP_BITSET
+#define _CPP_BITSET 1
+
+// 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 <bits/std_cstddef.h> // for size_t
+#include <bits/std_string.h>
+#include <bits/std_stdexcept.h>
+#include <bits/std_istream.h>
+#include <bits/std_ostream.h>
+#include <bits/std_algorithm.h>
+
+#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;
+ const _WordT __mask = __offset == static_cast<size_t>(0) ?
+ static_cast<_WordT>(0) :
+ ~static_cast<_WordT>(0);
+ size_t __n = _Nw - 1;
+ for ( ; __n > __wshift; --__n)
+ _M_w[__n] = (_M_w[__n - __wshift] << __offset) |
+ ((_M_w[__n - __wshift - 1] >> __sub_offset) & __mask);
+ 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 _WordT __mask = __offset == static_cast<size_t>(0) ?
+ static_cast<_WordT>(0) :
+ ~static_cast<_WordT>(0);
+ 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) & __mask);
+ _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
+{
+ if (sizeof(_WordT) >= sizeof(unsigned long)) {
+ for (size_t __i = 1; __i < _Nw; ++__i)
+ if (_M_w[__i])
+ __STL_THROW(overflow_error("bitset"));
+
+ const _WordT __mask = static_cast<_WordT>(static_cast<unsigned long>(-1));
+ if (_M_w[0] & ~__mask)
+ __STL_THROW(overflow_error("bitset"));
+
+ 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_error("bitset"));
+ }
+ 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_error("bitset"));
+
+ 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.
+//
+
+#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
+
+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.
+//
+
+__STL_TEMPLATE_NULL
+inline unsigned long
+_Base_bitset<1, unsigned long>::_M_do_to_ulong() const { return _M_w; }
+
+__STL_TEMPLATE_NULL
+inline _Base_bitset<1, unsigned long>::_Base_bitset(unsigned long __val) {
+ _M_w = __val;
+}
+
+#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
+
+// ------------------------------------------------------------
+// Helper class to zero out the unused high-order bits in the highest word.
+
+#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
+
+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) {}
+};
+
+#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
+
+template <class _WordT, size_t _Extrabits> struct _Sanitize {
+ static void _M_do_sanitize(_WordT& __val) {
+ if (_Extrabits != 0)
+ __val &= ~((~static_cast<_WordT>(0)) << _Extrabits);
+ }
+};
+
+#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
+
+// ------------------------------------------------------------
+// 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.
+
+#ifdef __STL_HAS_NAMESPACES
+ 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;
+#endif /* __STL_HAS_NAMESPACES */
+
+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();
+
+ public:
+ reference( bitset& __b, size_t __pos ) {
+ _M_wp = &__b._M_getword(__pos);
+ _M_bpos = _S_whichbit(__pos);
+ }
+
+ ~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) {}
+
+#ifdef __STL_MEMBER_TEMPLATES
+ template<class _CharT, class _Traits, class _Alloc>
+ explicit bitset(const basic_string<_CharT,_Traits,_Alloc>& __s,
+ size_t __pos = 0)
+ : _Base()
+ {
+ if (__pos > __s.size())
+ __STL_THROW(out_of_range("bitset"));
+ _M_copy_from_string(__s, __pos,
+ basic_string<_CharT,_Traits,_Alloc>::npos);
+ }
+
+ template<class _CharT, class _Traits, class _Alloc>
+ bitset(const basic_string<_CharT, _Traits, _Alloc>& __s,
+ size_t __pos,
+ size_t __n)
+ : _Base()
+ {
+ if (__pos > __s.size())
+ __STL_THROW(out_of_range("bitset"));
+ _M_copy_from_string(__s, __pos, __n);
+ }
+#else
+ explicit bitset(const basic_string<char>& __s,
+ size_t __pos = 0,
+ size_t __n = basic_string<char>::npos)
+ : _Base()
+ {
+ if (__pos > __s.size())
+ __STL_THROW(out_of_range("bitset"));
+ _M_copy_from_string(__s, __pos, __n);
+ }
+
+#endif /* __STL_MEMBER_TEMPLATES */
+
+ // 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(); }
+
+#if defined(__STL_MEMBER_TEMPLATES) && \
+ defined(__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 /* member templates and explicit function template args */
+
+ // Helper functions for string operations.
+#ifdef __STL_MEMBER_TEMPLATES
+
+ template<class _CharT, class _Traits, class _Alloc>
+ void _M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s,
+ size_t,
+ size_t);
+
+ template<class _CharT, class _Traits, class _Alloc>
+ void _M_copy_to_string(basic_string<_CharT,_Traits,_Alloc>&) const;
+
+#else /* __STL_MEMBER_TEMPLATES */
+
+ void _M_copy_from_string(const basic_string<char>&, size_t, size_t);
+ void _M_copy_to_string(basic_string<char>&) const;
+
+#endif /* __STL_MEMBER_TEMPLATES */
+
+ 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.
+//
+
+#ifdef __STL_MEMBER_TEMPLATES
+
+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';
+}
+
+#else /* __STL_MEMBER_TEMPLATES */
+
+template <size_t _Nb, class _WordT>
+void bitset<_Nb, _WordT>::_M_copy_from_string(const basic_string<char>& __s,
+ size_t __pos, size_t __n)
+{
+ reset();
+ size_t __tmp = _Nb;
+ const size_t __nbits = min(__tmp, 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>
+void bitset<_Nb, _WordT>::_M_copy_to_string(basic_string<char>& __s) const
+{
+ __s.assign(_Nb, '0');
+
+ for (size_t __i = 0; __i < _Nb; ++__i)
+ if (_Unchecked_test(__i))
+ __s[_Nb - 1 - __i] = '1';
+}
+
+#endif /* __STL_MEMBER_TEMPLATES */
+
+// ------------------------------------------------------------
+
+//
+// 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;
+}
+
+#ifdef __STL_USE_NEW_IOSTREAMS
+
+template <class _CharT, class _Traits, size_t _Nb, class _WordT>
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb,_WordT>& __x)
+{
+ basic_string<_CharT, _Traits> __tmp;
+ __tmp.reserve(_Nb);
+
+ // Skip whitespace
+ typename basic_istream<_CharT, _Traits>::sentry __sentry(__is);
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf();
+ for (size_t __i = 0; __i < _Nb; ++__i) {
+ static _Traits::int_type __eof = _Traits::eof();
+
+ typename _Traits::int_type __c1 = __buf->sbumpc();
+ if (_Traits::eq_int_type(__c1, __eof)) {
+ __is.setstate(ios_base::eofbit);
+ break;
+ }
+ else {
+ char __c2 = _Traits::to_char_type(__c1);
+ char __c = __is.narrow(__c2, '*');
+
+ if (__c == '0' || __c == '1')
+ __tmp.push_back(__c);
+ else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) {
+ __is.setstate(ios_base::failbit);
+ break;
+ }
+ }
+ }
+
+ if (__tmp.empty())
+ __is.setstate(ios_base::failbit);
+ else
+ __x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb);
+ }
+
+ return __is;
+}
+
+template <class _CharT, class _Traits, size_t _Nb, class _WordT>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const bitset<_Nb,_WordT>& __x)
+{
+ basic_string<_CharT, _Traits> __tmp;
+ __x._M_copy_to_string(__tmp);
+ return __os << __tmp;
+}
+
+#else /* __STL_USE_NEW_IOSTREAMS */
+
+template <size_t _Nb, class _WordT>
+istream&
+operator>>(istream& __is, bitset<_Nb,_WordT>& __x) {
+ string __tmp;
+ __tmp.reserve(_Nb);
+
+ 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;
+}
+
+#endif /* __STL_USE_NEW_IOSTREAMS */
+
+// ------------------------------------------------------------
+// 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 _S_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 /* _CPP_BITSET */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/std_cassert.h b/libstdc++-v3/bits/std_cassert.h
new file mode 100644
index 000000000000..c1aefa6abb3d
--- /dev/null
+++ b/libstdc++-v3/bits/std_cassert.h
@@ -0,0 +1,38 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 19.2 Assertions
+//
+
+// Note: This is not a conforming implementation.
+
+// No include guards on this header...
+
+# include_next <assert.h>
diff --git a/libstdc++-v3/bits/std_cctype.h b/libstdc++-v3/bits/std_cctype.h
new file mode 100644
index 000000000000..b3ce7d993056
--- /dev/null
+++ b/libstdc++-v3/bits/std_cctype.h
@@ -0,0 +1,210 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: <ccytpe>
+//
+
+#ifndef _CPP_CCTYPE
+#define _CPP_CCTYPE 1
+
+// This keeps isanum, et al from being propagated as macros.
+#if __linux__
+#define __NO_CTYPE 1
+#endif
+
+# include_next <ctype.h>
+
+// Sequester the C non-inline implementations in the _C_Swamp::
+// namespace, and provide C++ inlines for them in the std:: namespace
+// where they belong.
+
+namespace std
+{
+ // NB: If not using namespaces, can't have any of these definitions,
+ // as they will duplicate what's in the global namespace.
+
+#ifdef toupper
+ inline int
+ _S_toupper_helper(int __c) { return toupper(__c); }
+# undef toupper
+ inline int
+ toupper(int __c) { return _S_toupper_helper(__c); }
+#elif _GLIBCPP_USE_NAMESPACES
+ inline int
+ toupper(int __c) { return ::toupper(__c); }
+#endif
+
+#ifdef tolower
+ inline int
+ _S_tolower_helper(int __c) { return tolower(__c); }
+# undef tolower
+ inline int
+ tolower(int __c) { return _S_tolower_helper(__c); }
+#elif _GLIBCPP_USE_NAMESPACES
+ inline int
+ tolower(int __c) { return ::tolower(__c); }
+#endif
+
+#ifdef isspace
+ inline int
+ _S_isspace_helper(int __c) { return isspace(__c); }
+# undef isspace
+ inline int
+ isspace(int __c) { return _S_isspace_helper(__c); }
+#elif _GLIBCPP_USE_NAMESPACES
+ inline int
+ isspace(int __c) { return ::isspace(__c); }
+#endif
+
+#ifdef isprint
+ inline int
+ _S_isprint_helper(int __c) { return isprint(__c); }
+# undef isprint
+ inline int
+ isprint(int __c) { return _S_isprint_helper(__c); }
+#elif _GLIBCPP_USE_NAMESPACES
+ inline int
+ isprint(int __c) { return ::isprint(__c); }
+#endif
+
+#ifdef iscntrl
+ inline int
+ _S_iscntrl_helper(int __c) { return iscntrl(__c); }
+# undef iscntrl
+ inline int
+ iscntrl(int __c) { return _S_iscntrl_helper(__c); }
+#elif _GLIBCPP_USE_NAMESPACES
+ inline int
+ iscntrl(int __c) { return ::iscntrl(__c); }
+#endif
+
+#ifdef isupper
+ inline int
+ _S_isupper_helper(int __c) { return isupper(__c); }
+# undef isupper
+ inline int
+ isupper(int __c) { return _S_isupper_helper(__c); }
+#elif _GLIBCPP_USE_NAMESPACES
+ inline int
+ isupper(int __c) { return ::isupper(__c); }
+#endif
+
+#ifdef islower
+ inline int
+ _S_islower_helper(int __c) { return islower(__c); }
+# undef islower
+ inline int
+ islower(int __c) { return _S_islower_helper(__c); }
+#elif _GLIBCPP_USE_NAMESPACES
+ inline int
+ islower(int __c) { return ::islower(__c); }
+#endif
+
+#ifdef isalpha
+ inline int
+ _S_isalpha_helper(int __c) { return isalpha(__c); }
+# undef isalpha
+ inline int
+ isalpha(int __c) { return _S_isalpha_helper(__c); }
+#elif _GLIBCPP_USE_NAMESPACES
+ inline int
+ isalpha(int __c) { return ::isalpha(__c); }
+#endif
+
+#ifdef isdigit
+ inline int
+ _S_isdigit_helper(int __c) { return isdigit(__c); }
+# undef isdigit
+ inline int
+ isdigit(int __c) { return _S_isdigit_helper(__c); }
+#elif _GLIBCPP_USE_NAMESPACES
+ inline int
+ isdigit(int __c) { return ::isdigit(__c); }
+#endif
+
+#ifdef ispunct
+ inline int
+ _S_ispunct_helper(int __c) { return ispunct(__c); }
+# undef ispunct
+ inline int
+ ispunct(int __c) { return _S_ispunct_helper(__c); }
+#elif _GLIBCPP_USE_NAMESPACES
+ inline int
+ ispunct(int __c) { return ::ispunct(__c); }
+#endif
+
+#ifdef isxdigit
+ inline int
+ _S_isxdigit_helper(int __c) { return isxdigit(__c); }
+# undef isxdigit
+ inline int
+ isxdigit(int __c) { return _S_isxdigit_helper(__c); }
+#elif _GLIBCPP_USE_NAMESPACES
+ inline int
+ isxdigit(int __c) { return ::isxdigit(__c); }
+#endif
+
+#ifdef isalnum
+ inline int
+ _S_isalnum_helper(int __c) { return isalnum(__c); }
+# undef isalnum
+ inline int
+ isalnum(int __c) { return _S_isalnum_helper(__c); }
+#elif _GLIBCPP_USE_NAMESPACES
+ inline int
+ isalnum(int __c) { return ::isalnum(__c); }
+#endif
+
+#ifdef isgraph
+ inline int
+ _S_isgraph_helper(int __c) { return isgraph(__c); }
+# undef isgraph
+ inline int
+ isgraph(int __c) { return _S_isgraph_helper(__c); }
+#elif _GLIBCPP_USE_NAMESPACES
+ inline int
+ isgraph(int __c) { return ::isgraph(__c); }
+#endif
+
+} // namespace std
+
+#endif // _CPP_CCTYPE
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_cerrno.h b/libstdc++-v3/bits/std_cerrno.h
new file mode 100644
index 000000000000..fda202d1e4fe
--- /dev/null
+++ b/libstdc++-v3/bits/std_cerrno.h
@@ -0,0 +1,39 @@
+// The -*- C++ -*- error number header.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 19.3 Error numbers
+//
+
+// Note: this is not a conforming implementation.
+
+#ifndef _CPP_CERRNO
+#define _CPP_CERRNO 1
+# include_next <errno.h>
+#endif
diff --git a/libstdc++-v3/bits/std_cfloat.h b/libstdc++-v3/bits/std_cfloat.h
new file mode 100644
index 000000000000..869c452eb3f0
--- /dev/null
+++ b/libstdc++-v3/bits/std_cfloat.h
@@ -0,0 +1,46 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 18.2.2 Implementation properties: C library
+//
+
+// Note: this is not a conforming implementation.
+
+#ifndef _CPP_CFLOAT
+#define _CPP_CFLOAT 1
+# include_next <float.h>
+
+#if 0
+# ifdef __GLIBC__
+// For GNU libc we must also include this one:
+# include <fenv.h>
+# endif
+#endif
+#endif
diff --git a/libstdc++-v3/bits/std_ciso646.h b/libstdc++-v3/bits/std_ciso646.h
new file mode 100644
index 000000000000..4f8935a70016
--- /dev/null
+++ b/libstdc++-v3/bits/std_ciso646.h
@@ -0,0 +1,71 @@
+// ciso646 -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: <ciso646>
+//
+
+#ifndef _CPP_ISO646
+#define _CPP_ISO646 1
+
+namespace std {
+
+ // 2.11 Keywords
+ // alternative representations
+ // and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq
+
+#ifndef __cplusplus
+#define and &&
+#define and_eq &=
+#define bitand &
+#define bitor |
+#define compl ~
+#define not !
+#define not_eq !=
+#define or ||
+#define or_eq |=
+#define xor ^
+#define xor_eq ^=
+#endif
+
+#if 0
+ template<typename _T1, typename _T2>
+ inline bool
+ operator and(const _T1& __lhs, const _T2& __rhs)
+ { return (static_cast<bool>(__lhs) && static_cast<bool>(__rhs)); }
+
+ template<typename _T1, typename _T2>
+ inline bool
+ operator or(const _T1& __lhs, const _T2& __rhs)
+ { return (static_cast<bool>(__lhs) || static_cast<bool>(__rhs)); }
+#endif
+
+} // namespace std
+
+#endif // _CPP_ISO646
diff --git a/libstdc++-v3/bits/std_climits.h b/libstdc++-v3/bits/std_climits.h
new file mode 100644
index 000000000000..0638ec22cc8a
--- /dev/null
+++ b/libstdc++-v3/bits/std_climits.h
@@ -0,0 +1,39 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 18.2.2 Implementation properties: C library
+//
+
+// Note: this is not a conforming implementation.
+
+#ifndef _CPP_CLIMITS
+#define _CPP_CLIMITS 1
+# include_next <limits.h>
+#endif
diff --git a/libstdc++-v3/bits/std_clocale.h b/libstdc++-v3/bits/std_clocale.h
new file mode 100644
index 000000000000..acadfd710890
--- /dev/null
+++ b/libstdc++-v3/bits/std_clocale.h
@@ -0,0 +1,40 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 18.2.2 Implementation properties: C library
+//
+
+// Note: this is not a conforming implementation.
+
+#ifndef _CPP_CLOCALE
+#define _CPP_CLOCALE 1
+# include_next <locale.h>
+#endif
+
diff --git a/libstdc++-v3/bits/std_cmath.h b/libstdc++-v3/bits/std_cmath.h
new file mode 100644
index 000000000000..04b018ff043b
--- /dev/null
+++ b/libstdc++-v3/bits/std_cmath.h
@@ -0,0 +1,247 @@
+// -*- C++ -*- C math library.
+
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 26.5 C library
+//
+
+// Note: this is not a conforming implementation.
+
+#ifndef _CPP_CMATH
+#define _CPP_CMATH 1
+# include_next <math.h>
+# include_next <stdlib.h>
+
+#include <bits/c++config.h>
+
+namespace std {
+
+ inline long
+ abs(long __l) { return ::labs(__l); }
+
+ inline ldiv_t
+ div(long __a, long __b) { return ::ldiv(__a, __b); }
+
+ // double
+ inline double
+ abs(double __x) { return ::fabs(__x); }
+
+ double
+ pow(double, int);
+
+ // float
+ inline float
+ ceil(float __x) { return ::ceil(static_cast<double>(__x)); }
+
+ inline float
+ floor(float __x) { return ::floor(static_cast<double>(__x)); }
+
+ inline float
+ fmod(float __x, float __y)
+ { return ::fmod(static_cast<double>(__x), static_cast<double>(__y)); }
+
+ inline float
+ frexp(float __x, int* __p)
+ { return ::frexp(static_cast<double>(__x), __p); }
+
+ inline float
+ ldexp(float __x, int __i)
+ { return ::ldexp(static_cast<double>(__x), __i); }
+
+ inline float
+ pow(float __x, float __y)
+ { return ::pow(static_cast<double>(__x), static_cast<double>(__y)); }
+
+ float
+ pow(float, int);
+
+#if _GLIBCPP_HAVE_ABSF
+ inline float
+ abs(float __x) { return ::absf(__x); }
+#else
+ inline float
+ abs(float __x) { return ::fabs(static_cast<double>(__x)); }
+#endif
+
+#if _GLIBCPP_HAVE_ACOSF
+ inline float
+ acos(float __x) { return ::acosf(__x); }
+#else
+ inline float
+ acos(float __x) { return ::acos(static_cast<double>(__x)); }
+#endif
+
+#if _GLIBCPP_HAVE_ASINF
+ inline float
+ asin(float __x) { return ::asinf(__x); }
+#else
+ inline float
+ asin(float __x) { return ::asin(static_cast<double>(__x)); }
+#endif
+
+#if _GLIBCPP_HAVE_ATANF
+ inline float
+ atan(float __x) { return ::atanf(__x); }
+#else
+ inline float
+ atan(float __x) { return ::atan(static_cast<double>(__x)); }
+#endif
+
+#if _GLIBCPP_HAVE_ATAN2F
+ inline float
+ atan2(float __x, float __y) { return ::atan2f(__x, __y); }
+#else
+ inline float
+ atan2(float __x, float __y)
+ { return ::atan2(static_cast<double>(__x), static_cast<double>(__y)); }
+#endif
+
+#if _GLIBCPP_HAVE_TANF
+ inline float
+ tan(float __x) { return ::tanf(__x); }
+#else
+ inline float
+ tan(float __x) { return ::tan(static_cast<double>(__x)); }
+#endif
+
+#if _GLIBCPP_HAVE_SINHF
+ inline float
+ sinh(float __x) { return ::sinhf(__x); }
+#else
+ inline float
+ sinh(float __x) { return ::sinh(static_cast<double>(__x)); }
+#endif
+
+#if _GLIBCPP_HAVE_TANHF
+ inline float
+ tanh(float __x) { return ::tanhf(__x); }
+#else
+ inline float
+ tanh(float __x) { return ::tanh(static_cast<double>(__x)); }
+#endif
+
+#if _GLIBCPP_HAVE_COSHF
+ inline float
+ cosh(float __x) { return ::coshf(__x); }
+#else
+ inline float
+ cosh(float __x) { return ::cosh(static_cast<double>(__x)); }
+#endif
+
+#if _GLIBCPP_HAVE_EXPF
+ inline float
+ exp(float __x) { return ::expf(__x); }
+#else
+ inline float
+ exp(float __x) { return ::exp(static_cast<double>(__x)); }
+#endif
+
+#if _GLIBCPP_HAVE_LOGF
+ inline float
+ log(float __x) { return ::logf(__x); }
+#else
+ inline float
+ log(float __x) { return ::log(static_cast<double>(__x)); }
+#endif
+
+#if _GLIBCPP_HAVE_LOG10F
+ inline float
+ log10(float __x) { return ::log10f(__x); }
+#else
+ inline float
+ log10(float __x) { return ::log10(static_cast<double>(__x)); }
+#endif
+
+#if _GLIBCPP_HAVE_MODFF
+ inline float
+ modf(float __x, float* __p) { return ::modff(__x, __p); }
+#else
+ inline float
+ modf(float __x, float* __p)
+ {
+ double __tmp;
+ double __res = ::modf(static_cast<double>(__x), &__tmp);
+ *__p = static_cast<float> (__tmp);
+ return __res;
+ }
+#endif
+
+#if GLIBCPP_HAS_BUILTIN_SINF
+ inline float
+ sin(float __x) { return __builtin_sinf(__x); }
+#elif _GLIBCPP_HAVE_SINF
+ inline float
+ sin(float __x) { return ::sinf(__x); }
+#else
+ inline float
+ sin(float __x) { return ::sin(static_cast<double>(__x)); }
+#endif
+
+#if GLIBCPP_HAS_BUILTIN_COSF
+ inline float
+ cos(float __x) { return __builtin_cosf(__x); }
+#elif _GLIBCPP_HAVE_COSF
+ inline float
+ cos(float __x) { return ::cosf(__x); }
+#else
+ inline float
+ cos(float __x) { return ::cos(static_cast<double>(__x)); }
+#endif
+
+#if GLIBCPP_HAS_BUILTIN_FABSF
+ inline float
+ fabs(float __x) { return __builtin_fabsf(__x); }
+#elif _GLIBCPP_HAVE_FABSF
+ inline float
+ fabs(float __x) { return ::fabsf(__x); }
+#else
+ inline float
+ fabs(float __x) { return ::fabs(static_cast<double>(__x)); }
+#endif
+
+#if GLIBCPP_HAS_BUILTIN_SQRTF
+ inline float
+ sqrt(float __x) { return __builtin_sqrtf(__x); }
+#elif _GLIBCPP_HAVE_SQRTF
+ inline float
+ sqrt(float __x) { return ::sqrtf(__x); }
+#else
+ inline float
+ sqrt(float __x) { return ::fabs(static_cast<double>(__x)); }
+#endif
+
+ // XXX long double
+ long double
+ pow(long double, int);
+
+} // std
+
+#endif // _CPP_CMATH
+
+
diff --git a/libstdc++-v3/bits/std_complex.h b/libstdc++-v3/bits/std_complex.h
new file mode 100644
index 000000000000..5064efad1a1c
--- /dev/null
+++ b/libstdc++-v3/bits/std_complex.h
@@ -0,0 +1,966 @@
+// The template and inlines for the -*- C++ -*- complex number classes.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO 14882/26.2.1
+// Note: this is not a conforming implementation.
+// Initially implemented by Ulrich Drepper <drepper@cygnus.com>
+// Improved by Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+//
+
+#ifndef _CPP_COMPLEX
+#define _CPP_COMPLEX 1
+
+#include <bits/c++config.h>
+#include <bits/std_iosfwd.h>
+
+
+namespace std
+{
+ // Forward declarations
+ template<typename _Tp> class complex;
+ template<> class complex<float>;
+ template<> class complex<double>;
+ template<> class complex<long double>;
+
+ template<typename _Tp> _Tp abs(const complex<_Tp>&);
+ template<typename _Tp> _Tp arg(const complex<_Tp>&);
+
+ template<typename _Tp> complex<_Tp> conj(const complex<_Tp>&);
+ template<typename _Tp> complex<_Tp> polar(const _Tp&, const _Tp&);
+
+ // Transcendentals:
+ template<typename _Tp> complex<_Tp> cos(const complex<_Tp>&);
+ template<typename _Tp> complex<_Tp> cosh(const complex<_Tp>&);
+ template<typename _Tp> complex<_Tp> exp(const complex<_Tp>&);
+ template<typename _Tp> complex<_Tp> log(const complex<_Tp>&);
+ template<typename _Tp> complex<_Tp> log10(const complex<_Tp>&);
+ template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, int);
+ template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, const _Tp&);
+ template<typename _Tp> complex<_Tp> pow (const complex<_Tp>&,
+ const complex<_Tp>&);
+ template<typename _Tp> complex<_Tp> pow(const _Tp&, const complex<_Tp>&);
+ template<typename _Tp> complex<_Tp> sin(const complex<_Tp>&);
+ template<typename _Tp> complex<_Tp> sinh(const complex<_Tp>&);
+ template<typename _Tp> complex<_Tp> sqrt(const complex<_Tp>&);
+ template<typename _Tp> complex<_Tp> tan(const complex<_Tp>&);
+ template<typename _Tp> complex<_Tp> tanh(const complex<_Tp>&);
+
+
+ //
+ // 26.2.2 Primary template class complex
+ //
+ template <typename _Tp>
+ class complex
+ {
+ public:
+ typedef _Tp value_type;
+
+ complex (const _Tp& = _Tp(), const _Tp & = _Tp());
+
+ // Let's the compiler synthetize the copy constructor
+ // complex (const complex<_Tp>&);
+
+ template <typename _Up>
+ complex (const complex<_Up>&);
+
+ _Tp real () const;
+ _Tp imag () const;
+
+ complex<_Tp>& operator= (const _Tp&);
+ complex<_Tp>& operator+= (const _Tp&);
+ complex<_Tp>& operator-= (const _Tp&);
+ complex<_Tp>& operator*= (const _Tp&);
+ complex<_Tp>& operator/= (const _Tp&);
+
+ // Let's the compiler synthetize the
+ // copy and assignment operator
+ // complex<_Tp>& operator= (const complex<_Tp>&);
+
+ template <typename _Up>
+ complex<_Tp>& operator= (const complex<_Up>&);
+ template <typename _Up>
+ complex<_Tp>& operator+= (const complex<_Up>&);
+ template <typename _Up>
+ complex<_Tp>& operator-= (const complex<_Up>&);
+ template <typename _Up>
+ complex<_Tp>& operator*= (const complex<_Up>&);
+ template <typename _Up>
+ complex<_Tp>& operator/= (const complex<_Up>&);
+
+ private:
+ _Tp _M_real, _M_imag;
+ };
+
+ template<typename _Tp>
+ inline _Tp
+ complex<_Tp>::real() const { return _M_real; }
+
+ template<typename _Tp>
+ inline _Tp
+ complex<_Tp>::imag() const { return _M_imag; }
+
+
+ //
+ // 26.2.3 complex specializations
+ //
+
+ //
+ // complex<float> specialization
+ //
+ template<> class complex<float>
+ {
+ public:
+ typedef float value_type;
+
+ complex(float = 0.0f, float = 0.0f);
+#ifdef _GLIBCPP_BUGGY_COMPLEX
+ complex(const complex& __z) : _M_value(__z._M_value) {}
+#endif
+ explicit complex(const complex<double>&);
+ explicit complex(const complex<long double>&);
+
+ float real() const;
+ float imag() const;
+
+ complex<float>& operator= (float);
+ complex<float>& operator+= (float);
+ complex<float>& operator-= (float);
+ complex<float>& operator*= (float);
+ complex<float>& operator/= (float);
+
+ // Let's the compiler synthetize the copy and assignment
+ // operator. It always does a pretty good job.
+ // complex& operator= (const complex&);
+
+ template <typename _Tp>
+ complex<float>&operator= (const complex<_Tp>&);
+ template <typename _Tp>
+ complex<float>& operator+= (const complex<_Tp>&);
+ template <class _Tp>
+ complex<float>& operator-= (const complex<_Tp>&);
+ template <class _Tp>
+ complex<float>& operator*= (const complex<_Tp>&);
+ template <class _Tp>
+ complex<float>&operator/= (const complex<_Tp>&);
+
+ private:
+ typedef __complex__ float _ComplexT;
+ _ComplexT _M_value;
+
+ complex(_ComplexT __z) : _M_value(__z) {}
+
+ friend class complex<double>;
+ friend class complex<long double>;
+
+ friend float abs<>(const complex<float>&);
+ friend float arg<>(const complex<float>&);
+
+ friend complex<float> conj<>(const complex<float>&);
+
+ friend complex<float> cos<>(const complex<float>&);
+ friend complex<float> cosh<>(const complex<float>&);
+ friend complex<float> exp<>(const complex<float>&);
+ friend complex<float> log<>(const complex<float>&);
+ friend complex<float> log10<>(const complex<float>&);
+ friend complex<float> pow<>(const complex<float>&, int);
+ friend complex<float> pow<>(const complex<float>&, const float&);
+ friend complex<float> pow<>(const complex<float>&,
+ const complex<float>&);
+ friend complex<float> pow<>(const float&, const complex<float>&);
+ friend complex<float> sin<>(const complex<float>&);
+ friend complex<float> sinh<>(const complex<float>&);
+ friend complex<float> sqrt<>(const complex<float>&);
+ friend complex<float> tan<>(const complex<float>&);
+ friend complex<float> tanh<>(const complex<float>&);
+ };
+
+ inline float
+ complex<float>::real() const
+ { return __real__ _M_value; }
+
+ inline float
+ complex<float>::imag() const
+ { return __imag__ _M_value; }
+
+
+ //
+ // complex<double> specialization
+ //
+ template<> class complex<double>
+ {
+ public:
+ typedef double value_type;
+
+ complex(double =0.0, double =0.0);
+#ifdef _GLIBCPP_BUGGY_COMPLEX
+ complex(const complex& __z) : _M_value(__z._M_value) {}
+#endif
+ complex(const complex<float>&);
+ explicit complex(const complex<long double>&);
+
+ double real () const;
+ double imag () const;
+
+ complex<double>& operator= (double);
+ complex<double>& operator+= (double);
+ complex<double>& operator-= (double);
+ complex<double>& operator*= (double);
+ complex<double>& operator/= (double);
+
+ // The compiler will synthetize this, efficiently.
+ // complex& operator= (const complex&);
+
+ template <typename _Tp>
+ complex<double>& operator= (const complex<_Tp>&);
+ template <typename _Tp>
+ complex<double>& operator+= (const complex<_Tp>&);
+ template <typename _Tp>
+ complex<double>& operator-= (const complex<_Tp>&);
+ template <typename _Tp>
+ complex<double>& operator*= (const complex<_Tp>&);
+ template <typename _Tp>
+ complex<double>& operator/= (const complex<_Tp>&);
+
+ private:
+ typedef __complex__ double _ComplexT;
+ _ComplexT _M_value;
+
+ complex(_ComplexT __z) : _M_value(__z) {}
+
+ friend class complex<float>;
+ friend class complex<long double>;
+
+ friend double abs<>(const complex<double>&);
+ friend double arg<>(const complex<double>&);
+
+ friend complex<double> conj<>(const complex<double>&);
+
+ friend complex<double> cos<>(const complex<double>&);
+ friend complex<double> cosh<>(const complex<double>&);
+ friend complex<double> exp<>(const complex<double>&);
+ friend complex<double> log<>(const complex<double>&);
+ friend complex<double> log10<>(const complex<double>&);
+ friend complex<double> pow<>(const complex<double>&, int);
+ friend complex<double> pow<>(const complex<double>&, const double&);
+ friend complex<double> pow<>(const complex<double>&,
+ const complex<double>&);
+ friend complex<double> pow<>(const double&, const complex<double>&);
+ friend complex<double> sin<>(const complex<double>&);
+ friend complex<double> sinh<>(const complex<double>&);
+ friend complex<double> sqrt<>(const complex<double>&);
+ friend complex<double> tan<>(const complex<double>&);
+ friend complex<double> tanh<>(const complex<double>&);
+ };
+
+ inline double
+ complex<double>::real() const
+ { return __real__ _M_value; }
+
+ inline double
+ complex<double>::imag() const
+ { return __imag__ _M_value; }
+
+
+ //
+ // complex<long double> specialization
+ //
+ template<> class complex<long double>
+ {
+ public:
+ typedef long double value_type;
+
+ complex(long double = 0.0L, long double = 0.0L);
+#ifdef _GLIBCPP_BUGGY_COMPLEX
+ complex(const complex& __z) : _M_value(__z._M_value) {}
+#endif
+ complex(const complex<float>&);
+ complex(const complex<double>&);
+
+ long double real() const;
+ long double imag() const;
+
+ complex<long double>& operator= (long double);
+ complex<long double>& operator+= (long double);
+ complex<long double>& operator-= (long double);
+ complex<long double>& operator*= (long double);
+ complex<long double>& operator/= (long double);
+
+ // The compiler knows how to do this efficiently
+ // complex& operator= (const complex&);
+
+ template<typename _Tp>
+ complex<long double>& operator= (const complex<_Tp>&);
+ template<typename _Tp>
+ complex<long double>& operator+= (const complex<_Tp>&);
+ template<typename _Tp>
+ complex<long double>& operator-= (const complex<_Tp>&);
+ template<typename _Tp>
+ complex<long double>& operator*= (const complex<_Tp>&);
+ template<typename _Tp>
+ complex<long double>& operator/= (const complex<_Tp>&);
+
+ private:
+ typedef __complex__ long double _ComplexT;
+ _ComplexT _M_value;
+
+ complex(_ComplexT __z) : _M_value(__z) {}
+
+ friend class complex<float>;
+ friend class complex<double>;
+
+ friend long double abs<>(const complex<long double>&);
+ friend long double arg<>(const complex<long double>&);
+
+ friend complex<long double> conj<>(const complex<long double>&);
+
+ friend complex<long double> cos<>(const complex<long double>&);
+ friend complex<long double> cosh<>(const complex<long double>&);
+ friend complex<long double> exp<>(const complex<long double>&);
+ friend complex<long double> log<>(const complex<long double>&);
+ friend complex<long double> log10<>(const complex<long double>&);
+ friend complex<long double> pow<>(const complex<long double>&, int);
+ friend complex<long double> pow<>(const complex<long double>&,
+ const long double&);
+ friend complex<long double> pow<>(const complex<long double>&,
+ const complex<long double>&);
+ friend complex<long double> pow<>(const long double&,
+ const complex<long double>&);
+ friend complex<long double> sin<>(const complex<long double>&);
+ friend complex<long double> sinh<>(const complex<long double>&);
+ friend complex<long double> sqrt<>(const complex<long double>&);
+ friend complex<long double> tan<>(const complex<long double>&);
+ friend complex<long double> tanh<>(const complex<long double>&);
+ };
+
+ inline
+ complex<long double>::complex(long double __r, long double __i)
+ {
+ __real__ _M_value = __r;
+ __imag__ _M_value = __i;
+ }
+
+ inline
+ complex<long double>::complex(const complex<float>& __z)
+ : _M_value(_ComplexT(__z._M_value)) {}
+
+ inline
+ complex<long double>::complex(const complex<double>& __z)
+ : _M_value(_ComplexT(__z._M_value)) {}
+
+ inline long double
+ complex<long double>::real() const
+ { return __real__ _M_value; }
+
+ inline long double
+ complex<long double>::imag() const
+ { return __imag__ _M_value; }
+
+ inline complex<long double>&
+ complex<long double>::operator= (long double __r)
+ {
+ __real__ _M_value = __r;
+ __imag__ _M_value = 0.0L;
+ return *this;
+ }
+
+ inline complex<long double>&
+ complex<long double>::operator+= (long double __r)
+ {
+ __real__ _M_value += __r;
+ return *this;
+ }
+
+ inline complex<long double>&
+ complex<long double>::operator-= (long double __r)
+ {
+ __real__ _M_value -= __r;
+ return *this;
+ }
+
+ inline complex<long double>&
+ complex<long double>::operator*= (long double __r)
+ {
+ __real__ _M_value *= __r;
+ return *this;
+ }
+
+ inline complex<long double>&
+ complex<long double>::operator/= (long double __r)
+ {
+ __real__ _M_value /= __r;
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline complex<long double>&
+ complex<long double>::operator= (const complex<_Tp>& __z)
+ {
+ __real__ _M_value = __z.real();
+ __imag__ _M_value = __z.imag();
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline complex<long double>&
+ complex<long double>::operator+= (const complex<_Tp>& __z)
+ {
+ __real__ _M_value += __z.real();
+ __imag__ _M_value += __z.imag();
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline complex<long double>&
+ complex<long double>::operator-= (const complex<_Tp>& __z)
+ {
+ __real__ _M_value -= __z.real();
+ __imag__ _M_value -= __z.imag();
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline complex<long double>&
+ complex<long double>::operator*= (const complex<_Tp>& __z)
+ {
+ _ComplexT __t;
+ __real__ __t = __z.real();
+ __imag__ __t = __z.imag();
+ _M_value *= __t;
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline complex<long double>&
+ complex<long double>::operator/= (const complex<_Tp>& __z)
+ {
+ _ComplexT __t;
+ __real__ __t = __z.real();
+ __imag__ __t = __z.imag();
+ _M_value /= __t;
+ return *this;
+ }
+
+ //
+ // complex<float> continued.
+ //
+ inline
+ complex<float>::complex(float r, float i)
+ {
+ __real__ _M_value = r;
+ __imag__ _M_value = i;
+ }
+
+ inline
+ complex<float>::complex(const complex<double>& __z)
+ : _M_value(_ComplexT(__z._M_value)) {}
+
+ inline
+ complex<float>::complex(const complex<long double>& __z)
+ : _M_value(_ComplexT(__z._M_value)) {}
+
+ inline complex<float>&
+ complex<float>::operator= (float __f)
+ {
+ __real__ _M_value = __f;
+ __imag__ _M_value = 0.0f;
+ return *this;
+ }
+
+ inline complex<float>&
+ complex<float>::operator+= (float __f)
+ {
+ __real__ _M_value += __f;
+ return *this;
+ }
+
+ inline complex<float>&
+ complex<float>::operator-= (float __f)
+ {
+ __real__ _M_value -= __f;
+ return *this;
+ }
+
+ inline complex<float>&
+ complex<float>::operator*= (float __f)
+ {
+ _M_value *= __f;
+ return *this;
+ }
+
+ inline complex<float>&
+ complex<float>::operator/= (float __f)
+ {
+ _M_value /= __f;
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline complex<float>&
+ complex<float>::operator= (const complex<_Tp>& __z)
+ {
+ __real__ _M_value = __z.real();
+ __imag__ _M_value = __z.imag();
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline complex<float>&
+ complex<float>::operator+= (const complex<_Tp>& __z)
+ {
+ __real__ _M_value += __z.real();
+ __imag__ _M_value += __z.imag();
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline complex<float>&
+ complex<float>::operator-= (const complex<_Tp>& __z)
+ {
+ __real__ _M_value -= __z.real();
+ __imag__ _M_value -= __z.real();
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline complex<float>&
+ complex<float>::operator*= (const complex<_Tp>& __z)
+ {
+ _ComplexT __t;
+ __real__ __t = __z.real();
+ __imag__ __t = __z.imag();
+ _M_value *= __t;
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline complex<float>&
+ complex<float>::operator/= (const complex<_Tp>& __z)
+ {
+ _ComplexT __t;
+ __real__ __t = __z.real();
+ __imag__ __t = __z.imag();
+ _M_value /= __t;
+ return *this;
+ }
+
+
+ //
+ // complex<double> continued.
+ //
+ inline
+ complex<double>::complex(double __r, double __i)
+ {
+ __real__ _M_value = __r;
+ __imag__ _M_value = __i;
+ }
+
+ inline
+ complex<double>::complex(const complex<float>& __z)
+ : _M_value(_ComplexT(__z._M_value)) {}
+
+ inline
+ complex<double>::complex(const complex<long double>& __z)
+ {
+ __real__ _M_value = __z.real();
+ __imag__ _M_value = __z.imag();
+ }
+
+ inline complex<double>&
+ complex<double>::operator= (double __d)
+ {
+ __real__ _M_value = __d;
+ __imag__ _M_value = 0.0;
+ return *this;
+ }
+
+ inline complex<double>&
+ complex<double>::operator+= (double __d)
+ {
+ __real__ _M_value += __d;
+ return *this;
+ }
+
+ inline complex<double>&
+ complex<double>::operator-= (double __d)
+ {
+ __real__ _M_value -= __d;
+ return *this;
+ }
+
+ inline complex<double>&
+ complex<double>::operator*= (double __d)
+ {
+ _M_value *= __d;
+ return *this;
+ }
+
+ inline complex<double>&
+ complex<double>::operator/= (double __d)
+ {
+ _M_value /= __d;
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline complex<double>&
+ complex<double>::operator= (const complex<_Tp>& __z)
+ {
+ __real__ _M_value = __z.real();
+ __imag__ _M_value = __z.imag();
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline complex<double>&
+ complex<double>::operator+= (const complex<_Tp>& __z)
+ {
+ __real__ _M_value += __z.real();
+ __imag__ _M_value += __z.imag();
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline complex<double>&
+ complex<double>::operator-= (const complex<_Tp>& __z)
+ {
+ __real__ _M_value -= __z.real();
+ __imag__ _M_value -= __z.imag();
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline complex<double>&
+ complex<double>::operator*= (const complex<_Tp>& __z)
+ {
+ _ComplexT __t;
+ __real__ __t = __z.real();
+ __imag__ __t = __z.imag();
+ _M_value *= __t;
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline complex<double>&
+ complex<double>::operator/= (const complex<_Tp>& __z)
+ {
+ _ComplexT __t;
+ __real__ __t = __z.real();
+ __imag__ __t = __z.imag();
+ _M_value /= __t;
+ return *this;
+ }
+
+ //
+ // Primary template class complex continued.
+ //
+ // 26.2.4
+ template<typename _Tp>
+ inline
+ complex<_Tp>::complex(const _Tp& __r, const _Tp& __i)
+ : _M_real(__r), _M_imag(__i) {}
+
+ template<typename _Tp>
+ template<typename _Up>
+ inline
+ complex<_Tp>::complex(const complex<_Up>& __z)
+ : _M_real(__z.real()), _M_imag(__z.imag()) {}
+
+ // 26.2.7/6
+ template<typename _Tp>
+ inline complex<_Tp>
+ conj(const complex<_Tp>& __z)
+ { return complex<_Tp>(__z.real(), -__z.imag()); }
+
+ // 26.2.7/4
+ template<typename _Tp>
+ inline _Tp
+ norm(const complex<_Tp>& __z)
+ {
+ // XXX: Grammar school computation
+ return __z.real() * __z.real() + __z.imag() * __z.imag();
+ }
+
+ template<typename _Tp>
+ complex<_Tp>&
+ complex<_Tp>::operator= (const _Tp& __t)
+ {
+ _M_real = __t;
+ _M_imag = _Tp();
+ return *this;
+ }
+
+ // 26.2.5/1
+ template<typename _Tp>
+ inline complex<_Tp>&
+ complex<_Tp>::operator+= (const _Tp& __t)
+ {
+ _M_real += __t;
+ return *this;
+ }
+
+ // 26.2.5/3
+ template<typename _Tp>
+ inline complex<_Tp>&
+ complex<_Tp>::operator-= (const _Tp& __t)
+ {
+ _M_real -= __t;
+ return *this;
+ }
+
+ // 26.2.5/5
+ template<typename _Tp>
+ complex<_Tp>&
+ complex<_Tp>::operator*= (const _Tp& __t)
+ {
+ _M_real *= __t;
+ _M_imag *= __t;
+ return *this;
+ }
+
+ // 26.2.5/7
+ template<typename _Tp>
+ complex<_Tp>&
+ complex<_Tp>::operator/= (const _Tp& __t)
+ {
+ _M_real /= __t;
+ _M_imag /= __t;
+ return *this;
+ }
+
+ template<typename _Tp>
+ template<typename _Up>
+ complex<_Tp>&
+ complex<_Tp>::operator= (const complex<_Up>& __z)
+ {
+ _M_real = __z.real();
+ _M_imag = __z.imag();
+ return *this;
+ }
+
+ // 26.2.5/9
+ template<typename _Tp>
+ template<typename _Up>
+ complex<_Tp>&
+ complex<_Tp>::operator+= (const complex<_Up>& __z)
+ {
+ _M_real += __z.real();
+ _M_imag += __z.imag();
+ return *this;
+ }
+
+ // 26.2.5/11
+ template<typename _Tp>
+ template<typename _Up>
+ complex<_Tp>&
+ complex<_Tp>::operator-= (const complex<_Up>& __z)
+ {
+ _M_real -= __z.real();
+ _M_imag -= __z.imag();
+ return *this;
+ }
+
+ // 26.2.5/13
+ // XXX: this is a grammar school implementation.
+ template<typename _Tp>
+ template<typename _Up>
+ complex<_Tp>&
+ complex<_Tp>::operator*= (const complex<_Up>& __z)
+ {
+ _Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
+ _M_imag = _M_real * __z.imag() + _M_imag * __z.real();
+ _M_real = __r;
+ return *this;
+ }
+
+ // 26.2.5/15
+ // XXX: this is a grammar school implementation.
+ template<typename _Tp>
+ template<typename _Up>
+ complex<_Tp>&
+ complex<_Tp>::operator/= (const complex<_Up>& __z)
+ {
+ _Tp __r = _M_real * __z.real() + _M_imag * __z.imag();
+ _Tp __n = norm(__z);
+ _M_imag = (_M_real * __z.imag() - _M_imag * __z.real()) / __n;
+ _M_real = __r / __n;
+ return *this;
+ }
+
+
+ // Operators:
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
+ { return complex<_Tp> (__x) += __y; }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator+(const complex<_Tp>& __x, const _Tp& __y)
+ { return complex<_Tp> (__x) += __y; }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator+(const _Tp& __x, const complex<_Tp>& __y)
+ { return complex<_Tp> (__y) += __x; }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
+ { return complex<_Tp> (__x) -= __y; }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator-(const complex<_Tp>& __x, const _Tp& __y)
+ { return complex<_Tp> (__x) -= __y; }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator-(const _Tp& __x, const complex<_Tp>& __y)
+ { return complex<_Tp> (__x) -= __y; }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator*(const complex<_Tp>& __x, const complex<_Tp>& __y)
+ { return complex<_Tp> (__x) *= __y; }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator*(const complex<_Tp>& __x, const _Tp& __y)
+ { return complex<_Tp> (__x) *= __y; }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator*(const _Tp& __x, const complex<_Tp>& __y)
+ { return complex<_Tp> (__y) *= __x; }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator/(const complex<_Tp>& __x, const complex<_Tp>& __y)
+ { return complex<_Tp> (__x) /= __y; }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator/(const complex<_Tp>& __x, const _Tp& __y)
+ { return complex<_Tp> (__x) /= __y; }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator/(const _Tp& __x, const complex<_Tp>& __y)
+ { return complex<_Tp> (__x) /= __y; }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator+(const complex<_Tp>& __x)
+ { return __x; }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator-(const complex<_Tp>& __x)
+ { return complex<_Tp>(-__x.real(), -__x.imag()); }
+
+ template<typename _Tp>
+ inline bool
+ operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
+ { return __x.real() == __y.real() && __x.imag == __y.imag(); }
+
+ template<typename _Tp>
+ inline bool
+ operator==(const complex<_Tp>& __x, const _Tp& __y)
+ { return __x.real() == __y && __x.imag() == 0; }
+
+ template<typename _Tp>
+ inline bool
+ operator==(const _Tp& __x, const complex<_Tp>& __y)
+ { return __x == __y.real() && 0 == __y.imag(); }
+
+ template<typename _Tp>
+ inline bool
+ operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
+ { return __x.real() != __y.real() || __x.imag() != __y.imag(); }
+
+ template<typename _Tp>
+ inline bool
+ operator!=(const complex<_Tp>& __x, const _Tp& __y)
+ { return __x.real() != __y || __x.imag() != 0; }
+
+ template<typename _Tp>
+ inline bool
+ operator!=(const _Tp& __x, const complex<_Tp>& __y)
+ { return __x != __y.real() || 0 != __y.imag(); }
+
+ template<typename _Tp, typename _CharT, class _Traits>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&);
+
+ template<typename _Tp, typename _CharT, class _Traits>
+ basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>&, const complex<_Tp>&);
+
+
+ // Values:
+ template <typename _Tp>
+ inline _Tp
+ real (const complex<_Tp>& __z)
+ { return __z.real(); }
+
+ template <typename _Tp>
+ inline _Tp
+ imag (const complex<_Tp>& __z)
+ { return __z.imag(); }
+
+
+ // We use here a few more specializations.
+ template<>
+ inline complex<float>
+ conj(const complex<float> &__x)
+#ifdef _GLIBCPP_BUGGY_FLOAT_COMPLEX
+ {
+ complex<float> __tmpf(~__x._M_value);
+ return __tmpf;
+ }
+#else
+ { return complex<float>(~__x._M_value); }
+#endif
+
+ template<>
+ inline complex<double>
+ conj(const complex<double> &__x)
+ { return complex<double> (~__x._M_value); }
+
+ template<>
+ inline complex<long double>
+ conj(const complex<long double> &__x)
+ {
+ return complex<long double> (~__x._M_value);
+ }
+
+} // namespace std
+
+#endif /* _CPP_COMPLEX */
diff --git a/libstdc++-v3/bits/std_csetjmp.h b/libstdc++-v3/bits/std_csetjmp.h
new file mode 100644
index 000000000000..e94488b85b82
--- /dev/null
+++ b/libstdc++-v3/bits/std_csetjmp.h
@@ -0,0 +1,39 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+// Note: this is not a conforming implementation.
+
+#ifndef _CPP_CSETJMP
+#define _CPP_CSETJMP 1
+# include_next <setjmp.h>
+#endif
diff --git a/libstdc++-v3/bits/std_csignal.h b/libstdc++-v3/bits/std_csignal.h
new file mode 100644
index 000000000000..b300f5b0547b
--- /dev/null
+++ b/libstdc++-v3/bits/std_csignal.h
@@ -0,0 +1,39 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+// Note: this is not a conforming implementation.
+
+#ifndef _CPP_CSIGNAL
+#define _CPP_CSIGNAL 1
+# include_next <signal.h>
+#endif
diff --git a/libstdc++-v3/bits/std_cstdarg.h b/libstdc++-v3/bits/std_cstdarg.h
new file mode 100644
index 000000000000..5b0ca7d6e638
--- /dev/null
+++ b/libstdc++-v3/bits/std_cstdarg.h
@@ -0,0 +1,39 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+// Note: this is not a conforming implementation.
+
+#ifndef _CPP_CSTDARG
+#define _CPP_CSTDARG 1
+# include_next <stdarg.h>
+#endif
diff --git a/libstdc++-v3/bits/std_cstddef.h b/libstdc++-v3/bits/std_cstddef.h
new file mode 100644
index 000000000000..66a1b5d4a05a
--- /dev/null
+++ b/libstdc++-v3/bits/std_cstddef.h
@@ -0,0 +1,39 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 18.1 Types
+//
+
+// Note: this is not a conforming implementation.
+
+#ifndef _CPP_CSTDDEF
+#define _CPP_CSTDDEF 1
+# include_next <stddef.h>
+#endif
diff --git a/libstdc++-v3/bits/std_cstdio.h b/libstdc++-v3/bits/std_cstdio.h
new file mode 100644
index 000000000000..aec526d1b623
--- /dev/null
+++ b/libstdc++-v3/bits/std_cstdio.h
@@ -0,0 +1,60 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.8.2 C Library files
+//
+
+// Note: this is not a conforming implementation.
+
+#ifndef _CPP_CSTDIO
+#define _CPP_CSTDIO 1
+# include_next <stdio.h>
+
+#ifndef SEEK_CUR
+#define SEEK_CUR 1
+#endif
+
+#ifndef SEEK_END
+#define SEEK_END 2
+#endif
+
+#ifndef SEEK_SET
+#define SEEK_SET 4
+#endif
+
+#endif
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_cstdlib.h b/libstdc++-v3/bits/std_cstdlib.h
new file mode 100644
index 000000000000..adbefa2ad773
--- /dev/null
+++ b/libstdc++-v3/bits/std_cstdlib.h
@@ -0,0 +1,53 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+// Note: this is not a conforming implementation.
+
+#ifndef _CPP_CSTDLIB
+#define _CPP_CSTDLIB 1
+
+// This keeps isanum, et al from being propagated as macros.
+#if __linux__
+#define __USE_ISOC9X 1
+#endif
+
+# include_next <stdlib.h>
+
+#endif // _CPP_CSTDLIB
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_cstring.h b/libstdc++-v3/bits/std_cstring.h
new file mode 100644
index 000000000000..c076b6a12d01
--- /dev/null
+++ b/libstdc++-v3/bits/std_cstring.h
@@ -0,0 +1,43 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+// Note: this is not a conforming implementation.
+
+#ifndef _CPP_CSTRING
+#define _CPP_CSTRING 1
+# if defined __GLIBC__ && __GLIBC__ >= 2
+// We must not see the optimized string functions GNU libc defines.
+# define __NO_STRING_INLINES
+# endif
+# include_next <string.h>
+#endif
diff --git a/libstdc++-v3/bits/std_ctime.h b/libstdc++-v3/bits/std_ctime.h
new file mode 100644
index 000000000000..08c07b6d5f63
--- /dev/null
+++ b/libstdc++-v3/bits/std_ctime.h
@@ -0,0 +1,39 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 20.5 Date and time
+//
+
+// Note: this is not a conforming implementation.
+
+#ifndef _CPP_CTIME
+#define _CPP_CTIME 1
+# include_next <time.h>
+#endif
diff --git a/libstdc++-v3/bits/std_cwchar.h b/libstdc++-v3/bits/std_cwchar.h
new file mode 100644
index 000000000000..8c606dc80de7
--- /dev/null
+++ b/libstdc++-v3/bits/std_cwchar.h
@@ -0,0 +1,108 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: ???
+//
+
+// Note: this is not a conforming implementation.
+
+#ifndef _CPP_CWCHAR
+#define _CPP_CWCHAR 1
+
+#include <bits/c++config.h>
+#ifdef _GLIBCPP_USE_WCHAR_T
+ # include_next <wchar.h>
+#endif
+
+extern "C" {
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+
+#ifndef _GLIBCPP_HAVE_WMEMCMP
+ int wmemcmp(const wchar_t* __s1, const wchar_t* __s2, size_t __n);
+#endif
+
+#ifndef _GLIBCPP_HAVE_WCSLEN
+ size_t wcslen(const wchar_t* __s);
+#endif
+
+#ifndef _GLIBCPP_HAVE_WMEMCHR
+ wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n);
+#endif
+
+#ifndef _GLIBCPP_HAVE_WMEMMOVE
+ wchar_t* wmemmove(wchar_t* __s1, const wchar_t* __s2, size_t __n);
+#endif
+
+#ifndef _GLIBCPP_HAVE_WMEMCPY
+ wchar_t* wmemcpy(wchar_t* __s1, const wchar_t* __s2, size_t __n);
+#endif
+
+#ifndef _GLIBCPP_HAVE_WMEMSET
+ wchar_t* wmemset(wchar_t* __s, wchar_t __c, size_t __n);
+#endif
+
+#endif //_GLIBCPP_USE_WCHAR_T
+
+// NB: mbstate_t should be defined in <cwchar>, as per
+// 21.2 p5
+// If not, autoconf will
+// detect this with some configure time magic and define
+// _GLIBCPP_NEED_MBSTATE_T (see config.h in the build directory.)
+#ifdef _GLIBCPP_NEED_MBSTATE_T
+ typedef struct
+ {
+ int __fill[6];
+ } mbstate_t;
+#endif
+}
+
+
+#endif // _CPP_CWCHAR
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_cwctype.h b/libstdc++-v3/bits/std_cwctype.h
new file mode 100644
index 000000000000..97db4b85423b
--- /dev/null
+++ b/libstdc++-v3/bits/std_cwctype.h
@@ -0,0 +1,164 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: <cwctype>
+//
+
+#ifndef _CPP_CWCTYPE
+#define _CPP_CWCTYPE 1
+
+// This keeps isanum, et al from being propagated as macros.
+#if __linux__
+#define __NO_WCTYPE 1
+#endif
+
+# include_next <wctype.h>
+
+// Sequester the C non-inline implementations in the _C_Swamp::
+// namespace, and provide C++ inlines for them in the std:: namespace
+// where they belong.
+
+namespace std
+{
+
+#ifdef towupper
+ inline wint_t
+ _S_towupper_helper(wint_t __wc) { return towupper(__wc); }
+# undef towupper
+ inline wint_t
+ towupper(wint_t __wc) { return _S_towupper_helper(__wc); }
+#endif
+
+#ifdef towlower
+ inline wint_t
+ _S_towlower_helper(wint_t __wc) { return towlower(__wc); }
+# undef towlower
+ inline wint_t
+ towlower(wint_t __wc) { return _S_towlower_helper(__wc); }
+#endif
+
+#ifdef iswspace
+ inline int
+ _S_iswspace_helper(wint_t __wc) { return iswspace(__wc); }
+# undef iswspace
+ inline int
+ iswspace(wint_t __wc) { return _S_iswspace_helper(__wc); }
+#endif
+
+#ifdef iswprint
+ inline int
+ _S_iswprint_helper(wint_t __wc) { return iswprint(__wc); }
+# undef iswprint
+ inline int
+ iswprint(wint_t __wc) { return _S_iswprint_helper(__wc); }
+#endif
+
+#ifdef iswcntrl
+ inline int
+ _S_iswcntrl_helper(wint_t __wc) { return iswcntrl(__wc); }
+# undef iswcntrl
+ inline int
+ iswcntrl(wint_t __wc) { return _S_iswcntrl_helper(__wc); }
+#endif
+
+#ifdef iswupper
+ inline int
+ _S_iswupper_helper(wint_t __wc) { return iswupper(__wc); }
+# undef iswupper
+ inline int
+ iswupper(wint_t __wc) { return _S_iswupper_helper(__wc); }
+#endif
+
+#ifdef iswlower
+ inline int
+ _S_iswlower_helper(wint_t __wc) { return iswlower(__wc); }
+# undef iswlower
+ inline int
+ iswlower(wint_t __wc) { return _S_iswlower_helper(__wc); }
+#endif
+
+#ifdef iswalpha
+ inline int
+ _S_iswalpha_helper(wint_t __wc) { return iswalpha(__wc); }
+# undef iswalpha
+ inline int
+ iswalpha(wint_t __wc) { return _S_iswalpha_helper(__wc); }
+#endif
+
+#ifdef iswdigit
+ inline int
+ _S_iswdigit_helper(wint_t __wc) { return iswdigit(__wc); }
+# undef iswdigit
+ inline int
+ iswdigit(wint_t __wc) { return _S_iswdigit_helper(__wc); }
+#endif
+
+#ifdef iswpunct
+ inline int
+ _S_iswpunct_helper(wint_t __wc) { return iswpunct(__wc); }
+# undef iswpunct
+ inline int
+ iswpunct(wint_t __wc) { return _S_iswpunct_helper(__wc); }
+#endif
+
+#ifdef iswxdigit
+ inline int
+ _S_iswxdigit_helper (wint_t __wc) { return iswxdigit(__wc); }
+# undef iswxdigit
+ inline int
+ iswxdigit(wint_t __wc) { return _S_iswxdigit_helper(__wc); }
+#endif
+
+#ifdef iswalnum
+ inline int
+ _S_iswalnum_helper(wint_t __wc) { return iswalnum(__wc); }
+# undef iswalnum
+ inline int
+ iswalnum(wint_t __wc) { return _S_iswalnum_helper(__wc); }
+#endif
+
+#ifdef iswgraph
+ inline int
+ _S_iswgraph_helper(wint_t __wc) { return iswgraph(__wc); }
+# undef iswgraph
+ inline int
+ iswgraph(wint_t __wc) { return _S_iswgraph_helper(__wc); }
+#endif
+
+} // namespace std
+
+#endif // _CPP_CWCTYPE
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_deque.h b/libstdc++-v3/bits/std_deque.h
new file mode 100644
index 000000000000..574ab3137554
--- /dev/null
+++ b/libstdc++-v3/bits/std_deque.h
@@ -0,0 +1,41 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_DEQUE
+#define _CPP_DEQUE 1
+
+#include <bits/stl_range_errors.h>
+#include <bits/stl_algobase.h>
+#include <bits/stl_alloc.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_uninitialized.h>
+#include <bits/stl_deque.h>
+
+#endif /* _CPP_DEQUE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/std_exception.h b/libstdc++-v3/bits/std_exception.h
new file mode 100644
index 000000000000..66cf46d95cc5
--- /dev/null
+++ b/libstdc++-v3/bits/std_exception.h
@@ -0,0 +1,80 @@
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_EXCEPTION
+#define _CPP_EXCEPTION 1
+
+#ifdef __GNUG__
+#include_next <exception>
+#else
+
+#include <bits/stl_config.h>
+
+__STL_BEGIN_NAMESPACE
+
+ // 18.6 Exception handling
+ class exception;
+ class bad_exception;
+
+ typedef void (*unexpected_handler)();
+ unexpected_handler set_unexpected(unexpected_handler) throw();
+ void unexpected();
+ typedef void (*terminate_handler)();
+ terminate_handler set_terminate(terminate_handler) throw();
+ void terminate();
+ bool uncaught_exception();
+
+ // 18.6.1 Class exception
+ class exception {
+ public:
+ exception() throw();
+ exception(const exception&) throw();
+ exception& operator=(const exception&) throw();
+ virtual ~exception() throw();
+ virtual const char* what() const throw();
+ };
+
+ // 18.6.2.1 Class bad_exception
+ class bad_exception : public exception {
+ public:
+ bad_exception() throw();
+ bad_exception(const bad_exception&) throw();
+ bad_exception& operator=(const bad_exception&) throw();
+ virtual ~bad_exception() throw();
+ virtual const char* what() const throw();
+ };
+
+__STL_END_NAMESPACE
+
+#endif /* __GNUG__ */
+
+#endif /* _CPP_EXCEPTION */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/std_fstream.h b/libstdc++-v3/bits/std_fstream.h
new file mode 100644
index 000000000000..0ebbc7602727
--- /dev/null
+++ b/libstdc++-v3/bits/std_fstream.h
@@ -0,0 +1,386 @@
+// File based streams -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.8 File-based streams
+//
+
+#ifndef _CPP_FSTREAM
+#define _CPP_FSTREAM 1
+
+#include <bits/std_istream.h>
+#include <bits/std_ostream.h>
+#include <bits/basic_file.h>
+#include <bits/std_locale.h> // For codecvt
+#include <bits/c++threads.h> // For __mutext_type
+
+namespace std {
+
+ template<typename _CharT, typename _Traits>
+ class basic_filebuf : public basic_streambuf<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ // Non-standard Types:
+ typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
+ typedef basic_filebuf<_CharT, _Traits> __filebuf_type;
+ typedef __basic_file __file_type;
+ typedef typename _Traits::state_type __state_type;
+ typedef codecvt<_CharT, char, __state_type> __codecvt_type;
+ typedef codecvt<_CharT, char, __state_type>::result __res_type;
+
+ friend ios_base; // For sync_with_stdio.
+
+ private:
+ // Data Members:
+ __file_type* _M_file;
+ bool _M_last_overflowed; // XXX Needed?
+ __state_type _M_state_cur;// Current state type for codecvt.
+ __state_type _M_state_beg;
+ const __codecvt_type* _M_fcvt; // Cached value from use_facet.
+ __mutext_type _M_lock;
+
+ public:
+ // Constructors/destructor:
+ basic_filebuf();
+
+ // Non-standard ctor:
+ basic_filebuf(int __fd, const char* __name = "unknown",
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+
+ virtual
+ ~basic_filebuf()
+ {
+ this->close();
+ _M_fcvt = NULL;
+ delete _M_file;
+ _M_file = NULL;
+ _M_last_overflowed = false;
+ }
+
+ // Members:
+ bool
+ is_open(void) const { return _M_file ? _M_file->is_open() : false; }
+
+ __filebuf_type*
+ open(const char* __s, ios_base::openmode __mode);
+
+ __filebuf_type*
+ close(void);
+
+ protected:
+ // Common initialization code for both ctors goes here.
+ void
+ _M_init_filebuf(void);
+
+ // Overridden virtual functions:
+ virtual streamsize
+ showmanyc(void);
+
+ // Stroustrup, 1998, p. 628
+ // underflow() and uflow() functions are called to get the next
+ // charater from the real input source when the buffer is empty.
+ // Buffered input uses underflow()
+ virtual int_type
+ underflow(void);
+
+ virtual int_type
+ pbackfail(int_type __c = _Traits::eof());
+
+ // NB: For what the standard expects of the overflow function,
+ // see _M_really_overflow(), below. Because basic_streambuf's
+ // sputc/sputn call overflow directly, and the complications of
+ // this implementation's setting of the initial pointers all
+ // equal to _M_buf when initializing, it seems essential to have
+ // this in actuality be a helper function that checks for the
+ // eccentricities of this implementation, and then call
+ // overflow() if indeed the buffer is full.
+ virtual int_type
+ overflow(int_type __c = _Traits::eof());
+
+ // Stroustrup, 1998, p 648
+ // The overflow() function is called to transfer characters to the
+ // real output destination when the buffer is full. A call to
+ // overflow(c) outputs the contents of the buffer plus the
+ // character c.
+ // 27.5.2.4.5
+ // Consume some sequence of the characters in the pending sequence.
+ int_type
+ _M_really_overflow(int_type __c = _Traits::eof());
+
+ virtual __streambuf_type*
+ setbuf(char_type* __s, streamsize __n)
+ {
+ if (!this->is_open() && __s == 0 && __n == 0)
+ _M_buf_size = 0;
+ _M_last_overflowed = false;
+ return this;
+ }
+
+ virtual pos_type
+ seekoff(off_type __off, ios_base::seekdir __way,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+
+ virtual pos_type
+ seekpos(pos_type __pos,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+
+ virtual int
+ sync(void)
+ {
+ bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
+ if (__testput)
+ {
+ // Make sure that libio resyncs its idea of the file position
+ // with the external file.
+ _M_file->sync();
+
+ // Need to restore current position. This interpreted as
+ // the position of the external byte sequence (_M_file)
+ // plus the offset in the current internal buffer
+ // (_M_out_beg - _M_out_cur)
+ __c_streampos __cur = _M_file->seekoff(0, ios_base::cur);
+ off_type __off = _M_out_cur - _M_out_beg;
+ this->_M_really_overflow();
+ _M_file->seekpos(__cur + __off);
+ }
+ _M_last_overflowed = false;
+ return 0;
+ }
+
+ virtual void
+ imbue(const locale& __loc);
+
+ void
+ _M_output_unshift();
+ };
+
+ typedef basic_filebuf<char> filebuf;
+ typedef basic_filebuf<wchar_t> wfilebuf;
+
+ // 27.8.1.5 Template class basic_ifstream
+ template<typename _CharT, typename _Traits>
+ class basic_ifstream : public basic_istream<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ // Non-standard types:
+ typedef basic_filebuf<_CharT, _Traits> __filebuf_type;
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+
+ // Constructors/Destructors:
+ basic_ifstream()
+ : __istream_type(new __filebuf_type())
+ { }
+
+ explicit
+ basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
+ : __istream_type(new __filebuf_type())
+ { this->open(__s, __mode); }
+
+ ~basic_ifstream()
+ {
+ delete _M_streambuf;
+ _M_streambuf = NULL;
+ }
+
+ // Members:
+ __filebuf_type*
+ rdbuf() const
+ { return static_cast<__filebuf_type*>(_M_streambuf); }
+
+ bool
+ is_open(void) { return rdbuf()->is_open(); }
+
+ void
+ open(const char* __s, ios_base::openmode __mode = ios_base::in)
+ {
+ if (rdbuf()->open(__s, __mode | ios_base::in) == NULL)
+ this->setstate(ios_base::failbit);
+ }
+
+ void
+ close(void)
+ {
+ if (!rdbuf()->close())
+ this->setstate(ios_base::failbit);
+ }
+ };
+
+ // 27.8.1.8 Template class basic_ofstream
+ template<typename _CharT, typename _Traits>
+ class basic_ofstream : public basic_ostream<_CharT,_Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ // Non-standard types:
+ typedef basic_filebuf<_CharT, _Traits> __filebuf_type;
+ typedef basic_ostream<_CharT, _Traits> __ostream_type;
+
+ // Constructors:
+ basic_ofstream()
+ : __ostream_type(new __filebuf_type())
+ { }
+
+ explicit
+ basic_ofstream(const char* __s,
+ ios_base::openmode __mode = ios_base::out|ios_base::trunc)
+ : __ostream_type(new __filebuf_type())
+ { this->open(__s, __mode); }
+
+ ~basic_ofstream()
+ {
+ delete _M_streambuf;
+ _M_streambuf = NULL;
+ }
+
+ // Members:
+ __filebuf_type*
+ rdbuf(void) const
+ { return static_cast<__filebuf_type*>(_M_streambuf); }
+
+ bool
+ is_open(void) { return rdbuf()->is_open(); }
+
+ void
+ open(const char* __s,
+ ios_base::openmode __mode = ios_base::out | ios_base::trunc)
+ {
+ if (!rdbuf()->open(__s, __mode | ios_base::out))
+ this->setstate (ios_base::failbit);
+ }
+
+ void
+ close(void)
+ {
+ if (!rdbuf()->close())
+ setstate (ios_base::failbit);
+ }
+ };
+
+ typedef basic_ofstream<char> ofstream;
+ typedef basic_ofstream<wchar_t> wofstream;
+
+
+ // 27.8.1.11 Template class basic_fstream
+ template<typename _CharT, typename _Traits>
+ class basic_fstream : public basic_iostream<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ // Non-standard types:
+ typedef basic_filebuf<_CharT, _Traits> __filebuf_type;
+ typedef basic_ios<_CharT, _Traits> __ios_type;
+ typedef basic_iostream<_CharT, _Traits> __iostream_type;
+
+ // Constructors/destructor:
+ basic_fstream()
+ : __iostream_type(new __filebuf_type())
+ { }
+
+ explicit
+ basic_fstream(const char* __s,
+ ios_base::openmode __mode = ios_base::in | ios_base::out)
+ : __iostream_type(new __filebuf_type())
+ { this->open(__s, __mode); }
+
+ ~basic_fstream()
+ {
+ delete _M_streambuf;
+ _M_streambuf = NULL;
+ }
+
+ // Members:
+ __filebuf_type*
+ rdbuf(void) const
+ { return static_cast<__filebuf_type*>(_M_streambuf); }
+
+ bool
+ is_open(void) { return rdbuf()->is_open(); }
+
+ void
+ open(const char* __s,
+ ios_base::openmode __mode = ios_base::in | ios_base::out)
+ {
+ if (!rdbuf()->open(__s, __mode))
+ setstate (ios_base::failbit);
+ }
+
+ void
+ close(void)
+ {
+ if (!rdbuf()->close())
+ setstate (ios_base::failbit);
+ }
+ };
+
+ typedef basic_fstream<char> fstream;
+ typedef basic_fstream<wchar_t> wfstream;
+
+} // namespace std
+
+
+#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
+# define export
+#ifdef _GLIBCPP_FULLY_COMPLIANT_HEADERS
+# include <bits/fstream.tcc>
+#endif
+#endif
+
+#endif /* _CPP_FSTREAM */
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_functional.h b/libstdc++-v3/bits/std_functional.h
new file mode 100644
index 000000000000..0336c2aedab1
--- /dev/null
+++ b/libstdc++-v3/bits/std_functional.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+#ifndef _CPP_FUNCTIONAL
+#define _CPP_FUNCTIONAL
+
+#include <bits/stl_config.h>
+#include <bits/std_cstddef.h>
+#include <bits/stl_function.h>
+
+#endif /* _CPP_FUNCTIONAL */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/libstdc++-v3/bits/std_iomanip.h b/libstdc++-v3/bits/std_iomanip.h
new file mode 100644
index 000000000000..6fa49386b672
--- /dev/null
+++ b/libstdc++-v3/bits/std_iomanip.h
@@ -0,0 +1,219 @@
+// Standard stream manipulators -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.6.3 Standard manipulators
+//
+
+#ifndef _CPP_IOMANIP
+#define _CPP_IOMANIP 1
+
+#include <bits/c++config.h>
+#include <bits/std_istream.h>
+#include <bits/std_functional.h>
+
+namespace std {
+
+ struct _Resetiosflags { ios_base::fmtflags _M_mask; };
+
+ inline _Resetiosflags
+ resetiosflags(ios_base::fmtflags __mask)
+ {
+ _Resetiosflags __x;
+ __x._M_mask = __mask;
+ return __x;
+ }
+
+ template <class _CharT, class _Traits>
+ basic_istream<_CharT,_Traits>&
+ operator>>(basic_istream<_CharT,_Traits>& __is, _Resetiosflags __f)
+ {
+ __is.setf(ios_base::fmtflags(0), __f._M_mask);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ basic_ostream<_CharT,_Traits>&
+ operator<<(basic_ostream<_CharT,_Traits>& __os, _Resetiosflags __f)
+ {
+ __os.setf(ios_base::fmtflags(0), __f._M_mask);
+ return __os;
+ }
+
+
+ struct _Setiosflags { ios_base::fmtflags _M_mask; };
+
+ inline _Setiosflags
+ setiosflags (ios_base::fmtflags __mask)
+ {
+ _Setiosflags __x;
+ __x._M_mask = __mask;
+ return __x;
+ }
+
+ template <class _CharT, class _Traits>
+ basic_istream<_CharT,_Traits>&
+ operator>>(basic_istream<_CharT,_Traits>& __is, _Setiosflags __f)
+ {
+ __is.setf(__f._M_mask);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ basic_ostream<_CharT,_Traits>&
+ operator<<(basic_ostream<_CharT,_Traits>& __os, _Setiosflags __f)
+ {
+ __os.setf(__f._M_mask);
+ return __os;
+ }
+
+
+ struct _Setbase { int _M_base; };
+
+ inline _Setbase
+ setbase (int __base)
+ {
+ _Setbase __x;
+ __x._M_base = __base;
+ return __x;
+ }
+
+ template <class _CharT, class _Traits>
+ basic_istream<_CharT,_Traits>&
+ operator>>(basic_istream<_CharT,_Traits>& __is, _Setbase __f)
+ {
+ __is.setf(__f._M_base == 8 ? ios_base::oct :
+ __f._M_base == 10 ? ios_base::dec :
+ __f._M_base == 16 ? ios_base::hex :
+ ios_base::fmtflags(0), ios_base::basefield);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ basic_ostream<_CharT,_Traits>&
+ operator<<(basic_ostream<_CharT,_Traits>& __os, _Setbase __f)
+ {
+ __os.setf(__f._M_base == 8 ? ios_base::oct :
+ __f._M_base == 10 ? ios_base::dec :
+ __f._M_base == 16 ? ios_base::hex :
+ ios_base::fmtflags(0), ios_base::basefield);
+ return __os;
+ }
+
+
+ template<class _CharT>
+ struct _Setfill { _CharT _M_c; };
+
+ template<class _CharT>
+ _Setfill<_CharT>
+ setfill(_CharT __c)
+ {
+ _Setfill<_CharT> __x;
+ __x._M_c = __c;
+ return __x;
+ }
+
+ template <class _CharT, class _Traits>
+ basic_istream<_CharT,_Traits>&
+ operator>>(basic_istream<_CharT,_Traits>& __is, _Setfill<_CharT> __f)
+ {
+ __is.fill(__f._M_c);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ basic_ostream<_CharT,_Traits>&
+ operator<<(basic_ostream<_CharT,_Traits>& __os, _Setfill<_CharT> __f)
+ {
+ __os.fill(__f._M_c);
+ return __os;
+ }
+
+
+ struct _Setprecision { int _M_n; };
+
+ inline _Setprecision
+ setprecision(int __n)
+ {
+ _Setprecision __x;
+ __x._M_n = __n;
+ return __x;
+ }
+
+ template <class _CharT, class _Traits>
+ basic_istream<_CharT,_Traits>&
+ operator>>(basic_istream<_CharT,_Traits>& __is, _Setprecision __f)
+ {
+ __is.precision(__f._M_n);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ basic_ostream<_CharT,_Traits>&
+ operator<<(basic_ostream<_CharT,_Traits>& __os, _Setprecision __f)
+ {
+ __os.precision(__f._M_n);
+ return __os;
+ }
+
+
+ struct _Setw { int _M_n; };
+
+ inline _Setw
+ setw(int __n)
+ {
+ _Setw __x;
+ __x._M_n = __n;
+ return __x;
+ }
+
+ template <class _CharT, class _Traits>
+ basic_istream<_CharT,_Traits>&
+ operator>>(basic_istream<_CharT,_Traits>& __is, _Setw __f)
+ {
+ __is.width(__f._M_n);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ basic_ostream<_CharT,_Traits>&
+ operator<<(basic_ostream<_CharT,_Traits>& __os, _Setw __f)
+ {
+ __os.width(__f._M_n);
+ return __os;
+ }
+
+} // namespace std
+
+#endif /* __IOMANIP */
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_ios.h b/libstdc++-v3/bits/std_ios.h
new file mode 100644
index 000000000000..7c54547c2ab3
--- /dev/null
+++ b/libstdc++-v3/bits/std_ios.h
@@ -0,0 +1,52 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.4 Iostreams base classes
+//
+
+#ifndef _CPP_IOS
+#define _CPP_IOS 1
+
+#include <bits/std_iosfwd.h>
+#include <bits/std_exception.h> // For ios_base::failure
+#include <bits/char_traits.h> // For char_traits, streamoff, streamsize, fpos
+#include <bits/stl_string_fwd.h>// For string.
+#include <bits/std_cstdio.h> // For SEEK_SET, SEEK_CUR, SEEK_END
+# include <bits/localefwd.h> // For class locale
+#include <bits/ios_base.h> // For ios_base declarations.
+#include <bits/std_streambuf.h>
+#include <bits/basic_ios.h>
+
+#endif /* _CPP_IOS */
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_iosfwd.h b/libstdc++-v3/bits/std_iosfwd.h
new file mode 100644
index 000000000000..3a8eb056ddc6
--- /dev/null
+++ b/libstdc++-v3/bits/std_iosfwd.h
@@ -0,0 +1,157 @@
+// Forwarding declarations -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.2 Forward declarations
+//
+
+#ifndef _CPP_IOSFWD
+#define _CPP_IOSFWD 1
+
+#include <bits/c++config.h>
+#include <bits/std_cwchar.h> //For mbstate_t
+
+namespace std {
+
+ // Generic declarations.
+ template<typename _CharT> struct char_traits;
+ template<typename _Alloc> class allocator;
+
+ // Forward declarations
+ template<> class char_traits<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<> class char_traits<wchar_t>;
+#endif
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_ios;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_streambuf;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_istream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_ostream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_iostream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT>,
+ typename _Alloc = allocator<_CharT> >
+ class basic_stringbuf;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT>,
+ typename _Alloc = allocator<_CharT> >
+ class basic_istringstream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT>,
+ typename _Alloc = allocator<_CharT> >
+ class basic_ostringstream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT>,
+ typename _Alloc = allocator<_CharT> >
+ class basic_stringstream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_filebuf;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_ifstream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_ofstream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_fstream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class istreambuf_iterator;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class ostreambuf_iterator;
+
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ // Not included.
+ class ios_base;
+#endif
+
+ template<class _State> struct fpos;
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ // Can't have self-recursive types for streampos.
+ // 21.1.3.1 char_traits sets size_type to streampos
+ // 27.4.1
+ // And here, where streampos is typedefed to fpos<traits::state_type>
+ typedef fpos<mbstate_t> streampos;
+# ifdef _GLIBCPP_USE_WCHAR_T
+ typedef fpos<mbstate_t> wstreampos;
+# endif
+#endif
+
+ typedef basic_ios<char> ios;
+ typedef basic_streambuf<char> streambuf;
+ typedef basic_istream<char> istream;
+ typedef basic_ostream<char> ostream;
+ typedef basic_iostream<char> iostream;
+ typedef basic_stringbuf<char> stringbuf;
+ typedef basic_istringstream<char> istringstream;
+ typedef basic_ostringstream<char> ostringstream;
+ typedef basic_stringstream<char> stringstream;
+ typedef basic_filebuf<char> filebuf;
+ typedef basic_ifstream<char> ifstream;
+ typedef basic_ofstream<char> ofstream;
+ typedef basic_fstream<char> fstream;
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ typedef basic_ios<wchar_t> wios;
+ typedef basic_streambuf<wchar_t> wstreambuf;
+ typedef basic_istream<wchar_t> wistream;
+ typedef basic_ostream<wchar_t> wostream;
+ typedef basic_iostream<wchar_t> wiostream;
+ typedef basic_stringbuf<wchar_t> wstringbuf;
+ typedef basic_istringstream<wchar_t> wistringstream;
+ typedef basic_ostringstream<wchar_t> wostringstream;
+ typedef basic_stringstream<wchar_t> wstringstream;
+ typedef basic_filebuf<wchar_t> wfilebuf;
+ typedef basic_ifstream<wchar_t> wifstream;
+ typedef basic_ofstream<wchar_t> wofstream;
+ typedef basic_fstream<wchar_t> wfstream;
+#endif
+
+} // namespace std
+
+#endif // _CPP_IOSFWD
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_iostream.h b/libstdc++-v3/bits/std_iostream.h
new file mode 100644
index 000000000000..b08d038046d3
--- /dev/null
+++ b/libstdc++-v3/bits/std_iostream.h
@@ -0,0 +1,58 @@
+// Standard iostream objects -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.3 Standard iostream objects
+//
+
+#ifndef _CPP_IOSTREAM
+#define _CPP_IOSTREAM 1
+
+#include <bits/c++config.h>
+#include <bits/std_ostream.h>
+#include <bits/std_istream.h>
+
+namespace std {
+
+ extern istream cin;
+ extern ostream cout;
+ extern ostream cerr;
+ extern ostream clog;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ extern wistream wcin;
+ extern wostream wcout;
+ extern wostream wcerr;
+ extern wostream wclog;
+#endif
+
+ // For construction of filebuffers for cout, cin, cerr, clog et. al.
+ static ios_base::Init __ioinit;
+} // namespace std
+
+#endif /* _CPP_IOSTREAM */
diff --git a/libstdc++-v3/bits/std_istream.h b/libstdc++-v3/bits/std_istream.h
new file mode 100644
index 000000000000..baddea47f8a2
--- /dev/null
+++ b/libstdc++-v3/bits/std_istream.h
@@ -0,0 +1,307 @@
+// Input streams -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.6.1 Input streams
+//
+
+#ifndef _CPP_ISTREAM
+#define _CPP_ISTREAM 1
+
+#include <bits/std_ios.h>
+#include <bits/std_limits.h> // For numeric_limits
+
+namespace std {
+
+ // 27.6.1.1 Template class basic_istream
+ template<typename _CharT, typename _Traits>
+ class basic_istream : virtual public basic_ios<_CharT, _Traits>
+ {
+ public:
+
+ // Types (inherited from basic_ios (27.4.4)):
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ // Non-standard Types:
+ typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
+ typedef basic_ios<_CharT, _Traits> __ios_type;
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef istreambuf_iterator<_CharT> __istreambuf_iter;
+ typedef num_get<_CharT, __istreambuf_iter> __numget_type;
+ typedef ctype<_CharT> __ctype_type;
+
+ protected:
+ // Data Members:
+ streamsize _M_gcount;
+
+ public:
+ // 27.6.1.1.1 Constructor/destructor:
+ explicit
+ basic_istream(__streambuf_type* __sb)
+ {
+ this->init(__sb);
+ _M_gcount = streamsize(0);
+ }
+
+ virtual
+ ~basic_istream()
+ {
+ _M_gcount = streamsize(0);
+ _M_fnumget = NULL;
+ }
+
+ // 27.6.1.1.2 Prefix/suffix:
+ class sentry;
+ friend class sentry;
+
+ // 27.6.1.2 Formatted input:
+ // 27.6.1.2.3 basic_istream::operator>>
+ __istream_type&
+ operator>>(__istream_type& (*__pf)(__istream_type&));
+
+ __istream_type&
+ operator>>(__ios_type& (*__pf)(__ios_type&));
+
+ __istream_type&
+ operator>>(ios_base& (*__pf)(ios_base&));
+
+ // 27.6.1.2.2 Arithmetic Extractors
+ __istream_type&
+ operator>>(bool& __n);
+
+ __istream_type&
+ operator>>(short& __n);
+
+ __istream_type&
+ operator>>(unsigned short& __n);
+
+ __istream_type&
+ operator>>(int& __n);
+
+ __istream_type&
+ operator>>(unsigned int& __n);
+
+ __istream_type&
+ operator>>(long& __n);
+
+ __istream_type&
+ operator>>(unsigned long& __n);
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ __istream_type&
+ operator>>(long long& __n);
+
+ __istream_type&
+ operator>>(unsigned long long& __n);
+#endif
+
+ __istream_type&
+ operator>>(float& __f);
+
+ __istream_type&
+ operator>>(double& __f);
+
+ __istream_type&
+ operator>>(long double& __f);
+
+ __istream_type&
+ operator>>(void*& __p);
+
+ __istream_type&
+ operator>>(__streambuf_type* __sb);
+
+ // 27.6.1.3 Unformatted input:
+ inline streamsize
+ gcount(void) const
+ { return _M_gcount; }
+
+ int_type
+ get(void);
+
+ __istream_type&
+ get(char_type& __c);
+
+ __istream_type&
+ get(char_type* __s, streamsize __n, char_type __delim);
+
+ inline __istream_type&
+ get(char_type* __s, streamsize __n)
+ { return get(__s, __n, this->widen('\n')); }
+
+ __istream_type&
+ get(__streambuf_type& __sb, char_type __delim);
+
+ inline __istream_type&
+ get(__streambuf_type& __sb)
+ { return get(__sb, this->widen('\n')); }
+
+ __istream_type&
+ getline(char_type* __s, streamsize __n, char_type __delim);
+
+ inline __istream_type&
+ getline(char_type* __s, streamsize __n)
+ { return getline(__s, __n, this->widen('\n')); }
+
+ __istream_type&
+ ignore(streamsize __n = 1, int_type __delim = traits_type::eof());
+
+ int_type
+ peek(void);
+
+ __istream_type&
+ read(char_type* __s, streamsize __n);
+
+ streamsize
+ readsome(char_type* __s, streamsize __n);
+
+ __istream_type&
+ putback(char_type __c);
+
+ __istream_type&
+ unget(void);
+
+ int
+ sync(void);
+
+ pos_type
+ tellg(void);
+
+ __istream_type&
+ seekg(pos_type);
+
+ __istream_type&
+ seekg(off_type, ios_base::seekdir);
+
+ private:
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ // Not defined.
+ __istream_type&
+ operator=(const __istream_type&);
+
+ basic_istream(const __istream_type&);
+#endif
+ };
+
+ template<typename _CharT, typename _Traits>
+ class basic_istream<_CharT, _Traits>::sentry
+ {
+ public:
+
+ typedef _Traits traits_type;
+ typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef __istream_type::__ctype_type __ctype_type;
+ typedef typename _Traits::int_type __int_type;
+
+ explicit
+ sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
+
+ operator bool() { return _M_ok; }
+
+ private:
+ bool _M_ok;
+ };
+
+ // 27.6.1.2.3 Character extraction templates
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c);
+
+ template<class _Traits>
+ basic_istream<char, _Traits>&
+ operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
+ { return (__in >> static_cast<char>(__c)); }
+
+ template<class _Traits>
+ basic_istream<char, _Traits>&
+ operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
+ { return (__in >> static_cast<char>(__c)); }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s);
+
+ template<class _Traits>
+ basic_istream<char,_Traits>&
+ operator>>(basic_istream<char,_Traits>& __in, unsigned char* __s)
+ { return (__in >> reinterpret_cast<char*>(__s)); }
+
+ template<class _Traits>
+ basic_istream<char,_Traits>&
+ operator>>(basic_istream<char,_Traits>& __in, signed char* __s)
+ { return (__in >> reinterpret_cast<char*>(__s)); }
+
+ // 27.6.1.5 Template class basic_iostream
+ template<typename _CharT, typename _Traits>
+ class basic_iostream
+ : public basic_istream<_CharT, _Traits>,
+ public basic_ostream<_CharT, _Traits>
+ {
+ public:
+
+ // Non-standard Types:
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef basic_ostream<_CharT, _Traits> __ostream_type;
+
+ explicit
+ basic_iostream(basic_streambuf<_CharT, _Traits>* __sb)
+ : __istream_type(__sb), __ostream_type(__sb)
+ { }
+
+ virtual
+ ~basic_iostream() { }
+ };
+
+ // 27.6.1.4 Standard basic_istream manipulators
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ ws(basic_istream<_CharT, _Traits>& __is);
+
+} // namespace std
+
+#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
+# define export
+#ifdef _GLIBCPP_FULLY_COMPLIANT_HEADERS
+# include <bits/istream.tcc>
+#endif
+#endif
+
+#endif /* _CPP_ISTREAM */
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_iterator.h b/libstdc++-v3/bits/std_iterator.h
new file mode 100644
index 000000000000..643cff99cb8f
--- /dev/null
+++ b/libstdc++-v3/bits/std_iterator.h
@@ -0,0 +1,46 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_ITERATOR
+#define _CPP_ITERATOR 1
+
+#include <bits/stl_config.h>
+#include <bits/stl_relops.h>
+#include <bits/std_cstddef.h>
+#include <bits/std_iosfwd.h>
+#include <bits/stl_iterator_base.h>
+#include <bits/stl_iterator.h>
+
+#endif /* _CPP_ITERATOR */
+
+// Local Variables:
+// mode:C++
+// End:
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_list.h b/libstdc++-v3/bits/std_list.h
new file mode 100644
index 000000000000..eaf1258cca68
--- /dev/null
+++ b/libstdc++-v3/bits/std_list.h
@@ -0,0 +1,40 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_LIST
+#define _CPP_LIST 1
+
+#include <bits/stl_algobase.h>
+#include <bits/stl_alloc.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_uninitialized.h>
+#include <bits/stl_list.h>
+
+#endif /* _CPP_LIST */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/std_locale.h b/libstdc++-v3/bits/std_locale.h
new file mode 100644
index 000000000000..85100444fb96
--- /dev/null
+++ b/libstdc++-v3/bits/std_locale.h
@@ -0,0 +1,44 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+#ifndef _CPP_LOCALE
+#define _CPP_LOCALE 1
+
+#include <bits/localefwd.h>
+#include <bits/locale_facets.h>
+
+#endif
+
+// Local Variables:
+// mode:c++
+// End:
diff --git a/libstdc++-v3/bits/std_map.h b/libstdc++-v3/bits/std_map.h
new file mode 100644
index 000000000000..9390ab8689dc
--- /dev/null
+++ b/libstdc++-v3/bits/std_map.h
@@ -0,0 +1,40 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_MAP
+#define _CPP_MAP 1
+
+#ifndef _CPP_BITS_STL_TREE_H /* XXX is this guard necessary? */
+#include <bits/stl_tree.h>
+#endif
+#include <bits/stl_map.h>
+#include <bits/stl_multimap.h>
+
+#endif /* _CPP_MAP */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/std_memory.h b/libstdc++-v3/bits/std_memory.h
new file mode 100644
index 000000000000..005c7d3728cf
--- /dev/null
+++ b/libstdc++-v3/bits/std_memory.h
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+#ifndef _CPP_MEMORY
+#define _CPP_MEMORY 1
+
+#include <bits/stl_algobase.h>
+#include <bits/stl_alloc.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_iterator_base.h> //for iterator_traits
+#include <bits/stl_tempbuf.h>
+#include <bits/stl_uninitialized.h>
+#include <bits/stl_raw_storage_iter.h>
+
+__STL_BEGIN_NAMESPACE
+
+#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \
+ defined(__STL_MEMBER_TEMPLATES)
+
+ template<class _Tp1> struct auto_ptr_ref {
+ _Tp1* _M_ptr;
+ auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {}
+};
+
+#endif
+
+template <class _Tp> class auto_ptr {
+private:
+ _Tp* _M_ptr;
+
+public:
+ typedef _Tp element_type;
+
+ explicit auto_ptr(_Tp* __p = 0) __STL_NOTHROW : _M_ptr(__p) {}
+ auto_ptr(auto_ptr& __a) __STL_NOTHROW : _M_ptr(__a.release()) {}
+
+#ifdef __STL_MEMBER_TEMPLATES
+ template <class _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) __STL_NOTHROW
+ : _M_ptr(__a.release()) {}
+#endif /* __STL_MEMBER_TEMPLATES */
+
+ auto_ptr& operator=(auto_ptr& __a) __STL_NOTHROW {
+ reset(__a.release());
+ return *this;
+ }
+
+#ifdef __STL_MEMBER_TEMPLATES
+ template <class _Tp1>
+ auto_ptr& operator=(auto_ptr<_Tp1>& __a) __STL_NOTHROW {
+ reset(__a.release());
+ return *this;
+ }
+#endif /* __STL_MEMBER_TEMPLATES */
+
+ ~auto_ptr() __STL_NOTHROW { delete _M_ptr; }
+
+ _Tp& operator*() const __STL_NOTHROW {
+ return *_M_ptr;
+ }
+ _Tp* operator->() const __STL_NOTHROW {
+ return _M_ptr;
+ }
+ _Tp* get() const __STL_NOTHROW {
+ return _M_ptr;
+ }
+ _Tp* release() __STL_NOTHROW {
+ _Tp* __tmp = _M_ptr;
+ _M_ptr = 0;
+ return __tmp;
+ }
+ void reset(_Tp* __p = 0) __STL_NOTHROW {
+ if (__p != _M_ptr) {
+ delete _M_ptr;
+ _M_ptr = __p;
+ }
+ }
+
+ // According to the C++ standard, these conversions are required. Most
+ // present-day compilers, however, do not enforce that requirement---and,
+ // in fact, most present-day compilers do not support the language
+ // features that these conversions rely on.
+
+#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \
+ defined(__STL_MEMBER_TEMPLATES)
+
+public:
+ auto_ptr(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW
+ : _M_ptr(__ref._M_ptr) {}
+
+ auto_ptr& operator=(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW {
+ if (__ref._M_ptr != this->get()) {
+ delete _M_ptr;
+ _M_ptr = __ref._M_ptr;
+ }
+ return *this;
+ }
+
+ template <class _Tp1> operator auto_ptr_ref<_Tp1>() __STL_NOTHROW
+ { return auto_ptr_ref<_Tp>(this->release()); }
+ template <class _Tp1> operator auto_ptr<_Tp1>() __STL_NOTHROW
+ { return auto_ptr<_Tp1>(this->release()); }
+
+#endif /* auto ptr conversions && member templates */
+};
+
+__STL_END_NAMESPACE
+
+#endif /* _CPP_MEMORY */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/std_new.h b/libstdc++-v3/bits/std_new.h
new file mode 100644
index 000000000000..1ac2dd05325c
--- /dev/null
+++ b/libstdc++-v3/bits/std_new.h
@@ -0,0 +1,81 @@
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _CPP_NEW
+#define _CPP_NEW 1
+
+#include <bits/c++config.h>
+
+#ifdef __GNUG__
+# include_next <new>
+#else
+
+#include <bits/std_exception.h>
+
+
+// 18.4 Dynamic memory management
+
+__STL_BEGIN_NAMESPACE
+
+ class bad_alloc;
+ struct nothrow_t {};
+ extern const nothrow_t nothrow;
+ typedef void (*new_handler)();
+ new_handler set_new_handler(new_handler) throw();
+
+ class bad_alloc : public exception {
+ public:
+ bad_alloc() throw();
+ bad_alloc(const bad_alloc&) throw();
+ bad_alloc& operator=(const bad_alloc&) throw();
+ virtual ~bad_alloc() throw();
+ virtual const char* what() const throw();
+ };
+
+__STL_END_NAMESPACE
+
+ void* operator new(__STD::size_t) throw(__STD::bad_alloc);
+ void* operator new(__STD::size_t, const __STD::nothrow_t&) throw();
+ void operator delete(void*) throw();
+ void operator delete(void*, const __STD::nothrow_t&) throw();
+ void* operator new[](__STD::size_t) throw(__STD::bad_alloc);
+ void* operator new[](__STD::size_t, const __STD::nothrow_t&) throw();
+ void operator delete[](void*) throw();
+ void operator delete[](void*, const __STD::nothrow_t&) throw();
+ void* operator new (__STD::size_t, void*) throw();
+ void* operator new[](__STD::size_t, void*) throw();
+ void operator delete (void*, void*) throw();
+ void operator delete[](void*, void*) throw();
+
+#endif
+
+#endif /* _CPP_NEW */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/std_numeric.h b/libstdc++-v3/bits/std_numeric.h
new file mode 100644
index 000000000000..8b7c6fd96669
--- /dev/null
+++ b/libstdc++-v3/bits/std_numeric.h
@@ -0,0 +1,41 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_NUMERIC
+#define _CPP_NUMERIC 1
+
+#include <bits/stl_config.h>
+#include <bits/stl_relops.h>
+#include <bits/std_cstddef.h>
+#include <bits/std_iterator.h>
+#include <bits/stl_function.h>
+#include <bits/stl_numeric.h>
+
+#endif /* _CPP_NUMERIC */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/std_ostream.h b/libstdc++-v3/bits/std_ostream.h
new file mode 100644
index 000000000000..eff25b90625b
--- /dev/null
+++ b/libstdc++-v3/bits/std_ostream.h
@@ -0,0 +1,288 @@
+// Output streams -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.6.2 Output streams
+//
+
+#ifndef _CPP_OSTREAM
+#define _CPP_OSTREAM 1
+
+#include <bits/std_ios.h>
+
+namespace std {
+
+ // 27.6.2.1 Template class basic_ostream
+ template<typename _CharT, typename _Traits>
+ class basic_ostream : virtual public basic_ios<_CharT, _Traits>
+ {
+ public:
+
+ // Types (inherited from basic_ios (27.4.4)):
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ // Non-standard Types:
+ typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
+ typedef basic_ios<_CharT, _Traits> __ios_type;
+ typedef basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef ostreambuf_iterator<_CharT> __ostreambuf_iter;
+ typedef num_put<_CharT, __ostreambuf_iter> __numput_type;
+ typedef ctype<_CharT> __ctype_type;
+
+ // 27.6.2.2 Constructor/destructor:
+ explicit
+ basic_ostream(__streambuf_type* __sb)
+ { this->init(__sb); }
+
+ virtual
+ ~basic_ostream()
+ { _M_fnumput = NULL; }
+
+ // 27.6.2.3 Prefix/suffix:
+ class sentry;
+ friend class sentry;
+
+ // 27.6.2.5 Formatted output:
+ // 27.6.2.5.3 basic_ostream::operator<<
+ __ostream_type&
+ operator<<(__ostream_type& (*__pf)(__ostream_type&));
+
+ __ostream_type&
+ operator<<(__ios_type& (*__pf)(__ios_type&));
+
+ __ostream_type&
+ operator<<(ios_base& (*__pf) (ios_base&));
+
+ // 27.6.2.5.2 Arithmetic Inserters
+ __ostream_type&
+ operator<<(long __n);
+
+ __ostream_type&
+ operator<<(unsigned long __n);
+
+ __ostream_type&
+ operator<<(bool __n);
+
+ __ostream_type&
+ operator<<(short __n)
+ {
+ ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
+ if (__fmt & ios_base::oct || __fmt & ios_base::hex)
+ return this->operator<<(static_cast<unsigned long>
+ (static_cast<unsigned short>(__n)));
+ else
+ return this->operator<<(static_cast<long>(__n));
+ }
+
+ __ostream_type&
+ operator<<(unsigned short __n)
+ { return this->operator<<(static_cast<unsigned long>(__n)); }
+
+ __ostream_type&
+ operator<<(int __n)
+ {
+ ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
+ if (__fmt & ios_base::oct || __fmt & ios_base::hex)
+ return this->operator<<(static_cast<unsigned long>
+ (static_cast<unsigned int>(__n)));
+ else
+ return this->operator<<(static_cast<long>(__n));
+ }
+
+ __ostream_type&
+ operator<<(unsigned int __n)
+ { return this->operator<<(static_cast<unsigned long>(__n)); }
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ __ostream_type&
+ operator<<(long long __n);
+
+ __ostream_type&
+ operator<<(unsigned long long __n);
+#endif
+
+ __ostream_type&
+ operator<<(double __f);
+
+ __ostream_type&
+ operator<<(float __f)
+ { return this->operator<<(static_cast<double>(__f)); }
+
+ __ostream_type&
+ operator<<(long double __f);
+
+ __ostream_type&
+ operator<<(const void* __p);
+
+ __ostream_type&
+ operator<<(__streambuf_type* __sb);
+
+ // Unformatted output:
+ __ostream_type&
+ put(char_type __c);
+
+ __ostream_type&
+ write(const char_type* __s, streamsize __n);
+
+ __ostream_type&
+ flush();
+
+ // Seeks:
+ pos_type
+ tellp();
+
+ __ostream_type&
+ seekp(pos_type);
+
+ __ostream_type&
+ seekp(off_type, ios_base::seekdir);
+
+ private:
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ // Not defined.
+ __ostream_type&
+ operator=(const __ostream_type&);
+
+ basic_ostream(const __ostream_type&);
+#endif
+ };
+
+ // 27.6.2.3 Class basic_ostream::sentry
+ template <typename _CharT, typename _Traits>
+ class basic_ostream<_CharT, _Traits>::sentry
+ {
+ // Data Members:
+ bool _M_ok;
+ basic_ostream<_CharT,_Traits>& _M_os;
+
+ public:
+ explicit
+ sentry(basic_ostream<_CharT,_Traits>& __os);
+
+ ~sentry()
+ {
+ // XXX MT
+ if (_M_os.flags() & ios_base::unitbuf && !uncaught_exception())
+ {
+ // Can't call flush directly or else will get into recursive lock.
+ if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1)
+ _M_os.setstate(ios_base::badbit);
+ }
+ }
+
+ operator bool()
+ { return _M_ok; }
+ };
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c);
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
+ { return (__out << __out.widen(__c)); }
+
+ // Specialization
+ template <class _Traits>
+ basic_ostream<char, _Traits>&
+ operator<<(basic_ostream<char, _Traits>& __out, char __c);
+
+ // Signed and unsigned
+ template<class _Traits>
+ basic_ostream<char, _Traits>&
+ operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
+ { return (__out << static_cast<char>(__c)); }
+
+ template<class _Traits>
+ basic_ostream<char, _Traits>&
+ operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
+ { return (__out << static_cast<char>(__c)); }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s);
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits> &
+ operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s);
+
+ // Partial specializationss
+ template<class _Traits>
+ basic_ostream<char, _Traits>&
+ operator<<(basic_ostream<char, _Traits>& __out, const char* __s);
+
+ // Signed and unsigned
+ template<class _Traits>
+ basic_ostream<char, _Traits>&
+ operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
+ { return (__out << reinterpret_cast<const char*>(__s)); }
+
+ template<class _Traits>
+ basic_ostream<char, _Traits> &
+ operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
+ { return (__out << reinterpret_cast<const char*>(__s)); }
+
+ // 27.6.2.7 Standard basic_ostream manipulators
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ endl(basic_ostream<_CharT, _Traits>& __os)
+ { return flush(__os.put(__os.widen('\n'))); }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ ends(basic_ostream<_CharT, _Traits>& __os)
+ { return __os.put(_Traits::eos()); }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ flush(basic_ostream<_CharT, _Traits>& __os)
+ { return __os.flush(); }
+
+} // namespace std
+
+#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
+# define export
+#ifdef _GLIBCPP_FULLY_COMPLIANT_HEADERS
+# include <bits/ostream.tcc>
+#endif
+#endif
+
+#endif /* _CPP_OSTREAM */
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_queue.h b/libstdc++-v3/bits/std_queue.h
new file mode 100644
index 000000000000..198b2c03508a
--- /dev/null
+++ b/libstdc++-v3/bits/std_queue.h
@@ -0,0 +1,45 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_QUEUE
+#define _CPP_QUEUE 1
+
+#include <bits/stl_algobase.h>
+#include <bits/stl_alloc.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_uninitialized.h>
+#include <bits/stl_vector.h>
+#include <ext/stl_bvector.h>
+#include <bits/stl_heap.h>
+#include <bits/stl_deque.h>
+#include <bits/stl_function.h>
+#include <bits/stl_queue.h>
+
+#endif /* _CPP_QUEUE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/std_set.h b/libstdc++-v3/bits/std_set.h
new file mode 100644
index 000000000000..7a5f5c5b4ece
--- /dev/null
+++ b/libstdc++-v3/bits/std_set.h
@@ -0,0 +1,40 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_SET
+#define _CPP_SET 1
+
+#ifndef _CPP_BITS_STL_TREE_H /* XXX is this guard needed? */
+#include <bits/stl_tree.h>
+#endif
+#include <bits/stl_set.h>
+#include <bits/stl_multiset.h>
+
+#endif /* _CPP_SET */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/std_sstream.h b/libstdc++-v3/bits/std_sstream.h
new file mode 100644
index 000000000000..68a36c22b44a
--- /dev/null
+++ b/libstdc++-v3/bits/std_sstream.h
@@ -0,0 +1,367 @@
+// String based streams -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.7 String-based streams
+//
+
+#ifndef _CPP_SSTREAM
+#define _CPP_SSTREAM 1
+
+#include <bits/std_istream.h>
+#include <bits/std_ostream.h>
+
+namespace std {
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class basic_stringbuf : public basic_streambuf<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+ // Non-standard types:
+ typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ typedef __string_type::size_type __size_type;
+
+ private:
+ // Data Members:
+ __string_type _M_string;
+
+ public:
+ // Constructors:
+ explicit
+ basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out)
+ : __streambuf_type(), _M_string()
+ { _M_init_stringbuf(__mode); }
+
+ explicit
+ basic_stringbuf(const __string_type& __str,
+ ios_base::openmode __mode = ios_base::in | ios_base::out)
+ : __streambuf_type(), _M_string(__str)
+ { _M_init_stringbuf(__mode); }
+
+ // Get and set:
+ __string_type
+ str() const
+ {
+ if (_M_mode & ios_base::in && !(_M_mode & ios_base::out))
+ return _M_string;
+ else
+ {
+ // This is the deal: _M_string.size() is value that
+ // represents the size of the intial string that makes
+ // _M_string, and may not be the correct size of the
+ // current stringbuf internal buffer.
+ __size_type __len = _M_string.size();
+ if (_M_out_cur > _M_out_beg)
+ __len = max(__size_type(_M_out_end - _M_out_beg), __len);
+ return __string_type(_M_out_beg, _M_out_beg + __len);
+ }
+ }
+
+ void
+ str(const __string_type& __s)
+ {
+ _M_string = __s;
+ _M_init_stringbuf(_M_mode);
+ }
+
+ protected:
+ // Common initialization code for both ctors goes here.
+ void
+ _M_init_stringbuf(ios_base::openmode __mode)
+ {
+ // _M_buf_size is a convenient alias for "what the streambuf
+ // thinks the allocated size of the string really is." This is
+ // necessary as ostringstreams are implemented with the
+ // streambufs having control of the allocation and
+ // re-allocation of the internal string object, _M_string.
+ _M_buf_size = _M_string.size();
+ _M_mode = __mode;
+ if (_M_mode & ios_base::ate)
+ _M_really_sync(0, _M_buf_size);
+ else
+ _M_really_sync(0, 0);
+ }
+
+ // Overridden virtual functions:
+ virtual int_type
+ underflow()
+ {
+ if (_M_in_cur && _M_in_cur < _M_in_end)
+ return traits_type::to_int_type(*gptr());
+ else
+ return traits_type::eof();
+ }
+
+ virtual int_type
+ pbackfail(int_type __c = traits_type::eof());
+
+ virtual int_type
+ overflow(int_type __c = traits_type::eof());
+
+ virtual __streambuf_type*
+ setbuf(char_type* __s, streamsize __n)
+ {
+ if (__n)
+ {
+ _M_string = __string_type(__s, __n);
+ _M_really_sync(0, 0);
+ }
+ return this;
+ }
+
+ virtual pos_type
+ seekoff(off_type __off, ios_base::seekdir __way,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+
+ virtual pos_type
+ seekpos(pos_type __sp,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+
+ // Internal function for correctly updating the internal buffer
+ // for a particular _M_string, due to initialization or
+ // re-sizing of an existing _M_string.
+ // Assumes: contents of _M_string and internal buffer match exactly.
+ // __i == _M_in_cur - _M_in_beg
+ // __o == _M_out_cur - _M_out_beg
+ virtual int
+ _M_really_sync(__size_type __i, __size_type __o)
+ {
+ char_type* __base = const_cast<char_type*>(_M_string.data());
+ bool __testin = _M_mode & ios_base::in;
+ bool __testout = _M_mode & ios_base::out;
+ __size_type __len = _M_string.size();
+
+ _M_buf = __base;
+ if (__testin)
+ this->setg(__base, __base + __i, __base + __len);
+ if (__testout)
+ {
+ this->setp(__base, __base + __len);
+ _M_out_cur += __o;
+ }
+ return 0;
+ }
+ };
+
+ typedef basic_stringbuf<char> stringbuf;
+ typedef basic_stringbuf<wchar_t> wstringbuf;
+
+
+ // 27.7.2 Template class basic_istringstream
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class basic_istringstream : public basic_istream<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ // Non-standard types:
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+
+ // Constructors:
+ explicit
+ basic_istringstream(ios_base::openmode __mode = ios_base::in)
+ : __istream_type(new __stringbuf_type(__mode | ios_base::in))
+ { }
+
+ explicit
+ basic_istringstream(const __string_type& __str,
+ ios_base::openmode __mode = ios_base::in)
+ : __istream_type(new __stringbuf_type(__str, __mode | ios_base::in))
+ { }
+
+ ~basic_istringstream()
+ {
+ delete _M_streambuf;
+ _M_streambuf = NULL;
+ }
+
+ // Members:
+ __stringbuf_type*
+ rdbuf() const
+ { return static_cast<__stringbuf_type*>(_M_streambuf); }
+
+ __string_type
+ str() const
+ { return this->rdbuf()->str(); }
+
+ void
+ str(const __string_type& __s)
+ { rdbuf()->str(__s); }
+
+ };
+
+ typedef basic_istringstream<char> istringstream;
+ typedef basic_istringstream<wchar_t> wistringstream;
+
+ // 27.7.3 Template class basic_ostringstream
+ template <typename _CharT, typename _Traits, typename _Alloc>
+ class basic_ostringstream : public basic_ostream<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+ // Non-standard types:
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
+ typedef basic_ostream<_CharT, _Traits> __ostream_type;
+
+ // Constructors/destructor:
+ explicit
+ basic_ostringstream(ios_base::openmode __mode = ios_base::out)
+ : __ostream_type(new __stringbuf_type(__mode | ios_base::out))
+ { }
+
+ explicit
+ basic_ostringstream(const __string_type __str,
+ ios_base::openmode __mode = ios_base::out)
+ : __ostream_type(new __stringbuf_type(__str, __mode | ios_base::out))
+ { }
+
+ ~basic_ostringstream()
+ {
+ delete _M_streambuf;
+ _M_streambuf = NULL;
+ }
+
+ // Members:
+ __stringbuf_type*
+ rdbuf() const
+ { return static_cast<__stringbuf_type*>(_M_streambuf); }
+
+ __string_type
+ str() const
+ { return this->rdbuf()->str(); }
+
+ void
+ str(const __string_type& __s)
+ { rdbuf()->str(__s); }
+
+ };
+
+ typedef basic_ostringstream<char> ostringstream;
+ typedef basic_ostringstream<wchar_t> wostringstream;
+
+ // 27.7.4 Template class basic_stringstream
+ template <typename _CharT, typename _Traits, typename _Alloc>
+ class basic_stringstream : public basic_iostream<_CharT, _Traits>
+ {
+ public:
+ // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+ // Non-standard types:
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
+ typedef basic_iostream<_CharT, _Traits> __iostream_type;
+
+ // Constructors/destructors
+ explicit
+ basic_stringstream(ios_base::openmode __mode =
+ ios_base::out | ios_base::in)
+ : __iostream_type(new __stringbuf_type(__mode))
+ { }
+
+ explicit
+ basic_stringstream(const __string_type& __str,
+ ios_base::openmode __mode =
+ ios_base::out | ios_base::in)
+ : __iostream_type(new __stringbuf_type(__str, __mode))
+ { }
+
+ ~basic_stringstream()
+ {
+ delete _M_streambuf;
+ _M_streambuf = NULL;
+ }
+
+ // Members:
+ __stringbuf_type*
+ rdbuf() const
+ { return static_cast<__stringbuf_type*>(_M_streambuf); }
+
+ __string_type
+ str() const
+ { return rdbuf()->str(); }
+
+ void
+ str(const __string_type& __s)
+ { rdbuf()->str(__s); }
+ };
+
+ typedef basic_stringstream<char> stringstream;
+ typedef basic_stringstream<wchar_t> wstringstream;
+
+} // namespace std
+
+
+
+#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
+# define export
+#ifdef _GLIBCPP_FULLY_COMPLIANT_HEADERS
+# include <bits/sstream.tcc>
+#endif
+#endif
+
+
+#endif /* _CPP_SSTREAM */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_stack.h b/libstdc++-v3/bits/std_stack.h
new file mode 100644
index 000000000000..53e7e21f0ecb
--- /dev/null
+++ b/libstdc++-v3/bits/std_stack.h
@@ -0,0 +1,41 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_STACK
+#define _CPP_STACK 1
+
+#include <bits/stl_algobase.h>
+#include <bits/stl_alloc.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_uninitialized.h>
+#include <bits/stl_deque.h>
+#include <bits/stl_stack.h>
+
+#endif /* _CPP_STACK */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/std_stdexcept.h b/libstdc++-v3/bits/std_stdexcept.h
new file mode 100644
index 000000000000..691b9b5825e9
--- /dev/null
+++ b/libstdc++-v3/bits/std_stdexcept.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_STDEXCEPT
+#define _CPP_STDEXCEPT 1
+
+#include <bits/std_exception.h>
+
+#if defined(__STL_USE_EXCEPTIONS) || \
+ !(defined(_MIPS_SIM) && defined(_ABIO32) && _MIPS_SIM == _ABIO32)
+
+#include <bits/stl_string_fwd.h>
+
+__STL_BEGIN_NAMESPACE
+
+class __Named_exception : public exception {
+public:
+ __Named_exception(const string& __str);
+ virtual const char* what() const __STL_NOTHROW { return _M_name; }
+
+private:
+ enum { _S_bufsize = 256 };
+ char _M_name[_S_bufsize];
+};
+
+class logic_error : public __Named_exception {
+public:
+ logic_error(const string& __s) : __Named_exception(__s) {}
+};
+
+class runtime_error : public __Named_exception {
+public:
+ runtime_error(const string& __s) : __Named_exception(__s) {}
+};
+
+class domain_error : public logic_error {
+public:
+ domain_error(const string& __arg) : logic_error(__arg) {}
+};
+
+class invalid_argument : public logic_error {
+public:
+ invalid_argument(const string& __arg) : logic_error(__arg) {}
+};
+
+class length_error : public logic_error {
+public:
+ length_error(const string& __arg) : logic_error(__arg) {}
+};
+
+class out_of_range : public logic_error {
+public:
+ out_of_range(const string& __arg) : logic_error(__arg) {}
+};
+
+class range_error : public runtime_error {
+public:
+ range_error(const string& __arg) : runtime_error(__arg) {}
+};
+
+class overflow_error : public runtime_error {
+public:
+ overflow_error(const string& __arg) : runtime_error(__arg) {}
+};
+
+class underflow_error : public runtime_error {
+public:
+ underflow_error(const string& __arg) : runtime_error(__arg) {}
+};
+
+__STL_END_NAMESPACE
+
+#endif /* Not o32, and no exceptions */
+
+#endif /* _CPP_STDEXCEPT */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/libstdc++-v3/bits/std_streambuf.h b/libstdc++-v3/bits/std_streambuf.h
new file mode 100644
index 000000000000..6aa9204c5104
--- /dev/null
+++ b/libstdc++-v3/bits/std_streambuf.h
@@ -0,0 +1,460 @@
+// Stream buffer classes -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.5 Stream buffers
+//
+
+#ifndef _CPP_STREAMBUF
+#define _CPP_STREAMBUF 1
+
+#include <bits/c++config.h>
+#include <bits/std_iosfwd.h>
+#include <bits/std_cstdio.h> // For SEEK_SET, SEEK_CUR, SEEK_END
+#include <bits/localefwd.h>
+#include <bits/ios_base.h>
+
+namespace std {
+
+ template<typename _CharT, typename _Traits>
+ static streamsize
+ _S_copy_streambufs(basic_ios<_CharT, _Traits>& __ios,
+ basic_streambuf<_CharT, _Traits>* __sbin,
+ basic_streambuf<_CharT, _Traits>* __sbout);
+
+ // 27.5.2 Template class basic_streambuf<_CharT, _Traits>
+ template<typename _CharT, typename _Traits>
+ class basic_streambuf
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ // Non-standard Types:
+ typedef ctype<_CharT> __ctype_type;
+ typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
+
+ friend class basic_ios<char_type, traits_type>;
+ friend class basic_istream<char_type, traits_type>;
+ friend class basic_ostream<char_type, traits_type>;
+ friend class istreambuf_iterator<char_type, traits_type>;
+ friend class ostreambuf_iterator<char_type, traits_type>;
+
+ friend streamsize
+ _S_copy_streambufs<>(basic_ios<_CharT, _Traits>& __ios,
+ basic_streambuf<_CharT, _Traits>* __sbin,
+ basic_streambuf<_CharT, _Traits>* __sbout);
+
+ protected:
+
+ // Pointer to the beginning of internally-allocated
+ // space. Filebuf manually allocates/deallocates this, whereas
+ // stringstreams attempt to use the built-in intelligence of the
+ // string class. If you are managing memory, set this. If not,
+ // leave it NULL.
+ char_type* _M_buf;
+
+ // Size of internal buffer, in bytes.
+ int_type _M_buf_size;
+
+ // True iff _M_in_* and _M_out_* buffers should always point to
+ // the same place. True for fstreams, false for sstreams.
+ bool _M_buf_unified;
+
+ // This is based on _IO_FILE, just reordered to be more
+ // consistent, and is intended to be the most minimal abstraction
+ // for an internal buffer.
+ // get == input == read
+ // put == output == write
+ char_type* _M_in_cur; // Current read area.
+ char_type* _M_in_beg; // Start of get area.
+ char_type* _M_in_end; // End of get area.
+ char_type* _M_out_cur; // Current put area.
+ char_type* _M_out_beg; // Start of put area.
+ char_type* _M_out_end; // End of put area.
+
+ // Place to stash in || out || in | out settings for current streambuf.
+ ios_base::openmode _M_mode;
+
+ // Current locale setting.
+ locale _M_locale_buf;
+
+ // True iff locale is initialized.
+ bool _M_locale_set;
+
+ // Cached use_facet<ctype>, which is based on the current locale info.
+ const __ctype_type* _M_fctype_buf;
+
+ // Correctly sets the _M_out_cur pointer, and bumps the
+ // appropriate _M_*_end pointers as well. Necessary for the
+ // un-tied stringbufs, in in|out mode.
+ // Invariant:
+ // __n + _M_out_[cur, end] <= _M_buf + _M_buf_size
+ // Assuming all _M_*_[beg, cur, end] pointers are operating on
+ // the same range:
+ // _M_buf <= _M_*_ <= _M_buf + _M_buf_size
+ void
+ _M_buf_bump(off_type __n) // argument needs to be +-
+ {
+ bool __testin = _M_mode & ios_base::in;
+ bool __testout = _M_mode & ios_base::out;
+ _M_out_cur += __n;
+ if (_M_buf_unified && __testin)
+ _M_in_cur = _M_out_cur;
+ if (_M_out_cur > _M_out_end)
+ {
+ _M_out_end = _M_out_cur;
+ if (__testin && __testout && _M_out_end > _M_in_end)
+ _M_in_end = _M_out_cur;
+ }
+ }
+
+ // These three functions are used to clarify internal buffer
+ // maintance. After an overflow, or after a seekoff call that
+ // started at beg or end, or possibly when the stream becomes
+ // unbuffered, and a myrid other obscure corner cases, the
+ // internal buffer does not truly reflect the contents of the
+ // external buffer. At this point, for whatever reason, it is in
+ // an indeterminate state.
+ void
+ _M_set_indeterminate(void)
+ {
+ if (_M_mode & ios_base::in)
+ this->setg(_M_buf, _M_buf, _M_buf);
+ if (_M_mode & ios_base::out)
+ this->setp(_M_buf, _M_buf);
+ }
+
+ void
+ _M_set_determinate(off_type __off)
+ {
+ bool __testin = _M_mode & ios_base::in;
+ bool __testout = _M_mode & ios_base::out;
+ if (__testin)
+ {
+ this->setg(_M_buf, _M_buf, _M_buf + __off);
+ if (!__testout)
+ _M_buf_size = static_cast<int_type>(__off);
+ }
+ if (__testout)
+ this->setp(_M_buf, _M_buf + __off);
+
+ }
+
+ bool
+ _M_is_indeterminate(void)
+ {
+ bool __retval = false;
+ if (_M_mode & ios_base::in)
+ __retval = _M_in_beg == _M_in_cur && _M_in_cur == _M_in_end;
+ if (_M_mode & ios_base::out)
+ __retval = _M_out_beg == _M_out_cur && _M_out_cur == _M_out_end;
+ return __retval;
+ }
+
+ public:
+ virtual
+ ~basic_streambuf()
+ {
+ _M_buf_unified = false;
+ _M_buf_size = 0;
+ _M_mode = ios_base::openmode(0);
+ _M_fctype_buf = NULL;
+ _M_locale_set = false;
+ }
+
+ // Locales:
+ locale
+ pubimbue(const locale &__loc)
+ {
+ locale __tmp(this->getloc());
+ this->imbue(__loc);
+ return __tmp;
+ }
+
+ locale
+ getloc() const
+ {
+ if (_M_locale_set)
+ return _M_locale_buf;
+ else
+ return locale();
+ }
+
+ // Buffer and positioning:
+ __streambuf_type*
+ pubsetbuf(char_type* __s, streamsize __n)
+ { return this->setbuf(__s, __n); }
+
+ pos_type
+ pubseekoff(off_type __off, ios_base::seekdir __way,
+ ios_base::openmode __mode = ios_base::in | ios_base::out)
+ { return this->seekoff(__off, __way, __mode); }
+
+ pos_type
+ pubseekpos(pos_type __sp,
+ ios_base::openmode __mode = ios_base::in | ios_base::out)
+ { return this->seekpos(__sp, __mode); }
+
+ int
+ pubsync() { return this->sync(); }
+
+ // Get and put areas:
+ // Get area:
+ streamsize
+ in_avail()
+ {
+ streamsize __retval;
+ if (_M_in_cur && _M_in_cur < _M_in_end)
+ __retval = this->egptr() - this->gptr();
+ else
+ __retval = this->showmanyc();
+ return __retval;
+ }
+
+ int_type
+ snextc()
+ {
+ int_type __eof = traits_type::eof();
+ return (this->sbumpc() == __eof ? __eof : this->sgetc());
+ }
+
+ int_type
+ sbumpc();
+
+ int_type
+ sgetc()
+ {
+ int_type __retval;
+ if (_M_in_cur && _M_in_cur < _M_in_end)
+ __retval = traits_type::to_int_type(*gptr());
+ else
+ __retval = this->underflow();
+ return __retval;
+ }
+
+ streamsize
+ sgetn(char_type* __s, streamsize __n)
+ { return this->xsgetn(__s, __n); }
+
+ // Putback:
+ int_type
+ sputbackc(char_type __c);
+
+ int_type
+ sungetc();
+
+ // Put area:
+ int_type
+ sputc(char_type __c);
+
+ streamsize
+ sputn(const char_type* __s, streamsize __n)
+ { return this->xsputn(__s, __n); }
+
+ protected:
+ basic_streambuf()
+ : _M_buf(NULL), _M_buf_size(0), _M_buf_unified(false),
+ _M_in_cur(0), _M_in_beg(0), _M_in_end(0), _M_out_cur(0), _M_out_beg(0),
+ _M_out_end(0), _M_mode(ios_base::openmode(0)),
+ _M_locale_buf(locale()), _M_locale_set(false)
+ { _M_fctype_buf = &use_facet<__ctype_type>(this->getloc()); }
+
+ // Get area:
+ char_type*
+ eback() const { return _M_in_beg; }
+
+ char_type*
+ gptr() const { return _M_in_cur; }
+
+ char_type*
+ egptr() const { return _M_in_end; }
+
+ void
+ gbump(int __n) { _M_in_cur += __n; }
+
+ void
+ setg(char_type* __gbeg, char_type* __gnext, char_type* __gend)
+ {
+ _M_in_beg = __gbeg;
+ _M_in_cur = __gnext;
+ _M_in_end = __gend;
+ if (!(_M_mode & ios_base::in) && __gbeg && __gnext && __gend)
+ _M_mode = _M_mode | ios_base::in;
+ }
+
+ // Put area:
+ char_type*
+ pbase() const { return _M_out_beg; }
+
+ char_type*
+ pptr() const { return _M_out_cur; }
+
+ char_type*
+ epptr() const { return _M_out_end; }
+
+ void
+ pbump(int __n) { _M_out_cur += __n; }
+
+ void
+ setp(char_type* __pbeg, char_type* __pend)
+ {
+ _M_out_beg = _M_out_cur = __pbeg;
+ _M_out_end = __pend;
+ if (!(_M_mode & ios_base::out) && __pbeg && __pend)
+ _M_mode = _M_mode | ios_base::out;
+ // The output sequence is highly tied to _M_buf and
+ // _M_buf_size in addition to the actual pointers into the
+ // buffer. Because of this, (re)set _M_buf_size here, as
+ // sputc/xsputn need _M_buf_size to be accurate. (The
+ // corresponding input functions rely instead on _M_in_end.)
+ _M_buf_size = max(_M_buf_size, static_cast<int_type>(__pend - __pbeg));
+ }
+
+ // Virtual functions:
+ // Locales:
+ virtual void
+ imbue(const locale& __loc)
+ {
+ _M_locale_set = true;
+ if (_M_locale_buf != __loc)
+ {
+ _M_locale_buf = __loc;
+ _M_fctype_buf = &use_facet<__ctype_type>(_M_locale_buf);
+ }
+ }
+
+ // Buffer management and positioning:
+ virtual basic_streambuf<char_type,_Traits>*
+ setbuf(char_type*, streamsize)
+ { return this; }
+
+ virtual pos_type
+ seekoff(off_type, ios_base::seekdir,
+ ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out)
+ { return pos_type(off_type(-1)); }
+
+ virtual pos_type
+ seekpos(pos_type,
+ ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out)
+ { return pos_type(off_type(-1)); }
+
+ virtual int
+ sync() { return 0; }
+
+ // Get area:
+ virtual streamsize
+ showmanyc() { return 0; }
+
+ virtual streamsize
+ xsgetn(char_type* __s, streamsize __n);
+
+ virtual int_type
+ underflow()
+ { return traits_type::eof(); }
+
+ virtual int_type
+ uflow()
+ {
+ int_type __retval = traits_type::eof();
+ bool __testeof = this->underflow() == __retval;
+ bool __testpending = _M_in_cur && _M_in_cur < _M_in_end;
+
+ if (!__testeof && __testpending)
+ {
+ __retval = traits_type::to_int_type(*_M_in_cur);
+ ++_M_in_cur;
+ if (_M_buf_unified && _M_mode & ios_base::out)
+ ++_M_out_cur;
+ }
+ return __retval;
+ }
+
+ // Putback:
+ virtual int_type
+ pbackfail(int_type /* __c */ = traits_type::eof())
+ { return traits_type::eof(); }
+
+ // Put area:
+ virtual streamsize
+ xsputn(const char_type* __s, streamsize __n);
+
+ virtual int_type
+ overflow(int_type /* __c */ = traits_type::eof())
+ { return traits_type::eof(); }
+
+#ifdef _GLIBCPP_DEPRICATED
+ public:
+ void
+ stossc()
+ {
+ if (_M_in_cur < _M_in_end)
+ ++_M_in_cur;
+ else
+ this->uflow();
+ }
+#endif
+
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ private:
+ basic_streambuf(const __streambuf_type&);
+
+ __streambuf_type&
+ operator=(const __streambuf_type&);
+#endif
+ };
+
+ typedef basic_streambuf<char> streambuf;
+ typedef basic_streambuf<wchar_t> wstreambuf;
+
+} // namespace std
+
+#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
+# define export
+#ifdef _GLIBCPP_FULLY_COMPLIANT_HEADERS
+#include <bits/streambuf.tcc>
+#endif
+#endif
+
+#endif /* _CPP_STREAMBUF */
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_string.h b/libstdc++-v3/bits/std_string.h
new file mode 100644
index 000000000000..6008eca2862b
--- /dev/null
+++ b/libstdc++-v3/bits/std_string.h
@@ -0,0 +1,63 @@
+// Components for manipulating sequences of characters -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 21 Strings library
+//
+
+#ifndef _CPP_STRING
+#define _CPP_STRING 1
+
+#include <bits/c++config.h>
+#include <bits/stl_string_fwd.h>
+#include <bits/std_iterator.h>
+#include <bits/char_traits.h>
+#include <bits/type_traits.h>
+#include <bits/std_iosfwd.h> // for operators >>, <<, and getline decls
+#include <bits/basic_string.h>
+
+#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
+# include <bits/std_algorithm.h> // for find_if
+# include <bits/string.tcc>
+#endif
+
+#endif /* _CPP_STRING */
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/std_strstream.h b/libstdc++-v3/bits/std_strstream.h
new file mode 100644
index 000000000000..2f784b36fcee
--- /dev/null
+++ b/libstdc++-v3/bits/std_strstream.h
@@ -0,0 +1,159 @@
+/*
+ * 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.
+ */
+
+// WARNING: The classes defined in this header are DEPRECATED. This
+// header is defined in section D.7.1 of the C++ standard, and it
+// MAY BE REMOVED in a future standard revision. You should use the
+// header <sstream> instead.
+
+#ifndef __SGI_STL_STRSTREAM
+#define __SGI_STL_STRSTREAM
+
+#if defined(__sgi) && !defined(__GNUC__) && !defined(_STANDARD_C_PLUS_PLUS)
+#error This header file requires the -LANG:std option
+#endif
+
+#include <bits/std_iosfwd.h>
+#include <bits/std_ios.h>
+#include <bits/std_istream.h>
+#include <bits/std_ostream.h>
+#include <bits/std_string.h>
+
+__STL_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Class strstreambuf, a streambuf class that manages an array of char.
+// Note that this class is not a template.
+
+class strstreambuf : public basic_streambuf<char, char_traits<char> >
+{
+public: // Types.
+ typedef char_traits<char> _Traits;
+ typedef basic_streambuf<char, _Traits> _Base;
+
+public: // Constructor, destructor
+ explicit strstreambuf(streamsize __initial_capacity = 0);
+ strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*));
+
+ strstreambuf(char* __get, streamsize __n, char* __put = 0);
+ strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0);
+ strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0);
+
+ strstreambuf(const char* __get, streamsize __n);
+ strstreambuf(const signed char* __get, streamsize __n);
+ strstreambuf(const unsigned char* __get, streamsize __n);
+
+ virtual ~strstreambuf();
+
+public: // strstreambuf operations.
+ void freeze(bool = true);
+ char* str();
+ int pcount() const;
+
+protected: // Overridden virtual member functions.
+ virtual int_type overflow(int_type __c = _Traits::eof());
+ virtual int_type pbackfail(int_type __c = _Traits::eof());
+ virtual int_type underflow();
+ virtual _Base* setbuf(char* __buf, streamsize __n);
+ virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
+ ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+ virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+
+private: // Helper functions.
+ // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.
+ char* _M_alloc(size_t);
+ void _M_free(char*);
+
+ // Helper function used in constructors.
+ void _M_setup(char* __get, char* __put, streamsize __n);
+
+private: // Data members.
+ void* (*_M_alloc_fun)(size_t);
+ void (*_M_free_fun)(void*);
+
+ bool _M_dynamic : 1;
+ bool _M_frozen : 1;
+ bool _M_constant : 1;
+};
+
+//----------------------------------------------------------------------
+// Class istrstream, an istream that manages a strstreambuf.
+
+class istrstream : public basic_istream<char>
+{
+public:
+ explicit istrstream(char*);
+ explicit istrstream(const char*);
+ istrstream(char* , streamsize);
+ istrstream(const char*, streamsize);
+ virtual ~istrstream();
+
+ strstreambuf* rdbuf() const;
+ char* str();
+
+private:
+ strstreambuf _M_buf;
+};
+
+//----------------------------------------------------------------------
+// Class ostrstream
+
+class ostrstream : public basic_ostream<char>
+{
+public:
+ ostrstream();
+ ostrstream(char*, int, ios_base::openmode = ios_base::out);
+ virtual ~ostrstream();
+
+ strstreambuf* rdbuf() const;
+ void freeze(bool = true);
+ char* str();
+ int pcount() const;
+
+private:
+ strstreambuf _M_buf;
+};
+
+//----------------------------------------------------------------------
+// Class strstream
+
+class strstream : public basic_iostream<char>
+{
+public:
+ typedef char char_type;
+ typedef char_traits<char>::int_type int_type;
+ typedef char_traits<char>::pos_type pos_type;
+ typedef char_traits<char>::off_type off_type;
+
+ strstream();
+ strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);
+ virtual ~strstream();
+
+ strstreambuf* rdbuf() const;
+ void freeze(bool = true);
+ int pcount() const;
+ char* str();
+
+private:
+ strstreambuf _M_buf;
+};
+
+__STL_END_NAMESPACE
+
+#endif /* __SGI_STL_STRSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/std_typeinfo.h b/libstdc++-v3/bits/std_typeinfo.h
new file mode 100644
index 000000000000..1bce795882cc
--- /dev/null
+++ b/libstdc++-v3/bits/std_typeinfo.h
@@ -0,0 +1,80 @@
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#ifndef _CPP_TYPEINFO
+#define _CPP_TYPEINFO 1
+
+#include <bits/c++config.h>
+#include <bits/std_exception.h>
+
+#ifdef __GNUG__
+# include_next <typeinfo>
+#else
+
+__STL_BEGIN_NAMESPACE
+
+ class type_info {
+ public:
+ virtual ~type_info();
+ bool operator==(const type_info& rhs) const;
+ bool operator!=(const type_info& rhs) const;
+ bool before(const type_info& rhs) const;
+ const char* name() const;
+ private:
+ type_info(const type_info& rhs);
+ type_info& operator=(const type_info& rhs);
+ };
+
+ class bad_cast : public exception {
+ public:
+ bad_cast() throw();
+ bad_cast(const bad_cast&) throw();
+ bad_cast& operator=(const bad_cast&) throw();
+ virtual ~bad_cast() throw();
+ virtual const char* what() const throw();
+ };
+
+ class bad_typeid : public exception {
+ public:
+ bad_typeid() throw();
+ bad_typeid(const bad_typeid&) throw();
+ bad_typeid& operator=(const bad_typeid&) throw();
+ virtual ~bad_typeid() throw();
+ virtual const char* what() const throw();
+ };
+
+__STL_END_NAMESPACE
+
+#endif
+
+#endif /* _CPP_TYPEINFO */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/std_utility.h b/libstdc++-v3/bits/std_utility.h
new file mode 100644
index 000000000000..e10dae35b6a8
--- /dev/null
+++ b/libstdc++-v3/bits/std_utility.h
@@ -0,0 +1,38 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_UTILITY
+#define _CPP_UTILITY 1
+
+#include <bits/stl_config.h>
+#include <bits/stl_relops.h>
+#include <bits/stl_pair.h>
+
+#endif /* _CPP_UTILITY */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/std_valarray.h b/libstdc++-v3/bits/std_valarray.h
new file mode 100644
index 000000000000..3a5f0c7ba1ae
--- /dev/null
+++ b/libstdc++-v3/bits/std_valarray.h
@@ -0,0 +1,748 @@
+// The template and inlines for the -*- C++ -*- valarray class.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _CPP_VALARRAY
+#define _CPP_VALARRAY 1
+
+#include <bits/c++config.h>
+#include <bits/std_cstddef.h>
+#include <bits/std_cmath.h>
+#include <bits/std_cstdlib.h>
+#include <bits/std_numeric.h>
+#include <bits/std_functional.h>
+#include <bits/std_algorithm.h>
+
+namespace std {
+
+ 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
+
+}
+
+#include <bits/valarray_array.h>
+#include <bits/valarray_meta.h>
+
+namespace std {
+
+ 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>
+ _Tp&
+ valarray<_Tp>::operator[] (size_t __i)
+ { return _M_data[__i]; }
+
+} // std::
+
+#include <bits/slice.h>
+#include <bits/slice_array.h>
+#include <bits/gslice.h>
+#include <bits/gslice_array.h>
+#include <bits/mask_array.h>
+#include <bits/indirect_array.h>
+
+namespace std {
+
+ 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(static_cast<_Tp*__restrict__>
+ (__valarray_get_memory(__n * sizeof (_Tp))))
+ { __valarray_default_construct(_M_data, _M_data + __n); }
+
+ template<typename _Tp>
+ inline valarray<_Tp>::valarray (const _Tp& __t, size_t __n)
+ : _M_size(__n),
+ _M_data(static_cast<_Tp*__restrict__>
+ (__valarray_get_memory(__n * sizeof (_Tp))))
+ { __valarray_fill_construct (_M_data, _M_data + __n, __t); }
+
+ template<typename _Tp>
+ inline valarray<_Tp>::valarray (const _Tp* __restrict__ __p, size_t __n)
+ : _M_size(__n),
+ _M_data(static_cast<_Tp*__restrict__>
+ (__valarray_get_memory(__n * sizeof (_Tp))))
+ { __valarray_copy_construct (__p, __p + __n, _M_data); }
+
+ template<typename _Tp>
+ inline valarray<_Tp>::valarray (const valarray<_Tp>& __v)
+ : _M_size(__v._M_size),
+ _M_data(static_cast<_Tp*__restrict__>
+ (__valarray_get_memory(__v._M_size * sizeof (_Tp))))
+ { __valarray_copy_construct (__v._M_data, __v._M_data + _M_size, _M_data); }
+
+ template<typename _Tp>
+ inline valarray<_Tp>::valarray (const slice_array<_Tp>& __sa)
+ : _M_size(__sa._M_sz),
+ _M_data(static_cast<_Tp*__restrict__>
+ (__valarray_get_memory(__sa._M_sz * sizeof (_Tp))))
+ {
+ __valarray_copy_construct
+ (__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(static_cast<_Tp*__restrict__>
+ (__valarray_get_memory(_M_size * sizeof (_Tp))))
+ {
+ __valarray_copy_construct
+ (__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(static_cast<_Tp*__restrict__>
+ (__valarray_get_memory(__ma._M_sz * sizeof (_Tp))))
+ {
+ __valarray_copy_construct
+ (__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(static_cast<_Tp*__restrict__>
+ (__valarray_get_memory(__ia._M_sz * sizeof (_Tp))))
+ {
+ __valarray_copy_construct
+ (__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(static_cast<_Tp*__restrict__>
+ (__valarray_copy_construct(_M_size * sizeof (_Tp))))
+ { __valarray_copy_construct (__e, _M_size, _Array<_Tp>(_M_data)); }
+
+ template<typename _Tp>
+ inline valarray<_Tp>::~valarray ()
+ {
+ __valarray_destroy_elements(_M_data, _M_data + _M_size);
+ __valarray_release_memory(_M_data);
+ }
+
+ template<typename _Tp>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator= (const valarray<_Tp>& __v)
+ {
+ __valarray_copy(__v._M_data, _M_size, _M_data);
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator= (const _Tp& __t)
+ {
+ __valarray_fill (_M_data, _M_size, __t);
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator= (const slice_array<_Tp>& __sa)
+ {
+ __valarray_copy (__sa._M_array, __sa._M_sz,
+ __sa._M_stride, _Array<_Tp>(_M_data));
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator= (const gslice_array<_Tp>& __ga)
+ {
+ __valarray_copy (__ga._M_array, _Array<size_t>(__ga._M_index),
+ _Array<_Tp>(_M_data), _M_size);
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator= (const mask_array<_Tp>& __ma)
+ {
+ __valarray_copy (__ma._M_array, __ma._M_mask,
+ _Array<_Tp>(_M_data), _M_size);
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator= (const indirect_array<_Tp>& __ia)
+ {
+ __valarray_copy (__ia._M_array, __ia._M_index,
+ _Array<_Tp>(_M_data), _M_size);
+ return *this;
+ }
+
+ template<typename _Tp> template<class _Dom>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator= (const _Expr<_Dom, _Tp>& __e)
+ {
+ __valarray_copy (__e, _M_size, _Array<_Tp>(_M_data));
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline _Expr<_SClos<_ValArray,_Tp>, _Tp>
+ valarray<_Tp>::operator[] (slice __s) const
+ {
+ typedef _SClos<_ValArray,_Tp> _Closure;
+ return _Expr<_Closure, _Tp> (_Closure (_Array<_Tp>(_M_data), __s));
+ }
+
+ template<typename _Tp>
+ inline slice_array<_Tp>
+ valarray<_Tp>::operator[] (slice __s)
+ {
+ return slice_array<_Tp> (_Array<_Tp>(_M_data), __s);
+ }
+
+ template<typename _Tp>
+ inline _Expr<_GClos<_ValArray,_Tp>, _Tp>
+ valarray<_Tp>::operator[] (const gslice& __gs) const
+ {
+ typedef _GClos<_ValArray,_Tp> _Closure;
+ return _Expr<_Closure, _Tp>
+ (_Closure (_Array<_Tp>(_M_data), __gs._M_index->_M_index));
+ }
+
+ template<typename _Tp>
+ inline gslice_array<_Tp>
+ valarray<_Tp>::operator[] (const gslice& __gs)
+ {
+ return gslice_array<_Tp>
+ (_Array<_Tp>(_M_data), __gs._M_index->_M_index);
+ }
+
+ template<typename _Tp>
+ inline valarray<_Tp>
+ valarray<_Tp>::operator[] (const valarray<bool>& __m) const
+ {
+ size_t __s (0);
+ size_t __e (__m.size ());
+ for (size_t __i=0; __i<__e; ++__i)
+ if (__m[__i]) ++__s;
+ return valarray<_Tp> (mask_array<_Tp> (_Array<_Tp>(_M_data), __s,
+ _Array<bool> (__m)));
+ }
+
+ template<typename _Tp>
+ inline mask_array<_Tp>
+ valarray<_Tp>::operator[] (const valarray<bool>& __m)
+ {
+ size_t __s (0);
+ size_t __e (__m.size ());
+ for (size_t __i=0; __i<__e; ++__i)
+ if (__m[__i]) ++__s;
+ return mask_array<_Tp> (_Array<_Tp>(_M_data), __s, _Array<bool> (__m));
+ }
+
+ template<typename _Tp>
+ inline _Expr<_IClos<_ValArray,_Tp>, _Tp>
+ valarray<_Tp>::operator[] (const valarray<size_t>& __i) const
+ {
+ typedef _IClos<_ValArray,_Tp> _Closure;
+ return _Expr<_Closure, _Tp> (_Closure (*this, __i));
+ }
+
+ template<typename _Tp>
+ inline indirect_array<_Tp>
+ valarray<_Tp>::operator[] (const valarray<size_t>& __i)
+ {
+ return indirect_array<_Tp> (_Array<_Tp>(_M_data), __i.size(),
+ _Array<size_t> (__i));
+ }
+
+ template<class _Tp>
+ inline size_t valarray<_Tp>::size () const { return _M_size; }
+
+ template<class _Tp>
+ inline _Tp
+ valarray<_Tp>::sum () const
+ {
+ return __valarray_sum(_M_data, _M_data + _M_size);
+ }
+
+// template<typename _Tp>
+// inline _Tp
+// valarray<_Tp>::product () const
+// {
+// return __valarray_product(_M_data, _M_data + _M_size);
+// }
+
+ template <class _Tp>
+ inline valarray<_Tp>
+ valarray<_Tp>::shift (int __n) const
+ {
+ _Tp* const __a = static_cast<_Tp*>
+ (__builtin_alloca (sizeof(_Tp) * _M_size));
+ if (! __n) // __n == 0: no shift
+ __valarray_copy_construct(_M_data, _M_data + _M_size, __a);
+ else if (__n > 0) { // __n > 0: shift left
+ if (__n > _M_size)
+ __valarray_default_construct(__a, __a + __n);
+ else {
+ __valarray_copy_construct(_M_data+__n, _M_data + _M_size, __a);
+ __valarray_default_construct(__a+_M_size-__n, __a + _M_size);
+ }
+ }
+ else { // __n < 0: shift right
+ __valarray_copy_construct (_M_data, _M_data+_M_size+__n, __a-__n);
+ __valarray_default_construct(__a, __a - __n);
+ }
+ return valarray<_Tp> (__a, _M_size);
+ }
+
+ template <class _Tp>
+ inline valarray<_Tp>
+ valarray<_Tp>::cshift (int __n) const
+ {
+ _Tp* const __a = static_cast<_Tp*>
+ (__builtin_alloca (sizeof(_Tp) * _M_size));
+ if (! __n) // __n == 0: no cshift
+ __valarray_copy_construct(_M_data, _M_data + _M_size, __a);
+ else if (__n > 0) { // __n > 0: cshift left
+ __valarray_copy_construct(_M_data, _M_data+__n, __a+_M_size-__n);
+ __valarray_copy_construct(_M_data+__n, _M_data + _M_size, __a);
+ }
+ else { // __n < 0: cshift right
+ __valarray_copy_construct
+ (_M_data + _M_size+__n, _M_data + _M_size, __a);
+ __valarray_copy_construct
+ (_M_data, _M_data + _M_size+__n, __a - __n);
+ }
+ return valarray<_Tp> (__a, _M_size);
+ }
+
+ template <class _Tp>
+ inline void
+ valarray<_Tp>::resize (size_t __n, _Tp __c)
+ {
+ if (_M_size != __n) {
+ __valarray_destroy_elements(_M_data, _M_data + _M_size);
+ __valarray_release_memory(_M_data);
+ _M_size = __n;
+ _M_data = static_cast<_Tp*__restrict__>
+ (__valarray_get_memory(__n * sizeof (_Tp)));
+ __valarray_fill_construct(_M_data, _M_data + __n, __c);
+ }
+ else {
+ // this is so to make valarray<valarray<T> > work
+ // even though it is not required by the standard.
+ __valarray_destroy_elements(_M_data, _M_data + _M_size);
+ __valarray_fill_construct(_M_data, _M_data + _M_size, __c);
+ }
+ }
+
+ template<typename _Tp>
+ inline _Tp
+ valarray<_Tp>::min() const
+ {
+ return *min_element (_M_data, _M_data+_M_size);
+ }
+
+ template<typename _Tp>
+ inline _Tp
+ valarray<_Tp>::max() const
+ {
+ return *max_element (_M_data, _M_data+_M_size);
+ }
+
+ template<class _Tp>
+ inline _Expr<_ValFunClos<_ValArray,_Tp>,_Tp>
+ valarray<_Tp>::apply (_Tp func (_Tp)) const
+ {
+ typedef _ValFunClos<_ValArray,_Tp> _Closure;
+ return _Expr<_Closure,_Tp> (_Closure (*this, func));
+ }
+
+ template<class _Tp>
+ inline _Expr<_RefFunClos<_ValArray,_Tp>,_Tp>
+ valarray<_Tp>::apply (_Tp func (const _Tp &)) const
+ {
+ typedef _RefFunClos<_ValArray,_Tp> _Closure;
+ return _Expr<_Closure,_Tp> (_Closure (*this, func));
+ }
+
+#define _DEFINE_VALARRAY_UNARY_OPERATOR(_Op, _Name) \
+ template<typename _Tp> \
+ inline _Expr<_UnClos<_Name,_ValArray,_Tp>, _Tp> \
+ valarray<_Tp>::operator##_Op() const \
+ { \
+ typedef _UnClos<_Name,_ValArray,_Tp> _Closure; \
+ return _Expr<_Closure, _Tp> (_Closure (*this)); \
+ }
+
+ _DEFINE_VALARRAY_UNARY_OPERATOR(+, _Unary_plus)
+ _DEFINE_VALARRAY_UNARY_OPERATOR(-, negate)
+ _DEFINE_VALARRAY_UNARY_OPERATOR(~, _Bitwise_not)
+
+#undef _DEFINE_VALARRAY_UNARY_OPERATOR
+
+ template<typename _Tp>
+ inline _Expr<_UnClos<logical_not,_ValArray,_Tp>, bool>
+ valarray<_Tp>::operator!() const
+ {
+ typedef _UnClos<logical_not,_ValArray,_Tp> _Closure;
+ return _Expr<_Closure, bool> (_Closure (*this));
+ }
+
+#define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name) \
+ template<class _Tp> \
+ inline valarray<_Tp> & \
+ valarray<_Tp>::operator##_Op##= (const _Tp &__t) \
+ { \
+ _Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, __t); \
+ return *this; \
+ } \
+ \
+ template<class _Tp> \
+ inline valarray<_Tp> & \
+ valarray<_Tp>::operator##_Op##= (const valarray<_Tp> &__v) \
+ { \
+ _Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, \
+ _Array<_Tp>(__v._M_data)); \
+ return *this; \
+ }
+
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(+, plus)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(-, minus)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(*, multiplies)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(/, divides)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(%, modulus)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(^, xor)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, and)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, or)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(<<, shift_left)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, shift_right)
+
+#undef _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT
+
+
+} // std::
+
+
+namespace std {
+
+#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
+
+} // namespace std
+
+#endif // _CPP_VALARRAY
+
+// Local Variables:
+// mode:c++
+// End:
diff --git a/libstdc++-v3/bits/std_vector.h b/libstdc++-v3/bits/std_vector.h
new file mode 100644
index 000000000000..08ac4bd69de3
--- /dev/null
+++ b/libstdc++-v3/bits/std_vector.h
@@ -0,0 +1,42 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_VECTOR
+#define _CPP_VECTOR 1
+
+#include <bits/stl_range_errors.h>
+#include <bits/stl_algobase.h>
+#include <bits/stl_alloc.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_uninitialized.h>
+#include <bits/stl_vector.h>
+#include <ext/stl_bvector.h>
+
+#endif /* _CPP_VECTOR */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/stl_algo.h b/libstdc++-v3/bits/stl_algo.h
new file mode 100644
index 000000000000..60d40f662509
--- /dev/null
+++ b/libstdc++-v3/bits/stl_algo.h
@@ -0,0 +1,2900 @@
+/*
+ *
+ * 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 <bits/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) {
+ while (__first1 != __last1 && !__predicate(*__first1, *__first2))
+ ++__first1;
+ return __first1;
+ }
+
+ // 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 __unary_op) {
+ for ( ; __first != __last; ++__first, ++__result)
+ *__result = __unary_op(*__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 == 0)
+ return __last;
+
+ else 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/libstdc++-v3/bits/stl_algobase.h b/libstdc++-v3/bits/stl_algobase.h
new file mode 100644
index 000000000000..b1bbd57b9b29
--- /dev/null
+++ b/libstdc++-v3/bits/stl_algobase.h
@@ -0,0 +1,652 @@
+/*
+ *
+ * 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
+
+#include <bits/stl_config.h>
+#include <bits/stl_relops.h>
+#include <bits/stl_pair.h>
+#include <bits/type_traits.h>
+
+#include <bits/std_cstring.h>
+#include <bits/std_climits.h>
+#include <bits/std_cstdlib.h>
+#include <bits/std_cstddef.h>
+#include <bits/std_new.h>
+
+#ifdef __STL_USE_NEW_IOSTREAMS
+#include <iosfwd>
+#else /* __STL_USE_NEW_IOSTREAMS */
+#include <bits/std_iosfwd.h>
+#endif /* __STL_USE_NEW_IOSTREAMS */
+
+#include <bits/stl_iterator_base.h>
+#include <bits/stl_iterator.h>
+
+__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;
+ if (__b < __a) return __b; return __a;
+}
+
+template <class _Tp>
+inline const _Tp& max(const _Tp& __a, const _Tp& __b) {
+ //return __a < __b ? __b : __a;
+ if (__a < __b) return __b; return __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;
+ if (__comp(__b, __a)) return __b; return __a;
+}
+
+template <class _Tp, class _Compare>
+inline const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) {
+ //return __comp(__a, __b) ? __b : __a;
+ if (__comp(__a, __b)) return __b; return __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.
+
+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);
+}
+
+#if defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER)
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_aux2(_InputIter __first, _InputIter __last,
+ _OutputIter __result, __false_type) {
+ return __copy(__first, __last, __result,
+ __ITERATOR_CATEGORY(__first),
+ __DISTANCE_TYPE(__first));
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_aux2(_InputIter __first, _InputIter __last,
+ _OutputIter __result, __true_type) {
+ return __copy(__first, __last, __result,
+ __ITERATOR_CATEGORY(__first),
+ __DISTANCE_TYPE(__first));
+}
+
+template <class _Tp>
+inline _Tp* __copy_aux2(_Tp* __first, _Tp* __last, _Tp* __result,
+ __true_type) {
+ return __copy_trivial(__first, __last, __result);
+}
+
+template <class _Tp>
+inline _Tp* __copy_aux2(const _Tp* __first, const _Tp* __last, _Tp* __result,
+ __true_type) {
+ return __copy_trivial(__first, __last, __result);
+}
+
+
+template <class _InputIter, class _OutputIter, class _Tp>
+inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last,
+ _OutputIter __result, _Tp*) {
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator
+ _Trivial;
+ return __copy_aux2(__first, __last, __result, _Trivial());
+}
+
+template<typename _InputIter, typename _OutputIter>
+inline _OutputIter __copy_ni2(_InputIter __first, _InputIter __last,
+ _OutputIter __result, __true_type) {
+ return _OutputIter(__copy_aux(__first, __last, __result.base(),
+ __VALUE_TYPE(__first)));
+}
+
+template<typename _InputIter, typename _OutputIter>
+inline _OutputIter __copy_ni2(_InputIter __first, _InputIter __last,
+ _OutputIter __result, __false_type) {
+ return __copy_aux(__first, __last, __result, __VALUE_TYPE(__first));
+}
+
+template<typename _InputIter, typename _OutputIter>
+inline _OutputIter __copy_ni1(_InputIter __first, _InputIter __last,
+ _OutputIter __result, __true_type) {
+ typedef typename _Is_normal_iterator<_OutputIter>::_Normal __Normal;
+ return __copy_ni2(__first.base(), __last.base(), __result, __Normal());
+}
+
+template<typename _InputIter, typename _OutputIter>
+inline _OutputIter __copy_ni1(_InputIter __first, _InputIter __last,
+ _OutputIter __result, __false_type) {
+ typedef typename _Is_normal_iterator<_OutputIter>::_Normal __Normal;
+ return __copy_ni2(__first, __last, __result, __Normal());
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter copy(_InputIter __first, _InputIter __last,
+ _OutputIter __result) {
+ typedef typename _Is_normal_iterator<_InputIter>::_Normal __Normal;
+ return __copy_ni1(__first, __last, __result, __Normal());
+}
+
+// Hack for compilers that don't have partial ordering of function templates
+// but do have partial specialization of class templates.
+#elif defined(__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);
+}
+
+// Fallback for compilers with neither partial ordering nor partial
+// specialization. Define the faster version for the basic builtin
+// types.
+#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));
+}
+
+#define __SGI_STL_DECLARE_COPY_TRIVIAL(_Tp) \
+ inline _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) { \
+ return __copy_trivial(__first, __last, __result); \
+ }
+
+__SGI_STL_DECLARE_COPY_TRIVIAL(char)
+__SGI_STL_DECLARE_COPY_TRIVIAL(signed char)
+__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned char)
+__SGI_STL_DECLARE_COPY_TRIVIAL(short)
+__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned short)
+__SGI_STL_DECLARE_COPY_TRIVIAL(int)
+__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned int)
+__SGI_STL_DECLARE_COPY_TRIVIAL(long)
+__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned long)
+#ifdef __STL_HAS_WCHAR_T
+__SGI_STL_DECLARE_COPY_TRIVIAL(wchar_t)
+#endif
+#ifdef _STL_LONG_LONG
+__SGI_STL_DECLARE_COPY_TRIVIAL(long long)
+__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned long long)
+#endif
+__SGI_STL_DECLARE_COPY_TRIVIAL(float)
+__SGI_STL_DECLARE_COPY_TRIVIAL(double)
+__SGI_STL_DECLARE_COPY_TRIVIAL(long double)
+
+#undef __SGI_STL_DECLARE_COPY_TRIVIAL
+#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_aux(_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);
+}
+
+template <typename _BI1, typename _BI2>
+inline _BI2 __copy_backward_output_normal_iterator(_BI1 __first, _BI1 __last,
+ _BI2 __result, __true_type) {
+ return _BI2(__copy_backward_aux(__first, __last, __result.base()));
+}
+
+template <typename _BI1, typename _BI2>
+inline _BI2 __copy_backward_output_normal_iterator(_BI1 __first, _BI1 __last,
+ _BI2 __result, __false_type){
+ return __copy_backward_aux(__first, __last, __result);
+}
+
+template <typename _BI1, typename _BI2>
+inline _BI2 __copy_backward_input_normal_iterator(_BI1 __first, _BI1 __last,
+ _BI2 __result, __true_type) {
+ typedef typename _Is_normal_iterator<_BI2>::_Normal __Normal;
+ return __copy_backward_output_normal_iterator(__first.base(), __last.base(),
+ __result, __Normal());
+}
+
+template <typename _BI1, typename _BI2>
+inline _BI2 __copy_backward_input_normal_iterator(_BI1 __first, _BI1 __last,
+ _BI2 __result, __false_type) {
+ typedef typename _Is_normal_iterator<_BI2>::_Normal __Normal;
+ return __copy_backward_output_normal_iterator(__first, __last, __result,
+ __Normal());
+}
+
+template <typename _BI1, typename _BI2>
+inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) {
+ typedef typename _Is_normal_iterator<_BI1>::_Normal __Normal;
+ return __copy_backward_input_normal_iterator(__first, __last, __result,
+ __Normal());
+}
+
+#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/libstdc++-v3/bits/stl_alloc.h b/libstdc++-v3/bits/stl_alloc.h
new file mode 100644
index 000000000000..d28938b9cefc
--- /dev/null
+++ b/libstdc++-v3/bits/stl_alloc.h
@@ -0,0 +1,905 @@
+/*
+ * 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.
+
+#ifndef __THROW_BAD_ALLOC
+# if defined(__STL_NO_BAD_ALLOC) || !defined(__STL_USE_EXCEPTIONS)
+# include <bits/std_cstdio.h>
+# include <bits/std_cstdlib.h>
+# define __THROW_BAD_ALLOC fprintf(stderr, "out of memory\n"); exit(1)
+# else /* Standard conforming out-of-memory handling */
+# include <bits/std_new.h>
+# define __THROW_BAD_ALLOC throw std::bad_alloc()
+# endif
+#endif
+
+#ifdef __STL_WIN32THREADS
+# include <windows.h>
+#endif
+
+#include <bits/std_cstddef.h>
+#include <bits/std_cstdlib.h>
+#include <bits/std_cstring.h>
+#include <bits/std_cassert.h>
+#ifndef __RESTRICT
+# define __RESTRICT
+#endif
+
+#ifdef __STL_THREADS
+# include <bits/stl_threads.h>
+# define __NODE_ALLOCATOR_THREADS true
+# ifdef __STL_SGI_THREADS
+ // We test whether threads are in use before locking.
+ // Perhaps this should be moved into stl_threads.h, but that
+ // probably makes it harder to avoid the procedure call when
+ // it isn't needed.
+ 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_node_allocator_lock._M_acquire_lock(); }
+# define __NODE_ALLOCATOR_UNLOCK if (threads && __us_rsthread_malloc) \
+ { _S_node_allocator_lock._M_release_lock(); }
+# else /* !__STL_SGI_THREADS */
+# define __NODE_ALLOCATOR_LOCK \
+ { if (threads) _S_node_allocator_lock._M_acquire_lock(); }
+# define __NODE_ALLOCATOR_UNLOCK \
+ { if (threads) _S_node_allocator_lock._M_release_lock(); }
+# endif
+#else
+// Thread-unsafe
+# define __NODE_ALLOCATOR_LOCK
+# define __NODE_ALLOCATOR_UNLOCK
+# define __NODE_ALLOCATOR_THREADS false
+#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 + (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;
+ assert(*(size_t*)__real_p == __n);
+ _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;
+ assert(*(size_t*)__real_p == __old_sz);
+ 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;
+ }
+
+};
+
+
+# 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 = 16}; // _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 = 16}; // _MAX_BYTES/_ALIGN
+# endif
+ static size_t
+ _S_round_up(size_t __bytes)
+ { return (((__bytes) + (size_t) _ALIGN-1) & ~((size_t) _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* __STL_VOLATILE _S_free_list[];
+ // Specifying a size results in duplicate def for 4.1
+# else
+ static _Obj* __STL_VOLATILE _S_free_list[_NFREELISTS];
+# endif
+ 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);
+
+ // Chunk allocation state.
+ static char* _S_start_free;
+ static char* _S_end_free;
+ static size_t _S_heap_size;
+
+# ifdef __STL_THREADS
+ static _STL_mutex_lock _S_node_allocator_lock;
+# endif
+
+ // It would be nice to use _STL_auto_lock here. But we
+ // don't need the NULL check. And we do need a test whether
+ // threads have actually been started.
+ class _Lock;
+ friend class _Lock;
+ class _Lock {
+ public:
+ _Lock() { __NODE_ALLOCATOR_LOCK; }
+ ~_Lock() { __NODE_ALLOCATOR_UNLOCK; }
+ };
+
+public:
+
+ /* __n must be > 0 */
+ static void* allocate(size_t __n)
+ {
+ void* __ret = 0;
+
+ if (__n > (size_t) _MAX_BYTES) {
+ __ret = malloc_alloc::allocate(__n);
+ }
+ else {
+ _Obj* __STL_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.
+# ifndef _NOTHREADS
+ /*REFERENCED*/
+ _Lock __lock_instance;
+# endif
+ _Obj* __RESTRICT __result = *__my_free_list;
+ if (__result == 0)
+ __ret = _S_refill(_S_round_up(__n));
+ else {
+ *__my_free_list = __result -> _M_free_list_link;
+ __ret = __result;
+ }
+ }
+
+ return __ret;
+ };
+
+ /* __p may not be 0 */
+ static void deallocate(void* __p, size_t __n)
+ {
+ if (__n > (size_t) _MAX_BYTES)
+ malloc_alloc::deallocate(__p, __n);
+ else {
+ _Obj* __STL_VOLATILE* __my_free_list
+ = _S_free_list + _S_freelist_index(__n);
+ _Obj* __q = (_Obj*)__p;
+
+ // 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* __STL_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* __STL_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 <= (size_t) _MAX_BYTES;
+ __i += (size_t) _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* __STL_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_THREADS
+ template <bool __threads, int __inst>
+ _STL_mutex_lock
+ __default_alloc_template<__threads, __inst>::_S_node_allocator_lock
+ __STL_MUTEX_INITIALIZER;
+#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* __STL_VOLATILE
+__default_alloc_template<__threads, __inst> ::_S_free_list[
+# ifdef __SUNPRO_CC
+ _NFREELISTS
+# else
+ __default_alloc_template<__threads, __inst>::_NFREELISTS
+# endif
+] = {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.
+
+#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> {
+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 _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/libstdc++-v3/bits/stl_config.h b/libstdc++-v3/bits/stl_config.h
new file mode 100644
index 000000000000..6e2200dfbd8e
--- /dev/null
+++ b/libstdc++-v3/bits/stl_config.h
@@ -0,0 +1,490 @@
+/*
+ *
+ * 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_STATIC_CONST_INIT_BUG: defined if the compiler can't handle a
+// constant-initializer in the declaration of a static const data member
+// of integer type. (See section 9.4.2, paragraph 4, of the C++ standard.)
+// * __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_DEFAULT_CONSTRUCTOR_BUG: defined if T() does not work properly
+// when T is a builtin type.
+// * __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_NO_BAD_ALLOC: defined if the compiler does not have a <new>
+// header, or if <new> does not contain a bad_alloc class. If a bad_alloc
+// class exists, it is assumed to be in namespace std.
+// * __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_PTHREADS: defined if we should use portable pthreads
+// synchronization.
+// * __STL_UITHREADS: defined if we should use UI / solaris / UnixWare threads
+// synchronization. UIthreads are similar to pthreads, but are based
+// on an earlier version of the Posix threads standard.
+// * __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.)
+// * __STL_THREADS is defined if thread safety is needed.
+// * __STL_VOLATILE is deifined to be "volatile" if threads are being
+// used, and the empty string otherwise.
+
+
+// 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_NO_RELOPS_NAMESPACE: if defined, don't put the relational
+// operator templates (>, <=. >=, !=) in namespace std::rel_ops, even
+// if the compiler supports namespaces and partial ordering of
+// function templates.
+// * __STL_ASSERTIONS: if defined, then enable runtime checking through the
+// __stl_assert macro.
+// * _PTHREADS: if defined, use Posix threads for multithreading support.
+// * _UITHREADS:if defined, use SCO/Solaris/UI threads for multithreading
+// support
+// * _NOTHREADS: if defined, don't use any multithreading support.
+// * __STL_USE_NEW_IOSTREAMS: if defined, then the STL will use new,
+// standard-conforming iostreams (e.g. the <iosfwd> header). If not
+// defined, the STL will use old cfront-style iostreams (e.g. the
+// <iostream.h> header).
+
+// 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.
+
+# if defined(_PTHREADS) && !defined(_NOTHREADS)
+# define __STL_PTHREADS
+# endif
+
+# if defined(_UITHREADS) && !defined(_PTHREADS) && !defined(_NOTHREADS)
+# define __STL_UITHREADS
+# endif
+
+# if defined(__sgi) && !defined(__GNUC__)
+# include <standards.h>
+# if !defined(_BOOL)
+# define __STL_NO_BOOL
+# endif
+# if defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32
+# define __STL_STATIC_CONST_INIT_BUG
+# 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
+# if (_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32
+# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
+# 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 defined(_STANDARD_C_PLUS_PLUS)
+# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
+# endif
+# if (_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32
+# define __STL_MEMBER_TEMPLATE_KEYWORD
+# endif
+# if defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32
+# define __STL_DEFAULT_CONSTRUCTOR_BUG
+# 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 _COMPILER_VERSION < 730 || !defined(_STANDARD_C_PLUS_PLUS) || \
+ !defined(_NAMESPACES)
+# define __STL_NO_BAD_ALLOC
+# endif
+# if !defined(_NOTHREADS) && !defined(__STL_PTHREADS)
+# define __STL_SGI_THREADS
+# endif
+# if defined(_LONGLONG) && defined(_SGIAPI) && _SGIAPI
+# define __STL_LONG_LONG
+# endif
+# if _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)
+# define __STL_USE_NEW_IOSTREAMS
+# endif
+# if _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)
+# define __STL_CAN_THROW_RANGE_ERRORS
+# endif
+# if _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)
+# define __SGI_STL_USE_AUTO_PTR_CONVERSIONS
+# endif
+# endif
+
+
+/*
+ * Jochen Schlick '1999 - added new #defines (__STL)_UITHREADS (for
+ * providing SCO / Solaris / UI thread support)
+ * - added the necessary defines for the SCO UDK 7
+ * compiler (and its template friend behavior)
+ * - all UDK7 specific STL changes are based on the
+ * macro __USLC__ being defined
+ */
+// SCO UDK 7 compiler (UnixWare 7x, OSR 5, UnixWare 2x)
+# if defined(__USLC__)
+# define __STL_HAS_WCHAR_T
+# define __STL_CLASS_PARTIAL_SPECIALIZATION
+# define __STL_PARTIAL_SPECIALIZATION_SYNTAX
+# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
+# define __STL_MEMBER_TEMPLATES
+# define __STL_MEMBER_TEMPLATE_CLASSES
+# define __STL_USE_EXCEPTIONS
+# define __STL_HAS_NAMESPACES
+# define __STL_USE_NAMESPACES
+# define __STL_LONG_LONG
+# if defined(_REENTRANT)
+# define _UITHREADS /* if UnixWare < 7.0.1 */
+# define __STL_UITHREADS
+// use the following defines instead of the UI threads defines when
+// you want to use POSIX threads
+//# define _PTHREADS /* only if UnixWare >=7.0.1 */
+//# define __STL_PTHREADS
+# endif
+# endif
+
+
+
+# ifdef __GNUC__
+# define __STL_HAS_WCHAR_T
+# define __STL_MEMBER_TEMPLATES
+# define __STL_MEMBER_TEMPLATE_CLASSES
+# define __STL_CLASS_PARTIAL_SPECIALIZATION
+# define __STL_PARTIAL_SPECIALIZATION_SYNTAX
+# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
+# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
+# define __SGI_STL_USE_AUTO_PTR_CONVERSIONS
+# define __STL_HAS_NAMESPACES
+# define __STL_USE_NAMESPACES
+# define __STL_USE_EXCEPTIONS
+# define __STL_CAN_THROW_RANGE_ERRORS
+# define __STL_USE_STD_ALLOCATORS
+# define __USE_MALLOC // As the "underlying allocator"
+//# define __STL_USE_NEW_IOSTREAMS //990209 bkoz--use standard .h includes.
+# ifdef _REENTRANT
+# define __STL_THREADS
+# endif
+# ifdef _PTHREADS
+# define __STL_PTHREADS
+# 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
+# ifdef _REENTRANT
+# define __STL_PTHREADS
+# endif
+# define __SGI_STL_NO_ARROW_OPERATOR
+# define __STL_PARTIAL_SPECIALIZATION_SYNTAX
+# define __STL_NO_EXCEPTION_HEADER
+# define __STL_NO_BAD_ALLOC
+# 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
+
+// Intel compiler, which uses the EDG front end.
+# if defined(__ICL)
+# define __STL_LONG_LONG
+# define __STL_MEMBER_TEMPLATES
+# define __STL_MEMBER_TEMPLATE_CLASSES
+# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
+# define __STL_CLASS_PARTIAL_SPECIALIZATION
+# define __STL_NO_DRAND48
+# define __STL_HAS_NAMESPACES
+# define __STL_USE_EXCEPTIONS
+# define __STL_MEMBER_TEMPLATE_KEYWORD
+# ifdef _CPPUNWIND
+# define __STL_USE_EXCEPTIONS
+# endif
+# ifdef _MT
+# define __STL_WIN32THREADS
+# endif
+# endif
+
+// Mingw32, EGCS compiler using the Microsoft C runtime
+# if defined(__MINGW32__)
+# define __STL_NO_DRAND48
+# endif
+
+// Microsoft compiler.
+# if defined(_MSC_VER) && !defined(__ICL)
+# define __STL_NO_DRAND48
+# define __STL_STATIC_CONST_INIT_BUG
+# 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
+# endif
+# if _MSC_VER > 1000
+# include <yvals.h>
+# define __STL_DONT_USE_BOOL_TYPEDEF
+# endif
+# define __STL_NON_TYPE_TMPL_PARAM_BUG
+# define __SGI_STL_NO_ARROW_OPERATOR
+# define __STL_DEFAULT_CONSTRUCTOR_BUG
+# 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
+# define __STL_CAN_THROW_RANGE_ERRORS
+# endif
+# if _MSC_VER < 1100
+# define __STL_NO_EXCEPTION_HEADER
+# define __STL_NO_BAD_ALLOC
+# endif
+ // Because of a Microsoft front end bug, we must not provide a
+ // namespace qualifier when declaring a friend function.
+# define __STD_QUALIFIER
+# endif
+
+# if defined(__BORLANDC__)
+# define __STL_NO_BAD_ALLOC
+# define __STL_NO_DRAND48
+# define __STL_NEED_TYPENAME
+# define __STL_LIMITED_DEFAULT_TEMPLATES
+# define __SGI_STL_NO_ARROW_OPERATOR
+# define __STL_DEFAULT_CONSTRUCTOR_BUG
+# 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
+
+// __STL_NO_NAMESPACES is a hook so that users can disable namespaces
+// without having to edit library headers. __STL_NO_RELOPS_NAMESPACE is
+// a hook so that users can disable the std::rel_ops namespace, keeping
+// the relational operator template in namespace std, without having to
+// edit library headers.
+# if defined(__STL_HAS_NAMESPACES) && !defined(__STL_NO_NAMESPACES)
+# define __STL_USE_NAMESPACES
+# define __STD std
+# define __STL_BEGIN_NAMESPACE namespace std {
+# define __STL_END_NAMESPACE }
+# if defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER) && \
+ !defined(__STL_NO_RELOPS_NAMESPACE)
+# define __STL_USE_NAMESPACE_FOR_RELOPS
+# define __STL_BEGIN_RELOPS_NAMESPACE namespace std { namespace rel_ops {
+# define __STL_END_RELOPS_NAMESPACE } }
+# define __STD_RELOPS std::rel_ops
+# else /* Use std::rel_ops namespace */
+# define __STL_USE_NAMESPACE_FOR_RELOPS
+# define __STL_BEGIN_RELOPS_NAMESPACE namespace std {
+# define __STL_END_RELOPS_NAMESPACE }
+# define __STD_RELOPS std
+# endif /* Use std::rel_ops namespace */
+# 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
+
+// Some versions of the EDG front end sometimes require an explicit
+// namespace spec where they shouldn't. This macro facilitates that.
+// If the bug becomes irrelevant, then all uses of __STD_QUALIFIER
+// should be removed. The 7.3 beta SGI compiler has this bug, but the
+// MR version is not expected to have it.
+
+# if defined(__STL_USE_NAMESPACES) && !defined(__STD_QUALIFIER)
+# define __STD_QUALIFIER std::
+# else
+# define __STD_QUALIFIER
+# 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
+
+#if defined(__STL_WIN32THREADS) || defined(STL_SGI_THREADS) \
+ || defined(__STL_PTHREADS) || defined(__STL_UITHREADS)
+# define __STL_THREADS
+# define __STL_VOLATILE volatile
+#else
+# define __STL_VOLATILE
+#endif
+
+#endif /* __STL_CONFIG_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/stl_construct.h b/libstdc++-v3/bits/stl_construct.h
new file mode 100644
index 000000000000..b77bf15dd53c
--- /dev/null
+++ b/libstdc++-v3/bits/stl_construct.h
@@ -0,0 +1,90 @@
+/*
+ *
+ * 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 _CPP_BITS_STL_CONSTRUCT_H
+#define _CPP_BITS_STL_CONSTRUCT_H 1
+
+#include <bits/std_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::~_Tp();
+}
+
+template <class _Tp1, class _Tp2>
+inline void construct(_Tp1* __p, const _Tp2& __value) {
+ new (__p) _Tp1(__value);
+}
+
+template <class _Tp1>
+inline void construct(_Tp1* __p) {
+ new (__p) _Tp1();
+}
+
+template <class _ForwardIterator>
+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 /* _CPP_BITS_STL_CONSTRUCT_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/stl_deque.h b/libstdc++-v3/bits/stl_deque.h
new file mode 100644
index 000000000000..4b0d20b87811
--- /dev/null
+++ b/libstdc++-v3/bits/stl_deque.h
@@ -0,0 +1,1768 @@
+/*
+ *
+ * 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);
+ }
+ bool operator>(const _Self& __x) const { return __x < *this; }
+ bool operator<=(const _Self& __x) const { return !(__x < *this); }
+ bool operator>=(const _Self& __x) const { return !(*this < __x); }
+
+ 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 _M_node_allocator; }
+
+ _Deque_alloc_base(const allocator_type& __a)
+ : _M_node_allocator(__a), _M_map_allocator(__a),
+ _M_map(0), _M_map_size(0)
+ {}
+
+protected:
+ typedef typename _Alloc_traits<_Tp*, _Alloc>::allocator_type
+ _Map_allocator_type;
+
+ allocator_type _M_node_allocator;
+ _Map_allocator_type _M_map_allocator;
+
+ _Tp* _M_allocate_node() {
+ return _M_node_allocator.allocate(__deque_buf_size(__bufsiz,sizeof(_Tp)));
+ }
+ void _M_deallocate_node(_Tp* __p) {
+ _M_node_allocator.deallocate(__p, __deque_buf_size(__bufsiz,sizeof(_Tp)));
+ }
+ _Tp** _M_allocate_map(size_t __n)
+ { return _M_map_allocator.allocate(__n); }
+ void _M_deallocate_map(_Tp** __p, size_t __n)
+ { _M_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 = 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)]; }
+
+#ifdef __STL_THROW_RANGE_ERRORS
+ void _M_range_check(size_type __n) const {
+ if (__n >= this->size())
+ __stl_throw_range_error("deque");
+ }
+
+ reference at(size_type __n)
+ { _M_range_check(__n); return (*this)[__n]; }
+ const_reference at(size_type __n) const
+ { _M_range_check(__n); return (*this)[__n]; }
+#endif /* __STL_THROW_RANGE_ERRORS */
+
+ 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 _M_fill_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);
+ }
+ }
+
+ void assign(size_type __n, const _Tp& __val) {
+ _M_fill_assign(__n, __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)
+ { _M_fill_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)
+ { _M_fill_insert(__pos, __n, __x); }
+
+ void _M_fill_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) {
+ _M_fill_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;
+ size_type __index = __pos - _M_start;
+ if (__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());
+ }
+ bool operator>(const deque<_Tp,_Alloc,0>& __x) const {
+ return __x < *this;
+ }
+ bool operator<=(const deque<_Tp,_Alloc,0>& __x) const {
+ return !(__x < *this);
+ }
+ bool operator>=(const deque<_Tp,_Alloc,0>& __x) const {
+ return !(*this < __x);
+ }
+#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>::_M_fill_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);
+ __STL_TRY {
+ uninitialized_fill(__new_start, _M_start, __x);
+ _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_fill(_M_finish, __new_finish, __x);
+ _M_finish = __new_finish;
+ }
+ __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
+ __new_finish._M_node + 1));
+ }
+ 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);
+ __STL_TRY {
+ for ( ; __first != __last; ++__first)
+ push_back(*__first);
+ }
+ __STL_UNWIND(clear());
+}
+
+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>
+inline 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>
+inline 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());
+}
+
+#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
+
+template <class _Tp, class _Alloc, size_t __bufsiz>
+inline bool operator!=(const deque<_Tp, _Alloc, __bufsiz>& __x,
+ const deque<_Tp, _Alloc, __bufsiz>& __y)
+{
+ return !(__x == __y);
+}
+
+template <class _Tp, class _Alloc, size_t __bufsiz>
+inline bool operator>(const deque<_Tp, _Alloc, __bufsiz>& __x,
+ const deque<_Tp, _Alloc, __bufsiz>& __y)
+{
+ return __y < __x;
+}
+
+template <class _Tp, class _Alloc, size_t __bufsiz>
+inline bool operator<=(const deque<_Tp, _Alloc, __bufsiz>& __x,
+ const deque<_Tp, _Alloc, __bufsiz>& __y)
+{
+ return !(__y < __x);
+}
+template <class _Tp, class _Alloc, size_t __bufsiz>
+inline bool operator>=(const deque<_Tp, _Alloc, __bufsiz>& __x,
+ const deque<_Tp, _Alloc, __bufsiz>& __y)
+{
+ return !(__x < __y);
+}
+
+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 /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
+#endif /* __STL_NON_TYPE_TMPL_PARAM_BUG */
+
+#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/libstdc++-v3/bits/stl_function.h b/libstdc++-v3/bits/stl_function.h
new file mode 100644
index 000000000000..e7e53407c958
--- /dev/null
+++ b/libstdc++-v3/bits/stl_function.h
@@ -0,0 +1,732 @@
+/*
+ *
+ * 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& __fn, const _Tp& __x)
+{
+ typedef typename _Operation::first_argument_type _Arg1_type;
+ return binder1st<_Operation>(__fn, _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& __fn, const _Tp& __x)
+{
+ typedef typename _Operation::second_argument_type _Arg2_type;
+ return binder2nd<_Operation>(__fn, _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 _M_fn1;
+ _Operation2 _M_fn2;
+public:
+ unary_compose(const _Operation1& __x, const _Operation2& __y)
+ : _M_fn1(__x), _M_fn2(__y) {}
+ typename _Operation1::result_type
+ operator()(const typename _Operation2::argument_type& __x) const {
+ return _M_fn1(_M_fn2(__x));
+ }
+};
+
+template <class _Operation1, class _Operation2>
+inline unary_compose<_Operation1,_Operation2>
+compose1(const _Operation1& __fn1, const _Operation2& __fn2)
+{
+ return unary_compose<_Operation1,_Operation2>(__fn1, __fn2);
+}
+
+template <class _Operation1, class _Operation2, class _Operation3>
+class binary_compose
+ : public unary_function<typename _Operation2::argument_type,
+ typename _Operation1::result_type> {
+protected:
+ _Operation1 _M_fn1;
+ _Operation2 _M_fn2;
+ _Operation3 _M_fn3;
+public:
+ binary_compose(const _Operation1& __x, const _Operation2& __y,
+ const _Operation3& __z)
+ : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
+ typename _Operation1::result_type
+ operator()(const typename _Operation2::argument_type& __x) const {
+ return _M_fn1(_M_fn2(__x), _M_fn3(__x));
+ }
+};
+
+template <class _Operation1, class _Operation2, class _Operation3>
+inline binary_compose<_Operation1, _Operation2, _Operation3>
+compose2(const _Operation1& __fn1, const _Operation2& __fn2,
+ const _Operation3& __fn3)
+{
+ return binary_compose<_Operation1,_Operation2,_Operation3>
+ (__fn1, __fn2, __fn3);
+}
+
+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> {
+ _Tp& operator()(_Tp& __x) const { return __x; }
+ 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> {
+ typename _Pair::first_type& operator()(_Pair& __x) const {
+ return __x.first;
+ }
+ 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>
+{
+ typename _Pair::second_type& operator()(_Pair& __x) const {
+ return __x.second;
+ }
+ 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 _M_val;
+
+ _Constant_void_fun(const result_type& __v) : _M_val(__v) {}
+ const result_type& operator()() const { return _M_val; }
+};
+
+template <class _Result, class _Argument>
+struct _Constant_unary_fun {
+ typedef _Argument argument_type;
+ typedef _Result result_type;
+ result_type _M_val;
+
+ _Constant_unary_fun(const result_type& __v) : _M_val(__v) {}
+ const result_type& operator()(const _Argument&) const { return _M_val; }
+};
+
+template <class _Result, class _Arg1, class _Arg2>
+struct _Constant_binary_fun {
+ typedef _Arg1 first_argument_type;
+ typedef _Arg2 second_argument_type;
+ typedef _Result result_type;
+ _Result _M_val;
+
+ _Constant_binary_fun(const _Result& __v) : _M_val(__v) {}
+ const result_type& operator()(const _Arg1&, const _Arg2&) const {
+ return _M_val;
+ }
+};
+
+template <class _Result>
+struct constant_void_fun : public _Constant_void_fun<_Result> {
+ constant_void_fun(const _Result& __v) : _Constant_void_fun<_Result>(_v) {}
+};
+
+
+template <class _Result,
+ class _Argument = _Result>
+struct constant_unary_fun : public _Constant_unary_fun<_Result, _Argument>
+{
+ constant_unary_fun(const _Result& __v)
+ : _Constant_unary_fun<_Result, _Argument>(__v) {}
+};
+
+
+template <class _Result,
+ class _Arg1 = _Result,
+ class _Arg2 = _Arg1>
+struct constant_binary_fun
+ : public _Constant_binary_fun<_Result, _Arg1, _Arg2>
+{
+ constant_binary_fun(const _Result& __v)
+ : _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {}
+};
+
+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/libstdc++-v3/bits/stl_heap.h b/libstdc++-v3/bits/stl_heap.h
new file mode 100644
index 000000000000..8af130c7006b
--- /dev/null
+++ b/libstdc++-v3/bits/stl_heap.h
@@ -0,0 +1,281 @@
+/*
+ *
+ * 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 _CPP_BITS_STL_HEAP_H
+#define _CPP_BITS_STL_HEAP_H 1
+
+__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 /* _CPP_BITS_STL_HEAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/stl_iterator.h b/libstdc++-v3/bits/stl_iterator.h
new file mode 100644
index 000000000000..16b657e81b72
--- /dev/null
+++ b/libstdc++-v3/bits/stl_iterator.h
@@ -0,0 +1,1093 @@
+/*
+ *
+ * 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
+
+
+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));
+}
+
+template <class _BidirectionalIterator, class _Tp, class _Reference = _Tp&,
+ class _Distance = ptrdiff_t>
+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_FUNCTION_TMPL_PARTIAL_ORDER
+
+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 == __y);
+}
+
+#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
+
+
+#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();
+}
+
+#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
+
+template <class _Iterator>
+inline bool operator!=(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y) {
+ return !(__x == __y);
+}
+
+template <class _Iterator>
+inline bool operator>(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y) {
+ return __y < __x;
+}
+
+template <class _Iterator>
+inline bool operator<=(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y) {
+ return !(__y < __x);
+}
+
+template <class _Iterator>
+inline bool operator>=(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y) {
+ return !(__x < __y);
+}
+
+#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
+
+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.
+
+template <class _RandomAccessIterator, class _Tp, class _Reference = _Tp&,
+ class _Distance = ptrdiff_t>
+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();
+}
+
+#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
+
+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 == __y); }
+}
+
+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 < __x;
+}
+
+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 < __x);
+}
+
+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 < __y);
+}
+
+#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
+
+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 */
+
+// istream_iterator and ostream_iterator look very different if we're
+// using new, templatized iostreams than if we're using the old cfront
+// version.
+
+#ifdef __STL_USE_NEW_IOSTREAMS
+
+template <class _Tp,
+ class _CharT = char, class _Traits = char_traits<_CharT>,
+ class _Dist = ptrdiff_t>
+class istream_iterator {
+public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_istream<_CharT, _Traits> istream_type;
+
+ 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(0), _M_ok(false) {}
+ istream_iterator(istream_type& __s) : _M_stream(&__s) { _M_read(); }
+
+ reference operator*() const { return _M_value; }
+ pointer operator->() const { return &(operator*()); }
+
+ istream_iterator& operator++() {
+ _M_read();
+ return *this;
+ }
+ istream_iterator operator++(int) {
+ istream_iterator __tmp = *this;
+ _M_read();
+ return __tmp;
+ }
+
+ bool _M_equal(const istream_iterator& __x) const
+ { return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream); }
+
+private:
+ istream_type* _M_stream;
+ _Tp _M_value;
+ bool _M_ok;
+
+ void _M_read() {
+ _M_ok = (_M_stream && *_M_stream) ? true : false;
+ if (_M_ok) {
+ *_M_stream >> _M_value;
+ _M_ok = *_M_stream ? true : false;
+ }
+ }
+};
+
+template <class _Tp, class _CharT, class _Traits, class _Dist>
+inline bool
+operator==(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x,
+ const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) {
+ return __x._M_equal(__y);
+}
+
+#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
+
+template <class _Tp, class _CharT, class _Traits, class _Dist>
+inline bool
+operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x,
+ const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) {
+ return !__x._M_equal(__y);
+}
+
+#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
+
+template <class _Tp,
+ class _CharT = char, class _Traits = char_traits<_CharT> >
+class ostream_iterator {
+public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
+
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {}
+ ostream_iterator(ostream_type& __s, const _CharT* __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; }
+private:
+ ostream_type* _M_stream;
+ const _CharT* _M_string;
+};
+
+// The default template argument is declared in iosfwd
+
+// We do not read any characters until operator* is called. The first
+// time operator* is called, it calls getc. Subsequent calls to getc
+// return a cached character, and calls to operator++ use snextc. Before
+// operator* or operator++ has been called, _M_is_initialized is false.
+template<class _CharT, class _Traits>
+class istreambuf_iterator
+{
+public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename _Traits::int_type int_type;
+ typedef basic_streambuf<_CharT, _Traits> streambuf_type;
+ typedef basic_istream<_CharT, _Traits> istream_type;
+
+ typedef input_iterator_tag iterator_category;
+ typedef _CharT value_type;
+ typedef typename _Traits::off_type difference_type;
+ typedef const _CharT* pointer;
+ typedef const _CharT& reference;
+
+public:
+ istreambuf_iterator(streambuf_type* __p = 0) { this->_M_init(__p); }
+ istreambuf_iterator(istream_type& __is) { this->_M_init(__is.rdbuf()); }
+
+ char_type operator*() const
+ { return _M_is_initialized ? _M_c : _M_dereference_aux(); }
+
+ istreambuf_iterator& operator++() { this->_M_nextc(); return *this; }
+ istreambuf_iterator operator++(int) {
+ if (!_M_is_initialized)
+ _M_postincr_aux();
+ istreambuf_iterator __tmp = *this;
+ this->_M_nextc();
+ return __tmp;
+ }
+
+ bool equal(const istreambuf_iterator& __i) const {
+ return this->_M_is_initialized && __i._M_is_initialized
+ ? this->_M_eof == __i._M_eof
+ : this->_M_equal_aux(__i);
+ }
+
+private:
+ void _M_init(streambuf_type* __p) {
+ _M_buf = __p;
+ _M_eof = !__p;
+ _M_is_initialized = _M_eof;
+ }
+
+ char_type _M_dereference_aux() const;
+ bool _M_equal_aux(const istreambuf_iterator&) const;
+ void _M_postincr_aux();
+
+ void _M_nextc() {
+ int_type __c = _M_buf->snextc();
+ _M_c = traits_type::to_char_type(__c);
+ _M_eof = traits_type::eq_int_type(__c, traits_type::eof());
+ _M_is_initialized = true;
+ }
+
+ void _M_getc() const {
+ int_type __c = _M_buf->sgetc();
+ _M_c = traits_type::to_char_type(__c);
+ _M_eof = traits_type::eq_int_type(__c, traits_type::eof());
+ _M_is_initialized = true;
+ }
+
+private:
+ streambuf_type* _M_buf;
+ mutable _CharT _M_c;
+ mutable bool _M_eof : 1;
+ mutable bool _M_is_initialized : 1;
+};
+
+template<class _CharT, class _Traits>
+_CharT istreambuf_iterator<_CharT, _Traits>::_M_dereference_aux() const
+{
+ this->_M_getc();
+ return _M_c;
+}
+
+template<class _CharT, class _Traits>
+bool istreambuf_iterator<_CharT, _Traits>
+ ::_M_equal_aux(const istreambuf_iterator& __i) const
+{
+ if (!this->_M_is_initialized)
+ this->_M_getc();
+ if (!__i._M_is_initialized)
+ __i._M_getc();
+
+ return this->_M_eof == __i._M_eof;
+}
+
+template<class _CharT, class _Traits>
+void istreambuf_iterator<_CharT, _Traits>::_M_postincr_aux()
+{
+ this->_M_getc();
+}
+
+template<class _CharT, class _Traits>
+inline bool operator==(const istreambuf_iterator<_CharT, _Traits>& __x,
+ const istreambuf_iterator<_CharT, _Traits>& __y) {
+ return __x.equal(__y);
+}
+
+#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
+
+template<class _CharT, class _Traits>
+inline bool operator!=(const istreambuf_iterator<_CharT, _Traits>& __x,
+ const istreambuf_iterator<_CharT, _Traits>& __y) {
+ return !__x.equal(__y);
+}
+
+#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
+
+// The default template argument is declared in iosfwd
+template<class _CharT, class _Traits>
+class ostreambuf_iterator
+{
+public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename _Traits::int_type int_type;
+ typedef basic_streambuf<_CharT, _Traits> streambuf_type;
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
+
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+public:
+ ostreambuf_iterator(streambuf_type* __buf) : _M_buf(__buf), _M_ok(__buf) {}
+ ostreambuf_iterator(ostream_type& __o)
+ : _M_buf(__o.rdbuf()), _M_ok(__o.rdbuf()) {}
+
+ ostreambuf_iterator& operator=(char_type __c) {
+ _M_ok = _M_ok && !traits_type::eq_int_type(_M_buf->sputc(__c),
+ traits_type::eof());
+ return *this;
+ }
+
+ ostreambuf_iterator& operator*() { return *this; }
+ ostreambuf_iterator& operator++() { return *this; }
+ ostreambuf_iterator& operator++(int) { return *this; }
+
+ bool failed() const { return !_M_ok; }
+
+private:
+ streambuf_type* _M_buf;
+ bool _M_ok;
+};
+
+#else /* __STL_USE_NEW_IOSTREAMS */
+
+template <class _Tp, class _Dist = ptrdiff_t> class istream_iterator;
+
+template <class _Tp, class _Dist>
+inline bool operator==(const istream_iterator<_Tp, _Dist>&,
+ const istream_iterator<_Tp, _Dist>&);
+
+template <class _Tp, class _Dist>
+class istream_iterator {
+#ifdef __STL_MEMBER_TEMPLATES
+ template <class _T1, class _D1>
+ friend bool operator==(const istream_iterator<_T1, _D1>&,
+ const istream_iterator<_T1, _D1>&);
+#else /* __STL_MEMBER_TEMPLATES */
+ friend bool __STD_QUALIFIER
+ operator== __STL_NULL_TMPL_ARGS (const istream_iterator&,
+ const istream_iterator&);
+#endif /* __STL_MEMBER_TEMPLATES */
+
+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;
+}
+
+#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
+
+template <class _Tp, class _Distance>
+inline bool operator!=(const istream_iterator<_Tp, _Distance>& __x,
+ const istream_iterator<_Tp, _Distance>& __y) {
+ return !(__x == __y);
+}
+
+#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
+
+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 */
+
+#endif /* __STL_USE_NEW_IOSTREAMS */
+
+// This iterator adapter is 'normal' in the sense that it does not
+// change the semantics of any of the operators of its itererator
+// parameter. Its primary purpose is to convert an iterator that is
+// not a class, e.g. a pointer, into an iterator that is a class.
+// The _Container parameter exists solely so that different containers
+// using this template can instantiate different types, even if the
+// _Iterator parameter is the same.
+template<typename _Iterator, typename _Container>
+class __normal_iterator
+ : public iterator<iterator_traits<_Iterator>::iterator_category,
+ iterator_traits<_Iterator>::value_type,
+ iterator_traits<_Iterator>::difference_type,
+ iterator_traits<_Iterator>::pointer,
+ iterator_traits<_Iterator>::reference>
+{
+public:
+
+ typedef __normal_iterator<_Iterator, _Container> normal_iterator_type;
+
+ inline __normal_iterator() : _M_current() { }
+
+ inline explicit __normal_iterator(const _Iterator& __i)
+ : _M_current(__i) { }
+
+ // Allow iterator to const_iterator conversion
+ template<typename _Iter>
+ inline __normal_iterator(const __normal_iterator<_Iter, _Container>& __i)
+ : _M_current(__i.base()) { }
+
+ // forward iterator requirements
+
+ inline reference
+ operator*() const
+ { return *_M_current; }
+
+ inline pointer
+ operator->() const
+ { return _M_current; }
+
+ inline normal_iterator_type&
+ operator++()
+ { ++_M_current; return *this; }
+
+ inline normal_iterator_type
+ operator++(int)
+ { return __normal_iterator(_M_current++); }
+
+ // bidirectional iterator requirements
+
+ inline normal_iterator_type&
+ operator--()
+ { --_M_current; return *this; }
+
+ inline normal_iterator_type
+ operator--(int)
+ { return __normal_iterator(_M_current--); }
+
+ // random access iterator requirements
+
+ inline reference
+ operator[](const difference_type& __n) const
+ { return _M_current[__n]; }
+
+ inline normal_iterator_type&
+ operator+=(const difference_type& __n)
+ { _M_current += __n; return *this; }
+
+ inline normal_iterator_type
+ operator+(const difference_type& __n) const
+ { return __normal_iterator(_M_current + __n); }
+
+ inline normal_iterator_type&
+ operator-=(const difference_type& __n)
+ { _M_current -= __n; return *this; }
+
+ inline normal_iterator_type
+ operator-(const difference_type& __n) const
+ { return __normal_iterator(_M_current - __n); }
+
+ inline difference_type
+ operator-(const normal_iterator_type& __i) const
+ { return _M_current - __i._M_current; }
+
+ const _Iterator& base() const
+ { return _M_current; }
+
+protected:
+ _Iterator _M_current;
+};
+
+// forward iterator requirements
+
+template<typename _IteratorL, typename _IteratorR, typename _Container>
+bool operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ const __normal_iterator<_IteratorR, _Container>& __rhs)
+{ return __lhs.base() == __rhs.base(); }
+
+template<typename _IteratorL, typename _IteratorR, typename _Container>
+bool operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ const __normal_iterator<_IteratorR, _Container>& __rhs)
+{ return !(__lhs == __rhs); }
+
+// random access iterator requirements
+
+template<typename _IteratorL, typename _IteratorR, typename _Container>
+bool operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ const __normal_iterator<_IteratorR, _Container>& __rhs)
+{ return __lhs.base() < __rhs.base(); }
+
+template<typename _IteratorL, typename _IteratorR, typename _Container>
+bool operator>(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ const __normal_iterator<_IteratorR, _Container>& __rhs)
+{ return __rhs < __lhs; }
+
+template<typename _IteratorL, typename _IteratorR, typename _Container>
+bool operator<=(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ const __normal_iterator<_IteratorR, _Container>& __rhs)
+{ return !(__rhs < __lhs); }
+
+template<typename _IteratorL, typename _IteratorR, typename _Container>
+bool operator>=(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ const __normal_iterator<_IteratorR, _Container>& __rhs)
+{ return !(__lhs < __rhs); }
+
+template<typename _Iterator, typename _Container>
+inline __normal_iterator<_Iterator, _Container>
+operator+(__normal_iterator<_Iterator, _Container>::difference_type __n,
+ const __normal_iterator<_Iterator, _Container>& __i)
+{ return __normal_iterator<_Iterator, _Container>(__i.base() + __n); }
+
+__STL_END_NAMESPACE
+
+#endif /* __SGI_STL_INTERNAL_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/stl_iterator_base.h b/libstdc++-v3/bits/stl_iterator_base.h
new file mode 100644
index 000000000000..d26888e60723
--- /dev/null
+++ b/libstdc++-v3/bits/stl_iterator_base.h
@@ -0,0 +1,358 @@
+/*
+ *
+ * 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_BASE_H
+#define __SGI_STL_INTERNAL_ITERATOR_BASE_H
+
+// This file contains all of the general iterator-related utilities.
+// The internal file stl_iterator.h contains predefined iterators,
+// such as front_insert_iterator and istream_iterator.
+
+__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));
+}
+
+__STL_END_NAMESPACE
+
+#endif /* __SGI_STL_INTERNAL_ITERATOR_BASE_H */
+
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/stl_list.h b/libstdc++-v3/bits/stl_list.h
new file mode 100644
index 000000000000..b5b88ed81bd5
--- /dev/null
+++ b/libstdc++-v3/bits/stl_list.h
@@ -0,0 +1,867 @@
+/*
+ *
+ * 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 = 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) {
+ _M_fill_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)
+ { _M_fill_insert(__pos, __n, __x); }
+ void _M_fill_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) { _M_fill_assign(__n, __val); }
+
+ void _M_fill_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)
+ { _M_fill_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 */
+};
+
+template <class _Tp, class _Alloc>
+inline bool
+operator==(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y)
+{
+ typedef typename list<_Tp,_Alloc>::const_iterator const_iterator;
+ const_iterator __end1 = __x.end();
+ const_iterator __end2 = __y.end();
+
+ const_iterator __i1 = __x.begin();
+ const_iterator __i2 = __y.begin();
+ while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) {
+ ++__i1;
+ ++__i2;
+ }
+ return __i1 == __end1 && __i2 == __end2;
+}
+
+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 bool operator!=(const list<_Tp,_Alloc>& __x,
+ const list<_Tp,_Alloc>& __y) {
+ return !(__x == __y);
+}
+
+template <class _Tp, class _Alloc>
+inline bool operator>(const list<_Tp,_Alloc>& __x,
+ const list<_Tp,_Alloc>& __y) {
+ return __y < __x;
+}
+
+template <class _Tp, class _Alloc>
+inline bool operator<=(const list<_Tp,_Alloc>& __x,
+ const list<_Tp,_Alloc>& __y) {
+ return !(__y < __x);
+}
+
+template <class _Tp, class _Alloc>
+inline bool operator>=(const list<_Tp,_Alloc>& __x,
+ const list<_Tp,_Alloc>& __y) {
+ return !(__x < __y);
+}
+
+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>::_M_fill_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>::_M_fill_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/libstdc++-v3/bits/stl_map.h b/libstdc++-v3/bits/stl_map.h
new file mode 100644
index 000000000000..1a3b63014dc9
--- /dev/null
+++ b/libstdc++-v3/bits/stl_map.h
@@ -0,0 +1,273 @@
+/*
+ *
+ * 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 _CPP_BITS_STL_MAP_H
+#define _CPP_BITS_STL_MAP_H 1
+
+__STL_BEGIN_NAMESPACE
+
+#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
+#pragma set woff 1174
+#pragma set woff 1375
+#endif
+
+template <class _Key, class _Tp, class _Compare = less<_Key>,
+ class _Alloc = allocator<pair<const _Key, _Tp> > >
+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 comp;
+ value_compare(_Compare __c) : comp(__c) {}
+ public:
+ bool operator()(const value_type& __x, const value_type& __y) const {
+ return comp(__x.first, __y.first);
+ }
+ };
+
+private:
+ typedef _Rb_tree<key_type, value_type,
+ _Select1st<value_type>, key_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);
+ }
+
+#ifdef __STL_MEMBER_TEMPLATES
+ template <class _K1, class _T1, class _C1, class _A1>
+ friend bool operator== (const map<_K1, _T1, _C1, _A1>&,
+ const map<_K1, _T1, _C1, _A1>&);
+ template <class _K1, class _T1, class _C1, class _A1>
+ friend bool operator< (const map<_K1, _T1, _C1, _A1>&,
+ const map<_K1, _T1, _C1, _A1>&);
+#else /* __STL_MEMBER_TEMPLATES */
+ friend bool __STD_QUALIFIER
+ operator== __STL_NULL_TMPL_ARGS (const map&, const map&);
+ friend bool __STD_QUALIFIER
+ operator< __STL_NULL_TMPL_ARGS (const map&, const map&);
+#endif /* __STL_MEMBER_TEMPLATES */
+};
+
+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 bool operator!=(const map<_Key,_Tp,_Compare,_Alloc>& __x,
+ const map<_Key,_Tp,_Compare,_Alloc>& __y) {
+ return !(__x == __y);
+}
+
+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 __y < __x;
+}
+
+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 !(__y < __x);
+}
+
+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 < __y);
+}
+
+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 /* _CPP_BITS_STL_MAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/stl_multimap.h b/libstdc++-v3/bits/stl_multimap.h
new file mode 100644
index 000000000000..c8a861bcb170
--- /dev/null
+++ b/libstdc++-v3/bits/stl_multimap.h
@@ -0,0 +1,275 @@
+/*
+ *
+ * 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
+
+// Forward declaration of operators < and ==, needed for friend declaration.
+
+template <class _Key, class _Tp,
+ class _Compare = less<_Key>,
+ class _Alloc = allocator<pair<const _Key, _Tp> > >
+class 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);
+
+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);
+
+template <class _Key, class _Tp, class _Compare, class _Alloc>
+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 comp;
+ value_compare(_Compare __c) : comp(__c) {}
+ public:
+ bool operator()(const value_type& __x, const value_type& __y) const {
+ return comp(__x.first, __y.first);
+ }
+ };
+
+private:
+ typedef _Rb_tree<key_type, value_type,
+ _Select1st<value_type>, key_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);
+ }
+
+#ifdef __STL_MEMBER_TEMPLATES
+ template <class _K1, class _T1, class _C1, class _A1>
+ friend bool operator== (const multimap<_K1, _T1, _C1, _A1>&,
+ const multimap<_K1, _T1, _C1, _A1>&);
+ template <class _K1, class _T1, class _C1, class _A1>
+ friend bool operator< (const multimap<_K1, _T1, _C1, _A1>&,
+ const multimap<_K1, _T1, _C1, _A1>&);
+#else /* __STL_MEMBER_TEMPLATES */
+ friend bool __STD_QUALIFIER
+ operator== __STL_NULL_TMPL_ARGS (const multimap&, const multimap&);
+ friend bool __STD_QUALIFIER
+ operator< __STL_NULL_TMPL_ARGS (const multimap&, const multimap&);
+#endif /* __STL_MEMBER_TEMPLATES */
+};
+
+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 bool operator!=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
+ const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {
+ return !(__x == __y);
+}
+
+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 __y < __x;
+}
+
+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 !(__y < __x);
+}
+
+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 < __y);
+}
+
+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/libstdc++-v3/bits/stl_multiset.h b/libstdc++-v3/bits/stl_multiset.h
new file mode 100644
index 000000000000..eda4dabe2a7a
--- /dev/null
+++ b/libstdc++-v3/bits/stl_multiset.h
@@ -0,0 +1,266 @@
+/*
+ *
+ * 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
+
+// Forward declaration of operators < and ==, needed for friend declaration.
+
+template <class _Key, class _Compare = less<_Key>,
+ class _Alloc = allocator<_Key> >
+class multiset;
+
+template <class _Key, class _Compare, class _Alloc>
+inline bool operator==(const multiset<_Key,_Compare,_Alloc>& __x,
+ const multiset<_Key,_Compare,_Alloc>& __y);
+
+template <class _Key, class _Compare, class _Alloc>
+inline bool operator<(const multiset<_Key,_Compare,_Alloc>& __x,
+ const multiset<_Key,_Compare,_Alloc>& __y);
+
+template <class _Key, class _Compare, class _Alloc>
+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);
+ }
+
+#ifdef __STL_MEMBER_TEMPLATES
+ template <class _K1, class _C1, class _A1>
+ friend bool operator== (const multiset<_K1,_C1,_A1>&,
+ const multiset<_K1,_C1,_A1>&);
+ template <class _K1, class _C1, class _A1>
+ friend bool operator< (const multiset<_K1,_C1,_A1>&,
+ const multiset<_K1,_C1,_A1>&);
+#else /* __STL_MEMBER_TEMPLATES */
+ friend bool __STD_QUALIFIER
+ operator== __STL_NULL_TMPL_ARGS (const multiset&, const multiset&);
+ friend bool __STD_QUALIFIER
+ operator< __STL_NULL_TMPL_ARGS (const multiset&, const multiset&);
+#endif /* __STL_MEMBER_TEMPLATES */
+};
+
+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 bool operator!=(const multiset<_Key,_Compare,_Alloc>& __x,
+ const multiset<_Key,_Compare,_Alloc>& __y) {
+ return !(__x == __y);
+}
+
+template <class _Key, class _Compare, class _Alloc>
+inline bool operator>(const multiset<_Key,_Compare,_Alloc>& __x,
+ const multiset<_Key,_Compare,_Alloc>& __y) {
+ return __y < __x;
+}
+
+template <class _Key, class _Compare, class _Alloc>
+inline bool operator<=(const multiset<_Key,_Compare,_Alloc>& __x,
+ const multiset<_Key,_Compare,_Alloc>& __y) {
+ return !(__y < __x);
+}
+
+template <class _Key, class _Compare, class _Alloc>
+inline bool operator>=(const multiset<_Key,_Compare,_Alloc>& __x,
+ const multiset<_Key,_Compare,_Alloc>& __y) {
+ return !(__x < __y);
+}
+
+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/libstdc++-v3/bits/stl_numeric.h b/libstdc++-v3/bits/stl_numeric.h
new file mode 100644
index 000000000000..7070e2d625e5
--- /dev/null
+++ b/libstdc++-v3/bits/stl_numeric.h
@@ -0,0 +1,239 @@
+/*
+ *
+ * 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 _CPP_BITS_STL_NUMERIC_H
+#define _CPP_BITS_STL_NUMERIC_H 1
+
+__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 __monoid_op)
+{
+ if (__n == 0)
+ return identity_element(__monoid_op);
+ else {
+ while ((__n & 1) == 0) {
+ __n >>= 1;
+ __x = __monoid_op(__x, __x);
+ }
+
+ _Tp __result = __x;
+ __n >>= 1;
+ while (__n != 0) {
+ __x = __monoid_op(__x, __x);
+ if ((__n & 1) != 0)
+ __result = __monoid_op(__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 __monoid_op)
+{
+ return __power(__x, __n, __monoid_op);
+}
+
+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 /* _CPP_BITS_STL_NUMERIC_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/stl_pair.h b/libstdc++-v3/bits/stl_pair.h
new file mode 100644
index 000000000000..a6155a698e1c
--- /dev/null
+++ b/libstdc++-v3/bits/stl_pair.h
@@ -0,0 +1,101 @@
+/*
+ *
+ * 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);
+}
+
+#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
+
+template <class _T1, class _T2>
+inline bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
+ return !(__x == __y);
+}
+
+template <class _T1, class _T2>
+inline bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
+ return __y < __x;
+}
+
+template <class _T1, class _T2>
+inline bool operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
+ return !(__y < __x);
+}
+
+template <class _T1, class _T2>
+inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
+ return !(__x < __y);
+}
+
+#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
+
+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/libstdc++-v3/bits/stl_pthread_alloc.h b/libstdc++-v3/bits/stl_pthread_alloc.h
new file mode 100644
index 000000000000..c1488b1ef6a2
--- /dev/null
+++ b/libstdc++-v3/bits/stl_pthread_alloc.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 1996-1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BITS_STL_PTHREAD_ALLOC_H
+#define _CPP_BITS_STL_PTHREAD_ALLOC_H 1
+
+#include <bits/pthread_allocimpl.h>
+
+#ifdef __STL_USE_NAMESPACES
+
+using __STD::_Pthread_alloc_template;
+using __STD::pthread_alloc;
+
+#endif /* __STL_USE_NAMESPACES */
+
+
+#endif /* _CPP_BITS_STL_PTHREAD_ALLOC_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/stl_queue.h b/libstdc++-v3/bits/stl_queue.h
new file mode 100644
index 000000000000..610ba3edbc5a
--- /dev/null
+++ b/libstdc++-v3/bits/stl_queue.h
@@ -0,0 +1,221 @@
+/*
+ *
+ * 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
+
+// Forward declarations of operators < and ==, needed for friend declaration.
+
+template <class _Tp,
+ class _Sequence = deque<_Tp> >
+class queue;
+
+template <class _Tp, class _Seq>
+inline bool operator==(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&);
+
+template <class _Tp, class _Seq>
+inline bool operator<(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&);
+
+
+template <class _Tp, class _Sequence>
+class queue {
+
+#ifdef __STL_MEMBER_TEMPLATES
+ template <class _Tp1, class _Seq1>
+ friend bool operator== (const queue<_Tp1, _Seq1>&,
+ const queue<_Tp1, _Seq1>&);
+ template <class _Tp1, class _Seq1>
+ friend bool operator< (const queue<_Tp1, _Seq1>&,
+ const queue<_Tp1, _Seq1>&);
+#else /* __STL_MEMBER_TEMPLATES */
+ friend bool __STD_QUALIFIER
+ operator== __STL_NULL_TMPL_ARGS (const queue&, const queue&);
+ friend bool __STD_QUALIFIER
+ operator< __STL_NULL_TMPL_ARGS (const queue&, const queue&);
+#endif /* __STL_MEMBER_TEMPLATES */
+
+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 */
+
+template <class _Tp,
+ class _Sequence = vector<_Tp>,
+ class _Compare = less<typename _Sequence::value_type> >
+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/libstdc++-v3/bits/stl_range_errors.h b/libstdc++-v3/bits/stl_range_errors.h
new file mode 100644
index 000000000000..c5ddfe63cbb8
--- /dev/null
+++ b/libstdc++-v3/bits/stl_range_errors.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 1999
+ * 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_RANGE_ERRORS_H
+#define __STL_RANGE_ERRORS_H
+
+// A few places in the STL throw range errors, using standard exception
+// classes defined in <stdexcept>. This header file provides functions
+// to throw those exception objects.
+
+// __STL_DONT_THROW_RANGE_ERRORS is a hook so that users can disable
+// this exception throwing.
+
+#include <bits/stl_config.h>
+
+#if defined(__STL_CAN_THROW_RANGE_ERRORS) && \
+ defined(__STL_USE_EXCEPTIONS) && \
+ !defined(__STL_DONT_THROW_RANGE_ERRORS)
+# define __STL_THROW_RANGE_ERRORS
+#endif
+
+// For the SGI 7.3 compiler, declare these functions here and define them
+// elsewhere.
+#if defined(__STL_THROW_RANGE_ERRORS) && \
+ defined(__sgi) && !defined(__GNUC__) && \
+ _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS) \
+ || defined(__GNUC__) && defined(__STL_THROW_RANGE_ERRORS)
+
+__STL_BEGIN_NAMESPACE
+void __stl_throw_range_error(const char* __msg);
+void __stl_throw_length_error(const char* __msg);
+__STL_END_NAMESPACE
+
+// For other compilers where we're throwing range errors, include the
+// stdexcept header and throw the appropriate exceptions directly.
+#elif defined(__STL_THROW_RANGE_ERRORS)
+
+#include <bits/std_stdexcept.h>
+
+__STL_BEGIN_NAMESPACE
+inline void __stl_throw_range_error(const char* __msg)
+ { throw range_error(__msg); }
+inline void __stl_throw_length_error(const char* __msg)
+ { throw length_error(__msg); }
+__STL_END_NAMESPACE
+
+// Otherwise, define inline functions that do nothing.
+#else
+
+__STL_BEGIN_NAMESPACE
+inline void __stl_throw_range_error(const char*) {}
+inline void __stl_throw_length_error(const char*) {}
+__STL_END_NAMESPACE
+
+#endif
+
+#endif /* __STL_RANGE_ERRORS_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
+
diff --git a/libstdc++-v3/bits/stl_raw_storage_iter.h b/libstdc++-v3/bits/stl_raw_storage_iter.h
new file mode 100644
index 000000000000..007acd032edb
--- /dev/null
+++ b/libstdc++-v3/bits/stl_raw_storage_iter.h
@@ -0,0 +1,81 @@
+/*
+ *
+ * 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 _CPP_BITS_STL_RAW_STORAGE_ITERATOR_H
+#define _CPP_BITS_STL_RAW_STORAGE_ITERATOR_H 1
+
+__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 /* _CPP_BITS_STL_RAW_STORAGE_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/stl_relops.h b/libstdc++-v3/bits/stl_relops.h
new file mode 100644
index 000000000000..f0cabdfd5444
--- /dev/null
+++ b/libstdc++-v3/bits/stl_relops.h
@@ -0,0 +1,62 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ * Copyright (c) 1996,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 _CPP_BITS_STL_RELOPS_H
+#define _CPP_BITS_STL_RELOPS_H 1
+
+__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 /* _CPP_BITS_STL_RELOPS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/stl_set.h b/libstdc++-v3/bits/stl_set.h
new file mode 100644
index 000000000000..b5d364362cba
--- /dev/null
+++ b/libstdc++-v3/bits/stl_set.h
@@ -0,0 +1,259 @@
+/*
+ *
+ * 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
+
+// Forward declarations of operators < and ==, needed for friend declaration.
+
+template <class _Key, class _Compare = less<_Key>,
+ class _Alloc = allocator<_Key> >
+class set;
+
+template <class _Key, class _Compare, class _Alloc>
+inline bool operator==(const set<_Key,_Compare,_Alloc>& __x,
+ const set<_Key,_Compare,_Alloc>& __y);
+
+template <class _Key, class _Compare, class _Alloc>
+inline bool operator<(const set<_Key,_Compare,_Alloc>& __x,
+ const set<_Key,_Compare,_Alloc>& __y);
+
+
+template <class _Key, class _Compare, class _Alloc>
+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);
+ }
+
+#ifdef __STL_MEMBER_TEMPLATES
+ template <class _K1, class _C1, class _A1>
+ friend bool operator== (const set<_K1,_C1,_A1>&, const set<_K1,_C1,_A1>&);
+ template <class _K1, class _C1, class _A1>
+ friend bool operator< (const set<_K1,_C1,_A1>&, const set<_K1,_C1,_A1>&);
+#else /* __STL_MEMBER_TEMPLATES */
+ friend bool __STD_QUALIFIER
+ operator== __STL_NULL_TMPL_ARGS (const set&, const set&);
+ friend bool __STD_QUALIFIER
+ operator< __STL_NULL_TMPL_ARGS (const set&, const set&);
+#endif /* __STL_MEMBER_TEMPLATES */
+};
+
+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 bool operator!=(const set<_Key,_Compare,_Alloc>& __x,
+ const set<_Key,_Compare,_Alloc>& __y) {
+ return !(__x == __y);
+}
+
+template <class _Key, class _Compare, class _Alloc>
+inline bool operator>(const set<_Key,_Compare,_Alloc>& __x,
+ const set<_Key,_Compare,_Alloc>& __y) {
+ return __y < __x;
+}
+
+template <class _Key, class _Compare, class _Alloc>
+inline bool operator<=(const set<_Key,_Compare,_Alloc>& __x,
+ const set<_Key,_Compare,_Alloc>& __y) {
+ return !(__y < __x);
+}
+
+template <class _Key, class _Compare, class _Alloc>
+inline bool operator>=(const set<_Key,_Compare,_Alloc>& __x,
+ const set<_Key,_Compare,_Alloc>& __y) {
+ return !(__x < __y);
+}
+
+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/libstdc++-v3/bits/stl_stack.h b/libstdc++-v3/bits/stl_stack.h
new file mode 100644
index 000000000000..bb9d851f4cfc
--- /dev/null
+++ b/libstdc++-v3/bits/stl_stack.h
@@ -0,0 +1,133 @@
+/*
+ *
+ * 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
+
+// Forward declarations of operators == and <, needed for friend declaration.
+
+template <class _Tp,
+ class _Sequence = deque<_Tp> >
+class stack;
+
+template <class _Tp, class _Seq>
+bool operator==(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y);
+
+template <class _Tp, class _Seq>
+bool operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y);
+
+
+template <class _Tp, class _Sequence>
+class stack {
+
+#ifdef __STL_MEMBER_TEMPLATES
+ template <class _Tp1, class _Seq1>
+ friend bool operator== (const stack<_Tp1, _Seq1>&,
+ const stack<_Tp1, _Seq1>&);
+ template <class _Tp1, class _Seq1>
+ friend bool operator< (const stack<_Tp1, _Seq1>&,
+ const stack<_Tp1, _Seq1>&);
+#else /* __STL_MEMBER_TEMPLATES */
+ friend bool __STD_QUALIFIER
+ operator== __STL_NULL_TMPL_ARGS (const stack&, const stack&);
+ friend bool __STD_QUALIFIER
+ operator< __STL_NULL_TMPL_ARGS (const stack&, const stack&);
+#endif /* __STL_MEMBER_TEMPLATES */
+
+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:
+ stack() : c() {}
+ explicit stack(const _Sequence& __s) : c(__s) {}
+
+ bool empty() const { return c.empty(); }
+ size_type size() const { return c.size(); }
+ reference top() { return c.back(); }
+ const_reference top() const { return c.back(); }
+ void push(const value_type& __x) { c.push_back(__x); }
+ void pop() { c.pop_back(); }
+};
+
+template <class _Tp, class _Seq>
+bool operator==(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
+{
+ return __x.c == __y.c;
+}
+
+template <class _Tp, class _Seq>
+bool operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
+{
+ return __x.c < __y.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/libstdc++-v3/bits/stl_string_fwd.h b/libstdc++-v3/bits/stl_string_fwd.h
new file mode 100644
index 000000000000..5097e618aa9d
--- /dev/null
+++ b/libstdc++-v3/bits/stl_string_fwd.h
@@ -0,0 +1,47 @@
+/*
+ * 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_STRING_FWD_H
+#define __SGI_STL_STRING_FWD_H
+
+#include <bits/stl_config.h>
+//#include <bits/std_cstddef.h>
+#include <bits/stl_alloc.h>
+
+__STL_BEGIN_NAMESPACE
+
+template <class _CharT> struct char_traits;
+template <class _CharT,
+ class _Traits = char_traits<_CharT>,
+ class _Alloc = allocator<_CharT> >
+class basic_string;
+
+typedef basic_string<char> string;
+#ifdef _GLIBCPP_USE_WCHAR_T
+typedef basic_string<wchar_t> wstring;
+#endif
+
+__STL_END_NAMESPACE
+
+#endif /* __SGI_STL_STRING_FWD_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/bits/stl_tempbuf.h b/libstdc++-v3/bits/stl_tempbuf.h
new file mode 100644
index 000000000000..cdc0dd27df0e
--- /dev/null
+++ b/libstdc++-v3/bits/stl_tempbuf.h
@@ -0,0 +1,161 @@
+/*
+ *
+ * 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) {
+ // Workaround for a __type_traits bug in the pre-7.3 compiler.
+# if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION < 730
+ typedef typename __type_traits<_Tp>::is_POD_type _Trivial;
+# else
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor
+ _Trivial;
+# endif
+
+ __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/libstdc++-v3/bits/stl_threads.h b/libstdc++-v3/bits/stl_threads.h
new file mode 100644
index 000000000000..8b6d08e2489e
--- /dev/null
+++ b/libstdc++-v3/bits/stl_threads.h
@@ -0,0 +1,369 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+// Stl_config.h should be included before this file.
+
+#ifndef __SGI_STL_INTERNAL_THREADS_H
+#define __SGI_STL_INTERNAL_THREADS_H
+
+// Supported threading models are native SGI, pthreads, uithreads
+// (similar to pthreads, but based on an earlier draft of the Posix
+// threads standard), and Win32 threads. Uithread support by Jochen
+// Schlick, 1999.
+
+#if defined(__STL_SGI_THREADS)
+#include <mutex.h>
+#include <time.h>
+#elif defined(__STL_PTHREADS)
+#include <pthread.h>
+#elif defined(__STL_UITHREADS)
+#include <thread.h>
+#include <synch.h>
+#elif defined(__STL_WIN32THREADS)
+#include <windows.h>
+#endif
+
+__STL_BEGIN_NAMESPACE
+
+
+// Class _Refcount_Base provides a type, _RC_t, a data member,
+// _M_ref_count, and member functions _M_incr and _M_decr, which perform
+// atomic preincrement/predecrement. The constructor initializes
+// _M_ref_count.
+
+// Hack for SGI o32 compilers.
+#if defined(__STL_SGI_THREADS) && !defined(__add_and_fetch) && \
+ (__mips < 3 || !(defined (_ABIN32) || defined(_ABI64)))
+# define __add_and_fetch(__l,__v) add_then_test((unsigned long*)__l,__v)
+# define __test_and_set(__l,__v) test_and_set(__l,__v)
+#endif /* o32 */
+
+struct _Refcount_Base
+{
+ // The type _RC_t
+# ifdef __STL_WIN32THREADS
+ typedef long _RC_t;
+# else
+ typedef size_t _RC_t;
+#endif
+
+ // The data member _M_ref_count
+ volatile _RC_t _M_ref_count;
+
+ // Constructor
+# ifdef __STL_PTHREADS
+ pthread_mutex_t _M_ref_count_lock;
+ _Refcount_Base(_RC_t __n) : _M_ref_count(__n)
+ { pthread_mutex_init(&_M_ref_count_lock, 0); }
+# elif defined(__STL_UITHREADS)
+ mutex_t _M_ref_count_lock;
+ _Refcount_Base(_RC_t __n) : _M_ref_count(__n)
+ { mutex_init(&_M_ref_count_lock, USYNC_THREAD, 0); }
+# else
+ _Refcount_Base(_RC_t __n) : _M_ref_count(__n) {}
+# endif
+
+ // _M_incr and _M_decr
+# ifdef __STL_SGI_THREADS
+ void _M_incr() { __add_and_fetch(&_M_ref_count, 1); }
+ _RC_t _M_decr() { return __add_and_fetch(&_M_ref_count, (size_t) -1); }
+# elif defined (__STL_WIN32THREADS)
+ void _M_incr() { InterlockedIncrement((_RC_t*)&_M_ref_count); }
+ _RC_t _M_decr() { return InterlockedDecrement((_RC_t*)&_M_ref_count); }
+# elif defined(__STL_PTHREADS)
+ void _M_incr() {
+ pthread_mutex_lock(&_M_ref_count_lock);
+ ++_M_ref_count;
+ pthread_mutex_unlock(&_M_ref_count_lock);
+ }
+ _RC_t _M_decr() {
+ pthread_mutex_lock(&_M_ref_count_lock);
+ volatile _RC_t __tmp = --_M_ref_count;
+ pthread_mutex_unlock(&_M_ref_count_lock);
+ return __tmp;
+ }
+# elif defined(__STL_UITHREADS)
+ void _M_incr() {
+ mutex_lock(&_M_ref_count_lock);
+ ++_M_ref_count;
+ mutex_unlock(&_M_ref_count_lock);
+ }
+ _RC_t _M_decr() {
+ mutex_lock(&_M_ref_count_lock);
+ /*volatile*/ _RC_t __tmp = --_M_ref_count;
+ mutex_unlock(&_M_ref_count_lock);
+ return __tmp;
+ }
+# else /* No threads */
+ void _M_incr() { ++_M_ref_count; }
+ _RC_t _M_decr() { return --_M_ref_count; }
+# endif
+};
+
+// Atomic swap on unsigned long
+// This is guaranteed to behave as though it were atomic only if all
+// possibly concurrent updates use _Atomic_swap.
+// In some cases the operation is emulated with a lock.
+# ifdef __STL_SGI_THREADS
+ inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) {
+# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64))
+ return test_and_set(__p, __q);
+# else
+ return __test_and_set(__p, (unsigned long)__q);
+# endif
+ }
+# elif defined(__STL_WIN32THREADS)
+ inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) {
+ return (unsigned long) InterlockedExchange((LPLONG)__p, (LONG)__q);
+ }
+# elif defined(__STL_PTHREADS)
+ // We use a template here only to get a unique initialized instance.
+ template<int __dummy>
+ struct _Swap_lock_struct {
+ static pthread_mutex_t _S_swap_lock;
+ };
+
+ template<int __dummy>
+ pthread_mutex_t
+ _Swap_lock_struct<__dummy>::_S_swap_lock = PTHREAD_MUTEX_INITIALIZER;
+
+ // This should be portable, but performance is expected
+ // to be quite awful. This really needs platform specific
+ // code.
+ inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) {
+ pthread_mutex_lock(&_Swap_lock_struct<0>::_S_swap_lock);
+ unsigned long __result = *__p;
+ *__p = __q;
+ pthread_mutex_unlock(&_Swap_lock_struct<0>::_S_swap_lock);
+ return __result;
+ }
+# elif defined(__STL_UITHREADS)
+ // We use a template here only to get a unique initialized instance.
+ template<int __dummy>
+ struct _Swap_lock_struct {
+ static mutex_t _S_swap_lock;
+ };
+
+ template<int __dummy>
+ mutex_t
+ _Swap_lock_struct<__dummy>::_S_swap_lock = DEFAULTMUTEX;
+
+ // This should be portable, but performance is expected
+ // to be quite awful. This really needs platform specific
+ // code.
+ inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) {
+ mutex_lock(&_Swap_lock_struct<0>::_S_swap_lock);
+ unsigned long __result = *__p;
+ *__p = __q;
+ mutex_unlock(&_Swap_lock_struct<0>::_S_swap_lock);
+ return __result;
+ }
+# elif defined (__STL_SOLARIS_THREADS)
+ // any better solutions ?
+ // We use a template here only to get a unique initialized instance.
+ template<int __dummy>
+ struct _Swap_lock_struct {
+ static mutex_t _S_swap_lock;
+ };
+
+# if ( __STL_STATIC_TEMPLATE_DATA > 0 )
+ template<int __dummy>
+ mutex_t
+ _Swap_lock_struct<__dummy>::_S_swap_lock = DEFAULTMUTEX;
+# else
+ __DECLARE_INSTANCE(mutex_t, _Swap_lock_struct<__dummy>::_S_swap_lock,
+ =DEFAULTMUTEX);
+# endif /* ( __STL_STATIC_TEMPLATE_DATA > 0 ) */
+
+ // This should be portable, but performance is expected
+ // to be quite awful. This really needs platform specific
+ // code.
+ inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) {
+ mutex_lock(&_Swap_lock_struct<0>::_S_swap_lock);
+ unsigned long __result = *__p;
+ *__p = __q;
+ mutex_unlock(&_Swap_lock_struct<0>::_S_swap_lock);
+ return __result;
+ }
+# else
+ static inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) {
+ unsigned long __result = *__p;
+ *__p = __q;
+ return __result;
+ }
+# endif
+
+// Locking class. Note that this class *does not have a constructor*.
+// It must be initialized either statically, with __STL_MUTEX_INITIALIZER,
+// or dynamically, by explicitly calling the _M_initialize member function.
+// (This is similar to the ways that a pthreads mutex can be initialized.)
+// There are explicit member functions for acquiring and releasing the lock.
+
+// There is no constructor because static initialization is essential for
+// some uses, and only a class aggregate (see section 8.5.1 of the C++
+// standard) can be initialized that way. That means we must have no
+// constructors, no base classes, no virtual functions, and no private or
+// protected members.
+
+struct _STL_mutex_lock
+{
+#if defined(__STL_SGI_THREADS) || defined(__STL_WIN32THREADS)
+ // It should be relatively easy to get this to work on any modern Unix.
+ volatile unsigned long _M_lock;
+ void _M_initialize() { _M_lock = 0; }
+ static void _S_nsec_sleep(int __log_nsec) {
+# ifdef __STL_SGI_THREADS
+ struct timespec __ts;
+ /* Max sleep is 2**27nsec ~ 60msec */
+ __ts.tv_sec = 0;
+ __ts.tv_nsec = 1 << __log_nsec;
+ nanosleep(&__ts, 0);
+# elif defined(__STL_WIN32THREADS)
+ if (__log_nsec <= 20) {
+ Sleep(0);
+ } else {
+ Sleep(1 << (__log_nsec - 20));
+ }
+# else
+# error unimplemented
+# endif
+ }
+ void _M_acquire_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;
+ volatile unsigned __junk;
+ int __i;
+ volatile unsigned long* __lock = &this->_M_lock;
+
+ if (!_Atomic_swap((unsigned long*)__lock, 1)) {
+ return;
+ }
+ __my_spin_max = __spin_max;
+ __my_last_spins = __last_spins;
+ __junk = 17; // Value doesn't matter.
+ for (__i = 0; __i < __my_spin_max; __i++) {
+ if (__i < __my_last_spins/2 || *__lock) {
+ __junk *= __junk; __junk *= __junk;
+ __junk *= __junk; __junk *= __junk;
+ continue;
+ }
+ if (!_Atomic_swap((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) {
+ int __log_nsec = __i + 6;
+
+ if (__log_nsec > 27) __log_nsec = 27;
+ if (!_Atomic_swap((unsigned long *)__lock, 1)) {
+ return;
+ }
+ _S_nsec_sleep(__log_nsec);
+ }
+ }
+ void _M_release_lock() {
+ volatile unsigned long* __lock = &_M_lock;
+# if defined(__STL_SGI_THREADS) && defined(__GNUC__) && __mips >= 3
+ asm("sync");
+ *__lock = 0;
+# elif defined(__STL_SGI_THREADS) && __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
+ }
+
+// We no longer use win32 critical sections.
+// They appear to be slower in the contention-free case,
+// and they appear difficult to initialize without introducing a race.
+
+#elif defined(__STL_PTHREADS)
+ pthread_mutex_t _M_lock;
+ void _M_initialize() { pthread_mutex_init(&_M_lock, NULL); }
+ void _M_acquire_lock() { pthread_mutex_lock(&_M_lock); }
+ void _M_release_lock() { pthread_mutex_unlock(&_M_lock); }
+#elif defined(__STL_UITHREADS)
+ mutex_t _M_lock;
+ void _M_initialize() { mutex_init(&_M_lock, USYNC_THREAD, 0); }
+ void _M_acquire_lock() { mutex_lock(&_M_lock); }
+ void _M_release_lock() { mutex_unlock(&_M_lock); }
+#else /* No threads */
+ void _M_initialize() {}
+ void _M_acquire_lock() {}
+ void _M_release_lock() {}
+#endif
+};
+
+#ifdef __STL_PTHREADS
+// Pthreads locks must be statically initialized to something other than
+// the default value of zero.
+# define __STL_MUTEX_INITIALIZER = { PTHREAD_MUTEX_INITIALIZER }
+#elif defined(__STL_UITHREADS)
+// UIthreads locks must be statically initialized to something other than
+// the default value of zero.
+# define __STL_MUTEX_INITIALIZER = { DEFAULTMUTEX }
+#elif defined(__STL_SGI_THREADS) || defined(__STL_WIN32THREADS)
+# define __STL_MUTEX_INITIALIZER = { 0 }
+#else
+# define __STL_MUTEX_INITIALIZER
+#endif
+
+
+// A locking class that uses _STL_mutex_lock. The constructor takes a
+// reference to an _STL_mutex_lock, and acquires a lock. The
+// destructor releases the lock. It's not clear that this is exactly
+// the right functionality. It will probably change in the future.
+
+struct _STL_auto_lock
+{
+ _STL_mutex_lock& _M_lock;
+
+ _STL_auto_lock(_STL_mutex_lock& __lock) : _M_lock(__lock)
+ { _M_lock._M_acquire_lock(); }
+ ~_STL_auto_lock() { _M_lock._M_release_lock(); }
+
+private:
+ void operator=(const _STL_auto_lock&);
+ _STL_auto_lock(const _STL_auto_lock&);
+};
+
+__STL_END_NAMESPACE
+
+#endif /* __SGI_STL_INTERNAL_THREADS_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
+
+
+
+
diff --git a/libstdc++-v3/bits/stl_tree.h b/libstdc++-v3/bits/stl_tree.h
new file mode 100644
index 000000000000..dd1fa407bc81
--- /dev/null
+++ b/libstdc++-v3/bits/stl_tree.h
@@ -0,0 +1,1368 @@
+/*
+ *
+ * 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 <bits/stl_algobase.h>
+#include <bits/stl_alloc.h>
+#include <bits/stl_construct.h>
+#include <bits/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 = 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 bool
+operator!=(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x,
+ const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __y) {
+ return !(__x == __y);
+}
+
+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 __y < __x;
+}
+
+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 !(__y < __x);
+}
+
+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 < __y);
+}
+
+
+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(_S_key(__position._M_node), _KeyOfValue()(__v)))
+ 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(_S_key(__position._M_node), _KeyOfValue()(__v)))
+ 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;
+ int __sum = 0;
+ do {
+ if (__node->_M_color == _S_rb_tree_black)
+ ++__sum;
+ if (__node == __root)
+ break;
+ __node = __node->_M_parent;
+ } while (1);
+ return __sum;
+}
+
+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 = 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/libstdc++-v3/bits/stl_uninitialized.h b/libstdc++-v3/bits/stl_uninitialized.h
new file mode 100644
index 000000000000..087424ad4c34
--- /dev/null
+++ b/libstdc++-v3/bits/stl_uninitialized.h
@@ -0,0 +1,281 @@
+/*
+ *
+ * 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 _CPP_BITS_STL_UNINITIALIZED_H
+#define _CPP_BITS_STL_UNINITIALIZED_H 1
+
+#include <bits/std_cstring.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 /* _CPP_BITS_STL_UNINITIALIZED_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/stl_vector.h b/libstdc++-v3/bits/stl_vector.h
new file mode 100644
index 000000000000..3d2994cc7d3b
--- /dev/null
+++ b/libstdc++-v3/bits/stl_vector.h
@@ -0,0 +1,873 @@
+/*
+ *
+ * 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
+
+#include <bits/exception_support.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 = allocator<_Tp> >
+class vector : protected _Vector_base<_Tp, _Alloc>
+{
+private:
+ typedef _Vector_base<_Tp, _Alloc> _Base;
+ typedef vector<_Tp, _Alloc> vector_type;
+public:
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef __normal_iterator<pointer, vector_type> iterator;
+ typedef __normal_iterator<const_pointer, vector_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 iterator (_M_start); }
+ const_iterator begin() const
+ { return const_iterator (_M_start); }
+ iterator end() { return iterator (_M_finish); }
+ const_iterator end() const { return const_iterator (_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(const_iterator(_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); }
+
+#ifdef __STL_THROW_RANGE_ERRORS
+ void _M_range_check(size_type __n) const {
+ if (__n >= this->size())
+ __out_of_range("vector");
+ }
+
+ reference at(size_type __n)
+ { _M_range_check(__n); return (*this)[__n]; }
+ const_reference at(size_type __n) const
+ { _M_range_check(__n); return (*this)[__n]; }
+#endif /* __STL_THROW_RANGE_ERRORS */
+
+ 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();
+ pointer __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) { _M_fill_assign(__n, __val); }
+ void _M_fill_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)
+ { _M_fill_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(iterator(__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(iterator(__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)
+ { _M_fill_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)
+ { _M_fill_insert(__pos, __n, __x); }
+
+ void _M_fill_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, end(), __position);
+ --_M_finish;
+ destroy(_M_finish);
+ return __position;
+ }
+ iterator erase(iterator __first, iterator __last) {
+ iterator __i(copy(__last, end(), __first));
+ destroy(__i, end());
+ _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>
+ pointer _M_allocate_and_copy(size_type __n, _ForwardIterator __first,
+ _ForwardIterator __last)
+{
+ pointer __result = _M_allocate(__n);
+ __STL_TRY {
+ uninitialized_copy(__first, __last, __result);
+ return __result;
+ }
+ __STL_UNWIND(_M_deallocate(__result, __n));
+ }
+#else /* __STL_MEMBER_TEMPLATES */
+ pointer _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);
+}
+
+template <class _Tp, class _Alloc>
+inline bool
+operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) {
+ return !(__x == __y);
+}
+
+template <class _Tp, class _Alloc>
+inline bool
+operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) {
+ return __y < __x;
+}
+
+template <class _Tp, class _Alloc>
+inline bool
+operator<=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) {
+ return !(__y < __x);
+}
+
+template <class _Tp, class _Alloc>
+inline bool
+operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) {
+ return !(__x < __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()) {
+ pointer __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, end());
+ }
+ 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>::_M_fill_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()) {
+ pointer __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, end());
+ _M_finish = __new_finish.base();
+ }
+ 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, iterator(_M_finish - 2), iterator(_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(iterator(_M_start), __position,
+ __new_start);
+ construct(__new_finish.base(), __x);
+ ++__new_finish;
+ __new_finish = uninitialized_copy(__position, iterator(_M_finish),
+ __new_finish);
+ }
+ __STL_UNWIND((destroy(__new_start,__new_finish),
+ _M_deallocate(__new_start.base(),__len)));
+ destroy(begin(), end());
+ _M_deallocate(_M_start, _M_end_of_storage - _M_start);
+ _M_start = __new_start.base();
+ _M_finish = __new_finish.base();
+ _M_end_of_storage = __new_start.base() + __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, iterator(_M_finish - 2),
+ iterator(_M_finish - 1));
+ *__position = _Tp();
+ }
+ else {
+ const size_type __old_size = size();
+ const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
+ pointer __new_start = _M_allocate(__len);
+ pointer __new_finish = __new_start;
+ __STL_TRY {
+ __new_finish = uninitialized_copy(iterator(_M_start), __position,
+ __new_start);
+ construct(__new_finish);
+ ++__new_finish;
+ __new_finish = uninitialized_copy(__position, iterator(_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_fill_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 = end() - __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(begin(), __position, __new_start);
+ __new_finish = uninitialized_fill_n(__new_finish, __n, __x);
+ __new_finish
+ = uninitialized_copy(__position, end(), __new_finish);
+ }
+ __STL_UNWIND((destroy(__new_start,__new_finish),
+ _M_deallocate(__new_start.base(),__len)));
+ destroy(_M_start, _M_finish);
+ _M_deallocate(_M_start, _M_end_of_storage - _M_start);
+ _M_start = __new_start.base();
+ _M_finish = __new_finish.base();
+ _M_end_of_storage = __new_start.base() + __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 = end() - __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(iterator(_M_start),
+ __position, __new_start);
+ __new_finish = uninitialized_copy(__first, __last, __new_finish);
+ __new_finish
+ = uninitialized_copy(__position, iterator(_M_finish), __new_finish);
+ }
+ __STL_UNWIND((destroy(__new_start,__new_finish),
+ _M_deallocate(__new_start.base(),__len)));
+ destroy(_M_start, _M_finish);
+ _M_deallocate(_M_start, _M_end_of_storage - _M_start);
+ _M_start = __new_start.base();
+ _M_finish = __new_finish.base();
+ _M_end_of_storage = __new_start.base() + __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/libstdc++-v3/bits/streambuf.tcc b/libstdc++-v3/bits/streambuf.tcc
new file mode 100644
index 000000000000..f956ab267200
--- /dev/null
+++ b/libstdc++-v3/bits/streambuf.tcc
@@ -0,0 +1,259 @@
+// Stream buffer classes -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.5 Stream buffers
+//
+
+#ifndef _CPP_BITS_STREAMBUF_TCC
+#define _CPP_BITS_STREAMBUF_TCC 1
+
+namespace std {
+
+ template<typename _CharT, typename _Traits>
+ basic_streambuf<_CharT, _Traits>::int_type
+ basic_streambuf<_CharT, _Traits>::
+ sbumpc()
+ {
+ int_type __retval;
+ if (_M_in_cur && _M_in_cur < _M_in_end)
+ {
+ char_type __c = *gptr();
+ ++_M_in_cur;
+ if (_M_buf_unified && _M_mode & ios_base::out)
+ ++_M_out_cur;
+ __retval = traits_type::to_int_type(__c);
+ }
+ else
+ __retval = this->uflow();
+ return __retval;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_streambuf<_CharT, _Traits>::int_type
+ basic_streambuf<_CharT, _Traits>::
+ sputbackc(char_type __c)
+ {
+ int_type __retval;
+ bool __testpos = _M_in_cur && _M_in_beg < _M_in_cur;
+ bool __testne = _M_in_cur && !traits_type::eq(__c, this->gptr()[-1]);
+ if (!__testpos || __testne)
+ __retval = pbackfail(traits_type::to_int_type(__c));
+ else
+ {
+ --_M_in_cur;
+ if (_M_buf_unified && _M_mode & ios_base::out)
+ --_M_out_cur;
+ __retval = traits_type::to_int_type(*this->gptr());
+ }
+ return __retval;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_streambuf<_CharT, _Traits>::int_type
+ basic_streambuf<_CharT, _Traits>::
+ sungetc()
+ {
+ int_type __retval;
+ if (_M_in_cur && _M_in_beg < _M_in_cur)
+ {
+ --_M_in_cur;
+ if (_M_buf_unified && _M_mode & ios_base::out)
+ --_M_out_cur;
+ __retval = traits_type::to_int_type(*_M_in_cur);
+ }
+ else
+ __retval = this->pbackfail();
+ return __retval;
+ }
+
+ // Don't test against _M_buf + _M_buf_size, because _M_buf reflects
+ // allocated space, and on certain (rare but entirely legal)
+ // situations, there will be no allocated space yet the internal
+ // buffers will still be valid. (This happens if setp is used to set
+ // the internal buffer to say some externally-allocated sequence.)
+ template<typename _CharT, typename _Traits>
+ basic_streambuf<_CharT, _Traits>::int_type
+ basic_streambuf<_CharT, _Traits>::
+ sputc(char_type __c)
+ {
+ int_type __retval;
+
+ if (_M_out_cur && _M_out_cur < _M_out_beg + _M_buf_size)
+ {
+ *_M_out_cur = __c;
+ _M_buf_bump(1);
+ __retval = traits_type::to_int_type(__c);
+ }
+ else
+ __retval = this->overflow(traits_type::to_int_type(__c));
+ return __retval;
+ }
+
+ template<typename _CharT, typename _Traits>
+ streamsize
+ basic_streambuf<_CharT, _Traits>::
+ xsgetn(char_type* __s, streamsize __n)
+ {
+ bool __testout = _M_mode & ios_base::out;
+ streamsize __retval = 0;
+
+ if (__n)
+ {
+ while (__retval < __n)
+ {
+ bool __testget = _M_in_cur < _M_in_end;
+ if (__testget)
+ {
+ size_t __len;
+ if (_M_in_cur + __n - __retval <= _M_in_end)
+ __len = __n - __retval;
+ else
+ __len = _M_in_end - _M_in_cur;
+ traits_type::copy(__s, _M_in_cur, __len);
+ __retval += __len;
+ __s += __len;
+ _M_in_cur += __len;
+ if (_M_buf_unified && __testout)
+ _M_out_cur += __len;
+ }
+
+ if (__retval != __n)
+ {
+ if (this->uflow() != traits_type::eof())
+ ++__retval;
+ else
+ break;
+ }
+ }
+ }
+ return __retval;
+ }
+
+ // Don't test against _M_buf + _M_buf_size, because _M_buf reflects
+ // allocated space, and on certain (rare but entirely legal)
+ // situations, there will be no allocated space yet the internal
+ // buffers will still be valid. (This happens if setp is used to set
+ // the internal buffer to say some externally-allocated sequence.)
+ template<typename _CharT, typename _Traits>
+ streamsize
+ basic_streambuf<_CharT, _Traits>::
+ xsputn(const char_type* __s, streamsize __n)
+ {
+ streamsize __retval = 0;
+
+ if (__n)
+ {
+ while (__retval < __n)
+ {
+ bool __testput = _M_out_cur < _M_out_beg + _M_buf_size;
+ bool __testout = _M_mode & ios_base::out;
+ if (!(__testput && __testout))
+ {
+ char_type __c = *__s;
+ char_type __overfc = this->overflow(__c);
+ if (__c == __overfc)
+ {
+ ++__retval;
+ ++__s;
+ }
+ else
+ break;
+ }
+
+ if (__retval != __n)
+ {
+ size_t __len;
+ if (_M_out_cur + __n - __retval <= _M_out_beg + _M_buf_size)
+ __len = __n - __retval;
+ else
+ __len = _M_out_beg + _M_buf_size - _M_out_cur;
+ traits_type::copy(_M_out_cur, __s, __len);
+ __retval += __len;
+ __s += __len;
+ _M_buf_bump(__len);
+ }
+ }
+ }
+ return __retval;
+ }
+
+
+ // Conceivably, this could be used to implement buffer-to-buffer
+ // copies, if this was ever desired in an un-ambiguous way by the
+ // standard. If so, then checks for __ios being zero would be
+ // necessary.
+ template<typename _CharT, typename _Traits>
+ static streamsize
+ _S_copy_streambufs(basic_ios<_CharT, _Traits>& __ios,
+ basic_streambuf<_CharT, _Traits>* __sbin,
+ basic_streambuf<_CharT, _Traits>* __sbout)
+ {
+ typedef typename _Traits::int_type int_type;
+
+ streamsize __retval = 0;
+ streamsize __bufsize = __sbin->in_avail();
+ streamsize __xtrct;
+ bool __testout = __sbin->_M_mode & ios_base::out;
+ bool __testput = __sbout->_M_mode & ios_base::out;
+ try {
+ while (__testput && __bufsize != -1)
+ {
+ __xtrct = __sbout->sputn(__sbin->gptr(), __bufsize);
+ __retval += __xtrct;
+ __sbin->_M_in_cur += __xtrct;
+ if (__testout && __sbin->_M_buf_unified)
+ __sbin->_M_out_cur += __xtrct;
+ if (__xtrct == __bufsize)
+ {
+ int_type __c = __sbin->sgetc();
+ if (__c == _Traits::eof())
+ {
+ __ios.setstate(ios_base::eofbit);
+ break;
+ }
+ }
+ else
+ break;
+ }
+ }
+ catch(exception& __fail) {
+ if ((__ios.exceptions() & ios_base::failbit) != 0)
+ throw;
+ }
+ return __retval;
+ }
+
+} // namespace std
+
+#endif // _CPP_BITS_STREAMBUF_TCC
+
+
+
+
diff --git a/libstdc++-v3/bits/string.tcc b/libstdc++-v3/bits/string.tcc
new file mode 100644
index 000000000000..7ad2b5d0e8fd
--- /dev/null
+++ b/libstdc++-v3/bits/string.tcc
@@ -0,0 +1,858 @@
+// Components for manipulating sequences of characters -*- C++ -*-
+
+// Copyright (C) 2000, 1999, 1998, 1997 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 21 Strings library
+//
+
+// This file is included by <string>. It is not meant to be included
+// separately.
+
+// Written by Jason Merrill based upon the specification by Takanori Adachi
+// in ANSI X3J16/94-0013R2. Rewritten by Nathan Myers to ISO-14882.
+
+#ifndef _CPP_BITS_STRING_TCC
+#define _CPP_BITS_STRING_TCC 1
+
+namespace std
+{
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ _CharT
+ basic_string<_CharT, _Traits, _Alloc>::
+ _Rep::_S_terminal = _CharT();
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ _Rep::_S_max_size = (((npos - sizeof(_Rep))/sizeof(_CharT)) - 1) / 4;
+
+ // NB: This is the special case for Input Iterators, used in
+ // istreambuf_iterators, etc.
+ // Input Iterators have a cost structure very different from
+ // pointers, calling for a different coding style.
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ template<typename _InIter>
+ _CharT*
+ basic_string<_CharT, _Traits, _Alloc>::
+ _S_construct(_InIter __beg, _InIter __end, const _Alloc& __a,
+ input_iterator_tag)
+ {
+ if (__beg == __end && __a == _Alloc())
+ return _S_empty_rep()._M_refcopy();
+ // Avoid reallocation for common case.
+ _CharT __buf[100];
+ size_type __i = 0;
+ while (__beg != __end && __i < sizeof(__buf) / sizeof(_CharT))
+ {
+ __buf[__i++] = *__beg;
+ ++__beg;
+ }
+ _Rep* __r = _Rep::_S_create(__i, __a);
+ traits_type::copy(__r->_M_refdata(), __buf, __i);
+ __r->_M_length = __i;
+ try {
+ // NB: this loop looks precisely this way because
+ // it avoids comparing __beg != __end any more
+ // than strictly necessary; != might be expensive!
+ for (;;)
+ {
+ _CharT* __p = __r->_M_refdata() + __r->_M_length;
+ _CharT* __last = __r->_M_refdata() + __r->_M_capacity;
+ for (;;)
+ {
+ if (__beg == __end)
+ {
+ __r->_M_length = __p - __r->_M_refdata();
+ *__p = _Rep::_S_terminal; // grrr.
+ return __r->_M_refdata();
+ }
+ if (__p == __last)
+ break;
+ *__p++ = *__beg;
+ ++__beg;
+ }
+ // Allocate more space.
+ size_type __len = __p - __r->_M_refdata();
+ _Rep* __another = _Rep::_S_create(__len + 1, __a);
+ traits_type::copy(__another->_M_refdata(),
+ __r->_M_refdata(), __len);
+ __r->_M_destroy(__a);
+ __r = __another;
+ __r->_M_length = __len;
+ }
+ }
+ catch (...) {
+ __r->_M_destroy(__a);
+ throw;
+ }
+ return 0;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ template <class _InIter>
+ _CharT*
+ basic_string<_CharT,_Traits,_Alloc>::
+ _S_construct(_InIter __beg, _InIter __end, const _Alloc& __a,
+ forward_iterator_tag)
+ {
+ size_type __dnew = static_cast<size_type>(distance(__beg, __end));
+
+ if (__beg == __end && __a == _Alloc())
+ return _S_empty_rep()._M_refcopy();
+
+ // Check for out_of_range and length_error exceptions.
+ _Rep* __r = _Rep::_S_create(__dnew, __a);
+ try {
+ _S_copy_chars(__r->_M_refdata(), __beg, __end);
+ }
+ catch (...) {
+ __r->_M_destroy(__a);
+ throw;
+ }
+ __r->_M_length = __dnew;
+
+ __r->_M_refdata()[__dnew] = _Rep::_S_terminal; // grrr.
+ return __r->_M_refdata();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ _CharT*
+ basic_string<_CharT,_Traits, _Alloc>::
+ _S_construct(size_type __n, _CharT __c, const _Alloc& __a)
+ {
+ if (__n == 0 && __a == _Alloc())
+ return _S_empty_rep()._M_refcopy();
+
+ // Check for out_of_range and length_error exceptions.
+ _Rep* __r = _Rep::_S_create(__n, __a);
+ try {
+ if (__n)
+ traits_type::assign(__r->_M_refdata(), __n, __c);
+ }
+ catch (...) {
+ __r->_M_destroy(__a);
+ throw;
+ }
+ __r->_M_length = __n;
+ __r->_M_refdata()[__n] = _Rep::_S_terminal; // grrr
+ return __r->_M_refdata();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(const basic_string& __str)
+ : _M_dataplus(__str._M_rep()->_M_grab(_Alloc(), __str.get_allocator()),
+ __str.get_allocator())
+ { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(const _Alloc& __a)
+ : _M_dataplus(_S_construct(size_type(), _CharT(), __a), __a)
+ { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(const basic_string& __str, size_type __pos, size_type __n)
+ : _M_dataplus(_S_construct(__str._M_check(__pos),
+ __str._M_fold(__pos, __n), _Alloc()), _Alloc())
+ { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(const basic_string& __str, size_type __pos,
+ size_type __n, const _Alloc& __a)
+ : _M_dataplus(_S_construct(__str._M_check(__pos),
+ __str._M_fold(__pos, __n), __a), __a)
+ { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(const _CharT* __s, size_type __n, const _Alloc& __a)
+ : _M_dataplus(_S_construct(__s, __s + __n, __a), __a)
+ { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(const _CharT* __s, const _Alloc& __a)
+ : _M_dataplus(_S_construct(__s, __s + traits_type::length(__s), __a), __a)
+ { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(size_type __n, _CharT __c, const _Alloc& __a)
+ : _M_dataplus(_S_construct(__n, __c, __a), __a)
+ { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ template<typename _InputIter>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(_InputIter __beg, _InputIter __end, const _Alloc& __a)
+ : _M_dataplus(_S_construct(__beg, __end, __a), __a)
+ { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::assign(const basic_string& __str)
+ {
+ if (_M_rep() != __str._M_rep())
+ {
+ // XXX MT
+ allocator_type __a = this->get_allocator();
+ _CharT* __tmp = __str._M_rep()->_M_grab(__a, __str.get_allocator());
+ _M_rep()->_M_dispose(__a);
+ _M_data(__tmp);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ basic_string<_CharT, _Traits, _Alloc>::_Rep::
+ _M_destroy(const _Alloc& __a) throw ()
+ {
+ size_type __size = sizeof(_Rep) + (_M_capacity + 1) * sizeof(_CharT);
+ _Raw_bytes_alloc(__a).deallocate(reinterpret_cast<char*>(this), __size);
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ basic_string<_CharT, _Traits, _Alloc>::_M_leak_hard()
+ {
+ if (_M_rep()->_M_is_shared())
+ _M_mutate(0, 0, 0);
+ _M_rep()->_M_set_leaked();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ basic_string<_CharT, _Traits, _Alloc>::
+ _M_mutate(size_type __pos, size_type __len1, size_type __len2)
+ {
+ size_type __old_size = this->size();
+ const size_type __new_size = __old_size + __len2 - __len1;
+ const _CharT* __src = _M_data() + __pos + __len1;
+ const size_type __how_much = __old_size - __pos - __len1;
+
+ if (_M_rep()->_M_is_shared() || __new_size > capacity())
+ {
+ // Must reallocate.
+ allocator_type __a = get_allocator();
+ _Rep* __r = _Rep::_S_create(__new_size, __a);
+ try {
+ if (__pos)
+ traits_type::copy(__r->_M_refdata(), _M_data(), __pos);
+ if (__how_much)
+ traits_type::copy(__r->_M_refdata() + __pos + __len2,
+ __src, __how_much);
+ }
+ catch (...) {
+ __r->_M_dispose(get_allocator());
+ throw;
+ }
+ _M_rep()->_M_dispose(__a);
+ _M_data(__r->_M_refdata());
+ }
+ else if (__how_much)
+ {
+ // Work in-place
+ traits_type::move(_M_data() + __pos + __len2, __src, __how_much);
+ }
+ _M_rep()->_M_set_sharable();
+ _M_rep()->_M_length = __new_size;
+ _M_data()[__new_size] = _Rep::_S_terminal; // grrr. (per 21.3.4)
+ // You cannot leave those LWG people alone for a second.
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ basic_string<_CharT, _Traits, _Alloc>::reserve(size_type __res)
+ {
+ if (__res > this->capacity() || _M_rep()->_M_is_shared())
+ {
+ __LENGTHERROR(__res > this->max_size());
+ allocator_type __a = get_allocator();
+ _CharT* __tmp = _M_rep()->_M_clone(__a, __res - this->size());
+ _M_rep()->_M_dispose(__a);
+ _M_data(__tmp);
+ }
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void basic_string<_CharT, _Traits, _Alloc>::swap(basic_string& __s)
+ {
+ if (_M_rep()->_M_is_leaked())
+ _M_rep()->_M_set_sharable();
+ if (__s._M_rep()->_M_is_leaked())
+ __s._M_rep()->_M_set_sharable();
+ if (this->get_allocator() == __s.get_allocator())
+ {
+ _CharT* __tmp = _M_data();
+ _M_data(__s._M_data());
+ __s._M_data(__tmp);
+ }
+ // The code below can usually be optimized away.
+ else
+ {
+ basic_string __tmp1(_M_ibegin(), _M_iend(), __s.get_allocator());
+ basic_string __tmp2(__s._M_ibegin(), __s._M_iend(),
+ this->get_allocator());
+ *this = __tmp2;
+ __s = __tmp1;
+ }
+ }
+
+#ifdef _GLIBCPP_ALLOC_CONTROL
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ bool (*basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_excess_slop)
+ (size_t, size_t) =
+ basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_default_excess;
+#endif
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::_Rep*
+ basic_string<_CharT, _Traits, _Alloc>::_Rep::
+ _S_create(size_t __capacity, const _Alloc& __alloc)
+ {
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ // 83. String::npos vs. string::max_size()
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ __LENGTHERROR(__capacity > _S_max_size);
+#else
+ __LENGTHERROR(__capacity == npos);
+#endif
+
+ // NB: Need an array of char_type[__capacity], plus a
+ // terminating null char_type() element, plus enough for the
+ // _Rep data structure. Whew. Seemingly so needy, yet so elemental.
+ size_t __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep);
+ // NB: Might throw, but no worries about a leak, mate: _Rep()
+ // does not throw.
+ void* __place = _Raw_bytes_alloc(__alloc).allocate(__size);
+ _Rep *__p = new (__place) _Rep;
+ __p->_M_capacity = __capacity;
+ __p->_M_set_sharable(); // one reference
+ __p->_M_length = 0;
+ return __p;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ _CharT*
+ basic_string<_CharT, _Traits, _Alloc>::_Rep::
+ _M_clone(const _Alloc& __alloc, size_type __res)
+ {
+ _Rep* __r = _Rep::_S_create(_M_length + __res, __alloc);
+ if (_M_length)
+ {
+ try {
+ traits_type::copy(__r->_M_refdata(), _M_refdata(), _M_length);
+ }
+ catch (...) {
+ __r->_M_destroy(__alloc);
+ throw;
+ }
+ }
+ __r->_M_length = _M_length;
+ return __r->_M_refdata();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+#ifdef _GLIBCPP_ALLOC_CONTROL
+ basic_string<_CharT, _Traits, _Alloc>::_Rep::
+ _S_default_excess(size_t __s, size_t __r)
+#else
+ basic_string<_CharT, _Traits, _Alloc>::_Rep::
+ _S_excess_slop(size_t __s, size_t __r)
+#endif
+ {
+ return 2 * (__s <= 16 ? 16 : __s) < __r;
+ }
+
+ // Linker sets _S_empty_rep_storage to all 0s (one reference, empty string)
+ // at static init time (before static ctors are run).
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename _Alloc::size_type
+ basic_string<_CharT, _Traits, _Alloc>::_S_empty_rep_storage[
+ (sizeof(_Rep) + sizeof(_CharT) + sizeof(size_type) - 1)/sizeof(size_type)];
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ basic_string<_CharT, _Traits, _Alloc>::resize(size_type __n, _CharT __c)
+ {
+ __LENGTHERROR(__n > max_size());
+ size_type __size = this->size();
+ if (__size < __n)
+ this->append(__n - __size, __c);
+ else if (__n < __size)
+ this->erase(__n);
+ // else nothing (in particular, avoid calling _M_mutate() unnecessarily.)
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ template<typename _InputIter>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::
+ _M_replace(iterator __i1, iterator __i2, _InputIter __j1,
+ _InputIter __j2, input_iterator_tag)
+ {
+ basic_string __s(__j1, __j2);
+ return this->replace(__i1, __i2, __s._M_ibegin(), __s._M_iend());
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ template<typename _ForwardIter>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::
+ _M_replace(iterator __i1, iterator __i2, _ForwardIter __j1,
+ _ForwardIter __j2, forward_iterator_tag)
+ {
+ size_type __dold = __i2 - __i1;
+ size_type __dmax = this->max_size();
+ size_type __dnew = static_cast<size_type>(distance(__j1, __j2));
+
+ __LENGTHERROR(__dmax <= __dnew);
+ size_type __off = __i1 - _M_ibegin();
+ _M_mutate(__off, __dold, __dnew);
+ // Invalidated __i1, __i2
+ if (__dnew)
+ _S_copy_chars(_M_data() + __off, __j1, __j2);
+
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::
+ replace(size_type __pos1, size_type __n1, const basic_string& __str,
+ size_type __pos2, size_type __n2)
+ {
+ return this->replace(_M_check(__pos1), _M_fold(__pos1, __n1),
+ __str._M_check(__pos2),
+ __str._M_fold(__pos2, __n2));
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT,_Traits,_Alloc>&
+ basic_string<_CharT,_Traits,_Alloc>::
+ append(const basic_string& __str)
+ {
+ // Iff appending itself, string needs to pre-reserve the
+ // correct size so that _M_mutate does not clobber the
+ // iterators formed here.
+ size_type __size = __str.size();
+ size_type __len = __size + this->size();
+ if (__len > this->capacity())
+ this->reserve(__len);
+ return this->replace(_M_iend(), _M_iend(), __str._M_ibegin(),
+ __str._M_iend());
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT,_Traits,_Alloc>&
+ basic_string<_CharT,_Traits,_Alloc>::
+ append(const basic_string& __str, size_type __pos, size_type __n)
+ {
+ // Iff appending itself, string needs to pre-reserve the
+ // correct size so that _M_mutate does not clobber the
+ // iterators formed here.
+ size_type __len = min(__str.size() - __pos, __n) + this->size();
+ if (__len > this->capacity())
+ this->reserve(__len);
+ return this->replace(_M_iend(), _M_iend(), __str._M_check(__pos),
+ __str._M_fold(__pos, __n));
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT,_Traits,_Alloc>&
+ basic_string<_CharT,_Traits,_Alloc>::
+ append(const _CharT* __s, size_type __n)
+ {
+ size_type __len = __n + this->size();
+ if (__len > this->capacity())
+ this->reserve(__len);
+ return this->replace(_M_iend(), _M_iend(), __s, __s + __n);
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT,_Traits,_Alloc>&
+ basic_string<_CharT,_Traits,_Alloc>::
+ append(size_type __n, _CharT __c)
+ {
+ size_type __len = __n + this->size();
+ if (__len > this->capacity())
+ this->reserve(__len);
+ return this->replace(_M_iend(), _M_iend(), __n, __c);
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT,_Traits,_Alloc>
+ operator+(const _CharT* __lhs,
+ const basic_string<_CharT,_Traits,_Alloc>& __rhs)
+ {
+ typedef basic_string<_CharT,_Traits,_Alloc> __string_type;
+ __string_type::size_type __len = _Traits::length(__lhs);
+ __string_type __str;
+ __str.reserve(__len + __rhs.size());
+ __str.append(__lhs, __lhs + __len);
+ __str.append(__rhs);
+ return __str;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT,_Traits,_Alloc>
+ operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
+ {
+ typedef basic_string<_CharT,_Traits,_Alloc> __string_type;
+ __string_type __str;
+ __string_type::size_type __len = __rhs.size();
+ __str.reserve(__len + 1);
+ __str.append(__string_type::size_type(1), __lhs);
+ __str.append(__rhs);
+ return __str;
+ }
+
+
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::
+ replace(iterator __i1, iterator __i2, size_type __n2, _CharT __c)
+ {
+ size_type __n1 = __i2 - __i1;
+ size_type __off1 = __i1 - _M_ibegin();
+ __LENGTHERROR(max_size() - (this->size() - __n1) <= __n2);
+ _M_mutate (__off1, __n1, __n2);
+ // Invalidated __i1, __i2
+ if (__n2)
+ traits_type::assign(_M_data() + __off1, __n2, __c);
+ return *this;
+ }
+
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ copy(_CharT* __s, size_type __n, size_type __pos) const
+ {
+ __OUTOFRANGE(__pos > this->size());
+
+ if (__n > this->size() - __pos)
+ __n = this->size() - __pos;
+
+ traits_type::copy(__s, _M_data() + __pos, __n);
+ // 21.3.5.7 par 3: do not append null. (good.)
+ return __n;
+ }
+
+ // String operations
+ // NB: This is specialized for the standard char_traits<char>
+ // specialization to use the same optimizations as strchr.
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ const _CharT*
+ basic_string<_CharT, _Traits, _Alloc>::
+ _S_find(const _CharT* __beg, const _CharT* __end, _CharT __c)
+ {
+ return find_if(__beg, __end, _Char_traits_match<_CharT, _Traits>(__c));
+ }
+
+ // Specialization for char, definitions in src/string-inst.cc.
+ template<>
+ const char*
+ string::_S_find(const char* __beg, const char* __end, char __c);
+
+ // Specialization for wchar_t.
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ const wchar_t*
+ wstring::_S_find(const wchar_t* __beg, const wchar_t* __end, wchar_t __c);
+#endif
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ size_t __xpos = __pos;
+ const _CharT* __data = _M_data();
+ for (; __xpos + __n <= this->size(); ++__xpos)
+ if (traits_type::eq(__data[__xpos], *__s)
+ && traits_type::compare(__data + __xpos, __s, __n) == 0)
+ return __xpos;
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find(_CharT __c, size_type __pos) const
+ {
+ size_type __size = this->size();
+ size_type __retval = npos;
+ if (__pos < __size)
+ {
+ const _CharT* __data = _M_data();
+ const _CharT* __end = __data + __size;
+ const _CharT* __p = _S_find(__data + __pos, __end, __c);
+ if (__p != __end)
+ __retval = __p - __data;
+ }
+ return __retval;
+ }
+
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ rfind(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ size_type __size = this->size();
+ if (__n <= __size)
+ {
+ size_t __xpos = __size - __n;
+ if (__xpos > __pos)
+ __xpos = __pos;
+
+ for (++__xpos; __xpos-- > 0; )
+ if (traits_type::eq(_M_data()[__xpos], *__s)
+ && traits_type::compare(_M_data() + __xpos, __s, __n) == 0)
+ return __xpos;
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ rfind(_CharT __c, size_type __pos) const
+ {
+ size_type __size = this->size();
+ if (__size)
+ {
+ size_t __xpos = __size - 1;
+ if (__xpos > __pos)
+ __xpos = __pos;
+
+ for (++__xpos; __xpos-- > 0; )
+ if (traits_type::eq(_M_data()[__xpos], __c))
+ return __xpos;
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ const _CharT* __end = __s + __n;
+ for (; __n && __pos < this->size(); ++__pos)
+ {
+ const _CharT* __p = _S_find(__s, __end, _M_data()[__pos]);
+ if (__p != __end)
+ return __pos;
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ size_type __size = this->size();
+ if (__size && __n)
+ {
+ if (--__size > __pos)
+ __size = __pos;
+ do
+ {
+ const _CharT* __p = _S_find(__s, __s + __n, _M_data()[__size]);
+ if (__p != __s + __n)
+ return __size;
+ }
+ while (__size-- != 0);
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ size_t __xpos = __pos;
+ for (; __n && __xpos < this->size(); ++__xpos)
+ if (_S_find(__s, __s + __n, _M_data()[__xpos]) == __s + __n)
+ return __xpos;
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find_first_not_of(_CharT __c, size_type __pos) const
+ {
+ size_t __xpos = __pos;
+ for (; __xpos < size(); ++__xpos)
+ if (!traits_type::eq(_M_data()[__xpos], __c))
+ return __xpos;
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ size_type __size = this->size();
+ if (__size && __n)
+ {
+ if (--__size > __pos)
+ __size = __pos;
+ do
+ {
+ if (_S_find(__s, __s + __n, _M_data()[__size]) == __s + __n)
+ return __size;
+ }
+ while (__size--);
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find_last_not_of(_CharT __c, size_type __pos) const
+ {
+ size_type __size = this->size();
+ if (__size)
+ {
+ if (--__size > __pos)
+ __size = __pos;
+ do
+ {
+ if (!traits_type::eq(_M_data()[__size], __c))
+ return __size;
+ }
+ while (__size--);
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ int
+ basic_string<_CharT, _Traits, _Alloc>::
+ compare(size_type __pos, size_type __n, const basic_string& __str) const
+ {
+ size_type __size = this->size();
+ size_type __osize = __str.size();
+ __OUTOFRANGE(__pos > __size);
+
+ size_type __rsize= min(__size - __pos, __n);
+ size_type __len = min(__rsize, __osize);
+ int __r = traits_type::compare(_M_data() + __pos, __str.data(), __len);
+ if (!__r)
+ __r = __rsize - __osize;
+ return __r;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ int
+ basic_string<_CharT, _Traits, _Alloc>::
+ compare(size_type __pos1, size_type __n1, const basic_string& __str,
+ size_type __pos2, size_type __n2) const
+ {
+ size_type __size = this->size();
+ size_type __osize = __str.size();
+ __OUTOFRANGE(__pos1 > __size);
+ __OUTOFRANGE(__pos2 > __osize);
+
+ size_type __rsize = min(__size - __pos1, __n1);
+ size_type __rosize = min(__osize - __pos2, __n2);
+ size_type __len = min(__rsize, __rosize);
+ int __r = traits_type::compare(_M_data() + __pos1,
+ __str.data() + __pos2, __len);
+ if (!__r)
+ __r = __rsize - __rosize;
+ return __r;
+ }
+
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ int
+ basic_string<_CharT, _Traits, _Alloc>::
+ compare(const _CharT* __s) const
+ {
+ size_type __size = this->size();
+ int __r = traits_type::compare(_M_data(), __s, __size);
+ if (!__r)
+ __r = __size - traits_type::length(__s);
+ return __r;
+ }
+
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ int
+ basic_string <_CharT,_Traits,_Alloc>::
+ compare(size_type __pos, size_type __n1, const _CharT* __s,
+ size_type __n2) const
+ {
+ size_type __size = this->size();
+ __OUTOFRANGE(__pos > __size);
+
+ size_type __osize = min(traits_type::length(__s), __n2);
+ size_type __rsize = min(__size - __pos, __n1);
+ size_type __len = min(__rsize, __osize);
+ int __r = traits_type::compare(_M_data() + __pos, __s, __len);
+ if (!__r)
+ __r = __rsize - __osize;
+ return __r;
+ }
+
+ template <class _CharT, class _Traits, class _Alloc>
+ void
+ _S_string_copy(const basic_string<_CharT, _Traits, _Alloc>& __str,
+ _CharT* __buf, typename _Alloc::size_type __bufsiz)
+ {
+ typedef typename _Alloc::size_type size_type;
+ size_type __strsize = __str.size();
+ size_type __bytes = min(__strsize, __bufsiz - 1);
+ _Traits::copy(__buf, __str.data(), __bytes);
+ __buf[__bytes] = _CharT();
+ }
+
+} // std::
+
+#endif /* _CPP_BITS_STRING_TCC */
+
+// Local Variables:
+// mode:c++
+// End:
diff --git a/libstdc++-v3/bits/type_traits.h b/libstdc++-v3/bits/type_traits.h
new file mode 100644
index 000000000000..dbcaa2a619fe
--- /dev/null
+++ b/libstdc++-v3/bits/type_traits.h
@@ -0,0 +1,387 @@
+/*
+ *
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _CPP_BITS_TYPE_TRAITS_H
+#define _CPP_BITS_TYPE_TRAITS_H 1
+
+#ifndef _CPP_BITS_STL_CONFIG_H
+#include <bits/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 _Tp> void
+ copy(_Tp* __source,_Tp* __destination,int __n,__false_type);
+//Copy an array of elements which have trivial copy constructors. Use memcpy.
+template <class _Tp> void
+ copy(_Tp* __source,_Tp* __destination,int __n,__true_type);
+
+//Copy an array of any type by using the most efficient copy mechanism
+template <class _Tp> inline void copy(_Tp* __source,_Tp* __destination,int __n) {
+ copy(__source,__destination,__n,
+ typename __type_traits<_Tp>::has_trivial_copy_constructor());
+}
+*/
+
+
+template <bool _Truth> struct _Bool {};
+typedef _Bool<true> __true_type;
+typedef _Bool<false> __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 */
+
+template<typename _Tp> struct _Is_normal_iterator {
+ typedef __false_type _Normal;
+};
+
+// Forward declaration hack, should really include this from somewhere.
+namespace std {
+ template<typename _Iterator, typename _Container> class __normal_iterator;
+};
+
+template<typename _Iterator, typename _Container>
+struct _Is_normal_iterator< std::__normal_iterator<_Iterator, _Container> > {
+ typedef __true_type _Normal;
+};
+
+#endif /* _CPP_BITS_TYPE_TRAITS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/bits/valarray_array.h b/libstdc++-v3/bits/valarray_array.h
new file mode 100644
index 000000000000..fc610ee0defc
--- /dev/null
+++ b/libstdc++-v3/bits/valarray_array.h
@@ -0,0 +1,535 @@
+// The template and inlines for the -*- C++ -*- internal _Array helper class.
+
+// Copyright (C) 1997-2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _CPP_BITS_ARRAY_H
+#define _CPP_BITS_ARRAY_H 1
+
+#include <bits/c++config.h>
+#include <bits/cpp_type_traits.h>
+#include <bits/std_cstdlib.h>
+#include <bits/std_cstring.h>
+#include <bits/std_new.h>
+
+namespace std
+{
+
+ //
+ // Helper functions on raw pointers
+ //
+
+ // We get memory by the old fashion way
+ inline void*
+ __valarray_get_memory(size_t __n)
+ { return operator new(__n); }
+
+ // Return memory to the system
+ inline void
+ __valarray_release_memory(void* __p)
+ { operator delete(__p); }
+
+ // Turn a raw-memory into an array of _Tp filled with _Tp()
+ // This is required in 'valarray<T> v(n);'
+ template<typename _Tp, bool>
+ struct _Array_default_ctor
+ {
+ // Please note that this isn't exception safe. But
+ // valarrays aren't required to be exception safe.
+ inline static void
+ _S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e)
+ { while (__b != __e) new(__b++) _Tp(); }
+ };
+
+ template<typename _Tp>
+ struct _Array_default_ctor<_Tp, true>
+ {
+ // For fundamental types, it suffices to say 'memset()'
+ inline static void
+ _S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e)
+ { memset(__b, 0, __e - __b); }
+ };
+
+ template<typename _Tp>
+ inline void
+ __valarray_default_construct(_Tp* __restrict__ __b, _Tp* __restrict__ __e)
+ {
+ _Array_default_ctor<_Tp, __is_fundamental<_Tp>::_M_type>::
+ _S_do_it(__b, __e);
+ }
+
+ // Turn a raw-memory into an array of _Tp filled with __t
+ // This is the required in valarray<T> v(n, t). Also
+ // used in valarray<>::resize().
+ template<typename _Tp, bool>
+ struct _Array_init_ctor
+ {
+ // Please note that this isn't exception safe. But
+ // valarrays aren't required to be exception safe.
+ inline static void
+ _S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e, const _Tp __t)
+ { while (__b != __e) new(__b++) _Tp(__t); }
+ };
+
+ template<typename _Tp>
+ struct _Array_init_ctor<_Tp, true>
+ {
+ inline static void
+ _S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e, const _Tp __t)
+ { while (__b != __e) *__b++ = __t; }
+ };
+
+ template<typename _Tp>
+ inline void
+ __valarray_fill_construct(_Tp* __restrict__ __b, _Tp* __restrict__ __e,
+ const _Tp __t)
+ {
+ _Array_init_ctor<_Tp, __is_fundamental<_Tp>::_M_type>::
+ _S_do_it(__b, __e, __t);
+ }
+
+ //
+ // copy-construct raw array [__o, *) from plain array [__b, __e)
+ // We can't just say 'memcpy()'
+ //
+ template<typename _Tp, bool>
+ struct _Array_copy_ctor
+ {
+ // Please note that this isn't exception safe. But
+ // valarrays aren't required to be exception safe.
+ inline static void
+ _S_do_it(const _Tp* __restrict__ __b, const _Tp* __restrict__ __e,
+ _Tp* __restrict__ __o)
+ { while (__b != __e) new(__o++) _Tp(*__b++); }
+ };
+
+ template<typename _Tp>
+ struct _Array_copy_ctor<_Tp, true>
+ {
+ inline static void
+ _S_do_it(const _Tp* __restrict__ __b, const _Tp* __restrict__ __e,
+ _Tp* __restrict__ __o)
+ { memcpy(__o, __b, __e - __b); }
+ };
+
+ template<typename _Tp>
+ inline void
+ __valarray_copy_construct(const _Tp* __restrict__ __b,
+ const _Tp* __restrict__ __e,
+ _Tp* __restrict__ __o)
+ {
+ _Array_copy_ctor<_Tp, __is_fundamental<_Tp>::_M_type>::
+ _S_do_it(__b, __e, __o);
+ }
+
+ // copy-construct raw array [__o, *) from strided array __a[<__n : __s>]
+ template<typename _Tp>
+ inline void
+ __valarray_copy_construct (const _Tp* __restrict__ __a, size_t __n,
+ size_t __s, _Tp* __restrict__ __o)
+ {
+ if (__is_fundamental<_Tp>::_M_type)
+ while (__n--) { *__o++ = *__a; __a += __s; }
+ else
+ while (__n--) { new(__o++) _Tp(*__a); __a += __s; }
+ }
+
+ // copy-construct raw array [__o, *) from indexed array __a[__i[<__n>]]
+ template<typename _Tp>
+ inline void
+ __valarray_copy_construct (const _Tp* __restrict__ __a,
+ const size_t* __restrict__ __i,
+ _Tp* __restrict__ __o, size_t __n)
+ {
+ if (__is_fundamental<_Tp>::_M_type)
+ while (__n--) *__o++ = __a[*__i++];
+ else
+ while (__n--) new (__o++) _Tp(__a[*__i++]);
+ }
+
+ // Do the necessary cleanup when we're done with arrays.
+ template<typename _Tp>
+ inline void
+ __valarray_destroy_elements(_Tp* __restrict__ __b, _Tp* __restrict__ __e)
+ {
+ if (!__is_fundamental<_Tp>::_M_type)
+ while (__b != __e) { __b->~_Tp(); ++__b; }
+ }
+
+ // fill plain array __a[<__n>] with __t
+ template<typename _Tp>
+ 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 indir ect array __a[__i[<__n>]] with __i
+ template<typename _Tp>
+ inline void
+ __valarray_fill(_Tp* __restrict__ __a, const size_t* __restrict__ __i,
+ size_t __n, const _Tp& __t)
+ { for (size_t __j=0; __j<__n; ++__j, ++__i) __a[*__i] = __t; }
+
+ // copy plain array __a[<__n>] in __b[<__n>]
+ // For non-fundamental types, it is wrong to say 'memcpy()'
+ template<typename _Tp, bool>
+ struct _Array_copier
+ {
+ inline static void
+ _S_do_it(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b)
+ { while (__n--) *__b++ = *__a++; }
+ };
+
+ template<typename _Tp>
+ struct _Array_copier<_Tp, true>
+ {
+ inline static void
+ _S_do_it(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b)
+ { memcpy (__b, __a, __n * sizeof (_Tp)); }
+ };
+
+ template<typename _Tp>
+ inline void
+ __valarray_copy (const _Tp* __restrict__ __a, size_t __n,
+ _Tp* __restrict__ __b)
+ {
+ _Array_copier<_Tp, __is_fundamental<_Tp>::_M_type>::
+ _S_do_it(__a, __n, __b);
+ }
+
+ // copy strided array __a[<__n : __s>] in plain __b[<__n>]
+ template<typename _Tp>
+ inline void
+ __valarray_copy (const _Tp* __restrict__ __a, size_t __n, size_t __s,
+ _Tp* __restrict__ __b)
+ { for (size_t __i=0; __i<__n; ++__i, ++__b, __a += __s) *__b = *__a; }
+
+ // copy plain __a[<__n>] in strided __b[<__n : __s>]
+ template<typename _Tp>
+ inline void
+ __valarray_copy (const _Tp* __restrict__ __a, _Tp* __restrict__ __b,
+ size_t __n, size_t __s)
+ { for (size_t __i=0; __i<__n; ++__i, ++__a, __b+=__s) *__b = *__a; }
+
+ // copy indexed __a[__i[<__n>]] in plain __b[<__n>]
+ template<typename _Tp>
+ inline void
+ __valarray_copy (const _Tp* __restrict__ __a,
+ const size_t* __restrict__ __i,
+ _Tp* __restrict__ __b, size_t __n)
+ { for (size_t __j=0; __j<__n; ++__j, ++__b, ++__i) *__b = __a[*__i]; }
+
+ // copy plain __a[<__n>] in indexed __b[__i[<__n>]]
+ template<typename _Tp>
+ inline void
+ __valarray_copy (const _Tp* __restrict__ __a, size_t __n,
+ _Tp* __restrict__ __b, const size_t* __restrict__ __i)
+ { for (size_t __j=0; __j<__n; ++__j, ++__a, ++__i) __b[*__i] = *__a; }
+
+
+ //
+ // Compute the sum of elements in range [__f, __l)
+ // This is a naive algorithm. It suffers from cancelling.
+ // In the future try to specialize
+ // for _Tp = float, double, long double using a more accurate
+ // algorithm.
+ //
+ template<typename _Tp>
+ inline _Tp
+ __valarray_sum(const _Tp* __restrict__ __f, const _Tp* __restrict__ __l)
+ {
+ _Tp __r = _Tp();
+ while (__f != __l) __r += *__f++;
+ return __r;
+ }
+
+ // Compute the product of all elements in range [__f, __l)
+ template<typename _Tp>
+ _Tp
+ __valarray_product(const _Tp* __restrict__ __f,
+ const _Tp* __restrict__ __l)
+ {
+ _Tp __r = _Tp(1);
+ while (__f != __l) __r = __r * *__f++;
+ return __r;
+ }
+
+
+ //
+ // Helper class _Array, first layer of valarray abstraction.
+ // All operations on valarray should be forwarded to this class
+ // whenever possible. -- gdr
+ //
+
+ template<typename _Tp>
+ struct _Array
+ {
+ explicit _Array (size_t);
+ explicit _Array (_Tp* const __restrict__);
+ explicit _Array (const valarray<_Tp>&);
+ _Array (const _Tp* __restrict__, size_t);
+
+ _Tp* begin () const;
+
+ _Tp* const __restrict__ _M_data;
+ };
+
+ template<typename _Tp>
+ inline void
+ __valarray_fill (_Array<_Tp> __a, size_t __n, const _Tp& __t)
+ { __valarray_fill (__a._M_data, __n, __t); }
+
+ template<typename _Tp>
+ inline void
+ __valarray_fill (_Array<_Tp> __a, size_t __n, size_t __s, const _Tp& __t)
+ { __valarray_fill (__a._M_data, __n, __s, __t); }
+
+ template<typename _Tp>
+ inline void
+ __valarray_fill (_Array<_Tp> __a, _Array<size_t> __i,
+ size_t __n, const _Tp& __t)
+ { __valarray_fill (__a._M_data, __i._M_data, __n, __t); }
+
+ template<typename _Tp>
+ inline void
+ __valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b)
+ { __valarray_copy (__a._M_data, __n, __b._M_data); }
+
+ template<typename _Tp>
+ inline void
+ __valarray_copy (_Array<_Tp> __a, size_t __n, size_t __s, _Array<_Tp> __b)
+ { __valarray_copy(__a._M_data, __n, __s, __b._M_data); }
+
+ template<typename _Tp>
+ inline void
+ __valarray_copy (_Array<_Tp> __a, _Array<_Tp> __b, size_t __n, size_t __s)
+ { __valarray_copy (__a._M_data, __b._M_data, __n, __s); }
+
+ template<typename _Tp>
+ inline void
+ __valarray_copy (_Array<_Tp> __a, _Array<size_t> __i,
+ _Array<_Tp> __b, size_t __n)
+ { __valarray_copy (__a._M_data, __i._M_data, __b._M_data, __n); }
+
+ template<typename _Tp>
+ inline void
+ __valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b,
+ _Array<size_t> __i)
+ { __valarray_copy (__a._M_data, __n, __b._M_data, __i._M_data); }
+
+ template<typename _Tp>
+ inline
+ _Array<_Tp>::_Array (size_t __n)
+ : _M_data(__valarray_get_memory(__n * sizeof (_Tp)))
+ { __valarray_default_construct(_M_data, _M_data + __n); }
+
+ template<typename _Tp>
+ inline
+ _Array<_Tp>::_Array (_Tp* const __restrict__ __p) : _M_data (__p) {}
+
+ template<typename _Tp>
+ inline _Array<_Tp>::_Array (const valarray<_Tp>& __v)
+ : _M_data (__v._M_data) {}
+
+ template<typename _Tp>
+ inline
+ _Array<_Tp>::_Array (const _Tp* __restrict__ __b, size_t __s)
+ : _M_data(__valarray_get_memory(__s * sizeof (_Tp)))
+ { __valarray_copy_construct(__b, __s, _M_data); }
+
+ template<typename _Tp>
+ inline _Tp*
+ _Array<_Tp>::begin () const
+ { return _M_data; }
+
+#define _DEFINE_ARRAY_FUNCTION(_Op, _Name) \
+template<typename _Tp> \
+inline void \
+_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, const _Tp& __t) \
+{ \
+ for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p) \
+ *__p _Op##= __t; \
+} \
+ \
+template<typename _Tp> \
+inline void \
+_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b) \
+{ \
+ _Tp* __p = __a._M_data; \
+ for (_Tp* __q=__b._M_data; __q<__b._M_data+__n; ++__p, ++__q) \
+ *__p _Op##= *__q; \
+} \
+ \
+template<typename _Tp, class _Dom> \
+void \
+_Array_augmented_##_Name (_Array<_Tp> __a, \
+ const _Expr<_Dom,_Tp>& __e, size_t __n) \
+{ \
+ _Tp* __p (__a._M_data); \
+ for (size_t __i=0; __i<__n; ++__i, ++__p) *__p _Op##= __e[__i]; \
+} \
+ \
+template<typename _Tp> \
+inline void \
+_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, size_t __s, \
+ _Array<_Tp> __b) \
+{ \
+ _Tp* __q (__b._M_data); \
+ for (_Tp* __p=__a._M_data; __p<__a._M_data+__s*__n; __p+=__s, ++__q) \
+ *__p _Op##= *__q; \
+} \
+ \
+template<typename _Tp> \
+inline void \
+_Array_augmented_##_Name (_Array<_Tp> __a, _Array<_Tp> __b, \
+ size_t __n, size_t __s) \
+{ \
+ _Tp* __q (__b._M_data); \
+ for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p, __q+=__s) \
+ *__p _Op##= *__q; \
+} \
+ \
+template<typename _Tp, class _Dom> \
+void \
+_Array_augmented_##_Name (_Array<_Tp> __a, size_t __s, \
+ const _Expr<_Dom,_Tp>& __e, size_t __n) \
+{ \
+ _Tp* __p (__a._M_data); \
+ for (size_t __i=0; __i<__n; ++__i, __p+=__s) *__p _Op##= __e[__i]; \
+} \
+ \
+template<typename _Tp> \
+inline void \
+_Array_augmented_##_Name (_Array<_Tp> __a, _Array<size_t> __i, \
+ _Array<_Tp> __b, size_t __n) \
+{ \
+ _Tp* __q (__b._M_data); \
+ for (size_t* __j=__i._M_data; __j<__i._M_data+__n; ++__j, ++__q) \
+ __a._M_data[*__j] _Op##= *__q; \
+} \
+ \
+template<typename _Tp> \
+inline void \
+_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, \
+ _Array<_Tp> __b, _Array<size_t> __i) \
+{ \
+ _Tp* __p (__a._M_data); \
+ for (size_t* __j=__i._M_data; __j<__i._M_data+__n; ++__j, ++__p) \
+ *__p _Op##= __b._M_data[*__j]; \
+} \
+ \
+template<typename _Tp, class _Dom> \
+void \
+_Array_augmented_##_Name (_Array<_Tp> __a, _Array<size_t> __i, \
+ const _Expr<_Dom, _Tp>& __e, size_t __n) \
+{ \
+ size_t* __j (__i._M_data); \
+ for (size_t __k=0; __k<__n; ++__k, ++__j) \
+ __a._M_data[*__j] _Op##= __e[__k]; \
+} \
+ \
+template<typename _Tp> \
+void \
+_Array_augmented_##_Name (_Array<_Tp> __a, _Array<bool> __m, \
+ _Array<_Tp> __b, size_t __n) \
+{ \
+ bool* ok (__m._M_data); \
+ _Tp* __p (__a._M_data); \
+ for (_Tp* __q=__b._M_data; __q<__b._M_data+__n; ++__q, ++ok, ++__p) { \
+ while (! *ok) { \
+ ++ok; \
+ ++__p; \
+ } \
+ *__p _Op##= *__q; \
+ } \
+} \
+ \
+template<typename _Tp> \
+void \
+_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, \
+ _Array<_Tp> __b, _Array<bool> __m) \
+{ \
+ bool* ok (__m._M_data); \
+ _Tp* __q (__b._M_data); \
+ for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p, ++ok, ++__q) { \
+ while (! *ok) { \
+ ++ok; \
+ ++__q; \
+ } \
+ *__p _Op##= *__q; \
+ } \
+} \
+ \
+template<typename _Tp, class _Dom> \
+void \
+_Array_augmented_##_Name (_Array<_Tp> __a, _Array<bool> __m, \
+ const _Expr<_Dom, _Tp>& __e, size_t __n) \
+{ \
+ bool* ok(__m._M_data); \
+ _Tp* __p (__a._M_data); \
+ for (size_t __i=0; __i<__n; ++__i, ++ok, ++__p) { \
+ while (! *ok) { \
+ ++ok; \
+ ++__p; \
+ } \
+ *__p _Op##= __e[__i]; \
+ } \
+}
+
+_DEFINE_ARRAY_FUNCTION(+, plus)
+_DEFINE_ARRAY_FUNCTION(-, minus)
+_DEFINE_ARRAY_FUNCTION(*, multiplies)
+_DEFINE_ARRAY_FUNCTION(/, divides)
+_DEFINE_ARRAY_FUNCTION(%, modulus)
+_DEFINE_ARRAY_FUNCTION(^, xor)
+_DEFINE_ARRAY_FUNCTION(|, or)
+_DEFINE_ARRAY_FUNCTION(&, and)
+_DEFINE_ARRAY_FUNCTION(<<, shift_left)
+_DEFINE_ARRAY_FUNCTION(>>, shift_right)
+
+#undef _DEFINE_VALARRAY_FUNCTION
+
+} // std::
+
+#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
+# define export
+# include <bits/valarray_array.tcc>
+#endif
+
+#endif /* _CPP_BITS_ARRAY_H */
+
+// Local Variables:
+// mode:c++
+// End:
diff --git a/libstdc++-v3/bits/valarray_array.tcc b/libstdc++-v3/bits/valarray_array.tcc
new file mode 100644
index 000000000000..ab77f4aca1eb
--- /dev/null
+++ b/libstdc++-v3/bits/valarray_array.tcc
@@ -0,0 +1,161 @@
+// The template and inlines for the -*- C++ -*- internal _Array helper class.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _CPP_BITS_VALARRAY_ARRAY_TCC
+#define _CPP_BITS_VALARRAY_ARRAY_TCC 1
+
+namespace std
+{
+
+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];
+ }
+}
+
+
+export template<typename _Tp, class _Dom>
+void
+__valarray_copy_construct (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) new (__p) _Tp(__e[__i]);
+}
+
+
+export template<typename _Tp>
+void
+__valarray_copy_construct (_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;
+ }
+ new (__q) _Tp(*__p);
+ }
+}
+
+
+
+
+} // std::
+
+#endif /* _CPP_BITS_VALARRAY_ARRAY_TCC */
+
+// Local Variables:
+// mode:c++
+// End:
diff --git a/libstdc++-v3/bits/valarray_meta.h b/libstdc++-v3/bits/valarray_meta.h
new file mode 100644
index 000000000000..1207bd96e2df
--- /dev/null
+++ b/libstdc++-v3/bits/valarray_meta.h
@@ -0,0 +1,1057 @@
+// The template and inlines for the -*- C++ -*- internal _Meta class.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
+
+#ifndef _CPP_VALARRAY_META_H
+#define _CPP_VALARRAY_META_H 1
+
+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;
+
+ //
+ // 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 (__e, __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
+ {
+ 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 _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
+
+} // std::
+
+
+#endif /* _CPP_VALARRAY_META_H */
+
+// Local Variables:
+// mode:c++
+// End:
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
new file mode 100644
index 000000000000..b657fdf306f7
--- /dev/null
+++ b/libstdc++-v3/config.h.in
@@ -0,0 +1,569 @@
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+// Include support for 'long long' and 'unsigned long long'.
+#undef _GLIBCPP_USE_LONG_LONG
+
+// Define if the host has a type mbstate_t defined in
+// wchar.h, as required by 21.1.3.1. Some systems, namely
+// hppa-hp-hpux10.20 do not meet this requirement, and must be worked
+// around.
+#undef _GLIBCPP_NEED_MBSTATE_T
+
+// Define if WCHAR_MIN and WCHAR_MAX are in the <cwchar_t>
+// header. Presently, this is needed so that solaris won't
+// instantitate numeric_limits<wchar_t>
+#undef _GLIBCPP_HAS_WCHAR_MIN_MAX
+
+// Define if code specialized for wchar_t should be used.
+#undef _GLIBCPP_USE_WCHAR_T
+
+// Define if the compiler/host combination has __builtin_sinf defined.
+#undef _GLIBCPP_HAS_BUILTIN_SINF
+
+// Define if the compiler/host combination has __builtin_cosf defined.
+#undef _GLIBCPP_HAS_BUILTIN_COSF
+
+// Define if the compiler/host combination has __builtin_fabsf defined.
+#undef _GLIBCPP_HAS_BUILTIN_FABSF
+
+// Define if the compiler/host combination has __builtin_fabsf defined.
+#undef _GLIBCPP_HAS_BUILTIN_SQRTF
+
+// Define if GCC support for __complex__ float is buggy.
+#undef _GLIBCPP_BUGGY_FLOAT_COMPLEX
+
+// Define if GCC support for __complex__ is buggy.
+#undef _GLIBCPP_BUGGY_COMPLEX
+
+// Define if LC_MESSAGES is available in <locale.h>.
+#undef HAVE_LC_MESSAGES
+
+// Define if <float.h> exists.
+#undef HAVE_FLOAT_H
+
+// Define if modf is present in <math.h>
+#undef HAVE_MODF
+
+/* Define if you have the _copysign function. */
+#undef HAVE__COPYSIGN
+
+/* Define if you have the _copysignl function. */
+#undef HAVE__COPYSIGNL
+
+/* Define if you have the _cosf function. */
+#undef HAVE__COSF
+
+/* Define if you have the _coshf function. */
+#undef HAVE__COSHF
+
+/* Define if you have the _fabsf function. */
+#undef HAVE__FABSF
+
+/* Define if you have the _finite function. */
+#undef HAVE__FINITE
+
+/* Define if you have the _finitef function. */
+#undef HAVE__FINITEF
+
+/* Define if you have the _fpclass function. */
+#undef HAVE__FPCLASS
+
+/* Define if you have the _isinf function. */
+#undef HAVE__ISINF
+
+/* Define if you have the _isinff function. */
+#undef HAVE__ISINFF
+
+/* Define if you have the _isinfl function. */
+#undef HAVE__ISINFL
+
+/* Define if you have the _isnan function. */
+#undef HAVE__ISNAN
+
+/* Define if you have the _isnanf function. */
+#undef HAVE__ISNANF
+
+/* Define if you have the _isnanl function. */
+#undef HAVE__ISNANL
+
+/* Define if you have the _log10f function. */
+#undef HAVE__LOG10F
+
+/* Define if you have the _logf function. */
+#undef HAVE__LOGF
+
+/* Define if you have the _modf function. */
+#undef HAVE__MODF
+
+/* Define if you have the _powf function. */
+#undef HAVE__POWF
+
+/* Define if you have the _qfinite function. */
+#undef HAVE__QFINITE
+
+/* Define if you have the _qfpclass function. */
+#undef HAVE__QFPCLASS
+
+/* Define if you have the _sincos function. */
+#undef HAVE__SINCOS
+
+/* Define if you have the _sincosf function. */
+#undef HAVE__SINCOSF
+
+/* Define if you have the _sincosl function. */
+#undef HAVE__SINCOSL
+
+/* Define if you have the _sinf function. */
+#undef HAVE__SINF
+
+/* Define if you have the _sinhf function. */
+#undef HAVE__SINHF
+
+/* Define if you have the _sqrtf function. */
+#undef HAVE__SQRTF
+
+/* Define if you have the _strtof function. */
+#undef HAVE__STRTOF
+
+/* Define if you have the _strtold function. */
+#undef HAVE__STRTOLD
+
+/* Define if you have the _tanf function. */
+#undef HAVE__TANF
+
+/* Define if you have the _tanhf function. */
+#undef HAVE__TANHF
+
+/* Define if you have the atan2f function. */
+#undef HAVE_ATAN2F
+
+/* Define if you have the c_log function. */
+#undef HAVE_C_LOG
+
+/* Define if you have the c_logf function. */
+#undef HAVE_C_LOGF
+
+/* Define if you have the c_logl function. */
+#undef HAVE_C_LOGL
+
+/* Define if you have the carg function. */
+#undef HAVE_CARG
+
+/* Define if you have the cargf function. */
+#undef HAVE_CARGF
+
+/* Define if you have the cargl function. */
+#undef HAVE_CARGL
+
+/* Define if you have the ccos function. */
+#undef HAVE_CCOS
+
+/* Define if you have the ccosf function. */
+#undef HAVE_CCOSF
+
+/* Define if you have the ccosh function. */
+#undef HAVE_CCOSH
+
+/* Define if you have the ccoshf function. */
+#undef HAVE_CCOSHF
+
+/* Define if you have the ccoshl function. */
+#undef HAVE_CCOSHL
+
+/* Define if you have the ccosl function. */
+#undef HAVE_CCOSL
+
+/* Define if you have the cexp function. */
+#undef HAVE_CEXP
+
+/* Define if you have the cexpf function. */
+#undef HAVE_CEXPF
+
+/* Define if you have the cexpl function. */
+#undef HAVE_CEXPL
+
+/* Define if you have the clog10 function. */
+#undef HAVE_CLOG10
+
+/* Define if you have the clog10f function. */
+#undef HAVE_CLOG10F
+
+/* Define if you have the clog10l function. */
+#undef HAVE_CLOG10L
+
+/* Define if you have the copysign function. */
+#undef HAVE_COPYSIGN
+
+/* Define if you have the copysignf function. */
+#undef HAVE_COPYSIGNF
+
+/* Define if you have the copysignl function. */
+#undef HAVE_COPYSIGNL
+
+/* Define if you have the cosf function. */
+#undef HAVE_COSF
+
+/* Define if you have the coshf function. */
+#undef HAVE_COSHF
+
+/* Define if you have the cpow function. */
+#undef HAVE_CPOW
+
+/* Define if you have the cpowf function. */
+#undef HAVE_CPOWF
+
+/* Define if you have the cpowl function. */
+#undef HAVE_CPOWL
+
+/* Define if you have the csin function. */
+#undef HAVE_CSIN
+
+/* Define if you have the csinf function. */
+#undef HAVE_CSINF
+
+/* Define if you have the csinh function. */
+#undef HAVE_CSINH
+
+/* Define if you have the csinhf function. */
+#undef HAVE_CSINHF
+
+/* Define if you have the csinhl function. */
+#undef HAVE_CSINHL
+
+/* Define if you have the csinl function. */
+#undef HAVE_CSINL
+
+/* Define if you have the csqrt function. */
+#undef HAVE_CSQRT
+
+/* Define if you have the csqrtf function. */
+#undef HAVE_CSQRTF
+
+/* Define if you have the csqrtl function. */
+#undef HAVE_CSQRTL
+
+/* Define if you have the ctan function. */
+#undef HAVE_CTAN
+
+/* Define if you have the ctanf function. */
+#undef HAVE_CTANF
+
+/* Define if you have the ctanh function. */
+#undef HAVE_CTANH
+
+/* Define if you have the ctanhf function. */
+#undef HAVE_CTANHF
+
+/* Define if you have the ctanhl function. */
+#undef HAVE_CTANHL
+
+/* Define if you have the ctanl function. */
+#undef HAVE_CTANL
+
+/* Define if you have the expf function. */
+#undef HAVE_EXPF
+
+/* Define if you have the fabsf function. */
+#undef HAVE_FABSF
+
+/* Define if you have the finite function. */
+#undef HAVE_FINITE
+
+/* Define if you have the fpclass function. */
+#undef HAVE_FPCLASS
+
+/* Define if you have the fqfinite function. */
+#undef HAVE_FQFINITE
+
+/* Define if you have the getpagesize function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define if you have the hypot function. */
+#undef HAVE_HYPOT
+
+/* Define if you have the hypotf function. */
+#undef HAVE_HYPOTF
+
+/* Define if you have the hypotl function. */
+#undef HAVE_HYPOTL
+
+/* Define if you have the isinf function. */
+#undef HAVE_ISINF
+
+/* Define if you have the isinff function. */
+#undef HAVE_ISINFF
+
+/* Define if you have the isinfl function. */
+#undef HAVE_ISINFL
+
+/* Define if you have the isnan function. */
+#undef HAVE_ISNAN
+
+/* Define if you have the isnanf function. */
+#undef HAVE_ISNANF
+
+/* Define if you have the isnanl function. */
+#undef HAVE_ISNANL
+
+/* Define if you have the log10f function. */
+#undef HAVE_LOG10F
+
+/* Define if you have the logf function. */
+#undef HAVE_LOGF
+
+/* Define if you have the modf function. */
+#undef HAVE_MODF
+
+/* Define if you have the nan function. */
+#undef HAVE_NAN
+
+/* Define if you have the powf function. */
+#undef HAVE_POWF
+
+/* Define if you have the qfpclass function. */
+#undef HAVE_QFPCLASS
+
+/* Define if you have the signbitl function. */
+#undef HAVE_SIGNBITL
+
+/* Define if you have the sincos function. */
+#undef HAVE_SINCOS
+
+/* Define if you have the sincosf function. */
+#undef HAVE_SINCOSF
+
+/* Define if you have the sincosl function. */
+#undef HAVE_SINCOSL
+
+/* Define if you have the sinf function. */
+#undef HAVE_SINF
+
+/* Define if you have the sinhf function. */
+#undef HAVE_SINHF
+
+/* Define if you have the sqrtf function. */
+#undef HAVE_SQRTF
+
+/* Define if you have the strtof function. */
+#undef HAVE_STRTOF
+
+/* Define if you have the strtold function. */
+#undef HAVE_STRTOLD
+
+/* Define if you have the tanf function. */
+#undef HAVE_TANF
+
+/* Define if you have the tanhf function. */
+#undef HAVE_TANHF
+
+/* Define if you have the wcslen function. */
+#undef HAVE_WCSLEN
+
+/* Define if you have the wmemchr function. */
+#undef HAVE_WMEMCHR
+
+/* Define if you have the wmemcmp function. */
+#undef HAVE_WMEMCMP
+
+/* Define if you have the wmemcpy function. */
+#undef HAVE_WMEMCPY
+
+/* Define if you have the wmemmove function. */
+#undef HAVE_WMEMMOVE
+
+/* Define if you have the wmemset function. */
+#undef HAVE_WMEMSET
+
+/* Define if you have the <complex.h> header file. */
+#undef HAVE_COMPLEX_H
+
+/* Define if you have the <endian.h> header file. */
+#undef HAVE_ENDIAN_H
+
+/* Define if you have the <float.h> header file. */
+#undef HAVE_FLOAT_H
+
+/* Define if you have the <fp.h> header file. */
+#undef HAVE_FP_H
+
+/* Define if you have the <ieeefp.h> header file. */
+#undef HAVE_IEEEFP_H
+
+/* Define if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
+/* Define if you have the <machine/endian.h> header file. */
+#undef HAVE_MACHINE_ENDIAN_H
+
+/* Define if you have the <machine/param.h> header file. */
+#undef HAVE_MACHINE_PARAM_H
+
+/* Define if you have the <nan.h> header file. */
+#undef HAVE_NAN_H
+
+/* Define if you have the <sys/isa_defs.h> header file. */
+#undef HAVE_SYS_ISA_DEFS_H
+
+/* Define if you have the <sys/machine.h> header file. */
+#undef HAVE_SYS_MACHINE_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Name of package */
+#undef PACKAGE
+
+/* Version number of package */
+#undef VERSION
+
+//
+// Systems that have certain non-standard functions prefixed with an
+// underscore, we'll handle those here. Must come after config.h.in.
+//
+
+#if defined (HAVE__ISNAN) && ! defined (HAVE_ISNAN)
+# define HAVE_ISNAN 1
+# define isnan _isnan
+#endif
+
+#if defined (HAVE__ISNANF) && ! defined (HAVE_ISNANF)
+# define HAVE_ISNANF 1
+# define isnanf _isnanf
+#endif
+
+#if defined (HAVE__ISNANL) && ! defined (HAVE_ISNANL)
+# define HAVE_ISNANL 1
+# define isnanl _isnanl
+#endif
+
+#if defined (HAVE__ISINF) && ! defined (HAVE_ISINF)
+# define HAVE_ISINF 1
+# define isinf _isinf
+#endif
+
+#if defined (HAVE__ISINFF) && ! defined (HAVE_ISINFF)
+# define HAVE_ISINFF 1
+# define isinff _isinff
+#endif
+
+#if defined (HAVE__ISINFL) && ! defined (HAVE_ISINFL)
+# define HAVE_ISINFL 1
+# define isinfl _isinfl
+#endif
+
+#if defined (HAVE__COPYSIGN) && ! defined (HAVE_COPYSIGN)
+# define HAVE_COPYSIGN 1
+# define copysign _copysign
+#endif
+
+#if defined (HAVE__COPYSIGNL) && ! defined (HAVE_COPYSIGNL)
+# define HAVE_COPYSIGNL 1
+# define copysignl _copysignl
+#endif
+
+#if defined (HAVE__COSF) && ! defined (HAVE_COSF)
+# define HAVE_COSF 1
+# define cosf _cosf
+#endif
+
+#if defined (HAVE__COSHF) && ! defined (HAVE_COSHF)
+# define HAVE_COSHF 1
+# define coshf _coshf
+#endif
+
+#if defined (HAVE__LOGF) && ! defined (HAVE_LOGF)
+# define HAVE_LOGF 1
+# define logf _logf
+#endif
+
+#if defined (HAVE__LOG10F) && ! defined (HAVE_LOG10F)
+# define HAVE_LOG10F 1
+# define log10f _log10f
+#endif
+
+#if defined (HAVE__POWF) && ! defined (HAVE_POWF)
+# define HAVE_POWF 1
+# define powf _powf
+#endif
+
+#if defined (HAVE__SINF) && ! defined (HAVE_SINF)
+# define HAVE_SINF 1
+# define sinf _sinf
+#endif
+
+#if defined (HAVE__SINHF) && ! defined (HAVE_SINHF)
+# define HAVE_SINHF 1
+# define sinhf _sinhf
+#endif
+
+#if defined (HAVE__SQRTF) && ! defined (HAVE_SQRTF)
+# define HAVE_SQRTF 1
+# define sqrtf _sqrtf
+#endif
+
+#if defined (HAVE__TANF) && ! defined (HAVE_TANF)
+# define HAVE_TANF 1
+# define tanf _tanf
+#endif
+
+#if defined (HAVE__TANHF) && ! defined (HAVE_TANHF)
+# define HAVE_TANHF 1
+# define tanhf _tanhf
+#endif
+
+#if defined (HAVE__STRTOF) && ! defined (HAVE_STRTOF)
+# define HAVE_STRTOF 1
+# define strtof _strtof
+#endif
+
+#if defined (HAVE__STRTOLD) && ! defined (HAVE_STRTOLD)
+# define HAVE_STRTOLD 1
+# define strtold _strtold
+#endif
+
+#if defined (HAVE__FABSF) && ! defined (HAVE_FABSF)
+# define HAVE_FABSF 1
+# define fabsf _fabsf
+#endif
+
+#if defined (HAVE__SINCOS) && ! defined (HAVE_SINCOS)
+# define HAVE_SINCOS 1
+# define sincos _sincos
+#endif
+
+#if defined (HAVE__SINCOSF) && ! defined (HAVE_SINCOSF)
+# define HAVE_SINCOSF 1
+# define sincosf _sincosf
+#endif
+
+#if defined (HAVE__SINCOSL) && ! defined (HAVE_SINCOSL)
+# define HAVE_SINCOSL 1
+# define sincosl _sincosl
+#endif
+
+#if defined (HAVE__FINITE) && ! defined (HAVE_FINITE)
+# define HAVE_FINITE 1
+# define finite _finite
+#endif
+
+#if defined (HAVE__QFINITE) && ! defined (HAVE_QFINITE)
+# define HAVE_QFINITE 1
+# define qfinite _qfinite
+#endif
+
+#if defined (HAVE__FPCLASS) && ! defined (HAVE_FPCLASS)
+# define HAVE_FPCLASS 1
+# define fpclass _fpclass
+#endif
+
+#if defined (HAVE__QFPCLASS) && ! defined (HAVE_QFPCLASS)
+# define HAVE_QFPCLASS 1
+# define qfpclass _qfpclass
+#endif
+
diff --git a/libstdc++-v3/config/aix/bits/ctype_base.h b/libstdc++-v3/config/aix/bits/ctype_base.h
new file mode 100644
index 000000000000..bae6bb4a4583
--- /dev/null
+++ b/libstdc++-v3/config/aix/bits/ctype_base.h
@@ -0,0 +1,62 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000, 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+ struct ctype_base
+ {
+ typedef unsigned char mask;
+ // Non-standard typedefs.
+ typedef const int* __to_type;
+
+ enum
+ {
+ space = _ISSPACE,
+ print = _ISPRINT,
+ cntrl = _ISCNTRL,
+ upper = _ISUPPER,
+ lower = _ISLOWER,
+ alpha = _ISALPHA,
+ digit = _ISDIGIT,
+ punct = _ISPUNCT,
+ xdigit = _ISXDIGIT,
+ alnum = _ISALNUM,
+ graph = _ISGRAPH
+ };
+ };
+
+
+
+
+
+
diff --git a/libstdc++-v3/config/aix/bits/ctype_specializations.h b/libstdc++-v3/config/aix/bits/ctype_specializations.h
new file mode 100644
index 000000000000..2083a174a4ba
--- /dev/null
+++ b/libstdc++-v3/config/aix/bits/ctype_specializations.h
@@ -0,0 +1,76 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+ bool
+ ctype<char>::
+ is(mask __m, char __c) const throw()
+ { return _IS(__c, __m); }
+
+ const char*
+ ctype<char>::
+ is(const char* __low, const char* __high, mask* __vec) const throw()
+ {
+ while (__low < __high)
+ *__vec++ = __OBJ_DATA(__lc_ctype)->mask[*__low++];
+ return __high;
+ }
+
+ const char*
+ ctype<char>::
+ scan_is(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high && !this->is(__m, *__low))
+ ++__low;
+ return __low;
+ }
+
+ const char*
+ ctype<char>::
+ scan_not(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high && this->is(__m, *__low) != 0)
+ ++__low;
+ return __low;
+ }
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/config/aix/ctype.cc b/libstdc++-v3/config/aix/ctype.cc
new file mode 100644
index 000000000000..2c600f0e0db8
--- /dev/null
+++ b/libstdc++-v3/config/aix/ctype.cc
@@ -0,0 +1,110 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+ ctype<char>::ctype(const mask* __table = 0, bool __del = false,
+ size_t __refs = 0) throw()
+ : _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
+ _M_toupper(NULL), _M_tolower(NULL),
+ _M_ctable(NULL), _M_table(__table == 0 ? _M_ctable: __table)
+ { }
+
+ char
+ ctype<char>::do_toupper(char __c) const
+ { return _toupper(__c); }
+
+ const char*
+ ctype<char>::do_toupper(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = this->do_toupper(*__low);
+ ++__low;
+ }
+ return __high;
+ }
+
+ char
+ ctype<char>::do_tolower(char __c) const
+ { return _tolower(__a); }
+
+ const char*
+ ctype<char>::do_tolower(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = this->do_tolower(*__low);
+ ++__low;
+ }
+ return __high;
+ }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ ctype<wchar_t>::ctype(size_t /*__refs*/) throw()
+ : _M_toupper(NULL), _M_tolower(NULL),
+ _M_ctable(NULL)
+ { }
+
+ wchar_t
+ ctype<wchar_t>::do_toupper(wchar_t __c) const
+ { return towupper(__c); }
+
+ const wchar_t*
+ ctype<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const
+ {
+ for (;low < high; ++low)
+ if (*low < _S_table_size)
+ *low = this->do_toupper(*low);
+ return high;
+ }
+
+ wchar_t
+ ctype<wchar_t>::do_tolower(wchar_t __c) const
+ { return towlower(__c); }
+
+ const wchar_t*
+ ctype<wchar_t>::do_tolower(wchar_t* __low, const wchar_t* __high) const
+ {
+ for (; __low < __high; ++__low)
+ if (*__low < _S_table_size)
+ *__low = this->do_tolower(*__low);
+ return __high;
+ }
+#endif
+
+
+
+
+
+
diff --git a/libstdc++-v3/config/c_io_libio.cc b/libstdc++-v3/config/c_io_libio.cc
new file mode 100644
index 000000000000..9ea87a293c07
--- /dev/null
+++ b/libstdc++-v3/config/c_io_libio.cc
@@ -0,0 +1,268 @@
+// Wrapper of C-language FILE struct -*- C++ -*-
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.8 File-based streams
+//
+
+#include <bits/basic_file.h>
+#include <libioP.h>
+#include <fcntl.h> // Solaris needs for O_* macros
+
+namespace std {
+
+ __basic_file::__basic_file(__c_lock* __lock)
+ {
+ this->_lock = __lock;
+ _IO_init(this, 0);
+ _IO_file_init(this);
+ }
+
+ int
+ __basic_file::get_fileno(void)
+ { return _fileno; }
+
+ __basic_file::~__basic_file()
+ {
+ if (_IO_file_is_open(this))
+ {
+ _IO_do_flush(this);
+ if (!(_IO_file_flags & _IO_DELETE_DONT_CLOSE))
+ _IO_SYSCLOSE(this);
+ }
+ else
+ _IO_un_link(this);
+ }
+
+ __basic_file*
+ __basic_file::sys_open(int __fd, ios_base::openmode __mode)
+ {
+ __basic_file* __retval = NULL;
+ bool __testi = __mode & ios_base::in;
+ bool __testo = __mode & ios_base::out;
+#ifdef O_BINARY
+ bool __testb = __mode & ios_base::binary;
+#endif
+ int __p_mode = 0;
+ int __rw_mode = _IO_NO_READS + _IO_NO_WRITES;
+
+ if (__testi)
+ {
+ __p_mode = O_RDONLY;
+ __rw_mode = _IO_NO_WRITES;
+ }
+ if (__testo)
+ {
+ __p_mode = O_WRONLY | O_TRUNC;
+ __rw_mode = _IO_NO_READS;
+ }
+#ifdef O_BINARY
+ if (__testb)
+ __p_mode |= O_BINARY;
+#endif
+
+ if (__fd >= 0)
+ {
+ __retval = this;
+ _fileno = __fd;
+ }
+
+ int __mask = _IO_NO_READS + _IO_NO_WRITES + _IO_IS_APPENDING;
+ _IO_file_flags = (_IO_file_flags & ~__mask) | (__rw_mode & __mask);
+ _IO_link_in(this);
+ return __retval;
+ }
+
+ __basic_file*
+ __basic_file::open(const char* __name, ios_base::openmode __mode,
+ int __prot = 0664)
+ {
+ __basic_file* __retval = NULL;
+#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;
+ int __p_mode = 0;
+ int __rw_mode = _IO_NO_READS + _IO_NO_WRITES;
+
+ 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
+ if ( !_IO_file_is_open(this))
+ {
+#if _G_HAVE_IO_FILE_OPEN
+ __c_file_type* __f;
+ __f = _IO_file_open(this, __name, __p_mode, __prot, __rw_mode, 0);
+ __retval = __f ? this: NULL;
+#else
+ int __i = ::open(__name, __p_mode, __prot);
+ if (__i >= 0)
+ {
+ __retval = this;
+ _fileno = __i;
+ }
+ int __mask = _IO_NO_READS + _IO_NO_WRITES + _IO_IS_APPENDING;
+ _IO_file_flags = (_IO_file_flags & ~__mask) | (__rw_mode & __mask);
+ _IO_link_in(this);
+#endif
+ }
+ return __retval;
+ }
+
+ bool
+ __basic_file::is_open() { return _fileno >= 0; }
+
+ __basic_file*
+ __basic_file::close()
+ {
+ bool __testopen = _IO_file_close_it(this);
+ return __testopen ? static_cast<__basic_file*>(NULL) : this;
+ }
+
+ // NB: Unused.
+ int
+ __basic_file::overflow(int __c) { return _IO_file_overflow(this, __c); }
+
+ // NB: Unused.
+ int
+ __basic_file::underflow() { return _IO_file_underflow(this); }
+
+ // NB: Unused.
+ int
+ __basic_file::uflow() { return _IO_default_uflow(this); }
+
+ // NB: Unused.
+ int
+ __basic_file::pbackfail(int __c)
+ { return _IO_default_pbackfail(this, __c); }
+
+ streamsize
+ __basic_file::xsputn(const char* __s, streamsize __n)
+ { return _IO_file_xsputn(this, __s, __n); }
+
+ streamsize
+ __basic_file::xsgetn(char* __s, streamsize __n)
+ { return _IO_default_xsgetn(this, __s, __n); }
+
+ __c_streampos
+ __basic_file::seekoff(streamoff __off, ios_base::seekdir __way,
+ ios_base::openmode __mode)
+ { return _IO_file_seekoff(this, __off, __way, __mode); }
+
+ __c_streampos
+ __basic_file::seekpos(__c_streampos __pos, ios_base::openmode __mode)
+ { return _IO_file_seekoff(this, __pos, ios_base::beg, __mode); }
+
+ // NB: Unused.
+ streambuf*
+ __basic_file::setbuf(char* __b, int __len)
+ { return (streambuf*) _IO_file_setbuf(this,__b, __len); }
+
+ int
+ __basic_file::sync()
+ { return _IO_file_sync(this); }
+
+ // NB: Unused.
+ int
+ __basic_file::doallocate()
+ { return _IO_file_doallocate(this); }
+
+ // NB: Unused.
+ streamsize
+ __basic_file::sys_read(char* __s, streamsize __n)
+ { return _IO_file_read(this, __s, __n); }
+
+ // NB: Unused.
+ streamsize
+ __basic_file::sys_write(const char* __s, streamsize __n)
+ { return _IO_file_write(this, __s, __n); }
+
+ // NB: Unused.
+ __c_streampos
+ __basic_file::sys_seek(__c_streampos __pos, ios_base::seekdir __way)
+ { return _IO_file_seek(this, __pos, __way); }
+
+ // NB: Unused.
+ int
+ __basic_file::sys_close() { return _IO_file_close(this); }
+
+ // NB: Unused.
+ int
+ __basic_file::sys_stat(void* __v) { return _IO_file_stat(this, __v); }
+
+ // NB: Unused.
+ int
+ __basic_file::showmanyc() { return EOF; }
+
+ // NB: Unused.
+ void
+ __basic_file::imbue(void* /*__v*/) { }
+
+} // namespace std
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/config/c_io_libio.h b/libstdc++-v3/config/c_io_libio.h
new file mode 100644
index 000000000000..d282519f6a31
--- /dev/null
+++ b/libstdc++-v3/config/c_io_libio.h
@@ -0,0 +1,108 @@
+// underlying io library -*- C++ -*-
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 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_off_t streamoff;
+ typedef _IO_ssize_t streamsize; // Signed integral type
+#if _GLIBCPP_USE_WCHAR_T
+ typedef _IO_off_t wstreamoff;
+ typedef _IO_ssize_t wstreamsize;
+#endif
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+ typedef _IO_fpos64_t __c_streampos;
+#else
+ typedef _IO_fpos_t __c_streampos;
+#endif
+
+ typedef _IO_lock_t __c_lock;
+
+// from basic_file.h
+ typedef _IO_FILE __c_file_type;
+#define _GLIBCPP_BASIC_FILE_INHERITANCE 1
+
+// 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/libstdc++-v3/config/cpu/alpha/atomicity.h b/libstdc++-v3/config/cpu/alpha/atomicity.h
new file mode 100644
index 000000000000..b9b92d05dcb3
--- /dev/null
+++ b/libstdc++-v3/config/cpu/alpha/atomicity.h
@@ -0,0 +1,113 @@
+/* Low-level functions for atomic operations. Alpha version.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _ATOMICITY_H
+#define _ATOMICITY_H 1
+
+#ifdef _GLIBCPP_HAVE_INTTYPES_H
+#include <inttypes.h>
+#else
+typedef unsigned int uint32_t;
+typedef int int32_t;
+#endif
+
+
+static inline int
+__attribute__ ((unused))
+exchange_and_add (volatile uint32_t *mem, int val)
+{
+ register int result, tmp;
+
+ __asm__ __volatile__ (
+ "/* Inline exchange & add */\n"
+ "1:\t"
+ "ldl_l %0,%3\n\t"
+ "addl %0,%4,%1\n\t"
+ "stl_c %1,%2\n\t"
+ "beq %1,2f\n"
+ ".subsection 1\n"
+ "2:\t"
+ "br 1b\n"
+ ".previous\n\t"
+ "mb\n\t"
+ "/* End exchange & add */"
+ : "=&r"(result), "=&r"(tmp), "=m"(*mem)
+ : "m" (*mem), "r"(val));
+
+ return result;
+}
+
+static inline void
+__attribute__ ((unused))
+atomic_add (volatile uint32_t *mem, int val)
+{
+ register int result;
+
+ __asm__ __volatile__ (
+ "/* Inline exchange & add */\n"
+ "1:\t"
+ "ldl_l %0,%2\n\t"
+ "addl %0,%3,%0\n\t"
+ "stl_c %0,%1\n\t"
+ "beq %0,2f\n\t"
+ ".subsection 1\n"
+ "2:\t"
+ "br 1b\n"
+ ".previous\n\t"
+ "mb\n\t"
+ "/* End exchange & add */"
+ : "=&r"(result), "=m"(*mem)
+ : "m" (*mem), "r"(val));
+}
+
+static inline long
+__attribute__ ((unused))
+compare_and_swap (volatile long int *p, long int oldval, long int newval)
+{
+ long int ret;
+
+ __asm__ __volatile__ (
+ "/* Inline compare & swap */\n"
+ "1:\t"
+ "ldq_l %0,%4\n\t"
+ "cmpeq %0,%2,%0\n\t"
+ "beq %0,3f\n\t"
+ "mov %3,%0\n\t"
+ "stq_c %0,%1\n\t"
+ "beq %0,2f\n\t"
+ ".subsection 1\n"
+ "2:\t"
+ "br 1b\n"
+ ".previous\n\t"
+ "3:\t"
+ "mb\n\t"
+ "/* End compare & swap */"
+ : "=&r"(ret), "=m"(*p)
+ : "r"(oldval), "r"(newval), "m"(*p));
+
+ return ret;
+}
+
+#endif /* atomicity.h */
+
+
+
+
+
+
diff --git a/libstdc++-v3/config/cpu/arm/atomicity.h b/libstdc++-v3/config/cpu/arm/atomicity.h
new file mode 100644
index 000000000000..7d886a3036d3
--- /dev/null
+++ b/libstdc++-v3/config/cpu/arm/atomicity.h
@@ -0,0 +1,109 @@
+/* Low-level functions for atomic operations. ARM version.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _ATOMICITY_H
+#define _ATOMICITY_H 1
+
+#ifdef _GLIBCPP_HAVE_INTTYPES_H
+#include <inttypes.h>
+#else
+typedef unsigned int uint32_t;
+typedef int int32_t;
+#endif
+
+static inline int
+__attribute__ ((unused))
+exchange_and_add (volatile uint32_t *mem, int val)
+{
+ int tmp, tmp2, result;
+ __asm__ ("\
+0: ldr %0,[%3]
+ add %1,%0,%4
+ swp %2,%1,[%3]
+ cmp %0,%2
+ swpne %1,%2,[%3]
+ bne 0b
+" : "=&r"(result), "=&r"(tmp), "=&r"(tmp2) : "r" (mem), "r"(val) : "cc", "memory");
+ return result;
+}
+
+static inline void
+__attribute__ ((unused))
+atomic_add (volatile uint32_t *mem, int val)
+{
+ int tmp, tmp2, tmp3;
+ __asm__ ("\
+0: ldr %0,[%3]
+ add %1,%0,%4
+ swp %2,%1,[%3]
+ cmp %0,%2
+ swpne %1,%2,[%3]
+ bne 0b
+" : "=&r"(tmp), "=&r"(tmp2), "=&r"(tmp3) : "r" (mem), "r"(val) : "cc", "memory");
+}
+
+static inline int
+__attribute__ ((unused))
+compare_and_swap (volatile long int *p, long int oldval, long int newval)
+{
+ int result, tmp;
+ __asm__ ("\
+0: ldr %1,[%2]
+ mov %0,#0
+ cmp %1,%4
+ bne 1f
+ swp %0,%3,[%2]
+ cmp %1,%0
+ swpne %1,%0,[%2]
+ bne 0b
+ mov %0,#1
+1:
+" : "=&r"(result), "=&r"(tmp) : "r" (p), "r" (newval), "r" (oldval) : "cc", "memory");
+}
+
+static inline long int
+__attribute__ ((unused))
+always_swap (volatile long int *p, long int newval)
+{
+ long int result;
+ __asm__ ("\
+ swp %0,%2,[%1]
+" : "=&r"(result) : "r"(p), "r"(newval) : "memory");
+ return result;
+}
+
+static inline int
+__attribute__ ((unused))
+test_and_set (volatile long int *p, long int newval)
+{
+ int result, tmp, tmp2, tmp3;
+ __asm__ ("\
+0: ldr %0,[%2]
+ cmp %0,#0
+ bne 1f
+ swp %1,%3,[%2]
+ cmp %0,%1
+ swpne %0,%1,[%2]
+ bne 0b
+1:
+" : "=&r"(result), "=r" (tmp) : "r"(p), "r"(newval) : "cc", "memory");
+ return result;
+}
+
+#endif /* atomicity.h */
diff --git a/libstdc++-v3/config/cpu/generic/atomicity.h b/libstdc++-v3/config/cpu/generic/atomicity.h
new file mode 100644
index 000000000000..5831f9597922
--- /dev/null
+++ b/libstdc++-v3/config/cpu/generic/atomicity.h
@@ -0,0 +1,58 @@
+/* Low-level functions for atomic operations. Stub version.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _ATOMICITY_H
+#define _ATOMICITY_H 1
+
+#ifdef _GLIBCPP_HAVE_INTTYPES_H
+#include <inttypes.h>
+#else
+typedef unsigned int uint32_t;
+typedef int int32_t;
+#endif
+
+
+static inline int
+__attribute__ ((unused))
+exchange_and_add (uint32_t *mem, int val)
+{
+ int result = *mem;
+ *mem += val;
+ return result;
+}
+
+static inline void
+__attribute__ ((unused))
+atomic_add (uint32_t *mem, int val)
+{
+ *mem += val;
+}
+
+static inline int
+__attribute__ ((unused))
+compare_and_swap (long int *p, long int oldval, long int newval)
+{
+ if (*p != oldval)
+ return 0;
+
+ *p = newval;
+ return 1;
+}
+
+#endif /* atomicity.h */
diff --git a/libstdc++-v3/config/cpu/i386/atomicity.h b/libstdc++-v3/config/cpu/i386/atomicity.h
new file mode 100644
index 000000000000..dfa9182465ae
--- /dev/null
+++ b/libstdc++-v3/config/cpu/i386/atomicity.h
@@ -0,0 +1,62 @@
+/* Low-level functions for atomic operations. ix86 version, x >= 4.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _ATOMICITY_H
+#define _ATOMICITY_H 1
+
+#ifdef _GLIBCPP_HAVE_INTTYPES_H
+#include <inttypes.h>
+#else
+typedef unsigned int uint32_t;
+typedef int int32_t;
+#endif
+
+
+static inline int
+__attribute__ ((unused))
+exchange_and_add (volatile uint32_t *mem, int val)
+{
+ register int result;
+ __asm__ __volatile__ ("lock; xaddl %0,%2"
+ : "=r" (result) : "0" (val), "m" (*mem) : "memory");
+ return result;
+}
+
+static inline void
+__attribute__ ((unused))
+atomic_add (volatile uint32_t *mem, int val)
+{
+ __asm__ __volatile__ ("lock; addl %0,%1"
+ : : "ir" (val), "m" (*mem) : "memory");
+}
+
+static inline char
+__attribute__ ((unused))
+compare_and_swap (volatile long int *p, long int oldval, long int newval)
+{
+ char ret;
+ long int readval;
+
+ __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0"
+ : "=q" (ret), "=m" (*p), "=a" (readval)
+ : "r" (newval), "m" (*p), "a" (oldval));
+ return ret;
+}
+
+#endif /* atomicity.h */
diff --git a/libstdc++-v3/config/cpu/powerpc/atomicity.h b/libstdc++-v3/config/cpu/powerpc/atomicity.h
new file mode 100644
index 000000000000..59bd61cd7299
--- /dev/null
+++ b/libstdc++-v3/config/cpu/powerpc/atomicity.h
@@ -0,0 +1,110 @@
+/* Low-level functions for atomic operations. PowerPC version.
+ Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _ATOMICITY_H
+#define _ATOMICITY_H 1
+
+#ifdef _GLIBCPP_HAVE_INTTYPES_H
+#include <inttypes.h>
+#else
+typedef unsigned int uint32_t;
+typedef int int32_t;
+#endif
+
+
+#if BROKEN_PPC_ASM_CR0
+# define __ATOMICITY_INLINE /* nothing */
+#else
+# define __ATOMICITY_INLINE inline
+#endif
+
+static __ATOMICITY_INLINE int
+__attribute__ ((unused))
+exchange_and_add (volatile uint32_t *mem, int val)
+{
+ int tmp, result;
+ __asm__ ("\
+0: lwarx %0,0,%2
+ add%I3 %1,%0,%3
+ stwcx. %1,0,%2
+ bne- 0b
+" : "=&b"(result), "=&r"(tmp) : "r" (mem), "Ir"(val) : "cr0", "memory");
+ return result;
+}
+
+static __ATOMICITY_INLINE void
+__attribute__ ((unused))
+atomic_add (volatile uint32_t *mem, int val)
+{
+ int tmp;
+ __asm__ ("\
+0: lwarx %0,0,%1
+ add%I2 %0,%0,%2
+ stwcx. %0,0,%1
+ bne- 0b
+" : "=&b"(tmp) : "r" (mem), "Ir"(val) : "cr0", "memory");
+}
+
+static __ATOMICITY_INLINE int
+__attribute__ ((unused))
+compare_and_swap (volatile long int *p, long int oldval, long int newval)
+{
+ int result;
+ __asm__ ("\
+0: lwarx %0,0,%1
+ sub%I2c. %0,%0,%2
+ cntlzw %0,%0
+ bne- 1f
+ stwcx. %3,0,%1
+ bne- 0b
+1:
+" : "=&b"(result) : "r"(p), "Ir"(oldval), "r"(newval) : "cr0", "memory");
+ return result >> 5;
+}
+
+static __ATOMICITY_INLINE long int
+__attribute__ ((unused))
+always_swap (volatile long int *p, long int newval)
+{
+ long int result;
+ __asm__ ("\
+0: lwarx %0,0,%1
+ stwcx. %2,0,%1
+ bne- 0b
+" : "=&r"(result) : "r"(p), "r"(newval) : "cr0", "memory");
+ return result;
+}
+
+static __ATOMICITY_INLINE int
+__attribute__ ((unused))
+test_and_set (volatile long int *p, long int newval)
+{
+ int result;
+ __asm__ ("\
+0: lwarx %0,0,%1
+ cmpwi %0,0
+ bne- 1f
+ stwcx. %2,0,%1
+ bne- 0b
+1:
+" : "=&r"(result) : "r"(p), "r"(newval) : "cr0", "memory");
+ return result;
+}
+
+#endif /* atomicity.h */
diff --git a/libstdc++-v3/config/cpu/sparc/sparc32/atomicity.h b/libstdc++-v3/config/cpu/sparc/sparc32/atomicity.h
new file mode 100644
index 000000000000..1ead56e8d9bb
--- /dev/null
+++ b/libstdc++-v3/config/cpu/sparc/sparc32/atomicity.h
@@ -0,0 +1,104 @@
+/* Low-level functions for atomic operations. Sparc32 version.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _ATOMICITY_H
+#define _ATOMICITY_H 1
+
+#ifdef _GLIBCPP_HAVE_INTTYPES_H
+#include <inttypes.h>
+#else
+typedef unsigned int uint32_t;
+typedef int int32_t;
+#endif
+
+
+static int
+__attribute__ ((unused))
+exchange_and_add (volatile uint32_t *mem, int val)
+{
+ static unsigned char lock;
+ int result, tmp;
+
+ __asm__ __volatile__("1: ldstub [%1], %0\n\t"
+ " cmp %0, 0\n\t"
+ " bne 1b\n\t"
+ " nop"
+ : "=&r" (tmp)
+ : "r" (&lock)
+ : "memory");
+ result = *mem;
+ *mem += val;
+ __asm__ __volatile__("stb %%g0, [%0]"
+ : /* no outputs */
+ : "r" (&lock)
+ : "memory");
+ return result;
+}
+
+static void
+__attribute__ ((unused))
+atomic_add (volatile uint32_t *mem, int val)
+{
+ static unsigned char lock;
+ int tmp;
+
+ __asm__ __volatile__("1: ldstub [%1], %0\n\t"
+ " cmp %0, 0\n\t"
+ " bne 1b\n\t"
+ " nop"
+ : "=&r" (tmp)
+ : "r" (&lock)
+ : "memory");
+ *mem += val;
+ __asm__ __volatile__("stb %%g0, [%0]"
+ : /* no outputs */
+ : "r" (&lock)
+ : "memory");
+}
+
+static int
+__attribute__ ((unused))
+compare_and_swap (volatile long int *p, long int oldval, long int newval)
+{
+ static unsigned char lock;
+ int ret, tmp;
+
+ __asm__ __volatile__("1: ldstub [%1], %0\n\t"
+ " cmp %0, 0\n\t"
+ " bne 1b\n\t"
+ " nop"
+ : "=&r" (tmp)
+ : "r" (&lock)
+ : "memory");
+ if (*p != oldval)
+ ret = 0;
+ else
+ {
+ *p = newval;
+ ret = 1;
+ }
+ __asm__ __volatile__("stb %%g0, [%0]"
+ : /* no outputs */
+ : "r" (&lock)
+ : "memory");
+
+ return ret;
+}
+
+#endif /* atomicity.h */
diff --git a/libstdc++-v3/config/cpu/sparc/sparc64/atomicity.h b/libstdc++-v3/config/cpu/sparc/sparc64/atomicity.h
new file mode 100644
index 000000000000..945247a60252
--- /dev/null
+++ b/libstdc++-v3/config/cpu/sparc/sparc64/atomicity.h
@@ -0,0 +1,88 @@
+/* Low-level functions for atomic operations. Sparc64 version.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _ATOMICITY_H
+#define _ATOMICITY_H 1
+
+#ifdef _GLIBCPP_HAVE_INTTYPES_H
+#include <inttypes.h>
+#else
+typedef unsigned int uint32_t;
+typedef int int32_t;
+#endif
+
+
+static inline int
+__attribute__ ((unused))
+exchange_and_add (volatile uint32_t *mem, int val)
+{
+ uint32_t tmp1, tmp2;
+
+ __asm__ __volatile__("1: lduw [%2], %0\n\t"
+ " add %0, %3, %1\n\t"
+ " cas [%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 uint32_t *mem, int val)
+{
+ uint32_t tmp1, tmp2;
+
+ __asm__ __volatile__("1: lduw [%2], %0\n\t"
+ " add %0, %3, %1\n\t"
+ " cas [%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");
+}
+
+static inline int
+__attribute__ ((unused))
+compare_and_swap (volatile long int *p, long int oldval, long int newval)
+{
+ register long int tmp, tmp2;
+
+ __asm__ __volatile__("1: ldx [%4], %0\n\t"
+ " mov %2, %1\n\t"
+ " cmp %0, %3\n\t"
+ " bne,a,pn %%xcc, 2f\n\t"
+ " mov 0, %0\n\t"
+ " casx [%4], %0, %1\n\t"
+ " sub %0, %1, %0\n\t"
+ " brnz,pn %0, 1b\n\t"
+ " mov 1, %0\n\t"
+ "2:"
+ : "=&r" (tmp), "=&r" (tmp2)
+ : "r" (newval), "r" (oldval), "r" (p)
+ : "memory");
+ return tmp;
+}
+
+#endif /* atomicity.h */
diff --git a/libstdc++-v3/config/generic/bits/ctype_base.h b/libstdc++-v3/config/generic/bits/ctype_base.h
new file mode 100644
index 000000000000..8b5e0a07252e
--- /dev/null
+++ b/libstdc++-v3/config/generic/bits/ctype_base.h
@@ -0,0 +1,59 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Default information, may not be appropriate for specific host.
+
+ struct ctype_base
+ {
+ typedef unsigned int mask;
+ // Non-standard typedefs.
+ typedef const int* __to_type;
+
+ enum
+ {
+ space = (1 << 5), // Whitespace
+ print = (1 << 6), // Printing
+ cntrl = (1 << 9), // Control character
+ upper = (1 << 0), // UPPERCASE
+ lower = (1 << 1), // lowercase
+ alpha = (1 << 5), // Alphabetic
+ digit = (1 << 2), // Numeric
+ punct = (1 << 10),// Punctuation
+ xdigit = (1 << 4),// Hexadecimal numeric
+ alnum = (1 << 11),// Alphanumeric
+ graph = (1 << 7) // Graphical
+ };
+ };
+
+
+
diff --git a/libstdc++-v3/config/generic/bits/ctype_specializations.h b/libstdc++-v3/config/generic/bits/ctype_specializations.h
new file mode 100644
index 000000000000..76d4cbcbb798
--- /dev/null
+++ b/libstdc++-v3/config/generic/bits/ctype_specializations.h
@@ -0,0 +1,73 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+ bool
+ ctype<char>::
+ is(mask __m, char __c) const throw()
+ { return _M_table[(unsigned char)(__c)] & __m; }
+
+ const char*
+ ctype<char>::
+ is(const char* __low, const char* __high, mask* __vec) const throw()
+ {
+ while (__low < __high)
+ *__vec++ = _M_table[(unsigned char)(*__low++)];
+ return __high;
+ }
+
+ const char*
+ ctype<char>::
+ scan_is(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high && !(_M_table[(unsigned char)(*__low)] & __m))
+ ++__low;
+ return __low;
+ }
+
+ const char*
+ ctype<char>::
+ scan_not(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high
+ && (_M_table[(unsigned char)(*__low)] & __m) != 0)
+ ++__low;
+ return __low;
+ }
+
+
+
+
+
diff --git a/libstdc++-v3/config/generic/ctype.cc b/libstdc++-v3/config/generic/ctype.cc
new file mode 100644
index 000000000000..ad7ec434bc31
--- /dev/null
+++ b/libstdc++-v3/config/generic/ctype.cc
@@ -0,0 +1,106 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+ ctype<char>::ctype(const mask* __table = 0, bool __del = false,
+ size_t __refs = 0) throw()
+ : _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
+ _M_toupper(NULL), _M_tolower(NULL),
+ _M_ctable(NULL), _M_table(__table == 0 ? _M_ctable: __table)
+ { }
+
+ char
+ ctype<char>::do_toupper(char __c) const
+ { return _S_toupper[(int) __c]; }
+
+ const char*
+ ctype<char>::do_toupper(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = _S_toupper[(int) *__low];
+ ++__low;
+ }
+ return __high;
+ }
+
+ char
+ ctype<char>::do_tolower(char __c) const
+ { return _S_tolower[(int) __c]; }
+
+ const char*
+ ctype<char>::do_tolower(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = _S_tolower[(int) *__low];
+ ++__low;
+ }
+ return __high;
+ }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ ctype<wchar_t>::ctype(size_t /*__refs*/) throw()
+ : _M_toupper(NULL), _M_tolower(NULL),
+ _M_ctable(NULL)
+ { }
+
+ wchar_t
+ ctype<wchar_t>::do_toupper(char_type __c) const
+ { return (__c < _S_table_size) ? _S_toupper[__c] : __c; }
+
+ const wchar_t*
+ ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
+ {
+ for (;low < high; ++low)
+ if (*low < _S_table_size)
+ *low = _S_toupper[*low];
+ return high;
+ }
+
+ wchar_t
+ ctype<wchar_t>::do_tolower(char_type __c) const
+ { return (__c < _S_table_size) ? _S_tolower[__c] : __c; }
+
+ const wchar_t*
+ ctype<wchar_t>::do_tolower(char_type* __low, const char_type* __high) const
+ {
+ for (; __low < __high; ++__low)
+ if (*__low < _S_table_size)
+ *__low = _S_toupper[*__low];
+ return __high;
+ }
+#endif
+
+
diff --git a/libstdc++-v3/config/gnu-linux/bits/ctype_base.h b/libstdc++-v3/config/gnu-linux/bits/ctype_base.h
new file mode 100644
index 000000000000..8d4a65bd040f
--- /dev/null
+++ b/libstdc++-v3/config/gnu-linux/bits/ctype_base.h
@@ -0,0 +1,60 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+ struct ctype_base
+ {
+ typedef unsigned short mask;
+ // Non-standard typedefs.
+ typedef const int* __to_type;
+
+ enum
+ {
+ space = _ISspace,
+ print = _ISprint,
+ cntrl = _IScntrl,
+ upper = _ISupper,
+ lower = _ISlower,
+ alpha = _ISalpha,
+ digit = _ISdigit,
+ punct = _ISpunct,
+ xdigit = _ISxdigit,
+ alnum = _ISalnum,
+ graph = _ISgraph
+ };
+ };
+
+
+
+
diff --git a/libstdc++-v3/config/gnu-linux/bits/ctype_specializations.h b/libstdc++-v3/config/gnu-linux/bits/ctype_specializations.h
new file mode 100644
index 000000000000..76d4cbcbb798
--- /dev/null
+++ b/libstdc++-v3/config/gnu-linux/bits/ctype_specializations.h
@@ -0,0 +1,73 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+ bool
+ ctype<char>::
+ is(mask __m, char __c) const throw()
+ { return _M_table[(unsigned char)(__c)] & __m; }
+
+ const char*
+ ctype<char>::
+ is(const char* __low, const char* __high, mask* __vec) const throw()
+ {
+ while (__low < __high)
+ *__vec++ = _M_table[(unsigned char)(*__low++)];
+ return __high;
+ }
+
+ const char*
+ ctype<char>::
+ scan_is(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high && !(_M_table[(unsigned char)(*__low)] & __m))
+ ++__low;
+ return __low;
+ }
+
+ const char*
+ ctype<char>::
+ scan_not(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high
+ && (_M_table[(unsigned char)(*__low)] & __m) != 0)
+ ++__low;
+ return __low;
+ }
+
+
+
+
+
diff --git a/libstdc++-v3/config/gnu-linux/ctype.cc b/libstdc++-v3/config/gnu-linux/ctype.cc
new file mode 100644
index 000000000000..f6abe08cc103
--- /dev/null
+++ b/libstdc++-v3/config/gnu-linux/ctype.cc
@@ -0,0 +1,112 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+ ctype<char>::ctype(const mask* __table = 0, bool __del = false,
+ size_t __refs = 0) throw()
+ : _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
+ _M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower),
+ _M_ctable(__ctype_b), _M_table(__table == 0 ? _M_ctable: __table)
+ { }
+
+ char
+ ctype<char>::do_toupper(char __c) const
+ { return _M_toupper[(int) __c]; }
+
+ const char*
+ ctype<char>::do_toupper(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = _M_toupper[(int) *__low];
+ ++__low;
+ }
+ return __high;
+ }
+
+ char
+ ctype<char>::do_tolower(char __c) const
+ { return _M_tolower[(int) __c]; }
+
+ const char*
+ ctype<char>::do_tolower(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = _M_tolower[(int) *__low];
+ ++__low;
+ }
+ return __high;
+ }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ ctype<wchar_t>::ctype(size_t /*__refs*/) throw()
+ : _M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower),
+ _M_ctable(__ctype_b)
+ { }
+
+ wchar_t
+ ctype<wchar_t>::do_toupper(wchar_t __c) const
+ {
+ return ((static_cast<__table_type>(__c) < _S_table_size)
+ ? _M_toupper[__c] : __c);
+ }
+
+ const wchar_t*
+ ctype<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const
+ {
+ for (;low < high; ++low)
+ if (static_cast<__table_type>(*low) < _S_table_size)
+ *low = _M_toupper[*low];
+ return high;
+ }
+
+ wchar_t
+ ctype<wchar_t>::do_tolower(wchar_t __c) const
+ {
+ return ((static_cast<__table_type>(__c) < _S_table_size)
+ ? _M_tolower[__c] : __c);
+ }
+
+ const wchar_t*
+ ctype<wchar_t>::do_tolower(wchar_t* __low, const wchar_t* __high) const
+ {
+ for (; __low < __high; ++__low)
+ if (static_cast<__table_type>(*__low) < _S_table_size)
+ *__low = _M_toupper[*__low];
+ return __high;
+ }
+#endif
+
+
diff --git a/libstdc++-v3/config/irix/bits/ctype_base.h b/libstdc++-v3/config/irix/bits/ctype_base.h
new file mode 100644
index 000000000000..32394eb7a4a9
--- /dev/null
+++ b/libstdc++-v3/config/irix/bits/ctype_base.h
@@ -0,0 +1,60 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h on irix 6.5
+
+ struct ctype_base
+ {
+ typedef unsigned char mask;
+ // Non-standard typedefs.
+ typedef int* __to_type;
+
+ enum
+ {
+ space = _ISspace,
+ print = _ISprint,
+ cntrl = _IScntrl,
+ upper = _ISupper,
+ lower = _ISlower,
+ alpha = _ISalpha,
+ digit = _ISdigit,
+ punct = _ISpunct,
+ xdigit = _ISxdigit,
+ alnum = _ISalnum,
+ graph = _ISgraph
+ };
+ };
+
+
+
+
diff --git a/libstdc++-v3/config/irix/bits/ctype_specializations.h b/libstdc++-v3/config/irix/bits/ctype_specializations.h
new file mode 100644
index 000000000000..88a93b4c7baf
--- /dev/null
+++ b/libstdc++-v3/config/irix/bits/ctype_specializations.h
@@ -0,0 +1,73 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000 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.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+ bool
+ ctype<char>::
+ is(mask __m, char __c) const throw()
+ { return (_M_table + 1)[(unsigned char)(__c)] & __m; }
+
+ const char*
+ ctype<char>::
+ is(const char* __low, const char* __high, mask* __vec) const throw()
+ {
+ while (__low < __high)
+ *__vec++ = (_M_table + 1)[(unsigned char)(*__low++)];
+ return __high;
+ }
+
+ const char*
+ ctype<char>::
+ scan_is(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high && !((_M_table + 1)[(unsigned char)(*__low)] & __m))
+ ++__low;
+ return __low;
+ }
+
+ const char*
+ ctype<char>::
+ scan_not(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high
+ && ((_M_table + 1)[(unsigned char)(*__low)] & __m) != 0)
+ ++__low;
+ return __low;
+ }
+
+
+
+
+
diff --git a/libstdc++-v3/config/irix/ctype.cc b/libstdc++-v3/config/irix/ctype.cc
new file mode 100644
index 000000000000..553e776e1dd5
--- /dev/null
+++ b/libstdc++-v3/config/irix/ctype.cc
@@ -0,0 +1,45 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+ ctype_base::__to_type const& ctype<char>::_S_toupper = _toupper;
+ ctype_base::__to_type const& ctype<char>::_S_tolower = _tolower;
+ const ctype_base::mask* const& ctype<char>::_S_table = __ctype;
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ ctype_base::__to_type const& ctype<wchar_t>::_S_toupper = _toupper;
+ ctype_base::__to_type const& ctype<wchar_t>::_S_tolower = _tolower;
+ const ctype_base::mask* const& ctype<wchar_t>::_S_table = __ctype;
+#endif
+
diff --git a/libstdc++-v3/config/newlib/bits/ctype_base.h b/libstdc++-v3/config/newlib/bits/ctype_base.h
new file mode 100644
index 000000000000..447073e2a046
--- /dev/null
+++ b/libstdc++-v3/config/newlib/bits/ctype_base.h
@@ -0,0 +1,61 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h, for solaris2.5.1
+
+// Support for Solaris 2.5.1
+
+ struct ctype_base
+ {
+ typedef char mask;
+ // Non-standard typedefs.
+ typedef const int* __to_type;
+
+ enum
+ {
+ space = 010, // Whitespace
+ print = 020 | 01 | 02 | 04 | 0200, // Printing
+ cntrl = 040, // Control character
+ upper = 01, // UPPERCASE
+ lower = 02, // lowercase
+ alpha = 01 | 02, // Alphabetic
+ digit = 04, // Numeric
+ punct = 020, // Punctuation
+ xdigit = 0200, // Hexadecimal numeric
+ alnum = 01 | 02 | 04, // Alphanumeric
+ graph = 020 | 01 | 02 | 04 // Graphical
+ };
+ };
+
+
+
diff --git a/libstdc++-v3/config/newlib/bits/ctype_specializations.h b/libstdc++-v3/config/newlib/bits/ctype_specializations.h
new file mode 100644
index 000000000000..ff8bb67c1ede
--- /dev/null
+++ b/libstdc++-v3/config/newlib/bits/ctype_specializations.h
@@ -0,0 +1,73 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+ bool
+ ctype<char>::
+ is(mask __m, char __c) const throw()
+ { return (_M_table + 1)[(unsigned char)(__c)] & __m; }
+
+ const char*
+ ctype<char>::
+ is(const char* __low, const char* __high, mask* __vec) const throw()
+ {
+ while (__low < __high)
+ *__vec++ = (_M_table + 1)[(unsigned char)(*__low++)];
+ return __high;
+ }
+
+ const char*
+ ctype<char>::
+ scan_is(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high && !((_M_table + 1)[(unsigned char)(*__low)] & __m))
+ ++__low;
+ return __low;
+ }
+
+ const char*
+ ctype<char>::
+ scan_not(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high
+ && ((_M_table + 1)[(unsigned char)(*__low)] & __m) != 0)
+ ++__low;
+ return __low;
+ }
+
+
+
+
+
diff --git a/libstdc++-v3/config/newlib/ctype.cc b/libstdc++-v3/config/newlib/ctype.cc
new file mode 100644
index 000000000000..db401bdc5c25
--- /dev/null
+++ b/libstdc++-v3/config/newlib/ctype.cc
@@ -0,0 +1,120 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+ ctype<char>::ctype(const mask* __table = 0, bool __del = false,
+ size_t __refs = 0) throw()
+ : _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
+ _M_toupper(NULL), _M_tolower(NULL),
+ _M_ctable(_ctype_), _M_table(__table == 0 ? _M_ctable: __table)
+ { }
+
+ char
+ ctype<char>::do_toupper(char __c) const
+ {
+ int __x = __c;
+ return (this->is(ctype_base::upper, __c) ? (__x - 'A' + 'a') : __x);
+ }
+
+ const char*
+ ctype<char>::do_toupper(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = this->do_toupper(*__low);
+ ++__low;
+ }
+ return __high;
+ }
+
+ char
+ ctype<char>::do_tolower(char __c) const
+ {
+ int __x = __c;
+ return (this->is(ctype_base::lower, __c) ? (__x - 'A' + 'a') : __x);
+ }
+
+ const char*
+ ctype<char>::do_tolower(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = this->do_tolower(*__low);
+ ++__low;
+ }
+ return __high;
+ }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ ctype<wchar_t>::ctype(size_t /*__refs*/) throw()
+ : _M_toupper(NULL), _M_tolower(NULL),
+ _M_ctable(_ctype_)
+ { }
+
+ wchar_t
+ ctype<wchar_t>::do_toupper(wchar_t __c) const
+ {
+ int __x = __c;
+ bool __testok = __c < _S_table_size && this->is(ctype_base::upper, __c);
+ return (__testok ? (__x - 'A' + 'a') : __x);
+ }
+
+ const wchar_t*
+ ctype<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const
+ {
+ for (;low < high; ++low)
+ if (*low < _S_table_size)
+ *low = this->do_toupper(*low);
+ return high;
+ }
+
+ wchar_t
+ ctype<wchar_t>::do_tolower(wchar_t __c) const
+ {
+ int __x = __c;
+ bool __testok = __c < _S_table_size && this->is(ctype_base::lower, __c);
+ return (__testok ? (__x - 'A' + 'a') : __x);
+ }
+
+ const wchar_t*
+ ctype<wchar_t>::do_tolower(wchar_t* __low, const wchar_t* __high) const
+ {
+ for (; __low < __high; ++__low)
+ if (*__low < _S_table_size)
+ *__low = this->do_tolower(*__low);
+ return __high;
+ }
+#endif
+
+
diff --git a/libstdc++-v3/config/solaris/solaris2.5/bits/ctype_base.h b/libstdc++-v3/config/solaris/solaris2.5/bits/ctype_base.h
new file mode 100644
index 000000000000..1f4e1d65d3d5
--- /dev/null
+++ b/libstdc++-v3/config/solaris/solaris2.5/bits/ctype_base.h
@@ -0,0 +1,56 @@
+// Locale support -*- C++ -*-
+
+// 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.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h, for solaris2.5.1
+
+ struct ctype_base
+ {
+ typedef unsigned char mask;
+ // Non-standard typedefs.
+ typedef const int* __to_type;
+
+ enum
+ {
+ space = 010, // Whitespace
+ print = 020 | 01 | 02 | 04 | 0200, // Printing
+ cntrl = 040, // Control character
+ upper = 01, // UPPERCASE
+ lower = 02, // lowercase
+ alpha = 01 | 02, // Alphabetic
+ digit = 04, // Numeric
+ punct = 020, // Punctuation
+ xdigit = 0200, // Hexadecimal numeric
+ alnum = 01 | 02 | 04, // Alphanumeric
+ graph = 020 | 01 | 02 | 04 // Graphical
+ };
+ };
diff --git a/libstdc++-v3/config/solaris/solaris2.5/bits/ctype_specializations.h b/libstdc++-v3/config/solaris/solaris2.5/bits/ctype_specializations.h
new file mode 100644
index 000000000000..88a93b4c7baf
--- /dev/null
+++ b/libstdc++-v3/config/solaris/solaris2.5/bits/ctype_specializations.h
@@ -0,0 +1,73 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000 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.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+ bool
+ ctype<char>::
+ is(mask __m, char __c) const throw()
+ { return (_M_table + 1)[(unsigned char)(__c)] & __m; }
+
+ const char*
+ ctype<char>::
+ is(const char* __low, const char* __high, mask* __vec) const throw()
+ {
+ while (__low < __high)
+ *__vec++ = (_M_table + 1)[(unsigned char)(*__low++)];
+ return __high;
+ }
+
+ const char*
+ ctype<char>::
+ scan_is(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high && !((_M_table + 1)[(unsigned char)(*__low)] & __m))
+ ++__low;
+ return __low;
+ }
+
+ const char*
+ ctype<char>::
+ scan_not(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high
+ && ((_M_table + 1)[(unsigned char)(*__low)] & __m) != 0)
+ ++__low;
+ return __low;
+ }
+
+
+
+
+
diff --git a/libstdc++-v3/config/solaris/solaris2.5/ctype.cc b/libstdc++-v3/config/solaris/solaris2.5/ctype.cc
new file mode 100644
index 000000000000..7e01ad6ecf7e
--- /dev/null
+++ b/libstdc++-v3/config/solaris/solaris2.5/ctype.cc
@@ -0,0 +1,118 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000 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.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+ ctype<char>::ctype(const mask* __table = 0, bool __del = false,
+ size_t __refs = 0) throw()
+ : _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
+ _M_toupper(NULL), _M_tolower(NULL),
+ _M_ctable(__ctype), _M_table(__table == 0 ? _M_ctable: __table)
+ { }
+
+ char
+ ctype<char>::do_toupper(char __c) const
+ { return ((_M_table + 258)[static_cast<int>(__c)]); }
+
+ const char*
+ ctype<char>::do_toupper(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = this->do_toupper(*__low);
+ ++__low;
+ }
+ return __high;
+ }
+
+ char
+ ctype<char>::do_tolower(char __c) const
+ { return ((_M_table + 258)[static_cast<int>(__c)]); }
+
+ const char*
+ ctype<char>::do_tolower(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = this->do_tolower(*__low);
+ ++__low;
+ }
+ return __high;
+ }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ ctype<wchar_t>::ctype(size_t /*__refs*/) throw()
+ : _M_toupper(NULL), _M_tolower(NULL),
+ _M_ctable(__ctype)
+ { }
+
+ wchar_t
+ ctype<wchar_t>::do_toupper(wchar_t __c) const
+ {
+ int __x = __c;
+ bool __testok = __c < _S_table_size && this->is(ctype_base::upper, __c);
+ return (__testok ? __x : (__x - 'a' + 'A'));
+ }
+
+ const wchar_t*
+ ctype<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const
+ {
+ for (;low < high; ++low)
+ if (*low < _S_table_size)
+ *low = this->do_toupper(*low);
+ return high;
+ }
+
+ wchar_t
+ ctype<wchar_t>::do_tolower(wchar_t __c) const
+ {
+ int __x = __c;
+ bool __testok = __c < _S_table_size && this->is(ctype_base::lower, __c);
+ return (__testok ? __x: (__x - 'A' + 'a'));
+ }
+
+ const wchar_t*
+ ctype<wchar_t>::do_tolower(wchar_t* __low, const wchar_t* __high) const
+ {
+ for (; __low < __high; ++__low)
+ if (*__low < _S_table_size)
+ *__low = this->do_tolower(*__low);
+ return __high;
+ }
+#endif
+
+
+
+
+
+
diff --git a/libstdc++-v3/config/solaris/solaris2.6/bits/ctype_base.h b/libstdc++-v3/config/solaris/solaris2.6/bits/ctype_base.h
new file mode 100644
index 000000000000..4e2618f89e73
--- /dev/null
+++ b/libstdc++-v3/config/solaris/solaris2.6/bits/ctype_base.h
@@ -0,0 +1,58 @@
+// Locale support -*- C++ -*-
+
+// 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.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h. Looks like this
+// only works with solaris2.6 and solaris2.7, but not solaris2.5.1.
+
+ struct ctype_base
+ {
+ typedef unsigned int mask;
+ // Non-standard typedefs.
+ typedef long* __to_type;
+
+ enum
+ {
+ space = _ISSPACE,
+ print = _ISPRINT,
+ cntrl = _ISCNTRL,
+ upper = _ISUPPER,
+ lower = _ISLOWER,
+ alpha = _ISALPHA,
+ digit = _ISDIGIT,
+ punct = _ISPUNCT,
+ xdigit = _ISXDIGIT,
+ alnum = _ISALNUM,
+ graph = _ISGRAPH
+ };
+ };
+
diff --git a/libstdc++-v3/config/solaris/solaris2.6/bits/ctype_specializations.h b/libstdc++-v3/config/solaris/solaris2.6/bits/ctype_specializations.h
new file mode 100644
index 000000000000..819fc19caed2
--- /dev/null
+++ b/libstdc++-v3/config/solaris/solaris2.6/bits/ctype_specializations.h
@@ -0,0 +1,73 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000 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.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+ bool
+ ctype<char>::
+ is(mask __m, char __c) const throw()
+ { return _M_table[(unsigned char)(__c)] & __m; }
+
+ const char*
+ ctype<char>::
+ is(const char* __low, const char* __high, mask* __vec) const throw()
+ {
+ while (__low < __high)
+ *__vec++ = _M_table[(unsigned char)(*__low++)];
+ return __high;
+ }
+
+ const char*
+ ctype<char>::
+ scan_is(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high && !(_M_table[(unsigned char)(*__low)] & __m))
+ ++__low;
+ return __low;
+ }
+
+ const char*
+ ctype<char>::
+ scan_not(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high
+ && (_M_table[(unsigned char)(*__low)] & __m) != 0)
+ ++__low;
+ return __low;
+ }
+
+
+
+
+
diff --git a/libstdc++-v3/config/solaris/solaris2.6/ctype.cc b/libstdc++-v3/config/solaris/solaris2.6/ctype.cc
new file mode 100644
index 000000000000..97a9a561f215
--- /dev/null
+++ b/libstdc++-v3/config/solaris/solaris2.6/ctype.cc
@@ -0,0 +1,107 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-1999, 2000 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.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+ ctype<char>::ctype(const mask* __table = 0, bool __del = false,
+ size_t __refs = 0) throw()
+ : _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
+ _M_toupper(__trans_upper), _M_tolower(__trans_lower),
+ _M_ctable(__ctype_mask), _M_table(__table == 0 ? _M_ctable: __table)
+ { }
+
+ char
+ ctype<char>::do_toupper(char __c) const
+ { return _M_toupper[(int) __c]; }
+
+ const char*
+ ctype<char>::do_toupper(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = _M_toupper[(int) *__low];
+ ++__low;
+ }
+ return __high;
+ }
+
+ char
+ ctype<char>::do_tolower(char __c) const
+ { return _M_tolower[(int) __c]; }
+
+ const char*
+ ctype<char>::do_tolower(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = _M_tolower[(int) *__low];
+ ++__low;
+ }
+ return __high;
+ }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ ctype<wchar_t>::ctype(size_t /*__refs*/) throw()
+ : _M_toupper(__trans_upper), _M_tolower(__trans_lower),
+ _M_ctable(__ctype_mask)
+ { }
+
+ wchar_t
+ ctype<wchar_t>::do_toupper(wchar_t __c) const
+ { return (__c < _S_table_size) ? _M_toupper[__c] : __c; }
+
+ const wchar_t*
+ ctype<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const
+ {
+ for (;low < high; ++low)
+ if (*low < _S_table_size)
+ *low = _M_toupper[*low];
+ return high;
+ }
+
+ wchar_t
+ ctype<wchar_t>::do_tolower(wchar_t __c) const
+ { return (__c < _S_table_size) ? _M_tolower[__c] : __c; }
+
+ const wchar_t*
+ ctype<wchar_t>::do_tolower(wchar_t* __low, const wchar_t* __high) const
+ {
+ for (; __low < __high; ++__low)
+ if (*__low < _S_table_size)
+ *__low = _M_toupper[*__low];
+ return __high;
+ }
+#endif
+
+
+
diff --git a/libstdc++-v3/config/solaris/solaris2.7/bits/ctype_base.h b/libstdc++-v3/config/solaris/solaris2.7/bits/ctype_base.h
new file mode 100644
index 000000000000..782a09b2fedf
--- /dev/null
+++ b/libstdc++-v3/config/solaris/solaris2.7/bits/ctype_base.h
@@ -0,0 +1,58 @@
+// Locale support -*- C++ -*-
+
+// 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.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h. Looks like this
+// only works with solaris2.6 and solaris2.7, but not solaris2.5.1.
+
+ struct ctype_base
+ {
+ typedef unsigned int mask;
+ // Non-standard typedefs.
+ typedef int* __to_type;
+
+ enum
+ {
+ space = _ISSPACE,
+ print = _ISPRINT,
+ cntrl = _ISCNTRL,
+ upper = _ISUPPER,
+ lower = _ISLOWER,
+ alpha = _ISALPHA,
+ digit = _ISDIGIT,
+ punct = _ISPUNCT,
+ xdigit = _ISXDIGIT,
+ alnum = _ISALNUM,
+ graph = _ISGRAPH
+ };
+ };
+
diff --git a/libstdc++-v3/config/solaris/solaris2.7/bits/ctype_specializations.h b/libstdc++-v3/config/solaris/solaris2.7/bits/ctype_specializations.h
new file mode 100644
index 000000000000..819fc19caed2
--- /dev/null
+++ b/libstdc++-v3/config/solaris/solaris2.7/bits/ctype_specializations.h
@@ -0,0 +1,73 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2000 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.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+ bool
+ ctype<char>::
+ is(mask __m, char __c) const throw()
+ { return _M_table[(unsigned char)(__c)] & __m; }
+
+ const char*
+ ctype<char>::
+ is(const char* __low, const char* __high, mask* __vec) const throw()
+ {
+ while (__low < __high)
+ *__vec++ = _M_table[(unsigned char)(*__low++)];
+ return __high;
+ }
+
+ const char*
+ ctype<char>::
+ scan_is(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high && !(_M_table[(unsigned char)(*__low)] & __m))
+ ++__low;
+ return __low;
+ }
+
+ const char*
+ ctype<char>::
+ scan_not(mask __m, const char* __low, const char* __high) const throw()
+ {
+ while (__low < __high
+ && (_M_table[(unsigned char)(*__low)] & __m) != 0)
+ ++__low;
+ return __low;
+ }
+
+
+
+
+
diff --git a/libstdc++-v3/config/solaris/solaris2.7/ctype.cc b/libstdc++-v3/config/solaris/solaris2.7/ctype.cc
new file mode 100644
index 000000000000..d8f837098854
--- /dev/null
+++ b/libstdc++-v3/config/solaris/solaris2.7/ctype.cc
@@ -0,0 +1,110 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-1999, 2000 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.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+ ctype<char>::ctype(const mask* __table = 0, bool __del = false,
+ size_t __refs = 0) throw()
+ : _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
+ _M_toupper(__trans_upper), _M_tolower(__trans_lower),
+ _M_ctable(__ctype_mask), _M_table(__table == 0 ? _M_ctable: __table)
+ { }
+
+ char
+ ctype<char>::do_toupper(char __c) const
+ { return _M_toupper[(int) __c]; }
+
+ const char*
+ ctype<char>::do_toupper(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = _M_toupper[(int) *__low];
+ ++__low;
+ }
+ return __high;
+ }
+
+ char
+ ctype<char>::do_tolower(char __c) const
+ { return _M_tolower[(int) __c]; }
+
+ const char*
+ ctype<char>::do_tolower(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+ *__low = _M_tolower[(int) *__low];
+ ++__low;
+ }
+ return __high;
+ }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ ctype<wchar_t>::ctype(size_t /*__refs*/) throw()
+ : _M_toupper(__trans_upper), _M_tolower(__trans_lower),
+ _M_ctable(__ctype_mask)
+ { }
+
+ wchar_t
+ ctype<wchar_t>::do_toupper(wchar_t __c) const
+ { return (static_cast<__table_type>(__c) < _S_table_size) ? _M_toupper[__c] : __c; }
+
+ const wchar_t*
+ ctype<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const
+ {
+ for (;low < high; ++low)
+ if (static_cast<__table_type>(*low) < _S_table_size)
+ *low = _M_toupper[*low];
+ return high;
+ }
+
+ wchar_t
+ ctype<wchar_t>::do_tolower(wchar_t __c) const
+ { return (static_cast<__table_type>(__c) < _S_table_size) ? _M_tolower[__c] : __c; }
+
+ const wchar_t*
+ ctype<wchar_t>::do_tolower(wchar_t* __low, const wchar_t* __high) const
+ {
+ for (; __low < __high; ++__low)
+ if (static_cast<__table_type>(*__low) < _S_table_size)
+ *__low = _M_toupper[*__low];
+ return __high;
+ }
+#endif
+
+
+
+
+
+
diff --git a/libstdc++-v3/config/threads-no.h b/libstdc++-v3/config/threads-no.h
new file mode 100644
index 000000000000..c2de0f1ef4c8
--- /dev/null
+++ b/libstdc++-v3/config/threads-no.h
@@ -0,0 +1,78 @@
+// thread support (null case) -*- C++ -*-
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// threads-no.h - Defines for using no threads.
+
+#ifndef _CPP_THREADS_NO
+#define _CPP_THREADS_NO
+
+//
+// Includes
+//
+
+
+//
+// Defines
+//
+
+
+//
+// Typedefs.
+//
+namespace std {
+
+ struct __null_mutext { };
+ typedef __null_mutext __mutext_type;
+
+} // std
+
+
+//
+// Condition variables.
+//
+
+
+//
+// Mutexes.
+//
+
+
+//
+// Thread creation and manipulation.
+//
+
+#endif // _CPP_THREADS_NO
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/config/threads-posix.h b/libstdc++-v3/config/threads-posix.h
new file mode 100644
index 000000000000..46d53f4ecc28
--- /dev/null
+++ b/libstdc++-v3/config/threads-posix.h
@@ -0,0 +1,91 @@
+// thread support (posix case) -*- C++ -*-
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// threads-posix.h - Defines for using posix threads.
+
+// People trying to implement this should look at
+// libjava/include/posix-threads.h for more info on the interface that
+// java is using. It's one worth looking at.
+
+#ifndef _CPP_THREADS_POSIX
+#define _CPP_THREADS_POSIX
+
+#include <bits/c++config.h>
+
+//
+// Includes
+//
+#include <pthread.h>
+
+
+//
+// Defines
+//
+
+// Currently needed for stl/bits/stl_config.h
+# define _PTHREADS
+
+// Currently libio expects this macro
+#define _IO_MTSAFE_IO
+
+// May be needed on solaris.
+//#define PTHREAD_MUTEX_INITIALIZER {{{0},0},{{{0}}},{0}}
+
+
+//
+// Typedefs.
+//
+namespace std {
+ typedef pthread_mutex_t __mutext_type;
+} // std
+
+
+//
+// Condition variables.
+//
+
+
+//
+// Mutexes.
+//
+
+
+//
+// Thread creation and manipulation.
+//
+
+#endif // _CPP_THREADS_POSIX
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
new file mode 100755
index 000000000000..7adb657d3f9c
--- /dev/null
+++ b/libstdc++-v3/configure
@@ -0,0 +1,4470 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+ --with-target-subdir=SUBDIR
+ configuring in a subdirectory"
+ac_help="$ac_help
+ --with-cross-host=HOST configuring with a cross compiler"
+ac_help="$ac_help
+ --enable-multilib build hella library versions (default)"
+ac_help="$ac_help
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer"
+ac_help="$ac_help
+ --enable-shared[=PKGS] build shared libraries [default=yes]"
+ac_help="$ac_help
+ --enable-static[=PKGS] build static libraries [default=yes]"
+ac_help="$ac_help
+ --enable-fast-install[=PKGS] optimize for fast installation [default=yes]"
+ac_help="$ac_help
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]"
+ac_help="$ac_help
+ --disable-libtool-lock avoid locking (might break parallel builds)"
+ac_help="$ac_help
+ --enable-debug extra debugging, turn off optimization [default=no]"
+ac_help="$ac_help
+ --enable-cstdio enable GNU libio for target io package. (default)
+ --enable-cstdio=LIB use LIB target-speific io package."
+ac_help="$ac_help
+ --enable-long_long turns on 'long long' [default=no]"
+ac_help="$ac_help
+ --enable-threads enable thread usage for target GCC.
+ --enable-threads=LIB use LIB thread package for target GCC."
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=src/complex.cc
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+ac_aux_dir=
+for ac_dir in .. $srcdir/..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in .. $srcdir/.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+# Gets and sets build, host, target, *_vendor, *_cpu, *_os, etc.
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+# configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+# same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+# as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:604: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:625: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+ case $nonopt in
+ NONE) target_alias=$host_alias ;;
+ *) target_alias=$nonopt ;;
+ esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:643: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+test "$host_alias" != "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+
+# We use these options to decide which functions to include.
+# Check whether --with-target-subdir or --without-target-subdir was given.
+if test "${with_target_subdir+set}" = set; then
+ withval="$with_target_subdir"
+ :
+fi
+
+# Check whether --with-cross-host or --without-cross-host was given.
+if test "${with_cross_host+set}" = set; then
+ withval="$with_cross_host"
+ :
+fi
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:692: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
+echo "configure:745: checking whether build environment is sane" >&5
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "$*" != "X $srcdir/configure conftestfile" \
+ && test "$*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ { echo "configure: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" 1>&2; exit 1; }
+ fi
+
+ test "$2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ { echo "configure: error: newly created file is older than distributed files!
+Check your system clock" 1>&2; exit 1; }
+fi
+rm -f conftest*
+echo "$ac_t""yes" 1>&6
+if test "$program_transform_name" = s,x,x,; then
+ program_transform_name=
+else
+ # Double any \ or $. echo might interpret backslashes.
+ cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+ program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+ rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+ program_transform_name="s,^,${program_prefix},; $program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:802: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+if test $host != $build; then
+ ac_tool_prefix=${host_alias}-
+else
+ ac_tool_prefix=
+fi
+
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:835: checking for Cygwin environment" >&5
+if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 840 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:851: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_cygwin=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:868: checking for mingw32 environment" >&5
+if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 873 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:880: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_mingw32=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+
+ # Check whether --enable-multilib or --disable-multilib was given.
+if test "${enable_multilib+set}" = set; then
+ enableval="$enable_multilib"
+ case "${enableval}" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) { echo "configure: error: bad value ${enableval} for multilib option" 1>&2; exit 1; } ;;
+ esac
+else
+ multilib=yes
+fi
+
+ if test "${srcdir}" = "."; then
+ if test "${with_target_subdir}" != "."; then
+ glibcpp_basedir="${srcdir}/${with_multisrctop}../."
+ else
+ glibcpp_basedir="${srcdir}/${with_multisrctop}."
+ fi
+ else
+ glibcpp_basedir="${srcdir}/."
+ fi
+
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:927: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+
+
+PACKAGE=libstdc++
+
+VERSION=2.90.8
+
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
+fi
+cat >> confdefs.h <<EOF
+#define PACKAGE "$PACKAGE"
+EOF
+
+cat >> confdefs.h <<EOF
+#define VERSION "$VERSION"
+EOF
+
+
+
+missing_dir=`cd $ac_aux_dir && pwd`
+echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
+echo "configure:968: checking for working aclocal" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (aclocal --version) < /dev/null > /dev/null 2>&1; then
+ ACLOCAL=aclocal
+ echo "$ac_t""found" 1>&6
+else
+ ACLOCAL="$missing_dir/missing aclocal"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
+echo "configure:981: checking for working autoconf" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (autoconf --version) < /dev/null > /dev/null 2>&1; then
+ AUTOCONF=autoconf
+ echo "$ac_t""found" 1>&6
+else
+ AUTOCONF="$missing_dir/missing autoconf"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working automake""... $ac_c" 1>&6
+echo "configure:994: checking for working automake" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (automake --version) < /dev/null > /dev/null 2>&1; then
+ AUTOMAKE=automake
+ echo "$ac_t""found" 1>&6
+else
+ AUTOMAKE="$missing_dir/missing automake"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
+echo "configure:1007: checking for working autoheader" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (autoheader --version) < /dev/null > /dev/null 2>&1; then
+ AUTOHEADER=autoheader
+ echo "$ac_t""found" 1>&6
+else
+ AUTOHEADER="$missing_dir/missing autoheader"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
+echo "configure:1020: checking for working makeinfo" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
+ MAKEINFO=makeinfo
+ echo "$ac_t""found" 1>&6
+else
+ MAKEINFO="$missing_dir/missing makeinfo"
+ echo "$ac_t""missing" 1>&6
+fi
+
+
+
+# FIXME: We temporarily define our own version of AC_PROG_CC. This is
+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
+# are probably using a cross compiler, which will not be able to fully
+# link an executable. This should really be fixed in autoconf
+# itself.
+
+
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1046: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1076: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1125: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1134: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=
+ echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1149: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ elif test $ac_cv_prog_cc_g = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-O2"
+ fi
+else
+ GCC=
+ test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+
+
+# Likewise for AC_PROG_CXX.
+
+
+
+for ac_prog in $CCC c++ g++ gcc CC cxx cc++
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1186: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CXX="$ac_prog"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CXX="$ac_cv_prog_CXX"
+if test -n "$CXX"; then
+ echo "$ac_t""$CXX" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+test -n "$CXX" && break
+done
+test -n "$CXX" || CXX="gcc"
+
+test -z "$CXX" && { echo "configure: error: no acceptable c++ found in \$PATH" 1>&2; exit 1; }
+
+echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
+echo "configure:1219: checking whether we are using GNU C++" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.C <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1228: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gxx=yes
+else
+ ac_cv_prog_gxx=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gxx" 1>&6
+
+if test $ac_cv_prog_gxx = yes; then
+ GXX=yes
+ ac_test_CXXFLAGS="${CXXFLAGS+set}"
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS=
+ echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
+echo "configure:1243: checking whether ${CXX-g++} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.cc
+if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
+ ac_cv_prog_cxx_g=yes
+else
+ ac_cv_prog_cxx_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6
+ if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ elif test $ac_cv_prog_cxx_g = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-O2"
+ fi
+else
+ GXX=
+ test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
+fi
+
+
+# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we dont
+# run it explicitly here, it will be run implicitly before
+# LIBGCJ_CONFIGURE, which doesn't work because that means that it will
+# be run before AC_CANONICAL_HOST.
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:1276: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+
+# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1297: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$AS"; then
+ ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_AS="${ac_tool_prefix}as"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as"
+fi
+fi
+AS="$ac_cv_prog_AS"
+if test -n "$AS"; then
+ echo "$ac_t""$AS" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1329: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
+fi
+fi
+AR="$ac_cv_prog_AR"
+if test -n "$AR"; then
+ echo "$ac_t""$AR" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1361: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_RANLIB"; then
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1393: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+else
+ RANLIB=":"
+fi
+fi
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:1438: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
+echo "configure:1492: checking whether to enable maintainer-specific portions of Makefiles" >&5
+ # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+ enableval="$enable_maintainer_mode"
+ USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi
+
+ echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
+
+
+if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
+fi
+ MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
+# at least currently, we never actually build a program, so we never
+# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
+# fails, because we are probably configuring with a cross compiler
+# which cant create executables. So we include AC_EXEEXT to keep
+# automake happy, but we dont execute it, since we dont care about
+# the result.
+if false; then
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:1526: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+ ac_cv_exeext=.exe
+else
+ rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.$ac_ext
+ ac_cv_exeext=
+ if { (eval echo configure:1536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj) ;;
+ *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ else
+ { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+ fi
+ rm -f conftest*
+ test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+fi
+
+# configure.host sets the following important variables
+# glibcpp_cflags - host specific C compiler flags
+# glibcpp_cxxflags - host specific C++ compiler flags
+
+glibcpp_cflags=
+glibcpp_cxxflags=
+
+. ${glibcpp_basedir}/configure.host
+
+case ${glibcpp_basedir} in
+/* | A-Za-z:/\\*) libgcj_flagbasedir=${glibcpp_basedir} ;;
+*) glibcpp_flagbasedir='$(top_builddir)/'${glibcpp_basedir} ;;
+esac
+
+GLIBCPP_CFLAGS="${glibcpp_cflags}"
+GLIBCPP_CXXFLAGS="${glibcpp_cxxflags}"
+
+
+
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_shared=yes
+fi
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval="$enable_static"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_static=yes
+fi
+
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_fast_install=yes
+fi
+
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1650: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval="$with_gnu_ld"
+ test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$ac_cv_prog_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
+echo "configure:1689: checking for ld used by GCC" >&5
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
+echo "configure:1713: checking for GNU ld" >&5
+else
+ echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+echo "configure:1716: checking for non-GNU ld" >&5
+fi
+if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ ac_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ ac_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$ac_cv_path_LD"
+if test -n "$LD"; then
+ echo "$ac_t""$LD" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
+echo "configure:1751: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ ac_cv_prog_gnu_ld=yes
+else
+ ac_cv_prog_gnu_ld=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6
+
+
+echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
+echo "configure:1767: checking for BSD-compatible nm" >&5
+if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ ac_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -B"
+ break
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -p"
+ break
+ else
+ ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+fi
+fi
+
+NM="$ac_cv_path_NM"
+echo "$ac_t""$NM" 1>&6
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:1803: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ rm -f conftestdata
+if ln -s X conftestdata 2>/dev/null
+then
+ rm -f conftestdata
+ ac_cv_prog_LN_S="ln -s"
+else
+ ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+case "$target" in
+NONE) lt_target="$host" ;;
+*) lt_target="$target" ;;
+esac
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+libtool_flags="$libtool_flags --enable-dlopen"
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval="$enable_libtool_lock"
+ :
+fi
+
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case "$lt_target" in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 1852 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:1853: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+echo "configure:1874: checking whether the C compiler needs -belf" >&5
+if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1879 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+
+esac
+
+
+# Save cache, so that ltconfig can load it
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
+DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
+
+# Reload cache, that may have been modified by ltconfig
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+
+
+
+
+
+# Check for c++ or library specific bits that don't require linking.
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1993: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 2008 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2014: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 2025 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 2042 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2048: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+
+ echo $ac_n "checking for g++ that will successfullly compile this code""... $ac_c" 1>&6
+echo "configure:2074: checking for g++ that will successfullly compile this code" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 2076 "configure"
+#include "confdefs.h"
+
+ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+ ok
+ #endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "ok" >/dev/null 2>&1; then
+ rm -rf conftest*
+ gpp_satisfactory=yes
+else
+ rm -rf conftest*
+ { echo "configure: error: "please upgrade to gcc-2.95 or above"" 1>&2; exit 1; }
+fi
+rm -f conftest*
+
+ echo "$ac_t""$gpp_satisfactory" 1>&6
+
+ echo $ac_n "checking for g++ that supports new inlining mechanism""... $ac_c" 1>&6
+echo "configure:2097: checking for g++ that supports new inlining mechanism" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 2099 "configure"
+#include "confdefs.h"
+
+ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
+ ok
+ #endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "ok" >/dev/null 2>&1; then
+ rm -rf conftest*
+ OPTLEVEL='-O2'
+ WERRORSUPPRESS=
+
+else
+ rm -rf conftest*
+ OPTLEVEL=
+ WERRORSUPPRESS=-Wno-error
+
+fi
+rm -f conftest*
+
+ if test "$OPTLEVEL" = ""; then
+ echo "$ac_t""no" 1>&6
+ else
+ echo "$ac_t""yes" 1>&6
+ fi
+
+
+
+
+ echo $ac_n "checking for cpu primitives directory""... $ac_c" 1>&6
+echo "configure:2131: checking for cpu primitives directory" >&5
+ case "$target_cpu" in
+ alpha*)
+ cpu_include_dir="config/cpu/alpha"
+ ;;
+ arm*)
+ cpu_include_dir="config/cpu/arm"
+ ;;
+ i486 | i586 | i686 | i786)
+ cpu_include_dir="config/cpu/i386"
+ ;;
+ powerpc | rs6000)
+ cpu_include_dir="config/cpu/powerpc"
+ ;;
+ sparc64 | ultrasparc)
+ cpu_include_dir="config/cpu/sparc/sparc64"
+ ;;
+ sparc*)
+ cpu_include_dir="config/cpu/sparc/sparc32"
+ ;;
+ *)
+ cpu_include_dir="config/cpu/generic"
+ ;;
+ esac
+ echo "$ac_t""$cpu_include_dir" 1>&6
+
+
+
+# Enable all the crazy c++ stuff.
+# Check whether --enable-debug or --disable-debug was given.
+if test "${enable_debug+set}" = set; then
+ enableval="$enable_debug"
+ case "$enableval" in
+ yes) enable_debug=yes ;;
+ no) enable_debug=no ;;
+ *) { echo "configure: error: Unknown argument to enable/disable extra debugging" 1>&2; exit 1; } ;;
+ esac
+else
+ enable_debug=no
+fi
+case "$enable_debug" in
+ yes) DEBUGFLAGS='-ggdb -O0'
+ ;;
+ no) DEBUGFLAGS='-g'
+ ;;
+esac
+
+
+
+ echo $ac_n "checking for cstdio to use""... $ac_c" 1>&6
+echo "configure:2181: checking for cstdio to use" >&5
+ # Check whether --enable-cstdio or --disable-cstdio was given.
+if test "${enable_cstdio+set}" = set; then
+ enableval="$enable_cstdio"
+ if test x$enable_cstdio = xno; then
+ enable_cstdio=libio
+ fi
+else
+ enable_cstdio=libio
+fi
+
+
+ enable_cstdio_flag=$enable_cstdio
+
+ case x${enable_cstdio_flag} in
+ xlibio | x | xno | xnone | xyes)
+ # default
+ CSTDIO_H=c_io_libio.h
+ CSTDIO_CC=c_io_libio.cc
+ echo "$ac_t""libio" 1>&6
+
+ # see if we are on a system with libio native (ie, linux)
+ ac_safe=`echo "libio.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for libio.h""... $ac_c" 1>&6
+echo "configure:2205: checking for libio.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2210 "configure"
+#include "confdefs.h"
+#include <libio.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2215: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ has_libio=yes
+else
+ echo "$ac_t""no" 1>&6
+has_libio=no
+fi
+
+ if test $has_libio = "yes"; then
+ BUILD_LIBIO_INCLUDE=
+ need_libio=no
+ else
+ BUILD_LIBIO_INCLUDE='-I../libio'
+ need_libio=yes
+ fi
+
+ ;;
+ xwince)
+ CSTDIO_H=c_io_wince.h
+ CSTDIO_CC=c_io_wince.cc
+ echo "$ac_t""wince" 1>&6
+
+ need_libio=no
+ BUILD_LIBIO_INCLUDE=
+
+ ;;
+ *)
+ echo "$enable_cstdio is an unknown io package" 1>&2
+ exit 1
+ ;;
+ esac
+
+
+
+
+if test "$need_libio" = yes; then
+ GLIBCPP_NEED_LIBIO_TRUE=
+ GLIBCPP_NEED_LIBIO_FALSE='#'
+else
+ GLIBCPP_NEED_LIBIO_TRUE='#'
+ GLIBCPP_NEED_LIBIO_FALSE=
+fi
+
+ # Check whether --enable-long-long or --disable-long-long was given.
+if test "${enable_long_long+set}" = set; then
+ enableval="$enable_long_long"
+ case "$enableval" in
+ yes) enable_long_long=yes ;;
+ no) enable_long_long=no ;;
+ *) { echo "configure: error: Unknown argument to enable/disable long long" 1>&2; exit 1; } ;;
+ esac
+else
+ enable_long_long=no
+fi
+ case "$enable_long_long" in
+ yes) cat >> confdefs.h <<\EOF
+#define _GLIBCPP_USE_LONG_LONG 1
+EOF
+
+ ;;
+ esac
+
+
+ echo $ac_n "checking for threads package to use""... $ac_c" 1>&6
+echo "configure:2293: checking for threads package to use" >&5
+ # Check whether --enable-threads or --disable-threads was given.
+if test "${enable_threads+set}" = set; then
+ enableval="$enable_threads"
+ if test x$enable_threads = xno; then
+ enable_threads=''
+ fi
+else
+ enable_threads=''
+fi
+
+
+ enable_threads_flag=$enable_threads
+
+ case x${enable_threads_flag} in
+ x | xno | xnone)
+ # No threads
+ target_thread_file='single'
+ ;;
+ xyes)
+ # default
+ target_thread_file=''
+ ;;
+ xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
+ xsolaris | xwin32 | xdce | xvxworks)
+ target_thread_file=$enable_threads_flag
+ ;;
+ *)
+ echo "$enable_threads is an unknown thread package" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case "$target_thread_file" in
+ no | none | single)
+ THREADS=none
+ ;;
+ posix | pthreads)
+ THREADS=posix
+ case "$host" in
+ *-*-linux*)
+ ;;
+ esac
+ ;;
+ decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
+ { echo "configure: error: thread package $THREADS not yet supported" 1>&2; exit 1; }
+ ;;
+ *)
+ { echo "configure: error: $THREADS is an unknown thread package" 1>&2; exit 1; }
+ ;;
+ esac
+ echo "$ac_t""$THREADS" 1>&6
+
+ THREADLIBS=
+ THREADINCS=
+ THREADDEPS=
+ THREADOBJS=
+ THREADH=
+ THREADSPEC=
+ case "$THREADS" in
+ posix)
+ ac_safe=`echo "pthread.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for pthread.h""... $ac_c" 1>&6
+echo "configure:2356: checking for pthread.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2361 "configure"
+#include "confdefs.h"
+#include <pthread.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2366: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ have_pthread_h=yes
+else
+ echo "$ac_t""no" 1>&6
+have_pthread_h=
+fi
+
+ THREADLIBS=-lpthread
+ THREADSPEC=-lpthread
+ THREADH=threads-posix.h
+ ;;
+ none)
+ THREADH=threads-no.h
+ ;;
+ esac
+
+
+
+
+
+
+#GLIBCPP_ENABLE_NAMESPACES(yes)
+#GLIBCPP_ENABLE_RELIBGCC([../..])
+
+if test -n "$with_cross_host"; then
+
+ # We are being configured with a cross compiler. AC_REPLACE_FUNCS
+ # may not work correctly, because the compiler may not be able to
+ # link executables.
+
+ xcompiling=1
+ NATIVE=no
+ # If Canadian cross, then don't pick up tools from the build
+ # directory.
+ if test "$build" != "$with_cross_host"; then
+ CANADIAN=yes
+ NULL_TARGET=yes
+ else
+ CANADIAN=no
+ NULL_TARGET=no
+ fi
+
+ case "$target_alias" in
+ *-wince-*)
+ # Configure for Microsoft Windows CE, or whatever they are
+ # currently calling it.
+ cat >> confdefs.h <<\EOF
+#define HAVE_FLOAT_H 1
+EOF
+
+
+ cat >> confdefs.h <<\EOF
+#define HAVE__FINITE 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define HAVE__ISNAN 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define HAVE__COPYSIGN 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define HAVE__FPCLASS 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define HAVE_MODF 1
+EOF
+
+
+ ctype_include_dir="config/wince"
+
+
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_NEED_MBSTATE_T 1
+EOF
+
+
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_BUGGY_FLOAT_COMPLEX 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_BUGGY_COMPLEX 1
+EOF
+
+ ;;
+ *)
+ # We assume newlib. This lets us hard-code the functions we know
+ # we'll have.
+ cat >> confdefs.h <<\EOF
+#define HAVE_FINITE 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define HAVE_ISNAN 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define HAVE_ISNANF 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define HAVE_ISINF 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define HAVE_ISINFF 1
+EOF
+
+
+ ctype_include_dir="config/newlib"
+
+
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_NEED_MBSTATE_T 1
+EOF
+
+
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_BUGGY_FLOAT_COMPLEX 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_BUGGY_COMPLEX 1
+EOF
+
+ # need to ceck for faster f versions of math functions, ie sinf?
+ ;;
+ esac
+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.
+
+ xcompiling=0
+ NATIVE=yes
+ CANADIAN=no
+ NULL_TARGET=no
+
+ # Check for available headers.
+ for ac_hdr in 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
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2530: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2535 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2540: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+
+ echo $ac_n "checking for GNU C++ __complex__ support""... $ac_c" 1>&6
+echo "configure:2570: checking for GNU C++ __complex__ support" >&5
+ if eval "test \"`echo '$''{'glibcpp_cv_complex'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+
+ ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+ cat > conftest.$ac_ext <<EOF
+#line 2584 "configure"
+#include "confdefs.h"
+struct dcomplex { __complex__ double x; }; \
+ dcomplex f(const dcomplex& x) { return dcomplex(x); }
+int main() {
+\
+ dcomplex x; f(x);
+; return 0; }
+EOF
+if { (eval echo configure:2593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ glibcpp_cv_complex=ok
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ glibcpp_cv_complex=buggy
+
+fi
+rm -f conftest*
+ ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+
+fi
+
+ echo "$ac_t""$glibcpp_cv_complex" 1>&6
+ if test $glibcpp_cv_complex = buggy; then
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_BUGGY_COMPLEX 1
+EOF
+
+ fi
+
+
+
+ echo $ac_n "checking for GNU C++ __complex__ float support""... $ac_c" 1>&6
+echo "configure:2625: checking for GNU C++ __complex__ float support" >&5
+ if eval "test \"`echo '$''{'glibcpp_cv_float_complex'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+
+ ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+ rm -f conftest.h
+ cat > conftest.h <<EOB
+ //
+ // Check for buggy __complex__ that causes ICE in most versions of egcs
+ // and gcc-2.95.x on certain platforms (eg., x86-win32).
+ //
+ // See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for
+ // more info on the bug itself.
+ //
+ struct
+ float_complex
+ {
+ __complex__ float m_value;
+ float_complex (float = 0.0f, float = 0.0f);
+ float_complex (__complex__ float val) : m_value (val) {}
+ float_complex foo (const float_complex &val)
+ { return float_complex (~val.m_value); }
+ };
+EOB
+ cat > conftest.$ac_ext <<EOF
+#line 2658 "configure"
+#include "confdefs.h"
+#include "conftest.h"
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:2665: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ glibcpp_cv_float_complex=ok
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ glibcpp_cv_float_complex=buggy
+
+fi
+rm -f conftest*
+ ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+
+fi
+
+ echo "$ac_t""$glibcpp_cv_float_complex" 1>&6
+ if test $glibcpp_cv_float_complex = buggy; then
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_BUGGY_FLOAT_COMPLEX 1
+EOF
+
+ fi
+
+
+ echo $ac_n "checking for __builtin_sinf""... $ac_c" 1>&6
+echo "configure:2696: checking for __builtin_sinf" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 2698 "configure"
+#include "confdefs.h"
+#include <math.h>
+int main() {
+float foo(void) { __builtin_sinf(0.0); }
+; return 0; }
+EOF
+if { (eval echo configure:2705: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ use_builtin_sinf=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ use_builtin_sinf=no
+fi
+rm -f conftest*
+ echo "$ac_t""$use_builtin_sinf" 1>&6
+ if test $use_builtin_sinf = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_HAS_BUILTIN_SINF 1
+EOF
+
+ fi
+
+ echo $ac_n "checking for __builtin_cosf""... $ac_c" 1>&6
+echo "configure:2724: checking for __builtin_cosf" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 2726 "configure"
+#include "confdefs.h"
+#include <math.h>
+int main() {
+float foo(void) { __builtin_cosf(0.0); }
+; return 0; }
+EOF
+if { (eval echo configure:2733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ use_builtin_cosf=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ use_builtin_cosf=no
+fi
+rm -f conftest*
+ echo "$ac_t""$use_builtin_cosf" 1>&6
+ if test $use_builtin_cosf = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_HAS_BUILTIN_COSF 1
+EOF
+
+ fi
+
+ echo $ac_n "checking for __builtin_fabsf""... $ac_c" 1>&6
+echo "configure:2752: checking for __builtin_fabsf" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 2754 "configure"
+#include "confdefs.h"
+#include <math.h>
+int main() {
+float foo(void) { __builtin_fabsf(0.0); }
+; return 0; }
+EOF
+if { (eval echo configure:2761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ use_builtin_fabsf=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ use_builtin_fabsf=no
+fi
+rm -f conftest*
+ echo "$ac_t""$use_builtin_fabsf" 1>&6
+ if test $use_builtin_fabsf = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_HAS_BUILTIN_FABSF 1
+EOF
+
+ fi
+
+ echo $ac_n "checking for __builtin_sqrtf""... $ac_c" 1>&6
+echo "configure:2780: checking for __builtin_sqrtf" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 2782 "configure"
+#include "confdefs.h"
+#include <math.h>
+int main() {
+float foo(void) { __builtin_sqrtf(0.0); }
+; return 0; }
+EOF
+if { (eval echo configure:2789: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ use_builtin_sqrtf=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ use_builtin_sqrtf=no
+fi
+rm -f conftest*
+ echo "$ac_t""$use_builtin_sqrtf" 1>&6
+ if test $use_builtin_sqrtf = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_HAS_BUILTIN_SQRTF 1
+EOF
+
+ fi
+
+
+ echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6
+echo "configure:2809: checking for sin in -lm" >&5
+ac_lib_var=`echo m'_'sin | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lm $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2817 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char sin();
+
+int main() {
+sin()
+; return 0; }
+EOF
+if { (eval echo configure:2828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ libm="-lm"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $libm"
+
+ for ac_hdr in complex.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2855: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2860 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2865: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ for ac_func in ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \
+ clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \
+ ctan ctanf ctanh ctanhf \
+ carg cargf nan hypot hypotf atan2f expf copysignf
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2897: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2902 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"
+fi
+done
+
+
+
+ USE_LONG_DOUBLE=no
+ echo $ac_n "checking for sinl""... $ac_c" 1>&6
+echo "configure:2954: checking for sinl" >&5
+if eval "test \"`echo '$''{'ac_cv_func_sinl'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2959 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char sinl(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char sinl();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_sinl) || defined (__stub___sinl)
+choke me
+#else
+sinl();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_sinl=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_sinl=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'sinl`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ USE_LONG_DOUBLE=yes
+ for ac_func in ccoshl ccosl cexpl cpowl csinhl csinl \
+ csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3001: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3006 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"
+fi
+done
+
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+ for ac_func in modf isnan isnanf isnanl isinf isinff isinfl copysign \
+ copysignl cosf coshf logf log10f powf sinf sinhf sqrtf tanf tanhf \
+ strtof strtold fabsf sincos sincosf sincosl finite finite fqfinite \
+ fpclass qfpclass
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3067: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3072 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+#Some runtimes have these functions with a preceding underscore. Please
+# keep this sync'd with the one above. And if you add any new symbol,
+# please add the corresponding block in the @BOTTOM@ section of
+# acconfig.h.
+for ac_func in _modf _isnan _isnanf _isnanl _isinf _isinff _isinfl _copysign \
+_copysignl _cosf _coshf _logf _log10f _powf _sinf _sinhf _sqrtf _tanf _tanhf \
+_strtof _strtold _fabsf _sincos _sincosf _sincosl _finite _finitef _qfinite \
+_fpclass _qfpclass
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3130: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3135 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3158: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+LIBS="$save_LIBS"
+
+
+ ac_safe=`echo "wchar.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for wchar.h""... $ac_c" 1>&6
+echo "configure:3188: checking for wchar.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3193 "configure"
+#include "confdefs.h"
+#include <wchar.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3198: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+
+ echo $ac_n "checking for native mbstate_t""... $ac_c" 1>&6
+echo "configure:3216: checking for native mbstate_t" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 3218 "configure"
+#include "confdefs.h"
+#include <wchar.h>
+int main() {
+mbstate_t teststate;
+; return 0; }
+EOF
+if { (eval echo configure:3225: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ use_native_mbstatet=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ use_native_mbstatet=no
+fi
+rm -f conftest*
+ echo "$ac_t""$use_native_mbstatet" 1>&6
+ if test $use_native_mbstatet = "no"; then
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_NEED_MBSTATE_T 1
+EOF
+
+ fi
+
+ echo $ac_n "checking for WCHAR_MIN and WCHAR_MAX""... $ac_c" 1>&6
+echo "configure:3244: checking for WCHAR_MIN and WCHAR_MAX" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 3246 "configure"
+#include "confdefs.h"
+#include <wchar.h>
+int main() {
+int i = WCHAR_MIN; int j = WCHAR_MAX;
+; return 0; }
+EOF
+if { (eval echo configure:3253: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ has_wchar_minmax=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ has_wchar_minmax=no
+fi
+rm -f conftest*
+ echo "$ac_t""$has_wchar_minmax" 1>&6
+ if test $has_wchar_minmax = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_HAS_WCHAR_MIN_MAX 1
+EOF
+
+ fi
+
+ # Test wchar.h for WEOF, which is what we use to determine whether
+ # to specialize for wchar_t or not.
+ echo $ac_n "checking for WEOF""... $ac_c" 1>&6
+echo "configure:3274: checking for WEOF" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 3276 "configure"
+#include "confdefs.h"
+
+ #include <wchar.h>
+ #include <stddef.h>
+int main() {
+wint_t i = WEOF;
+; return 0; }
+EOF
+if { (eval echo configure:3285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ has_weof=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ has_weof=no
+fi
+rm -f conftest*
+ echo "$ac_t""$has_weof" 1>&6
+
+ for ac_func in wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3300: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3305 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"
+fi
+done
+
+
+
+ echo $ac_n "checking for wide character support""... $ac_c" 1>&6
+echo "configure:3356: checking for wide character support" >&5
+ if test $has_weof = "yes" && test $has_wchar_minmax = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_USE_WCHAR_T 1
+EOF
+
+ echo "$ac_t""ok" 1>&6
+ else
+ echo "$ac_t"""not specializing for wchar_t"" 1>&6
+ fi
+
+else
+ echo "$ac_t""no" 1>&6
+
+ echo "configure: warning: <wchar.h> not found" 1>&2
+ cat >> confdefs.h <<\EOF
+#define _GLIBCPP_NEED_MBSTATE_T 1
+EOF
+
+
+fi
+
+
+
+ ac_safe=`echo "ctype.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for ctype.h""... $ac_c" 1>&6
+echo "configure:3382: checking for ctype.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3387 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3392: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+
+
+ ctype_default=yes
+
+ echo $ac_n "checking for gnu-linux <ctype>""... $ac_c" 1>&6
+echo "configure:3413: checking for gnu-linux <ctype>" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 3415 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+int main() {
+int
+ foo (int a)
+ { return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \
+ + _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \
+ + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}
+; return 0; }
+EOF
+if { (eval echo configure:3426: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ \
+ ctype_linux=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ctype_linux=no
+fi
+rm -f conftest*
+ echo "$ac_t""$ctype_linux" 1>&6
+ if test $ctype_linux = "yes"; then
+ ctype_include_dir="config/gnu-linux"
+ ctype_default=no
+ fi
+
+ if test $ctype_default = "yes"; then
+ echo $ac_n "checking for solaris 2.6 or 2.7 <ctype>""... $ac_c" 1>&6
+echo "configure:3445: checking for solaris 2.6 or 2.7 <ctype>" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 3447 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+int main() {
+int
+ foo (int a)
+ { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
+ + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
+ + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}
+; return 0; }
+EOF
+if { (eval echo configure:3458: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ \
+ ctype_solaris=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ctype_solaris=no
+fi
+rm -f conftest*
+ echo "$ac_t""$ctype_solaris" 1>&6
+
+ if test $ctype_solaris = "yes"; then
+ echo $ac_n "checking for version""... $ac_c" 1>&6
+echo "configure:3473: checking for version" >&5
+ ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+ cat > conftest.$ac_ext <<EOF
+#line 3482 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+int main() {
+typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;
+; return 0; }
+EOF
+if { (eval echo configure:3489: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ \
+ ctype_solaris26=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ctype_solaris26=no
+fi
+rm -f conftest*
+ ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ if test $ctype_solaris26 = "yes"; then
+ ctype_include_dir="config/solaris/solaris2.6"
+ echo "$ac_t"""solaris2.6"" 1>&6
+ ctype_default=no
+ else
+ ctype_include_dir="config/solaris/solaris2.7"
+ echo "$ac_t"""solaris2.7"" 1>&6
+ ctype_default=no
+ fi
+ fi
+ fi
+
+ if test $ctype_default = "yes"; then
+ echo $ac_n "checking for solaris 2.5.1 <ctype>""... $ac_c" 1>&6
+echo "configure:3521: checking for solaris 2.5.1 <ctype>" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 3523 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+int main() {
+int
+ foo (int a)
+ { return _U + _L + _N + _S + _P + _C + _X + _B \
+ + __ctype[a];}
+; return 0; }
+EOF
+if { (eval echo configure:3533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ \
+ ctype_solaris25=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ctype_solaris25=no
+fi
+rm -f conftest*
+ echo "$ac_t""$ctype_solaris25" 1>&6
+ if test $ctype_solaris25 = "yes"; then
+ ctype_include_dir="config/solaris/solaris2.5"
+ ctype_default=no
+ fi
+ fi
+
+ if test $ctype_default = "yes"; then
+ echo $ac_n "checking for aix <ctype>""... $ac_c" 1>&6
+echo "configure:3553: checking for aix <ctype>" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 3555 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+int main() {
+int
+ foo (int a)
+ { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
+ + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
+ + _VALC('a') + _IS('c', 0);}
+; return 0; }
+EOF
+if { (eval echo configure:3566: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ \
+ ctype_aix=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ctype_aix=no
+fi
+rm -f conftest*
+ echo "$ac_t""$ctype_aix" 1>&6
+ if test $ctype_aix = "yes"; then
+ ctype_include_dir="config/aix"
+ ctype_default=no
+ fi
+ fi
+
+ if test $ctype_default = "yes"; then
+ echo $ac_n "checking for newlib <ctype>""... $ac_c" 1>&6
+echo "configure:3586: checking for newlib <ctype>" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 3588 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+int main() {
+int
+ foo (int a)
+ { return _U + _L + _N + _S + _P + _C + _X + _B \
+ + _ctype_[a];}
+; return 0; }
+EOF
+if { (eval echo configure:3598: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ \
+ ctype_newlib=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ctype_newlib=no
+fi
+rm -f conftest*
+ echo "$ac_t""$ctype_newlib" 1>&6
+ if test $ctype_newlib = "yes"; then
+ ctype_include_dir="config/newlib"
+ ctype_default=no
+ fi
+ fi
+
+ if test $ctype_default = "yes"; then
+ ctype_include_dir="config/generic"
+ echo "configure: warning: "Using default ctype headers."" 1>&2
+ fi
+
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+ for ac_hdr in unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:3632: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3637 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3642: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getpagesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3671: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3676 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+echo $ac_n "checking for working mmap""... $ac_c" 1>&6
+echo "configure:3724: checking for working mmap" >&5
+if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_mmap_fixed_mapped=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3732 "configure"
+#include "confdefs.h"
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+ Here is a matrix of mmap possibilities:
+ mmap private not fixed
+ mmap private fixed at somewhere currently unmapped
+ mmap private fixed at somewhere already mapped
+ mmap shared not fixed
+ mmap shared fixed at somewhere currently unmapped
+ mmap shared fixed at somewhere already mapped
+ For private mappings, we should verify that changes cannot be read()
+ back from the file, nor mmap's back from the file at a different
+ address. (There have been systems where private was not correctly
+ implemented like the infamous i386 svr4.0, and systems where the
+ VM page cache was not coherent with the filesystem buffer cache
+ like early versions of FreeBSD and possibly contemporary NetBSD.)
+ For shared mappings, we should conversely verify that changes get
+ propogated back to all the places they're supposed to be.
+
+ Grep wants private fixed already mapped.
+ The main things grep needs to know about mmap are:
+ * does it exist and is it safe to write into the mmap'd area
+ * how to use it (BSD variants) */
+#include <sys/types.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+/* This mess was copied from the GNU getpagesize.h. */
+#ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
+
+/* Assume that all systems that can run configure have sys/param.h. */
+# ifndef HAVE_SYS_PARAM_H
+# define HAVE_SYS_PARAM_H 1
+# endif
+
+# ifdef _SC_PAGESIZE
+# define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+# ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+# ifdef EXEC_PAGESIZE
+# define getpagesize() EXEC_PAGESIZE
+# else /* no EXEC_PAGESIZE */
+# ifdef NBPG
+# define getpagesize() NBPG * CLSIZE
+# ifndef CLSIZE
+# define CLSIZE 1
+# endif /* no CLSIZE */
+# else /* no NBPG */
+# ifdef NBPC
+# define getpagesize() NBPC
+# else /* no NBPC */
+# ifdef PAGESIZE
+# define getpagesize() PAGESIZE
+# endif /* PAGESIZE */
+# endif /* no NBPC */
+# endif /* no NBPG */
+# endif /* no EXEC_PAGESIZE */
+# else /* no HAVE_SYS_PARAM_H */
+# define getpagesize() 8192 /* punt totally */
+# endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
+
+#ifdef __cplusplus
+extern "C" { void *malloc(unsigned); }
+#else
+char *malloc();
+#endif
+
+int
+main()
+{
+ char *data, *data2, *data3;
+ int i, pagesize;
+ int fd;
+
+ pagesize = getpagesize();
+
+ /*
+ * First, make a file with some known garbage in it.
+ */
+ data = malloc(pagesize);
+ if (!data)
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ *(data + i) = rand();
+ umask(0);
+ fd = creat("conftestmmap", 0600);
+ if (fd < 0)
+ exit(1);
+ if (write(fd, data, pagesize) != pagesize)
+ exit(1);
+ close(fd);
+
+ /*
+ * Next, try to mmap the file at a fixed address which
+ * already has something else allocated at it. If we can,
+ * also make sure that we see the same garbage.
+ */
+ fd = open("conftestmmap", O_RDWR);
+ if (fd < 0)
+ exit(1);
+ data2 = malloc(2 * pagesize);
+ if (!data2)
+ exit(1);
+ data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+ if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_FIXED, fd, 0L))
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data2 + i))
+ exit(1);
+
+ /*
+ * Finally, make sure that changes to the mapped area
+ * do not percolate back to the file as seen by read().
+ * (This is a bug on some variants of i386 svr4.0.)
+ */
+ for (i = 0; i < pagesize; ++i)
+ *(data2 + i) = *(data2 + i) + 1;
+ data3 = malloc(pagesize);
+ if (!data3)
+ exit(1);
+ if (read(fd, data3, pagesize) != pagesize)
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data3 + i))
+ exit(1);
+ close(fd);
+ unlink("conftestmmap");
+ exit(0);
+}
+
+EOF
+if { (eval echo configure:3872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_func_mmap_fixed_mapped=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_mmap_fixed_mapped=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_MMAP 1
+EOF
+
+fi
+
+fi
+
+
+
+if test "$CANADIAN" = yes; then
+ CANADIAN_TRUE=
+ CANADIAN_FALSE='#'
+else
+ CANADIAN_TRUE='#'
+ CANADIAN_FALSE=
+fi
+
+
+if test "$NULL_TARGET" = yes; then
+ NULL_TARGET_TRUE=
+ NULL_TARGET_FALSE='#'
+else
+ NULL_TARGET_TRUE='#'
+ NULL_TARGET_FALSE=
+fi
+
+
+if test "$NATIVE" = yes || test "$NULL_TARGET" = yes; then
+ NATIVE_TRUE=
+ NATIVE_FALSE='#'
+else
+ NATIVE_TRUE='#'
+ NATIVE_FALSE=
+fi
+
+
+if test -z "$with_cross_host"; then
+ USE_LIBDIR_TRUE=
+ USE_LIBDIR_FALSE='#'
+else
+ USE_LIBDIR_TRUE='#'
+ USE_LIBDIR_FALSE=
+fi
+
+if test $ac_cv_header_locale_h = yes; then
+ echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
+echo "configure:3935: checking for LC_MESSAGES" >&5
+if eval "test \"`echo '$''{'ac_cv_val_LC_MESSAGES'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3940 "configure"
+#include "confdefs.h"
+#include <locale.h>
+int main() {
+return LC_MESSAGES
+; return 0; }
+EOF
+if { (eval echo configure:3947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_cv_val_LC_MESSAGES=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_val_LC_MESSAGES=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_val_LC_MESSAGES" 1>&6
+ if test $ac_cv_val_LC_MESSAGES = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_LC_MESSAGES 1
+EOF
+
+ fi
+ fi
+
+
+# Sanity checking & User-visible messages.
+# Checks down here, otherwise they get scrolled off before
+# the user will notice.
+if test "$enable_namespaces" = "yes" && test "$enable_libgcc_rebuild" = "no"
+then
+ echo "configure: warning: libgcc.a will not match mangled symbols unless it is rebuilt" 1>&2
+fi
+if test "$enable_namespaces" = "no" && test "$enable_libgcc_rebuild" != "no"
+then
+ # Other things besides namespaces can make this true as well, but none
+ # of them are done automatically... yet
+ echo "configure: warning: no point in rebuilding libgcc.a if namespaces aren't used" 1>&2
+fi
+
+
+if test "${multilib}" = "yes"; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+
+# Generate the various Makefiles, include files, and scripts.
+
+# NB: Multilibs need MULTISUBDIR defined correctly in src/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/Makefile.am, manually
+# append it here.
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "mkcheck Makefile src/Makefile math/Makefile libio/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@glibcpp_basedir@%$glibcpp_basedir%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@PACKAGE@%$PACKAGE%g
+s%@VERSION@%$VERSION%g
+s%@ACLOCAL@%$ACLOCAL%g
+s%@AUTOCONF@%$AUTOCONF%g
+s%@AUTOMAKE@%$AUTOMAKE%g
+s%@AUTOHEADER@%$AUTOHEADER%g
+s%@MAKEINFO@%$MAKEINFO%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@CC@%$CC%g
+s%@CXX@%$CXX%g
+s%@AS@%$AS%g
+s%@AR@%$AR%g
+s%@RANLIB@%$RANLIB%g
+s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
+s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
+s%@MAINT@%$MAINT%g
+s%@EXEEXT@%$EXEEXT%g
+s%@GLIBCPP_CFLAGS@%$GLIBCPP_CFLAGS%g
+s%@GLIBCPP_CXXFLAGS@%$GLIBCPP_CXXFLAGS%g
+s%@LN_S@%$LN_S%g
+s%@LIBTOOL@%$LIBTOOL%g
+s%@CPP@%$CPP%g
+s%@OPTLEVEL@%$OPTLEVEL%g
+s%@WERRORSUPPRESS@%$WERRORSUPPRESS%g
+s%@cpu_include_dir@%$cpu_include_dir%g
+s%@DEBUGFLAGS@%$DEBUGFLAGS%g
+s%@BUILD_LIBIO_INCLUDE@%$BUILD_LIBIO_INCLUDE%g
+s%@CSTDIO_H@%$CSTDIO_H%g
+s%@CSTDIO_CC@%$CSTDIO_CC%g
+s%@GLIBCPP_NEED_LIBIO_TRUE@%$GLIBCPP_NEED_LIBIO_TRUE%g
+s%@GLIBCPP_NEED_LIBIO_FALSE@%$GLIBCPP_NEED_LIBIO_FALSE%g
+s%@THREADLIBS@%$THREADLIBS%g
+s%@THREADINCS@%$THREADINCS%g
+s%@THREADDEPS@%$THREADDEPS%g
+s%@THREADOBJS@%$THREADOBJS%g
+s%@THREADSPEC@%$THREADSPEC%g
+s%@ctype_include_dir@%$ctype_include_dir%g
+s%@LIBMATHOBJS@%$LIBMATHOBJS%g
+s%@USE_LONG_DOUBLE@%$USE_LONG_DOUBLE%g
+s%@LIBSTRINGOBJS@%$LIBSTRINGOBJS%g
+s%@CANADIAN_TRUE@%$CANADIAN_TRUE%g
+s%@CANADIAN_FALSE@%$CANADIAN_FALSE%g
+s%@NULL_TARGET_TRUE@%$NULL_TARGET_TRUE%g
+s%@NULL_TARGET_FALSE@%$NULL_TARGET_FALSE%g
+s%@NATIVE_TRUE@%$NATIVE_TRUE%g
+s%@NATIVE_FALSE@%$NATIVE_FALSE%g
+s%@USE_LIBDIR_TRUE@%$USE_LIBDIR_TRUE%g
+s%@USE_LIBDIR_FALSE@%$USE_LIBDIR_FALSE%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"mkcheck Makefile src/Makefile math/Makefile libio/Makefile"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS="config.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+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}"
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
+if test -n "$CONFIG_FILES"; then
+ ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
+ grep '^MULTISUBDIR =' Makefile >> src/Makefile
+fi
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
+
+
+blddir=`pwd`
+# Generate mkcheck having execute privs
+
+
+# Generate bits/c++config.h
+# NB: This must be the first generated file as others include it. . .
+
+
+# Generate bits/std_limits.h and src/limitsMEMBERS.cc
+
+
+# Generate bits/c++threads.h
+
+
+# Generate bits/c++io.h and src/c++io.cc
+
+
+
+
+
+
+
+
+
+
+
+chmod +x $blddir/mkcheck
+$srcdir/mkc++config $blddir $srcdir
+$srcdir/mknumeric_limits $blddir $srcdir $xcompiling
+cp $srcdir/config/$THREADH $blddir/bits/c++threads.h
+cp $srcdir/config/$CSTDIO_H $blddir/bits/c++io.h
+cp $srcdir/config/$CSTDIO_CC $blddir/src/c++io.cc
+
+
+
+
+
+
diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
new file mode 100644
index 000000000000..6c896c65348b
--- /dev/null
+++ b/libstdc++-v3/configure.host
@@ -0,0 +1,43 @@
+# configure.host
+
+# This shell script handles all host based configuration for libstdc++.
+# It sets various shell variables based on the the host and the
+# configuration options. You can modify this shell script without
+# needing to rerun autoconf.
+
+# This shell script should be invoked as
+# . configure.host
+# If it encounters an error, it will exit with a message.
+
+# It uses the following shell variables:
+# host The configuration host
+# host_cpu The configuration host CPU
+# target_optspace --enable-target-optspace ("yes", "no", "")
+
+# It sets the following shell variables:
+# glibcpp_cflags Special CFLAGS to use when building
+# glibcpp_cxxflags Special CXXFLAGS to use when building
+
+glibcpp_cflags=
+glibcpp_cxxflags=
+
+AM_RUNTESTFLAGS=
+
+# Set any host dependent compiler flags.
+# THIS TABLE IS SORTED. KEEP IT THAT WAY.
+
+echo "$target"
+
+DIVIDESPEC=-fuse-divide-subroutine
+
+case "${host}" in
+ i686-*|i586-*)
+ ;;
+ sparc-*)
+ ;;
+ *)
+ ;;
+esac
+
+glibcpp_cflags="${glibcpp_cflags} ${libgcj_flags}"
+glibcpp_cxxflags="${glibcpp_cxxflags} ${libgcj_flags}"
diff --git a/libstdc++-v3/configure.in b/libstdc++-v3/configure.in
new file mode 100644
index 000000000000..cd26c7dbd4a6
--- /dev/null
+++ b/libstdc++-v3/configure.in
@@ -0,0 +1,197 @@
+# Process this file with autoconf to produce a configure script, like so:
+# aclocal -I m4, autoconf, autoheader, automake
+
+AC_PREREQ(2.13)
+AC_INIT(src/complex.cc)
+AC_CONFIG_AUX_DIR(..)
+
+# Gets and sets build, host, target, *_vendor, *_cpu, *_os, etc.
+AC_CANONICAL_SYSTEM
+
+# We use these options to decide which functions to include.
+AC_ARG_WITH(target-subdir,
+[ --with-target-subdir=SUBDIR
+ configuring in a subdirectory])
+AC_ARG_WITH(cross-host,
+[ --with-cross-host=HOST configuring with a cross compiler])
+
+GLIBCPP_CONFIGURE(.)
+AC_LIBTOOL_DLOPEN
+AM_PROG_LIBTOOL
+AM_CONFIG_HEADER(config.h)
+
+# Check for c++ or library specific bits that don't require linking.
+GLIBCPP_CHECK_COMPILER_VERSION
+GLIBCPP_CHECK_CPU
+
+# Enable all the crazy c++ stuff.
+GLIBCPP_ENABLE_DEBUG
+GLIBCPP_ENABLE_CSTDIO
+GLIBCPP_ENABLE_LONG_LONG
+GLIBCPP_ENABLE_THREADS
+#GLIBCPP_ENABLE_NAMESPACES(yes)
+#GLIBCPP_ENABLE_RELIBGCC([../..])
+
+if test -n "$with_cross_host"; then
+
+ # We are being configured with a cross compiler. AC_REPLACE_FUNCS
+ # may not work correctly, because the compiler may not be able to
+ # link executables.
+
+ xcompiling=1
+ NATIVE=no
+ # If Canadian cross, then don't pick up tools from the build
+ # directory.
+ if test "$build" != "$with_cross_host"; then
+ CANADIAN=yes
+ NULL_TARGET=yes
+ else
+ CANADIAN=no
+ NULL_TARGET=no
+ fi
+
+ case "$target_alias" in
+ *-wince-*)
+ # Configure for Microsoft Windows CE, or whatever they are
+ # currently calling it.
+ AC_DEFINE(HAVE_FLOAT_H)
+
+ AC_DEFINE(HAVE__FINITE)
+ AC_DEFINE(HAVE__ISNAN)
+ AC_DEFINE(HAVE__COPYSIGN)
+ AC_DEFINE(HAVE__FPCLASS)
+ AC_DEFINE(HAVE_MODF)
+
+ ctype_include_dir="config/wince"
+ AC_SUBST(ctype_include_dir)
+
+ AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
+
+ AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
+ AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
+ ;;
+ *)
+ # We assume newlib. This lets us hard-code the functions we know
+ # we'll have.
+ AC_DEFINE(HAVE_FINITE)
+ AC_DEFINE(HAVE_ISNAN)
+ AC_DEFINE(HAVE_ISNANF)
+ AC_DEFINE(HAVE_ISINF)
+ AC_DEFINE(HAVE_ISINFF)
+
+ ctype_include_dir="config/newlib"
+ AC_SUBST(ctype_include_dir)
+
+ AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
+
+ AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
+ AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
+ # need to ceck for faster f versions of math functions, ie sinf?
+ ;;
+ esac
+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.
+
+ xcompiling=0
+ NATIVE=yes
+ CANADIAN=no
+ NULL_TARGET=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])
+
+ GLIBCPP_CHECK_COMPLEX_SUPPORT
+ GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT
+ GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
+ GLIBCPP_CHECK_MATH_SUPPORT
+ GLIBCPP_CHECK_WCHAR_T_SUPPORT
+ GLIBCPP_CHECK_CTYPE
+
+ AC_FUNC_MMAP
+fi
+
+AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
+AM_CONDITIONAL(NULL_TARGET, test "$NULL_TARGET" = yes)
+AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes || test "$NULL_TARGET" = yes)
+AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
+
+AC_LC_MESSAGES
+
+
+# Sanity checking & User-visible messages.
+# Checks down here, otherwise they get scrolled off before
+# the user will notice.
+if test "$enable_namespaces" = "yes" && test "$enable_libgcc_rebuild" = "no"
+then
+ AC_MSG_WARN([libgcc.a will not match mangled symbols unless it is rebuilt])
+fi
+if test "$enable_namespaces" = "no" && test "$enable_libgcc_rebuild" != "no"
+then
+ # Other things besides namespaces can make this true as well, but none
+ # of them are done automatically... yet
+ AC_MSG_WARN([no point in rebuilding libgcc.a if namespaces aren't used])
+fi
+
+
+if test "${multilib}" = "yes"; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+
+# Generate the various Makefiles, include files, and scripts.
+
+# NB: Multilibs need MULTISUBDIR defined correctly in src/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/Makefile.am, manually
+# append it here.
+
+AC_OUTPUT(mkcheck Makefile src/Makefile math/Makefile libio/Makefile,
+[if test -n "$CONFIG_FILES"; then
+ ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
+ grep '^MULTISUBDIR =' Makefile >> src/Makefile
+fi],
+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}"
+)
+
+
+blddir=`pwd`
+# Generate mkcheck having execute privs
+AC_OUTPUT_COMMANDS([chmod +x $blddir/mkcheck])
+
+# Generate bits/c++config.h
+# NB: This must be the first generated file as others include it. . .
+AC_OUTPUT_COMMANDS([$srcdir/mkc++config $blddir $srcdir])
+
+# Generate bits/std_limits.h and src/limitsMEMBERS.cc
+AC_OUTPUT_COMMANDS([$srcdir/mknumeric_limits $blddir $srcdir $xcompiling])
+
+# Generate bits/c++threads.h
+AC_OUTPUT_COMMANDS([cp $srcdir/config/$THREADH $blddir/bits/c++threads.h])
+
+# Generate bits/c++io.h and src/c++io.cc
+AC_OUTPUT_COMMANDS([cp $srcdir/config/$CSTDIO_H $blddir/bits/c++io.h])
+AC_OUTPUT_COMMANDS([cp $srcdir/config/$CSTDIO_CC $blddir/src/c++io.cc])
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/docs/17_intro/BADNAMES b/libstdc++-v3/docs/17_intro/BADNAMES
new file mode 100644
index 000000000000..5b0473ba64e2
--- /dev/null
+++ b/libstdc++-v3/docs/17_intro/BADNAMES
@@ -0,0 +1,162 @@
+
+This is the list of names "reserved to the implementation"
+that have been claimed by certain compilers of interest, and
+should not be used in the library. It will grow, of course.
+We generally are interested in names that are not all-caps,
+except for those like "_T"
+
+For Solarix:
+_B
+_C
+_L
+_N
+_P
+_S
+_U
+_X
+_E1
+..
+_E24
+
+Irix adds:
+_A
+_G
+
+MS adds:
+_T
+
+For egcs:
+
+ The full set of __* identifiers (combined from gcc/cp/lex.c and
+ gcc/cplus-dem.c) that are either old or new, but are definitely
+ recognized by the demangler, is:
+
+__aa
+__aad
+__ad
+__addr
+__adv
+__aer
+__als
+__alshift
+__amd
+__ami
+__aml
+__amu
+__aor
+__apl
+__array
+__ars
+__arshift
+__as
+__bit_and
+__bit_ior
+__bit_not
+__bit_xor
+__call
+__cl
+__cm
+__cn
+__co
+__component
+__compound
+__cond
+__convert
+__delete
+__dl
+__dv
+__eq
+__er
+__ge
+__gt
+__indirect
+__le
+__ls
+__lt
+__max
+__md
+__method_call
+__mi
+__min
+__minus
+__ml
+__mm
+__mn
+__mult
+__mx
+__ne
+__negate
+__new
+__nop
+__nt
+__nw
+__oo
+__op
+__or
+__pl
+__plus
+__postdecrement
+__postincrement
+__pp
+__pt
+__rf
+__rm
+__rs
+__sz
+__trunc_div
+__trunc_mod
+__truth_andif
+__truth_not
+__truth_orif
+__vc
+__vd
+__vn
+
+SGI badnames:
+__builtin_alloca
+__builtin_fsqrt
+__builtin_sqrt
+__builtin_fabs
+__builtin_dabs
+__builtin_cast_f2i
+__builtin_cast_i2f
+__builtin_cast_d2ll
+__builtin_cast_ll2d
+__builtin_copy_dhi2i
+__builtin_copy_i2dhi
+__builtin_copy_dlo2i
+__builtin_copy_i2dlo
+__add_and_fetch
+__sub_and_fetch
+__or_and_fetch
+__xor_and_fetch
+__and_and_fetch
+__nand_and_fetch
+__mpy_and_fetch
+__min_and_fetch
+__max_and_fetch
+__fetch_and_add
+__fetch_and_sub
+__fetch_and_or
+__fetch_and_xor
+__fetch_and_and
+__fetch_and_nand
+__fetch_and_mpy
+__fetch_and_min
+__fetch_and_max
+__lock_test_and_set
+__lock_release
+__lock_acquire
+__compare_and_swap
+__synchronize
+__high_multiply
+__unix
+__sgi
+__linux__
+__i386__
+__i486__
+__cplusplus
+__embedded_cplusplus
+// long double conversion members mangled as __opr
+// http://sourceware.cygnus.com/ml/libstdc++/1999-q4/msg00060.html
+_opr \ No newline at end of file
diff --git a/libstdc++-v3/docs/17_intro/BUGS b/libstdc++-v3/docs/17_intro/BUGS
new file mode 100644
index 000000000000..150503593fe8
--- /dev/null
+++ b/libstdc++-v3/docs/17_intro/BUGS
@@ -0,0 +1,31 @@
+2000-03-24 libstdc++2.90.8
+
+- testsuite/27_io/istream_extractors_char.cc:
+ Failing on all platforms with -O2, working with -O. Need to look at this.
+
+- _GLIBCPP_HAS_BUILTIN_SINF: We should still hold out for a cleaner solution the is currenly the case in bits/std_cmath.h.
+
+- there may be one set of remaining string bugs, dependant on final
+clarification of the string::find technicalities when finding in an
+empty string or using an empty string for an argument. At the very
+least, v-3 has interpreted the standard in a way that is in opposition
+to other libraries on other platforms.
+
+- trigraphs and keywords a la the iso646 header are not correctly
+implemented. It looks like the compiler recognizes them as keywords
+but then doesn't translate into the correct bit ops. It is a mystery.
+
+- wide strings have not been tested, and may therefore be unusable.
+
+- Chapter 27 io functionality is not finished. As such, there are
+known bugs in: filebuf::putbackfail
+
+- Many facet implementations are stubs. (22)
+
+- Almost no optimizations for small-footprint/low-overhead. (22,27)
+
+- There has been some work to wrap the C headers in namespace std::, but
+ it may not be complete yet, and C macros are not shadowed. Please consult
+ the mailing list archives for more information.
+
+
diff --git a/libstdc++-v3/docs/17_intro/C++STYLE b/libstdc++-v3/docs/17_intro/C++STYLE
new file mode 100644
index 000000000000..91c4b0998da8
--- /dev/null
+++ b/libstdc++-v3/docs/17_intro/C++STYLE
@@ -0,0 +1,310 @@
+
+C++ Standard Library Style Guidelines DRAFT 1999-02-26
+-------------------------------------
+
+This library is written to appropriate C++ coding standards. As such,
+it is intended to precede the recommendations of the GNU Coding
+Standard, which can be referenced here:
+
+http://www.gnu.ai.mit.edu/prep/standards_toc.html
+
+ChangeLog entries for member functions should use the
+classname::member function name syntax as follows:
+
+1999-04-15 Dennis Ritchie <dr@att.com>
+
+ * src/basic_file.cc (__basic_file::open): Fix thinko in
+ _G_HAVE_IO_FILE_OPEN bits.
+
+Notable areas of divergence from what may be previous local practice
+(particularly for GNU C) include:
+
+01. Pointers and references
+ char* p = "flop";
+ char& c = *p;
+ -NOT-
+ char *p = "flop"; // wrong
+ char &c = *p; // wrong
+
+ Reason: In C++, definitions are mixed with executable code. Here,
+ p is being initialized, not *p. This is near-universal
+ practice among C++ programmers; it is normal for C hackers
+ to switch spontaneously as they gain experience.
+
+02. Operator names and parentheses
+ operator==(type)
+ -NOT-
+ operator == (type) // wrong
+
+ Reason: The == is part of the function name. Separating
+ it makes the declaration look like an expression.
+
+03. Function names and parentheses
+ void mangle()
+ -NOT-
+ void mangle () // wrong
+
+ Reason: no space before parentheses (except after a control-flow
+ keyword) is near-universal practice for C++. It identifies the
+ parentheses as the function-call operator or declarator, as
+ opposed to an expression or other overloaded use of parentheses.
+
+04. Template function indentation
+ template<typename T>
+ void
+ template_function(args)
+ { }
+ -NOT-
+ template<class T>
+ void template_function(args) {};
+
+ Reason: In class definitions, without indentation whitespace is
+ needed both above and below the declaration to distinguish
+ it visually from other members. (Also, re: "typename"
+ rather than "class".) T often could be int, which is
+ not a class. ("class", here, is an anachronism.)
+
+05. Template class indentation
+ template<typename _CharT, typename _Traits>
+ class basic_ios : public ios_base
+ {
+ public:
+ // Types:
+ };
+ -NOT-
+ template<class _CharT, class _Traits>
+ class basic_ios : public ios_base
+ {
+ public:
+ // Types:
+ };
+ -NOT-
+ template<class _CharT, class _Traits>
+ class basic_ios : public ios_base
+ {
+ public:
+ // Types:
+ };
+
+06. Enumerators
+ enum
+ {
+ space = _ISspace,
+ print = _ISprint,
+ cntrl = _IScntrl,
+ };
+ -NOT-
+ enum { space = _ISspace, print = _ISprint, cntrl = _IScntrl };
+
+07. Member initialization lists
+ All one line, separate from class name.
+
+ gribble::gribble()
+ : _M_private_data(0), _M_more_stuff(0), _M_helper(0);
+ { }
+ -NOT-
+ gribble::gribble() : _M_private_data(0), _M_more_stuff(0), _M_helper(0);
+ { }
+
+08. Try/Catch blocks
+ try {
+ //
+ }
+ catch(...) {
+ //
+ }
+ -NOT-
+ try { // } catch(...) { // }
+
+09. Member functions declarations and defintions
+ Keywords such as extern, static, export, explicit, inline, etc
+ go on the line above the function name. Thus
+
+ virtual int
+ foo()
+ -NOT-
+ virtual int foo()
+
+ Reason: GNU coding conventions dictate return types for functions
+ are on a separate line than the function name and parameter list
+ for definitions. For C++, where we have member functions that can
+. be either inline definitions or declarations, keeping to this
+ standard allows all member function names for a given class to be
+ aligned to the same margin, increasing readibility.
+
+
+10. Invocation of member functions with "this->"
+ For non-uglified names, use this->name to call the function.
+
+ this->sync()
+ -NOT-
+ sync()
+
+The library currently has a mixture of GNU-C and modern C++ coding
+styles. The GNU C usages will be combed out gradually.
+
+Name patterns:
+
+For nonstandard names appearing in Standard headers, we are constrained
+to use names that begin with underscores. This is called "uglification".
+The convention is:
+
+ Local and argument names: __[a-z].*
+
+ Examples: __count __ix __s1
+
+ Type names and template formal-argument names: _[A-Z][^_].*
+
+ Examples: _Helper _CharT _N
+
+ Member data and function names: _M_.*
+
+ Examples: _M_num_elements _M_initialize ()
+
+ Static data members, constants, and enumerations: _S_.*
+
+ Examples: _S_max_elements _S_default_value
+
+Don't use names in the same scope that differ only in the prefix,
+e.g. _S_top and _M_top. See BADNAMES for a list of forbidden names.
+(The most tempting of these seem to be and "_T" and "__sz".)
+
+Names must never have "__" internally; it would confuse name
+unmanglers on some targets. Also, never use "__[0-9]", same reason.
+
+--------------------------
+
+[BY EXAMPLE]
+
+#ifndef _HEADER_
+#define _HEADER_ 1
+
+namespace std
+{
+ class gribble
+ {
+ public:
+ // ctor, op=, dtor
+ gribble() throw();
+
+ gribble(const gribble&);
+
+ explicit
+ gribble(int __howmany);
+
+ gribble&
+ operator=(const gribble&);
+
+ virtual
+ ~gribble() throw ();
+
+ // argument
+ inline void
+ public_member(const char* __arg) const;
+
+ // in-class function definitions should be restricted to one-liners.
+ int
+ one_line() { return 0 }
+
+ int
+ two_lines(const char* arg)
+ { return strchr(arg, 'a'); }
+
+ inline int
+ three_lines(); // inline, but defined below.
+
+ // note indentation
+ template<typename _Formal_argument>
+ void
+ public_template() const throw();
+
+ template<typename _Iterator>
+ void
+ other_template();
+
+ private:
+ class _Helper;
+
+ int _M_private_data;
+ int _M_more_stuff;
+ _Helper* _M_helper;
+ int _M_private_function();
+
+ enum _Enum
+ {
+ _S_one,
+ _S_two
+ };
+
+ static void
+ _S_initialize_library();
+ };
+
+// More-or-less-standard language features described by lack, not presence:
+# ifndef _G_NO_LONGLONG
+ extern long long _G_global_with_a_good_long_name; // avoid globals!
+# endif
+
+ // avoid in-class inline definitions, define separately;
+ // likewise for member class definitions:
+ inline int
+ gribble::public_member() const
+ { int __local = 0; return __local; }
+
+ class gribble::_Helper
+ {
+ int _M_stuff;
+
+ friend class gribble;
+ };
+}
+
+// Names beginning with "__": only for arguments and
+// local variables; never use "__" in a type name, or
+// within any name; never use "__[0-9]".
+
+#endif /* _HEADER_ */
+
+
+namespace std {
+
+ template<typename T> // notice: "typename", not "class", no space
+ long_return_value_type<with_many, args>
+ function_name(char* pointer, // "char *pointer" is wrong.
+ char* argument,
+ const Reference& ref)
+ {
+ // int a_local; /* wrong; see below. */
+ if (test)
+ {
+ nested code
+ }
+
+ int a_local = 0; // declare variable at first use.
+
+ // char a, b, *p; /* wrong */
+ char a = 'a';
+ char b = a + 1;
+ char* c = "abc"; // each variable goes on its own line, always.
+
+ // except maybe here...
+ for (unsigned i = 0, mask = 1; mask; ++i, mask <<= 1) {
+ // ...
+ }
+ }
+
+ gribble::gribble()
+ : _M_private_data(0), _M_more_stuff(0), _M_helper(0);
+ { }
+
+ inline int
+ gribble::three_lines()
+ {
+ // doesn't fit in one line.
+ }
+
+}
+
+
+
+
diff --git a/libstdc++-v3/docs/17_intro/CHECKLIST b/libstdc++-v3/docs/17_intro/CHECKLIST
new file mode 100644
index 000000000000..bef9635e8507
--- /dev/null
+++ b/libstdc++-v3/docs/17_intro/CHECKLIST
@@ -0,0 +1,6014 @@
+
+ Completion Checklist for the Standard C++ Library
+ Updated: 1999-05-18
+
+ Status Code Legend:
+ M - Missing
+ S - Present as stub.
+ X - Partially implemented, or buggy.
+ T - Implemented, pending test/inspection.
+ V - Verified to pass all available test suites.
+ Q - Qualified by inspection for non-testable correctness.
+ P - Portability verified.
+ C - Certified.
+
+ Lexical notes:
+ Only status codes appear in column 0. Notes relating to conformance
+ issues appear [in brackets].
+
+ Note that this checklist does not (yet) include all emendations
+ recommended by the ISO Library Working Group: (restricted site)
+ http://www.cygnus.com/iso/wp/html/fdis/lwg-issues.html
+ The LWG has announced its intention to release a public version
+ of the issues list, URL to be added here. XXX
+
+ Detailed explanation of status codes:
+
+ M - Missing: The name is not visible to programs that include
+ the specified header, either at compile or link stage.
+
+ S - Present as stub: A program can use the name, but no implementation
+ is provided. Programs that use the name link correctly, but
+ cannot usefully be run.
+
+ X - Partially implemented, or buggy: Some implementation has been
+ provided, but it is known or believed not to conform fully.
+ It may have an incorrect base class, wrong namespace, wrong
+ storage class, or simply not fully implement requirements.
+ However, it may be sufficiently usable to help test other
+ components.
+
+ T - Implemented, pending test/inspection: Implementation believed
+ to be complete, and informal testing suggests it is ready for
+ formal verification.
+
+ V - Verified, passes all test suites: Verified to satisfy all
+ generically testable conformance requirements.
+
+ Q - Qualified by inspection for non-testable correctness:
+ Inspected, "implementation-defined" documentation accepted,
+ local usability criteria satisfied, formally inspected for
+ other untestable conformance. (Untestable requirements
+ include exception-safety, thread-safety, worst-case
+ complexity, memory cleanliness, usefulness.)
+
+ P - Portability verified: Qualified on all primary target platforms.
+
+ C - Certified: Formally certified to have passed all tests,
+ inspections, qualifications; approved under "signing authority"
+ to be used to satisfy contractual guarantees.
+
+ ----------------------------------------------------------------------
+ <algorithm> <iomanip> <list> <ostream> <streambuf>
+ <bitset> <ios> <locale> <queue> <string>
+ <complex> <iosfwd> <map> <set> <typeinfo>
+X <deque> <iostream> <memory> <sstream> <utility>
+ <exception> <istream> <new> <stack> <valarray>
+ <fstream> <iterator> <numeric> <stdexcept> <vector>
+ <functional> <limits>
+
+ [C header names must be in std:: to qualify. Related to shadow/ dir.]
+ <cassert> <ciso646> <csetjmp> <cstdio> <ctime>
+ <cctype> <climits> <csignal> <cstdlib> <cwchar>
+X <cerrno> <clocale> <cstdarg> <cstring> <cwctype>
+ <cfloat> <cmath> <cstddef>
+
+ Macro:
+X errno, declared or defined in <cerrno>.
+
+ Macro fn:
+X setjmp(jmp_buf), declared or defined in <csetjmp>
+X va_end(va_list), declared or defined in <cstdarg>
+
+ Types:
+X clock_t, div_t, FILE, fpos_t, lconv, ldiv_t, mbstate_t,
+X ptrdiff_t, sig_atomic_t, size_t, time_t, tm, va_list,
+X wctrans_t, wctype_t, and wint_t.
+
+ 1 Which of the functions in the C++ Standard Library are not reentrant
+ subroutines is implementation-defined.
+
+ 18.1 Types [lib.support.types]
+X <cstddef>
+X NULL
+X offsetof
+X ptrdiff_t
+X size_t
+
+ 18.2 Implementation properties [lib.support.limits]
+
+ <limits>, <climits>, and <cfloat>
+
+ 18.2.1 Numeric limits [lib.limits]
+
+ [Note: the numeric_limits templates are now automatically
+ generated. ]
+
+X template<class T> class numeric_limits;
+
+T enum float_round_style;
+T enum float_denorm_style;
+
+T template<> class numeric_limits<bool>;
+
+T template<> class numeric_limits<char>;
+T template<> class numeric_limits<signed char>;
+T template<> class numeric_limits<unsigned char>;
+T template<> class numeric_limits<wchar_t>;
+
+T template<> class numeric_limits<short>;
+T template<> class numeric_limits<int>;
+T template<> class numeric_limits<long>;
+T template<> class numeric_limits<unsigned short>;
+T template<> class numeric_limits<unsigned int>;
+T template<> class numeric_limits<unsigned long>;
+
+X template<> class numeric_limits<float>;
+X template<> class numeric_limits<double>;
+X template<> class numeric_limits<long double>;
+
+ 18.2.1.1 Template class numeric_limits [lib.numeric.limits]
+T template<class T> class numeric_limits {
+ public:
+T static const bool is_specialized = false;
+T static T min() throw();
+T static T max() throw();
+T static const int digits = 0;
+T static const int digits10 = 0;
+T static const bool is_signed = false;
+T static const bool is_integer = false;
+T static const bool is_exact = false;
+T static const int radix = 0;
+T static T epsilon() throw();
+T static T round_error() throw();
+
+T static const int min_exponent = 0;
+T static const int min_exponent10 = 0;
+T static const int max_exponent = 0;
+T static const int max_exponent10 = 0;
+
+T static const bool has_infinity = false;
+T static const bool has_quiet_NaN = false;
+T static const bool has_signaling_NaN = false;
+T static const float_denorm_style has_denorm = denorm_absent;
+T static const bool has_denorm_loss = false;
+T static T infinity() throw();
+T static T quiet_NaN() throw();
+T static T signaling_NaN() throw();
+T static T denorm_min() throw();
+
+T static const bool is_iec559 = false;
+T static const bool is_bounded = false;
+T static const bool is_modulo = false;
+
+T static const bool traps = false;
+T static const bool tinyness_before = false;
+T static const float_round_style round_style = round_toward_zero;
+ };
+
+ 18.2.1.3 Type float_round_style [lib.round.style]
+
+T enum float_round_style {
+T round_indeterminate = -1,
+T round_toward_zero = 0,
+T round_to_nearest = 1,
+T round_toward_infinity = 2,
+T round_toward_neg_infinity = 3
+ };
+
+ 18.2.1.4 Type float_denorm_style [lib.denorm.style]
+
+T enum float_denorm_style {
+T denorm_indeterminate = -1;
+T denorm_absent = 0;
+T denorm present = 1;
+ };
+
+ 18.2.1.5 numeric_limits specializations [lib.numeric.special]
+
+ [Note: see Note at 18.2.1. ]
+
+ 18.2.2 C Library [lib.c.limits]
+
+ 1 Header <climits> (Table 3):
+ CHAR_BIT INT_MAX LONG_MIN SCHAR_MIN UCHAR_MAX USHRT_MAX
+X CHAR_MAX INT_MIN MB_LEN_MAX SHRT_MAX UINT_MAX
+ CHAR_MIN LONG_MAX SCHAR_MAX SHRT_MIN ULONG_MAX
+
+ 3 Header <cfloat> (Table 4):
+
+ DBL_DIG DBL_MIN_EXP FLT_MIN_10_EXP LDBL_MAX_10_EXP
+ DBL_EPSILON FLT_DIG FLT_MIN_EXP LDBL_MAX_EXP
+ DBL_MANT_DIG FLT_EPSILON FLT_RADIX LDBL_MIN
+X DBL_MAX FLT_MANT_DIG FLT_ROUNDS LDBL_MIN_10_EXP
+ DBL_MAX_10_EXP FLT_MAX LDBL_DIG LDBL_MIN_EXP
+ DBL_MAX_EXP FLT_MAX_10_EXP LDBL_EPSILON
+ DBL_MIN FLT_MAX_EXP LDBL_MANT_DIG
+ DBL_MIN_10_EXP FLT_MIN LDBL_MAX
+
+
+ 1 Header <cstdlib> (partial), Table 5:
+X EXIT_FAILURE EXIT_SUCCESS
+ abort atexit exit
+
+S abort(void)
+S extern "C" int atexit(void (*f)(void))
+S extern "C++" int atexit(void (*f)(void))
+S exit(int status)
+
+ 18.4 Dynamic memory management [lib.support.dynamic]
+
+ Header <new> synopsis
+
+T class bad_alloc;
+T struct nothrow_t {};
+T extern const nothrow_t nothrow;
+T typedef void (*new_handler)();
+T new_handler set_new_handler(new_handler new_p) throw();
+
+T void* operator new(std::size_t size) throw(std::bad_alloc);
+T void* operator new(std::size_t size, const std::nothrow_t&) throw();
+T void operator delete(void* ptr) throw();
+T void operator delete(void* ptr, const std::nothrow_t&) throw();
+T void* operator new[](std::size_t size) throw(std::bad_alloc);
+T void* operator new[](std::size_t size, const std::nothrow_t&) throw();
+T void operator delete[](void* ptr) throw();
+T void operator delete[](void* ptr, const std::nothrow_t&) throw();
+T void* operator new (std::size_t size, void* ptr) throw();
+T void* operator new[](std::size_t size, void* ptr) throw();
+T void operator delete (void* ptr, void*) throw();
+T void operator delete[](void* ptr, void*) throw();
+
+ 18.4.2.1 Class bad_alloc [lib.bad.alloc]
+
+T class bad_alloc : public exception {
+ public:
+T bad_alloc() throw();
+T bad_alloc(const bad_alloc&) throw();
+T bad_alloc& operator=(const bad_alloc&) throw();
+T virtual ~bad_alloc() throw();
+T virtual const char* what() const throw();
+
+
+
+T new_handler set_new_handler(new_handler new_p) throw();
+
+
+ Header <typeinfo> synopsis
+
+T class type_info;
+T class bad_cast;
+T class bad_typeid;
+
+ 18.5.1 - Class type_info [lib.type.info]
+
+T class type_info {
+ public:
+T virtual ~type_info();
+T bool operator==(const type_info& rhs) const;
+T bool operator!=(const type_info& rhs) const;
+T bool before(const type_info& rhs) const;
+T const char* name() const;
+ private:
+T type_info(const type_info& rhs);
+T type_info& operator=(const type_info& rhs);
+ };
+
+ 18.5.2 - Class bad_cast [lib.bad.cast]
+
+T bad_cast() throw();
+T virtual const char* bad_cast::what() const throw();
+
+ 18.5.3 Class bad_typeid [lib.bad.typeid]
+
+T class bad_typeid : public exception {
+ public:
+T bad_typeid() throw();
+T bad_typeid(const bad_typeid&) throw();
+T bad_typeid& operator=(const bad_typeid&) throw();
+T virtual ~bad_typeid() throw();
+T virtual const char* what() const throw();
+ };
+
+ 18.6 Exception handling [lib.support.exception]
+
+T Header <exception> synopsis
+
+T class exception;
+T class bad_exception;
+
+T typedef void (*unexpected_handler)();
+T unexpected_handler set_unexpected(unexpected_handler f) throw();
+T void unexpected();
+T typedef void (*terminate_handler)();
+T terminate_handler set_terminate(terminate_handler f) throw();
+T void terminate();
+T bool uncaught_exception();
+
+ 18.6.1 Class exception [lib.exception]
+
+T class exception {
+ public:
+T exception() throw();
+T exception(const exception&) throw();
+T exception& operator=(const exception&) throw();
+T virtual ~exception() throw();
+T virtual const char* what() const throw();
+ };
+
+ 18.6.2.1 Class bad_exception [lib.bad.exception]
+T class bad_exception : public exception {
+ public:
+T bad_exception() throw();
+T bad_exception(const bad_exception&) throw();
+T bad_exception& operator=(const bad_exception&) throw();
+T virtual ~bad_exception() throw();
+T virtual const char* what() const throw();
+ };
+
+ 18.7 Other runtime support [lib.support.runtime]
+
+ 1 Headers <cstdarg> (variable arguments), <csetjmp> (nonlocal jumps),
+ <ctime> (system clock clock(), time()), <csignal> (signal handling),
+ and <cstdlib> (runtime environment getenv(), system()).
+
+ Table 6--Header <cstdarg> synopsis
+ Macros: va_arg va_end va_start
+X Type: va_list
+
+ Table 7--Header <csetjmp> synopsis
+
+ Macro: setjmp |
+X Type: jmp_buf
+ Function: longjmp
+
+ Table 8--Header <ctime> synopsis
+
+ Macros: CLOCKS_PER_SEC
+X Types: clock_t
+ Functions: clock
+
+ Table 9--Header <csignal> synopsis
+
+X Macros: SIGABRT SIGILL SIGSEGV SIG_DFL
+ SIG_IGN SIGFPE SIGINT SIGTERM SIG_ERR
+ Type: sig_atomic_t
+ Functions: raise signal
+
+ Table 10--Header <cstdlib> synopsis
+
+X Functions: getenv system
+
+ 19.1 Exception classes [lib.std.exceptions]
+
+ Header <stdexcept> synopsis
+
+T class logic_error;
+T class domain_error;
+T class invalid_argument;
+T class length_error;
+T class out_of_range;
+T class runtime_error;
+T class range_error;
+T class overflow_error;
+T class underflow_error;
+
+ 19.1.1 Class logic_error [lib.logic.error]
+T class logic_error : public exception {
+ public:
+T explicit logic_error(const string& what_arg);
+ };
+
+ 19.1.2 Class domain_error [lib.domain.error]
+
+T class domain_error : public logic_error {
+ public:
+T explicit domain_error(const string& what_arg);
+ };
+
+ 19.1.3 Class invalid_argument [lib.invalid.argument]
+
+T class invalid_argument : public logic_error {
+ public:
+T explicit invalid_argument(const string& what_arg);
+ };
+
+ 19.1.4 Class length_error [lib.length.error]
+
+T class length_error : public logic_error {
+ public:
+T explicit length_error(const string& what_arg);
+ };
+
+ 19.1.5 Class out_of_range [lib.out.of.range]
+
+T class out_of_range : public logic_error {
+ public:
+T explicit out_of_range(const string& what_arg);
+ };
+
+
+ 19.1.6 Class runtime_error [lib.runtime.error]
+
+T class runtime_error : public exception {
+ public:
+T explicit runtime_error(const string& what_arg);
+ };
+
+
+ 19.1.7 Class range_error [lib.range.error]
+
+T class range_error : public runtime_error {
+ public:
+T explicit range_error(const string& what_arg);
+ };
+
+ 19.1.8 Class overflow_error [lib.overflow.error]
+
+T class overflow_error : public runtime_error {
+ public:
+T explicit overflow_error(const string& what_arg);
+ };
+
+
+ 19.1.9 Class underflow_error [lib.underflow.error]
+
+T class underflow_error : public runtime_error {
+ public:
+T explicit underflow_error(const string& what_arg);
+ };
+
+
+ 19.2 Assertions [lib.assertions]
+
+ Table 2--Header <cassert> synopsis
+
+X Macro: assert
+
+ 19.3 Error numbers [lib.errno]
+
+ Table 3--Header <cerrno> synopsis
+
+X |Macros: EDOM ERANGE errno |
+
+
+ 20.2 Utility components [lib.utility]
+
+ Header <utility> synopsis
+
+ // _lib.operators_, operators:
+X namespace rel_ops {
+T template<class T> bool operator!=(const T&, const T&);
+T template<class T> bool operator> (const T&, const T&);
+T template<class T> bool operator<=(const T&, const T&);
+T template<class T> bool operator>=(const T&, const T&);
+ }
+ // _lib.pairs_, pairs:
+T template <class T1, class T2> struct pair;
+T template <class T1, class T2>
+ bool operator==(const pair<T1,T2>&, const pair<T1,T2>&);
+T template <class T1, class T2>
+ bool operator< (const pair<T1,T2>&, const pair<T1,T2>&);
+T template <class T1, class T2>
+ bool operator!=(const pair<T1,T2>&, const pair<T1,T2>&);
+T template <class T1, class T2>
+ bool operator> (const pair<T1,T2>&, const pair<T1,T2>&);
+T template <class T1, class T2>
+ bool operator>=(const pair<T1,T2>&, const pair<T1,T2>&);
+T template <class T1, class T2>
+ bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&);
+T template <class T1, class T2> pair<T1,T2> make_pair(const T1&, const T2&);
+
+
+ 20.2.2 Pairs [lib.pairs]
+
+T template <class T1, class T2>
+ struct pair {
+T typedef T1 first_type;
+T typedef T2 second_type;
+
+T T1 first;
+T T2 second;
+T pair();
+T pair(const T1& x, const T2& y);
+T template<class U, class V> pair(const pair<U, V> &p);
+ };
+
+ 20.3 Function objects [lib.function.objects]
+
+ Header <functional> synopsis
+
+ // _lib.base_, base:
+V template <class Arg, class Result> struct unary_function;
+V template <class Arg1, class Arg2, class Result> struct binary_function;
+
+ // _lib.arithmetic.operations_, arithmetic operations:
+V template <class T> struct plus;
+V template <class T> struct minus;
+V template <class T> struct multiplies;
+V template <class T> struct divides;
+V template <class T> struct modulus;
+V template <class T> struct negate;
+ // _lib.comparisons_, comparisons:
+V template <class T> struct equal_to;
+V template <class T> struct not_equal_to;
+V template <class T> struct greater;
+V template <class T> struct less;
+V template <class T> struct greater_equal;
+V template <class T> struct less_equal;
+ // _lib.logical.operations_, logical operations:
+V template <class T> struct logical_and;
+V template <class T> struct logical_or;
+V template <class T> struct logical_not;
+ // _lib.negators_, negators:
+ template <class Predicate> struct unary_negate;
+V template <class Predicate>
+ unary_negate<Predicate> not1(const Predicate&);
+V template <class Predicate> struct binary_negate;
+V template <class Predicate>
+ binary_negate<Predicate> not2(const Predicate&);
+ // _lib.binders_, binders:
+V template <class Operation> class binder1st;
+V template <class Operation, class T>
+ binder1st<Operation> bind1st(const Operation&, const T&);
+V template <class Operation> class binder2nd;
+V template <class Operation, class T>
+ binder2nd<Operation> bind2nd(const Operation&, const T&);
+ // _lib.function.pointer.adaptors_, adaptors:
+V template <class Arg, class Result> class pointer_to_unary_function;
+V template <class Arg, class Result>
+ pointer_to_unary_function<Arg,Result> ptr_fun(Result (*)(Arg));
+V template <class Arg1, class Arg2, class Result>
+ class pointer_to_binary_function;
+V template <class Arg1, class Arg2, class Result>
+ pointer_to_binary_function<Arg1,Arg2,Result>
+ ptr_fun(Result (*)(Arg1,Arg2));
+
+ // _lib.member.pointer.adaptors_, adaptors:
+V template<class S, class T> class mem_fun_t;
+V template<class S, class T, class A> class mem_fun1_t;
+V template<class S, class T>
+ mem_fun_t<S,T> mem_fun(S (T::*f)());
+V template<class S, class T, class A>
+ mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A));
+V template<class S, class T> class mem_fun_ref_t;
+V template<class S, class T, class A> class mem_fun1_ref_t;
+V template<class S, class T>
+ mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)());
+V template<class S, class T, class A>
+ mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A));
+
+V template <class S, class T> class const_mem_fun_t;
+V template <class S, class T, class A> class const_mem_fun1_t;
+V template <class S, class T>
+ const_mem_fun_t<S,T> mem_fun(S (T::*f)() const);
+V template <class S, class T, class A>
+ const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const);
+V template <class S, class T> class const_mem_fun_ref_t;
+V template <class S, class T, class A> class const_mem_fun1_ref_t;
+V template <class S, class T>
+ const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const);
+V template <class S, class T, class A>
+ const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const);
+ }
+
+ 20.3.1 Base [lib.base]
+
+V template <class Arg, class Result>
+ struct unary_function {
+V typedef Arg argument_type;
+V typedef Result result_type;
+ };
+V template <class Arg1, class Arg2, class Result>
+ struct binary_function {
+V typedef Arg1 first_argument_type;
+V typedef Arg2 second_argument_type;
+V typedef Result result_type;
+ };
+
+ 20.3.2 Arithmetic operations [lib.arithmetic.operations]
+
+T template <class T> struct plus : binary_function<T,T,T> {
+V T operator()(const T& x, const T& y) const;
+ };
+
+T template <class T> struct minus : binary_function<T,T,T> {
+V T operator()(const T& x, const T& y) const;
+ };
+
+T template <class T> struct multiplies : binary_function<T,T,T> {
+V T operator()(const T& x, const T& y) const;
+ };
+
+T template <class T> struct divides : binary_function<T,T,T> {
+V T operator()(const T& x, const T& y) const;
+ };
+
+T template <class T> struct modulus : binary_function<T,T,T> {
+V T operator()(const T& x, const T& y) const;
+ };
+
+T template <class T> struct negate : unary_function<T,T> {
+V T operator()(const T& x) const;
+ };
+
+ 20.3.3 Comparisons [lib.comparisons]
+
+T template <class T> struct equal_to : binary_function<T,T,bool> {
+V bool operator()(const T& x, const T& y) const;
+ };
+
+T template <class T> struct not_equal_to : binary_function<T,T,bool> {
+V bool operator()(const T& x, const T& y) const;
+ };
+
+T template <class T> struct greater : binary_function<T,T,bool> {
+V bool operator()(const T& x, const T& y) const;
+ };
+
+T template <class T> struct less : binary_function<T,T,bool> {
+V bool operator()(const T& x, const T& y) const;
+ };
+
+T template <class T> struct greater_equal : binary_function<T,T,bool> {
+V bool operator()(const T& x, const T& y) const;
+ };
+
+T template <class T> struct less_equal : binary_function<T,T,bool> {
+V bool operator()(const T& x, const T& y) const;
+ };
+
+ 20.3.4 Logical operations [lib.logical.operations]
+
+T template <class T> struct logical_and : binary_function<T,T,bool> {
+V bool operator()(const T& x, const T& y) const;
+ };
+
+T template <class T> struct logical_or : binary_function<T,T,bool> {
+V bool operator()(const T& x, const T& y) const;
+ };
+
+T template <class T> struct logical_not : unary_function<T,bool> {
+V bool operator()(const T& x) const;
+ };
+
+ 20.3.5 Negators [lib.negators]
+
+T template <class Predicate>
+ class unary_negate
+ : public unary_function<typename Predicate::argument_type,bool> {
+ public:
+T explicit unary_negate(const Predicate& pred);
+V bool operator()(const typename Predicate::argument_type& x) const;
+ };
+
+T template <class Predicate>
+ class binary_negate
+ : public binary_function<typename Predicate::first_argument_type,
+ typename Predicate::second_argument_type, bool> {
+ public:
+T explicit binary_negate(const Predicate& pred);
+V bool operator()(const typename Predicate::first_argument_type& x,
+ const typename Predicate::second_argument_type& y) const;
+ };
+
+
+ 20.3.6 Binders [lib.binders]
+
+ 20.3.6.1 Template class binder1st [lib.binder.1st]
+T template <class Operation>
+ class binder1st
+ : public unary_function<typename Operation::second_argument_type,
+ typename Operation::result_type> {
+ protected:
+T Operation op;
+T typename Operation::first_argument_type value;
+ public:
+V binder1st(const Operation& x,
+ const typename Operation::first_argument_type& y);
+V typename Operation::result_type
+ operator()(const typename Operation::second_argument_type& x) const;
+ };
+
+ 20.3.6.2 bind1st [lib.bind.1st]
+
+V template <class Operation, class T>
+ binder1st<Operation> bind1st(const Operation& op, const T& x);
+
+ 20.3.6.3 Template class binder2nd [lib.binder.2nd]
+T template <class Operation>
+ class binder2nd
+ : public unary_function<typename Operation::first_argument_type,
+ typename Operation::result_type> {
+ protected:
+T Operation op;
+T typename Operation::second_argument_type value;
+ public:
+V binder2nd(const Operation& x,
+ const typename Operation::second_argument_type& y);
+V typename Operation::result_type
+ operator()(const typename Operation::first_argument_type& x) const;
+ };
+
+ 20.3.6.4 bind2nd [lib.bind.2nd]
+
+T template <class Operation, class T>
+ binder2nd<Operation> bind2nd(const Operation& op, const T& x);
+
+
+ 20.3.7 Adaptors for pointers to [lib.function.pointer.adaptors]
+ functions
+
+ 1 To allow pointers to (unary and binary) functions to work with func-
+ tion adaptors the library provides:
+
+T template <class Arg, class Result>
+ class pointer_to_unary_function : public unary_function<Arg, Result> {
+ public:
+T explicit pointer_to_unary_function(Result (*f)(Arg));
+V Result operator()(Arg x) const;
+ };
+
+T template <class Arg, class Result>
+ pointer_to_unary_function<Arg, Result> ptr_fun(Result (*f)(Arg));
+
+T template <class Arg1, class Arg2, class Result>
+ class pointer_to_binary_function :
+ public binary_function<Arg1,Arg2,Result> {
+ public:
+T explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2));
+V Result operator()(Arg1 x, Arg2 y) const;
+ };
+
+
+ 20.3.8 Adaptors for pointers to [lib.member.pointer.adaptors]
+ members
+
+T template <class S, class T> class mem_fun_t
+ : public unary_function<T*, S> {
+ public:
+T explicit mem_fun_t(S (T::*p)());
+V S operator()(T* p) const;
+ };
+
+T template <class S, class T, class A> class mem_fun1_t
+ : public binary_function<T*, A, S> {
+ public:
+T explicit mem_fun1_t(S (T::*p)(A));
+V S operator()(T* p, A x) const;
+ };
+
+V template<class S, class T> mem_fun_t<S,T>
+ mem_fun(S (T::*f)());
+V template<class S, class T, class A> mem_fun1_t<S,T,A>
+ mem_fun(S (T::*f)(A));
+
+T template <class S, class T> class mem_fun_ref_t
+ : public unary_function<T, S> {
+ public:
+T explicit mem_fun_ref_t(S (T::*p)());
+V S operator()(T& p) const;
+ };
+
+T template <class S, class T, class A> class mem_fun1_ref_t
+ : public binary_function<T, A, S> {
+ public:
+T explicit mem_fun1_ref_t(S (T::*p)(A));
+V S operator()(T& p, A x) const;
+ };
+
+T template<class S, class T> mem_fun_ref_t<S,T>
+ mem_fun_ref(S (T::*f)());
+
+T template<class S, class T, class A> mem_fun1_ref_t<S,T,A>
+ mem_fun_ref(S (T::*f)(A));
+
+T template <class S, class T> class const_mem_fun_t
+ : public unary_function<T*, S> {
+ public:
+T explicit const_mem_fun_t(S (T::*p)() const);
+V S operator()(const T* p) const;
+ };
+
+T template <class S, class T, class A> class const_mem_fun1_t
+ : public binary_function<T*, A, S> {
+ public:
+T explicit const mem_fun1_t(S (T::*p)(A) const);
+V S operator()(const T* p, A x) const;
+ };
+
+V template<class S, class T> const_mem_fun_t<S,T>
+ mem_fun(S (T::*f)() const);
+V template<class S, class T, class A> const_mem_fun1_t<S,T,A>
+ mem_fun(S (T::*f)(A) const);
+
+T template <class S, class T> class const_mem_fun_ref_t
+ : public unary_function<T, S> {
+ public:
+T explicit const_mem_fun_ref_t(S (T::*p)() const);
+V S operator()(const T& p) const;
+ };
+
+T template <class S, class T, class A> class const_mem_fun1_ref_t
+ : public binary_function<T, A, S> {
+ public:
+T explicit const_mem_fun1_ref_t(S (T::*p)(A) const);
+V S operator()(const T& p, A x) const;
+ };
+
+T template<class S, class T> const_mem_fun_ref_t<S,T>
+ mem_fun_ref(S (T::*f)() const);
+
+T template<class S, class T, class A> const_mem_fun1_ref_t<S,T,A>
+ mem_fun_ref(S (T::*f)(A) const);
+
+ 20.4 Memory [lib.memory]
+
+ Header <memory> synopsis
+
+ // _lib.default.allocator_, the default allocator:
+T template <class T> class allocator;
+T template <> class allocator<void>;
+T template <class T, class U>
+ bool operator==(const allocator<T>&, const allocator<U>&) throw();
+T template <class T, class U>
+ bool operator!=(const allocator<T>&, const allocator<U>&) throw();
+ // _lib.storage.iterator_, raw storage iterator:
+T template <class OutputIterator, class T> class raw_storage_iterator;
+ // _lib.temporary.buffer_, temporary buffers:
+T template <class T>
+ pair<T*,ptrdiff_t> get_temporary_buffer(ptrdiff_t n);
+T template <class T>
+ void return_temporary_buffer(T* p);
+ // _lib.specialized.algorithms_, specialized algorithms:
+T template <class InputIterator, class ForwardIterator>
+ ForwardIterator
+ uninitialized_copy(InputIterator first, InputIterator last,
+ ForwardIterator result);
+T template <class ForwardIterator, class T>
+ void uninitialized_fill(ForwardIterator first, ForwardIterator last,
+ const T& x);
+T template <class ForwardIterator, class Size, class T>
+ void uninitialized_fill_n(ForwardIterator first, Size n, const T& x);
+ // _lib.auto.ptr_, pointers:
+X template<class X> class auto_ptr;
+ }
+
+ 20.4.1 The default allocator [lib.default.allocator]
+
+T template <class T> class allocator;
+ // specialize for void:
+T template <> class allocator<void> {
+ public:
+T typedef void* pointer;
+T typedef const void* const_pointer;
+ // reference-to-void members are impossible.
+T typedef void value_type;
+T template <class U> struct rebind { typedef allocator<U> other; };
+ };
+
+T template <class T> class allocator {
+ public:
+T typedef size_t size_type;
+T typedef ptrdiff_t difference_type;
+T typedef T* pointer;
+T typedef const T* const_pointer;
+T typedef T& reference;
+T typedef const T& const_reference;
+T typedef T value_type;
+T template <class U> struct rebind { typedef allocator<U> other; };
+T allocator() throw();
+T allocator(const allocator&) throw();
+T template <class U> allocator(const allocator<U>&) throw();
+T ~allocator() throw();
+T pointer address(reference x) const;
+T const_pointer address(const_reference x) const;
+T pointer allocate(
+ size_type, allocator<void>::const_pointer hint = 0);
+T void deallocate(pointer p, size_type n);
+T size_type max_size() const throw();
+T void construct(pointer p, const T& val);
+T void destroy(pointer p);
+ };
+
+ 20.4.1.2 allocator globals [lib.allocator.globals]
+
+T template <class T1, class T2>
+ bool operator==(const allocator<T1>&, const allocator<T2>&) throw();
+T template <class T1, class T2>
+ bool operator!=(const allocator<T1>&, const allocator<T2>&) throw();
+
+ 20.4.2 Raw storage iterator [lib.storage.iterator]
+
+T template <class OutputIterator, class T>
+ class raw_storage_iterator
+ : public iterator<output_iterator_tag,void,void,void,void> {
+ public:
+T explicit raw_storage_iterator(OutputIterator x);
+T raw_storage_iterator<OutputIterator,T>& operator*();
+T raw_storage_iterator<OutputIterator,T>& operator=(const T& element);
+T raw_storage_iterator<OutputIterator,T>& operator++();
+T raw_storage_iterator<OutputIterator,T> operator++(int);
+ };
+
+ 20.4.3 Temporary buffers [lib.temporary.buffer]
+
+T template <class T>
+ pair<T*, ptrdiff_t> get_temporary_buffer(ptrdiff_t n);
+
+T template <class T> void return_temporary_buffer(T* p);
+
+ 20.4.4 Specialized algorithms [lib.specialized.algorithms]
+
+ 20.4.4.1 uninitialized_copy [lib.uninitialized.copy]
+
+V template <class InputIterator, class ForwardIterator>
+ ForwardIterator
+ uninitialized_copy(InputIterator first, InputIterator last,
+ ForwardIterator result);
+
+ 20.4.4.2 uninitialized_fill [lib.uninitialized.fill]
+
+V template <class ForwardIterator, class T>
+ void uninitialized_fill(ForwardIterator first, ForwardIterator last,
+ const T& x);
+
+ 20.4.4.3 uninitialized_fill_n [lib.uninitialized.fill.n]
+
+V template <class ForwardIterator, class Size, class T>
+ void uninitialized_fill_n(ForwardIterator first, Size n, const T& x);
+
+ 20.4.5 Template class auto_ptr [lib.auto.ptr]
+
+X template<class X> class auto_ptr {
+ template <class Y> struct auto_ptr_ref {};
+ public:
+T typedef X element_type;
+ // _lib.auto.ptr.cons_ construct/copy/destroy:
+T explicit auto_ptr(X* p =0) throw();
+T auto_ptr(auto_ptr&) throw();
+T template<class Y> auto_ptr(auto_ptr<Y>&) throw();
+T auto_ptr& operator=(auto_ptr&) throw();
+T template<class Y> auto_ptr& operator=(auto_ptr<Y>&) throw();
+T ~auto_ptr() throw();
+ // _lib.auto.ptr.members_ members:
+T X& operator*() const throw();
+T X* operator->() const throw();
+T X* get() const throw();
+T X* release() throw();
+T void reset(X* p =0) throw();
+
+ // _lib.auto.ptr.conv_ converions:
+X auto_ptr(auto_ptr_ref<X>) throw();
+X template<class Y> operator auto_ptr_ref<Y>() throw();
+X template<class Y> operator auto_ptr<Y>() throw();
+ };
+
+ 20.4.6 C Library [lib.c.malloc]
+
+ Table 7--Header <cstdlib> synopsis
+
+X Functions: calloc malloc
+ free realloc
+
+
+ Table 8--Header <cstring> synopsis
+
+X Macro: NULL
+X Type: size_t
+X Functions: memchr memcmp
+X memcpy memmove memset
+
+ Table 9--Header <ctime> synopsis
+
+X Macros: NULL
+X Types: size_t clock_t time_t
+X Struct: tm
+ Functions:
+X asctime clock difftime localtime strftime
+X ctime gmtime mktime time
+
+ 21.1.1 Character traits requirements [lib.char.traits.require]
+
+ 2 The struct template
+T template<class charT> struct char_traits;
+ shall be provided in the header <string> as a basis for explicit spe-
+ cializations.
+
+
+ 21.1.3.1 struct [lib.char.traits.specializations.char]
+ char_traits<char>
+
+T template<>
+ struct char_traits<char> {
+T typedef char char_type;
+T typedef int int_type;
+T typedef streamoff off_type;
+T typedef streampos pos_type;
+T typedef mbstate_t state_type;
+
+T static void assign(char_type& c1, const char_type& c2);
+T static bool eq(const char_type& c1, const char_type& c2);
+T static bool lt(const char_type& c1, const char_type& c2);
+
+T static int compare(const char_type* s1, const char_type* s2, size_t n);
+T static size_t length(const char_type* s);
+T static const char_type* find(const char_type* s, size_t n,
+ const char_type& a);
+T static char_type* move(char_type* s1, const char_type* s2, size_t n);
+T static char_type* copy(char_type* s1, const char_type* s2, size_t n);
+T static char_type* assign(char_type* s, size_t n, char_type a);
+
+T static int_type not_eof(const int_type& c);
+T static char_type to_char_type(const int_type& c);
+T static int_type to_int_type(const char_type& c);
+T static bool eq_int_type(const int_type& c1, const int_type& c2);
+T static int_type eof();
+ };
+
+ 21.1.3.2 struct [lib.char.traits.specializations.wchar.t]
+ char_traits<wchar_t>
+
+V template<>
+ struct char_traits<wchar_t> {
+V typedef wchar_t char_type;
+V typedef wint_t int_type;
+V typedef streamoff off_type;
+V typedef wstreampos pos_type;
+V typedef mbstate_t state_type;
+
+V static void assign(char_type& c1, const char_type& c2);
+V static bool eq(const char_type& c1, const char_type& c2);
+V static bool lt(const char_type& c1, const char_type& c2);
+
+V static int compare(const char_type* s1, const char_type* s2, size_t n);
+V static size_t length(const char_type* s);
+V static const char_type* find(const char_type* s, size_t n,
+ const char_type& a);
+V static char_type* move(char_type* s1, const char_type* s2, size_t n);
+V static char_type* copy(char_type* s1, const char_type* s2, size_t n);
+V static char_type* assign(char_type* s, size_t n, char_type a);
+
+V static int_type not_eof(const int_type& c);
+V static char_type to_char_type(const int_type& c);
+V static int_type to_int_type(const char_type& c);
+V static bool eq_int_type(const int_type& c1, const int_type& c2);
+V static int_type eof();
+ };
+
+ 21.2 String classes [lib.string.classes]
+
+ // _lib.char.traits_, character traits:
+V template<class charT>
+ struct char_traits;
+V template <> struct char_traits<char>;
+V template <> struct char_traits<wchar_t>;
+
+ // _lib.basic.string_, basic_string:
+V template<class charT, class traits = char_traits<charT>,
+ class Allocator = allocator<charT> >
+ class basic_string;
+V template<class charT, class traits, class Allocator>
+ basic_string<charT,traits,Allocator>
+ operator+(const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+V template<class charT, class traits, class Allocator>
+ basic_string<charT,traits,Allocator>
+ operator+(const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+V template<class charT, class traits, class Allocator>
+ basic_string<charT,traits,Allocator>
+ operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs);
+V template<class charT, class traits, class Allocator>
+ basic_string<charT,traits,Allocator>
+ operator+(const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+V template<class charT, class traits, class Allocator>
+ basic_string<charT,traits,Allocator>
+ operator+(const basic_string<charT,traits,Allocator>& lhs, charT rhs);
+
+V template<class charT, class traits, class Allocator>
+ bool operator==(const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator==(const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator==(const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator!=(const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator< (const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator< (const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator< (const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator> (const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator> (const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator> (const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator<=(const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator<=(const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator<=(const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator>=(const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator>=(const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+V template<class charT, class traits, class Allocator>
+ bool operator>=(const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+ // _lib.string.special_:
+V template<class charT, class traits, class Allocator>
+ void swap(basic_string<charT,traits,Allocator>& lhs,
+ basic_string<charT,traits,Allocator>& rhs);
+V template<class charT, class traits, class Allocator>
+ basic_istream<charT,traits>&
+ operator>>(basic_istream<charT,traits>& is,
+ basic_string<charT,traits,Allocator>& str);
+T template<class charT, class traits, class Allocator>
+ basic_ostream<charT, traits>&
+ operator<<(basic_ostream<charT, traits>& os,
+ const basic_string<charT,traits,Allocator>& str);
+V template<class charT, class traits, class Allocator>
+ basic_istream<charT,traits>&
+ getline(basic_istream<charT,traits>& is,
+ basic_string<charT,traits,Allocator>& str,
+ charT delim);
+V template<class charT, class traits, class Allocator>
+ basic_istream<charT,traits>&
+ getline(basic_istream<charT,traits>& is,
+ basic_string<charT,traits,Allocator>& str);
+V typedef basic_string<char> string;
+T typedef basic_string<wchar_t> wstring;
+ }
+
+ 21.3 Template class basic_string [lib.basic.string]
+
+V namespace std {
+ template<class charT, class traits = char_traits<charT>,
+ class Allocator = allocator<charT> >
+ class basic_string {
+ public:
+ // types:
+ typedef traits traits_type;
+ typedef typename traits::char_type value_type;
+ typedef Allocator allocator_type;
+ typedef typename Allocator::size_type size_type;
+ typedef typename Allocator::difference_type difference_type;
+ typedef typename Allocator::reference reference;
+ typedef typename Allocator::const_reference const_reference;
+ typedef typename Allocator::pointer pointer;
+ typedef typename Allocator::const_pointer const_pointer;
+ typedef implementation defined iterator;
+ typedef implementation defined const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ static const size_type npos = -1;
+
+ // _lib.string.cons_ construct/copy/destroy:
+V explicit basic_string(const Allocator& a = Allocator());
+V basic_string(const basic_string& str, size_type pos = 0,
+ size_type n = npos, const Allocator& a = Allocator());
+V basic_string(const charT* s,
+ size_type n, const Allocator& a = Allocator());
+V basic_string(const charT* s, const Allocator& a = Allocator());
+V basic_string(size_type n, charT c, const Allocator& a = Allocator());
+V template<class InputIterator>
+ basic_string(InputIterator begin, InputIterator end,
+ const Allocator& a = Allocator());
+V ~basic_string();
+V basic_string& operator=(const basic_string& str);
+V basic_string& operator=(const charT* s);
+V basic_string& operator=(charT c);
+ // _lib.string.iterators_ iterators:
+V iterator begin();
+V const_iterator begin() const;
+V iterator end();
+V const_iterator end() const;
+
+V reverse_iterator rbegin();
+V const_reverse_iterator rbegin() const;
+V reverse_iterator rend();
+V const_reverse_iterator rend() const;
+ // _lib.string.capacity_ capacity:
+V size_type size() const;
+V size_type length() const;
+V size_type max_size() const;
+V void resize(size_type n, charT c);
+V void resize(size_type n);
+V size_type capacity() const;
+V void reserve(size_type res_arg = 0);
+V void clear();
+V bool empty() const;
+ // _lib.string.access_ element access:
+V const_reference operator[](size_type pos) const;
+V reference operator[](size_type pos);
+V const_reference at(size_type n) const;
+V reference at(size_type n);
+ // _lib.string.modifiers_ modifiers:
+V basic_string& operator+=(const basic_string& str);
+V basic_string& operator+=(const charT* s);
+V basic_string& operator+=(charT c);
+V basic_string& append(const basic_string& str);
+V basic_string& append(const basic_string& str, size_type pos,
+ size_type n);
+V basic_string& append(const charT* s, size_type n);
+V basic_string& append(const charT* s);
+V basic_string& append(size_type n, charT c);
+V template<class InputIterator>
+ basic_string& append(InputIterator first, InputIterator last);
+V void push_back(const charT);
+
+V basic_string& assign(const basic_string&);
+V basic_string& assign(const basic_string& str, size_type pos,
+ size_type n);
+V basic_string& assign(const charT* s, size_type n);
+V basic_string& assign(const charT* s);
+V basic_string& assign(size_type n, charT c);
+V template<class InputIterator>
+ basic_string& assign(InputIterator first, InputIterator last);
+V basic_string& insert(size_type pos1, const basic_string& str);
+V basic_string& insert(size_type pos1, const basic_string& str,
+ size_type pos2, size_type n);
+V basic_string& insert(size_type pos, const charT* s, size_type n);
+V basic_string& insert(size_type pos, const charT* s);
+V basic_string& insert(size_type pos, size_type n, charT c);
+V iterator insert(iterator p, charT c);
+V void insert(iterator p, size_type n, charT c);
+V template<class InputIterator>
+ void insert(iterator p, InputIterator first, InputIterator last);
+V basic_string& erase(size_type pos = 0, size_type n = npos);
+V iterator erase(iterator position);
+V iterator erase(iterator first, iterator last);
+V basic_string& replace(size_type pos1, size_type n1,
+ const basic_string& str);
+V basic_string& replace(size_type pos1, size_type n1,
+ const basic_string& str,
+ size_type pos2, size_type n2);
+V basic_string& replace(size_type pos, size_type n1, const charT* s,
+ size_type n2);
+V basic_string& replace(size_type pos, size_type n1, const charT* s);
+V basic_string& replace(size_type pos, size_type n1, size_type n2,
+ charT c);
+V basic_string& replace(iterator i1, iterator i2, const basic_string& str);
+V basic_string& replace(iterator i1, iterator i2, const charT* s,
+ size_type n);
+V basic_string& replace(iterator i1, iterator i2, const charT* s);
+V basic_string& replace(iterator i1, iterator i2,
+ size_type n, charT c);
+V template<class InputIterator>
+ basic_string& replace(iterator i1, iterator i2,
+ InputIterator j1, InputIterator j2);
+V size_type copy(charT* s, size_type n, size_type pos = 0) const;
+V void swap(basic_string<charT,traits,Allocator>&);
+ // _lib.string.ops_ string operations:
+V const charT* c_str() const; // explicit
+V const charT* data() const;
+V allocator_type get_allocator() const;
+V size_type find (const basic_string& str, size_type pos = 0) const;
+V size_type find (const charT* s, size_type pos, size_type n) const;
+V size_type find (const charT* s, size_type pos = 0) const;
+V size_type find (charT c, size_type pos = 0) const;
+V size_type rfind(const basic_string& str, size_type pos = npos) const;
+V size_type rfind(const charT* s, size_type pos, size_type n) const;
+V size_type rfind(const charT* s, size_type pos = npos) const;
+V size_type rfind(charT c, size_type pos = npos) const;
+
+V size_type find_first_of(const basic_string& str,
+ size_type pos = 0) const;
+V size_type find_first_of(const charT* s,
+ size_type pos, size_type n) const;
+V size_type find_first_of(const charT* s, size_type pos = 0) const;
+V size_type find_first_of(charT c, size_type pos = 0) const;
+V size_type find_last_of (const basic_string& str,
+ size_type pos = npos) const;
+V size_type find_last_of (const charT* s,
+ size_type pos, size_type n) const;
+V size_type find_last_of (const charT* s, size_type pos = npos) const;
+V size_type find_last_of (charT c, size_type pos = npos) const;
+V size_type find_first_not_of(const basic_string& str,
+ size_type pos = 0) const;
+V size_type find_first_not_of(const charT* s, size_type pos,
+ size_type n) const;
+V size_type find_first_not_of(const charT* s, size_type pos = 0) const;
+V size_type find_first_not_of(charT c, size_type pos = 0) const;
+V size_type find_last_not_of (const basic_string& str,
+ size_type pos = npos) const;
+V size_type find_last_not_of (const charT* s, size_type pos,
+ size_type n) const;
+V size_type find_last_not_of (const charT* s,
+ size_type pos = npos) const;
+V size_type find_last_not_of (charT c, size_type pos = npos) const;
+V basic_string substr(size_type pos = 0, size_type n = npos) const;
+V int compare(const basic_string& str) const;
+V int compare(size_type pos1, size_type n1,
+ const basic_string& str) const;
+V int compare(size_type pos1, size_type n1,
+ const basic_string& str,
+ size_type pos2, size_type n2) const;
+V int compare(const charT* s) const;
+V int compare(size_type pos1, size_type n1,
+ const charT* s, size_type n2 = npos) const;
+ };
+ }
+
+ 21.4 Null-terminated sequence utilities [lib.c.strings]
+
+ Table 10--Header <cctype> synopsis
+
+ isalnum isdigit isprint isupper tolower
+X isalpha isgraph ispunct isxdigit toupper
+ iscntrl islower isspace
+
+ Table 11--Header <cwctype> synopsis
+
+X Macro: WEOF <cwctype>
+X Types: wctrans_t wctype_t wint_t <cwctype>
+ Functions:
+X iswalnum iswctype iswlower iswspace towctrans wctrans
+X iswalpha iswdigit iswprint iswupper towlower wctype
+X iswcntrl iswgraph iswpunct iswxdigit towupper
+
+ Table 12--Header <cstring> synopsis
+
+X Macro: NULL <cstring>
+X Type: size_t <cstring>
+ Functions:
+X memchr strcat strcspn strncpy strtok
+X memcmp strchr strerror strpbrk strxfrm
+X memcpy strcmp strlen strrchr
+X memmove strcoll strncat strspn
+X memset strcpy strncmp strstr
+
+ Table 13--Header <cwchar> synopsis
+ Macros: NULL <cwchar> WCHAR_MAX WCHAR_MIN WEOF <cwchar>
+ Types: mbstate_t wint_t <cwchar> size_t
+ Functions:
+X btowc getwchar ungetwc wcscpy wcsrtombs wmemchr
+X fgetwc mbrlen vfwprintf wcscspn wcsspn wmemcmp
+X fgetws mbrtowc vswprintf wcsftime wcsstr wmemcpy
+X fputwc mbsinit vwprintf wcslen wcstod wmemmove
+X fputws mbsrtowcs wcrtomb wcsncat wcstok wmemset
+X fwide putwc wcscat wcsncmp wcstol wprintf
+X fwprintf putwchar wcschr wcsncpy wcstoul wscanf
+X fwscanf swprintf wcscmp wcspbrk wcsxfrm
+X getwc swscanf wcscoll wcsrchr wctob
+
+ Table 14--Header <cstdlib> synopsis
+
+ Macros: MB_CUR_MAX
+ Functions:
+X atol mblen strtod wctomb
+X atof mbstowcs strtol wcstombs
+X atoi mbtowc strtoul
+
+X const char* strchr(const char* s, int c);
+X char* strchr( char* s, int c);
+
+X const char* strpbrk(const char* s1, const char* s2);
+X char* strpbrk( char* s1, const char* s2);
+
+X const char* strrchr(const char* s, int c);
+X char* strrchr( char* s, int c);
+
+X const char* strstr(const char* s1, const char* s2);
+X char* strstr( char* s1, const char* s2);
+
+X const void* memchr(const void* s, int c, size_t n);
+X void* memchr( void* s, int c, size_t n);
+
+X const wchar_t* wcschr(const wchar_t* s, wchar_t c);
+X wchar_t* wcschr( wchar_t* s, wchar_t c);
+
+X const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);
+X wchar_t* wcspbrk( wchar_t* s1, const wchar_t* s2);
+
+X const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
+X wchar_t* wcsrchr( wchar_t* s, wchar_t c);
+
+X const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
+X wchar_t* wcsstr( wchar_t* s1, const wchar_t* s2);
+
+X const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
+X wchar_t* wmemchr( wchar_t* s, wchar_t c, size_t n);
+
+ [for initial efforts on the above, see shadow/string.h]
+
+ 22.1 Locales [lib.locales]
+
+ Header <locale> synopsis
+
+ // _lib.locale_, locale:
+T class locale;
+T template <class Facet> const Facet& use_facet(const locale&);
+T template <class Facet> bool has_facet(const locale&) throw();
+
+ // _lib.locale.convenience_, convenience interfaces:
+T template <class charT> bool isspace (charT c, const locale& loc);
+T template <class charT> bool isprint (charT c, const locale& loc);
+T template <class charT> bool iscntrl (charT c, const locale& loc);
+T template <class charT> bool isupper (charT c, const locale& loc);
+T template <class charT> bool islower (charT c, const locale& loc);
+T template <class charT> bool isalpha (charT c, const locale& loc);
+T template <class charT> bool isdigit (charT c, const locale& loc);
+T template <class charT> bool ispunct (charT c, const locale& loc);
+T template <class charT> bool isxdigit(charT c, const locale& loc);
+T template <class charT> bool isalnum (charT c, const locale& loc);
+T template <class charT> bool isgraph (charT c, const locale& loc);
+T template <class charT> charT toupper(charT c, const locale& loc);
+T template <class charT> charT tolower(charT c, const locale& loc);
+ // _lib.category.ctype_ and _lib.facet.ctype.special_, ctype:
+ class ctype_base;
+T template <class charT> class ctype;
+T template <> class ctype<char>; // specialization
+S template <class charT> class ctype_byname;
+S template <> class ctype_byname<char>; // specialization
+T class codecvt_base;
+X template <class internT, class externT, class stateT> class codecvt;
+S template <class internT, class externT, class stateT> class codecvt_byname;
+ // _lib.category.numeric_ and _lib.facet.numpunct_, numeric:
+X template <class charT, class InputIterator> class num_get;
+X template <class charT, class OutputIterator> class num_put;
+T template <class charT> class numpunct;
+S template <class charT> class numpunct_byname;
+ // _lib.category.collate_, collation:
+T template <class charT> class collate;
+S template <class charT> class collate_byname;
+ // _lib.category.time_, date and time:
+T class time_base;
+S template <class charT, class InputIterator> class time_get;
+S template <class charT, class InputIterator> class time_get_byname;
+S template <class charT, class OutputIterator> class time_put;
+S template <class charT, class OutputIterator> class time_put_byname;
+ // _lib.category.monetary_, money:
+T class money_base;
+S template <class charT, class InputIterator> class money_get;
+S template <class charT, class OutputIterator> class money_put;
+S template <class charT, bool Intl> class moneypunct;
+S template <class charT, bool Intl> class moneypunct_byname;
+ // _lib.category.messages_, message retrieval:
+T class messages_base;
+S template <class charT> class messages;
+S template <class charT> class messages_byname;
+
+
+ 22.1.1 Class locale [lib.locale]
+
+X class locale {
+ public:
+ // types:
+T class facet;
+T class id;
+T typedef int category;
+T static const category // values assigned here are for exposition only
+T none = 0,
+T collate = 0x010, ctype = 0x020,
+T monetary = 0x040, numeric = 0x080,
+T time = 0x100, messages = 0x200,
+T all = collate | ctype | monetary | numeric | time | messages;
+ // construct/copy/destroy:
+T locale() throw()
+T locale(const locale& other) throw()
+X explicit locale(const char* std_name);
+X locale(const locale& other, const char* std_name, category);
+T template <class Facet> locale(const locale& other, Facet* f);
+T locale(const locale& other, const locale& one, category);
+T ~locale() throw(); // non-virtual
+T const locale& operator=(const locale& other) throw();
+T template <class Facet> locale combine(const locale& other) const;
+ // locale operations:
+X basic_string<char> name() const;
+T bool operator==(const locale& other) const;
+T bool operator!=(const locale& other) const;
+T template <class charT, class Traits, class Allocator>
+ bool operator()(const basic_string<charT,Traits,Allocator>& s1,
+ const basic_string<charT,Traits,Allocator>& s2) const;
+ // global locale objects:
+T static locale global(const locale&);
+T static const locale& classic();
+ };
+
+ 22.1.1.1 locale types [lib.locale.types]
+
+ 22.1.1.1.1 Type locale::category [lib.locale.category]
+
+T typedef int category;
+
+T none, collate, ctype, monetary, numeric, time, and messages
+
+ [required locale members]
+T collate<char>, collate<wchar_t>
+T ctype<char>, ctype<wchar_t>
+T codecvt<char,char,mbstate_t>,
+S codecvt<wchar_t,char,mbstate_t>
+T moneypunct<char>, moneypunct<wchar_t>
+T moneypunct<char,true>, moneypunct<wchar_t,true>,
+S money_get<char>, money_get<wchar_t
+S money_put<char>, money_put<wchar_t>
+T numpunct<char>, numpunct<wchar_t>,
+X num_get<char>, num_get<wchar_t>
+X num_put<char>, num_put<wchar_t>
+S time_get<char>, time_get<wchar_t>,
+S time_put<char>, time_put<wchar_t>
+S messages<char>, messages<wchar_t>
+
+ [required instantiations]
+S collate_byname<char>, collate_byname<wchar_t>
+S ctype_byname<char>, ctype_byname<wchar_t>
+S codecvt_byname<char,char,mbstate_t>,
+S codecvt_byname<wchar_t,char,mbstate_t>
+S moneypunct_byname<char,International>,
+S moneypunct_byname<wchar_t,International>,
+S money_get<C,InputIterator>,
+S money_put<C,OutputIterator>
+S numpunct_byname<char>, numpunct_byname<wchar_t>
+X num_get<C,InputIterator>, num_put<C,OutputIterator>
+S time_get<char,InputIterator>,
+S time_get_byname<char,InputIterator>,
+S time_get<wchar_t,OutputIterator>,
+S time_get_byname<wchar_t,OutputIterator>,
+S time_put<char,OutputIterator>,
+S time_put_byname<char,OutputIterator>,
+S time_put<wchar_t,OutputIterator>
+S time_put_byname<wchar_t,OutputIterator>
+S messages_byname<char>, messages_byname<wchar_t>
+
+
+ 22.1.1.1.2 Class locale::facet [lib.locale.facet]
+
+T class locale::facet {
+ protected:
+T explicit facet(size_t refs = 0);
+T virtual ~facet();
+ private:
+T facet(const facet&); // not defined
+T void operator=(const facet&); // not defined
+ };
+ }
+
+
+ 22.1.1.1.3 Class locale::id [lib.locale.id]
+
+T class locale::id {
+ public:
+T id();
+ private:
+T void operator=(const id&); // not defined
+T id(const id&); // not defined
+ };
+ }
+
+
+ 22.2.1 The ctype category [lib.category.ctype]
+
+T class ctype_base {
+ public:
+T enum mask { // numeric values are for exposition only.
+T space=, print=, cntrl=, upper=, lower=,
+T alpha=, digit=, punct=, xdigit=,
+T alnum=, graph=
+ };
+ };
+
+
+ 22.2.1.1 Template class ctype [lib.locale.ctype]
+
+T template <class charT>
+ class ctype : public locale::facet, public ctype_base {
+ public:
+T typedef charT char_type;
+T explicit ctype(size_t refs = 0);
+T bool is(mask m, charT c) const;
+T const charT* is(const charT* low, const charT* high, mask* vec) const;
+T const charT* scan_is(mask m,
+ const charT* low, const charT* high) const;
+T const charT* scan_not(mask m,
+ const charT* low, const charT* high) const;
+T charT toupper(charT c) const;
+T const charT* toupper(charT* low, const charT* high) const;
+T charT tolower(charT c) const;
+T const charT* tolower(charT* low, const charT* high) const;
+T charT widen(char c) const;
+T const char* widen(const char* low, const char* high, charT* to) const;
+T char narrow(charT c, char dfault) const;
+T const charT* narrow(const charT* low, const charT*, char dfault,
+ char* to) const;
+T static locale::id id;
+
+ protected:
+T ~ctype(); // virtual
+T virtual bool do_is(mask m, charT c) const;
+T virtual const charT* do_is(const charT* low, const charT* high,
+ mask* vec) const;
+T virtual const charT* do_scan_is(mask m,
+ const charT* low, const charT* high) const;
+T virtual const charT* do_scan_not(mask m,
+ const charT* low, const charT* high) const;
+T virtual charT do_toupper(charT) const;
+T virtual const charT* do_toupper(charT* low, const charT* high) const;
+T virtual charT do_tolower(charT) const;
+T virtual const charT* do_tolower(charT* low, const charT* high) const;
+T virtual charT do_widen(char) const;
+T virtual const char* do_widen(const char* low, const char* high,
+ charT* dest) const;
+T virtual char do_narrow(charT, char dfault) const;
+T virtual const charT* do_narrow(const charT* low, const charT* high,
+ char dfault, char* dest) const;
+ };
+
+
+ 22.2.1.2 Template class ctype_byname [lib.locale.ctype.byname]
+
+X template <class charT>
+ class ctype_byname : public ctype<charT> {
+ public:
+T typedef ctype<charT>::mask mask;
+S explicit ctype_byname(const char*, size_t refs = 0);
+ protected:
+S ~ctype_byname(); // virtual
+S virtual bool do_is(mask m, charT c) const;
+S virtual const charT* do_is(const charT* low, const charT* high,
+ mask* vec) const;
+S virtual const char* do_scan_is(mask m,
+ const charT* low, const charT* high) const;
+S virtual const char* do_scan_not(mask m,
+ const charT* low, const charT* high) const;
+S virtual charT do_toupper(charT) const;
+S virtual const charT* do_toupper(charT* low, const charT* high) const;
+S virtual charT do_tolower(charT) const;
+S virtual const charT* do_tolower(charT* low, const charT* high) const;
+S virtual charT do_widen(char) const;
+S virtual const char* do_widen(const char* low, const char* high,
+ charT* dest) const;
+S virtual char do_narrow(charT, char dfault) const;
+S virtual const charT* do_narrow(const charT* low, const charT* high,
+ char dfault, char* dest) const;
+ };
+
+ 22.2.1.3 ctype specializations [lib.facet.ctype.special]
+
+T template <> class ctype<char>
+ : public locale::facet, public ctype_base {
+ public:
+T typedef char char_type;
+T explicit ctype(const mask* tab = 0, bool del = false,
+ size_t refs = 0);
+T bool is(mask m, char c) const;
+T const char* is(const char* low, const char* high, mask* vec) const;
+T const char* scan_is (mask m,
+ const char* low, const char* high) const;
+T const char* scan_not(mask m,
+ const char* low, const char* high) const;
+T char toupper(char c) const;
+T const char* toupper(char* low, const char* high) const;
+T char tolower(char c) const;
+T const char* tolower(char* low, const char* high) const;
+T char widen(char c) const;
+T const char* widen(const char* low, const char* high, char* to) const;
+T char narrow(char c, char dfault) const;
+T const char* narrow(const char* low, const char* high, char dfault,
+ char* to) const;
+T static locale::id id;
+T static const size_t table_size = IMPLEMENTATION_DEFINED;
+
+ protected:
+T const mask* table() const throw();
+T static const mask* classic_table() throw();
+T ~ctype(); // virtual
+T virtual char do_toupper(char c) const;
+T virtual const char* do_toupper(char* low, const char* high) const;
+T virtual char do_tolower(char c) const;
+T virtual const char* do_tolower(char* low, const char* high) const;
+
+T virtual char do_widen(char c) const;
+T virtual const char* do_widen(const char* low,
+ const char* high,
+ char* to) const;
+T virtual char do_narrow(char c, char dfault) const;
+T virtual const char* do_narrow(const char* low,
+ const char* high,
+ char dfault, char* to) const;
+ };
+
+
+ 22.2.1.4 Class [lib.locale.ctype.byname.special]
+ ctype_byname<char>
+
+X template <> class ctype_byname<char> : public ctype<char> {
+ public:
+S explicit ctype_byname(const char*, size_t refs = 0);
+ protected:
+S ~ctype_byname(); // virtual
+S virtual char do_toupper(char c) const;
+S virtual const char* do_toupper(char* low, const char* high) const;
+S virtual char do_tolower(char c) const;
+S virtual const char* do_tolower(char* low, const char* high) const;
+
+S virtual char do_widen(char c) const;
+S virtual const char* do_widen(char* low,
+ const char* high,
+ char* to) const;
+S virtual char do_widen(char c) const;
+S virtual const char* do_widen(char* low, const char* high) const;
+
+ };
+
+
+
+ 22.2.1.5 Template class codecvt [lib.locale.codecvt]
+
+T class codecvt_base {
+ public:
+T enum result { ok, partial, error, noconv };
+ };
+
+T template <class internT, class externT, class stateT>
+ class codecvt : public locale::facet, public codecvt_base {
+ public:
+T typedef internT intern_type;
+T typedef externT extern_type;
+T typedef stateT state_type;
+T explicit codecvt(size_t refs = 0)
+T result out(stateT& state,
+ const internT* from, const internT* from_end, const internT*& from_next,
+ externT* to, externT* to_limit, externT*& to_next) const;
+T result unshift(stateT& state,
+ externT* to, externT* to_limit, externT*& to_next) const;
+T result in(stateT& state,
+ const externT* from, const externT* from_end, const externT*& from_next,
+ internT* to, internT* to_limit, internT*& to_next) const;
+T int encoding() const throw();
+T bool always_noconv() const throw();
+T int length(const stateT&, const externT* from, const externT* end,
+ size_t max) const;
+T int max_length() const throw();
+T static locale::id id;
+
+ protected:
+T ~codecvt(); // virtual
+T virtual result do_out(stateT& state,
+ const internT* from, const internT* from_end, const internT*& from_next,
+ externT* to, externT* to_limit, externT*& to_next) const;
+T virtual result do_in(stateT& state,
+T const externT* from, const externT* from_end, const externT*& from_next,
+ internT* to, internT* to_limit, internT*& to_next) const;
+T virtual result do_unshift(stateT& state,
+ externT* to, externT* to_limit, externT*& to_next) const;
+T virtual int do_encoding() const throw();
+T virtual bool do_always_noconv() const throw();
+T virtual int do_length(const stateT&, const externT* from,
+ const externT* end, size_t max) const;
+T virtual int do_max_length() const throw();
+ };
+ }
+
+
+ 22.2.1.6 Template class [lib.locale.codecvt.byname]
+ codecvt_byname
+
+X template <class internT, class externT, class stateT>
+ class codecvt_byname : public codecvt<internT, externT, stateT> {
+ public:
+S explicit codecvt_byname(const char*, size_t refs = 0);
+ protected:
+S ~codecvt_byname(); // virtual
+S virtual result do_out(stateT& state,
+ const internT* from, const internT* from_end, const internT*& from_next,
+ externT* to, externT* to_limit, externT*& to_next) const;
+S virtual result do_in(stateT& state,
+ const externT* from, const externT* from_end, const externT*& from_next,
+ internT* to, internT* to_limit, internT*& to_next) const;
+S virtual result do_unshift(stateT& state,
+ externT* to, externT* to_limit, externT*& to_next) const;
+S virtual int do_encoding() const throw();
+S virtual bool do_always_noconv() const throw();
+S virtual int do_length(const stateT&, const externT* from,
+ const externT* end, size_t max) const;
+S virtual result do_unshift(stateT& state,
+ externT* to, externT* to_limit, externT*& to_next) const;
+S virtual int do_max_length() const throw();
+ };
+
+
+ 22.2.2.1 Template class num_get [lib.locale.num.get]
+
+X template <class charT, class InputIterator = istreambuf_iterator<charT> >
+ class num_get : public locale::facet {
+ public:
+T typedef charT char_type;
+T typedef InputIterator iter_type;
+T explicit num_get(size_t refs = 0);
+T iter_type get(iter_type in, iter_type end, ios_base&,
+ ios_base::iostate& err, bool& v) const;
+T iter_type get(iter_type in, iter_type end, ios_base& ,
+ ios_base::iostate& err, long& v) const;
+T iter_type get(iter_type in, iter_type end, ios_base&,
+ ios_base::iostate& err, unsigned short& v) const;
+T iter_type get(iter_type in, iter_type end, ios_base&,
+ ios_base::iostate& err, unsigned int& v) const;
+T iter_type get(iter_type in, iter_type end, ios_base&,
+ ios_base::iostate& err, unsigned long& v) const;
+T iter_type get(iter_type in, iter_type end, ios_base&,
+ ios_base::iostate& err, float& v) const;
+T iter_type get(iter_type in, iter_type end, ios_base&,
+ ios_base::iostate& err, double& v) const;
+T iter_type get(iter_type in, iter_type end, ios_base&,
+ ios_base::iostate& err, long double& v) const;
+T iter_type get(iter_type in, iter_type end, ios_base&,
+ ios_base::iostate& err, void*& v) const;
+T static locale::id id;
+
+ protected:
+T ~num_get(); // virtual
+T virtual iter_type do_get(iter_type, iter_type, ios_base&,
+ ios_base::iostate& err, bool& v) const;
+S virtual iter_type do_get(iter_type, iter_type, ios_base&,
+ ios_base::iostate& err, long& v) const;
+S virtual iter_type do_get(iter_type, iter_type, ios_base&,
+ ios_base::iostate& err, unsigned short& v) const;
+S virtual iter_type do_get(iter_type, iter_type, ios_base&,
+ ios_base::iostate& err, unsigned int& v) const;
+S virtual iter_type do_get(iter_type, iter_type, ios_base&,
+ ios_base::iostate& err, unsigned long& v) const;
+S virtual iter_type do_get(iter_type, iter_type, ios_base&,
+ ios_base::iostate& err, float& v) const;
+S virtual iter_type do_get(iter_type, iter_type, ios_base&,
+ ios_base::iostate& err, double& v) const;
+S virtual iter_type do_get(iter_type, iter_type, ios_base&,
+ ios_base::iostate& err, long double& v) const;
+S virtual iter_type do_get(iter_type, iter_type, ios_base&,
+ ios_base::iostate& err, void*& v) const;
+ };
+
+
+
+ 22.2.2.2 Template class num_put [lib.locale.nm.put]
+
+X template <class charT, class OutputIterator = ostreambuf_iterator<charT> >
+ class num_put : public locale::facet {
+ public:
+T typedef charT char_type;
+T typedef OutputIterator iter_type;
+T explicit num_put(size_t refs = 0);
+T iter_type put(iter_type s, ios_base& f, char_type fill, bool v) const;
+T iter_type put(iter_type s, ios_base& f, char_type fill, long v) const;
+T iter_type put(iter_type s, ios_base& f, char_type fill,
+ unsigned long v) const;
+T iter_type put(iter_type s, ios_base& f, char_type fill,
+ double v) const;
+T iter_type put(iter_type s, ios_base& f, char_type fill,
+ long double v) const;
+T iter_type put(iter_type s, ios_base& f, char_type fill,
+ const void* v) const;
+T static locale::id id;
+ protected:
+T ~num_put(); // virtual
+T virtual iter_type do_put(iter_type, ios_base&, char_type fill,
+ bool v) const;
+T virtual iter_type do_put(iter_type, ios_base&, char_type fill,
+ long v) const;
+T virtual iter_type do_put(iter_type, ios_base&, char_type fill,
+ unsigned long) const;
+S virtual iter_type do_put(iter_type, ios_base&, char_type fill,
+ double v) const;
+S virtual iter_type do_put(iter_type, ios_base&, char_type fill,
+ long double v) const;
+T virtual iter_type do_put(iter_type, ios_base&, char_type fill,
+ const void* v) const;
+ };
+ }
+
+ 22.2.3.1 Template class numpunct [lib.locale.numpunct]
+
+T template <class charT>
+ class numpunct : public locale::facet {
+ public:
+T typedef charT char_type;
+T typedef basic_string<charT> string_type;
+T explicit numpunct(size_t refs = 0);
+T char_type decimal_point() const;
+T char_type thousands_sep() const;
+T string grouping() const;
+T string_type truename() const;
+T string_type falsename() const;
+T static locale::id id;
+ protected:
+T ~numpunct(); // virtual
+T virtual char_type do_decimal_point() const;
+T virtual char_type do_thousands_sep() const;
+T virtual string do_grouping() const;
+T virtual string_type do_truename() const; // for bool
+T virtual string_type do_falsename() const; // for bool
+ };
+ }
+
+
+
+ 22.2.3.2 Template class [lib.locale.numpunct.byname]
+ numpunct_byname
+
+X template <class charT>
+ class numpunct_byname : public numpunct<charT> {
+ // this class is specialized for char and wchar_t.
+ public:
+T typedef charT char_type;
+T typedef basic_string<charT> string_type;
+S explicit numpunct_byname(const char*, size_t refs = 0);
+ protected:
+S ~numpunct_byname(); // virtual
+S virtual char_type do_decimal_point() const;
+S virtual char_type do_thousands_sep() const;
+S virtual string do_grouping() const;
+S virtual string_type do_truename() const; // for bool
+S virtual string_type do_falsename() const; // for bool
+ };
+
+
+ 22.2.4.1 Template class collate [lib.locale.collate]
+
+T template <class charT>
+ class collate : public locale::facet {
+ public:
+T typedef charT char_type;
+T typedef basic_string<charT> string_type;
+T explicit collate(size_t refs = 0);
+T int compare(const charT* low1, const charT* high1,
+ const charT* low2, const charT* high2) const;
+T string_type transform(const charT* low, const charT* high) const;
+T long hash(const charT* low, const charT* high) const;
+T static locale::id id;
+ protected:
+T ~collate(); // virtual
+T virtual int do_compare(const charT* low1, const charT* high1,
+ const charT* low2, const charT* high2) const;
+T virtual string_type do_transform
+ (const charT* low, const charT* high) const;
+T virtual long do_hash (const charT* low, const charT* high) const;
+ };
+
+
+ 22.2.4.2 Template class [lib.locale.collate.byname]
+ collate_byname
+
+X template <class charT>
+ class collate_byname : public collate<charT> {
+ public:
+T typedef basic_string<charT> string_type;
+T explicit collate_byname(const char*, size_t refs = 0);
+ protected:
+S ~collate_byname(); // virtual
+S virtual int do_compare(const charT* low1, const charT* high1,
+ const charT* low2, const charT* high2) const;
+S virtual string_type do_transform
+ (const charT* low, const charT* high) const;
+S virtual long do_hash (const charT* low, const charT* high) const;
+ };
+
+
+ 22.2.5.1 Template class time_get [lib.locale.time.get]
+
+T class time_base {
+ public:
+T enum dateorder { no_order, dmy, mdy, ymd, ydm };
+ };
+
+ [Note: semantics of time_get members are implementation-defined.
+ To complete implementation requires documenting behavior.]
+
+X template <class charT, class InputIterator = istreambuf_iterator<charT> >
+ class time_get : public locale::facet, public time_base {
+ public:
+T typedef charT char_type;
+T typedef InputIterator iter_type;
+T explicit time_get(size_t refs = 0);
+
+T dateorder date_order() const { return do_date_order(); }
+T iter_type get_time(iter_type s, iter_type end, ios_base& f,
+ ios_base::iostate& err, tm* t) const;
+T iter_type get_date(iter_type s, iter_type end, ios_base& f,
+ ios_base::iostate& err, tm* t) const;
+T iter_type get_weekday(iter_type s, iter_type end, ios_base& f,
+ ios_base::iostate& err, tm* t) const;
+T iter_type get_monthname(iter_type s, iter_type end, ios_base& f,
+ ios_base::iostate& err, tm* t) const;
+T iter_type get_year(iter_type s, iter_type end, ios_base& f,
+ ios_base::iostate& err, tm* t) const;
+T static locale::id id;
+ protected:
+ ~time_get(); // virtual
+X virtual dateorder do_date_order() const;
+S virtual iter_type do_get_time(iter_type s, iter_type end, ios_base&,
+ ios_base::iostate& err, tm* t) const;
+S virtual iter_type do_get_date(iter_type s, iter_type end, ios_base&,
+ ios_base::iostate& err, tm* t) const;
+S virtual iter_type do_get_weekday(iter_type s, iter_type end, ios_base&,
+ ios_base::iostate& err, tm* t) const;
+S virtual iter_type do_get_monthname(iter_type s, ios_base&,
+ ios_base::iostate& err, tm* t) const;
+S virtual iter_type do_get_year(iter_type s, iter_type end, ios_base&,
+ ios_base::iostate& err, tm* t) const;
+ };
+
+
+
+ 22.2.5.2 Template class [lib.locale.time.get.byname]
+ time_get_byname
+
+X template <class charT, class InputIterator = istreambuf_iterator<charT> >
+ class time_get_byname : public time_get<charT, InputIterator> {
+ public:
+T typedef time_base::dateorder dateorder;
+T typedef InputIterator iter_type
+
+S explicit time_get_byname(const char*, size_t refs = 0);
+ protected:
+S ~time_get_byname(); // virtual
+S virtual dateorder do_date_order() const;
+S virtual iter_type do_get_time(iter_type s, iter_type end, ios_base&,
+ ios_base::iostate& err, tm* t) const;
+S virtual iter_type do_get_date(iter_type s, iter_type end, ios_base&,
+ ios_base::iostate& err, tm* t) const;
+T virtual iter_type do_get_weekday(iter_type s, iter_type end, ios_base&,
+ ios_base::iostate& err, tm* t) const;
+T virtual iter_type do_get_monthname(iter_type s, iter_type end, ios_base&,
+ ios_base::iostate& err, tm* t) const;
+S virtual iter_type do_get_year(iter_type s, iter_type end, ios_base&,
+ ios_base::iostate& err, tm* t) const;
+ };
+ }
+
+ 22.2.5.3 Template class time_put [lib.locale.time.put]
+
+X template <class charT, class OutputIterator = ostreambuf_iterator<charT> >
+ class time_put : public locale::facet {
+ public:
+T typedef charT char_type;
+T typedef OutputIterator iter_type;
+T explicit time_put(size_t refs = 0);
+ // the following is implemented in terms of other member functions.
+S iter_type put(iter_type s, ios_base& f, char_type fill, const tm* tmb,
+ const charT* pattern, const charT* pat_end) const;
+T iter_type put(iter_type s, ios_base& f, char_type fill,
+ const tm* tmb, char format, char modifier = 0) const;
+T static locale::id id;
+ protected:
+T ~time_put(); // virtual
+S virtual iter_type do_put(iter_type s, ios_base&, char_type, const tm* t,
+ char format, char modifier) const;
+ };
+
+
+
+ 22.2.5.4 Template class [lib.locale.time.put.byname]
+ time_put_byname
+
+T template <class charT, class OutputIterator = ostreambuf_iterator<charT> >
+ class time_put_byname : public time_put<charT, OutputIterator>
+ {
+ public:
+T typedef charT char_type;
+T typedef OutputIterator iter_type;
+
+T explicit time_put_byname(const char*, size_t refs = 0);
+ protected:
+T ~time_put_byname(); // virtual
+S virtual iter_type do_put(iter_type s, ios_base&, char_type, const tm* t,
+ char format, char modifier) const;
+ };
+
+
+ 22.2.6.1 Template class money_get [lib.locale.money.get]
+
+X template <class charT,
+ class InputIterator = istreambuf_iterator<charT> >
+ class money_get : public locale::facet {
+ public:
+T typedef charT char_type;
+T typedef InputIterator iter_type;
+T typedef basic_string<charT> string_type;
+T explicit money_get(size_t refs = 0);
+T iter_type get(iter_type s, iter_type end, bool intl,
+ ios_base& f, ios_base::iostate& err,
+ long double& units) const;
+T iter_type get(iter_type s, iter_type end, bool intl,
+ ios_base& f, ios_base::iostate& err,
+ string_type& digits) const;
+T static locale::id id;
+ protected:
+T ~money_get(); // virtual
+S virtual iter_type do_get(iter_type, iter_type, bool, ios_base&,
+ ios_base::iostate& err, long double& units) const;
+S virtual iter_type do_get(iter_type, iter_type, bool, ios_base&,
+ ios_base::iostate& err, string_type& digits) const;
+ };
+
+ 22.2.6.2 Template class money_put [lib.locale.money.put]
+
+X template <class charT,
+ class OutputIterator = ostreambuf_iterator<charT> >
+ class money_put : public locale::facet {
+ public:
+T typedef charT char_type;
+T typedef OutputIterator iter_type;
+T typedef basic_string<charT> string_type;
+T explicit money_put(size_t refs = 0);
+T iter_type put(iter_type s, bool intl, ios_base& f,
+ char_type fill, long double units) const;
+T iter_type put(iter_type s, bool intl, ios_base& f,
+ char_type fill, const string_type& digits) const;
+T static locale::id id;
+
+ protected:
+T ~money_put(); // virtual
+S virtual iter_type
+ do_put(iter_type, bool, ios_base&, char_type fill,
+ long double units) const;
+S virtual iter_type
+ do_put(iter_type, bool, ios_base&, char_type fill,
+ const string_type& digits) const;
+ };
+
+
+ 22.2.6.3 Template class moneypunct [lib.locale.moneypunct]
+
+T class money_base {
+ public:
+T enum part { none, space, symbol, sign, value };
+T struct pattern { char field[4]; };
+ };
+
+X template <class charT, bool International = false>
+ class moneypunct : public locale::facet, public money_base {
+ public:
+T typedef charT char_type;
+T typedef basic_string<charT> string_type;
+T explicit moneypunct(size_t refs = 0);
+T charT decimal_point() const;
+T charT thousands_sep() const;
+T string grouping() const;
+T string_type curr_symbol() const;
+T string_type positive_sign() const;
+T string_type negative_sign() const;
+T int frac_digits() const;
+T pattern pos_format() const;
+T pattern neg_format() const;
+T static locale::id id;
+T static const bool intl = International;
+ protected:
+T ~moneypunct(); // virtual
+S virtual charT do_decimal_point() const;
+S virtual charT do_thousands_sep() const;
+S virtual string do_grouping() const;
+S virtual string_type do_curr_symbol() const;
+S virtual string_type do_positive_sign() const;
+S virtual string_type do_negative_sign() const;
+S virtual int do_frac_digits() const;
+T virtual pattern do_pos_format() const;
+T virtual pattern do_neg_format() const;
+ };
+ }
+
+ 22.2.6.4 Template class [lib.locale.moneypunct.byname]
+ moneypunct_byname
+
+X template <class charT, bool Intl = false>
+ class moneypunct_byname : public moneypunct<charT, Intl> {
+ public:
+T typedef money_base::pattern pattern;
+T typedef basic_string<charT> string_type;
+
+T explicit moneypunct_byname(const char*, size_t refs = 0);
+ protected:
+T ~moneypunct_byname(); // virtual
+S virtual charT do_decimal_point() const;
+S virtual charT do_thousands_sep() const;
+S virtual string do_grouping() const;
+S virtual string_type do_curr_symbol() const;
+S virtual string_type do_positive_sign() const;
+S virtual string_type do_negative_sign() const;
+S virtual int do_frac_digits() const;
+S virtual pattern do_pos_format() const;
+S virtual pattern do_neg_format() const;
+ };
+
+ 22.2.7.1 Template class messages [lib.locale.messages]
+
+T class messages_base {
+ public:
+T typedef int catalog;
+ };
+
+X template <class charT>
+ class messages : public locale::facet, public messages_base {
+ public:
+T typedef charT char_type;
+T typedef basic_string<charT> string_type;
+T explicit messages(size_t refs = 0);
+T catalog open(const basic_string<char>& fn, const locale&) const;
+T string_type get(catalog c, int set, int msgid,
+ const string_type& dfault) const;
+T void close(catalog c) const;
+T static locale::id id;
+ protected:
+T ~messages(); // virtual
+S virtual catalog do_open(const basic_string<char>&, const locale&) const;
+S virtual string_type do_get(catalog, int set, int msgid,
+ const string_type& dfault) const;
+S virtual void do_close(catalog) const;
+ };
+
+ 22.2.7.2 Template class [lib.locale.messages.byname]
+ messages_byname
+
+
+X template <class charT>
+ class messages_byname : public messages<charT> {
+ public:
+T typedef messages_base::catalog catalog;
+T typedef basic_string<charT> string_type;
+
+T explicit messages_byname(const char*, size_t refs = 0);
+ protected:
+T ~messages_byname(); // virtual
+S virtual catalog do_open(const basic_string<char>&, const locale&) const;
+S virtual string_type do_get(catalog, int set, int msgid,
+ const string_type& dfault) const;
+S virtual void do_close(catalog) const;
+ };
+
+
+ 22.3 C Library Locales [lib.c.locales]
+
+
+ Table 13--Header <clocale> synopsis
+ Macros:
+X LC_ALL LC_COLLATE LC_CTYPE
+X LC_MONETARY LC_NUMERIC LC_TIME
+X NULL
+X Struct: lconv
+X Functions: localeconv setlocale
+
+
+ 23.2 Sequences [lib.sequences]
+
+ <deque>, <list>, <queue>, <stack>, and <vector>.
+
+ Header <deque> synopsis
+
+X template <class T, class Allocator = allocator<T> > class deque;
+T template <class T, class Allocator>
+ bool operator==(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator< (const deque<T,Allocator>& x, const deque<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator!=(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator> (const deque<T,Allocator>& x, const deque<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator>=(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator<=(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
+T template <class T, class Allocator>
+ void swap(deque<T,Allocator>& x, deque<T,Allocator>& y);
+ }
+
+ Header <list> synopsis
+
+X template <class T, class Allocator = allocator<T> > class list;
+T template <class T, class Allocator>
+ bool operator==(const list<T,Allocator>& x, const list<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator< (const list<T,Allocator>& x, const list<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator!=(const list<T,Allocator>& x, const list<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator> (const list<T,Allocator>& x, const list<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator>=(const list<T,Allocator>& x, const list<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator<=(const list<T,Allocator>& x, const list<T,Allocator>& y);
+T template <class T, class Allocator>
+ void swap(list<T,Allocator>& x, list<T,Allocator>& y);
+ }
+
+ Header <queue> synopsis
+
+ namespace std {
+X template <class T, class Container = deque<T> > class queue;
+T template <class T, class Container>
+ bool operator==(const queue<T, Container>& x,
+ const queue<T, Container>& y);
+T template <class T, class Container>
+ bool operator< (const queue<T, Container>& x,
+ const queue<T, Container>& y);
+T template <class T, class Container>
+ bool operator!=(const queue<T, Container>& x,
+ const queue<T, Container>& y);
+T template <class T, class Container>
+ bool operator> (const queue<T, Container>& x,
+ const queue<T, Container>& y);
+T template <class T, class Container>
+ bool operator>=(const queue<T, Container>& x,
+ const queue<T, Container>& y);
+T template <class T, class Container>
+ bool operator<=(const queue<T, Container>& x,
+ const queue<T, Container>& y);
+T template <class T, class Container = vector<T>,
+ class Compare = less<typename Container::value_type> >
+T class priority_queue;
+ }
+
+ Header <stack> synopsis
+
+ namespace std {
+T template <class T, class Container = deque<T> > class stack;
+T template <class T, class Container>
+ bool operator==(const stack<T, Container>& x,
+ const stack<T, Container>& y);
+T template <class T, class Container>
+ bool operator< (const stack<T, Container>& x,
+ const stack<T, Container>& y);
+T template <class T, class Container>
+ bool operator!=(const stack<T, Container>& x,
+ const stack<T, Container>& y);
+T template <class T, class Container>
+ bool operator> (const stack<T, Container>& x,
+ const stack<T, Container>& y);
+T template <class T, class Container>
+ bool operator>=(const stack<T, Container>& x,
+ const stack<T, Container>& y);
+T template <class T, class Container>
+ bool operator<=(const stack<T, Container>& x,
+ const stack<T, Container>& y);
+ }
+
+ Header <vector> synopsis
+
+T template <class T, class Allocator = allocator<T> > class vector;
+
+T template <class T, class Allocator>
+ bool operator==(const vector<T,Allocator>& x,
+ const vector<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator< (const vector<T,Allocator>& x,
+ const vector<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator!=(const vector<T,Allocator>& x,
+ const vector<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator> (const vector<T,Allocator>& x,
+ const vector<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator>=(const vector<T,Allocator>& x,
+ const vector<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator<=(const vector<T,Allocator>& x,
+ const vector<T,Allocator>& y);
+T template <class T, class Allocator>
+ void swap(vector<T,Allocator>& x, vector<T,Allocator>& y);
+
+T template <class Allocator> class vector<bool,Allocator>;
+T template <class Allocator>
+ bool operator==(const vector<bool,Allocator>& x,
+ const vector<bool,Allocator>& y);
+T template <class Allocator>
+ bool operator< (const vector<bool,Allocator>& x,
+ const vector<bool,Allocator>& y);
+T template <class Allocator>
+ bool operator!=(const vector<bool,Allocator>& x,
+ const vector<bool,Allocator>& y);
+T template <class Allocator>
+ bool operator> (const vector<bool,Allocator>& x,
+ const vector<bool,Allocator>& y);
+T template <class Allocator>
+ bool operator>=(const vector<bool,Allocator>& x,
+ const vector<bool,Allocator>& y);
+T template <class Allocator>
+ bool operator<=(const vector<bool,Allocator>& x,
+ const vector<bool,Allocator>& y);
+T template <class Allocator>
+ void swap(vector<bool,Allocator>& x, vector<bool,Allocator>& y);
+ }
+
+ 23.2.1 Template class deque [lib.deque]
+
+ template <class T, class Allocator = allocator<T> >
+X class deque {
+ public:
+ // types:
+T typedef typename Allocator::reference reference;
+T typedef typename Allocator::const_reference const_reference;
+X typedef implementation defined iterator;
+X typedef implementation defined const_iterator;
+T typedef implementation defined size_type;
+T typedef implementation defined difference_type;
+T typedef T value_type;
+T typedef Allocator allocator_type;
+T typedef typename Allocator::pointer pointer;
+T typedef typename Allocator::const_pointer const_pointer;
+T typedef std::reverse_iterator<iterator> reverse_iterator;
+T typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ // _lib.deque.cons_ construct/copy/destroy:
+T explicit deque(const Allocator& = Allocator());
+T explicit deque(size_type n, const T& value = T(),
+ const Allocator& = Allocator());
+T template <class InputIterator>
+ deque(InputIterator first, InputIterator last,
+ const Allocator& = Allocator());
+T deque(const deque<T,Allocator>& x);
+T ~deque();
+T deque<T,Allocator>& operator=(const deque<T,Allocator>& x);
+T template <class InputIterator>
+ void assign(InputIterator first, InputIterator last);
+T void assign(size_type n, const T& t);
+T allocator_type get_allocator() const;
+ // iterators:
+T iterator begin();
+T const_iterator begin() const;
+T iterator end();
+T const_iterator end() const;
+T reverse_iterator rbegin();
+T const_reverse_iterator rbegin() const;
+T reverse_iterator rend();
+T const_reverse_iterator rend() const;
+ // _lib.deque.capacity_ capacity:
+T size_type size() const;
+T size_type max_size() const;
+T void resize(size_type sz, T c = T());
+T bool empty() const;
+
+ // element access:
+T reference operator[](size_type n);
+T const_reference operator[](size_type n) const;
+T reference at(size_type n);
+T const_reference at(size_type n) const;
+T reference front();
+T const_reference front() const;
+T reference back();
+T const_reference back() const;
+ // _lib.deque.modifiers_ modifiers:
+T void push_front(const T& x);
+T void push_back(const T& x);
+T iterator insert(iterator position, const T& x);
+T void insert(iterator position, size_type n, const T& x);
+T template <class InputIterator>
+ void insert (iterator position,
+ InputIterator first, InputIterator last);
+T void pop_front();
+T void pop_back();
+T iterator erase(iterator position);
+T iterator erase(iterator first, iterator last);
+T void swap(deque<T,Allocator>&);
+T void clear();
+ };
+T template <class T, class Allocator>
+ bool operator==(const deque<T,Allocator>& x,
+ const deque<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator< (const deque<T,Allocator>& x,
+ const deque<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator!=(const deque<T,Allocator>& x,
+ const deque<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator> (const deque<T,Allocator>& x,
+ const deque<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator>=(const deque<T,Allocator>& x,
+ const deque<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator<=(const deque<T,Allocator>& x,
+ const deque<T,Allocator>& y);
+ // specialized algorithms:
+T template <class T, class Allocator>
+ void swap(deque<T,Allocator>& x, deque<T,Allocator>& y);
+
+
+ 23.2.2 Template class list [lib.list]
+
+X template <class T, class Allocator = allocator<T> >
+ class list {
+ public:
+ // types:
+T typedef typename Allocator::reference reference;
+T typedef typename Allocator::const_reference const_reference;
+X typedef implementation defined iterator;
+X typedef implementation defined const_iterator;
+T typedef implementation defined size_type;
+T typedef implementation defined difference_type;
+T typedef T value_type;
+T typedef Allocator allocator_type;
+T typedef typename Allocator::pointer pointer;
+T typedef typename Allocator::const_pointer const_pointer;
+T typedef std::reverse_iterator<iterator> reverse_iterator;
+T typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ // _lib.list.cons_ construct/copy/destroy:
+T explicit list(const Allocator& = Allocator());
+T explicit list(size_type n, const T& value = T(),
+ const Allocator& = Allocator());
+T template <class InputIterator>
+ list(InputIterator first, InputIterator last,
+ const Allocator& = Allocator());
+T list(const list<T,Allocator>& x);
+T ~list();
+T list<T,Allocator>& operator=(const list<T,Allocator>& x);
+T template <class InputIterator>
+ void assign(InputIterator first, InputIterator last);
+T void assign(size_type n, const T& t);
+T allocator_type get_allocator() const;
+ // iterators:
+T iterator begin();
+T const_iterator begin() const;
+T iterator end();
+T const_iterator end() const;
+T reverse_iterator rbegin();
+T const_reverse_iterator rbegin() const;
+T reverse_iterator rend();
+T const_reverse_iterator rend() const;
+ // _lib.list.capacity_ capacity:
+T bool empty() const;
+T size_type size() const;
+T size_type max_size() const;
+T void resize(size_type sz, T c = T());
+ // element access:
+T reference front();
+T const_reference front() const;
+T reference back();
+T const_reference back() const;
+ // _lib.list.modifiers_ modifiers:
+T void push_front(const T& x);
+T void pop_front();
+T void push_back(const T& x);
+T void pop_back();
+T iterator insert(iterator position, const T& x);
+T void insert(iterator position, size_type n, const T& x);
+T template <class InputIterator>
+ void insert(iterator position, InputIterator first,
+ InputIterator last);
+T iterator erase(iterator position);
+T iterator erase(iterator position, iterator last);
+T void swap(list<T,Allocator>&);
+T void clear();
+ // _lib.list.ops_ list operations:
+T void splice(iterator position, list<T,Allocator>& x);
+T void splice(iterator position, list<T,Allocator>& x, iterator i);
+T void splice(iterator position, list<T,Allocator>& x, iterator first,
+ iterator last);
+T void remove(const T& value);
+T template <class Predicate> void remove_if(Predicate pred);
+
+T void unique();
+T template <class BinaryPredicate>
+ void unique(BinaryPredicate binary_pred);
+T void merge(list<T,Allocator>& x);
+T template <class Compare> void merge(list<T,Allocator>& x, Compare comp);
+ void sort();
+T template <class Compare> void sort(Compare comp);
+ void reverse();
+ };
+T template <class T, class Allocator>
+ bool operator==(const list<T,Allocator>& x, const list<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator< (const list<T,Allocator>& x, const list<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator!=(const list<T,Allocator>& x, const list<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator> (const list<T,Allocator>& x, const list<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator>=(const list<T,Allocator>& x, const list<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator<=(const list<T,Allocator>& x, const list<T,Allocator>& y);
+ // specialized algorithms:
+T template <class T, class Allocator>
+ void swap(list<T,Allocator>& x, list<T,Allocator>& y);
+
+
+ 23.2.3.1 Template class queue [lib.queue]
+
+T template <class T, class Container = deque<T> >
+ class queue {
+ public:
+T typedef typename Container::value_type value_type;
+T typedef typename Container::size_type size_type;
+T typedef Container container_type;
+ protected:
+T Container c;
+ public:
+T explicit queue(const Container& = Container());
+
+T bool empty() const { return c.empty(); }
+T size_type size() const { return c.size(); }
+T value_type& front() { return c.front(); }
+T const value_type& front() const { return c.front(); }
+T value_type& back() { return c.back(); }
+T const value_type& back() const { return c.back(); }
+T void push(const value_type& x) { c.push_back(x); }
+T void pop() { c.pop_front(); }
+ };
+
+T template <class T, class Container>
+ bool operator==(const queue<T, Container>& x,
+ const queue<T, Container>& y);
+T template <class T, class Container>
+ bool operator< (const queue<T, Container>& x,
+ const queue<T, Container>& y);
+T template <class T, class Container>
+ bool operator!=(const queue<T, Container>& x,
+ const queue<T, Container>& y);
+T template <class T, class Container>
+ bool operator> (const queue<T, Container>& x,
+ const queue<T, Container>& y);
+T template <class T, class Container>
+ bool operator>=(const queue<T, Container>& x,
+ const queue<T, Container>& y);
+T template <class T, class Container>
+ bool operator<=(const queue<T, Container>& x,
+ const queue<T, Container>& y);
+
+ 23.2.3.2 Template class priority_queue [lib.priority.queue]
+
+T template <class T, class Container = vector<T>,
+ class Compare = less<typename Container::value_type> >
+ class priority_queue {
+ public:
+T typedef typename Container::value_type value_type;
+T typedef typename Container::size_type size_type;
+T typedef Container container_type;
+ protected:
+T Container c;
+T Compare comp;
+ public:
+T explicit priority_queue(const Compare& x = Compare(),
+ const Container& = Container());
+T template <class InputIterator>
+ priority_queue(InputIterator first, InputIterator last,
+ const Compare& x = Compare(),
+ const Container& = Container());
+
+T bool empty() const { return c.empty(); }
+T size_type size() const { return c.size(); }
+T const value_type& top() const { return c.front(); }
+T void push(const value_type& x);
+T void pop();
+ };
+
+ 23.2.3.3 Template class stack [lib.stack]
+
+T template <class T, class Container = deque<T> >
+ class stack {
+ public:
+T typedef typename Container::value_type value_type;
+T typedef typename Container::size_type size_type;
+T typedef Container container_type;
+ protected:
+T Container c;
+ public:
+T explicit stack(const Container& = Container());
+
+T bool empty() const { return c.empty(); }
+T size_type size() const { return c.size(); }
+T value_type& top() { return c.back(); }
+T const value_type& top() const { return c.back(); }
+T void push(const value_type& x) { c.push_back(x); }
+T void pop() { c.pop_back(); }
+ };
+T template <class T, class Container>
+ bool operator==(const stack<T, Container>& x,
+ const stack<T, Container>& y);
+T template <class T, class Container>
+ bool operator< (const stack<T, Container>& x,
+ const stack<T, Container>& y);
+T template <class T, class Container>
+ bool operator!=(const stack<T, Container>& x,
+ const stack<T, Container>& y);
+T template <class T, class Container>
+ bool operator> (const stack<T, Container>& x,
+ const stack<T, Container>& y);
+T template <class T, class Container>
+ bool operator>=(const stack<T, Container>& x,
+ const stack<T, Container>& y);
+T template <class T, class Container>
+ bool operator<=(const stack<T, Container>& x,
+ const stack<T, Container>& y);
+
+ 23.2.4 Template class vector [lib.vector]
+
+ template <class T, class Allocator = allocator<T> >
+X class vector {
+ public:
+ // types:
+T typedef typename Allocator::reference reference;
+T typedef typename Allocator::const_reference const_reference;
+X typedef implementation defined iterator;
+X typedef implementation defined const_iterator;
+T typedef implementation defined size_type;
+T typedef implementation defined difference_type;
+T typedef T value_type;
+T typedef Allocator allocator_type;
+T typedef typename Allocator::pointer pointer;
+T typedef typename Allocator::const_pointer const_pointer
+T typedef std::reverse_iterator<iterator> reverse_iterator;
+T typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ // _lib.vector.cons_ construct/copy/destroy:
+T explicit vector(const Allocator& = Allocator());
+T explicit vector(size_type n, const T& value = T(),
+ const Allocator& = Allocator());
+T template <class InputIterator>
+ vector(InputIterator first, InputIterator last,
+ const Allocator& = Allocator());
+T vector(const vector<T,Allocator>& x);
+T ~vector();
+T vector<T,Allocator>& operator=(const vector<T,Allocator>& x);
+T template <class InputIterator>
+ void assign(InputIterator first, InputIterator last);
+T void assign(size_type n, const T& u);
+T allocator_type get_allocator() const;
+ // iterators:
+T iterator begin();
+T const_iterator begin() const;
+T iterator end();
+T const_iterator end() const;
+T reverse_iterator rbegin();
+T const_reverse_iterator rbegin() const;
+T reverse_iterator rend();
+T const_reverse_iterator rend() const;
+ // _lib.vector.capacity_ capacity:
+T size_type size() const;
+T size_type max_size() const;
+T void resize(size_type sz, T c = T());
+T size_type capacity() const;
+T bool empty() const;
+T void reserve(size_type n);
+
+ // element access:
+T reference operator[](size_type n);
+T const_reference operator[](size_type n) const;
+T const_reference at(size_type n) const;
+T reference at(size_type n);
+T reference front();
+T const_reference front() const;
+T reference back();
+T const_reference back() const;
+ // _lib.vector.modifiers_ modifiers:
+T void push_back(const T& x);
+T void pop_back();
+T iterator insert(iterator position, const T& x);
+T void insert(iterator position, size_type n, const T& x);
+T template <class InputIterator>
+ void insert(iterator position,
+ InputIterator first, InputIterator last);
+T iterator erase(iterator position);
+T iterator erase(iterator first, iterator last);
+T void swap(vector<T,Allocator>&);
+T void clear();
+ };
+
+T template <class T, class Allocator>
+ bool operator==(const vector<T,Allocator>& x,
+ const vector<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator< (const vector<T,Allocator>& x,
+ const vector<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator!=(const vector<T,Allocator>& x,
+ const vector<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator> (const vector<T,Allocator>& x,
+ const vector<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator>=(const vector<T,Allocator>& x,
+ const vector<T,Allocator>& y);
+T template <class T, class Allocator>
+ bool operator<=(const vector<T,Allocator>& x,
+ const vector<T,Allocator>& y);
+ // specialized algorithms:
+T template <class T, class Allocator>
+ void swap(vector<T,Allocator>& x, vector<T,Allocator>& y);
+
+
+ 23.2.5 Class vector<bool> [lib.vector.bool]
+
+X template <class Allocator> class vector<bool, Allocator> {
+ public:
+ // types:
+T typedef bool const_reference;
+X typedef implementation defined iterator;
+X typedef implementation defined const_iterator;
+T typedef implementation defined size_type;
+T typedef implementation defined difference_type;
+T typedef bool value_type;
+T typedef Allocator allocator_type;
+T typedef implementation defined pointer;
+T typedef implementation defined const_pointer
+T typedef std::reverse_iterator<iterator> reverse_iterator;
+T typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ // bit reference:
+T class reference {
+ friend class vector;
+T reference();
+ public:
+T ~reference();
+T operator bool() const;
+T reference& operator=(const bool x);
+T reference& operator=(const reference& x);
+T void flip(); // flips the bit
+ };
+
+ // construct/copy/destroy:
+T explicit vector(const Allocator& = Allocator());
+T explicit vector(size_type n, const bool& value = bool(),
+ const Allocator& = Allocator());
+T template <class InputIterator>
+ vector(InputIterator first, InputIterator last,
+ const Allocator& = Allocator());
+T vector(const vector<bool,Allocator>& x);
+T ~vector();
+T vector<bool,Allocator>& operator=(const vector<bool,Allocator>& x);
+T template <class InputIterator>
+ void assign(InputIterator first, InputIterator last);
+T void assign(size_type n, const T& t);
+T allocator_type get_allocator() const;
+ // iterators:
+T iterator begin();
+T const_iterator begin() const;
+T iterator end();
+T const_iterator end() const;
+T reverse_iterator rbegin();
+T const_reverse_iterator rbegin() const;
+T reverse_iterator rend();
+T const_reverse_iterator rend() const;
+ // capacity:
+T size_type size() const;
+T size_type max_size() const;
+T void resize(size_type sz, bool c = false);
+T size_type capacity() const;
+T bool empty() const;
+T void reserve(size_type n);
+ // element access:
+T reference operator[](size_type n);
+T const_reference operator[](size_type n) const;
+T const_reference at(size_type n) const;
+T reference at(size_type n);
+T reference front();
+T const_reference front() const;
+T reference back();
+T const_reference back() const;
+ // modifiers:
+T void push_back(const bool& x);
+T void pop_back();
+T iterator insert(iterator position, const bool& x);
+T void insert (iterator position, size_type n, const bool& x);
+T template <class InputIterator>
+ void insert(iterator position,
+ InputIterator first, InputIterator last);
+T iterator erase(iterator position);
+T iterator erase(iterator first, iterator last);
+T void swap(vector<bool,Allocator>&);
+T static void swap(reference x, reference y);
+T void flip(); // flips all bits
+T void clear();
+ };
+
+T template <class Allocator>
+ bool operator==(const vector<bool,Allocator>& x,
+ const vector<bool,Allocator>& y);
+T template <class Allocator>
+ bool operator< (const vector<bool,Allocator>& x,
+ const vector<bool,Allocator>& y);
+T template <class Allocator>
+ bool operator!=(const vector<bool,Allocator>& x,
+ const vector<bool,Allocator>& y);
+T template <class Allocator>
+ bool operator> (const vector<bool,Allocator>& x,
+ const vector<bool,Allocator>& y);
+T template <class Allocator>
+ bool operator>=(const vector<bool,Allocator>& x,
+ const vector<bool,Allocator>& y);
+T template <class Allocator>
+ bool operator<=(const vector<bool,Allocator>& x,
+ const vector<bool,Allocator>& y);
+ // specialized algorithms:
+T template <class Allocator>
+ void swap(vector<bool,Allocator>& x, vector<bool,Allocator>& y);
+
+ 23.3 Associative containers [lib.associative]
+
+ <map> and <set>:
+
+ Header <map> synopsis
+
+ template <class Key, class T, class Compare = less<Key>,
+ class Allocator = allocator<pair<const Key, T> > >
+X class map;
+
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator==(const map<Key,T,Compare,Allocator>& x,
+ const map<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator< (const map<Key,T,Compare,Allocator>& x,
+ const map<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator!=(const map<Key,T,Compare,Allocator>& x,
+ const map<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator> (const map<Key,T,Compare,Allocator>& x,
+ const map<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator>=(const map<Key,T,Compare,Allocator>& x,
+ const map<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator<=(const map<Key,T,Compare,Allocator>& x,
+ const map<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ void swap(map<Key,T,Compare,Allocator>& x,
+ map<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare = less<Key>,
+ class Allocator = allocator<pair<const Key, T> > >
+ class multimap;
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator==(const multimap<Key,T,Compare,Allocator>& x,
+ const multimap<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator< (const multimap<Key,T,Compare,Allocator>& x,
+ const multimap<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator!=(const multimap<Key,T,Compare,Allocator>& x,
+ const multimap<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator> (const multimap<Key,T,Compare,Allocator>& x,
+ const multimap<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator>=(const multimap<Key,T,Compare,Allocator>& x,
+ const multimap<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator<=(const multimap<Key,T,Compare,Allocator>& x,
+ const multimap<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ void swap(multimap<Key,T,Compare,Allocator>& x,
+ multimap<Key,T,Compare,Allocator>& y);
+ }
+
+ Header <set> synopsis
+
+ template <class Key, class Compare = less<Key>,
+ class Allocator = allocator<Key> >
+X class set;
+
+T template <class Key, class Compare, class Allocator>
+ bool operator==(const set<Key,Compare,Allocator>& x,
+ const set<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator< (const set<Key,Compare,Allocator>& x,
+ const set<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator!=(const set<Key,Compare,Allocator>& x,
+ const set<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator> (const set<Key,Compare,Allocator>& x,
+ const set<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator>=(const set<Key,Compare,Allocator>& x,
+ const set<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator<=(const set<Key,Compare,Allocator>& x,
+ const set<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ void swap(set<Key,Compare,Allocator>& x,
+ set<Key,Compare,Allocator>& y);
+T template <class Key, class Compare = less<Key>,
+ class Allocator = allocator<Key> >
+ class multiset;
+T template <class Key, class Compare, class Allocator>
+ bool operator==(const multiset<Key,Compare,Allocator>& x,
+ const multiset<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator< (const multiset<Key,Compare,Allocator>& x,
+ const multiset<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator!=(const multiset<Key,Compare,Allocator>& x,
+ const multiset<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator> (const multiset<Key,Compare,Allocator>& x,
+ const multiset<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator>=(const multiset<Key,Compare,Allocator>& x,
+ const multiset<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator<=(const multiset<Key,Compare,Allocator>& x,
+ const multiset<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ void swap(multiset<Key,Compare,Allocator>& x,
+ multiset<Key,Compare,Allocator>& y);
+ }
+
+ 23.3.1 Template class map [lib.map]
+
+ template <class Key, class T, class Compare = less<Key>,
+ class Allocator = allocator<pair<const Key, T> > >
+X class map {
+ public:
+ // types:
+T typedef Key key_type;
+T typedef T mapped_type;
+T typedef pair<const Key, T> value_type;
+T typedef Compare key_compare;
+T typedef Allocator allocator_type;
+T typedef typename Allocator::reference reference;
+T typedef typename Allocator::const_reference const_reference;
+X typedef implementation defined iterator;
+X typedef implementation defined const_iterator;
+T typedef implementation defined size_type;
+T typedef implementation defined difference_type;
+T typedef typename Allocator::pointer pointer;
+T typedef typename Allocator::const_pointer const_pointer;
+T typedef std::reverse_iterator<iterator> reverse_iterator;
+T typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+T class value_compare
+ : public binary_function<value_type,value_type,bool> {
+ friend class map;
+ protected:
+T Compare comp;
+T value_compare(Compare c) : comp(c) {}
+ public:
+T bool operator()(const value_type& x, const value_type& y) const {
+ return comp(x.first, y.first);
+ }
+ };
+
+ // _lib.map.cons_ construct/copy/destroy:
+T explicit map(const Compare& comp = Compare(),
+ const Allocator& = Allocator());
+T template <class InputIterator>
+ map(InputIterator first, InputIterator last,
+ const Compare& comp = Compare(), const Allocator& = Allocator());
+T map(const map<Key,T,Compare,Allocator>& x);
+T ~map();
+T map<Key,T,Compare,Allocator>&
+ operator=(const map<Key,T,Compare,Allocator>& x);
+ // iterators:
+T iterator begin();
+T const_iterator begin() const;
+T iterator end();
+T const_iterator end() const;
+T reverse_iterator rbegin();
+T const_reverse_iterator rbegin() const;
+T reverse_iterator rend();
+T const_reverse_iterator rend() const;
+ // capacity:
+T bool empty() const;
+T size_type size() const;
+T size_type max_size() const;
+ // _lib.map.access_ element access:
+T T& operator[](const key_type& x);
+ // modifiers:
+T pair<iterator, bool> insert(const value_type& x);
+T iterator insert(iterator position, const value_type& x);
+T template <class InputIterator>
+ void insert(InputIterator first, InputIterator last);
+T void erase(iterator position);
+T size_type erase(const key_type& x);
+T void erase(iterator first, iterator last);
+T void swap(map<Key,T,Compare,Allocator>&);
+T void clear();
+ // observers:
+T key_compare key_comp() const;
+T value_compare value_comp() const;
+ // _lib.map.ops_ map operations:
+T iterator find(const key_type& x);
+T const_iterator find(const key_type& x) const;
+T size_type count(const key_type& x) const;
+T iterator lower_bound(const key_type& x);
+T const_iterator lower_bound(const key_type& x) const;
+T iterator upper_bound(const key_type& x);
+T const_iterator upper_bound(const key_type& x) const;
+T pair<iterator,iterator>
+ equal_range(const key_type& x);
+T pair<const_iterator,const_iterator>
+ equal_range(const key_type& x) const;
+ };
+
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator==(const map<Key,T,Compare,Allocator>& x,
+ const map<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator< (const map<Key,T,Compare,Allocator>& x,
+ const map<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator!=(const map<Key,T,Compare,Allocator>& x,
+ const map<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator> (const map<Key,T,Compare,Allocator>& x,
+ const map<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator>=(const map<Key,T,Compare,Allocator>& x,
+ const map<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator<=(const map<Key,T,Compare,Allocator>& x,
+ const map<Key,T,Compare,Allocator>& y);
+ // specialized algorithms:
+T template <class Key, class T, class Compare, class Allocator>
+ void swap(map<Key,T,Compare,Allocator>& x,
+ map<Key,T,Compare,Allocator>& y);
+
+ 23.3.2 Template class multimap [lib.multimap]
+
+ template <class Key, class T, class Compare = less<Key>,
+ class Allocator = allocator<pair<const Key, T> > >
+X class multimap {
+ public:
+ // types:
+T typedef Key key_type;
+T typedef T mapped_type;
+T typedef pair<const Key,T> value_type;
+T typedef Compare key_compare;
+T typedef Allocator allocator_type;
+T typedef typename Allocator::reference reference;
+T typedef typename Allocator::const_reference const_reference;
+X typedef implementation defined iterator;
+X typedef implementation defined const_iterator;
+T typedef implementation defined size_type;
+T typedef implementation defined difference_type
+T typedef typename Allocator::pointer pointer;
+T typedef typename Allocator::const_pointer const_pointer;
+T typedef std::reverse_iterator<iterator> reverse_iterator;
+T typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+T class value_compare
+ : public binary_function<value_type,value_type,bool> {
+ friend class multimap;
+ protected:
+T Compare comp;
+T value_compare(Compare c) : comp(c) {}
+ public:
+T bool operator()(const value_type& x, const value_type& y) const {
+ return comp(x.first, y.first);
+ }
+ };
+ // construct/copy/destroy:
+T explicit multimap(const Compare& comp = Compare(),
+ const Allocator& = Allocator());
+T template <class InputIterator>
+ multimap(InputIterator first, InputIterator last,
+ const Compare& comp = Compare(),
+ const Allocator& = Allocator());
+T multimap(const multimap<Key,T,Compare,Allocator>& x);
+T ~multimap();
+T multimap<Key,T,Compare,Allocator>&
+ operator=(const multimap<Key,T,Compare,Allocator>& x);
+T allocator_type get_allocator() const;
+
+ // iterators:
+T iterator begin();
+T const_iterator begin() const;
+T iterator end();
+T const_iterator end() const;
+T reverse_iterator rbegin();
+T const_reverse_iterator rbegin() const;
+T reverse_iterator rend();
+T const_reverse_iterator rend() const;
+ // capacity:
+T bool empty() const;
+T size_type size() const;
+T size_type max_size() const;
+ // modifiers:
+T iterator insert(const value_type& x);
+T iterator insert(iterator position, const value_type& x);
+T template <class InputIterator>
+ void insert(InputIterator first, InputIterator last);
+T void erase(iterator position);
+T size_type erase(const key_type& x);
+T void erase(iterator first, iterator last);
+T void swap(multimap<Key,T,Compare,Allocator>&);
+T void clear();
+ // observers:
+T key_compare key_comp() const;
+T value_compare value_comp() const;
+ // map operations:
+T iterator find(const key_type& x);
+T const_iterator find(const key_type& x) const;
+T size_type count(const key_type& x) const;
+T iterator lower_bound(const key_type& x);
+T const_iterator lower_bound(const key_type& x) const;
+T iterator upper_bound(const key_type& x);
+T const_iterator upper_bound(const key_type& x) const;
+T pair<iterator,iterator> equal_range(const key_type& x);
+T pair<const_iterator,const_iterator> equal_range(const key_type& x) const;
+ };
+
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator==(const multimap<Key,T,Compare,Allocator>& x,
+ const multimap<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator< (const multimap<Key,T,Compare,Allocator>& x,
+ const multimap<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator!=(const multimap<Key,T,Compare,Allocator>& x,
+ const multimap<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator> (const multimap<Key,T,Compare,Allocator>& x,
+ const multimap<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator>=(const multimap<Key,T,Compare,Allocator>& x,
+ const multimap<Key,T,Compare,Allocator>& y);
+T template <class Key, class T, class Compare, class Allocator>
+ bool operator<=(const multimap<Key,T,Compare,Allocator>& x,
+ const multimap<Key,T,Compare,Allocator>& y);
+ // specialized algorithms:
+T template <class Key, class T, class Compare, class Allocator>
+ void swap(multimap<Key,T,Compare,Allocator>& x,
+ multimap<Key,T,Compare,Allocator>& y);
+
+
+ 23.3.3 Template class set [lib.set]
+
+ template <class Key, class Compare = less<Key>,
+ class Allocator = allocator<Key> >
+X class set {
+ public:
+ // types:
+T typedef Key key_type;
+T typedef Key value_type;
+T typedef Compare key_compare;
+T typedef Compare value_compare;
+T typedef Allocator allocator_type;
+T typedef typename Allocator::reference reference;
+T typedef typename Allocator::const_reference const_reference;
+X typedef implementation defined iterator;
+X typedef implementation defined const_iterator;
+T typedef implementation defined size_type;
+T typedef implementation defined difference_type;
+T typedef typename Allocator::pointer pointer;
+T typedef typename Allocator::const_pointer const_pointer;
+T typedef std::reverse_iterator<iterator> reverse_iterator;
+T typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ // _lib.set.cons_ construct/copy/destroy:
+T explicit set(const Compare& comp = Compare(),
+ const Allocator& = Allocator());
+T template <class InputIterator>
+ set(InputIterator first, InputIterator last,
+ const Compare& comp = Compare(), const Allocator& = Allocator());
+T set(const set<Key,Compare,Allocator>& x);
+T ~set();
+T set<Key,Compare,Allocator>&
+ operator=(const set<Key,Compare,Allocator>& x);
+T allocator_type get_allocator() const;
+ // iterators:
+T iterator begin();
+T const_iterator begin() const;
+T iterator end();
+T const_iterator end() const;
+T reverse_iterator rbegin();
+T const_reverse_iterator rbegin() const;
+T reverse_iterator rend();
+T const_reverse_iterator rend() const;
+ // capacity:
+T bool empty() const;
+T size_type size() const;
+T size_type max_size() const;
+ // modifiers:
+T pair<iterator,bool> insert(const value_type& x);
+T iterator insert(iterator position, const value_type& x);
+T template <class InputIterator>
+T void insert(InputIterator first, InputIterator last);
+T void erase(iterator position);
+T size_type erase(const key_type& x);
+T void erase(iterator first, iterator last);
+T void swap(set<Key,Compare,Allocator>&);
+T void clear();
+
+ // observers:
+T key_compare key_comp() const;
+T value_compare value_comp() const;
+ // set operations:
+T iterator find(const key_type& x) const;
+T size_type count(const key_type& x) const;
+T iterator lower_bound(const key_type& x) const;
+T iterator upper_bound(const key_type& x) const;
+T pair<iterator,iterator> equal_range(const key_type& x) const;
+ };
+T template <class Key, class Compare, class Allocator>
+ bool operator==(const set<Key,Compare,Allocator>& x,
+ const set<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator< (const set<Key,Compare,Allocator>& x,
+ const set<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator!=(const set<Key,Compare,Allocator>& x,
+ const set<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator> (const set<Key,Compare,Allocator>& x,
+ const set<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator>=(const set<Key,Compare,Allocator>& x,
+ const set<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator<=(const set<Key,Compare,Allocator>& x,
+ const set<Key,Compare,Allocator>& y);
+ // specialized algorithms:
+T template <class Key, class Compare, class Allocator>
+ void swap(set<Key,Compare,Allocator>& x,
+ set<Key,Compare,Allocator>& y);
+
+ 23.3.4 Template class multiset [lib.multiset]
+
+ template <class Key, class Compare = less<Key>,
+ class Allocator = allocator<Key> >
+X class multiset {
+ public:
+ // types:
+T typedef Key key_type;
+T typedef Key value_type;
+T typedef Compare key_compare;
+T typedef Compare value_compare;
+T typedef Allocator allocator_type;
+T typedef typename Allocator::reference reference;
+T typedef typename Allocator::const_reference const_reference;
+X typedef implementation defined iterator;
+X typedef implementation defined const_iterator;
+T typedef implementation defined size_type;
+T typedef implementation defined difference_type
+T typedef typename Allocator::pointer pointer;
+T typedef typename Allocator::const_pointer const_pointer;
+T typedef std::reverse_iterator<iterator> reverse_iterator;
+T typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ // construct/copy/destroy:
+T explicit multiset(const Compare& comp = Compare(),
+ const Allocator& = Allocator());
+T template <class InputIterator>
+ multiset(InputIterator first, InputIterator last,
+ const Compare& comp = Compare(),
+ const Allocator& = Allocator());
+T multiset(const multiset<Key,Compare,Allocator>& x);
+T ~multiset();
+T multiset<Key,Compare,Allocator>&
+ operator=(const multiset<Key,Compare,Allocator>& x);
+T allocator_type get_allocator() const;
+ // iterators:
+T iterator begin();
+T const_iterator begin() const;
+T iterator end();
+T const_iterator end() const;
+T reverse_iterator rbegin();
+T const_reverse_iterator rbegin() const;
+T reverse_iterator rend();
+T const_reverse_iterator rend() const;
+ // capacity:
+T bool empty() const;
+T size_type size() const;
+T size_type max_size() const;
+ // modifiers:
+T iterator insert(const value_type& x);
+T iterator insert(iterator position, const value_type& x);
+T template <class InputIterator>
+ void insert(InputIterator first, InputIterator last);
+T void erase(iterator position);
+T size_type erase(const key_type& x);
+T void erase(iterator first, iterator last);
+T void swap(multiset<Key,Compare,Allocator>&);
+T void clear();
+ // observers:
+T key_compare key_comp() const;
+T value_compare value_comp() const;
+ // set operations:
+T iterator find(const key_type& x) const;
+T size_type count(const key_type& x) const;
+T iterator lower_bound(const key_type& x) const;
+T iterator upper_bound(const key_type& x) const;
+T pair<iterator,iterator> equal_range(const key_type& x) const;
+ };
+
+T template <class Key, class Compare, class Allocator>
+ bool operator==(const multiset<Key,Compare,Allocator>& x,
+ const multiset<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator< (const multiset<Key,Compare,Allocator>& x,
+ const multiset<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator!=(const multiset<Key,Compare,Allocator>& x,
+ const multiset<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator> (const multiset<Key,Compare,Allocator>& x,
+ const multiset<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator>=(const multiset<Key,Compare,Allocator>& x,
+ const multiset<Key,Compare,Allocator>& y);
+T template <class Key, class Compare, class Allocator>
+ bool operator<=(const multiset<Key,Compare,Allocator>& x,
+ const multiset<Key,Compare,Allocator>& y);
+ // specialized algorithms:
+T template <class Key, class Compare, class Allocator>
+ void swap(multiset<Key,Compare,Allocator>& x,
+ multiset<Key,Compare,Allocator>& y);
+
+ 23.3.5 Template class bitset [lib.template.bitset]
+
+ Header <bitset> synopsis
+
+ [What's this stuff?
+ #include <cstddef> // for size_t
+ #include <string>
+ #include <stdexcept> // for invalid_argument,
+ // out_of_range, overflow_error
+ #include <iosfwd> // for istream, ostream
+ ]
+X template <size_t N> class bitset;
+ // _lib.bitset.operators_ bitset operations:
+T template <size_t N>
+ bitset<N> operator&(const bitset<N>&, const bitset<N>&);
+T template <size_t N>
+ bitset<N> operator|(const bitset<N>&, const bitset<N>&);
+T template <size_t N>
+ bitset<N> operator^(const bitset<N>&, const bitset<N>&);
+T template <class charT, class traits, size_t N>
+ basic_istream<charT, traits>&
+ operator>>(basic_istream<charT, traits>& is, bitset<N>& x);
+T template <class charT, class traits, size_t N>
+ basic_ostream<charT, traits>&
+ operator<<(basic_ostream<charT, traits>& os, const bitset<N>& x);
+
+X template<size_t N> class bitset {
+ public:
+ // bit reference:
+T class reference {
+ friend class bitset;
+T reference();
+ public:
+T ~reference();
+T reference& operator=(bool x); // for b[i] = x;
+T reference& operator=(const reference&); // for b[i] = b[j];
+T bool operator~() const; // flips the bit
+T operator bool() const; // for x = b[i];
+T reference& flip(); // for b[i].flip();
+ };
+
+ // _lib.bitset.cons_ constructors:
+T bitset();
+T bitset(unsigned long val);
+T template<class charT, class traits, class Allocator>
+ explicit bitset(
+ const basic_string<charT,traits,Allocator>& str,
+ typename basic_string<charT,traits,Allocator>::size_type pos = 0,
+ typename basic_string<charT,traits,Allocator>::size_type n =
+ basic_string<charT,traits,Allocator>::npos);
+ // _lib.bitset.members_ bitset operations:
+T bitset<N>& operator&=(const bitset<N>& rhs);
+T bitset<N>& operator|=(const bitset<N>& rhs);
+T bitset<N>& operator^=(const bitset<N>& rhs);
+T bitset<N>& operator<<=(size_t pos);
+T bitset<N>& operator>>=(size_t pos);
+T bitset<N>& set();
+T bitset<N>& set(size_t pos, int val = true);
+T bitset<N>& reset();
+T bitset<N>& reset(size_t pos);
+T bitset<N> operator~() const;
+T bitset<N>& flip();
+T bitset<N>& flip(size_t pos);
+ // element access:
+T reference operator[](size_t pos); // for b[i];
+T unsigned long to_ulong() const;
+T template <class charT, class traits, class Allocator>
+ basic_string<charT, traits, Allocator> to_string() const;
+T size_t count() const;
+T size_t size() const;
+T bool operator==(const bitset<N>& rhs) const;
+T bool operator!=(const bitset<N>& rhs) const;
+T bool test(size_t pos) const;
+T bool any() const;
+T bool none() const;
+T bitset<N> operator<<(size_t pos) const;
+T bitset<N> operator>>(size_t pos) const;
+ };
+
+
+
+
+ 24.2 Header <iterator> synopsis [lib.iterator.synopsis]
+
+ // _lib.iterator.primitives_, primitives:
+T template<class Iterator> struct iterator_traits;
+T template<class T> struct iterator_traits<T*>;
+
+X template<class Category, class T, class Distance = ptrdiff_t,
+ class Pointer = T*, class Reference = T&> struct iterator;
+T struct input_iterator_tag {};
+T struct output_iterator_tag {};
+T struct forward_iterator_tag: public input_iterator_tag {};
+T struct bidirectional_iterator_tag: public forward_iterator_tag {};
+T struct random_access_iterator_tag: public bidirectional_iterator_tag {};
+ // _lib.iterator.operations_, iterator operations:
+T template <class InputIterator, class Distance>
+ void advance(InputIterator& i, Distance n);
+T template <class InputIterator>
+ typename iterator_traits<InputIterator>::difference_type
+ distance(InputIterator first, InputIterator last);
+ // _lib.predef.iterators_, predefined iterators:
+X template <class Iterator> class reverse_iterator;
+T template <class Iterator>
+ bool operator==(
+ const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+T template <class Iterator>
+ bool operator<(
+ const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+T template <class Iterator>
+ bool operator!=(
+ const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+T template <class Iterator>
+ bool operator>(
+ const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+T template <class Iterator>
+ bool operator>=(
+ const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+T template <class Iterator>
+ bool operator<=(
+ const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+T template <class Iterator>
+ typename reverse_iterator<Iterator>::difference_type operator-(
+ const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+T template <class Iterator>
+ reverse_iterator<Iterator>
+ operator+(
+ typename reverse_iterator<Iterator>::difference_type n,
+ const reverse_iterator<Iterator>& x);
+
+X template <class Container> class back_insert_iterator;
+T template <class Container>
+ back_insert_iterator<Container> back_inserter(Container& x);
+X template <class Container> class front_insert_iterator;
+T template <class Container>
+ front_insert_iterator<Container> front_inserter(Container& x);
+X template <class Container> class insert_iterator;
+T template <class Container, class Iterator>
+ insert_iterator<Container> inserter(Container& x, Iterator i);
+ // _lib.stream.iterators_, stream iterators:
+X template <class T, class charT = char, class traits = char_traits<charT>,
+ class Distance = ptrdiff_t>
+ class istream_iterator;
+ template <class T, class charT, class traits, class Distance>
+X bool operator==(const istream_iterator<T,charT,traits,Distance>& x,
+ const istream_iterator<T,charT,traits,Distance>& y);
+ template <class T, class charT, class traits, class Distance>
+X bool operator!=(const istream_iterator<T,charT,traits,Distance>& x,
+ const istream_iterator<T,charT,traits,Distance>& y);
+X template <class T, class charT = char, class traits = char_traits<charT> >
+ class ostream_iterator;
+X template<class charT, class traits = char_traits<charT> >
+ class istreambuf_iterator;
+X template <class charT, class traits>
+ bool operator==(const istreambuf_iterator<charT,traits>& a,
+ const istreambuf_iterator<charT,traits>& b);
+X template <class charT, class traits>
+ bool operator!=(const istreambuf_iterator<charT,traits>& a,
+ const istreambuf_iterator<charT,traits>& b);
+T template <class charT, class traits = char_traits<charT> >
+ class ostreambuf_iterator;
+
+ 24.3 Iterator primitives [lib.iterator.primitives]
+
+T template<class Iterator> struct iterator_traits {
+T typedef typename Iterator::difference_type difference_type;
+T typedef typename Iterator::value_type value_type;
+T typedef typename Iterator::pointer pointer;
+T typedef typename Iterator::reference reference;
+T typedef typename Iterator::iterator_category iterator_category;
+ };
+
+T template<class T> struct iterator_traits<T*> {
+T typedef ptrdiff_t difference_type;
+T typedef T value_type;
+T typedef T* pointer;
+T typedef T& reference;
+T typedef random_access_iterator_tag iterator_category;
+ };
+
+T template<class T> struct iterator_traits<const T*> {
+T typedef ptrdiff_t difference_type;
+T typedef T value_type;
+T typedef const T* pointer;
+T typedef const T& reference;
+T typedef random_access_iterator_tag iterator_category;
+ };
+
+ 24.3.2 Basic iterator [lib.iterator.basic]
+
+ template<class Category, class T, class Distance = ptrdiff_t,
+ class Pointer = T*, class Reference = T&>
+X struct iterator {
+T typedef T value_type;
+T typedef Distance difference_type;
+T typedef Pointer pointer;
+T typedef Reference reference;
+T typedef Category iterator_category;
+ };
+
+ 24.3.3 Standard iterator tags [lib.std.iterator.tags]
+
+T struct input_iterator_tag {};
+T struct output_iterator_tag {};
+T struct forward_iterator_tag: public input_iterator_tag {};
+T struct bidirectional_iterator_tag: public forward_iterator_tag {};
+T struct random_access_iterator_tag: public bidirectional_iterator_tag {};
+
+
+ 24.4.1 Reverse iterators [lib.reverse.iterators]
+
+ template <class Iterator>
+X class reverse_iterator : public
+ iterator<typename iterator_traits<Iterator>::iterator_category,
+ typename iterator_traits<Iterator>::value_type,
+ typename iterator_traits<Iterator>::difference_type,
+ typename iterator_traits<Iterator>::pointer,
+ typename iterator_traits<Iterator>::reference> {
+ protected:
+T Iterator current;
+ public:
+T typedef Iterator
+ iterator_type;
+T typedef typename iterator_traits<Iterator>::difference_type
+ difference_type;
+T typedef typename iterator_traits<Iterator>::reference
+ reference;
+T typedef typename iterator_traits<Iterator>::pointer
+ pointer;
+
+T reverse_iterator();
+T explicit reverse_iterator(Iterator x);
+T template <class U> reverse_iterator(const reverse_iterator<U>& u);
+T Iterator base() const; // explicit
+T reference operator*() const;
+T pointer operator->() const;
+T reverse_iterator& operator++();
+T reverse_iterator operator++(int);
+T reverse_iterator& operator--();
+T reverse_iterator operator--(int);
+
+T reverse_iterator operator+ (difference_type n) const;
+T reverse_iterator& operator+=(difference_type n);
+T reverse_iterator operator- (difference_type n) const;
+T reverse_iterator& operator-=(difference_type n);
+T reference operator[](difference_type n) const;
+ };
+T template <class Iterator>
+ bool operator==(
+ const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+T template <class Iterator>
+ bool operator<(
+ const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+T template <class Iterator>
+ bool operator!=(
+ const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+T template <class Iterator>
+ bool operator>(
+ const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+T template <class Iterator>
+ bool operator>=(
+ const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+T template <class Iterator>
+ bool operator<=(
+ const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+T template <class Iterator>
+ typename reverse_iterator<Iterator>::difference_type operator-(
+ const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+T template <class Iterator>
+ reverse_iterator<Iterator> operator+(
+ typename reverse_iterator<Iterator>::difference_type n,
+ const reverse_iterator<Iterator>& x);
+
+
+ 24.4.2.1 Template class [lib.back.insert.iterator]
+ back_insert_iterator
+
+ template <class Container>
+X class back_insert_iterator :
+ public iterator<output_iterator_tag,void,void,void,void> {
+ protected:
+T Container* container;
+ public:
+T typedef Container container_type;
+T explicit back_insert_iterator(Container& x);
+T back_insert_iterator<Container>&
+ operator=(typename Container::const_reference value);
+
+T back_insert_iterator<Container>& operator*();
+T back_insert_iterator<Container>& operator++();
+T back_insert_iterator<Container> operator++(int);
+ };
+T template <class Container>
+ back_insert_iterator<Container> back_inserter(Container& x);
+
+
+
+ 24.4.2.3 Template class [lib.front.insert.iterator]
+ front_insert_iterator
+
+ template <class Container>
+X class front_insert_iterator :
+ public iterator<output_iterator_tag,void,void,void,void> {
+ protected:
+T Container* container;
+ public:
+T typedef Container container_type;
+T explicit front_insert_iterator(Container& x);
+T front_insert_iterator<Container>&
+ operator=(typename Container::const_reference value);
+T front_insert_iterator<Container>& operator*();
+T front_insert_iterator<Container>& operator++();
+T front_insert_iterator<Container> operator++(int);
+ };
+T template <class Container>
+ front_insert_iterator<Container> front_inserter(Container& x);
+
+
+ 24.4.2.5 Template class insert_iterator [lib.insert.iterator]
+
+ template <class Container>
+X class insert_iterator :
+ public iterator<output_iterator_tag,void,void,void,void> {
+ protected:
+T Container* container;
+T typename Container::iterator iter;
+ public:
+T typedef Container container_type;
+T insert_iterator(Container& x, typename Container::iterator i);
+T insert_iterator<Container>&
+ operator=(typename Container::const_reference value);
+T insert_iterator<Container>& operator*();
+T insert_iterator<Container>& operator++();
+T insert_iterator<Container>& operator++(int);
+ };
+T template <class Container, class Iterator>
+ insert_iterator<Container> inserter(Container& x, Iterator i);
+
+ 24.5.1 Template class istream_iterator [lib.istream.iterator]
+
+ template <class T, class charT = char, class traits = char_traits<charT>,
+ class Distance = ptrdiff_t>
+X class istream_iterator:
+ public iterator<input_iterator_tag, T, Distance, const T*, const T&> {
+ public:
+T typedef charT char_type
+T typedef traits traits_type;
+T typedef basic_istream<charT,traits> istream_type;
+T istream_iterator();
+T istream_iterator(istream_type& s);
+T istream_iterator(const istream_iterator<T,charT,traits,Distance>& x);
+T ~istream_iterator();
+
+T const T& operator*() const;
+T const T* operator->() const;
+T istream_iterator<T,charT,traits,Distance>& operator++();
+T istream_iterator<T,charT,traits,Distance> operator++(int);
+ };
+
+T template <class T, class charT, class traits, class Distance>
+ bool operator==(const istream_iterator<T,charT,traits,Distance>& x,
+ const istream_iterator<T,charT,traits,Distance>& y);
+T template <class T, class charT, class traits, class Distance>
+ bool operator!=(const istream_iterator<T,charT,traits,Distance>& x,
+ const istream_iterator<T,charT,traits,Distance>& y);
+
+
+ 24.5.2 Template class ostream_iterator [lib.ostream.iterator]
+
+ template <class T, class charT = char, class traits = char_traits<charT> >
+X class ostream_iterator:
+ public iterator<output_iterator_tag, void, void, void, void> {
+ public:
+T typedef charT char_type;
+T typedef traits traits_type;
+T typedef basic_ostream<charT,traits> ostream_type;
+T ostream_iterator(ostream_type& s);
+T ostream_iterator(ostream_type& s, const charT* delimiter);
+T ostream_iterator(const ostream_iterator<T,charT,traits>& x);
+T ~ostream_iterator();
+T ostream_iterator<T,charT,traits>& operator=(const T& value);
+
+T ostream_iterator<T,charT,traits>& operator*();
+T ostream_iterator<T,charT,traits>& operator++();
+T ostream_iterator<T,charT,traits>& operator++(int);
+ };
+
+
+ 24.5.3 Template class [lib.istreambuf.iterator]
+ istreambuf_iterator
+
+ template<class charT, class traits = char_traits<charT> >
+X class istreambuf_iterator
+ : public iterator<input_iterator_tag, charT,
+ typename traits::off_type, charT*, charT&> {
+ public:
+T typedef charT char_type;
+T typedef traits traits_type;
+T typedef typename traits::int_type int_type;
+T typedef basic_streambuf<charT,traits> streambuf_type;
+T typedef basic_istream<charT,traits> istream_type;
+T class proxy; // exposition only
+T istreambuf_iterator() throw();
+T istreambuf_iterator(istream_type& s) throw();
+T istreambuf_iterator(streambuf_type* s) throw();
+T istreambuf_iterator(const proxy& p) throw();
+T charT operator*() const;
+T istreambuf_iterator<charT,traits>& operator++();
+T proxy operator++(int);
+X bool equal(istreambuf_iterator& b);
+ };
+
+T template <class charT, class traits>
+ bool operator==(const istreambuf_iterator<charT,traits>& a,
+ const istreambuf_iterator<charT,traits>& b);
+
+T template <class charT, class traits>
+ bool operator!=(const istreambuf_iterator<charT,traits>& a,
+ const istreambuf_iterator<charT,traits>& b);
+
+ 24.5.3.1 Template class [lib.istreambuf.iterator::proxy]
+ istreambuf_iterator::proxy
+
+ template <class charT, class traits = char_traits<charT> >
+T class istreambuf_iterator<charT, traits>::proxy
+ {
+T charT keep_;
+T basic_streambuf<charT,traits>* sbuf_;
+T proxy(charT c,
+ basic_streambuf<charT,traits>* sbuf);
+ : keep_(c), sbuf_(sbuf) {}
+ public:
+T charT operator*() { return keep_; }
+ };
+
+
+
+ 24.5.4 Template class [lib.ostreambuf.iterator]
+ ostreambuf_iterator
+
+ template <class charT, class traits = char_traits<charT> >
+T class ostreambuf_iterator:
+ public iterator<output_iterator_tag, void, void, void, void> {
+ public:
+T typedef charT char_type;
+T typedef traits traits_type;
+T typedef basic_streambuf<charT,traits> streambuf_type;
+T typedef basic_ostream<charT,traits> ostream_type;
+ public:
+T ostreambuf_iterator(ostream_type& s) throw();
+T ostreambuf_iterator(streambuf_type* s) throw();
+T ostreambuf_iterator& operator=(charT c);
+T ostreambuf_iterator& operator*();
+T ostreambuf_iterator& operator++();
+T ostreambuf_iterator& operator++(int);
+T bool failed() const throw();
+ };
+
+
+ Header <algorithm> synopsis
+
+
+ // _lib.alg.nonmodifying_, non-modifying sequence operations:
+T template<class InputIterator, class Function>
+ Function for_each(InputIterator first, InputIterator last, Function f);
+T template<class InputIterator, class T>
+ InputIterator find(InputIterator first, InputIterator last,
+ const T& value);
+T template<class InputIterator, class Predicate>
+ InputIterator find_if(InputIterator first, InputIterator last,
+ Predicate pred);
+T template<class ForwardIterator1, class ForwardIterator2>
+ ForwardIterator1
+ find_end(ForwardIterator1 first1, ForwardIterator1 last1,
+ ForwardIterator2 first2, ForwardIterator2 last2);
+T template<class ForwardIterator1, class ForwardIterator2,
+ class BinaryPredicate>
+ ForwardIterator1
+ find_end(ForwardIterator1 first1, ForwardIterator1 last1,
+ ForwardIterator2 first2, ForwardIterator2 last2,
+ BinaryPredicate pred);
+T template<class ForwardIterator1, class ForwardIterator2>
+ ForwardIterator1
+ find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
+ ForwardIterator2 first2, ForwardIterator2 last2);
+T template<class ForwardIterator1, class ForwardIterator2,
+ class BinaryPredicate>
+ ForwardIterator1
+ find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
+ ForwardIterator2 first2, ForwardIterator2 last2,
+ BinaryPredicate pred);
+T template<class ForwardIterator>
+ ForwardIterator adjacent_find(ForwardIterator first,
+ ForwardIterator last);
+T template<class ForwardIterator, class BinaryPredicate>
+ ForwardIterator adjacent_find(ForwardIterator first,
+ ForwardIterator last, BinaryPredicate pred);
+T template<class InputIterator, class T>
+ typename iterator_traits<InputIterator>::difference_type
+ count(InputIterator first, InputIterator last, const T& value);
+T template<class InputIterator, class Predicate>
+ typename iterator_traits<InputIterator>::difference_type
+ count_if(InputIterator first, InputIterator last, Predicate pred);
+T template<class InputIterator1, class InputIterator2>
+ pair<InputIterator1, InputIterator2>
+ mismatch(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2);
+T template<class InputIterator1, class InputIterator2, class BinaryPredicate>
+ pair<InputIterator1, InputIterator2>
+ mismatch(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, BinaryPredicate pred);
+
+T template<class InputIterator1, class InputIterator2>
+ bool equal(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2);
+T template<class InputIterator1, class InputIterator2, class BinaryPredicate>
+ bool equal(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, BinaryPredicate pred);
+T template<class ForwardIterator1, class ForwardIterator2>
+ ForwardIterator1 search(ForwardIterator1 first1, ForwardIterator1 last1,
+ ForwardIterator2 first2, ForwardIterator2 last2);
+T template<class ForwardIterator1, class ForwardIterator2,
+ class BinaryPredicate>
+ ForwardIterator1 search(ForwardIterator1 first1, ForwardIterator1 last1,
+ ForwardIterator2 first2, ForwardIterator2 last2,
+ BinaryPredicate pred);
+T template<class ForwardIterator, class Size, class T>
+ ForwardIterator search_n(ForwardIterator first, ForwardIterator last,
+ Size count, const T& value);
+T template<class ForwardIterator, class Size, class T, class BinaryPredicate>
+ ForwardIterator1 search_n(ForwardIterator first, ForwardIterator last,
+ Size count, const T& value,
+ BinaryPredicate pred);
+ // _lib.alg.modifying.operations_, modifying sequence operations:
+ // _lib.alg.copy_, copy:
+T template<class InputIterator, class OutputIterator>
+ OutputIterator copy(InputIterator first, InputIterator last,
+ OutputIterator result);
+T template<class BidirectionalIterator1, class BidirectionalIterator2>
+ BidirectionalIterator2
+ copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
+ BidirectionalIterator2 result);
+ // _lib.alg.swap_, swap:
+T template<class T> void swap(T& a, T& b);
+T template<class ForwardIterator1, class ForwardIterator2>
+ ForwardIterator2 swap_ranges(ForwardIterator1 first1,
+ ForwardIterator1 last1, ForwardIterator2 first2);
+T template<class ForwardIterator1, class ForwardIterator2>
+ void iter_swap(ForwardIterator1 a, ForwardIterator2 b);
+T template<class InputIterator, class OutputIterator, class UnaryOperation>
+ OutputIterator transform(InputIterator first, InputIterator last,
+ OutputIterator result, UnaryOperation op);
+T template<class InputIterator1, class InputIterator2, class OutputIterator,
+ class BinaryOperation>
+ OutputIterator transform(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, OutputIterator result,
+ BinaryOperation binary_op);
+
+T template<class ForwardIterator, class T>
+ void replace(ForwardIterator first, ForwardIterator last,
+ const T& old_value, const T& new_value);
+T template<class ForwardIterator, class Predicate, class T>
+ void replace_if(ForwardIterator first, ForwardIterator last,
+ Predicate pred, const T& new_value);
+T template<class InputIterator, class OutputIterator, class T>
+ OutputIterator replace_copy(InputIterator first, InputIterator last,
+ OutputIterator result,
+ const T& old_value, const T& new_value);
+T template<class Iterator, class OutputIterator, class Predicate, class T>
+ OutputIterator replace_copy_if(Iterator first, Iterator last,
+ OutputIterator result,
+ Predicate pred, const T& new_value);
+T template<class ForwardIterator, class T>
+ void fill(ForwardIterator first, ForwardIterator last, const T& value);
+T template<class OutputIterator, class Size, class T>
+ void fill_n(OutputIterator first, Size n, const T& value);
+T template<class ForwardIterator, class Generator>
+ void generate(ForwardIterator first, ForwardIterator last, Generator gen);
+T template<class OutputIterator, class Size, class Generator>
+ void generate_n(OutputIterator first, Size n, Generator gen);
+T template<class ForwardIterator, class T>
+ ForwardIterator remove(ForwardIterator first, ForwardIterator last,
+ const T& value);
+T template<class ForwardIterator, class Predicate>
+ ForwardIterator remove_if(ForwardIterator first, ForwardIterator last,
+ Predicate pred);
+T template<class InputIterator, class OutputIterator, class T>
+ OutputIterator remove_copy(InputIterator first, InputIterator last,
+ OutputIterator result, const T& value);
+T template<class InputIterator, class OutputIterator, class Predicate>
+ OutputIterator remove_copy_if(InputIterator first, InputIterator last,
+ OutputIterator result, Predicate pred);
+T template<class ForwardIterator>
+ ForwardIterator unique(ForwardIterator first, ForwardIterator last);
+T template<class ForwardIterator, class BinaryPredicate>
+ ForwardIterator unique(ForwardIterator first, ForwardIterator last,
+ BinaryPredicate pred);
+T template<class InputIterator, class OutputIterator>
+ OutputIterator unique_copy(InputIterator first, InputIterator last,
+ OutputIterator result);
+T template<class InputIterator, class OutputIterator, class BinaryPredicate>
+ OutputIterator unique_copy(InputIterator first, InputIterator last,
+ OutputIterator result, BinaryPredicate pred);
+T template<class BidirectionalIterator>
+ void reverse(BidirectionalIterator first, BidirectionalIterator last);
+T template<class BidirectionalIterator, class OutputIterator>
+ OutputIterator reverse_copy(BidirectionalIterator first,
+ BidirectionalIterator last,
+ OutputIterator result);
+
+T template<class ForwardIterator>
+ void rotate(ForwardIterator first, ForwardIterator middle,
+ ForwardIterator last);
+T template<class ForwardIterator, class OutputIterator>
+ OutputIterator rotate_copy(ForwardIterator first, ForwardIterator middle,
+ ForwardIterator last, OutputIterator result);
+T template<class RandomAccessIterator>
+ void random_shuffle(RandomAccessIterator first,
+ RandomAccessIterator last);
+T template<class RandomAccessIterator, class RandomNumberGenerator>
+ void random_shuffle(RandomAccessIterator first,
+ RandomAccessIterator last,
+ RandomNumberGenerator& rand);
+ // _lib.alg.partitions_, partitions:
+T template<class BidirectionalIterator, class Predicate>
+ BidirectionalIterator partition(BidirectionalIterator first,
+ BidirectionalIterator last,
+ Predicate pred);
+T template<class BidirectionalIterator, class Predicate>
+ BidirectionalIterator stable_partition(BidirectionalIterator first,
+ BidirectionalIterator last,
+ Predicate pred);
+ // _lib.alg.sorting_, sorting and related operations:
+ // _lib.alg.sort_, sorting:
+T template<class RandomAccessIterator>
+ void sort(RandomAccessIterator first, RandomAccessIterator last);
+T template<class RandomAccessIterator, class Compare>
+ void sort(RandomAccessIterator first, RandomAccessIterator last,
+ Compare comp);
+T template<class RandomAccessIterator>
+ void stable_sort(RandomAccessIterator first, RandomAccessIterator last);
+T template<class RandomAccessIterator, class Compare>
+ void stable_sort(RandomAccessIterator first, RandomAccessIterator last,
+ Compare comp);
+T template<class RandomAccessIterator>
+ void partial_sort(RandomAccessIterator first,
+ RandomAccessIterator middle,
+ RandomAccessIterator last);
+T template<class RandomAccessIterator, class Compare>
+ void partial_sort(RandomAccessIterator first,
+ RandomAccessIterator middle,
+ RandomAccessIterator last, Compare comp);
+T template<class InputIterator, class RandomAccessIterator>
+ RandomAccessIterator
+ partial_sort_copy(InputIterator first, InputIterator last,
+ RandomAccessIterator result_first,
+ RandomAccessIterator result_last);
+T template<class InputIterator, class RandomAccessIterator, class Compare>
+ RandomAccessIterator
+ partial_sort_copy(InputIterator first, InputIterator last,
+ RandomAccessIterator result_first,
+ RandomAccessIterator result_last,
+ Compare comp);
+
+T template<class RandomAccessIterator>
+ void nth_element(RandomAccessIterator first, RandomAccessIterator nth,
+ RandomAccessIterator last);
+T template<class RandomAccessIterator, class Compare>
+ void nth_element(RandomAccessIterator first, RandomAccessIterator nth,
+ RandomAccessIterator last, Compare comp);
+ // _lib.alg.binary.search_, binary search:
+T template<class ForwardIterator, class T>
+ ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last,
+ const T& value);
+T template<class ForwardIterator, class T, class Compare>
+ ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last,
+ const T& value, Compare comp);
+T template<class ForwardIterator, class T>
+ ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last,
+ const T& value);
+T template<class ForwardIterator, class T, class Compare>
+ ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last,
+ const T& value, Compare comp);
+T template<class ForwardIterator, class T>
+ pair<ForwardIterator, ForwardIterator>
+ equal_range(ForwardIterator first, ForwardIterator last,
+ const T& value);
+T template<class ForwardIterator, class T, class Compare>
+ pair<ForwardIterator, ForwardIterator>
+ equal_range(ForwardIterator first, ForwardIterator last,
+ const T& value, Compare comp);
+T template<class ForwardIterator, class T>
+ bool binary_search(ForwardIterator first, ForwardIterator last,
+ const T& value);
+T template<class ForwardIterator, class T, class Compare>
+ bool binary_search(ForwardIterator first, ForwardIterator last,
+ const T& value, Compare comp);
+ // _lib.alg.merge_, merge:
+T template<class InputIterator1, class InputIterator2, class OutputIterator>
+ OutputIterator merge(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2,
+ OutputIterator result);
+T template<class InputIterator1, class InputIterator2, class OutputIterator,
+ class Compare>
+ OutputIterator merge(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2,
+ OutputIterator result, Compare comp);
+T template<class BidirectionalIterator>
+ void inplace_merge(BidirectionalIterator first,
+ BidirectionalIterator middle,
+ BidirectionalIterator last);
+T template<class BidirectionalIterator, class Compare>
+ void inplace_merge(BidirectionalIterator first,
+ BidirectionalIterator middle,
+ BidirectionalIterator last, Compare comp);
+
+ // _lib.alg.set.operations_, set operations:
+T template<class InputIterator1, class InputIterator2>
+ bool includes(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2);
+T template<class InputIterator1, class InputIterator2, class Compare>
+ bool includes(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2, Compare comp);
+T template<class InputIterator1, class InputIterator2, class OutputIterator>
+ OutputIterator set_union(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2,
+ OutputIterator result);
+T template<class InputIterator1, class InputIterator2, class OutputIterator,
+ class Compare>
+ OutputIterator set_union(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2,
+ OutputIterator result, Compare comp);
+T template<class InputIterator1, class InputIterator2, class OutputIterator>
+ OutputIterator set_intersection
+ (InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2,
+ OutputIterator result);
+T template<class InputIterator1, class InputIterator2, class OutputIterator,
+ class Compare>
+ OutputIterator set_intersection
+ (InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2,
+ OutputIterator result, Compare comp);
+T template<class InputIterator1, class InputIterator2, class OutputIterator>
+ OutputIterator set_difference
+ (InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2,
+ OutputIterator result);
+T template<class InputIterator1, class InputIterator2, class OutputIterator,
+ class Compare>
+ OutputIterator set_difference(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2,
+ OutputIterator result, Compare comp);
+T template<class InputIterator1, class InputIterator2, class OutputIterator>
+ OutputIterator
+ set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2,
+ OutputIterator result);
+T template<class InputIterator1, class InputIterator2, class OutputIterator,
+ class Compare>
+ OutputIterator
+ set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2,
+ OutputIterator result, Compare comp);
+ // _lib.alg.heap.operations_, heap operations:
+T template<class RandomAccessIterator>
+ void push_heap(RandomAccessIterator first, RandomAccessIterator last);
+T template<class RandomAccessIterator, class Compare>
+ void push_heap(RandomAccessIterator first, RandomAccessIterator last,
+ Compare comp);
+
+T template<class RandomAccessIterator>
+ void pop_heap(RandomAccessIterator first, RandomAccessIterator last);
+T template<class RandomAccessIterator, class Compare>
+ void pop_heap(RandomAccessIterator first, RandomAccessIterator last,
+ Compare comp);
+T template<class RandomAccessIterator>
+ void make_heap(RandomAccessIterator first, RandomAccessIterator last);
+T template<class RandomAccessIterator, class Compare>
+ void make_heap(RandomAccessIterator first, RandomAccessIterator last,
+ Compare comp);
+T template<class RandomAccessIterator>
+ void sort_heap(RandomAccessIterator first, RandomAccessIterator last);
+T template<class RandomAccessIterator, class Compare>
+ void sort_heap(RandomAccessIterator first, RandomAccessIterator last,
+ Compare comp);
+ // _lib.alg.min.max_, minimum and maximum:
+T template<class T> const T& min(const T& a, const T& b);
+T template<class T, class Compare>
+ const T& min(const T& a, const T& b, Compare comp);
+T template<class T> const T& max(const T& a, const T& b);
+T template<class T, class Compare>
+ const T& max(const T& a, const T& b, Compare comp);
+T template<class ForwardIterator>
+ ForwardIterator min_element(ForwardIterator first, ForwardIterator last);
+T template<class ForwardIterator, class Compare>
+ ForwardIterator min_element(ForwardIterator first, ForwardIterator last,
+ Compare comp);
+T template<class ForwardIterator>
+ ForwardIterator max_element(ForwardIterator first, ForwardIterator last);
+T template<class ForwardIterator, class Compare>
+ ForwardIterator max_element(ForwardIterator first, ForwardIterator last,
+ Compare comp);
+T template<class InputIterator1, class InputIterator2>
+ bool lexicographical_compare
+ (InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2);
+T template<class InputIterator1, class InputIterator2, class Compare>
+ bool lexicographical_compare
+ (InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2,
+ Compare comp);
+
+ // _lib.alg.permutation.generators_, permutations
+T template<class BidirectionalIterator>
+ bool next_permutation(BidirectionalIterator first,
+ BidirectionalIterator last);
+T template<class BidirectionalIterator, class Compare>
+ bool next_permutation(BidirectionalIterator first,
+ BidirectionalIterator last, Compare comp);
+T template<class BidirectionalIterator>
+ bool prev_permutation(BidirectionalIterator first,
+ BidirectionalIterator last);
+T template<class BidirectionalIterator, class Compare>
+ bool prev_permutation(BidirectionalIterator first,
+ BidirectionalIterator last, Compare comp);
+
+
+ 25.4 C library algorithms [lib.alg.c.library]
+
+ 1 Header <cstdlib> (partial, Table 2):
+
+ Table 2--Header <cstdlib> synopsis
+
+ Functions: bsearch qsort
+
+
+X extern "C" void *bsearch(const void *key, const void *base,
+ size_t nmemb, size_t size,
+ int (*compar)(const void *, const void *));
+X extern "C++" void *bsearch(const void *key, const void *base,
+ size_t nmemb, size_t size,
+ int (*compar)(const void *, const void *));
+
+X extern "C" void qsort(void* base, size_t nmemb, size_t size,
+ int (*compar)(const void*, const void*));
+X extern "C++" void qsort(void* base, size_t nmemb, size_t size,
+ int (*compar)(const void*, const void*));
+
+
+
+ 26.2 Complex numbers [lib.complex.numbers]
+
+
+ 26.2.1 Header <complex> synopsis [lib.complex.synopsis]
+
+T template<class T> class complex;
+T template<> class complex<float>;
+T template<> class complex<double>;
+T template<> class complex<long double>;
+ // _lib.complex.ops_ operators:
+T template<class T>
+ complex<T> operator+(const complex<T>&, const complex<T>&);
+T template<class T> complex<T> operator+(const complex<T>&, const T&);
+T template<class T> complex<T> operator+(const T&, const complex<T>&);
+T template<class T> complex<T> operator-
+ (const complex<T>&, const complex<T>&);
+T template<class T> complex<T> operator-(const complex<T>&, const T&);
+T template<class T> complex<T> operator-(const T&, const complex<T>&);
+T template<class T> complex<T> operator*
+ (const complex<T>&, const complex<T>&);
+T template<class T> complex<T> operator*(const complex<T>&, const T&);
+T template<class T> complex<T> operator*(const T&, const complex<T>&);
+T template<class T> complex<T> operator/
+ (const complex<T>&, const complex<T>&);
+T template<class T> complex<T> operator/(const complex<T>&, const T&);
+T template<class T> complex<T> operator/(const T&, const complex<T>&);
+T template<class T> complex<T> operator+(const complex<T>&);
+T template<class T> complex<T> operator-(const complex<T>&);
+T template<class T> bool operator==
+ (const complex<T>&, const complex<T>&);
+T template<class T> bool operator==(const complex<T>&, const T&);
+T template<class T> bool operator==(const T&, const complex<T>&);
+T template<class T> bool operator!=(const complex<T>&, const complex<T>&);
+T template<class T> bool operator!=(const complex<T>&, const T&);
+T template<class T> bool operator!=(const T&, const complex<T>&);
+T template<class T, class charT, class traits>
+ basic_istream<charT, traits>&
+ operator>>(basic_istream<charT, traits>&, complex<T>&);
+
+T template<class T, class charT, class traits>
+ basic_ostream<charT, traits>&
+ operator<<(basic_ostream<charT, traits>&, const complex<T>&);
+ // _lib.complex.value.ops_ values:
+T template<class T> T real(const complex<T>&);
+T template<class T> T imag(const complex<T>&);
+
+T template<class T> T abs(const complex<T>&);
+T template<class T> T arg(const complex<T>&);
+T template<class T> T norm(const complex<T>&);
+T template<class T> complex<T> conj(const complex<T>&);
+T template<class T> complex<T> polar(const T&, const T&);
+ // _lib.complex.transcendentals_ transcendentals:
+T template<class T> complex<T> cos (const complex<T>&);
+T template<class T> complex<T> cosh (const complex<T>&);
+T template<class T> complex<T> exp (const complex<T>&);
+T template<class T> complex<T> log (const complex<T>&);
+T template<class T> complex<T> log10(const complex<T>&);
+T template<class T> complex<T> pow(const complex<T>&, int);
+T template<class T> complex<T> pow(const complex<T>&, const T&);
+T template<class T> complex<T> pow(const complex<T>&, const complex<T>&);
+T template<class T> complex<T> pow(const T&, const complex<T>&);
+T template<class T> complex<T> sin (const complex<T>&);
+T template<class T> complex<T> sinh (const complex<T>&);
+T template<class T> complex<T> sqrt (const complex<T>&);
+T template<class T> complex<T> tan (const complex<T>&);
+T template<class T> complex<T> tanh (const complex<T>&);
+ }
+
+ 26.2.2 Template class complex [lib.complex]
+
+ template<class T>
+T class complex {
+ public:
+T typedef T value_type;
+
+T complex(const T& re = T(), const T& im = T());
+T complex(const complex&);
+T template<class X> complex(const complex<X>&);
+
+T T real() const;
+T T imag() const;
+
+T complex<T>& operator= (const T&);
+T complex<T>& operator+=(const T&);
+T complex<T>& operator-=(const T&);
+T complex<T>& operator*=(const T&);
+T complex<T>& operator/=(const T&);
+
+T complex& operator=(const complex&);
+T template<class X> complex<T>& operator= (const complex<X>&);
+T template<class X> complex<T>& operator+=(const complex<X>&);
+T template<class X> complex<T>& operator-=(const complex<X>&);
+T template<class X> complex<T>& operator*=(const complex<X>&);
+T template<class X> complex<T>& operator/=(const complex<X>&);
+ };
+
+T template<class T> complex<T> operator+
+ (const complex<T>&, const complex<T>&);
+T template<class T> complex<T> operator+(const complex<T>&, const T&);
+T template<class T> complex<T> operator+(const T&, const complex<T>&);
+
+T template<class T> complex<T> operator-
+ (const complex<T>&, const complex<T>&);
+T template<class T> complex<T> operator-(const complex<T>&, const T&);
+T template<class T> complex<T> operator-(const T&, const complex<T>&);
+
+T template<class T> complex<T> operator*
+ (const complex<T>&, const complex<T>&);
+T template<class T> complex<T> operator*(const complex<T>&, const T&);
+T template<class T> complex<T> operator*(const T&, const complex<T>&);
+
+T template<class T> complex<T> operator/
+ (const complex<T>&, const complex<T>&);
+T template<class T> complex<T> operator/(const complex<T>&, const T&);
+T template<class T> complex<T> operator/(const T&, const complex<T>&);
+
+T template<class T> complex<T> operator+(const complex<T>&);
+T template<class T> complex<T> operator-(const complex<T>&);
+
+T template<class T> bool operator==(const complex<T>&, const complex<T>&);
+T template<class T> bool operator==(const complex<T>&, const T&);
+T template<class T> bool operator==(const T&, const complex<T>&);
+
+T template<class T> bool operator!=(const complex<T>&, const complex<T>&);
+T template<class T> bool operator!=(const complex<T>&, const T&);
+T template<class T> bool operator!=(const T&, const complex<T>&);
+
+T template<class T, class charT, class traits>
+ basic_istream<charT, traits>&
+ operator>>(basic_istream<charT, traits>&, complex<T>&);
+
+T template<class T, class charT, class traits>
+ basic_ostream<charT, traits>&
+ operator<<(basic_ostream<charT, traits>&, const complex<T>&);
+
+
+ 26.2.3 complex specializations [lib.complex.special]
+
+T template<> class complex<float> {
+ public:
+T typedef float value_type;
+
+T complex(float re = 0.0f, float im = 0.0f);
+T explicit complex(const complex<double>&);
+T explicit complex(const complex<long double>&);
+T float real() const;
+T float imag() const;
+
+T complex<float>& operator= (float);
+T complex<float>& operator+=(float);
+T complex<float>& operator-=(float);
+T complex<float>& operator*=(float);
+T complex<float>& operator/=(float);
+
+T complex<float>& operator=(const complex<float>&);
+T template<class X> complex<float>& operator= (const complex<X>&);
+T template<class X> complex<float>& operator+=(const complex<X>&);
+T template<class X> complex<float>& operator-=(const complex<X>&);
+T template<class X> complex<float>& operator*=(const complex<X>&);
+T template<class X> complex<float>& operator/=(const complex<X>&);
+ };
+T template<> class complex<double> {
+ public:
+T typedef double value_type;
+
+T complex(double re = 0.0, double im = 0.0);
+T complex(const complex<float>&);
+T explicit complex(const complex<long double>&);
+T double real() const;
+T double imag() const;
+
+T complex<double>& operator= (double);
+T complex<double>& operator+=(double);
+T complex<double>& operator-=(double);
+T complex<double>& operator*=(double);
+T complex<double>& operator/=(double);
+
+T complex<double>& operator=(const complex<double>&);
+T template<class X> complex<double>& operator= (const complex<X>&);
+T template<class X> complex<double>& operator+=(const complex<X>&);
+T template<class X> complex<double>& operator-=(const complex<X>&);
+T template<class X> complex<double>& operator*=(const complex<X>&);
+T template<class X> complex<double>& operator/=(const complex<X>&);
+ };
+
+T template<> class complex<long double> {
+ public:
+T typedef long double value_type;
+
+T complex(long double re = 0.0L, long double im = 0.0L);
+T complex(const complex<float>&);
+T complex(const complex<double>&);
+T long double real() const;
+T long double imag() const;
+
+T complex<long double>& operator=(const complex<long double>&);
+T complex<long double>& operator= (long double);
+T complex<long double>& operator+=(long double);
+T complex<long double>& operator-=(long double);
+T complex<long double>& operator*=(long double);
+T complex<long double>& operator/=(long double);
+
+T template<class X> complex<long double>& operator= (const complex<X>&);
+T template<class X> complex<long double>& operator+=(const complex<X>&);
+T template<class X> complex<long double>& operator-=(const complex<X>&);
+T template<class X> complex<long double>& operator*=(const complex<X>&);
+T template<class X> complex<long double>& operator/=(const complex<X>&);
+ };
+
+ 26.3 Numeric arrays [lib.numarray]
+
+ 26.3.1 Header <valarray> synopsis [lib.valarray.synopsis]
+
+T template<class T> class valarray; // An array of type T
+T class slice;
+T template<class T> class slice_array;
+T class gslice;
+T template<class T> class gslice_array;
+T template<class T> class mask_array; // a masked array
+T template<class T> class indirect_array; // an indirected array
+
+T template<class T> valarray<T> operator*
+ (const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<T> operator* (const valarray<T>&, const T&);
+T template<class T> valarray<T> operator* (const T&, const valarray<T>&);
+T template<class T> valarray<T> operator/
+ (const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<T> operator/ (const valarray<T>&, const T&);
+T template<class T> valarray<T> operator/ (const T&, const valarray<T>&);
+T template<class T> valarray<T> operator%
+ (const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<T> operator% (const valarray<T>&, const T&);
+T template<class T> valarray<T> operator% (const T&, const valarray<T>&);
+T template<class T> valarray<T> operator+
+ (const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<T> operator+ (const valarray<T>&, const T&);
+T template<class T> valarray<T> operator+ (const T&, const valarray<T>&);
+T template<class T> valarray<T> operator-
+ (const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<T> operator- (const valarray<T>&, const T&);
+T template<class T> valarray<T> operator- (const T&, const valarray<T>&);
+T template<class T> valarray<T> operator^
+ (const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<T> operator^ (const valarray<T>&, const T&);
+T template<class T> valarray<T> operator^ (const T&, const valarray<T>&);
+T template<class T> valarray<T> operator&
+ (const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<T> operator& (const valarray<T>&, const T&);
+T template<class T> valarray<T> operator& (const T&, const valarray<T>&);
+T template<class T> valarray<T> operator|
+ (const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<T> operator| (const valarray<T>&, const T&);
+T template<class T> valarray<T> operator| (const T&, const valarray<T>&);
+T template<class T> valarray<T> operator<<
+ (const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<T> operator<<(const valarray<T>&, const T&);
+T template<class T> valarray<T> operator<<(const T&, const valarray<T>&);
+T template<class T> valarray<T> operator>>
+ (const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<T> operator>>(const valarray<T>&, const T&);
+T template<class T> valarray<T> operator>>(const T&, const valarray<T>&);
+T template<class T> valarray<bool> operator&&
+ (const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<bool> operator&&(const valarray<T>&, const T&);
+T template<class T> valarray<bool> operator&&(const T&, const valarray<T>&);
+T template<class T> valarray<bool> operator||
+ (const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<bool> operator||(const valarray<T>&, const T&);
+T template<class T> valarray<bool> operator||(const T&, const valarray<T>&);
+
+T template<class T>
+ valarray<bool> operator==(const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<bool> operator==(const valarray<T>&, const T&);
+T template<class T> valarray<bool> operator==(const T&, const valarray<T>&);
+T template<class T>
+ valarray<bool> operator!=(const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<bool> operator!=(const valarray<T>&, const T&);
+T template<class T> valarray<bool> operator!=(const T&, const valarray<T>&);
+T template<class T>
+ valarray<bool> operator< (const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<bool> operator< (const valarray<T>&, const T&);
+T template<class T> valarray<bool> operator< (const T&, const valarray<T>&);
+T template<class T>
+ valarray<bool> operator> (const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<bool> operator> (const valarray<T>&, const T&);
+T template<class T> valarray<bool> operator> (const T&, const valarray<T>&);
+T template<class T>
+ valarray<bool> operator<=(const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<bool> operator<=(const valarray<T>&, const T&);
+T template<class T> valarray<bool> operator<=(const T&, const valarray<T>&);
+T template<class T>
+ valarray<bool> operator>=(const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<bool> operator>=(const valarray<T>&, const T&);
+T template<class T> valarray<bool> operator>=(const T&, const valarray<T>&);
+T template<class T> valarray<T> abs (const valarray<T>&);
+T template<class T> valarray<T> acos (const valarray<T>&);
+T template<class T> valarray<T> asin (const valarray<T>&);
+T template<class T> valarray<T> atan (const valarray<T>&);
+T template<class T> valarray<T> atan2
+ (const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<T> atan2(const valarray<T>&, const T&);
+T template<class T> valarray<T> atan2(const T&, const valarray<T>&);
+T template<class T> valarray<T> cos (const valarray<T>&);
+T template<class T> valarray<T> cosh (const valarray<T>&);
+T template<class T> valarray<T> exp (const valarray<T>&);
+T template<class T> valarray<T> log (const valarray<T>&);
+T template<class T> valarray<T> log10(const valarray<T>&);
+T template<class T> valarray<T> pow(const valarray<T>&, const valarray<T>&);
+T template<class T> valarray<T> pow(const valarray<T>&, const T&);
+T template<class T> valarray<T> pow(const T&, const valarray<T>&);
+T template<class T> valarray<T> sin (const valarray<T>&);
+T template<class T> valarray<T> sinh (const valarray<T>&);
+T template<class T> valarray<T> sqrt (const valarray<T>&);
+T template<class T> valarray<T> tan (const valarray<T>&);
+T template<class T> valarray<T> tanh (const valarray<T>&);
+ }
+
+
+ 26.3.2 Template class valarray [lib.template.valarray]
+
+T template<class T> class valarray {
+ public:
+T typedef T value_type;
+
+ // _lib.valarray.cons_ construct/destroy:
+T valarray();
+T explicit valarray(size_t);
+T valarray(const T&, size_t);
+T valarray(const T*, size_t);
+T valarray(const valarray&);
+T valarray(const slice_array<T>&);
+T valarray(const gslice_array<T>&);
+T valarray(const mask_array<T>&);
+T valarray(const indirect_array<T>&);
+T ~valarray();
+
+ // _lib.valarray.assign_ assignment:
+T valarray<T>& operator=(const valarray<T>&);
+T valarray<T>& operator=(const T&);
+T valarray<T>& operator=(const slice_array<T>&);
+T valarray<T>& operator=(const gslice_array<T>&);
+T valarray<T>& operator=(const mask_array<T>&);
+T valarray<T>& operator=(const indirect_array<T>&);
+ // _lib.valarray.access_ element access:
+T T operator[](size_t) const;
+T T& operator[](size_t);
+ // _lib.valarray.sub_ subset operations:
+T valarray<T> operator[](slice) const;
+T slice_array<T> operator[](slice);
+T valarray<T> operator[](const gslice&) const;
+T gslice_array<T> operator[](const gslice&);
+T valarray<T> operator[](const valarray<bool>&) const;
+T mask_array<T> operator[](const valarray<bool>&);
+T valarray<T> operator[](const valarray<size_t>&) const;
+T indirect_array<T> operator[](const valarray<size_t>&);
+ // _lib.valarray.unary_ unary operators:
+T valarray<T> operator+() const;
+T valarray<T> operator-() const;
+T valarray<T> operator~() const;
+T valarray<T> operator!() const;
+ // _lib.valarray.cassign_ computed assignment:
+T valarray<T>& operator*= (const T&);
+T valarray<T>& operator/= (const T&);
+T valarray<T>& operator%= (const T&);
+T valarray<T>& operator+= (const T&);
+T valarray<T>& operator-= (const T&);
+T valarray<T>& operator^= (const T&);
+T valarray<T>& operator&= (const T&);
+T valarray<T>& operator|= (const T&);
+T valarray<T>& operator<<=(const T&);
+T valarray<T>& operator>>=(const T&);
+T valarray<T>& operator*= (const valarray<T>&);
+T valarray<T>& operator/= (const valarray<T>&);
+T valarray<T>& operator%= (const valarray<T>&);
+T valarray<T>& operator+= (const valarray<T>&);
+T valarray<T>& operator-= (const valarray<T>&);
+T valarray<T>& operator^= (const valarray<T>&);
+T valarray<T>& operator|= (const valarray<T>&);
+T valarray<T>& operator&= (const valarray<T>&);
+T valarray<T>& operator<<=(const valarray<T>&);
+T valarray<T>& operator>>=(const valarray<T>&);
+ // _lib.valarray.members_ member functions:
+T size_t size() const;
+T T sum() const;
+T T min() const;
+T T max() const;
+
+T valarray<T> shift (int) const;
+T valarray<T> cshift(int) const;
+T valarray<T> apply(T func(T)) const;
+T valarray<T> apply(T func(const T&)) const;
+T void resize(size_t sz, T c = T());
+ };
+ }
+
+
+
+ 26.3.4 Class slice [lib.class.slice]
+
+T class slice {
+ public:
+T slice();
+T slice(size_t, size_t, size_t);
+
+T size_t start() const;
+T size_t size() const;
+T size_t stride() const;
+ };
+ }
+
+
+
+ 26.3.5 Template class slice_array [lib.template.slice.array]
+
+T template <class T> class slice_array {
+ public:
+T typedef T value_type;
+
+T void operator= (const valarray<T>&) const;
+T void operator*= (const valarray<T>&) const;
+T void operator/= (const valarray<T>&) const;
+T void operator%= (const valarray<T>&) const;
+T void operator+= (const valarray<T>&) const;
+T void operator-= (const valarray<T>&) const;
+T void operator^= (const valarray<T>&) const;
+T void operator&= (const valarray<T>&) const;
+T void operator|= (const valarray<T>&) const;
+T void operator<<=(const valarray<T>&) const;
+T void operator>>=(const valarray<T>&) const;
+T void operator=(const T&);
+T ~slice_array();
+ private:
+T slice_array();
+T slice_array(const slice_array&);
+T slice_array& operator=(const slice_array&);
+ };
+ }
+
+
+
+ 26.3.6 The gslice class [lib.class.gslice]
+
+T class gslice {
+ public:
+T gslice();
+T gslice(size_t s, const valarray<size_t>& l, const valarray<size_t>& d);
+
+T size_t start() const;
+T valarray<size_t> size() const;
+T valarray<size_t> stride() const;
+ };
+
+
+ 26.3.7 Template class gslice_array [lib.template.gslice.array]
+
+T template <class T> class gslice_array {
+ public:
+T typedef T value_type;
+
+T void operator= (const valarray<T>&) const;
+T void operator*= (const valarray<T>&) const;
+T void operator/= (const valarray<T>&) const;
+T void operator%= (const valarray<T>&) const;
+T void operator+= (const valarray<T>&) const;
+T void operator-= (const valarray<T>&) const;
+T void operator^= (const valarray<T>&) const;
+T void operator&= (const valarray<T>&) const;
+T void operator|= (const valarray<T>&) const;
+T void operator<<=(const valarray<T>&) const;
+T void operator>>=(const valarray<T>&) const;
+T void operator=(const T&);
+T ~gslice_array();
+ private:
+T gslice_array();
+T gslice_array(const gslice_array&);
+T gslice_array& operator=(const gslice_array&);
+ };
+
+
+ 26.3.8 Template class mask_array [lib.template.mask.array]
+
+T template <class T> class mask_array {
+ public:
+T typedef T value_type;
+
+T void operator= (const valarray<T>&) const;
+T void operator*= (const valarray<T>&) const;
+T void operator/= (const valarray<T>&) const;
+T void operator%= (const valarray<T>&) const;
+T void operator+= (const valarray<T>&) const;
+T void operator-= (const valarray<T>&) const;
+T void operator^= (const valarray<T>&) const;
+T void operator&= (const valarray<T>&) const;
+T void operator|= (const valarray<T>&) const;
+T void operator<<=(const valarray<T>&) const;
+T void operator>>=(const valarray<T>&) const;
+T void operator=(const T&);
+T ~mask_array();
+ private:
+T mask_array();
+T mask_array(const mask_array&);
+T mask_array& operator=(const mask_array&);
+ // remainder implementation defined
+ };
+
+
+ 26.3.9 Template class [lib.template.indirect.array]
+ indirect_array
+
+T template <class T> class indirect_array {
+ public:
+T typedef T value_type;
+
+T void operator= (const valarray<T>&) const;
+T void operator*= (const valarray<T>&) const;
+T void operator/= (const valarray<T>&) const;
+T void operator%= (const valarray<T>&) const;
+T void operator+= (const valarray<T>&) const;
+T void operator-= (const valarray<T>&) const;
+T void operator^= (const valarray<T>&) const;
+T void operator&= (const valarray<T>&) const;
+T void operator|= (const valarray<T>&) const;
+T void operator<<=(const valarray<T>&) const;
+T void operator>>=(const valarray<T>&) const;
+T void operator=(const T&);
+T ~indirect_array();
+ private:
+T indirect_array();
+T indirect_array(const indirect_array&);
+T indirect_array& operator=(const indirect_array&);
+ // remainder implementation defined
+ };
+
+ 26.4 Generalized numeric operations [lib.numeric.ops]
+
+ Header <numeric> synopsis
+
+T template <class InputIterator, class T>
+ T accumulate(InputIterator first, InputIterator last, T init);
+
+T template <class InputIterator, class T, class BinaryOperation>
+ T accumulate(InputIterator first, InputIterator last, T init,
+ BinaryOperation binary_op);
+
+T template <class InputIterator1, class InputIterator2, class T>
+ T inner_product(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, T init);
+
+T template <class InputIterator1, class InputIterator2, class T,
+ class BinaryOperation1, class BinaryOperation2>
+ T inner_product(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, T init,
+ BinaryOperation1 binary_op1,
+ BinaryOperation2 binary_op2);
+
+T template <class InputIterator, class OutputIterator>
+ OutputIterator partial_sum(InputIterator first,
+ InputIterator last,
+ OutputIterator result);
+
+T template <class InputIterator, class OutputIterator,
+ class BinaryOperation>
+ OutputIterator partial_sum(InputIterator first,
+ InputIterator last,
+ OutputIterator result,
+ BinaryOperation binary_op);
+
+T template <class InputIterator, class OutputIterator>
+ OutputIterator adjacent_difference(InputIterator first,
+ InputIterator last,
+ OutputIterator result);
+
+T template <class InputIterator, class OutputIterator,
+ class BinaryOperation>
+ OutputIterator adjacent_difference(InputIterator first,
+ InputIterator last,
+ OutputIterator result,
+ BinaryOperation binary_op);
+
+
+ 26.5 C Library [lib.c.math]
+
+ Table 2--Header <cmath> synopsis
+X Macro: HUGE_VAL
+ Functions:
+X acos cos fmod modf tan
+X asin cosh frexp pow tanh
+X atan exp ldexp sin
+X atan2 fabs log sinh
+X ceil floor log10 sqrt
+
+ Table 3--Header <cstdlib> synopsis
+X Macros: RAND_MAX
+X Types: div_t ldiv_t
+ Functions:
+X abs labs srand
+X div ldiv rand
+
+X long abs(long); // labs()
+X ldiv_t div(long, long); // ldiv()
+
+X float abs (float);
+X float acos (float);
+X float asin (float);
+X float atan (float);
+X float atan2(float, float);
+X float ceil (float);
+X float cos (float);
+X float cosh (float);
+X float exp (float);
+X float fabs (float);
+X float floor(float);
+X float fmod (float, float);
+X float frexp(float, int*);
+X float ldexp(float, int);
+X float log (float);
+X float log10(float);
+X float modf (float, float*);
+X float pow (float, float);
+X float pow (float, int);
+X float sin (float);
+X float sinh (float);
+X float sqrt (float);
+X float tan (float);
+X float tanh (float);
+
+X double abs(double); // fabs()
+X double pow(double, int);
+
+X long double abs (long double);
+X long double acos (long double);
+X long double asin (long double);
+X long double atan (long double);
+X long double atan2(long double, long double);
+X long double ceil (long double);
+X long double cos (long double);
+X long double cosh (long double);
+X long double exp (long double);
+X long double fabs (long double);
+X long double floor(long double);
+X long double fmod (long double, long double);
+X long double frexp(long double, int*);
+X long double ldexp(long double, int);
+X long double log (long double);
+X long double log10(long double);
+X long double modf (long double, long double*);
+X long double pow (long double, long double);
+X long double pow (long double, int);
+X long double sin (long double);
+X long double sinh (long double);
+X long double sqrt (long double);
+X long double tan (long double);
+X long double tanh (long double);
+
+ Header <iosfwd> synopsis
+
+X template<class charT> class char_traits;
+X template<> class char_traits<char>;
+X template<> class char_traits<wchar_t>;
+X template<class T> class allocator;
+X template <class charT, class traits = char_traits<charT> >
+ class basic_ios;
+
+X template <class charT, class traits = char_traits<charT> >
+ class basic_streambuf;
+
+X template <class charT, class traits = char_traits<charT> >
+ class basic_istream;
+
+X template <class charT, class traits = char_traits<charT> >
+ class basic_ostream;
+
+X template <class charT, class traits = char_traits<charT> >
+ class basic_iostream;
+
+X template <class charT, class traits = char_traits<charT>,
+ class Allocator = allocator<charT> >
+ class basic_stringbuf;
+
+X template <class charT, class traits = char_traits<charT>,
+ class Allocator = allocator<charT> >
+ class basic_istringstream;
+
+X template <class charT, class traits = char_traits<charT>,
+ class Allocator = allocator<charT> >
+ class basic_ostringstream;
+
+X template <class charT, class traits = char_traits<charT>,
+ class Allocator = allocator<charT> >
+ class basic_stringstream;
+
+X template <class charT, class traits = char_traits<charT> >
+ class basic_filebuf;
+
+X template <class charT, class traits = char_traits<charT> >
+ class basic_ifstream;
+
+X template <class charT, class traits = char_traits<charT> >
+ class basic_ofstream;
+
+X template <class charT, class traits = char_traits<charT> >
+ class basic_fstream;
+X template <class charT, class traits = char_traits<charT> >
+ class istreambuf_iterator;
+
+X template <class charT, class traits = char_traits<charT> >
+ class ostreambuf_iterator;
+X typedef basic_ios<char> ios;
+X typedef basic_ios<wchar_t> wios;
+X typedef basic_streambuf<char> streambuf;
+X typedef basic_istream<char> istream;
+X typedef basic_ostream<char> ostream;
+X typedef basic_iostream<char> iostream;
+X typedef basic_stringbuf<char> stringbuf;
+X typedef basic_istringstream<char> istringstream;
+X typedef basic_ostringstream<char> ostringstream;
+X typedef basic_stringstream<char> stringstream;
+X typedef basic_filebuf<char> filebuf;
+X typedef basic_ifstream<char> ifstream;
+X typedef basic_ofstream<char> ofstream;
+X typedef basic_fstream<char> fstream;
+X typedef basic_streambuf<wchar_t> wstreambuf;
+X typedef basic_istream<wchar_t> wistream;
+X typedef basic_ostream<wchar_t> wostream;
+X typedef basic_iostream<wchar_t> wiostream;
+X typedef basic_stringbuf<wchar_t> wstringbuf;
+X typedef basic_istringstream<wchar_t> wistringstream;
+X typedef basic_ostringstream<wchar_t> wostringstream;
+X typedef basic_stringstream<wchar_t> wstringstream;
+
+X typedef basic_filebuf<wchar_t> wfilebuf;
+X typedef basic_ifstream<wchar_t> wifstream;
+X typedef basic_ofstream<wchar_t> wofstream;
+X typedef basic_fstream<wchar_t> wfstream;
+X template <class state> class fpos;
+X typedef fpos<char_traits<char>::state_type> streampos;
+X typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
+
+ 27.3 Standard iostream objects [lib.iostream.objects]
+
+ Header <iostream> synopsis
+
+T [must also include <istream> and <ostream>]
+T extern istream cin;
+T extern ostream cout;
+T extern ostream cerr;
+T extern ostream clog;
+
+T extern wistream wcin;
+T extern wostream wcout;
+T extern wostream wcerr;
+T extern wostream wclog;
+
+ 27.4 Iostreams base classes [lib.iostreams.base]
+
+ Header <ios> synopsis
+
+ #include <iosfwd>
+
+T typedef OFF_T streamoff;
+T typedef SZ_T streamsize;
+T template <class stateT> class fpos;
+
+ class ios_base;
+ template <class charT, class traits = char_traits<charT> >
+ class basic_ios;
+ // _lib.std.ios.manip_, manipulators:
+T ios_base& boolalpha (ios_base& str);
+T ios_base& noboolalpha(ios_base& str);
+T ios_base& showbase (ios_base& str);
+T ios_base& noshowbase (ios_base& str);
+T ios_base& showpoint (ios_base& str);
+T ios_base& noshowpoint(ios_base& str);
+T ios_base& showpos (ios_base& str);
+T ios_base& noshowpos (ios_base& str);
+T ios_base& skipws (ios_base& str);
+T ios_base& noskipws (ios_base& str);
+T ios_base& nouppercase(ios_base& str);
+T ios_base& uppercase (ios_base& str);
+M ios_base& unitbuf (ios_base& str);
+M ios_base& nounitbuf (ios_base& str);
+ // _lib.adjustfield.manip_ adjustfield:
+T ios_base& internal (ios_base& str);
+T ios_base& left (ios_base& str);
+T ios_base& right (ios_base& str);
+ // _lib.basefield.manip_ basefield:
+T ios_base& dec (ios_base& str);
+T ios_base& hex (ios_base& str);
+T ios_base& oct (ios_base& str);
+
+ // _lib.floatfield.manip_ floatfield:
+T ios_base& fixed (ios_base& str);
+T ios_base& scientific (ios_base& str);
+
+
+ 27.4.2 Class ios_base [lib.ios.base]
+
+T class ios_base {
+ public:
+ class failure;
+T typedef T1 fmtflags;
+T static const fmtflags boolalpha;
+T static const fmtflags dec;
+T static const fmtflags fixed;
+T static const fmtflags hex;
+T static const fmtflags internal;
+T static const fmtflags left;
+T static const fmtflags oct;
+T static const fmtflags right;
+T static const fmtflags scientific;
+T static const fmtflags showbase;
+T static const fmtflags showpoint;
+T static const fmtflags showpos;
+T static const fmtflags skipws;
+X static const fmtflags unitbuf;
+T static const fmtflags uppercase;
+T static const fmtflags adjustfield;
+T static const fmtflags basefield;
+T static const fmtflags floatfield;
+
+ typedef T2 iostate;
+T static const iostate badbit;
+T static const iostate eofbit;
+T static const iostate failbit;
+T static const iostate goodbit;
+T typedef T3 openmode;
+T static const openmode app;
+T static const openmode ate;
+T static const openmode binary;
+T static const openmode in;
+T static const openmode out;
+T static const openmode trunc;
+T typedef T4 seekdir;
+T static const seekdir beg;
+T static const seekdir cur;
+T static const seekdir end;
+T class Init;
+ // _lib.fmtflags.state_ fmtflags state:
+T fmtflags flags() const;
+T fmtflags flags(fmtflags fmtfl);
+T fmtflags setf(fmtflags fmtfl);
+T fmtflags setf(fmtflags fmtfl, fmtflags mask);
+T void unsetf(fmtflags mask);
+T streamsize precision() const;
+T streamsize precision(streamsize prec);
+T streamsize width() const;
+T streamsize width(streamsize wide);
+ // _lib.ios.base.locales_ locales:
+T locale imbue(const locale& loc);
+T locale getloc() const;
+ // _lib.ios.base.storage_ storage:
+T static int xalloc();
+T long& iword(int index);
+T void*& pword(int index);
+ // destructor
+T virtual ~ios_base();
+ // _lib.ios.base.callback_ callbacks;
+T enum event { erase_event, imbue_event, copyfmt_event };
+T typedef void (*event_callback)(event, ios_base&, int index);
+T void register_callback(event_call_back fn, int index);
+T static bool sync_with_stdio(bool sync = true);
+ protected:
+T ios_base();
+ };
+
+ 27.4.2.1.1 Class ios_base::failure [lib.ios::failure]
+
+T class ios_base::failure : public exception {
+ public:
+T explicit failure(const string& msg);
+T virtual ~failure();
+T virtual const char* what() const throw();
+ };
+
+
+ 27.4.2.1.6 Class ios_base::Init [lib.ios::Init]
+
+T class ios_base::Init {
+ public:
+T Init();
+T ~Init();
+ };
+
+
+ 27.4.3 Template class fpos [lib.fpos]
+
+X template <class stateT> class fpos {
+ public:
+ // _lib.fpos.members_ Members
+T stateT state() const;
+T void state(stateT);
+ private;
+T stateT st; // exposition only
+ };
+
+
+ 27.4.5 Template class basic_ios [lib.ios]
+
+ template <class charT, class traits = char_traits<charT> >
+X class basic_ios : public ios_base {
+ public:
+
+ // Types:
+T typedef charT char_type;
+T typedef typename traits::int_type int_type;
+T typedef typename traits::pos_type pos_type;
+T typedef typename traits::off_type off_type;
+T typedef traits traits_type;
+T operator void*() const
+T bool operator!() const
+T iostate rdstate() const;
+T void clear(iostate state = goodbit);
+T void setstate(iostate state);
+T bool good() const;
+T bool eof() const;
+T bool fail() const;
+T bool bad() const;
+T iostate exceptions() const;
+T void exceptions(iostate except);
+ // _lib.basic.ios.cons_ Constructor/destructor:
+T explicit basic_ios(basic_streambuf<charT,traits>* sb);
+T virtual ~basic_ios();
+ // _lib.basic.ios.members_ Members:
+T basic_ostream<charT,traits>* tie() const;
+T basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* tiestr);
+T basic_streambuf<charT,traits>* rdbuf() const;
+T basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb);
+X basic_ios& copyfmt(const basic_ios& rhs);
+T char_type fill() const;
+T char_type fill(char_type ch);
+ // _lib.ios.base.locales_ locales:
+T locale imbue(const locale& loc);
+X char narrow(char_type c, char dfault) const;
+X char_type widen(char c) const;
+ protected:
+ basic_ios();
+T void init(basic_streambuf<charT,traits>* sb);
+ private:
+T basic_ios(const basic_ios& ); // not defined
+T basic_ios& operator=(const basic_ios&); // not defined
+ };
+
+
+ 27.5 Stream buffers [lib.stream.buffers]
+
+ Header <streambuf> synopsis
+
+X template <class charT, class traits = char_traits<charT> >
+ class basic_streambuf;
+T typedef basic_streambuf<char> streambuf;
+T typedef basic_streambuf<wchar_t> wstreambuf;
+
+ 27.5.2 Template class [lib.streambuf]
+ basic_streambuf<charT,traits>
+
+ template <class charT, class traits = char_traits<charT> >
+X class basic_streambuf {
+ public:
+
+ // Types:
+T typedef charT char_type;
+T typedef typename traits::int_type int_type;
+T typedef typename traits::pos_type pos_type;
+T typedef typename traits::off_type off_type;
+T typedef traits traits_type;
+T virtual ~basic_streambuf();
+ // _lib.streambuf.locales_ locales:
+T locale pubimbue(const locale &loc);
+T locale getloc() const;
+ // _lib.streambuf.buffer_ buffer and positioning:
+T basic_streambuf<char_type,traits>*
+ pubsetbuf(char_type* s, streamsize n);
+T pos_type pubseekoff(off_type off, ios_base::seekdir way,
+ ios_base::openmode which =
+ ios_base::in | ios_base::out);
+T pos_type pubseekpos(pos_type sp,
+ ios_base::openmode which =
+ ios_base::in | ios_base::out);
+T int pubsync();
+
+ // Get and put areas:
+ // _lib.streambuf.pub.get_ Get area:
+T streamsize in_avail();
+T int_type snextc();
+T int_type sbumpc();
+T int_type sgetc();
+T streamsize sgetn(char_type* s, streamsize n);
+ // _lib.streambuf.pub.pback_ Putback:
+X int_type sputbackc(char_type c);
+X int_type sungetc();
+ // _lib.streambuf.pub.put_ Put area:
+T int_type sputc(char_type c);
+X streamsize sputn(const char_type* s, streamsize n);
+ protected:
+T basic_streambuf();
+ // _lib.streambuf.get.area_ Get area:
+T char_type* eback() const;
+T char_type* gptr() const;
+T char_type* egptr() const;
+T void gbump(int n);
+T void setg(char_type* gbeg, char_type* gnext, char_type* gend);
+ // _lib.streambuf.put.area_ Put area:
+T char_type* pbase() const;
+T char_type* pptr() const;
+T char_type* epptr() const;
+T void pbump(int n);
+T void setp(char_type* pbeg, char_type* pend);
+ // _lib.streambuf.virtuals_ virtual functions:
+ // _lib.streambuf.virt.locales_ Locales:
+T virtual void imbue(const locale &loc);
+ // _lib.streambuf.virt.buffer_ Buffer management and positioning:
+T virtual basic_streambuf<char_type,traits>*
+ setbuf(char_type* s, streamsize n);
+T virtual pos_type seekoff(off_type off, ios_base::seekdir way,
+ ios_base::openmode which = ios_base::in | ios_base::out);
+T virtual pos_type seekpos(pos_type sp,
+ ios_base::openmode which = ios_base::in | ios_base::out);
+T virtual int sync();
+ // _lib.streambuf.virt.get_ Get area:
+T virtual int showmanyc();
+T virtual streamsize xsgetn(char_type* s, streamsize n);
+T virtual int_type underflow();
+T virtual int_type uflow();
+ // _lib.streambuf.virt.pback_ Putback:
+T virtual int_type pbackfail(int_type c = traits::eof());
+ // _lib.streambuf.virt.put_ Put area:
+X virtual streamsize xsputn(const char_type* s, streamsize n);
+T virtual int_type overflow (int_type c = traits::eof());
+ };
+
+ 27.6 Formatting and manipulators [lib.iostream.format]
+
+ Header <istream> synopsis
+
+T template <class charT, class traits = char_traits<charT> >
+ class basic_istream;
+T typedef basic_istream<char> istream;
+T typedef basic_istream<wchar_t> wistream;
+
+T template <class charT, class traits = char_traits<charT> >
+ class basic_iostream;
+T typedef basic_iostream<char> iostream;
+T typedef basic_iostream<wchar_t> wiostream;
+
+X template <class charT, class traits>
+ basic_istream<charT,traits>& ws(basic_istream<charT,traits>& is);
+
+ Header <ostream> synopsis
+
+X template <class charT, class traits = char_traits<charT> >
+ class basic_ostream;
+T typedef basic_ostream<char> ostream;
+T typedef basic_ostream<wchar_t> wostream;
+
+T template <class charT, class traits>
+ basic_ostream<charT,traits>& endl(basic_ostream<charT,traits>& os);
+T template <class charT, class traits>
+ basic_ostream<charT,traits>& ends(basic_ostream<charT,traits>& os);
+T template <class charT, class traits>
+ basic_ostream<charT,traits>& flush(basic_ostream<charT,traits>& os);
+
+ Header <iomanip> synopsis
+
+ // Types T1, T2, ... are unspecified implementation types
+T T1 resetiosflags(ios_base::fmtflags mask);
+T T2 setiosflags (ios_base::fmtflags mask);
+T T3 setbase(int base);
+T template<charT> T4 setfill(charT c);
+T T5 setprecision(int n);
+T T6 setw(int n);
+
+
+ 27.6.1.1 Template class basic_istream [lib.istream]
+
+ template <class charT, class traits = char_traits<charT> >
+T class basic_istream : virtual public basic_ios<charT,traits> {
+ public:
+ // Types (inherited from basic_ios (_lib.ios_)):
+T typedef charT char_type;
+T typedef typename traits::int_type int_type;
+T typedef typename traits::pos_type pos_type;
+T typedef typename traits::off_type off_type;
+T typedef traits traits_type;
+ // _lib.istream.cons_ Constructor/destructor:
+T explicit basic_istream(basic_streambuf<charT,traits>* sb);
+T virtual ~basic_istream();
+ // _lib.istream::sentry_ Prefix/suffix:
+T class sentry;
+
+ // _lib.istream.formatted_ Formatted input:
+T basic_istream<charT,traits>& operator>>
+ (basic_istream<charT,traits>& (*pf)(basic_istream<charT,traits>&))
+T basic_istream<charT,traits>& operator>>
+ (basic_ios<charT,traits>& (*pf)(basic_ios<charT,traits>&))
+T basic_istream<charT,traits>& operator>>
+ (ios_base& (*pf)(ios_base&))
+S basic_istream<charT,traits>& operator>>(bool& n);
+S basic_istream<charT,traits>& operator>>(short& n);
+S basic_istream<charT,traits>& operator>>(unsigned short& n);
+S basic_istream<charT,traits>& operator>>(int& n);
+S basic_istream<charT,traits>& operator>>(unsigned int& n);
+S basic_istream<charT,traits>& operator>>(long& n);
+S basic_istream<charT,traits>& operator>>(unsigned long& n);
+S basic_istream<charT,traits>& operator>>(float& f);
+S basic_istream<charT,traits>& operator>>(double& f);
+S basic_istream<charT,traits>& operator>>(long double& f);
+S basic_istream<charT,traits>& operator>>(void*& p);
+S basic_istream<charT,traits>& operator>>
+ (basic_streambuf<char_type,traits>* sb);
+ // _lib.istream.unformatted_ Unformatted input:
+T streamsize gcount() const;
+S int_type get();
+S basic_istream<charT,traits>& get(char_type& c);
+S basic_istream<charT,traits>& get(char_type* s, streamsize n);
+S basic_istream<charT,traits>& get(char_type* s, streamsize n,
+ char_type delim);
+S basic_istream<charT,traits>& get(basic_streambuf<char_type,traits>& sb);
+S basic_istream<charT,traits>& get(basic_streambuf<char_type,traits>& sb,
+ char_type delim);
+S basic_istream<charT,traits>& getline(char_type* s, streamsize n);
+S basic_istream<charT,traits>& getline(char_type* s, streamsize n,
+ char_type delim);
+S basic_istream<charT,traits>& ignore
+ (streamsize n = 1, int_type delim = traits::eof());
+S int_type peek();
+S basic_istream<charT,traits>& read (char_type* s, streamsize n);
+S streamsize readsome(char_type* s, streamsize n);
+S basic_istream<charT,traits>& putback(char_type c);
+S basic_istream<charT,traits>& unget();
+S int sync();
+
+S pos_type tellg();
+S basic_istream<charT,traits>& seekg(pos_type);
+S basic_istream<charT,traits>& seekg(off_type, ios_base::seekdir);
+ };
+
+ // _lib.istream::extractors_ character extraction templates:
+S template<class charT, class traits>
+ basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&,
+ charT&);
+S template<class traits>
+ basic_istream<char,traits>& operator>>(basic_istream<char,traits>&,
+ unsigned char&);
+S template<class traits>
+ basic_istream<char,traits>& operator>>(basic_istream<char,traits>&,
+ signed char&);
+
+S template<class charT, class traits>
+ basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&,
+ charT*);
+S template<class traits>
+ basic_istream<char,traits>& operator>>(basic_istream<char,traits>&,
+ unsigned char*);
+S template<class traits>
+ basic_istream<char,traits>& operator>>(basic_istream<char,traits>&,
+ signed char*);
+
+ 27.6.1.1.2 Class basic_istream::sentry [lib.istream::sentry]
+
+
+ template <class charT,class traits = char_traits<charT> >
+S class basic_istream<charT,traits>::sentry {
+ typedef traits traits_type;
+S bool ok_; // exposition only
+ public:
+S explicit sentry(basic_istream<charT,traits>& is, bool noskipws = false);
+S ~sentry();
+S operator bool() const { return ok_; }
+ private:
+T sentry(const sentry&); // not defined
+T sentry& operator=(const sentry&); // not defined
+ };
+
+
+ 27.6.1.5 Template class basic_iostream [lib.iostreamclass]
+
+ template <class charT, class traits = char_traits<charT> >
+T class basic_iostream :
+ public basic_istream<charT,traits>,
+ public basic_ostream<charT,traits> {
+ public:
+ // constructor/destructor
+T explicit basic_iostream(basic_streambuf<charT,traits>* sb);
+T virtual ~basic_iostream();
+ };
+
+
+ 27.6.2.1 Template class basic_ostream [lib.ostream]
+
+ template <class charT, class traits = char_traits<charT> >
+X class basic_ostream : virtual public basic_ios<charT,traits> {
+ public:
+ // Types (inherited from basic_ios (_lib.ios_)):
+T typedef charT char_type;
+T typedef typename traits::int_type int_type;
+T typedef typename traits::pos_type pos_type;
+T typedef typename traits::off_type off_type;
+T typedef traits traits_type;
+ // _lib.ostream.cons_ Constructor/destructor:
+T explicit basic_ostream(basic_streambuf<char_type,traits>* sb);
+T virtual ~basic_ostream();
+ // _lib.ostream::sentry_ Prefix/suffix:
+T class sentry;
+ // _lib.ostream.formatted_ Formatted output:
+T basic_ostream<charT,traits>& operator<<
+ (basic_ostream<charT,traits>& (*pf)(basic_ostream<charT,traits>&));
+T basic_ostream<charT,traits>& operator<<
+ (basic_ios<charT,traits>& (*pf)(basic_ios<charT,traits>&));
+T basic_ostream<charT,traits>& operator<<
+ (ios_base& (*pf)(ios_base&));
+T basic_ostream<charT,traits>& operator<<(bool n);
+T basic_ostream<charT,traits>& operator<<(short n);
+T basic_ostream<charT,traits>& operator<<(unsigned short n);
+T basic_ostream<charT,traits>& operator<<(int n);
+T basic_ostream<charT,traits>& operator<<(unsigned int n);
+T basic_ostream<charT,traits>& operator<<(long n);
+T basic_ostream<charT,traits>& operator<<(unsigned long n);
+S basic_ostream<charT,traits>& operator<<(float f);
+S basic_ostream<charT,traits>& operator<<(double f);
+S basic_ostream<charT,traits>& operator<<(long double f);
+T basic_ostream<charT,traits>& operator<<(const void* p);
+X basic_ostream<charT,traits>& operator<<
+ (basic_streambuf<char_type,traits>* sb);
+ // _lib.ostream.unformatted_ Unformatted output:
+T basic_ostream<charT,traits>& put(char_type c);
+T basic_ostream<charT,traits>& write(const char_type* s, streamsize n);
+X basic_ostream<charT,traits>& flush();
+
+ // _lib.ostream.seeks_ seeks:
+S pos_type tellp();
+S basic_ostream<charT,traits>& seekp(pos_type);
+S basic_ostream<charT,traits>& seekp(off_type, ios_base::seekdir);
+ };
+ // _lib.ostream.inserters.character_ character inserters
+X template<class charT, class traits>
+ basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&,
+ charT);
+X template<class charT, class traits>
+ basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&,
+ char);
+ // specialization
+X template<class traits>
+ basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&,
+ char);
+ // signed and unsigned
+X template<class traits>
+ basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&,
+ signed char);
+X template<class traits>
+ basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&,
+ unsigned char)
+X template<class charT, class traits>
+ basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&,
+ const charT*);
+X template<class charT, class traits>
+ basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&,
+ const char*);
+ // partial specializationss
+X template<class traits>
+ basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&,
+ const char*);
+ // signed and unsigned
+X template<class traits>
+ basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&,
+ const signed char*);
+X template<class traits>
+ basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&,
+ const unsigned char*);
+
+
+ 27.6.2.3 Class basic_ostream::sentry [lib.ostream::sentry]
+
+ template <class charT,class traits = char_traits<charT> >
+X class basic_ostream<charT,traits>::sentry {
+ bool ok_; // exposition only
+ public:
+X explicit sentry(basic_ostream<charT,traits>& os);
+X ~sentry();
+X operator bool() const { return ok_; }
+ private
+X sentry(const sentry&); // not defined
+X sentry& operator=(const sentry&); // not defined
+ };
+
+ 27.7 String-based streams [lib.string.streams]
+
+ Header <sstream> synopsis
+
+X template <class charT, class traits = char_traits<charT>,
+ class Allocator = allocator<charT> >
+ class basic_stringbuf;
+
+T typedef basic_stringbuf<char> stringbuf;
+T typedef basic_stringbuf<wchar_t> wstringbuf;
+
+ template <class charT, class traits = char_traits<charT>,
+ class Allocator = allocator<charT> >
+X class basic_istringstream;
+
+T typedef basic_istringstream<char> istringstream;
+T typedef basic_istringstream<wchar_t> wistringstream;
+
+ template <class charT, class traits = char_traits<charT>,
+ class Allocator = allocator<charT> >
+X class basic_ostringstream;
+T typedef basic_ostringstream<char> ostringstream;
+T typedef basic_ostringstream<wchar_t> wostringstream;
+
+ template <class charT, class traits = char_traits<charT>,
+ class Allocator = allocator<charT> >
+X class basic_stringstream;
+T typedef basic_stringstream<char> stringstream;
+T typedef basic_stringstream<wchar_t> wstringstream;
+
+ 27.7.1 Template class basic_stringbuf [lib.stringbuf]
+
+ template <class charT, class traits = char_traits<charT>,
+ class Allocator = allocator<charT> >
+X class basic_stringbuf : public basic_streambuf<charT,traits> {
+ public:
+T typedef charT char_type;
+T typedef typename traits::int_type int_type;
+T typedef typename traits::pos_type pos_type;
+T typedef typename traits::off_type off_type;
+T typedef traits traits_type;
+ // _lib.stringbuf.cons_ Constructors:
+S explicit basic_stringbuf(ios_base::openmode which
+ = ios_base::in | ios_base::out);
+S explicit basic_stringbuf
+ (const basic_string<charT,traits,Allocator>& str,
+ ios_base::openmode which = ios_base::in | ios_base::out);
+ // _lib.stringbuf.members_ Get and set:
+S basic_string<charT,traits,Allocator> str() const;
+S void str(const basic_string<charT,traits,Allocator>& s);
+
+ protected:
+ // _lib.stringbuf.virtuals_ Overridden virtual functions:
+S virtual int_type underflow();
+S virtual int_type pbackfail(int_type c = traits::eof());
+S virtual int_type overflow (int_type c = traits::eof());
+S virtual basic_streambuf<charT,traits>* setbuf(charT*, streamsize);
+
+S virtual pos_type seekoff(off_type off, ios_base::seekdir way,
+ ios_base::openmode which
+ = ios_base::in | ios_base::out);
+S virtual pos_type seekpos(pos_type sp,
+ ios_base::openmode which
+ = ios_base::in | ios_base::out);
+ };
+
+
+ 27.7.2 Template class basic_istringstream [lib.istringstream]
+
+ template <class charT, class traits = char_traits<charT>,
+ class Allocator = allocator<charT> >
+X class basic_istringstream : public basic_istream<charT,traits> {
+ public:
+T typedef charT char_type;
+T typedef typename traits::int_type int_type;
+T typedef typename traits::pos_type pos_type;
+T typedef typename traits::off_type off_type;
+T typedef traits traits_type;
+ // _lib.istringstream.cons_ Constructors:
+S explicit basic_istringstream(ios_base::openmode which = ios_base::in);
+S explicit basic_istringstream(
+ const basic_string<charT,traits,Allocator>& str,
+ ios_base::openmode which = ios_base::in);
+
+ // _lib.istringstream.members_ Members:
+S basic_stringbuf<charT,traits,Allocator>* rdbuf() const;
+S basic_string<charT,traits,Allocator> str() const;
+S void str(const basic_string<charT,traits,Allocator>& s);
+ private:
+ // basic_stringbuf<charT,traits,Allocator> sb; exposition only
+ };
+
+ 27.7.3 Class basic_ostringstream [lib.ostringstream]
+
+ template <class charT, class traits = char_traits<charT>,
+ class Allocator = allocator<charT> >
+X class basic_ostringstream : public basic_ostream<charT,traits> {
+ public:
+
+ // Types:
+T typedef charT char_type;
+T typedef typename traits::int_type int_type;
+T typedef typename traits::pos_type pos_type;
+T typedef typename traits::off_type off_type;
+ // _lib.ostringstream.cons_ Constructors/destructor:
+S explicit basic_ostringstream(ios_base::openmode which = ios_base::out);
+S explicit basic_ostringstream(
+ const basic_string<charT,traits,Allocator>& str,
+ ios_base::openmode which = ios_base::out);
+ // _lib.ostringstream.members_ Members:
+S basic_stringbuf<charT,traits,Allocator>* rdbuf() const;
+S basic_string<charT,traits,Allocator> str() const;
+S void str(const basic_string<charT,traits,Allocator>& s);
+ };
+
+
+ 27.7.4 Template class basic_stringstream [lib.stringstream]
+
+ template <class charT, class traits = char_traits<charT>,
+ class Allocator = allocator<charT> >
+X class basic_stringstream
+ : public basic_iostream<charT,traits> {
+ public:
+ // Types
+T typedef charT char_type;
+T typedef typename traits::int_type int_type;
+T typedef typename traits::pos_type pos_type;
+T typedef typename traits::off_type off_type;
+ // constructors/destructors
+S explicit basic_stringstream(
+ ios_base::openmode which = ios_base::out|ios_base::in);
+S explicit basic_stringstream(
+ const basic_string<charT,traits,Allocator>& str,
+ ios_base::openmode which = ios_base::out|ios_base::in);
+ // Members:
+S basic_stringbuf<charT,traits,Allocator>* rdbuf() const;
+S basic_string<charT,traits,Allocator> str() const;
+S void str(const basic_string<charT,traits,Allocator>& str);
+ };
+
+
+
+ 27.8.1 File streams [lib.fstreams]
+
+
+ Header <fstream> synopsis
+
+X template <class charT, class traits = char_traits<charT> >
+ class basic_filebuf;
+T typedef basic_filebuf<char> filebuf;
+T typedef basic_filebuf<wchar_t> wfilebuf;
+
+X template <class charT, class traits = char_traits<charT> >
+ class basic_ifstream;
+T typedef basic_ifstream<char> ifstream;
+T typedef basic_ifstream<wchar_t> wifstream;
+
+X template <class charT, class traits = char_traits<charT> >
+ class basic_ofstream;
+T typedef basic_ofstream<char> ofstream;
+T typedef basic_ofstream<wchar_t> wofstream;
+
+X template <class charT, class traits = char_traits<charT> >
+ class basic_fstream;
+T typedef basic_fstream<char> fstream;
+T typedef basic_fstream<wchar_t> wfstream;
+
+ 27.8.1.1 Template class basic_filebuf [lib.filebuf]
+
+ template <class charT, class traits = char_traits<charT> >
+X class basic_filebuf : public basic_streambuf<charT,traits> {
+ public:
+T typedef charT char_type;
+T typedef typename traits::int_type int_type;
+T typedef typename traits::pos_type pos_type;
+T typedef typename traits::off_type off_type;
+T typedef traits traits_type;
+ // _lib.filebuf.cons_ Constructors/destructor:
+X basic_filebuf();
+X virtual ~basic_filebuf();
+ // _lib.filebuf.members_ Members:
+T bool is_open() const;
+X basic_filebuf<charT,traits>* open
+ (const char* s, ios_base::openmode mode);
+X basic_filebuf<charT,traits>* close();
+ protected:
+ // _lib.filebuf.virtuals_ Overridden virtual functions:
+X virtual streamsize showmanyc();
+X virtual int_type underflow();
+X virtual int_type uflow();
+X virtual int_type pbackfail(int_type c = traits::eof());
+X virtual int_type overflow (int_type c = traits::eof());
+S virtual basic_streambuf<charT,traits>*
+ setbuf(char_type* s, streamsize n);
+S virtual pos_type seekoff(off_type off, ios_base::seekdir way,
+ ios_base::openmode which
+ = ios_base::in | ios_base::out);
+S virtual pos_type seekpos(pos_type sp, ios_base::openmode which
+ = ios_base::in | ios_base::out);
+S virtual int sync();
+S virtual void imbue(const locale& loc);
+ };
+
+
+
+ 27.8.1.5 Template class basic_ifstream [lib.ifstream]
+
+ template <class charT, class traits = char_traits<charT> >
+X class basic_ifstream : public basic_istream<charT,traits> {
+ public:
+T typedef charT char_type;
+T typedef typename traits::int_type int_type;
+T typedef typename traits::pos_type pos_type;
+T typedef typename traits::off_type off_type;
+T typedef traits traits_type;
+ // _lib.ifstream.cons_ Constructors:
+S basic_ifstream();
+S explicit basic_ifstream(const char* s,
+ ios_base::openmode mode = ios_base::in);
+ // _lib.ifstream.members_ Members:
+S basic_filebuf<charT,traits>* rdbuf() const;
+S bool is_open();
+S void open(const char* s, ios_base::openmode mode = ios_base::in);
+S void close();
+ };
+
+
+ 27.8.1.8 Template class basic_ofstream [lib.ofstream]
+
+ template <class charT, class traits = char_traits<charT> >
+X class basic_ofstream : public basic_ostream<charT,traits> {
+ public:
+T typedef charT char_type;
+T typedef typename traits::int_type int_type;
+T typedef typename traits::pos_type pos_type;
+T typedef typename traits::off_type off_type;
+T typedef traits traits_type;
+ // _lib.ofstream.cons_ Constructors:
+X basic_ofstream();
+X explicit basic_ofstream(const char* s,
+ ios_base::openmode mode
+ = ios_base::out);
+ // _lib.ofstream.members_ Members:
+X basic_filebuf<charT,traits>* rdbuf() const;
+T bool is_open();
+X void open(const char* s, ios_base::openmode mode = ios_base::out);
+X void close();
+ };
+
+
+ 27.8.1.11 Template class basic_fstream [lib.fstream]
+
+ template <class charT, class traits=char_traits<charT> >
+X class basic_fstream
+ : public basic_iostream<charT,traits> {
+ public:
+T typedef charT char_type;
+T typedef typename traits::int_type int_type;
+T typedef typename traits::pos_type pos_type;
+T typedef typename traits::off_type off_type;
+T typedef traits traits_type;
+ // constructors/destructor
+S basic_fstream();
+S explicit basic_fstream(
+ const char* s,
+ ios_base::openmode mode = ios_base::in|ios_base::out);
+
+ // Members:
+S basic_filebuf<charT,traits>* rdbuf() const;
+S bool is_open();
+S void open(
+ const char* s,
+ ios_base::openmode mode = ios_base::in|ios_base::out);
+S void close();
+ };
+
+
+
+ 27.8.2 C Library files [lib.c.files]
+
+
+ Table 13--Header <cstdio> synopsis
+ Macros:
+X BUFSIZ L_tmpnam SEEK_SET TMP_MAX
+X EOF NULL <cstdio> stderr _IOFBF
+X FILENAME_MAX SEEK_CUR stdin _IOLBF
+X FOPEN_MAX SEEK_END stdout _IONBF
+
+X Types: FILE fpos_t size_t <cstdio>
+ Functions:
+X clearerr fgets fscanf gets rewind
+X fclose fopen fseek perror scanf tmpnam
+X feof fprintf fsetpos printf setbuf ungetc
+X ferror fputc ftell putc setvbuf vprintf
+X fflush fputs fwrite puts sprintf vfprintf
+X fgetc fread getc remove sscanf vsprintf
+X fgetpos freopen getchar putchar rename tmpfile
+
+
+
+
+ 1.5 Standard C library headers [depr.c.headers]
+
+X <assert.h> <iso646.h> <setjmp.h> <stdio.h> <wchar.h>
+ <ctype.h> <limits.h> <signal.h> <stdlib.h> <wctype.h>
+ <errno.h> <locale.h> <stdarg.h> <string.h>
+ <float.h> <math.h> <stddef.h> <time.h>
+
+ 1.6 Old iostreams members [depr.ios.members]
+
+ [Note: these should be #ifdef'd to permit diagnostics if used.]
+ namespace std {
+ class ios_base {
+ public:
+T typedef T1 io_state;
+T typedef T2 open_mode;
+T typedef T3 seek_dir;
+T typedef OFF_T streamoff;
+T typedef OFF_T streampos;
+ // remainder unchanged
+ };
+ }
+
+ [Note: these should be #ifdef'd to permit diagnostics if used.]
+ namespace std {
+ template<class charT, class traits = char_traits<charT> >
+ class basic_streambuf {
+ public:
+T void stossc();
+ // remainder unchanged
+ };
+ }
+
+ 8 An implementation may provide the following member functions that
+ overload signatures specified in clause _lib.iostreams_:
+
+ [Note: the following overloads should be #ifdef'd to permit
+ diagnostics to be emitted, by default, if used.]
+
+ template<class charT, class Traits> class basic_ios {
+ public:
+M void clear(io_state state);
+M void setstate(io_state state);
+ // remainder unchanged
+ };
+ class ios_base {
+ public:
+M void exceptions(io_state);
+ // remainder unchanged
+ };
+ template<class charT, class traits = char_traits<charT> >
+ class basic_streambuf {
+ public:
+M pos_type pubseekoff(off_type off, ios_base::seek_dir way,
+ ios_base::open_mode which = ios_base::in | ios_base::out);
+M pos_type pubseekpos(pos_type sp,
+ ios_base::open_mode which = ios_base::in | ios_base::out);
+ // remainder unchanged
+ };
+ template <class charT, class traits = char_traits<charT> >
+ class basic_filebuf : public basic_streambuf<charT,traits> {
+ public:
+M basic_filebuf<charT,traits>* open
+ (const char* s, ios_base::open_mode mode);
+ // remainder unchanged
+ };
+ template <class charT, class traits = char_traits<charT> >
+ class basic_ifstream : public basic_istream<charT,traits> {
+ public:
+M void open(const char* s, ios_base::open_mode mode = in);
+ // remainder unchanged
+ };
+ template <class charT, class traits = char_traits<charT> >
+ class basic_ofstream : public basic_ostream<charT,traits> {
+ public:
+M void open(const char* s, ios_base::open_mode mode = out | trunc);
+ // remainder unchanged
+ };
+ }
+
+
+
+ 1.7.1 Class strstreambuf [depr.strstreambuf]
+
+ [Note: It should be possible to adopt these components with only
+ minor changes from the 2.8 version of the library.]
+
+M class strstreambuf : public basic_streambuf<char> {
+ public:
+M explicit strstreambuf(streamsize alsize_arg = 0);
+M strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
+M strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = 0);
+M strstreambuf(const char* gnext_arg, streamsize n);
+M strstreambuf(signed char* gnext_arg, streamsize n,
+ signed char* pbeg_arg = 0);
+M strstreambuf(const signed char* gnext_arg, streamsize n);
+M strstreambuf(unsigned char* gnext_arg, streamsize n,
+ unsigned char* pbeg_arg = 0);
+M strstreambuf(const unsigned char* gnext_arg, streamsize n);
+M virtual ~strstreambuf();
+M void freeze(bool freezefl = true);
+M char* str();
+M int pcount();
+ protected:
+M virtual int_type overflow (int_type c = EOF);
+M virtual int_type pbackfail(int_type c = EOF);
+M virtual int_type underflow();
+M virtual pos_type seekoff(off_type off, ios_base::seekdir way,
+ ios_base::openmode which
+ = ios_base::in | ios_base::out);
+M virtual pos_type seekpos(pos_type sp, ios_base::openmode which
+ = ios_base::in | ios_base::out);
+M virtual streambuf<char>* setbuf(char* s, streamsize n);
+ }
+
+ 1.7.4 Class strstream [depr.strstream]
+
+M class strstream
+ : public basic_iostream<char> {
+ public:
+ // Types
+M typedef char char_type;
+M typedef typename char_traits<char>::int_type int_type
+M typedef typename char_traits<char>::pos_type pos_type;
+M typedef typename char_traits<char>::off_type off_type;
+ // consturctors/destructor
+M strstream();
+M strstream(char* s, int n,
+ ios_base::openmode mode = ios_base::in|ios_base::out);
+M virtual ~strstream();
+ // Members:
+M strstreambuf* rdbuf() const;
+M void freeze(bool freezefl = true);
+M int pcount() const;
+M char* str();
+ };
+
diff --git a/libstdc++-v3/docs/17_intro/COPYING b/libstdc++-v3/docs/17_intro/COPYING
new file mode 100644
index 000000000000..60549be514af
--- /dev/null
+++ b/libstdc++-v3/docs/17_intro/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ 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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/libstdc++-v3/docs/17_intro/DESIGN b/libstdc++-v3/docs/17_intro/DESIGN
new file mode 100644
index 000000000000..6979bc40f80d
--- /dev/null
+++ b/libstdc++-v3/docs/17_intro/DESIGN
@@ -0,0 +1,859 @@
+
+Standard C++ Library Design Document
+------------------------------------
+
+This is an overview of libstdc++-v3, with particular attention
+to projects to be done and how they fit into the whole.
+
+The Library
+-----------
+
+This paper is covers two major areas:
+
+ - Features and policies not mentioned in the standard that
+ the quality of the library implementation depends on, including
+ extensions and "implementation-defined" features;
+
+ - Plans for required but unimplemented library features and
+ optimizations to them.
+
+Overhead
+--------
+
+The standard defines a large library, much larger than the standard
+C library. A naive implementation would suffer substantial overhead
+in compile time, executable size, and speed, rendering it unusable
+in many (particularly embedded) applications. The alternative demands
+care in construction, and some compiler support, but there is no
+need for library subsets.
+
+What are the sources of this overhead? There are four main causes:
+
+ - The library is specified almost entirely as templates, which
+ with current compilers must be included in-line, resulting in
+ very slow builds as tens or hundreds of thousands of lines
+ of function definitions are read for each user source file.
+ Indeed, the entire SGI STL, as well as the dos Reis valarray,
+ are provided purely as header files, largely for simplicity in
+ porting. Iostream/locale is (or will be) as large again.
+
+ - The library is very flexible, specifying a multitude of hooks
+ where users can insert their own code in place of defaults.
+ When these hooks are not used, any time and code expended to
+ support that flexibility is wasted.
+
+ - Templates are often described as causing to "code bloat". In
+ practice, this refers (when it refers to anything real) to several
+ independent processes. First, when a class template is manually
+ instantiated in its entirely, current compilers place the definitions
+ for all members in a single object file, so that a program linking
+ to one member gets definitions of all. Second, template functions
+ which do not actually depend on the template argument are, under
+ current compilers, generated anew for each instantiation, rather
+ than being shared with other instantiations. Third, some of the
+ flexibility mentioned above comes from virtual functions (both in
+ regular classes and template classes) which current linkers add
+ to the executable file even when they manifestly cannot be called.
+
+ - The library is specified to use a language feature, exceptions,
+ which in the current gcc compiler ABI imposes a run time and
+ code space cost to handle the possibility of exceptions even when
+ they are not used. Under the new ABI (accessed with -fnew-abi),
+ there is a space overhead and a small reduction in code efficiency
+ resulting from lost optimization opportunities associated with
+ non-local branches associated with exceptions.
+
+What can be done to eliminate this overhead? A variety of coding
+techniques, and compiler, linker and library improvements and
+extensions may be used, as covered below. Most are not difficult,
+and some are already implemented in varying degrees.
+
+Overhead: Compilation Time
+--------------------------
+
+Providing "ready-instantiated" template code in object code archives
+allows us to avoid generating and optimizing template instantiations
+in each compilation unit which uses them. However, the number of such
+instantiations that are useful to provide is limited, and anyway this
+is not enough, by itself, to minimize compilation time. In particular,
+it does not reduce time spent parsing conforming headers.
+
+Quicker header parsing will depend on library extensions and compiler
+improvements. One approach is some variation on the techniques
+previously marketed as "pre-compiled headers", now standardized as
+support for the "export" keyword. "Exported" template definitions
+can be placed (once) in a "repository" -- really just a library, but
+of template definitions rather than object code -- to be drawn upon
+at link time when an instantiation is needed, rather than placed in
+header files to be parsed along with every compilation unit.
+
+Until "export" is implemented we can put some of the lengthy template
+definitions in #if guards or alternative headers so that users can skip
+over the the full definitions when they need only the ready-instantiated
+specializations.
+
+To be precise, this means that certain headers which define
+templates which users normally use only for certain arguments
+can be instrumented to avoid exposing the template definitions
+to the compiler unless a macro is defined. For example, in
+<string>, we might have:
+
+ template <class _CharT, ... > class basic_string {
+ ... // member declarations
+ };
+ ... // operator declarations
+
+ #ifdef _STRICT_ISO_
+ # if _G_NO_TEMPLATE_EXPORT
+ # include <bits/std_locale.h> // headers needed by definitions
+ # ...
+ # include <bits/string.tcc> // member and global template definitions.
+ # endif
+ #endif
+
+Users who compile without specifying a strict-ISO-conforming flag
+would not see many of the template definitions they now see, and rely
+instead on ready-instantiated specializations in the library. This
+technique would be useful for the following substantial components:
+string, locale/iostreams, valarray. It would *not* be useful or
+usable with the following: containers, algorithms, iterators,
+allocator. Since these constitute a large (though decreasing)
+fraction of the library, the benefit the technique offers is
+limited.
+
+The language specifies the semantics of the "export" keyword, but
+the gcc compiler does not yet support it. When it does, problems
+with large template inclusions can largely disappear, given some
+minor library reorganization, along with the need for the apparatus
+described above.
+
+Overhead: Flexibility Cost
+--------------------------
+
+The library offers many places where users can specify operations
+to be performed by the library in place of defaults. Sometimes
+this seems to require that the library use a more-roundabout, and
+possibly slower, way to accomplish the default requirements than
+would be used otherwise.
+
+The primary protection against this overhead is thorough compiler
+optimization, to crush out layers of inline function interfaces.
+Kuck & Associates has demonstrated the practicality of this kind
+of optimization.
+
+The second line of defense against this overhead is explicit
+specialization. By defining helper function templates, and writing
+specialized code for the default case, overhead can be eliminated
+for that case without sacrificing flexibility. This takes full
+advantage of any ability of the optimizer to crush out degenerate
+code.
+
+The library specifies many virtual functions which current linkers
+load even when they cannot be called. Some minor improvements to the
+compiler and to ld would eliminate any such overhead by simply
+omitting virtual functions that the complete program does not call.
+A prototype of this work has already been done. For targets where
+GNU ld is not used, a "pre-linker" could do the same job.
+
+The main areas in the standard interface where user flexibility
+can result in overhead are:
+
+ - Allocators: Containers are specified to use user-definable
+ allocator types and objects, making tuning for the container
+ characteristics tricky.
+
+ - Locales: the standard specifies locale objects used to implement
+ iostream operations, involving many virtual functions which use
+ streambuf iterators.
+
+ - Algorithms and containers: these may be instantiated on any type,
+ frequently duplicating code for identical operations.
+
+ - Iostreams and strings: users are permitted to use these on their
+ own types, and specify the operations the stream must use on these
+ types.
+
+Note that these sources of overhead are _avoidable_. The techniques
+to avoid them are covered below.
+
+Code Bloat
+----------
+
+In the SGI STL, and in some other headers, many of the templates
+are defined "inline" -- either explicitly or by their placement
+in class definitions -- which should not be inline. This is a
+source of code bloat. Matt had remarked that he was relying on
+the compiler to recognize what was too big to benefit from inlining,
+and generate it out-of-line automatically. However, this also can
+result in code bloat except where the linker can eliminate the extra
+copies.
+
+Fixing these cases will require an audit of all inline functions
+defined in the library to determine which merit inlining, and moving
+the rest out of line. This is an issue mainly in chapters 23, 25, and
+27. Of course it can be done incrementally, and we should generally
+accept patches that move large functions out of line and into ".tcc"
+files, which can later be pulled into a repository. Compiler/linker
+improvements to recognize very large inline functions and move them
+out-of-line, but shared among compilation units, could make this
+work unnecessary.
+
+Pre-instantiating template specializations currently produces large
+amounts of dead code which bloats statically linked programs. The
+current state of the static library, libstdc++.a, is intolerable on
+this account, and will fuel further confused speculation about a need
+for a library "subset". A compiler improvement that treats each
+instantiated function as a separate object file, for linking purposes,
+would be one solution to this problem. An alternative would be to
+split up the manual instantiation files into dozens upon dozens of
+little files, each compiled separately, but an abortive attempt at
+this was done for <string> and, though it is far from complete, it
+is already a nuisance. A better interim solution (just until we have
+"export") is badly needed.
+
+When building a shared library, the current compiler/linker cannot
+automatically generate the instantiatiations needed. This creates a
+miserable situation; it means any time something is changed in the
+library, before a shared library can be built someone must manually
+copy the declarations of all templates that are needed by other parts
+of the library to an "instantiation" file, and add it to the build
+system to be compiled and linked to the library. This process is
+readily automated, and should be automated as soon as possible.
+Users building their own shared libraries experience identical
+frustrations.
+
+Sharing common aspects of template definitions among instantiations
+can radically reduce code bloat. The compiler could help a great
+deal here by recognizing when a function depends on nothing about
+a template parameter, or only on its size, and giving the resulting
+function a link-name "equate" that allows it to be shared with other
+instantiations. Implementation code could take advantage of the
+capability by factoring out code that does not depend on the template
+argument into separate functions to be merged by the compiler.
+
+Until such a compiler optimization is implemented, much can be done
+manually (if tediously) in this direction. One such optimization is
+to derive class templates from non-template classes, and move as much
+implementation as possible into the base class. Another is to partial-
+specialize certain common instantiations, such as vector<T*>, to share
+code for instantiations on all types T. While these techniques work,
+they are far from the complete solution that a compiler improvement
+would afford.
+
+Overhead: Expensive Language Features
+-------------------------------------
+
+The main "expensive" language feature used in the standard library
+is exception support, which requires compiling in cleanup code with
+static table data to locate it, and linking in library code to use
+the table. For small embedded programs the amount of such library
+code and table data is assumed by some to be excessive. Under the
+"new" ABI this perception is generally exaggerated, although in some
+cases it may actually be excessive.
+
+To implement a library which does not use exceptions directly is
+not difficult given minor compiler support (to "turn off" exceptions
+and ignore exception contructs), and results in no great library
+maintenance difficulties. To be precise, given "-fno-exceptions",
+the compiler should treat "try" blocks as ordinary blocks, and
+"catch" blocks as dead code to ignore or eliminate. Compiler
+support is not strictly necessary, except in the case of "function
+try blocks"; otherwise the following macros almost suffice:
+
+ #define throw(X)
+ #define try if (true)
+ #define catch(X) else if (false)
+
+However, there may be a need to use function try blocks in the
+library implementation, and use of macros in this way can make
+correct diagnostics impossible. Furthermore, use of this scheme
+would require the library to call a function to re-throw exceptions
+from a try block. Implementing the above semantics in the compiler
+is preferable.
+
+Given the support above (however implemented) it only remains to
+replace code that "throws" with a call to a well-documented "handler"
+function in a separate compilation unit which may be replaced by
+the user. The main source of exceptions that would be difficult
+for users to avoid is memory allocation failures, but users can
+define their own memory allocation primitives that never throw.
+Otherwise, the complete list of such handlers, and which library
+functions may call them, would be needed for users to be able to
+implement the necessary substitutes. (Fortunately, they have the
+source code.)
+
+Opportunities
+-------------
+
+The template capabilities of C++ offer enormous opportunities for
+optimizing common library operations, well beyond what would be
+considered "eliminating overhead". In particular, many operations
+done in Glibc with macros that depend on proprietary language
+extensions can be implemented in pristine Standard C++. For example,
+the chapter 25 algorithms, and even C library functions such as strchr,
+can be specialized for the case of static arrays of known (small) size.
+
+Detailed optimization opportunities are identified below where
+the component where they would appear is discussed. Of course new
+opportunities will be identified during implementation.
+
+Unimplemented Required Library Features
+---------------------------------------
+
+The standard specifies hundreds of components, grouped broadly by
+chapter. These are listed in excruciating detail in the CHECKLIST
+file.
+
+ 17 general
+ 18 support
+ 19 diagnostics
+ 20 utilities
+ 21 string
+ 22 locale
+ 23 containers
+ 24 iterators
+ 25 algorithms
+ 26 numerics
+ 27 iostreams
+ Annex D backward compatibility
+
+Anyone participating in implementation of the library should obtain
+a copy of the standard, ISO 14882. People in the U.S. can obtain an
+electronic copy for US$18 from ANSI's web site. Those from other
+countries should visit http://www.iso.ch/ to find out the location
+of their country's representation in ISO, in order to know who can
+sell them a copy.
+
+The emphasis in the following sections is on unimplemented features
+and optimization opportunities.
+
+Chapter 17 General
+-------------------
+
+Chapter 17 concerns overall library requirements.
+
+The standard doesn't mention threads. A multi-thread (MT) extension
+primarily affects operators new and delete (18), allocator (20),
+string (21), locale (22), and iostreams (27). The common underlying
+support needed for this is discussed under chapter 20.
+
+The standard requirements on names from the C headers create a
+lot of work, mostly done. Names in the C headers must be visible
+in the std:: and sometimes the global namespace; the names in the
+two scopes must refer to the same object. More stringent is that
+Koenig lookup implies that any types specified as defined in std::
+really are defined in std::. Names optionally implemented as
+macros in C cannot be macros in C++. (An overview may be read at
+<http://www.cantrip.org/cheaders.html>). The scripts "inclosure"
+and "mkcshadow", and the directories shadow/ and cshadow/, are the
+beginning of an effort to conform in this area.
+
+A correct conforming definition of C header names based on underlying
+C library headers, and practical linking of conforming namespaced
+customer code with third-party C libraries depends ultimately on
+an ABI change, allowing namespaced C type names to be mangled into
+type names as if they were global, somewhat as C function names in a
+namespace, or C++ global variable names, are left unmangled. Perhaps
+another "extern" mode, such as 'extern "C-global"' would be an
+appropriate place for such type definitions. Such a type would
+affect mangling as follows:
+
+ namespace A {
+ struct X {};
+ extern "C-global" { // or maybe just 'extern "C"'
+ struct Y {};
+ };
+ }
+ void f(A::X*); // mangles to f__FPQ21A1X
+ void f(A::Y*); // mangles to f__FP1Y
+
+(It may be that this is really the appropriate semantics for regular
+'extern "C"', and 'extern "C-global"', as an extension, would not be
+necessary.) This would allow functions declared in non-standard C headers
+(and thus fixable by neither us nor users) to link properly with functions
+declared using C types defined in properly-namespaced headers. The
+problem this solves is that C headers (which C++ programmers do persist
+in using) frequently forward-declare C struct tags without including
+the header where the type is defined, as in
+
+ struct tm;
+ void munge(tm*);
+
+Without some compiler accommodation, munge cannot be called by correct
+C++ code using a pointer to a correctly-scoped tm* value.
+
+The current C headers use the preprocessor extension "#include_next",
+which the compiler complains about when run "-pedantic".
+(Incidentally, it appears that "-fpedantic" is currently ignored,
+probably a bug.) The solution in the C compiler is to use
+"-isystem" rather than "-I", but unfortunately in g++ this seems
+also to wrap the whole header in an 'extern "C"' block, so it's
+unusable for C++ headers. The correct solution appears to be to
+allow the various special include-directory options, if not given
+an argument, to affect subsequent include-directory options additively,
+so that if one said
+
+ -pedantic -iprefix $(prefix) \
+ -idirafter -ino-pedantic -ino-extern-c -iwithprefix -I g++-v3 \
+ -iwithprefix -I g++-v3/ext
+
+the compiler would search $(prefix)/g++-v3 and not report
+pedantic warnings for files found there, but treat files in
+$(prefix)/g++-v3/ext pedantically. (The undocumented semantics
+of "-isystem" in g++ stink. Can they be rescinded? If not it
+must be replaced with something more rationally behaved.)
+
+All the C headers need the treatment above; in the standard these
+headers are mentioned in various chapters. Below, I have only
+mentioned those that present interesting implementation issues.
+
+The components identified as "mostly complete", below, have not been
+audited for conformance. In many cases where the library passes
+conformance tests we have non-conforming extensions that must be
+wrapped in #if guards for "pedantic" use, and in some cases renamed
+in a conforming way for continued use in the implementation regardless
+of conformance flags.
+
+The STL portion of the library still depends on a header
+stl/bits/stl_config.h full of #ifdef clauses. This apparatus
+should be replaced with autoconf/automake machinery.
+
+The SGI STL defines a type_traits<> template, specialized for
+many types in their code including the built-in numeric and
+pointer types and some library types, to direct optimizations of
+standard functions. The SGI compiler has been extended to generate
+specializations of this template automatically for user types,
+so that use of STL templates on user types can take advantage of
+these optimizations. Specializations for other, non-STL, types
+would make more optimizations possible, but extending the gcc
+compiler in the same way would be much better. Probably the next
+round of standardization will ratify this, but probably with
+changes, so it probably should be renamed to place it in the
+implementation namespace.
+
+The SGI STL also defines a large number of extensions visible in
+standard headers. (Other extensions that appear in separate headers
+have been sequestered in subdirectories ext/ and backward/.) All
+these extensions should be moved to other headers where possible,
+and in any case wrapped in a namespace (not std!), and (where kept
+in a standard header) girded about with macro guards. Some cannot be
+moved out of standard headers because they are used to implement
+standard features. The canonical method for accommodating these
+is to use a protected name, aliased in macro guards to a user-space
+name. Unfortunately C++ offers no satisfactory template typedef
+mechanism, so very ad-hoc and unsatisfactory aliasing must be used
+instead.
+
+Implementation of a template typedef mechanism should have the highest
+priority among possible extensions, on the same level as implementation
+of the template "export" feature.
+
+Chapter 18 Language support
+----------------------------
+
+Headers: <limits> <new> <typeinfo> <exception>
+C headers: <cstddef> <climits> <cfloat> <cstdarg> <csetjmp>
+ <ctime> <csignal> <cstdlib> (also 21, 25, 26)
+
+This defines the built-in exceptions, rtti, numeric_limits<>,
+operator new and delete. Much of this is provided by the
+compiler in its static runtime library.
+
+Work to do includes defining numeric_limits<> specializations in
+separate files for all target architectures. Values for integer types
+except for bool and wchar_t are readily obtained from the C header
+<limits.h>, but values for the remaining numeric types (bool, wchar_t,
+float, double, long double) must be entered manually. This is
+largely dog work except for those members whose values are not
+easily deduced from available documentation. Also, this involves
+some work in target configuration to identify the correct choice of
+file to build against and to install.
+
+The definitions of the various operators new and delete must be
+made thread-safe, which depends on a portable exclusion mechanism,
+discussed under chapter 20. Of course there is always plenty of
+room for improvements to the speed of operators new and delete.
+
+<cstdarg>, in Glibc, defines some macros that gcc does not allow to
+be wrapped into an inline function. Probably this header will demand
+attention whenever a new target is chosen. The functions atexit(),
+exit(), and abort() in cstdlib have different semantics in C++, so
+must be re-implemented for C++.
+
+Chapter 19 Diagnostics
+-----------------------
+
+Headers: <stdexcept>
+C headers: <cassert> <cerrno>
+
+This defines the standard exception objects, which are "mostly complete".
+Cygnus has a version, and now SGI provides a slightly different one.
+It makes little difference which we use.
+
+The C global name "errno", which C allows to be a variable or a macro,
+is required in C++ to be a macro. For MT it must typically result in
+a function call.
+
+Chapter 20 Utilities
+---------------------
+Headers: <utility> <functional> <memory>
+C header: <ctime> (also in 18)
+
+SGI STL provides "mostly complete" versions of all the components
+defined in this chapter. However, the auto_ptr<> implementation
+is known to be wrong. Furthermore, the standard definition of it
+is known to be unimplementable as written. A minor change to the
+standard would fix it, and auto_ptr<> should be adjusted to match.
+
+Multi-threading affects the allocator implementation, and there must
+be configuration/installation choices for different users' MT
+requirements. Anyway, users will want to tune allocator options
+to support different target conditions, MT or no.
+
+The primitives used for MT implementation should be exposed, as an
+extension, for users' own work. We need cross-CPU "mutex" support,
+multi-processor shared-memory atomic integer operations, and single-
+processor uninterruptible integer operations, and all three configurable
+to be stubbed out for non-MT use, or to use an appropriately-loaded
+dynamic library for the actual runtime environment, or statically
+compiled in for cases where the target architecture is known.
+
+Chapter 21 String
+------------------
+Headers: <string>
+C headers: <cctype> <cwctype> <cstring> <cwchar> (also in 27)
+ <cstdlib> (also in 18, 25, 26)
+
+We have "mostly-complete" char_traits<> implementations. Many of the
+char_traits<char> operations might be optimized further using existing
+proprietary language extensions.
+
+We have a "mostly-complete" basic_string<> implementation. The work
+to manually instantiate char and wchar_t specializations in object
+files to improve link-time behavior is extremely unsatisfactory,
+literally tripling library-build time with no commensurate improvement
+in static program link sizes. It must be redone. (Similar work is
+needed for some components in chapters 22 and 27.)
+
+Other work needed for strings is MT-safety, as discussed under the
+chapter 20 heading.
+
+The standard C type mbstate_t from <cwchar> and used in char_traits<>
+must be different in C++ than in C, because in C++ the default constructor
+value mbstate_t() must be the "base" or "ground" sequence state.
+(According to the likely resolution of a recently raised Core issue,
+this may become unnecessary. However, there are other reasons to
+use a state type not as limited as whatever the C library provides.)
+If we might want to provide conversions from (e.g.) internally-
+represented EUC-wide to externally-represented Unicode, or vice-
+versa, the mbstate_t we choose will need to be more accommodating
+than what might be provided by an underlying C library.
+
+There remain some basic_string template-member functions which do
+not overload properly with their non-template brethren. The infamous
+hack akin to what was done in vector<> is needed, to conform to
+23.1.1 para 10. The CHECKLIST items for basic_string marked 'X',
+or incomplete, are so marked for this reason.
+
+Replacing the string iterators, which currently are simple character
+pointers, with class objects would greatly increase the safety of the
+client interface, and also permit a "debug" mode in which range,
+ownership, and validity are rigorously checked. The current use of
+raw pointers as string iterators is evil. vector<> iterators need the
+same treatment. Note that the current implementation freely mixes
+pointers and iterators, and that must be fixed before safer iterators
+can be introduced.
+
+Some of the functions in <cstring> are different from the C version.
+generally overloaded on const and non-const argument pointers. For
+example, in <cstring> strchr is overloaded. The functions isupper
+etc. in <cctype> typically implemented as macros in C are functions
+in C++, because they are overloaded with others of the same name
+defined in <locale>.
+
+Many of the functions required in <cwctype> and <cwchar> cannot be
+implemented using underlying C facilities on intended targets because
+such facilities only partly exist.
+
+Chapter 22 Locale
+------------------
+Headers: <locale>
+C headers: <clocale>
+
+We have a "mostly complete" class locale, with the exception of
+code for constructing, and handling the names of, named locales.
+The ways that locales are named (particularly when categories
+(e.g. LC_TIME, LC_COLLATE) are different) varies among all target
+environments. This code must be written in various versions and
+chosen by configuration parameters.
+
+Members of many of the facets defined in <locale> are stubs. Generally,
+there are two sets of facets: the base class facets (which are supposed
+to implement the "C" locale) and the "byname" facets, which are supposed
+to read files to determine their behavior. The base ctype<>, collate<>,
+and numpunct<> facets are "mostly complete", except that the table of
+bitmask values used for "is" operations, and corresponding mask values,
+are still defined in libio and just included/linked. (We will need to
+implement these tables independently, soon, but should take advantage
+of libio where possible.) The num_put<>::put members for integer types
+are "mostly complete".
+
+A complete list of what has and has not been implemented may be
+found in CHECKLIST. However, note that the current definition of
+codecvt<wchar_t,char,mbstate_t> is wrong. It should simply write
+out the raw bytes representing the wide characters, rather than
+trying to convert each to a corresponding single "char" value.
+
+Some of the facets are more important than others. Specifically,
+the members of ctype<>, numpunct<>, num_put<>, and num_get<> facets
+are used by other library facilities defined in <string>, <istream>,
+and <ostream>, and the codecvt<> facet is used by basic_filebuf<>
+in <fstream>, so a conforming iostream implementation depends on
+these.
+
+The "long long" type eventually must be supported, but code mentioning
+it should be wrapped in #if guards to allow pedantic-mode compiling.
+
+Performance of num_put<> and num_get<> depend critically on
+caching computed values in ios_base objects, and on extensions
+to the interface with streambufs.
+
+Specifically: retrieving a copy of the locale object, extracting
+the needed facets, and gathering data from them, for each call to
+(e.g.) operator<< would be prohibitively slow. To cache format
+data for use by num_put<> and num_get<> we have a _Format_cache<>
+object stored in the ios_base::pword() array. This is constructed
+and initialized lazily, and is organized purely for utility. It
+is discarded when a new locale with different facets is imbued.
+
+Using only the public interfaces of the iterator arguments to the
+facet functions would limit performance by forbidding "vector-style"
+character operations. The streambuf iterator optimizations are
+described under chapter 24, but facets can also bypass the streambuf
+iterators via explicit specializations and operate directly on the
+streambufs, and use extended interfaces to get direct access to the
+streambuf internal buffer arrays. These extensions are mentioned
+under chapter 27. These optimizations are particularly important
+for input parsing.
+
+Unused virtual members of locale facets can be omitted, as mentioned
+above, by a smart linker.
+
+Chapter 23 Containers
+----------------------
+Headers: <deque> <list> <queue> <stack> <vector> <map> <set> <bitset>
+
+All the components in chapter 23 are implemented in the SGI STL.
+They are "mostly complete"; they include a large number of
+nonconforming extensions which must be wrapped. Some of these
+are used internally and must be renamed or duplicated.
+
+The SGI components are optimized for large-memory environments. For
+embedded targets, different criteria might be more appropriate. Users
+will want to be able to tune this behavior. We should provide
+ways for users to compile the library with different memory usage
+characteristics.
+
+A lot more work is needed on factoring out common code from different
+specializations to reduce code size here and in chapter 25. The
+easiest fix for this would be a compiler/ABI improvement that allows
+the compiler to recognize when a specialization depends only on the
+size (or other gross quality) of a template argument, and allow the
+linker to share the code with similar specializations. In its
+absence, many of the algorithms and containers can be partial-
+specialized, at least for the case of pointers, but this only solves
+a small part of the problem. Use of a type_traits-style template
+allows a few more optimization opportunities, more if the compiler
+can generate the specializations automatically.
+
+As an optimization, containers can specialize on the default allocator
+and bypass it, or take advantage of details of its implementation
+after it has been improved upon.
+
+Replacing the vector iterators, which currently are simple element
+pointers, with class objects would greatly increase the safety of the
+client interface, and also permit a "debug" mode in which range,
+ownership, and validity are rigorously checked. The current use of
+pointers for iterators is evil.
+
+As mentioned for chapter 24, the deque iterator is a good example of
+an opportunity to implement a "staged" iterator that would benefit
+from specializations of some algorithms.
+
+Chapter 24 Iterators
+---------------------
+Headers: <iterator>
+
+Standard iterators are "mostly complete", with the exception of
+the stream iterators, which are not yet templatized on the
+stream type. Also, the base class template iterator<> appears
+to be wrong, so everything derived from it must also be wrong,
+currently.
+
+The streambuf iterators (currently located in stl/bits/std_iterator.h,
+but should be under bits/) can be rewritten to take advantage of
+friendship with the streambuf implementation.
+
+Matt Austern has identified opportunities where certain iterator
+types, particularly including streambuf iterators and deque
+iterators, have a "two-stage" quality, such that an intermediate
+limit can be checked much more quickly than the true limit on
+range operations. If identified with a member of iterator_traits,
+algorithms may be specialized for this case. Of course the
+iterators that have this quality can be identified by specializing
+a traits class.
+
+Many of the algorithms must be specialized for the streambuf
+iterators, to take advantage of block-mode operations, in order
+to allow iostream/locale operations' performance not to suffer.
+It may be that they could be treated as staged iterators and
+take advantage of those optimizations.
+
+Chapter 25 Algorithms
+----------------------
+Headers: <algorithm>
+C headers: <cstdlib> (also in 18, 21, 26))
+
+The algorithms are "mostly complete". As mentioned above, they
+are optimized for speed at the expense of code and data size.
+
+Specializations of many of the algorithms for non-STL types would
+give performance improvements, but we must use great care not to
+interfere with fragile template overloading semantics for the
+standard interfaces. Conventionally the standard function template
+interface is an inline which delegates to a non-standard function
+which is then overloaded (this is already done in many places in
+the library). Particularly appealing opportunities for the sake of
+iostream performance are for copy and find applied to streambuf
+iterators or (as noted elsewhere) for staged iterators, of which
+the streambuf iterators are a good example.
+
+The bsearch and qsort functions cannot be overloaded properly as
+required by the standard because gcc does not yet allow overloading
+on the extern-"C"-ness of a function pointer.
+
+Chapter 26 Numerics
+--------------------
+Headers: <complex> <valarray> <numeric>
+C headers: <cmath>, <cstdlib> (also 18, 21, 25)
+
+Numeric components: Gabriel dos Reis's valarray, Drepper's complex,
+and the few algorithms from the STL are "mostly done". Of course
+optimization opportunities abound for the numerically literate. It
+is not clear whether the valarray implementation really conforms
+fully, in the assumptions it makes about aliasing (and lack thereof)
+in its arguments.
+
+The C div() and ldiv() functions are interesting, because they are the
+only case where a C library function returns a class object by value.
+Since the C++ type div_t must be different from the underlying C type
+(which is in the wrong namespace) the underlying functions div() and
+ldiv() cannot be re-used efficiently. Fortunately they are trivial to
+re-implement.
+
+Chapter 27 Iostreams
+---------------------
+Headers: <iosfwd> <streambuf> <ios> <ostream> <istream> <iostream>
+ <iomanip> <sstream> <fstream>
+C headers: <cstdio> <cwchar> (also in 21)
+
+Iostream is currently in a very incomplete state. <iosfwd>, <iomanip>,
+ios_base, and basic_ios<> are "mostly complete". basic_streambuf<> and
+basic_ostream<> are well along, but basic_istream<> has had little work
+done. The standard stream objects, <sstream> and <fstream> have been
+started; basic_filebuf<> "write" functions have been implemented just
+enough to do "hello, world".
+
+Most of the istream and ostream operators << and >> (with the exception
+of the op<<(integer) ones) have not been changed to use locale primitives,
+sentry objects, or char_traits members.
+
+All these templates should be manually instantiated for char and
+wchar_t in a way that links only used members into user programs.
+
+Streambuf is fertile ground for optimization extensions. An extended
+interface giving iterator access to its internal buffer would be very
+useful for other library components.
+
+Iostream operations (primarily operators << and >>) can take advantage
+of the case where user code has not specified a locale, and bypass locale
+operations entirely. The current implementation of op<</num_put<>::put,
+for the integer types, demonstrates how they can cache encoding details
+from the locale on each operation. There is lots more room for
+optimization in this area.
+
+The definition of the relationship between the standard streams
+cout et al. and stdout et al. requires something like a "stdiobuf".
+The SGI solution of using double-indirection to actually use a
+stdio FILE object for buffering is unsatisfactory, because it
+interferes with peephole loop optimizations.
+
+The <sstream> header work has begun. stringbuf can benefit from
+friendship with basic_string<> and basic_string<>::_Rep to use
+those objects directly as buffers, and avoid allocating and making
+copies.
+
+The basic_filebuf<> template is a complex beast. It is specified to
+use the locale facet codecvt<> to translate characters between native
+files and the locale character encoding. In general this involves
+two buffers, one of "char" representing the file and another of
+"char_type", for the stream, with codecvt<> translating. The process
+is complicated by the variable-length nature of the translation, and
+the need to seek to corresponding places in the two representations.
+For the case of basic_filebuf<char>, when no translation is needed,
+a single buffer suffices. A specialized filebuf can be used to reduce
+code space overhead when no locale has been imbued. Matt Austern's
+work at SGI will be useful, perhaps directly as a source of code, or
+at least as an example to draw on.
+
+Filebuf, almost uniquely (cf. operator new), depends heavily on
+underlying environmental facilities. In current releases iostream
+depends fairly heavily on libio constant definitions, but it should
+be made independent. It also depends on operating system primitives
+for file operations. There is immense room for optimizations using
+(e.g.) mmap for reading. The shadow/ directory wraps, besides the
+standard C headers, the libio.h and unistd.h headers, for use mainly
+by filebuf. These wrappings have not been completed, though there
+is scaffolding in place.
+
+The encapulation of certain C header <cstdio> names presents an
+interesting problem. It is possible to define an inline std::fprintf()
+implemented in terms of the 'extern "C"' vfprintf(), but there is no
+standard vfscanf() to use to implement std::fscanf(). It appears that
+vfscanf but be re-implemented in C++ for targets where no vfscanf
+extension has been defined. This is interesting in that it seems
+to be the only significant case in the C library where this kind of
+rewriting is necessary. (Of course Glibc provides the vfscanf()
+extension.) (The functions related to exit() must be rewritten
+for other reasons.)
+
+
+Annex D
+-------
+Headers: <strstream>
+
+Annex D defines many non-library features, and many minor
+modifications to various headers, and a complete header.
+It is "mostly done", except that the libstdc++-2 <strstream>
+header has not been adopted into the library, or checked to
+verify that it matches the draft in those details that were
+clarified by the committee. Certainly it must at least be
+moved into the std namespace.
+
+We still need to wrap all the deprecated features in #if guards
+so that pedantic compile modes can detect their use.
+
+Nonstandard Extensions
+----------------------
+Headers: <iostream.h> <strstream.h> <hash> <rbtree>
+ <pthread_alloc> <stdiobuf> (etc.)
+
+User code has come to depend on a variety of nonstandard components
+that we must not omit. Much of this code can be adopted from
+libstdc++-v2 or from the SGI STL. This particularly includes
+<iostream.h>, <strstream.h>, and various SGI extensions such
+as <hash_map.h>. Many of these are already placed in the
+subdirectories ext/ and backward/. (Note that it is better to
+include them via "<backward/hash_map.h>" or "<ext/hash_map>" than
+to search the subdirectory itself via a "-I" directive.
+
diff --git a/libstdc++-v3/docs/17_intro/HEADER_POLICY b/libstdc++-v3/docs/17_intro/HEADER_POLICY
new file mode 100644
index 000000000000..c6fa6d38b54f
--- /dev/null
+++ b/libstdc++-v3/docs/17_intro/HEADER_POLICY
@@ -0,0 +1,164 @@
+
+Header Policy
+-------------
+
+The C++ Standard specifies many mutual dependencies among the
+headers it defines. It offers no advice on how to arrange headers
+to avoid problems. The worst such problem is circular references.
+Most simply this is "A includes B, B includes A":
+
+ // file <A> // file <B>
+ #ifndef A #ifndef B
+ #define A 1 #define B 1
+ #include <B> #include <A>
+ typedef int A_type; typedef int B_type;
+ extern B_type g(A_type); extern A_type f(B_type);
+ #endif /* A */ #endif /* B */
+
+ // file C.cc
+ #include <A>
+
+The typical effect of such an "include loop" may be seen by tracing
+the preprocessor activity:
+
+ C // file C.cc
+ C #include <A>
+ A // file <A>
+ A #ifndef A
+ A #define A 1
+ A #include <B>
+ B // file <B>
+ B #ifndef B
+ B #define B 1
+ B #include <A>
+ A // file <A>
+ A #ifndef A <-- oops, cpp symbol A defined already
+ A ... <-- skip <A> contents
+ A #endif
+ B typedef int B_type;
+ B extern A_type f(B_type); <-- error, A_type not defined yet.
+ B #endif /* B */
+ A typedef int A_type;
+ A extern B_type g(A_type);
+ A #endif /* A */
+
+The main symptom of #include loops is that definitions from file <A>
+are not available after the #include <A> for certain include orders.
+The number of standard headers makes testing all permutations of
+include order impractical, so a policy is needed to prevent chaos.
+In any case, for some standard headers (as for the above) no ordering
+can eliminate the loop.
+
+Other factors influence the policy. Typical implementations of
+Make (unfortunately including GNU make) have bugs relating to file
+names with no suffix, that lead to such problems as failure to track
+dependencies on such files and an inclination to _delete_ them.
+Therefore, headers used in building the library are always of the
+form <bits/yyy.h> generally, or specifically <bits/std_xxx.h> for
+an equivalent to the standard header <xxx>.
+
+Standard headers <xxx> are all placed under directory std/, and
+are ignored except during installation. These headers simply
+#include the corresponding header <bits/std_xxx.h>.
+
+Standard substitute headers <bits/std_xxx.h> that have any complexity
+may sub-include other headers. When they sub-include non-standard
+headers, they first include all the headers required for that
+non-standard header.
+
+Mutual dependencies are handled by splitting up the declarations
+intended for standard headers among two or more files, and then
+interleaving them as needed. For example, we replace <A> and <B>
+above, as follows:
+
+ // file <bits/std_A.h>
+ #ifndef _CPP_A
+ #define _CPP_A
+ # include <bits/A_types.h>
+ # include <bits/B_types.h>
+ # include <bits/A_funs.h>
+ #endif
+
+ // file <bits/std_B.h>
+ #ifndef _CPP_B
+ #define _CPP_B
+ # include <bits/A_types.h>
+ # include <bits/B_types.h>
+ # include <bits/B_funs.h>
+ #endif
+
+ // file <bits/A_types.h>
+ #ifndef _CPP_BITS_A_TYPES_H
+ #define _CPP_BITS_A_TYPES_H
+ typedef int A_type;
+ #endif
+
+ // file <bits/B_types.h>
+ #ifndef _CPP_BITS_B_TYPES_H
+ #define _CPP_BITS_B_TYPES_H
+ typedef int B_type;
+ #endif
+
+ // file <bits/A_funs.h>
+ #ifndef _CPP_BITS_A_FUNS_H
+ #define _CPP_BITS_A_FUNS_H
+ extern B_type g(A_type);
+ #endif
+
+ // file <bits/B_funs.h>
+ #ifndef _CPP_BITS_B_FUNS_H
+ #define _CPP_BITS_B_FUNS_H
+ extern A_type f(B_type);
+ #endif
+
+Of course we have the standard headers under their mandated names:
+
+ // file <std/A>
+ #ifndef _CPP_A
+ #define _CPP_A
+ # include <bits/std_A.h>
+ #endif
+
+ // file <std/B>
+ #ifndef _CPP_B
+ #define _CPP_B
+ # include <bits/std_B.h>
+ #endif
+
+Notice that the include guards are named uniformly except that
+the guard for standard header <bits/std_A.h> is just _CPP_A,
+identically as the header <A> in std/.
+
+At installation the files std/* can be replaced by symbolic links,
+or simply copied into place as is. The result is:
+
+ include/
+ include/A -> bits/std_A.h
+ include/B -> bits/std_A.h
+ include/bits/
+ include/bits/std_A.h
+ include/bits/std_B.h
+ include/bits/A_types.h
+ include/bits/B_types.h
+ include/bits/A_funs.h
+ include/bits/B_funs.h
+
+
+Of course splitting up standard headers this way creates
+complexity, so it is not done routinely, but only in response
+to discovered needs.
+
+Another reason to split up headers is for support of separate
+compilation of templates. This interacts with the foregoing
+because template definitions typically have many more dependencies
+on other headers than do pure declarations. Non-inline template
+definitions are placed in a separate ".tcc" file that is included
+by the standard header, and any other standard header that
+requires definitions from it for its implementation.
+
+The key to preventing chaos, given the above structure, is:
+
+ Only standard headers <bits/std_xxxx.h> should sub-include
+ other headers.
+
+
diff --git a/libstdc++-v3/docs/17_intro/PROBLEMS b/libstdc++-v3/docs/17_intro/PROBLEMS
new file mode 100644
index 000000000000..52223911295e
--- /dev/null
+++ b/libstdc++-v3/docs/17_intro/PROBLEMS
@@ -0,0 +1,8 @@
+Irix 6.2:
+- math.h: defines extern long double hypotl( long double ); i.e., only
+ one argument. They've fixed this in 6.3.
+
+DES OSF 3.2 & 4.0:
+- libm define sincos, sincosf, and sincosl but there are no prototypes and
+ especially the return type is nowhere defined. The functions are
+ documented in the man pages, though.
diff --git a/libstdc++-v3/docs/17_intro/RELEASE-NOTES b/libstdc++-v3/docs/17_intro/RELEASE-NOTES
new file mode 100644
index 000000000000..37040f72a344
--- /dev/null
+++ b/libstdc++-v3/docs/17_intro/RELEASE-NOTES
@@ -0,0 +1,99 @@
+2000-03-24
+
+Release Notes
+-------------
+The Standard C++ Library v3, or libstdc++-2.90.x, is an ongoing
+project to implement the ISO 14882 Standard C++ library as described
+in chapters 17 through 27 and annex D, as a drop-in replacement
+for the current (ARM-conformant) library.
+
+This is the ninth snapshot of the libstdc++ rewrite. It is still
+incomplet and incorrekt. It's a lot less incomplete and incorrect than
+some of the earlier snapshots though, and quite usable.
+
+The Standard C++ Library v3, or libstdc++-2.90.x, follows an open
+development model, attempting to be fully buzzword, bazaar, and GNU
+compliant. Full details on participating, including contributor
+guidelines, mailing list subscription, mailing list archives,
+up-to-date documentation, and various and sundry other details can be
+found at the following URL:
+
+ http://sourceware.cygnus.com/libstdc++/
+
+
+New:
+---
+
+- MT safe string. Supported CPUs are alpha, powerpc, x86, sparc32 and sparc64.
+- Configure support for --enable-threads=posix, as well as initial IO
+ locking implementation.
+- Support for native building on Solaris 2.5.1, Solaris 2.6, Solaris
+ 2.7, cygwin, [alpha, powerpc, x86]-linux, and preliminary support for
+ Irix and Aix4.2, Aix 4.3 hosts.
+- --enable-namespaces is on by default.
+- Configure and Makefile support for "drop-in" replacement to
+ libstdc++-v2 completed. It is now possible to bootstrap g++, and
+ have g++ find libstdc++-v3 headers and libraries by default.
+- Synched with CVS egcs libio.
+- Cygwin native compiling supported.
+- Cross compiling and embedded targets (newlib) with multilibs support added.
+- SGI's strstream implementation has been added.
+- Copyright on all sources assigned to the FSF.
+- Configure, build and install documentation has been added.
+- Support to enable long long has been added.
+- More valarray improvements.
+- Extractors and inserters for std::complex have been added.
+- Extractors and inserters for void* have been fixed.
+- autoconf macros are now in _GLIBCPP_ namespace.
+- group checking for num_get implemented.
+- Many, many bug fixes.
+
+
+What doesn't:
+-------------
+- see BUGS.
+
+
+Build and Install
+-----------------
+Up to date build and install directions can be found at:
+http://sourceware.cygnus.com/libstdc++/install.html
+
+
+Contact:
+--------
+Places have changed from previous snapshots. The web page, which has
+information about joining the mailing list and searching its archives,
+CVS access, and contribution information is now at:
+
+ http://sourceware.cygnus.com/libstdc++/
+
+Please note that the mailing list has recently moved, and is now
+hosted on sourceware.cygnus.com. (The web site above has the most
+up-to-date info.)
+
+Obtain the library snapshot via ftp (including these release notes) from
+
+ ftp://sourceware.cygnus.com/pub/libstdc++/
+
+The library is maintained by Benjamin Kosnik, Nathan Myers, Gabriel
+Dos Reis, and Ulrich Drepper.
+
+
+Development tools:
+------------------
+You will need a recent version of gcc to compile the snapshot of
+libstdc++. The recently released gcc-2.95.2 works well. In addition,
+you may need up-to-date tools for modifying Makefiles and regenerating
+configure scripts: automake (version 1.4 from Cygnus, not the one on
+the net) and autoconf (version 2.13 and higher). Please see the
+website for more info on where to obtain these additional tools.
+
+If you compile programs -fnew-abi -fno-honor-std, uses of RTTI and
+certain other language features will link only if you build your
+compiler's libgcc using the same flags. (The defaults use the old
+abi.) Using -fnew-abi offers real benefits, but note that it is not
+stable: later snapshots will *not* be binary-compatible with code
+compiled with older snapshots. See the configuration options page in
+the Documentation section.
+
diff --git a/libstdc++-v3/docs/17_intro/TODO b/libstdc++-v3/docs/17_intro/TODO
new file mode 100644
index 000000000000..4da846277d6b
--- /dev/null
+++ b/libstdc++-v3/docs/17_intro/TODO
@@ -0,0 +1,177 @@
+- exception specifications need to be reviewed for all parts of the
+library support and utility areas, particularly <new>.
+
+- exception/stdexcept headers will do, but are not cleanly
+implemented. Also, some kind of consensus needs to be established on
+if the presence of stdexcept should be assumed in iostreams
+headers. V3 currently takes the position that references to stdexcept
+classes necessitates the inclusion of stdexcept, other library vendors
+seem less inclined.
+
+- scoping/linking issues WRT to C structs need to be worked out. See
+Nathan's commentary on cantrip, http://www.cantrip.org/cheaders.html
+
+- triglyphs/ciso646: and, and_eq, bitand, bitor, compl, not, not_eq,
+or, or_eq, xor, xor_eq, true && 45, true and false, true or 45, etc.
+(bool and int), etc.
+
+- operator!= and utility/rel_ops operators need to be made safe with
+string and vector iterator classes. basic_string::reverse_iterator may
+be implemented incorrectly, or need things like
+operator==(__normal_iterator, const char*&), and swap(vector)
+
+- SGI iterator/allocator classes are not strictly conforming. In
+particular, raw_storage_iterator, mem_fun1_ref_t are all problem
+areas.
+
+- auto_ptr: seems to be some disagreement on what is
+standards-conformant behavior, specially on conversion operators.
+
+- vswprintf, vwprintf, wprintf, wscanf, wcsftime, swscanf, fgetws,
+fputwc, fputws, fwide, fwprintf, fwscanf, getwc, getwchar, putwc, etc:
+C library wchar_t functionality.
+
+- facets heirarchies seem on occasion give odd errors to conformace
+tests. Need to test that they are constructed in a strictly-conforming
+manner.
+
+- stuff like `LC_CTYPE' is not found. Locale oddness?
+
+- header optimizations to keep compile times reasonable are most
+certainly detracting from full conformance, as many templatized
+definitions are squired away and pre-instantiated, so that the
+compiler doesn't have to parse them. Areas effected: valarray, string,
+all of iostreams and locales.
+
+- basic_string<wchar_T> not implemented
+
+- ostreambuf_iterator has not been made standards-conformant (both
+char and wchar_t) In particular, look at
+time_put::put(OutIt, ios_base&, char, const tm*, const char*, const
+char*) const
+
+- C-related issues WRT to libio and filepos, mbstate_t. Need to
+straighten this stuff out with the glibc-2.2 libio. Also may need to
+define operators for mbstate_t so that 'mbstate_t& == mbstate_t' is
+something that can be done.
+
+- codecvt<wchar_t> has not been adequently handled in terms of the
+locale bits. (The io bits are done, with the exception of one
+ostream<wchar_t> inserter for char.
+
+- bool locale::operator() looks to be non-conformant
+
+- num_get<char>::do_get<user_defined_type>
+ num_put<char>::do_put<user_defined_type>
+num_put<char, char *>::do_put(char *, ios_base &, char, long double) const
+num_put<char, char *>::do_put(char *, ios_base &, char, double) const
+num_put<char, char *>::do_put(char *, ios_base &, char, void const *) const
+etc.
+appear to be broken, or headers mashed, or undefined.
+
+- locale and std::combine not working correctly
+ template <class _Facet> class locale locale::combine(const locale &)
+
+- ctype_byname<char>: check to make sure derivation standards-conformant.
+
+- codecvt::unshift not working for char, wchar_t
+
+- no match for money_base::pattern &[int]
+
+- money_get::do_get weirded out for wchar_t
+
+- looks like deque::get_allocator not standards conformant or deque
+allocator non-standard.
+
+- list::assignment operator needs const_cast
+
+- a cleaner division between pointers-to-value_type and true iterators
+needs to be drawn throughout the entire STL implementation.
+
+- priority_queue conversions may be non-conformant
+
+- istream_iterator uses 2 arguments, should it be 4?
+
+- 'do the right thing' ctor fixing needs to be done for string. This
+is still subject to some debate on the library issues list, so I
+suggest punting till the dust clears.
+
+- the ctype and "tolower" "isspace" stuff really needs to be sorted
+out. A portable, cross platform interface needs to be defined. A
+"fixincludes"-like solution needs to be put into place to prune
+headers. The "C" functions need to be able to work in std:: and "C"
+namespaces.
+
+- complex<float> seems to be the single largest source of internal
+compiler errors when compiling the c++ library across non-x86
+platforms. Somebody needs to make sure the complex support builtin to
+gcc is actually working. Just as a "for-instance" these things give ICEs:
+class complex<float>& complex<float>::operator-=<float>(const complex<float> &)
+class complex<float>& complex<float>::operator/=<float>(const complex<float> &)
+class complex<float>& complex<float>::operator+=<float>(const complex<float> &)
+class complex<float>& complex<float>::operator-=<float>(const complex<float> &)
+class complex<float>& complex<float>::operator*=<float>(const complex<float> &)
+
+- appears as if the following extraction operators are undefined:
+operator>>(istream, complex<float>&)
+operator>>(istream, complex<double>&)
+operator>>(istream, complex<long double>&)
+operator>>(istream, complex<user_defined_type>&)
+sqrt (const complex<T>& x)
+
+- Protect valarray::result_type (not Standard) and make it work with
+ the various helper classes.
+
+- Make sure `valarray<bool> & == _Expr<_BinClos<logical_or,_ValArray,_ValArray,double,double>,bool>'
+ is defined
+
+- long double std_cmath stuff looks weak
+
+- fwide not declared. C++ wchar_t issues completely unaddressed.
+
+- known issues WRT to io and corner cases with the buffers. This is
+still subject to interpretation, and I think the current
+implementation is credible.
+
+- All of the Library working group closed issues need to be
+addressed. Some of them proposed resolutions are already in the v-3
+sources, with macro-guards.
+
+- add deprecated features from Annex D
+ - add #ifdef wrappers for all of them, including in each
+ C <xxx.h> header
+ - replace typedef'd non-deprecated types with more type-safe equivalents.
+
+- add optimization hooks (esp. whitespace eating) to streambuf
+ - add _M_begin() and _M_end() to streambuf
+ - add algorithm specializations for [io]streambuf_iterator (copy find etc.)
+
+- fix template members of basic_string<> to overload iterators and
+ non-iterators properly. (This is the infamous hack as in vector<> etc
+ 23.1.1 para 10.)
+
+- write filebuf for wide characters
+
+- replace stl/bits/stl_config
+
+- add feature-test macros for non-standard extensions
+
+- move major extensions into separate namespace (e.g. stl::)
+
+- create MT abstraction layer
+
+- add MT support for locale, string, istream, ostream
+
+- specialize functions that use_facet<> calls on failure for the required
+ facets, and construct them lazily so unused facets need not be constructed
+ when the locale is.
+
+- get mknumeric_limits coope with 'exotic' OSes.
+
+- <cmath>: provide missing names.
+
+- provide testsuites for numerics.
+
+- add FAQ entries -- improve the install instructions
+
+- add HOWTO entries
diff --git a/libstdc++-v3/docs/17_intro/contribute.html b/libstdc++-v3/docs/17_intro/contribute.html
new file mode 100644
index 000000000000..916bb0562b84
--- /dev/null
+++ b/libstdc++-v3/docs/17_intro/contribute.html
@@ -0,0 +1,76 @@
+<!--990301 slightly modified version of the GCC contribute.html file-->
+<html>
+<head>
+<title>How to contribute</title>
+</head>
+<!--#include virtual="/include/header-subpages.html"-->
+<h2>How to contribute</h2>
+<p>
+The Standard C++ Library v3, or libstc++-2.90.x, follows an open development model. Active contributors are assigned maintainer-ship responsibility, and given write access to the CVS repository. First time submitors and all other potential contributors should follow this procedure:
+
+<p>
+<hr>
+<h4>ONE : read the documentation</h4>
+<p>
+
+<p>
+<ul>
+ <li> Get and read the relevant sections of the C++ language
+specification. Copies of the full ISO 14882 standard are available on
+line via the ISO mirror site for committee members. Non-members, or
+those who have not paid for the privilege of sitting on the committee
+and sustained their two meeting commitment for voting rights, may get
+a copy of the standard from their respective national standards
+organization. In the USA, this national standards organization is ANSI
+and their web-site is right
+
+ <a href="http://www.ansi.org">here.</a>
+(And if you've already registered with them, clicking this link will take you to directly to the place where you can
+<a href="http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+14882%2D1998">buy the standard on-line.)</a>
+
+ <li> Peruse the <a href="http://www.gnu.ai.mit.edu/prep/standards_toc.html">GNU Coding Standards</a>, and chuckle when you hit the part about "Using Languages Other Than C."
+
+ <li> Be familiar with the extensions that preceded these general GNU rules. These style issues for libstdc++ can be found in the file C++STYLE, located in the root level of the distribution, or <a href="C++STYLE"> here. </a>
+
+ <li> And last but certainly not least, read the library-specific information found <a href="../documentation.html"> here.</a>
+
+</ul>
+
+
+
+<p>
+<hr>
+<h4>TWO : copyright assignment</h4>
+<p>
+Small changes can be accepted without a copyright assignment form on
+file. New code and additions to the library need completed copyright
+assignment form on file at Cygnus. Note: your employer may be required
+to fill out appropriate disclaimer forms as well. Here is the <a href="libstdc++-assign.txt"> form. </a>
+
+Please contact <a href="mailto:benjamin@cygnus.com">Benjamin
+Kosnik</a> if you are confused about the assignment or have general
+licensing questions.
+
+
+<p>
+<hr>
+<h4>THREE : submitting patches</h4>
+<p>
+
+Every patch must have several pieces of information before it can be
+properly evaluated. Ideally (and to ensure the fastest possible
+response from the maintainers) it would have all of these pieces:
+<p>
+<ul>
+ <li> A description of the bug and how your patch fixes this bug. For new features a description of the feature and your implementation.
+ <li> A ChangeLog entry as plaintext; see the various ChangeLog files for format and content. If using you are using emacs as your editor, simply position the insertion point at the beginning of your change and hit CX-4a to bring up the appropriate ChangeLog entry. See--magic! Similar functionality also exists for vi.
+ <li> A testsuite submission or sample program that will easily and simply show the existing error or test new functionality.
+ <li> The patch itself. If you are accessing the CVS repository at Cygnus, use "cvs update; cvs diff -c3p NEW"; else, use
+ "diff -c3p OLD NEW" or "diff -up OLD NEW". If your version of diff does not support these options, then get the latest version of GNU diff.
+ <li> When you have all these pieces, bundle them up in a mail message
+and send it to libstdc++@sourceware.cygnus.com. All patches and related
+discussion should be sent to the libstdc++ mailinglist.
+
+</ul>
+
+
diff --git a/libstdc++-v3/docs/17_intro/howto.html b/libstdc++-v3/docs/17_intro/howto.html
new file mode 100644
index 000000000000..d55c2868347b
--- /dev/null
+++ b/libstdc++-v3/docs/17_intro/howto.html
@@ -0,0 +1,156 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, gcc, g++, libg++, STL">
+ <META NAME="DESCRIPTION" CONTENT="HOWTO for libstdc++ chapter 17.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>libstdc++-v3 HOWTO: Chapter 17</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/docs/18_support/">
+<LINK REL=StyleSheet HREF="../lib3styles.css">
+<!-- $Id: howto.html,v 1.10 2000/04/18 22:05:49 pme Exp $ -->
+</HEAD>
+<BODY>
+
+<H1 CLASS="centered"><A NAME="top">Chapter 17: Library Introduction</A></H1>
+
+<P>Chapter 17 is actually a list of definitions and descriptions used
+ in the following chapters of the Standard when describing the actual
+ library. Here, we use &quot;Introduction&quot; as an introduction
+ to the <EM>GNU implementation of</EM> the ISO Standard C++ Library.
+</P>
+
+
+<!-- ####################################################### -->
+<HR>
+<H1>Contents</H1>
+<UL>
+ <LI><A HREF="#2">The Standard C++ header files</A>
+ <LI><A HREF="#3">Thread-safety</A>
+ <LI><A HREF="#4"><TT>&lt;foo&gt;</TT> vs <TT>&lt;foo.h&gt;</TT></A>
+</UL>
+
+<HR>
+
+<!-- ####################################################### -->
+
+<H2><A NAME="2">The Standard C++ header files</A></H2>
+ <P>The Standard C++ Library specifies 50 header files that must be
+ available to all hosted implementations. Actually, the word
+ &quot;files&quot; is a misnomer, since the contents of the headers
+ don't necessarily have to be in any kind of external file. The
+ only rule is that when you <TT>#include</TT> a certain header, the
+ contents of that header, as defined by the Standard, become
+ available to you, no matter how.
+ </P>
+ <P>The names of the headers can be easily seen in
+ <A HREF="../testsuite/17_intro/headers.cc">this source code</A>,
+ which is a small testbed we use to make certain that the headers
+ all compile and run.
+ </P>
+
+<HR>
+<H2><A NAME="3">Thread-safety</A></H2>
+ <P>This is a thorny issue that gets brought up on the libstdc++-v3
+ and gcc mailing lists on a regular basis (probably by a cron job).
+ This entry will mention a very little bit about the general MT
+ issues with libstdc++. The latest status and quick notes will be
+ in FAQ 5.6. Some discussion about threadsafe containers will be
+ in section 6.8 (the HOWTOs on containers).
+ </P>
+ <P>The libstdc++ code (all of it, not just the containers) has been
+ designed so that thread-safety will be easily possible. The first
+ (!) problem is finding a <EM>fast</EM> method of implementation
+ portable to all platforms. A minor problem that pops up every so
+ often is different interpretations of what &quot;thread-safe&quot;
+ means for a library (not a general program). We currently use the
+ <A HREF="http://www.sgi.com/Technology/STL/thread_safety.html">same
+ definition that SGI</A> uses for their STL subset.
+ </P>
+ <P>A recent journal article has described &quot;atomic integer
+ operations,&quot; which would allow us to, well, perform updates
+ on integers atomically, and without requiring an explicit mutex
+ lock. This appears promising, but the major difficulty is that
+ these operations &quot;may not be available on all systems, and
+ if they are, may have different interfaces.&quot; [quoting from
+ mailing list messages]
+ </P>
+ <P>Here is a small link farm to threads (no pun) in the mail archives
+ that discuss the threading problem. Each link is to the first
+ relevent message in the thread; from there you can use
+ &quot;Thread Next&quot; to move down the thread. This farm is in
+ latest-to-oldest order.
+ <UL>
+ <LI>
+ </UL>
+ <BR>
+ Here are discussions that took place before the current snapshot;
+ they are still relevant and instructive.
+ <BR>
+ <UL>
+ <LI>One way of preventing memory leaks by the old default memory
+ allocator in multithreaded code is
+ <A HREF="/ml/gcc/1999-11/msg00431.html">discussed here</A>.
+ <LI><A HREF="/ml/libstdc++/1999-q3/msg00167.html">This thread
+ concerns strings</A>.
+ <LI><A HREF="/ml/libstdc++/1999-q2/msg00339.html">So does this
+ one</A>. This initial message also refers to another
+ thread in the GCC mailing list...
+ <LI><A HREF="/ml/egcs/1999-06/msg00680.html">which is here</A>,
+ and goes on for some time. Ironically, the initial message
+ in this thread also mentions another threading thread...
+ <LI><A HREF="/ml/egcs/1999-06/msg00771.html">beginning here</A>,
+ and talking about pthreads. (Note that a much more recent
+ message from the first thread in this list notes that
+ <A HREF="/ml/libstdc++/1999-q3/msg00176.html">pthreads
+ should not be used as a starting point</A> for making
+ libstdc++ threadsafe.)
+ <LI><A HREF="/ml/libstdc++/1999-q2/msg00168.html">This
+ message</A>,
+ <A HREF="/ml/libstdc++/1999-q2/msg00159.html">this one</A>,
+ and <A HREF="/ml/libstdc++/1999-q2/msg00156.html">this one</A>
+ are the tops of related threads (all within the same time
+ period) discussing threading and the IO library. Much of it
+ is dealing with the C library, but C++ is included as well.
+ </UL>
+ </P>
+ <P>This section will be updated as new and interesting issues come
+ to light.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="4"><TT>&lt;foo&gt;</TT> vs <TT>&lt;foo.h&gt;</TT></A></H2>
+ <P>The new-style headers are fully supported in libstdc++-v3. The compiler
+ itself fully supports namespaces. However, at the moment, the compiler
+ treats std:: as the global namespace by default.
+ </P>
+ <P>For those of you new to ISO C++98, no, that isn't a typo, the headers
+ really have new names. Marshall Cline's C++ FAQ Lite has a good
+ explanation in
+<A HREF="http://www.cerfnet.com/~mpcline/On-Line-C++-FAQ/coding-standards.html#[25.4]">item [25.4]</A>.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+
+
+<!-- ####################################################### -->
+
+<HR>
+<P CLASS="fineprint"><EM>
+Comments and suggestions are welcome, and may be sent to
+<A HREF="mailto:pme@sourceware.cygnus.com">Phil Edwards</A> or
+<A HREF="mailto:gdr@egcs.cygnus.com">Gabriel Dos Reis</A>.
+<BR> $Id: howto.html,v 1.10 2000/04/18 22:05:49 pme Exp $
+</EM></P>
+
+
+</BODY>
+</HTML>
+
+
diff --git a/libstdc++-v3/docs/17_intro/libstdc++-assign.txt b/libstdc++-v3/docs/17_intro/libstdc++-assign.txt
new file mode 100644
index 000000000000..025b86e1d739
--- /dev/null
+++ b/libstdc++-v3/docs/17_intro/libstdc++-assign.txt
@@ -0,0 +1,122 @@
+The way to assign copyright to Cygnus Solutions is to sign an assignment
+contract. This is what legally makes Cygnus Solutions the copyright
+holder so that we can register the copyright on the new version.
+I'm assuming that you wrote these changes yourself;
+if other people wrote parts, we may need papers from them.
+
+If you are employed to do programming (even at a university), or have
+made an agreement with your employer or school saying it owns programs
+you write, then you and we need a signed piece of paper from your
+employer disclaiming rights to the program.
+
+The disclaimer should be signed by a vice president or general manager
+of the company. If you can't get at them, anyone else authorized to
+license software produced there will do. Here is a sample wording:
+
+ Digital Stimulation Corporation hereby disclaims all copyright interest
+ in the changes and enhancements made by Hugh Heffner to the program
+ "libstdc++", also including any future revisions of these changes and
+ enhancements.
+
+ Digital Stimulation Corporation affirms that it has no other
+ intellectual property interest that would undermine this release, or
+ the use of the Program, and will do nothing to undermine it in the
+ future.
+
+ <signature of Ty Coon>, 1 April 1987
+ Ty Coon, President of Vice, Digital Stimulation Corp.
+
+(If your employer says they do have an intellectual property claim
+that could conflict with the use of the program, then please put me in
+touch with a suitable representative of the company, so that we can
+negotiate what to do about it.)
+
+IMPORTANT: When you talk to your employer, *no matter what
+instructions they have given you*, don't fail to show them the sample
+disclaimer above, or a disclaimer with the details filled in for your
+specific case. Companies are usually willing to sign a disclaimer
+without any fuss. If you make your request less specific, you may
+open Pandora's box and cause a long and unnecessary delay.
+
+Below is the assignment contract that we usually use. You need
+to print it out, sign it, and snail it to:
+
+Benjamin Kosnik
+Cygnus Solutions
+1325 Chesapeake Terrace
+Sunnyvale, CA 94089 USA
+
+Please try to print the whole first page below on a single piece of
+paper. If it doesn't fit on one printed page, put it on two sides of
+a single piece of paper.
+
+Don't forget to put down the date when you sign! Spell out the month
+name--don't use a number for the month. Dates using a number for the
+month are ambiguous; 2/8/95 means one thing in the US and another in
+Europe.
+
+Snail a copy of the employer's disclaimer as well.
+
+Please send me email about what you decide to do. If you have any
+questions, or would like something to be changed, ask bkoz@cygnus.com via
+email.
+ ASSIGNMENT
+
+ For good and valuable consideration, receipt of which I acknowledge, I,
+[your name here], hereby transfer to Cygnus Solutions, Inc. ("Cygnus")
+my entire right, title, and interest (including all rights under copyright)
+in my changes and enhancements to the libstdc++ library, subject to the
+conditions below. These changes and enhancements are herein called the
+"Work". The work hereby assigned shall also include any future revisions
+of these changes and enhancements hereafter made by me.
+
+ Upon thirty days' prior written notice, Cygnus agrees to
+grant me non-exclusive rights to use the Work (i.e. my changes and
+enhancements, not the program which I enhanced) as I see fit; (and
+Cygnus's rights shall otherwise continue unchanged).
+
+ I hereby agree that if I have or acquire hereafter any patent or
+interface copyright or other intellectual property interest dominating the
+program enhanced by the Work (or use of that program), such dominating
+interest will not be used to undermine the effect of this assignment, i.e.
+Cygnus and the general public will be licensed to use, in that program and
+its derivative works, without royalty or limitation, the subject matter of
+the dominating interest. This license provision will be binding on my
+heirs, assignees, or other successors to the dominating interest, as well
+as on me.
+
+ I hereby represent and warrant that I am the sole copyright holder for the
+Work and that I have the right and power to enter into this contract. I
+hereby indemnify and hold harmless Cygnus, its officers, employees,
+and agents against any and all claims, actions or damages (including
+attorney's reasonable fees) asserted by or paid to any party on account of a
+breach or alleged breach of the foregoing warranty. I make no other express
+or implied warranty (including without limitation, in this disclaimer of
+warranty, any warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE).
+
+Agreed: [signature] Date [Write the month with LETTERS]:
+
+
+For Cygnus,
+Alex Daly, CEO
+
+Please do not delete the control-l character before this line.
+Please print this as a separate page.
+
+[For the copyright registration, what country are you a citizen of?
+What year were you born?]
+
+
+[Please write your email address here.]
+
+
+[Please write your snail address here, so we can snail a copy back to you.]
+
+
+
+[Which files have you changed so far, and which new files have you written
+so far?]
+
+
+[Which Belgian comic book character is better, Tintin or Asterix, and why?]
+
diff --git a/libstdc++-v3/docs/17_intro/organization b/libstdc++-v3/docs/17_intro/organization
new file mode 100644
index 000000000000..828a81128341
--- /dev/null
+++ b/libstdc++-v3/docs/17_intro/organization
@@ -0,0 +1,84 @@
+20 [lib.utilities]
+ <utility>
+ namespace rel_ops { operators !=, >, <=, >= }
+ struct pair;
+ pair binary operators { operators ==, <, !=, >, >=, <= }
+ <functional>
+ // function objects, or objects with operator() defined
+ <memory>
+ template<T> class allocator;
+ template<> class allocator<void>;
+ template<OutI, T> class raw_storage_iterator;
+ temporary buffers
+ specialized algorithms for uninitialized_{copy, fill, fill_n}
+ template<T> class auto_ptr;
+ <ctime>
+ <cstdlib>
+ <cstring>
+
+21 [lib.strings]
+ <string>
+ template<T> struct char_traits
+ template<> struct char_traits<char>
+ template<> struct char_traits<wchar_t>
+ template<C, T=c_t<T>, A=a<T> > class basic_string;
+
+ typedef basic_string<char> string;
+ typedef basic_string<wchar_t> wstring;
+
+ template<C, T, A> void swap(string&, string&)
+ template<C, T, A> istream& operator>>(istream&, string&);
+ template<C, T, A> istream& getline(istream&, string&, C);
+ template<C, T, A> istream& getline(istream&, string&);
+ template<C, T, A> ostream& operator<<(ostream&, string&);
+ <cctype>
+ <cwctype>
+ <cstring>
+ <cwchar>
+ <cstdlib>
+
+23 [lib.containers]
+ <deque>
+ <list>
+ <queue>
+ <stack>
+ <vector>
+ <map>
+ <set>
+ <bitset>
+
+24 [lib.iterators]
+ <iterator>
+
+25 [lib.algorithms]
+ <algorithm>
+ non-modifying sequence operations
+ for_each, find, find_if, find_end, find_first_of,
+ adjacent_find, count, count_if, mismatch, equal,
+ search, search_n
+ modifying sequence operations
+ copy, copy_backward, swap, swap_ranges, iter_swap,
+ transform, replace, replace_if, replace_copy,
+ replace_copy_if, fill, fill_n, generate, generate_n,
+ remove, remove_if, remove_copy, remove_copy_if, unique,
+ unique_copy, reverse, reverse_copy, rotate,
+ rotate_copy, random_shuffle
+ sorting and related operations
+ sort, stable_sort, partial_sort, partial_sort_copy,
+ nth_element, lower_bound, upper_bound, equal_range,
+ binary_search, merge, inplace_merge, includes,
+ set_union, set_intersection, set_difference,
+ set_symmetric_difference, push_heap, pop_heap,
+ make_heap, sort_heap, min, max, min_element,
+ max_element, lexicographical_compare, next_permutation,
+ prev_permutation
+ <cstdlib>
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/docs/18_support/howto.html b/libstdc++-v3/docs/18_support/howto.html
new file mode 100644
index 000000000000..e31d5412e432
--- /dev/null
+++ b/libstdc++-v3/docs/18_support/howto.html
@@ -0,0 +1,217 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, egcs, g++, libg++, STL">
+ <META NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 18.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>libstdc++-v3 HOWTO: Chapter 18</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/docs/18_support/">
+<LINK REL=StyleSheet HREF="../lib3styles.css">
+<!-- $Id: howto.html,v 1.5 1999/12/15 16:57:06 pme Exp $ -->
+</HEAD>
+<BODY>
+
+<H1 CLASS="centered"><A NAME="top">Chapter 18: Library Support</A></H1>
+
+<P>Chapter 18 deals with the functions called and objects created
+ automatically during the course of a program's existence.
+</P>
+<P>While we can't reproduce the contents of the Standard here (you need to
+ get your own copy from your nation's member body; see our homepage for
+ help), we can mention a couple of changes in what kind of support a C++
+ program gets from the Standard Library.
+</P>
+
+
+<!-- ####################################################### -->
+<HR>
+<H1>Contents</H1>
+<UL>
+ <LI><A HREF="#1">Types</A>
+ <LI><A HREF="#2">Implementation properties</A>
+ <LI><A HREF="#3">Start and Termination</A>
+ <LI><A HREF="#4">Dynamic memory management</A>
+</UL>
+
+<HR>
+
+<!-- ####################################################### -->
+
+<H2><A NAME="1">Types</A></H2>
+ <P>All the types that you're used to in C are here in one form or
+ another. The only change that might affect people is the type of
+ NULL: while it is required to be a macro, the definition of that
+ macro is <EM>not</EM> allowed to be <TT>(void*)0</TT>, which is
+ often used in C.
+ </P>
+ <P>
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="2">Implementation properties</A></H2>
+ <P>
+ <H3><CODE>&lt;limits&gt;</CODE></H3>
+ This header mainly defines traits classes to give access to various
+ implementation defined-aspects of the fundamental types. The
+ traits classes -- fourteen in total -- are all specilizations of the
+ template class <CODE>numeric_limits</CODE> defined as follows:
+ <PRE>
+ template&lt;typename T&gt; struct class {
+ static const bool is_specialized;
+ static T max() throw();
+ static T min() throw();
+
+ static const int digits;
+ static const int digits10;
+ static const bool is_signed;
+ static const bool is_integer;
+ static const bool is_exact;
+ static const int radix;
+ static T epsilon() throw();
+ static T round_error() throw();
+
+ static const int min_exponent;
+ static const int min_exponent10;
+ static const int max_exponent;
+ static const int max_exponent10;
+
+ static const bool has_infinity;
+ static const bool has_quiet_NaN;
+ static const bool has_signaling_NaN;
+ static const float_denorm_style has_denorm;
+ static const bool has_denorm_loss;
+ static T infinity() throw();
+ static T quiet_NaN() throw();
+ static T denorm_min() throw();
+
+ static const bool is_iec559;
+ static const bool is_bounded;
+ static const bool is_modulo;
+
+ static const bool traps;
+ static const bool tinyness_before;
+ static const float_round_style round_style;
+ };</PRE>
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="3">Start and Termination</A></H2>
+ <P>Not many changes here to <TT>&lt;cstdlib&gt;</TT> (the old stdlib.h).
+ You should note that the <TT>abort()</TT> function does not call
+ the destructors of automatic nor static objects, so if you're depending
+ on those to do cleanup, it isn't going to happen. (The functions
+ registered with <TT>atexit()</TT> don't get called either, so you
+ can forget about that possibility, too.)
+ </P>
+ <P>The good old <TT>exit()</TT> function can be a bit funky, too, until
+ you look closer. Basically, three points to remember are:
+ <OL>
+ <LI>Static objects are destroyed in reverse order of their creation.
+ <LI>Functions registered with <TT>atexit()</TT> are called in
+ reverse order of registration, once per registration call.
+ (This isn't actually new.)
+ <LI>The previous two actions are &quot;interleaved,&quot; that is,
+ given this code:
+ <PRE>
+ extern "C or C++" void f1 (void);
+ extern "C or C++" void f2 (void);
+
+ static Thing obj1;
+ atexit(f1);
+ static Thing obj2;
+ atexit(f2);
+ </PRE>then at a call of <TT>exit()</TT>, f2 will be called, then
+ obj2 will be destroyed, then f1 will be called, and finally obj1
+ will be destroyed. If f1 or f2 allow an exception to propogate
+ out of them, Bad Things happen.
+ </OL>
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="4">Dynamic memory management</A></H2>
+ <P>There are six flavors each of <TT>new</TT> and <TT>delete</TT>, so
+ make certain that you're using the right ones! Here are quickie
+ descriptions of <TT>new</TT>:
+ <UL>
+ <LI>single object form, throwing a <TT>bad_alloc</TT> on errors;
+ this is what most people are used to using
+ <LI>single object &quot;nothrow&quot; form, returning NULL on errors
+ <LI>array new, throwing <TT>bad_alloc</TT> on errors
+ <LI>array nothrow new, returning NULL on errors
+ <LI>placement new, which does nothing (like it's supposed to)
+ <LI>placement array new, which also does nothing
+ </UL>
+ They are distinguished by the parameters that you pass to them, like
+ any other overloaded function. The six flavors of <TT>delete</TT>
+ are distinguished the same way, but none of them are allowed to throw
+ an exception under any circumstances anyhow. (They match up for
+ completeness' sake.)
+ </P>
+ <P>Remember that it is perfectly okay to call <TT>delete</TT> on a
+ NULL pointer! Nothing happens, by definition. That is not the
+ same thing as deleting a pointer twice.
+ </P>
+ <P>By default, if one of the &quot;throwing <TT>new</TT>s&quot; can't
+ allocate the memory requested, it tosses an instance of a
+ <TT>bad_alloc</TT> exception (or, technically, some class derived
+ from it). You can change this by writing your own function (called
+ a new-handler) and then registering it with <TT>set_new_handler()</TT>:
+ <PRE>
+ typedef void (*PFV)(void);
+
+ static char* safety;
+ static PFV old_handler;
+
+ void my_new_handler ()
+ {
+ delete safety;
+ popup_window ("Dude, you are running low on heap memory. You
+ should, like, close some windows, or something.
+ The next time you run out, we're gonna burn!");
+ set_new_handler (old_handler);
+ return;
+ }
+
+ int main ()
+ {
+ safety = new char[500000];
+ old_handler = set_new_handler (&my_new_handler);
+ ...
+ }
+ </PRE>
+ </P>
+ <P><TT>bad_alloc</TT> is derived from the base <TT>exception</TT>
+ class defined in Chapter 19.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+
+
+
+
+<!-- ####################################################### -->
+
+<HR>
+<P CLASS="fineprint"><EM>
+Comments and suggestions are welcome, and may be sent to
+<A HREF="mailto:pme@sourceware.cygnus.com">Phil Edwards</A> or
+<A HREF="mailto:gdr@egcs.cygnus.com">Gabriel Dos Reis</A>.
+<BR> $Id: howto.html,v 1.5 1999/12/15 16:57:06 pme Exp $
+</EM></P>
+
+
+</BODY>
+</HTML>
diff --git a/libstdc++-v3/docs/19_diagnostics/howto.html b/libstdc++-v3/docs/19_diagnostics/howto.html
new file mode 100644
index 000000000000..949a70a5fb1f
--- /dev/null
+++ b/libstdc++-v3/docs/19_diagnostics/howto.html
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, egcs, g++, libg++, STL">
+ <META NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 19.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>libstdc++-v3 HOWTO: Chapter 19</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/docs/19_diagnostics/">
+<LINK REL=StyleSheet HREF="../lib3styles.css">
+<!-- $Id: howto.html,v 1.4 1999/12/15 16:57:06 pme Exp $ -->
+</HEAD>
+<BODY>
+
+<H1 CLASS="centered"><A NAME="top">Chapter 19: Diagnostics</A></H1>
+
+<P>Chapter 19 deals with program diagnostics, such as exceptions
+ and assertions.
+</P>
+
+
+<!-- ####################################################### -->
+<HR>
+<H1>Contents</H1>
+<UL>
+ <LI><A HREF="#1">Adding data to exceptions</A>
+ <LI><A HREF="#2">Exception class hierarchy diagram</A>
+</UL>
+
+<HR>
+
+<!-- ####################################################### -->
+
+<H2><A NAME="1">Adding data to exceptions</A></H2>
+ <P>The standard exception classes carry with them a single string as
+ data (usually describing what went wrong or where the 'throw' took
+ place). It's good to remember that you can add your own data to
+ these exceptions when extending the heirarchy:
+ </P>
+ <PRE>
+ using std::runtime_error;
+ struct My_Exception : public runtime_error
+ {
+ public:
+ My_Exception (const string& whatarg)
+ : runtime_error(whatarg), e(errno), id(GetDataBaseID()) { }
+ int errno_at_time_of_throw() const { return e; }
+ DBID id_of_thing_that_threw() const { return id; }
+ protected:
+ int e;
+ DBID id; // some user-defined type
+ };
+ </PRE>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="2">Exception class hierarchy diagram</A></H2>
+ <P>The <A HREF="exceptions_hiearchy.pdf">diagram</A> is in PDF, or
+ at least it will be once it gets finished.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+
+
+
+<!-- ####################################################### -->
+
+<HR>
+<P CLASS="fineprint"><EM>
+Comments and suggestions are welcome, and may be sent to
+<A HREF="mailto:pme@sourceware.cygnus.com">Phil Edwards</A> or
+<A HREF="mailto:gdr@egcs.cygnus.com">Gabriel Dos Reis</A>.
+<BR> $Id: howto.html,v 1.4 1999/12/15 16:57:06 pme Exp $
+</EM></P>
+
+
+</BODY>
+</HTML>
diff --git a/libstdc++-v3/docs/20_util/howto.html b/libstdc++-v3/docs/20_util/howto.html
new file mode 100644
index 000000000000..21ea55b9cd5c
--- /dev/null
+++ b/libstdc++-v3/docs/20_util/howto.html
@@ -0,0 +1,194 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, egcs, g++, libg++, STL">
+ <META NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 20.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>libstdc++-v3 HOWTO: Chapter 20</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/docs/20_util/">
+<LINK REL=StyleSheet HREF="../lib3styles.css">
+<!-- $Id: howto.html,v 1.5 2000/03/20 22:16:21 pme Exp $ -->
+</HEAD>
+<BODY>
+
+<H1 CLASS="centered"><A NAME="top">Chapter 20: General Utilities</A></H1>
+
+<P>Chapter 20 deals with utility classes and functions, such as
+ the oft-debated <TT>auto_ptr&lt;&gt;</TT>.
+</P>
+
+
+<!-- ####################################################### -->
+<HR>
+<H1>Contents</H1>
+<UL>
+ <LI><A HREF="#1"><TT>auto_ptr</TT> is not omnipotent</A>
+ <LI><A HREF="#2">Automatically-generated operators</A>
+ <LI><A HREF="#3">Functors</A>
+ <LI><A HREF="#4">Pairs</A>
+</UL>
+
+<HR>
+
+<!-- ####################################################### -->
+
+<H2><A NAME="1"><TT>auto_ptr</TT> is not omnipotent</A></H2>
+ <P>I'm not going to try and explain all of the fun and delicious
+ things that can happen with misuse of the auto_ptr class template
+ (called AP here), nor am I going to try and teach you how to use
+ AP safely in the presence of copying. The AP class is a really
+ nifty idea for a smart pointer, but it is one of the dumbest of
+ all the smart pointers -- and that's fine.
+ </P>
+ <P>AP is not meant to be a supersmart solution to all resource
+ leaks everywhere. Neither is it meant to be an effective form
+ of garbage collection (although it can help, a little bit).
+ And it can <EM>not</EM> be used for arrays!
+ </P>
+ <P>AP <EM>is</EM> meant to prevent nasty leaks in the presence of
+ exceptions. That's <EM>all</EM>. This code is AP-friendly:
+ <PRE>
+ // not a recommend naming scheme, but good for web-based FAQs
+ typedef std::auto_ptr&lt;MyClass&gt; APMC;
+
+ extern function_taking_MyClass_pointer (MyClass*);
+ extern some_throwable_function ();
+
+ void func (int data)
+ {
+ APMC ap (new MyClass(data));
+
+ some_throwable_function(); // this will throw an exception
+
+ function_taking_MyClass_pointer (ap.get());
+ }
+ </PRE>When an exception gets thrown, the instance of MyClass that's
+ been created on the heap will be <TT>delete</TT>'d as the stack is
+ unwound past <TT>func()</TT>.
+ </P>
+ <P>Changing that code as follows is <EM>not</EM> AP-friendly:
+ <PRE>
+ APMC ap (new MyClass[22]);
+ </PRE>You will get the same problems as you would without the use
+ of AP:
+ <PRE>
+ char* array = new char[10]; // array new...
+ ...
+ delete array; // ...but single-object delete
+ </PRE>
+ </P>
+ <P>AP cannot tell whether the pointer you've passed at creation points
+ to one or many things. If it points to many things, you are about
+ to die. AP is trivial to write, however, so you could write your
+ own <TT>auto_array_ptr</TT> for that situation (in fact, this has
+ been done many times; check the newsgroups, Usenet, Boost, etc).
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="2">Automatically-generated operators</A></H2>
+ <P>Many programs (for that matter, many of the Standard algorithms
+ and containers) require that you write comparison operators for
+ your classes, like <TT>operator&gt;=</TT>. As any mathmatician
+ will tell you, once you have defined equality and ordering, all
+ of the other comparisons are easily defined in terms of those two.
+ </P>
+ <P>The Committee agrees. So, once you have written
+ <TT>operator==</TT> and <TT>operator&lt;</TT> for your class
+ (whether they are global or member functions is up to you), you
+ can have the compiler do the grunt-work of generating the rest:
+ <PRE>
+ #include &lt;header_with_my_op==_and_op&lt;_defined&gt;
+ #include &lt;utility&gt;
+ using std::rel_ops; // note the nested namespace!
+
+ ...
+ if ((obj1 != obj2) || (obj3 >= obj4)) foo();
+ </PRE>
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="3">Functors</A></H2>
+ <P>If you don't know what functors are, you're not alone. Many people
+ get slightly the wrong idea. In the interest of not reinventing
+ the wheel, we will refer you to the introduction to the functor
+ concept written by SGI as part of their STL, in
+ <A HREF="http://www.sgi.com/Technology/STL/functors.html">their
+ http://www.sgi.com/Technology/STL/functors.html</A>.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="4">Pairs</A></H2>
+ <P>The <TT>pair&lt;T1,T2&gt;</TT> is a simple and handy way to
+ carry around a pair of objects. One is of type T1, and another of
+ type T2; they may be the same type, but you don't get anything
+ extra if they are. The two members can be accessed directly, as
+ <TT>.first</TT> and <TT>.second</TT>.
+ </P>
+ <P>Construction is simple. The default ctor initializes each member
+ with its respective default ctor. The other simple ctor,
+ <PRE>
+ pair (const T1&amp; x, const T2&amp; y);
+ </PRE>does what you think it does, <TT>first</TT> getting <TT>x</TT>
+ and <TT>second</TT> getting <TT>y</TT>.
+ </P>
+ <P>There is a copy constructor, but it requires that your compiler
+ handle member function templates:
+ <PRE>
+ template &lt;class U, class V&gt; pain (const pair&lt;U,V&gt;&amp; p);
+ </PRE>The compiler will convert as necessary from U to T1 and from
+ V to T2 in order to perform the respective initializations.
+ </P>
+ <P>The comparison operators are done for you. Equality
+ of two <TT>pair&lt;T1,T2&gt;</TT>s is defined as both <TT>first</TT>
+ members comparing equal and both <TT>second</TT> members comparing
+ equal; this simply delegates responsibility to the respective
+ <TT>operator==</TT> functions (for types like MyClass) or builtin
+ comparisons (for types like int, char, etc).
+ </P>
+ <P>The less-than operator is a bit odd the first time you see it. It
+ is defined as evaluating to:
+ <PRE>
+ x.first &lt; y.first ||
+ ( !(y.first &lt; x.first) &amp;&amp; x.second &lt; y.second )
+ </PRE>
+ The other operators are not defined using the <TT>rel_ops</TT>
+ functions above, but their semantics are the same.
+ </P>
+ <P>Finally, there is a template function called <TT>make_pair</TT>
+ that takes two references-to-const objects and returns an
+ instance of a pair instantiated on their respective types:
+ <PRE>
+ pair&lt;int,MyClass&gt; p = make_pair(4,myobject);
+ </PRE>
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+
+
+
+<!-- ####################################################### -->
+
+<HR>
+<P CLASS="fineprint"><EM>
+Comments and suggestions are welcome, and may be sent to
+<A HREF="mailto:pme@sourceware.cygnus.com">Phil Edwards</A> or
+<A HREF="mailto:gdr@egcs.cygnus.com">Gabriel Dos Reis</A>.
+<BR> $Id: howto.html,v 1.5 2000/03/20 22:16:21 pme Exp $
+</EM></P>
+
+
+</BODY>
+</HTML>
diff --git a/libstdc++-v3/docs/21_strings/gotw29a.txt b/libstdc++-v3/docs/21_strings/gotw29a.txt
new file mode 100644
index 000000000000..d823f30504e6
--- /dev/null
+++ b/libstdc++-v3/docs/21_strings/gotw29a.txt
@@ -0,0 +1,155 @@
+From: herbs@cntc.com (Herb Sutter)
+Subject: Guru of the Week #29: Solution
+Date: 22 Jan 1998 00:00:00 GMT
+Message-ID: <6a8q26$9qa@netlab.cs.rpi.edu>
+Newsgroups: comp.lang.c++.moderated
+
+
+ .--------------------------------------------------------------------.
+ | Guru of the Week problems and solutions are posted regularly on |
+ | news:comp.lang.c++.moderated. For past problems and solutions |
+ | see the GotW archive at http://www.cntc.com. |
+ | Is there a topic you'd like to see covered? mailto:herbs@cntc.com |
+ `--------------------------------------------------------------------'
+_______________________________________________________
+
+GotW #29: Strings
+
+Difficulty: 7 / 10
+_______________________________________________________
+
+
+>Write a ci_string class which is identical to the
+>standard 'string' class, but is case-insensitive in the
+>same way as the C function stricmp():
+
+The "how can I make a case-insensitive string?"
+question is so common that it probably deserves its own
+FAQ -- hence this issue of GotW.
+
+Note 1: The stricmp() case-insensitive string
+comparison function is not part of the C standard, but
+it is a common extension on many C compilers.
+
+Note 2: What "case insensitive" actually means depends
+entirely on your application and language. For
+example, many languages do not have "cases" at all, and
+for languages that do you have to decide whether you
+want accented characters to compare equal to unaccented
+characters, and so on. This GotW provides guidance on
+how to implement case-insensitivity for standard
+strings in whatever sense applies to your particular
+situation.
+
+
+Here's what we want to achieve:
+
+> ci_string s( "AbCdE" );
+>
+> // case insensitive
+> assert( s == "abcde" );
+> assert( s == "ABCDE" );
+>
+> // still case-preserving, of course
+> assert( strcmp( s.c_str(), "AbCdE" ) == 0 );
+> assert( strcmp( s.c_str(), "abcde" ) != 0 );
+
+The key here is to understand what a "string" actually
+is in standard C++. If you look in your trusty string
+header, you'll see something like this:
+
+ typedef basic_string<char> string;
+
+So string isn't really a class... it's a typedef of a
+template. In turn, the basic_string<> template is
+declared as follows, in all its glory:
+
+ template<class charT,
+ class traits = char_traits<charT>,
+ class Allocator = allocator<charT> >
+ class basic_string;
+
+So "string" really means "basic_string<char,
+char_traits<char>, allocator<char> >". We don't need
+to worry about the allocator part, but the key here is
+the char_traits part because char_traits defines how
+characters interact and compare(!).
+
+basic_string supplies useful comparison functions that
+let you compare whether a string is equal to another,
+less than another, and so on. These string comparisons
+functions are built on top of character comparison
+functions supplied in the char_traits template. In
+particular, the char_traits template supplies character
+comparison functions named eq(), ne(), and lt() for
+equality, inequality, and less-than comparisons, and
+compare() and find() functions to compare and search
+sequences of characters.
+
+If we want these to behave differently, all we have to
+do is provide a different char_traits template! Here's
+the easiest way:
+
+ struct ci_char_traits : public char_traits<char>
+ // just inherit all the other functions
+ // that we don't need to override
+ {
+ static bool eq( char c1, char c2 ) {
+ return tolower(c1) == tolower(c2);
+ }
+
+ static bool ne( char c1, char c2 ) {
+ return tolower(c1) != tolower(c2);
+ }
+
+ static bool lt( char c1, char c2 ) {
+ return tolower(c1) < tolower(c2);
+ }
+
+ static int compare( const char* s1,
+ const char* s2,
+ size_t n ) {
+ return strnicmp( s1, s2, n );
+ // if available on your compiler,
+ // otherwise you can roll your own
+ }
+
+ static const char*
+ find( const char* s, int n, char a ) {
+ while( n-- > 0 && tolower(*s) != tolower(a) ) {
+ ++s;
+ }
+ return s;
+ }
+ };
+
+And finally, the key that brings it all together:
+
+ typedef basic_string<char, ci_char_traits> ci_string;
+
+All we've done is created a typedef named "ci_string"
+which operates exactly like the standard "string",
+except that it uses ci_char_traits instead of
+char_traits<char> to get its character comparison
+rules. Since we've handily made the ci_char_traits
+rules case-insensitive, we've made ci_string itself
+case-insensitive without any further surgery -- that
+is, we have a case-insensitive string without having
+touched basic_string at all!
+
+This GotW should give you a flavour for how the
+basic_string template works and how flexible it is in
+practice. If you want different comparisons than the
+ones stricmp() and tolower() give you, just replace the
+five functions shown above with your own code that
+performs character comparisons the way that's
+appropriate in your particular application.
+
+
+
+Exercise for the reader:
+
+Is it safe to inherit ci_char_traits from
+char_traits<char> this way? Why or why not?
+
+
diff --git a/libstdc++-v3/docs/21_strings/howto.html b/libstdc++-v3/docs/21_strings/howto.html
new file mode 100644
index 000000000000..0014268db874
--- /dev/null
+++ b/libstdc++-v3/docs/21_strings/howto.html
@@ -0,0 +1,292 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, egcs, g++, libg++, STL">
+ <META NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 21.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>libstdc++-v3 HOWTO: Chapter 21</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/docs/21_strings/">
+<LINK REL=StyleSheet HREF="../lib3styles.css">
+<!-- $Id: howto.html,v 1.8 2000/03/20 22:16:21 pme Exp $ -->
+</HEAD>
+<BODY>
+
+<H1 CLASS="centered"><A NAME="top">Chapter 21: Strings</A></H1>
+
+<P>Chapter 21 deals with the C++ strings library (a welcome relief).
+</P>
+
+
+<!-- ####################################################### -->
+<HR>
+<H1>Contents</H1>
+<UL>
+ <LI><A HREF="#1">MFC's CString</A>
+ <LI><A HREF="#2">A case-insensitive string class</A>
+ <LI><A HREF="#3">Breaking a C++ string into tokens</A>
+ <LI><A HREF="#4">Simple transformations</A>
+</UL>
+
+<HR>
+
+<!-- ####################################################### -->
+
+<H2><A NAME="1">MFC's CString</A></H2>
+ <P>A common lament seen in various newsgroups deals with the Standard
+ string class as opposed to the Microsoft Foundation Class called
+ CString. Often programmers realize that a standard portable
+ answer is better than a proprietary nonportable one, but in porting
+ their application from a Win32 platform, they discover that they
+ are relying on special functons offered by the CString class.
+ </P>
+ <P>Things are not as bad as they seem. In
+ <A HREF="http://egcs.cygnus.com/ml/egcs/1999-04/msg00233.html">this
+ message</A>, Joe Buck points out a few very important things:
+ <UL>
+ <LI>The Standard <TT>string</TT> supports all the operations
+ that CString does, with three exceptions.
+ <LI>Two of those exceptions (whitespace trimming and case
+ conversion) are trivial to implement. In fact, we do so
+ on this page.
+ <LI>The third is <TT>CString::Format</TT>, which allows formatting
+ in the style of <TT>sprintf</TT>. This deserves some mention:
+ </UL>
+ </P>
+ <A NAME="1.1internal"> <!-- Coming from Chapter 27 -->
+ <P>The old libg++ library had a function called form(), which did much
+ the same thing. But for a Standard solution, you should use the
+ stringstream classes. These are the bridge between the iostream
+ hierarchy and the string class, and they operate with regular
+ streams seamlessly because they inherit from the iostream
+ heirarchy. An quick example:
+ <PRE>
+ #include &lt;iostream&gt;
+ #include &lt;string&gt;
+ #include &lt;sstream&gt;
+
+ string f (string& incoming) // incoming is something like "foo N"
+ {
+ istringstream incoming_stream(incoming);
+ string the_word;
+ int the_number;
+
+ incoming_stream &gt;&gt; the_word // extract "foo"
+ &gt;&gt; the_number; // extract N
+
+ ostringstream output_stream;
+ output_stream &lt;&lt; "The word was " &lt;&lt; the_word
+ &lt;&lt; " and 3*N was " &lt;&lt; (3*the_number);
+
+ return output_stream.str();
+ } </PRE>
+ </P></A>
+ <P>A serious problem with CString is a design bug in its memory
+ allocation. Specifically, quoting from that same message:
+ <PRE>
+ CString suffers from a common programming error that results in
+ poor performance. Consider the following code:
+
+ CString n_copies_of (const CString& foo, unsigned n)
+ {
+ CString tmp;
+ for (unsigned i = 0; i &lt; n; i++)
+ tmp += foo;
+ return tmp;
+ }
+
+ This function is O(n^2), not O(n). The reason is that each +=
+ causes a reallocation and copy of the existing string. Microsoft
+ applications are full of this kind of thing (quadratic performance
+ on tasks that can be done in linear time) -- on the other hand,
+ we should be thankful, as it's created such a big market for high-end
+ ix86 hardware. :-)
+
+ If you replace CString with string in the above function, the
+ performance is O(n).
+ </PRE>
+ </P>
+ <P>Joe Buck also pointed out some other things to keep in mind when
+ comparing CString and the Standard string class:
+ <UL>
+ <LI>CString permits access to its internal representation; coders
+ who exploited that may have problems moving to <TT>string</TT>.
+ <LI>Microsoft ships the source to CString (in the files
+ MFC\SRC\Str{core,ex}.cpp), so you could fix the allocation
+ bug and rebuild your MFC libraries.
+ <EM><B>Note:</B> It looks like the the CString shipped with
+ VC++6.0 has fixed this, although it may in fact have been one
+ of the VC++ SPs that did it.</EM>
+ <LI><TT>string</TT> operations like this have O(n) complexity
+ <EM>if the implementors do it correctly</EM>. The libstdc++
+ implementors did it correctly. Other vendors might not.
+ <LI>While parts of the SGI STL are used in libstdc++-v3, their
+ string class is not. The SGI <TT>string</TT> is essentially
+ <TT>vector&lt;char&gt;</TT> and does not do any reference
+ counting like libstdc++-v3's does. (It is O(n), though.)
+ So if you're thinking about SGI's string or rope classes,
+ you're now looking at four possibilities: CString, the
+ libstdc++ string, the SGI string, and the SGI rope, and this
+ is all before any allocator or traits customizations! (More
+ choices than you can shake a stick at -- want fries with that?)
+ </UL>
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="2">A case-insensitive string class</A></H2>
+ <P>The well-known-and-if-it-isn't-well-known-it-ought-to-be
+ <A HREF="http://www.peerdirect.com/resources/">Guru of the Week</A>
+ discussions held on Usenet covered this topic in January of 1998.
+ Briefly, the challenge was, &quot;write a 'ci_string' class which
+ is identical to the standard 'string' class, but is
+ case-insensitive in the same way as the (common but nonstandard)
+ C function stricmp():&quot;
+ <PRE>
+ ci_string s( "AbCdE" );
+
+ // case insensitive
+ assert( s == "abcde" );
+ assert( s == "ABCDE" );
+
+ // still case-preserving, of course
+ assert( strcmp( s.c_str(), "AbCdE" ) == 0 );
+ assert( strcmp( s.c_str(), "abcde" ) != 0 ); </PRE>
+ </P>
+
+ <P>The solution is surprisingly easy. The original answer pages
+ on the GotW website have been removed into cold storage, in
+ preparation for a published book of GotW notes. Before being
+ put on the web, of course, it was posted on Usenet, and that
+ posting containing the answer is <A HREF="gotw29a.txt">available
+ here</A>.
+ </P>
+ <P>See? Told you it was easy!</P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="3">Breaking a C++ string into tokens</A></H2>
+ <P>The Standard C (and C++) function <TT>strtok()</TT> leaves a lot to
+ be desired in terms of user-friendliness. It's unintuitive, it
+ destroys the character string on which it operates, and it requires
+ you to handle all the memory problems. But it does let the client
+ code decide what to use to break the string into pieces; it allows
+ you to choose the &quot;whitespace,&quot; so to speak.
+ </P>
+ <P>A C++ implementation lets us keep the good things and fix those
+ annoyances. The implementation here is more intuitive (you only
+ call it once, not in a loop with varying argument), it does not
+ affect the original string at all, and all the memory allocation
+ is handled for you.
+ </P>
+ <P>It's called stringtok, and it's a template function. It's given
+ <A HREF="stringtok_h.txt">in this file</A> in a less-portable form than
+ it could be, to keep this example simple (for example, see the
+ comments on what kind of string it will accept). The author uses
+ a more general (but less readable) form of it for parsing command
+ strings and the like. If you compiled and ran this code using it:
+ <PRE>
+ std::list&lt;string> ls;
+ stringtok (ls, " this \t is\t\n a test ");
+ for (std::list&lt;string>::const_iterator i = ls.begin();
+ i != ls.end(); ++i)
+ {
+ std::cerr &lt;&lt; ':' &lt;&lt; (*i) &lt;&lt; ":\n";
+ }</PRE>
+ You would see this as output:
+ <PRE>
+ :this:
+ :is:
+ :a:
+ :test:</PRE>
+ with all the whitespace removed. The original <TT>s</TT> is still
+ available for use, <TT>ls</TT> will clean up after itself, and
+ <TT>ls.size()</TT> will return how many tokens there were.
+ </P>
+ <P>As always, there is a price paid here, in that stringtok is not
+ as fast as strtok. The other benefits usually outweight that, however.
+ <A HREF="stringtok_std_h.txt">Another version of stringtok is given
+ here</A>, suggested by Chris King and tweaked by Petr Prikryl,
+ and this one uses the
+ transformation functions given below. If you are comfortable with
+ reading the new function names, this version is recommended as an example.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="4">Simple transformations</A></H2>
+ <P>Here are Standard, simple, and portable ways to perform common
+ transformations on a <TT>string</TT> instance, such as &quot;convert
+ to all upper case.&quot; The word transformations is especially
+ apt, because the standard template function
+ <TT>transform&lt;&gt;</TT> is used.
+ <PRE>
+ #include &lt;string&gt;
+ #include &lt;algorithm&gt;
+ #include &lt;cctype&gt; // old &lt;ctype.h&gt;
+ std::string s ("Some Kind Of Initial Input Goes Here");
+
+ // Change everything into upper case
+ std::transform (s.begin(), s.end(), s.begin(), toupper);
+
+ // Change everything into lower case
+ std::transform (s.begin(), s.end(), s.begin(), tolower);
+
+ // Change everything back into upper case, but store the
+ // result in a different string
+ std::string capital_s;
+ capital_s.reserve(s.size());
+ std::transform (s.begin(), s.end(), capital_s.begin(), tolower); </PRE>
+ <SPAN CLASS="larger"><B>Note</B></SPAN> that these calls all involve
+ the global C locale through the use of the C functions
+ <TT>toupper/tolower</TT>. This is absolutely guaranteed to work --
+ but only if you're using English text (bummer). A much better and
+ more portable solution is to use a facet for a particular locale
+ and call its conversion functions. (These are discussed more in
+ Chapter 22.)
+ </P>
+ <P>Another common operation is trimming off excess whitespace. Much
+ like transformations, this task is trivial with the use of string's
+ <TT>find</TT> family. These examples are broken into multiple
+ statements for readability:
+ <PRE>
+ std::string str (" \t blah blah blah \n ");
+
+ // trim leading whitespace
+ string::size_type notwhite = str.find_first_not_of(" \t\n");
+ str.erase(0,notwhite);
+
+ // trim trailing whitespace
+ notwhite = str.find_last_not_of(" \t\n");
+ str.erase(notwhite+1); </PRE>
+ Obviously, the calls to <TT>find</TT> could be inserted directly
+ into the calls to <TT>erase</TT>, in case your compiler does not
+ optimize named temporaries out of existance.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+
+
+
+<!-- ####################################################### -->
+
+<HR>
+<P CLASS="fineprint"><EM>
+Comments and suggestions are welcome, and may be sent to
+<A HREF="mailto:pme@sourceware.cygnus.com">Phil Edwards</A> or
+<A HREF="mailto:gdr@egcs.cygnus.com">Gabriel Dos Reis</A>.
+<BR> $Id: howto.html,v 1.8 2000/03/20 22:16:21 pme Exp $
+</EM></P>
+
+
+</BODY>
+</HTML>
diff --git a/libstdc++-v3/docs/21_strings/stringtok_h.txt b/libstdc++-v3/docs/21_strings/stringtok_h.txt
new file mode 100644
index 000000000000..81d87a6efaf7
--- /dev/null
+++ b/libstdc++-v3/docs/21_strings/stringtok_h.txt
@@ -0,0 +1,102 @@
+/*
+ * stringtok.h -- Breaks a string into tokens. This is an example for lib3.
+ *
+ * Template function looks like this:
+ *
+ * template <typename Container>
+ * void stringtok (Container &l,
+ * string const &s,
+ * char const * const ws = " \t\n");
+ *
+ * A nondestructive version of strtok() that handles its own memory and can
+ * be broken up by any character(s). Does all the work at once rather than
+ * in an invocation loop like strtok() requires.
+ *
+ * Container is any type that supports push_back(a_string), although using
+ * list<string> and deque<string> are indicated due to their O(1) push_back.
+ * (I prefer deque<> because op[]/at() is available as well.) The first
+ * parameter references an existing Container.
+ *
+ * s is the string to be tokenized. From the parameter declaration, it can
+ * be seen that s is not affected. Since references-to-const may refer to
+ * temporaries, you could use stringtok(some_container, readline("")) when
+ * using the GNU readline library.
+ *
+ * The final parameter is an array of characters that serve as whitespace.
+ * Whitespace characters default to one or more of tab, space, and newline,
+ * in any combination.
+ *
+ * 'l' need not be empty on entry. On return, 'l' will have the token
+ * strings appended.
+ *
+ *
+ * [Example:
+ * list<string> ls;
+ * stringtok (ls, " this \t is\t\n a test ");
+ * for (list<string>::const_iterator i = ls.begin();
+ * i != ls.end(); ++i)
+ * {
+ * cerr << ':' << (*i) << ":\n";
+ * }
+ *
+ * would print
+ * :this:
+ * :is:
+ * :a:
+ * :test:
+ * -end example]
+ *
+ * pedwards@jaj.com May 1999
+*/
+
+
+#include <string>
+#include <cstring> // for strchr
+
+
+/*****************************************************************
+ * This is the only part of the implementation that I don't like.
+ * It can probably be improved upon by the reader...
+*/
+namespace {
+ inline bool
+ isws (char c, char const * const wstr)
+ {
+ return (strchr(wstr,c) != NULL);
+ }
+}
+
+
+/*****************************************************************
+ * Simplistic and quite Standard, but a bit slow. This should be
+ * templatized on basic_string instead, or on a more generic StringT
+ * that just happens to support ::size_type, .substr(), and so on.
+ * I had hoped that "whitespace" would be a trait, but it isn't, so
+ * the user must supply it. Enh, this lets them break up strings on
+ * different things easier than traits would anyhow.
+*/
+template <typename Container>
+void
+stringtok (Container &l, string const &s, char const * const ws = " \t\n")
+{
+ const string::size_type S = s.size();
+ string::size_type i = 0;
+
+ while (i < S) {
+ // eat leading whitespace
+ while ((i < S) && (isws(s[i],ws))) ++i;
+ if (i == S) return; // nothing left but WS
+
+ // find end of word
+ string::size_type j = i+1;
+ while ((j < S) && (!isws(s[j],ws))) ++j;
+
+ // add word
+ l.push_back(s.substr(i,j-i));
+
+ // set up for next loop
+ i = j+1;
+ }
+}
+
+
diff --git a/libstdc++-v3/docs/21_strings/stringtok_std_h.txt b/libstdc++-v3/docs/21_strings/stringtok_std_h.txt
new file mode 100644
index 000000000000..2f3d7e073684
--- /dev/null
+++ b/libstdc++-v3/docs/21_strings/stringtok_std_h.txt
@@ -0,0 +1,39 @@
+/*
+ * Same as stringtok_h.txt, but doesn't (visiably) use C functions.
+*/
+
+#include <string>
+
+// The std:: prefix is not used here, for readability, and a line like
+// "using namespace std;" is dangerous to have in a header file.
+
+template <typename Container>
+void
+stringtok (Container &container, string const &in,
+ const char * const delimiters = " \t\n")
+{
+ const string::size_type len = in.length();
+ string::size_type i = 0;
+
+ while ( i < len )
+ {
+ // eat leading whitespace
+ i = in.find_first_not_of (delimiters, i);
+ if (i == string::npos)
+ return; // nothing left but white space
+
+ // find the end of the token
+ string::size_type j = in.find_first_of (delimiters, i);
+
+ // push token
+ if (j == string::npos) {
+ container.push_back (in.substr(i));
+ return;
+ } else
+ container.push_back (in.substr(i, j-i));
+
+ // set up for next loop
+ i = j + 1;
+ }
+}
+
diff --git a/libstdc++-v3/docs/22_locale/howto.html b/libstdc++-v3/docs/22_locale/howto.html
new file mode 100644
index 000000000000..70d4add93f41
--- /dev/null
+++ b/libstdc++-v3/docs/22_locale/howto.html
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, egcs, g++, libg++, STL">
+ <META NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 22.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>libstdc++-v3 HOWTO: Chapter 22</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/docs/22_locale/">
+<LINK REL=StyleSheet HREF="../lib3styles.css">
+<!-- $Id: howto.html,v 1.5 2000/03/20 22:16:21 pme Exp $ -->
+</HEAD>
+<BODY>
+
+<H1 CLASS="centered"><A NAME="top">Chapter 22: Localization</A></H1>
+
+<P>Chapter 22 deals with the FORTRAN subroutines for automatically
+ transforming lemmings into gold.
+</P>
+
+
+<!-- ####################################################### -->
+<HR>
+<H1>Contents</H1>
+<UL>
+ <LI><A HREF="#1">Stroustrup on Locales</A>
+ <LI><A HREF="#2">Topic</A>
+</UL>
+
+<HR>
+
+<!-- ####################################################### -->
+
+<H2><A NAME="1">Stroustrup on Locales</A></H2>
+ <P>Dr. Bjarne Stroustrup has released a
+ <A HREF="http://www.research.att.com/~bs/3rd_loc0.html">pointer</A>
+ to Appendix D of his book,
+ <A HREF="http://www.research.att.com/~bs/3rd.html">The C++
+ Programming Language (3rd Edition)</A>. It is a detailed
+ description of locales and how to use them.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="2">Topic</A></H2>
+ <P>More stuff will have to wait until somebody with locale
+ experience can share it...
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+
+
+
+<!-- ####################################################### -->
+
+<HR>
+<P CLASS="fineprint"><EM>
+Comments and suggestions are welcome, and may be sent to
+<A HREF="mailto:pme@sourceware.cygnus.com">Phil Edwards</A> or
+<A HREF="mailto:gdr@egcs.cygnus.com">Gabriel Dos Reis</A>.
+<BR> $Id: howto.html,v 1.5 2000/03/20 22:16:21 pme Exp $
+</EM></P>
+
+
+</BODY>
+</HTML>
diff --git a/libstdc++-v3/docs/23_containers/howto.html b/libstdc++-v3/docs/23_containers/howto.html
new file mode 100644
index 000000000000..f39731b845cd
--- /dev/null
+++ b/libstdc++-v3/docs/23_containers/howto.html
@@ -0,0 +1,246 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, egcs, g++, libg++, STL">
+ <META NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 23.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>libstdc++-v3 HOWTO: Chapter 23</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/docs/23_containers/">
+<LINK REL=StyleSheet HREF="../lib3styles.css">
+<!-- $Id: howto.html,v 1.8 2000/03/23 20:58:38 pme Exp $ -->
+</HEAD>
+<BODY>
+
+<H1 CLASS="centered"><A NAME="top">Chapter 23: Containers</A></H1>
+
+<P>Chapter 23 deals with container classes and what they offer.
+</P>
+
+
+<!-- ####################################################### -->
+<HR>
+<H1>Contents</H1>
+<UL>
+ <LI><A HREF="#1">Making code unaware of the container/array difference</A>
+ <LI><A HREF="#2">Variable-sized bitmasks</A>
+ <LI><A HREF="#3">Containers and multithreading</A>
+</UL>
+
+<HR>
+
+<!-- ####################################################### -->
+
+<H2><A NAME="1">Making code unaware of the container/array difference</A></H2>
+ <P>You're writing some code and can't decide whether to use builtin
+ arrays or some kind of container. There are compelling reasons
+ to use one of the container classes, but you're afraid that you'll
+ eventually run into difficulties, change everything back to arrays,
+ and then have to change all the code that uses those data types to
+ keep up with the change.
+ </P>
+ <P>If your code makes use of the standard algorithms, this isn't as
+ scary as it sounds. The algorithms don't know, nor care, about
+ the kind of &quot;container&quot; on which they work, since the
+ algorithms are only given endpoints to work with. For the container
+ classes, these are iterators (usually <TT>begin()</TT> and
+ <TT>end()</TT>, but not always). For builtin arrays, these are
+ the address of the first element and the past-the-end element.
+ <!-- a good explanation of the past-the-end rules is in order,
+ probably a link somewhere
+ -->
+ </P>
+ <P>Some very simple wrapper functions can hide all of that from the
+ rest of the code. For example, a pair of functions called
+ <TT>beginof</TT> can be written, one that takes an array, another
+ that takes a vector. The first returns a pointer to the first
+ element, and the second returns the vector's <TT>begin()</TT>
+ iterator.
+ </P>
+ <P>The functions should be made template functions, and should also
+ be declared inline. As pointed out in the comments in the code
+ below, this can lead to <TT>beginof</TT> being optimized out of
+ existence, so you pay absolutely nothing in terms of increased
+ code size or execution time.
+ </P>
+ <P>The result is that if all your algorithm calls look like
+ <PRE>
+ std::transform(beginof(foo), endof(foo), beginof(foo), SomeFunction);</PRE>
+ then the type of foo can change from an array of ints to a vector
+ of ints to a deque of ints and back again, without ever changing any
+ client code.
+ </P>
+ <P>This author has a collection of such functions, called &quot;*of&quot;
+ because they all extend the builtin &quot;sizeof&quot;. It started
+ with some Usenet discussions on a transparent way to find the length
+ of an array. A simplified and much-reduced version for easier
+ reading is <A HREF="wrappers_h.txt">given here</A>.
+ </P>
+ <P>Astute readers will notice two things at once: first, that the
+ container class is still a <TT>vector&lt;T&gt;</TT> instead of a
+ more general <TT>Container&lt;T&gt;</TT>. This would mean that
+ three functions for <TT>deque</TT> would have to be added, another
+ three for <TT>list</TT>, and so on. This is due to problems with
+ getting template resolution correct; I find it easier just to
+ give the extra three lines and avoid confusion.
+ </P>
+ <P>Second, the line
+ <PRE>
+ inline unsigned int lengthof (T (&)[sz]) { return sz; } </PRE>
+ looks just weird! Hint: unused parameters can be left nameless.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="2">Variable-sized bitmasks</A></H2>
+ <P>No, you cannot write code of the form
+ <!-- Careful, the leading spaces in PRE show up directly. -->
+ <PRE>
+ #include &lt;bitset&gt;
+
+ void foo (size_t n)
+ {
+ std::bitset&lt;n&gt; bits;
+ ....
+ } </PRE>
+ because <TT>n</TT> must be known at compile time. Your compiler is
+ correct; it is not a bug. That's the way templates work. (Yes, it
+ <EM>is</EM> a feature.)
+ </P>
+ <P>There are a couple of ways to handle this kind of thing. Please
+ consider all of them before passing judgement. They include, in
+ no particular order:
+ <UL>
+ <LI>A very large N in <TT>bitset&lt;N&gt;</TT>.
+ <LI>A container&lt;bool&gt;.
+ <LI>Extremely weird solutions.
+ </UL>
+ </P>
+ <P><B>A very large N in <TT>bitset&lt;N&gt;</TT>.&nbsp;&nbsp;</B> It has
+ been pointed out a few times in newsgroups that N bits only takes up
+ (N/8) bytes on most systems, and division by a factor of eight is pretty
+ impressive when speaking of memory. Half a megabyte given over to a
+ bitset (recall that there is zero space overhead for housekeeping info;
+ it is known at compile time exactly how large the set is) will hold over
+ four million bits. If you're using those bits as status flags (e.g.,
+ &quot;changed&quot;/&quot;unchanged&quot; flags), that's a <EM>lot</EM>
+ of state.
+ </P>
+ <P>You can then keep track of the &quot;maximum bit used&quot; during some
+ testing runs on representative data, make note of how many of those bits
+ really need to be there, and then reduce N to a smaller number. Leave
+ some extra space, of course. (If you plan to write code like the
+ incorrect example above, where the bitset is a local variable, then you
+ may have to talk your compiler into allowing that much stack space;
+ there may be zero spae overhead, but it's all allocated inside the
+ object.)
+ </P>
+ <P><B>A container&lt;bool&gt;.&nbsp;&nbsp;</B> The Committee made provision
+ for the space savings possible with that (N/8) usage previously mentioned,
+ so that you don't have to do wasteful things like
+ <TT>Container&lt;char&gt;</TT> or <TT>Container&lt;short int&gt;</TT>.
+ Specifically, <TT>vector&lt;bool&gt;</TT> is required to be
+ specialized for that space savings.
+ </P>
+ <P>The problem is that <TT>vector&lt;bool&gt;</TT> doesn't behave like a
+ normal vector anymore. There have been recent journal articles which
+ discuss the problems (the ones by Herb Sutter in the May and
+ July/August 1999 issues of
+ <EM>C++ Report</EM> cover it well). Future revisions of the ISO C++
+ Standard will change the requirement for <TT>vector&lt;bool&gt;</TT>
+ specialization. In the meantime, <TT>deque&lt;bool&gt;</TT> is
+ recommended (although its behavior is sane, you probably will not get
+ the space savings, but the allocation scheme is different than that
+ of vector).
+ </P>
+ <P><B>Extremely weird solutions.&nbsp;&nbsp;</B> If you have access to
+ the compiler and linker at runtime, you can do something insane, like
+ figuring out just how many bits you need, then writing a temporary
+ source code file. That file contains an instantiation of <TT>bitset</TT>
+ for the required number of bits, inside some wrapper functions with
+ unchanging signatures. Have your program then call the
+ compiler on that file using Position Independant Code, then open the
+ newly-created object file and load those wrapper functions. You'll have
+ an instantiation of <TT>bitset&lt;N&gt;</TT> for the exact <TT>N</TT>
+ that you need at the time. Don't forget to delete the temporary files.
+ (Yes, this <EM>can</EM> be, and <EM>has been</EM>, done.)
+ </P>
+ <!-- I wonder if this next paragraph will get me in trouble... -->
+ <P>This would be the approach of either a visionary genius or a raving
+ lunatic, depending on your programming and management style. Probably
+ the latter.
+ </P>
+ <P>Which of the above techniques you use, if any, are up to you and your
+ intended application. Some time/space profiling is indicated if it
+ really matters (don't just guess). And, if you manage to do anything
+ along the lines of the third category, the author would love to hear
+ from you...
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="3">Containers and multithreading</A></H2>
+ <P>This section will mention some of the problems in designing MT
+ programs that use Standard containers. For information on other
+ aspects of multithreading (e.g., the library as a whole), see
+ the Received Wisdom on Chapter 17.
+ </P>
+ <P>An excellent page to read when working with templatized containers
+ and threads is
+ <A HREF="http://www.sgi.com/Technology/STL/thread_safety.html">SGI's
+ http://www.sgi.com/Technology/STL/thread_safety.html</A>. The
+ libstdc++-v3 uses the same definition of thread safety
+ when discussing design. A key point that beginners may miss is the
+ fourth major paragraph (&quot;For most clients,&quot;...), pointing
+ out that locking must nearly always be done outside the container,
+ by client code (that'd be you, not us *grin*).
+ </P>
+ <P>You didn't read it, did you? *sigh* I'm serious, go read the
+ SGI page. It's really good and doesn't take long, and makes most
+ of the points that would otherwise have to be made here (and does
+ a better job).
+ </P>
+ <P>That's much better. Now, the issue of MT has been brought up on
+ the libstdc++-v3 mailing list as well as the main GCC mailing list
+ several times. The Chapter 17 HOWTO has some links into the mail
+ archives, so you can see what's been thrown around. The usual
+ container (or pseudo-container, depending on how you look at it)
+ that people have in mind is <TT>string</TT>, which is one of the
+ points where libstdc++ departs from the SGI STL. As of the
+ 2.90.8 snapshot, the libstdc++-v3 string class is safe for
+ certain kinds of multithreaded access.
+ </P>
+ <P>For implementing a container which does its own locking, it is
+ trivial to (as SGI suggests) provide a wrapper class which obtains
+ the lock, performs the container operation, then releases the lock.
+ This could be templatized <EM>to a certain extent</EM>, on the
+ underlying container and/or a locking mechanism. Trying to provide
+ a catch-all general template solution would probably be more trouble
+ than it's worth.
+ </P>
+
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+
+
+
+<!-- ####################################################### -->
+
+<HR>
+<P CLASS="fineprint"><EM>
+Comments and suggestions are welcome, and may be sent to
+<A HREF="mailto:pme@sourceware.cygnus.com">Phil Edwards</A> or
+<A HREF="mailto:gdr@egcs.cygnus.com">Gabriel Dos Reis</A>.
+<BR> $Id: howto.html,v 1.8 2000/03/23 20:58:38 pme Exp $
+</EM></P>
+
+
+</BODY>
+</HTML>
diff --git a/libstdc++-v3/docs/23_containers/wrappers_h.txt b/libstdc++-v3/docs/23_containers/wrappers_h.txt
new file mode 100644
index 000000000000..3e0805bf8c83
--- /dev/null
+++ b/libstdc++-v3/docs/23_containers/wrappers_h.txt
@@ -0,0 +1,48 @@
+
+/*****************************************************************
+ * Functions to help treat arrays in a uniform manner. These were
+ * inspired by a thread on comp.lang.c++.moderated, started by Dietmar
+ * Kuehl and contributed to by the rest of the entire planet.
+ *
+ * beginof (x), endof (x), lengthof (x) now accompany sizeof, where x
+ * can be either a container (currently only sequences) or a builtin
+ * array (/not/ a pointer). The beginof/endof are intended for use in
+ * the algorithms library, and lengthof is a "sizing" function.
+ *
+ * Note example:
+ * char an_array [17];
+ * cerr << lengthof(an_array) << endl;
+ * produces assembly code of
+ * mov 17,register0
+ * call ofstream_put
+ * i.e., the template function inlining really does work; g++/egcs
+ * requires -O3 (or -finline-functions) before it does this, though.
+ *
+ * pedwards 13Nov98
+*/
+// beginof
+template <class T>
+ inline typename vector<T>::iterator beginof (vector<T> &v)
+ { return v.begin(); }
+
+template <class T, unsigned int sz>
+ inline T* beginof (T (&array)[sz]) { return array; }
+
+
+// endof
+template <class T>
+ inline typename vector<T>::iterator endof (vector<T> &v)
+ { return v.end(); }
+
+template <class T, unsigned int sz>
+ inline T* endof (T (&array)[sz]) { return array + sz; }
+
+
+// lengthof
+template <class T>
+ inline typename vector<T>::size_type lengthof (vector<T> &v)
+ { return v.size(); }
+
+template <class T, unsigned int sz>
+ inline unsigned int lengthof (T (&)[sz]) { return sz; }
+
diff --git a/libstdc++-v3/docs/24_iterators/howto.html b/libstdc++-v3/docs/24_iterators/howto.html
new file mode 100644
index 000000000000..036042f13c99
--- /dev/null
+++ b/libstdc++-v3/docs/24_iterators/howto.html
@@ -0,0 +1,95 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, egcs, g++, libg++, STL">
+ <META NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 24.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>libstdc++-v3 HOWTO: Chapter 24</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/docs/24_iterators/">
+<LINK REL=StyleSheet HREF="../lib3styles.css">
+<!-- $Id: howto.html,v 1.4 1999/12/15 16:57:06 pme Exp $ -->
+</HEAD>
+<BODY>
+
+<H1 CLASS="centered"><A NAME="top">Chapter 24: Iterators</A></H1>
+
+<P>Chapter 24 deals with the FORTRAN subroutines for automatically
+ transforming lemmings into gold.
+</P>
+
+
+<!-- ####################################################### -->
+<HR>
+<H1>Contents</H1>
+<UL>
+ <LI><A HREF="#1">They ain't pointers!</A>
+ <LI><A HREF="#2">Topic</A>
+</UL>
+
+<HR>
+
+<!-- ####################################################### -->
+
+<H2><A NAME="1">They ain't pointers!</A></H2>
+ <P><A HREF="../faq/index.html#5_1">FAQ 5.1</A> points out that iterators
+ are not implemented as pointers. They are a generalization of
+ pointers, but they are implemented in libstdc++-v3 as separate classes.
+ </P>
+ <P>Keeping that simple fact in mind as you design your code will
+ prevent a whole lot of difficult-to-understand bugs.
+ </P>
+ <P>You can think of it the other way 'round, even. Since iterators
+ are a generalization, that means that <EM>pointers</EM> are
+ <EM>iterators</EM>, and that pointers can be used whenever an
+ iterator would be. All those functions in the Algorithms chapter
+ of the Standard will work just as well on plain arrays and their
+ pointers.
+ </P>
+ <P>That doesn't mean that when you pass in a pointer, it gets wrapped
+ into some special delegating iterator-to-pointer class with a layer
+ of overhead. (If you think that's the case anywhere, you don't
+ understand templates to begin with...) Oh, no; if you pass
+ in a pointer, then the compiler will instantiate that template
+ using T* as a type and good old high-speed pointer arithmetic as
+ its operations, so the resulting code will be doing exactly the same
+ things as it would be doing if you had hand-coded it yourself (for
+ the 273rd time).
+ </P>
+ <P>How much overhead <EM>is</EM> there when using an interator class?
+ Very little. Most of the layering classes contain nothing but
+ typedefs, and typedefs are &quot;meta-information&quot; that simply
+ tell the compiler some nicknames; they don't create code. That
+ information gets passed down through inheritance, so while the
+ compiler has to do work looking up all the names, your runtime code
+ does not. (This has been a prime concern from the beginning.)
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="2">Topic</A></H2>
+ <P>Blah.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+
+
+
+<!-- ####################################################### -->
+
+<HR>
+<P CLASS="fineprint"><EM>
+Comments and suggestions are welcome, and may be sent to
+<A HREF="mailto:pme@sourceware.cygnus.com">Phil Edwards</A> or
+<A HREF="mailto:gdr@egcs.cygnus.com">Gabriel Dos Reis</A>.
+<BR> $Id: howto.html,v 1.4 1999/12/15 16:57:06 pme Exp $
+</EM></P>
+
+
+</BODY>
+</HTML>
diff --git a/libstdc++-v3/docs/25_algorithms/howto.html b/libstdc++-v3/docs/25_algorithms/howto.html
new file mode 100644
index 000000000000..9c6d6c42da13
--- /dev/null
+++ b/libstdc++-v3/docs/25_algorithms/howto.html
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, egcs, g++, libg++, STL">
+ <META NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 25.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>libstdc++-v3 HOWTO: Chapter 25</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/docs/25_algorithms/">
+<LINK REL=StyleSheet HREF="../lib3styles.css">
+<!-- $Id: howto.html,v 1.4 1999/12/15 16:57:06 pme Exp $ -->
+</HEAD>
+<BODY>
+
+<H1 CLASS="centered"><A NAME="top">Chapter 25: Algorithms</A></H1>
+
+<P>Chapter 25 deals with the FORTRAN subroutines for automatically
+ transforming lemmings into gold.
+</P>
+
+
+<!-- ####################################################### -->
+<HR>
+<H1>Contents</H1>
+<UL>
+ <LI><A HREF="#1">Topic</A>
+ <LI><A HREF="#2">Topic</A>
+</UL>
+
+<HR>
+
+<!-- ####################################################### -->
+
+<H2><A NAME="1">Topic</A></H2>
+ <P>Blah.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="2">Topic</A></H2>
+ <P>Blah.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+
+
+
+<!-- ####################################################### -->
+
+<HR>
+<P CLASS="fineprint"><EM>
+Comments and suggestions are welcome, and may be sent to
+<A HREF="mailto:pme@sourceware.cygnus.com">Phil Edwards</A> or
+<A HREF="mailto:gdr@egcs.cygnus.com">Gabriel Dos Reis</A>.
+<BR> $Id: howto.html,v 1.4 1999/12/15 16:57:06 pme Exp $
+</EM></P>
+
+
+</BODY>
+</HTML>
diff --git a/libstdc++-v3/docs/26_numerics/howto.html b/libstdc++-v3/docs/26_numerics/howto.html
new file mode 100644
index 000000000000..ef7b6bb1cb29
--- /dev/null
+++ b/libstdc++-v3/docs/26_numerics/howto.html
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, egcs, g++, libg++, STL">
+ <META NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 26.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>libstdc++-v3 HOWTO: Chapter 26</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/docs/26_numerics/">
+<LINK REL=StyleSheet HREF="../lib3styles.css">
+<!-- $Id: howto.html,v 1.4 1999/12/15 16:57:06 pme Exp $ -->
+</HEAD>
+<BODY>
+
+<H1 CLASS="centered"><A NAME="top">Chapter 26: Numerics</A></H1>
+
+<P>Chapter 26 deals with classes and functions to aid in numerical computing,
+ such as <TT>valarray&lt;&gt;</TT> and <TT>complex&lt;&gt;</TT>.
+</P>
+
+
+<!-- ####################################################### -->
+<HR>
+<H1>Contents</H1>
+<UL>
+ <LI><A HREF="#1">Topic</A>
+ <LI><A HREF="#2">Topic</A>
+</UL>
+
+<HR>
+
+<!-- ####################################################### -->
+
+<H2><A NAME="1">Topic</A></H2>
+ <P>Blah.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="2">Topic</A></H2>
+ <P>Blah.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+
+
+
+<!-- ####################################################### -->
+
+<HR>
+<P CLASS="fineprint"><EM>
+Comments and suggestions are welcome, and may be sent to
+<A HREF="mailto:pme@sourceware.cygnus.com">Phil Edwards</A> or
+<A HREF="mailto:gdr@egcs.cygnus.com">Gabriel Dos Reis</A>.
+<BR> $Id: howto.html,v 1.4 1999/12/15 16:57:06 pme Exp $
+</EM></P>
+
+
+</BODY>
+</HTML>
diff --git a/libstdc++-v3/docs/27_io/howto.html b/libstdc++-v3/docs/27_io/howto.html
new file mode 100644
index 000000000000..1de9a35969ee
--- /dev/null
+++ b/libstdc++-v3/docs/27_io/howto.html
@@ -0,0 +1,346 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, egcs, g++, libg++, STL">
+ <META NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 27.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>libstdc++-v3 HOWTO: Chapter 27</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/docs/27_io/">
+<LINK REL=StyleSheet HREF="../lib3styles.css">
+<!-- $Id: howto.html,v 1.7 1999/12/15 16:57:06 pme Exp $ -->
+</HEAD>
+<BODY>
+
+<H1 CLASS="centered"><A NAME="top">Chapter 27: Input/Output</A></H1>
+
+<P>Chapter 27 deals with iostreams and all their subcomponents
+ and extensions. All <EM>kinds</EM> of fun stuff.
+</P>
+
+
+<!-- ####################################################### -->
+<HR>
+<H1>Contents</H1>
+<UL>
+ <LI><A HREF="#1">Copying a file</A>
+ <LI><A HREF="#2">The buffering is screwing up my program!</A>
+ <LI><A HREF="#3">Binary I/O</A>
+ <LI><A HREF="#4">Iostreams class hierarchy diagram</A>
+ <LI><A HREF="#5">What is this &lt;sstream&gt;/stringstreams thing?</A>
+</UL>
+
+<HR>
+
+<!-- ####################################################### -->
+
+<H2><A NAME="1">Copying a file</A></H2>
+ <P>So you want to copy a file quickly and easily, and most important,
+ completely portably. And since this is C++, you have an open
+ ifstream (call it IN) and an open ofstream (call it OUT):
+ <PRE>
+ #include &lt;fstream&gt;
+
+ std::ifstream IN ("input_file");
+ std::ofstream OUT ("output_file"); </PRE>
+ </P>
+ <P>Here's the easiest way to get it completely wrong:
+ <PRE>
+ OUT &lt;&lt; IN;</PRE>
+ For those of you who don't already know why this doesn't work
+ (probably from having done it before), I invite you to quickly
+ create a simple text file called &quot;input_file&quot; containing
+ the sentence
+ <PRE>
+ The quick brown fox jumped over the lazy dog.</PRE>
+ surrounded by blank lines. Code it up and try it. The contents
+ of &quot;output_file&quot; may surprise you.
+ </P>
+ <P>Seriously, go do it. Get surprised, then come back. It's worth it.
+ </P>
+ <HR WIDTH="60%">
+ <P>The thing to remember is that the <TT>basic_[io]stream</TT> classes
+ handle formatting, nothing else. In particular, they break up on
+ whitespace. The actual reading, writing, and storing of data is
+ handled by the <TT>basic_streambuf</TT> family. Fortunately, the
+ <TT>operator&lt;&lt;</TT> is overloaded to take an ostream and
+ a pointer-to-streambuf, in order to help with just this kind of
+ &quot;dump the data verbatim&quot; situation.
+ </P>
+ <P>Why a <EM>pointer</EM> to streambuf and not just a streambuf? Well,
+ the [io]streams hold pointers (or references, depending on the
+ implementation) to their buffers, not the actual
+ buffers. This allows polymorphic behavior on the part of the buffers
+ as well as the streams themselves. The pointer is easily retrieved
+ using the <TT>rdbuf()</TT> member function. Therefore, the easiest
+ way to copy the file is:
+ <PRE>
+ OUT &lt;&lt; IN.rdbuf();</PRE>
+ </P>
+ <P>So what <EM>was</EM> happening with OUT&lt;&lt;IN? Undefined
+ behavior, since that particular &lt;&lt; isn't defined by the Standard.
+ I have seen instances where it is implemented, but the character
+ extraction process removes all the whitespace, leaving you with no
+ blank lines and only &quot;Thequickbrownfox...&quot;. With
+ libraries that do not define that operator, IN (or one of IN's
+ member pointers) sometimes gets converted to a void*, and the output
+ file then contains a perfect text representation of a hexidecimal
+ address (quite a big surprise). Others don't compile at all.
+ </P>
+ <P>Also note that none of this is specific to o<B>*f*</B>streams.
+ The operators shown above are all defined in the parent
+ basic_ostream class and are therefore available with all possible
+ descendents.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="2">The buffering is screwing up my program!</A></H2>
+<!--
+ This is not written very well. I need to redo this section.
+-->
+ <P>First, are you sure that you understand buffering? Particularly
+ the fact that C++ may not, in fact, have anything to do with it?
+ </P>
+ <P>The rules for buffering can be a little odd, but they aren't any
+ different from those of C. (Maybe that's why they can be a bit
+ odd.) Many people think that writing a newline to an output
+ stream automatically flushes the output buffer. This is true only
+ when the output stream is, in fact, a terminal and not a file
+ or some other device -- and <EM>that</EM> may not even be true
+ since C++ says nothing about files nor terminals. All of that is
+ system-dependant. (The &quot;newline-buffer-flushing only occuring
+ on terminals&quot; thing is mostly true on Unix systems, though.)
+ </P>
+ <P>Some people also believe that sending <TT>endl</TT> down an
+ output stream only writes a newline. This is incorrect; after a
+ newline is written, the buffer is also flushed. Perhaps this
+ is the effect you want when writing to a screen -- get the text
+ out as soon as possible, etc -- but the buffering is largely
+ wasted when doing this to a file:
+ <PRE>
+ output &lt;&lt; &quot;a line of text&quot; &lt;&lt; endl;
+ output &lt;&lt; some_data_variable &lt;&lt; endl;
+ output &lt;&lt; &quot;another line of text&quot; &lt;&lt; endl; </PRE>
+ The proper thing to do in this case to just write the data out
+ and let the libraries and the system worry about the buffering.
+ If you need a newline, just write a newline:
+ <PRE>
+ output &lt;&lt; &quot;a line of text\n&quot;
+ &lt;&lt; some_data_variable &lt;&lt; '\n'
+ &lt;&lt; &quot;another line of text\n&quot;; </PRE>
+ I have also joined the output statements into a single statement.
+ You could make the code prettier by moving the single newline to
+ the start of the quoted text on the thing line, for example.
+ </P>
+ <P>If you do need to flush the buffer above, you can send an
+ <TT>endl</TT> if you also need a newline, or just flush the buffer
+ yourself:
+ <PRE>
+ output &lt;&lt; ...... &lt;&lt; flush; // can use std::flush manipulator
+ output.flush(); // or call a member fn </PRE>
+ </P>
+ <P>On the other hand, there are times when writing to a file should
+ be like writing to standard error; no buffering should be done
+ because the data needs to appear quickly (a prime example is a
+ log file for security-related information). The way to do this is
+ just to turn off the buffering <EM>before any I/O operations at
+ all</EM> have been done, i.e., as soon as possible after opening:
+ <PRE>
+ std::ofstream os (&quot;/foo/bar/baz&quot;);
+ std::ifstream is (&quot;/qux/quux/quuux&quot;);
+ int i;
+
+ os.rdbuf()-&gt;pubsetbuf(0,0);
+ is.rdbuf()-&gt;pubsetbuf(0,0);
+ ...
+ os &lt;&lt; &quot;this data is written immediately\n&quot;;
+ is &gt;&gt; i; // and this will probably cause a disk read </PRE>
+ </P>
+ <P>Since all aspects of buffering are handled by a streambuf-derived
+ member, it is necessary to get at that member with <TT>rdbuf()</TT>.
+ Then the public version of <TT>setbuf</TT> can be called. The
+ arguments are the same as those for the Standard C I/O Library
+ function (a buffer area followed by its size).
+ </P>
+ <P>A great deal of this is implementation-dependant. For example,
+ <TT>streambuf</TT> does not specify any actions for its own
+ <TT>setbuf()</TT>-ish functions; the classes derived from
+ <TT>streambuf</TT> each define behavior that &quot;makes
+ sense&quot; for that class: an argument of (0,0) turns off
+ buffering for <TT>filebuf</TT> but has undefined behavior for
+ its sibling <TT>stringbuf</TT>, and specifying anything other
+ than (0,0) has varying effects. Other user-defined class derived
+ from streambuf can do whatever they want.
+ </P>
+ <P>A last reminder: there are usually more buffers involved than
+ just those at the language/library level. Kernel buffers, disk
+ buffers, and the like will also have an effect. Inspecting and
+ changing those are system-dependant.
+ </P>
+ <P>Return <A HREF="#top">to top of page</A> or
+ <A HREF="../faq/index.html">to the FAQ</A>.
+ </P>
+
+<HR>
+<H2><A NAME="3">Binary I/O</A></H2>
+ <P>The first and most important thing to remember about binary I/O is
+ that opening a file with <TT>ios::binary</TT> is not, repeat
+ <EM>not</EM>, the only thing you have to do. It is not a silver
+ bullet, and will not allow you to use the <TT>&lt;&lt;/&gt;&gt;</TT>
+ operators of the normal fstreams to do binary I/O.
+ </P>
+ <P>Sorry. Them's the breaks.
+ </P>
+ <P>This isn't going to try and be a complete tutorial on reading and
+ writing binary files (because &quot;binary&quot; covers a lot of
+ ground), but we will try and clear up a couple of misconceptions
+ and common errors.
+ </P>
+ <P>First, <TT>ios::binary</TT> has exactly one defined effect, no more
+ and no less. Normal text mode has to be concerned with the newline
+ characters, and the runtime system will translate between (for
+ example) '\n' and the appropriate end-of-line sequence (LF on Unix,
+ CRLF on DOS, CR on Macintosh, etc). (There are other things that
+ normal mode does, but that's the most obvious.) Opening a file in
+ binary mode disables this conversion, so reading a CRLF sequence
+ under Windows won't accidentally get mapped to a '\n' character, etc.
+ Binary mode is not supposed to suddenly give you a bitstream, and
+ if it is doing so in your program then you've discovered a bug in
+ your vendor's compiler (or some other part of the C++ implementation,
+ possibly the runtime system).
+ </P>
+ <P>Second, using <TT>&lt;&lt;</TT> to write and <TT>&gt;&gt;</TT> to
+ read isn't going to work with the standard file stream classes, even
+ if you use <TT>skipws</TT> during reading. Why not? Because
+ ifstream and ofstream exist for the purpose of <EM>formatting</EM>,
+ not reading and writing. Their job is to interpret the data into
+ text characters, and that's exactly what you don't want to happen
+ during binary I/O.
+ </P>
+ <P>Third, using the <TT>get()</TT> and <TT>put()/write()</TT> member
+ functions still aren't guaranteed to help you. These are
+ &quot;unformatted&quot; I/O functions, but still character-based.
+ (This may or may not be what you want.)
+ </P>
+ <P>Notice how all the problems here are due to the inappropriate use
+ of <EM>formatting</EM> functions and classes to perform something
+ which <EM>requires</EM> that formatting not be done? There are a
+ seemingly infinite number of solutions, and a few are listed here:
+ <UL>
+ <LI>&quot;Derive your own fstream-type classes and write your own
+ &lt;&lt;/&gt;&gt; operators to do binary I/O on whatever data
+ types you're using.&quot; This is a Bad Thing, because while
+ the compiler would probably be just fine with it, other humans
+ are going to be confused. The overloaded bitshift operators
+ have a well-defined meaning (formatting), and this breaks it.
+ <LI>&quot;Build the file structure in memory, then <TT>mmap()</TT>
+ the file and copy the structure.&quot; Well, this is easy to
+ make work, and easy to break, and is pretty equivalent to
+ using <TT>::read()</TT> and <TT>::write()</TT> directly, and
+ makes no use of the iostream library at all...
+ <LI>&quot;Use streambufs, that's what they're there for.&quot;
+ While not trivial for the beginner, this is the best of all
+ solutions. The streambuf/filebuf layer is the layer that is
+ responsible for actual I/O. If you want to use the C++
+ library for binary I/O, this is where you start.
+ </UL>
+ </P>
+ <P>How to go about using streambufs is a bit beyond the scope of this
+ document (at least for now), but while streambufs go a long way,
+ they still leave a couple of things up to you, the programmer.
+ As an example, byte ordering is completely between you and the
+ operating system, and you have to handle it yourself.
+ </P>
+ <P>Deriving a streambuf or filebuf
+ class from the standard ones, one that is specific to your data
+ types (or an abstraction thereof) is probably a good idea, and
+ lots of examples exist in journals and on Usenet. Using the
+ standard filebufs directly (either by declaring your own or by
+ using the pointer returned from an fstream's <TT>rdbuf()</TT>)
+ is certainly feasible as well.
+ </P>
+ <P>One area that causes problems is trying to do bit-by-bit operations
+ with filebufs. C++ is no different from C in this respect: I/O
+ must be done at the byte level. If you're trying to read or write
+ a few bits at a time, you're going about it the wrong way. You
+ must read/write an integral number of bytes and then process the
+ bytes. (For example, the streambuf functions take and return
+ variables of type <TT>int_type</TT>.)
+ </P>
+ <P>Another area of problems is opening text files in binary mode.
+ Generally, binary mode is intended for binary files, and opening
+ text files in binary mode means that you now have to deal with all of
+ those end-of-line and end-of-file problems that we mentioned before.
+ An instructive thread from comp.lang.c++.moderated delved off into
+ this topic starting more or less at
+ <A HREF="http://www.deja.com/getdoc.xp?AN=436187505">this</A>
+ article and continuing to the end of the thread. (You'll have to
+ sort through some flames every couple of paragraphs, but the points
+ made are good ones.)
+ </P>
+
+<HR>
+<H2><A NAME="4">Iostreams class hierarchy diagram</A></H2>
+ <P>The <A HREF="iostreams_hierarchy.pdf">diagram</A> is in PDF. Rumor
+ has it that once Benjamin Kosnik has been dead for a few decades,
+ this work of his will be hung next to the Mona Lisa in the
+ <A HREF="http://www.louvre.fr/">Musee du Louvre</A>.
+ </P>
+
+<HR>
+<H2><A NAME="5">What is this &lt;sstream&gt;/stringstreams thing?</A></H2>
+ <P>Stringstreams (defined in the header <TT>&lt;sstream&gt;</TT>)
+ are in this author's opinion one of the coolest things since
+ sliced time. An example of their use is in the Received Wisdom
+ section for Chapter 21 (Strings),
+ <A HREF="../21_strings/howto.html#1.1internal"> describing how to
+ format strings</A>.
+ </P>
+ <P>The quick definition is: they are siblings of ifstream and ofstream,
+ and they do for <TT>std::string</TT> what their siblings do for
+ files. All that work you put into writing <TT>&lt;&lt;</TT> and
+ <TT>&gt;&gt;</TT> functions for your classes now pays off
+ <EM>again!</EM> Need to format a string before passing the string
+ to a function? Send your stuff via <TT>&lt;&lt;</TT> to an
+ ostringstream. You've read a string as input and need to parse it?
+ Initialize an istringstream with that string, and then pull pieces
+ out of it with <TT>&gt;&gt;</TT>. Have a stringstream and need to
+ get a copy of the string inside? Just call the <TT>str()</TT>
+ member function.
+ </P>
+ <P>This only works if you've written your
+ <TT>&lt;&lt;</TT>/<TT>&gt;&gt;</TT> functions correctly, though,
+ and correctly means that they take istreams and ostreams as
+ parameters, not i<B>f</B>streams and o<B>f</B>streams. If they
+ take the latter, then your I/O operators will work fine with
+ file streams, but with nothing else -- including stringstreams.
+ </P>
+ <P>If you are a user of the strstream classes, you need to update
+ your code. You don't have to explicitly append <TT>ends</TT> to
+ terminate the C-style character array, you don't have to mess with
+ &quot;freezing&quot; functions, and you don't have to manage the
+ memory yourself. The strstreams have been officially deprecated,
+ which means that 1) future revisions of the C++ Standard won't
+ support them, and 2) if you use them, people will laugh at you.
+ </P>
+
+
+<!-- ####################################################### -->
+
+<HR>
+<P CLASS="fineprint"><EM>
+Comments and suggestions are welcome, and may be sent to
+<A HREF="mailto:pme@sourceware.cygnus.com">Phil Edwards</A> or
+<A HREF="mailto:gdr@egcs.cygnus.com">Gabriel Dos Reis</A>.
+<BR> $Id: howto.html,v 1.7 1999/12/15 16:57:06 pme Exp $
+</EM></P>
+
+
+</BODY>
+</HTML>
+
+
diff --git a/libstdc++-v3/docs/27_io/iostreams_hierarchy.pdf b/libstdc++-v3/docs/27_io/iostreams_hierarchy.pdf
new file mode 100644
index 000000000000..ab8891300174
--- /dev/null
+++ b/libstdc++-v3/docs/27_io/iostreams_hierarchy.pdf
@@ -0,0 +1 @@
+%PDF-1.2 1 0 obj << /Type /Catalog /Pages 2 0 R >> endobj 2 0 obj << /Type /Pages /Count 1 /Kids [3 0 R] >> endobj 3 0 obj << /Type /Page /Parent 2 0 R /MediaBox [0 0 841 595] /Resources 4 0 R /Contents 5 0 R /PieceInfo << /Illustrator7.0 << /LastModified (D:19990723224941+00'00') >> >> >> endobj 4 0 obj << /ProcSet [/PDF /Text] /Font 6 0 R >> endobj 6 0 obj << /F0 7 0 R >> endobj 5 0 obj << /Length 4532 /Filter [/ASCII85Decode /FlateDecode] >> stream GhUtXCMt.N(B"F5&+aY/@Qi]I;%s0lBq&tK!K+"a/W^0g,*/;JNiYL/lXkYFSkBQ+3$VRLAAp6[+Gk2p ]Y$V'q][Ii0`9nKmh=9$qUafIYES-6c9>:0iiB70cd1lN;\^Z5B(On5=3Kp1o4O9Ms/FWC4.r(nFZ"ID e#N8>Y&;s3hk&Gh=oPY>g/R7S`N35&lSnKGJT'N#f3]=I^3Ma7p@ZTLj1W%,c`?_IA&WBR:iYE0/De,) .5tSk?gUfI?gLVJ]B-%RhCB-/&1(hF(H3"13[7AhH6TkcV(T9#\l_XZ&A6prLn^=89]&sO]lO>H;AgG. E*Ffh#_X%&%CJ$hiAQ5#<*ID"b0kT-./,#D&_iK%9J/jH(%lNWYDLdVe&3s]TMfhIS&j#;9I<#\Qb$,7 OX=,>d],8TWGK,=QAXgt=(NL2B`c5r3!;DaCQfNY@HgI98u#(\L+TN8Jl%5*BSV6Z6K9q_Z)(MW:'d`5 CE&^O_Q6P>1m6SXTkQu$46r]!#A8?WKTu\^;IZ(1X`PciW(Q<b9St7$/PmuU"7IFkTf`i@74CZoOg3Q4 -8JdE-Z-UV=F1^S;CfZ6i]+-?S+NOUXBQ[Dd518[C6_gi.RoYa)O&0`>+Lf.<gc3TB7-S8&)o[FGYO:: ROcia<mnX-AkF_'d\6cMjd6.P77UNM>k&6r_R]!C16>/_7.8)ebcN7*<XRq/lq9#dMG&X8*Q+n-"f)Ct -Kq%oVLtt$I/;]D9[N[YMr&Eh1B@i&+(p[L)[%tYK9S&K1_Hg1Yi-H-(2%&c9S,gb6]4hFgU,<m8ak^' ]&^\fXYV8%JH:k*9@#q'?5aFKgm/kELN*O!2P_EA>qjii`eZi1/lL%Sq>dU+ngdD%eur2Ir!M];qA%XP nggM_lW7J!bTqU+1.e,$hd?==gUobOrnIVuqu)sI^0ESJMlYEI^7K1Boq03mjIdgC#]cL-`Mp(D""BX_ 4*ghojioIOq<!)+9$kKa4aA(PrNiLWherkKe6">^$>j-UD`2S$S<loOa*;@3KdYd%KD.'N1@Q=$`*"6! kjVmbD0",E36[]"]n?fB5Im5q3(%r#]Kg"1bi1b_Z<Ws8C9FVsN<L+]Aeuu;nG8U4<F<J4Xl@f./1:6d RN-)+R8\#qj_oST,)[7?B^=.l"1R-L\cseQ$t8Qc1gn;U`IppE4NlE=EL]_%+04(?I<A]"9tY9IH?6Bk (*B!uVYY%"?-]$]W9(]h-\!eHB?qi>)U@SX26/\%YFiKkq]SH'UgFsDKYc3pK<*th-hCrY?5N'BlZta# XuECr[WqMT*<R;XFsjE=npN%^gU$D,I=)FbGjJWIeGC!tSAW.O,`$ik"&/oI#fc)9H!D#6Vt1f?1Gk5I %SXh"[=r[>BHe=_R7LH*hKeO"[W?DCL1*,ub^MT0XZm%bleOB\KK]eSSfp?Yd)Uop%!fsF5729u=_ZrQ 5i@n<m],H'\"P75)O[4Z+pK$V!DNWWo`1*$34aQ%3bC^nrh2D/)$>/UVhOk%R==$MqJL_I=6iS#FhP;d 2Ufpk&(MK2D4[<sGN*=iZh);\o_%i#4skNYE2RAkl9hV^#j_>:eTU]13N@h:pI!M%FR(1,0_QrEs+Q$' Yn2o%b82KoY(S\8Pd88GM)kr+\o3H%i1p+NQ0K1E_t@s\pi$i7GVkCc"r:[KJu^'S\<74km['*s#_\Ft dMtM_6;h@h@Xq':.(O*fP^rU]N.D+#-m,3igY6dHDAg)`Pc^^`PkR6[#7dB$&m<*P$o:\9>RPgW*&XO: =AJ*0Yqp!^F@ld:d@mtqV%U&G7$WCp^tP0cWR`Fi\,aRdr7U!:Cd_.&3$"/Ee0;p&J8WO>BkO<5Vi34m 7O=jKMcj^c`DsuQ7&c/HYmi"_5%_(>kr8t6*NoP5:e2bi&TMLFZW[O#aDk322g:'@0^j[o+dY&WH1=bO .5iY75"c']o1"[T&)?Y&?^*Q!WeRT]g9Bo\<d53IJhS3cr>ocqOAgR@"4h\b^tXf)'7dPL?<H=$+Srn# ="i0(KYM9FHTj.M/_<JuH)E&n\.i2$`O.",IDpWK\0t6@2,q>>[(>+T4=g/*U.0cD''>im=>33CX'CB; 3GJX7QE_7QK=<L:/&BrJ<n,j@q0[Jk]NAu&Rb?eK8),?aISm<$mepQoc0KMc]K003%B[GFhQop>04O^T Y;TT?I\&I@q5g"@TW[#C->uYV^H=klN'`Do:g44"6nm6Tr-GXCpaIu4.!A.l99YQFY7\B@RsIqM*r$L: ctp+YI=*i@S[\K\R_G:Lc+D[,GNc9fCo]L5+7FWa0\DE`.,n0-oYYaG;[jClT-,@fT`A!.$l0]d70>8& B2h**HZlu[*6;P:D\9*7o*f:V!7OpNp^k&9^Du'>a!=G06qosuDO;9WG&PPrhd'UE_5!QLVIXN?3kefN S)$62YNh%W3oAP7T>L9OFFLoL5jrpIjTBg1<sNNT6sBEeeZ&EJFJnPN.%c+XQX;@0<*,">q$o2*oE"*" #MjR0VX;"P?T^dW4f?oH[02C`1F3P*&bn;/$"54+HToa31o9QYBA4E2-MB,p)'7MA_4rcY8H<DjkL:dX j9>6p,*>Ye>MJNe+i?d8NU3c;RgeDM[M7b&\Egn`&g8I+]ePi'UB=X/WH9dDIHtH)X`qkOd%N"&E`qe= ?C"#SYq<"D#I:GXRB6%_QXsi[BhMK^%V-HR10NkrJK&KaWXQnDou/BF*pHQ#n3ORHThoac+*Yb"dV.30 jM4,s=K)(LjAZbj$uIba,:_-`>WX14KH.\GNa%Z91hBVdEouFiBIfLZe'R<"m*r.u[Ss*f^o-97="l59 0;]h"VcRV69',:O:;V@O.ZV.TM.$^-En$cc=3ej,]p"PO[r*65)<Akl+ORFG-bI'=n[/%7F4LUXV0#IQ ql$T9.S:VbVF--?M'4_AgkF+e\.Wt</Z7(pVok:NEb&0'O%:&6O[V%Zp/4r\7j/7Yf:-r*Ki`,)P:\@I Zl,NU49g3Y@laoZ\q`1!d>!\T8[RDOPr?f5mpc-H830fjj?mOD&V2fGJ0;nXLjUYB7S;iW!$qjV;3)2" +p6_sKT,_'lJH#s.$JZoaCQVu3UpW/oCrX:X4?e;6^Bu\FcMQ*oIXa_hQd'=>[o[^$SJ%Da5fBUpW2&o rR<tr#:AjCh7HL>RU_+s_\t&T5Y`>dV]'S-k@"Q_kM?n_.I&4da\chQkMCLk)1%@f4\9GX#!HfnpZSEd 5B4@A0t)n-ciJ-WAjb9Ai!?.?F9;/<=hf^D5%cfket6q?T``S$NEX'@qD/F@qIuIR-.3o33<0"0Z2*C& ](Tdo:@SsHBq*3gY@lfrQ[90l\$q+^c-^g0-3t+"EZa%<[+CI;?,F"&F!tPGJGBK!YuEtS^Mj9R"Iekj ftBa(*OOrY;2DU%`o3kZF#L!cVp0<t&eN:--adY9So2.aS']$kd1+ntV+UsJnIg/UUOu9/M0QLqLGS4$ EpkuEa/iKk"\.Zg:5%)@-1JLiA8%1%FK^6EDUW<+&<MGJ)YkiL(a0h1"l7)I;G&mVE3"u+`sk\s#s,Lr [%Tl("F3&o0X*Pf1UJ$mFT&51K1nUmhJM8C1eg&(=E&i4/(G;n9<^n>L-BKO8n.PU;?r:TE:TE=Ug9K7 !N&L88e(4u=W"i,"cZ<e\#p0['CYG,RQ-#1?mM<ronm.,$#KmF$>?qFSk8.n>E?ad$qUprd3T>7CH16s 4(],a>iE0c7#WqRT.IqDUJll/WsBaY+eHbLpWU#QjTQ0aoa,:UJ=/+5M2!W7E1fE,-t0eH+m<,]+hjGn M'aa8<X=08/S5-G;BsL72iK\X-9>e_U[@eh1I)Cd!4MWnHO2i]&!)gJ`E;)5'Y;lfW-c`Rrm<RGq'./q a*/kcA@NMrM,A+(N"k`2-36dK.,G#\;OkqkV%>h7SCpj.DWjc(`,PSO_oPJbKPG/RJ<c/]ku95/UE47V W2?UPd=Q]G*I&[K[^'EL@XQd1r]Mppe4k,k]#.[uj6`%0C6ID/WV/>6HG&htqbr484ODB,["l69o4n9F i)8b-L%'&bR!>dH;\*!YB"Io8>$Wu.S,QU.iO`0ZY;Mu(')F>_.g?f&Kq^t6a\op<%ifGI2?T1@\fU<N AeKF^p;kt"='2%(Z;G$.FcPt48<3+;0+N$&<4!j=Q,BqL-Gkfno7QW;[HHUra6`$f!)@SU;a@/.VtA.n qUq+gU:!t;Z16Xi]'S^YEej4SdqqPqIac-]&#Zr/\s/F3ok6-H+iqZMk*^`0]SA.8Z92tB+Oa:`.GjYX l5=8#a4F:*m%H^]i`2^=n3RYmPG`I)FnF.\,9.kG&U1dEMH=i'm`H!AjDqim@Z_=aphJkL*M=8;V2eVq i?cA_"IW<6[=gFu8j@%jlI&HHK7FBCeZgG554#Lg.WMC0qXc%@n>!E4Q_?<[Fg&Df40DH29ln?<1(*I( *NMEfeVDBiQ[)(Ind`qAo(c4L3/+\H8?^>$PP"*O-o0p2HN^\%3V9r`NO/"VWSQH=-iXDQ?kBF~> endstream endobj 7 0 obj << /Type /Font /Subtype /Type1 /Name /F0 /BaseFont /Helvetica /Encoding /MacRomanEncoding >> endobj xref 0 8 0000000000 65535 f 0000000009 00000 n 0000000058 00000 n 0000000115 00000 n 0000000298 00000 n 0000000384 00000 n 0000000353 00000 n 0000005005 00000 n trailer << /Root 1 0 R /Size 8 >> startxref 5113 %%EOF \ No newline at end of file
diff --git a/libstdc++-v3/docs/configopts.html b/libstdc++-v3/docs/configopts.html
new file mode 100644
index 000000000000..e511f8f86686
--- /dev/null
+++ b/libstdc++-v3/docs/configopts.html
@@ -0,0 +1,164 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="libstdc++, libstdc++-v3, egcs, g++">
+ <META NAME="DESCRIPTION" CONTENT="Configuration options for libstdc++-v3.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>libstdc++-v3 configure options</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/">
+<LINK REL=StyleSheet HREF="lib3styles.css">
+<!-- $Id: configopts.html,v 1.2 2000/03/21 03:54:40 bkoz Exp $ -->
+</HEAD>
+<BODY>
+
+<H1 CLASS="centered"><A NAME="top">Interesting <TT>configure</TT>
+options</A></H1>
+
+<P>The latest version of this document is always available at
+ <A HREF="http://sourceware.cygnus.com/libstdc++/configopts.html">
+ http://sourceware.cygnus.com/libstdc++/configopts.html</A>.
+</P>
+
+<P>To the <A HREF="index.html">libstdc++-v3 homepage</A>.
+
+
+<!-- ####################################################### -->
+<HR>
+<P>Here are some of the non-obvious options to libstdc++'s configure.
+ Keep in mind that
+ <!-- This should be the "Choosing Package Options" section. -->
+ <A HREF="http://sourceware.cygnus.com/autoconf/autoconf.html#SEC74">they
+ all have opposite forms as well</A>
+ (enable/disable and with/without). The defaults are for the latest
+ snapshot, 2.90.8.
+<DL>
+ <DT><TT>--enable-multilib </TT>[default]
+ <DD><P>This is part of the generic multilib support for building
+ cross compilers. As such, targets like "powerpc-elf" will be
+ have libstdc++ built many different ways: "-msoft-float" and
+ not, etc. A different libstdc++ will be built for each of the
+ different multilib versions. This option is on by default.
+ </P>
+
+ <DT><TT>--enable-debug </TT>
+ <DD><P>The configure script will automatically detect the highest level
+ of optimization that the compiler in use can use (certain
+ versions of g++ will ICE if given the <TT>-O2</TT> option, but
+ this is fixed in later versions of the compiler). This --enable
+ flag will disable all optimizations and instruct the compiler to
+ emit as much extra debugging information as it can, for use
+ inside GDB.
+ </P>
+
+ <DT><TT>--enable-cstdio </TT>[default]
+ <DD><P>This is an abbreviated form of <TT>'--enable-cstdio=libio'</TT>
+ (described next).
+ </P>
+
+ <DT><TT>--enable-cstdio=LIB </TT>
+ <DD><P>Select a target-specific I/O package. As of libstdc++-v3
+ snapshot 2.90.8, the choices are 'libio' to specify the GNU
+ I/O package (from
+ <A HREF="http://sourceware.cygnus.com/glibc/">glibc</A>, the
+ GNU C library), or 'wince' to specify the Microsoft Windows CE
+ library. Eventually a generic cstdio interface will be added
+ so that people who want to use libstdc++-v3 with say, the Palm
+ Pilot, will be able to use libstdc++-v3 without libio.
+ </P>
+
+ <DT><TT>--enable-long_long </TT>
+ <DD><P>The &quot;long long&quot; type was introduced in C99. It is
+ provided as a GNU extension to C++98 in g++. This flag builds
+ support for &quot;long long&quot; into the library (specialized
+ templates and the like).
+ </P>
+ <P>Careful, that's an underscore between the words, not a hyphen.
+ </P>
+
+ <DT><TT>--enable-namespaces </TT>[default]
+ <DD><P>By default, g++ currently ignores namespace <TT>std</TT> for
+ backwards compatibility. It can be turned on with the
+ <TT> -fhonor-std </TT> flag to the compiler. As of libstdc++-v3
+ snapshot 2.90.8, that flag is passed to g++ when building the
+ library. (This will eventually be the default for the compiler
+ itself.) The --disable variant will put all std:: symbols into
+ the global namespace.
+ </P>
+
+ <DT><TT>--enable-threads </TT>
+ <DD><P>This is an abbreviated form of <TT>'--enable-threads=yes'</TT>
+ (described next).
+ </P>
+
+ <DT><TT>--enable-threads=LIB </TT>
+ <DD><P>Select a threading library. As of libstdc++-v3 snapshot 2.90.8,
+ the choices are:
+ 'yes' for some kind of default (hmmmmm);
+ 'decosf1', 'irix', 'mach', 'os2', 'posix'/'pthreads'
+ (same thing),
+ 'solaris', 'win32', 'dce', or 'vxworks' to select the
+ corresponding interface;
+ and 'single', 'no', or 'none' for the null-case,
+ single-threaded library.
+ </P>
+ <P>All of this is currently undergoing a lot of changes. As of
+ 2.90.8, 'single' and 'posix' are the only implemented models.
+ </P>
+
+ <DT><TT>--enable-libgcc-rebuild=DIR / --disable-libgcc-rebuild</TT>
+ <DD><P>This is a grueling temporary hack no matter which way you look
+ at it. It's described in <A HREF="gccrebuild.html">its own
+ little page</A>. Note that other --enable flags will
+ interact with this one. As of libstdc++-v3 snapshot 2.90.8,
+ this is enabled by default, with DIR
+ set to <TT> '../..' </TT>, so that building
+ the complete GCC sources with libstdc++-v3 in place works
+ transparently.
+ </P>
+
+<!--
+ <DT><TT>--enable-func-flags=FLAGS</TT>
+ <DD><P>With this option, you can pass a string of -f (functionality)
+ flags to the compiler to use when building libstdc++. FLAGS
+ is a quoted string of options, like
+ <PRE>
+ --enable-func-flags='-fsquangle -fvtable-gc -ansi'</PRE>
+ Note that the flags don't necessarily have to all be -f flags,
+ as shown, but usually those are the ones that will make sense
+ for experimentation and configure-time overriding.
+ </P>
+ <P>The advantage of --enable-func-flags over setting CXXFLAGS in
+ the 'make' environment is that, if libgcc is automatically
+ rebuilt, the same flags will be used when compiling those files
+ as well, so that everything matches.
+ </P>
+ <P>Fun flags to try might include combinations of
+ <PRE>
+ -fstrict-aliasing
+ -fnew-abi
+ -fnew-exceptions
+ -ffunction-sections
+ -fvtable-gc</PRE>
+ and -fno- forms of the same. Tell us (the mailing list) if
+ you discover more!
+ </P>
+-->
+</DL>
+</P>
+<P>Return <A HREF="#top">to the top of the README</A> or
+ <A HREF="index.html">to the homepage</A>.
+</P>
+
+
+<!-- ####################################################### -->
+
+<HR>
+<P CLASS="fineprint"><EM>
+$Id: configopts.html,v 1.2 2000/03/21 03:54:40 bkoz Exp $
+</EM></P>
+
+
+</BODY>
+</HTML>
diff --git a/libstdc++-v3/docs/documentation.html b/libstdc++-v3/docs/documentation.html
new file mode 100644
index 000000000000..540d934f1215
--- /dev/null
+++ b/libstdc++-v3/docs/documentation.html
@@ -0,0 +1,63 @@
+
+<!--#include virtual="/libstdc++/header.html"-->
+
+
+
+<H2><A NAME="1">Introductory notes for libstdc++</A></H2>
+ <P>This is a short list of text files pertaining to this
+ implementation of ISO 14882. A brief description follows the name
+ of the file.
+ <UL>
+ <LI><A HREF="17_intro/BADNAMES">BADNAMES</A>
+ - names to avoid because of potential collisions
+ <LI><A HREF="17_intro/BUGS">BUGS</A>
+ <LI><A HREF="17_intro/C++STYLE">C++STYLE</A>
+ - coding style by example
+ <LI><A HREF="17_intro/CHECKLIST">CHECKLIST</A>
+ - a list of required features and their status.
+ <LI><A HREF="17_intro/COPYING">COPYING</A>
+ - GPL v2 license terms
+ <LI><A HREF="17_intro/DESIGN">DESIGN</A>
+ - overview of the implementation plan
+ <LI><A HREF="17_intro/HEADER_POLICY">HEADER_POLICY</A>
+ - header naming and sub-include structure
+ <LI><A HREF="17_intro/PROBLEMS">PROBLEMS</A>
+ <LI> <A HREF="../README">README</a>
+ - directory structure
+ <LI><A HREF="17_intro/RELEASE-NOTES">RELEASE-NOTES</A>
+ - instructions for building, using
+ <LI><A HREF="17_intro/TODO">TODO</A>
+ - tasks and known bugs
+ <LI><A HREF="17_intro/organization">organization</A>
+ <LI><A HREF="17_intro/contribute.html">Contributor checklist</A>
+ <LI><A HREF="17_intro/libstdc++-assign.txt">Copyright assignment form for libstdc++-v3</A>
+ </UL>
+ </P>
+
+<HR>
+<H2><A NAME="2">Configuring, Building, Installing</A></H2>
+ <UL>
+ <A HREF="configopts.html">Configuring the library</A><BR>
+ <A HREF="install.html">Install the library</A><BR>
+ <A HREF="gccrebuild.html">Rebuilding libgcc for namespaces</A><BR>
+ </UL>
+
+<HR>
+<H2><A NAME="3">Chapter-Specific Information and Advice</A></H2>
+ <OL>
+ <LI><A HREF="17_intro/howto.html">Chapter 17 (Intro)</A>
+ <LI><A HREF="18_support/howto.html">Chapter 18 (Library Support)</A>
+ <LI><A HREF="19_diagnostics/howto.html">Chapter 19 (Diagnostics)</A>
+ <LI><A HREF="20_util/howto.html">Chapter 20 (Utilities)</A>
+ <LI><A HREF="21_strings/howto.html">Chapter 21 (Strings)</A>
+ <LI><A HREF="22_locale/howto.html">Chapter 22 (Localization)</A>
+ <LI><A HREF="23_containers/howto.html">Chapter 23 (Containers)</A>
+ <LI><A HREF="24_iterators/howto.html">Chapter 24 (Iterators)</A>
+ <LI><A HREF="25_algorithms/howto.html">Chapter 25 (Algorithms)</A>
+ <LI><A HREF="26_numerics/howto.html">Chapter 26 (Numerics)</A>
+ <LI><A HREF="27_io/howto.html">Chapter 27 (I/O)</A>
+ </OL>
+
+
+<!--#include virtual="/libstdc++/footer.html"-->
+
diff --git a/libstdc++-v3/docs/download.html b/libstdc++-v3/docs/download.html
new file mode 100644
index 000000000000..c6a834dd353e
--- /dev/null
+++ b/libstdc++-v3/docs/download.html
@@ -0,0 +1,39 @@
+
+<!--#include virtual="/libstdc++/header.html"-->
+
+
+<H3>Getting the sources by FTP or CVS</H3>
+
+<P>Get the snapshot archive from
+<BLOCKQUOTE>
+ <A HREF="ftp://sourceware.cygnus.com/pub/libstdc++/">
+ ftp://sourceware.cygnus.com/pub/libstdc++/
+ </A>
+</BLOCKQUOTE></P>
+
+<P>CVS repository available by anonymous CVS.
+ <UL>
+ <LI>cvs -z9 -d :pserver:anoncvs@sourceware.cygnus.com:/cvs/libstdc++ login
+ <LI>enter ``anoncvs'' for the password
+ <LI>cvs -z9 -d :pserver:anoncvs@sourceware.cygnus.com:/cvs/libstdc++ co libstdc++
+
+ <LI>You only need to specify the repository root the first time; after
+ that cvs will go to the correct place automatically. Using '-z9'
+ is highly recommended, as it will reduce the bandwidth required.
+
+ <LI>You can
+ <A HREF="/cgi-bin/cvsweb.cgi/libstdc++?cvsroot=libstdc++">browse
+ the CVS repository over the web</a>.
+ </UL>
+</P>
+
+<P>For those of you using Cygwin or Mingw32, you can avoid various
+ <A HREF="faq/index.html#3_2">problems building the library</A> by using
+ prebuilt binaries of snapshots from Mumit Khan's
+ <A HREF="http://www.xraylith.wisc.edu/~khan/software/gnu-win32/libstdc++-v3.html">Cygwin pages</A>.
+</P>
+
+
+
+<!--#include virtual="/libstdc++/footer.html"-->
+
diff --git a/libstdc++-v3/docs/faq/index.html b/libstdc++-v3/docs/faq/index.html
new file mode 100644
index 000000000000..12c7b3d0546e
--- /dev/null
+++ b/libstdc++-v3/docs/faq/index.html
@@ -0,0 +1,672 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="libstdc++, libstdc++-v3, egcs, g++, libg++, STL">
+ <META NAME="DESCRIPTION" CONTENT="FAQ for the GNU libstdc++ effort.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>libstdc++-v3 FAQ</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/">
+<LINK REL=StyleSheet HREF="../lib3styles.css">
+<!--
+ ** Locations of "the most recent snapshot is the Nth" text are
+ ** answers 1_1, 1_4, 4_1, 5_6.
+-->
+<!-- $Id: index.html,v 1.21 2000/03/26 03:44:35 pme Exp $ -->
+</HEAD>
+<BODY>
+
+<H1 CLASS="centered">libstdc++ Frequently Asked Questions</H1>
+
+<P>The latest version of this document is always available at
+<A HREF="http://sourceware.cygnus.com/libstdc++/faq/index.html">
+http://sourceware.cygnus.com/libstdc++/faq/</A>.</P>
+
+<P>To the <A HREF="../index.html">libstdc++-v3 homepage</A>.
+
+<!-- ####################################################### -->
+<HR>
+<H1>Questions</H1>
+<OL>
+ <LI><A HREF="#1_0">General Information</A>
+ <!-- I suspect these will mostly be links to/into existing documents. -->
+ <OL>
+ <LI><A HREF="#1_1">What is libstdc++-v3?</A>
+ <LI><A HREF="#1_2">Why should I use libstdc++?</A>
+ <LI><A HREF="#1_3">Who's in charge of it?</A>
+ <LI><A HREF="#1_4">How do I get libstdc++?</A>
+ <LI><A HREF="#1_5">When is libstdc++ going to be finished?</A>
+ <LI><A HREF="#1_6">How do I contribute to the effort?</A>
+ <LI><A HREF="#1_7">What happened to libg++? I need that!</A>
+ <LI><A HREF="#1_8">What if I have more questions?</A>
+ </OL>
+
+ <LI><A HREF="#2_0">Installation</A>
+ <OL>
+ <LI><A HREF="#2_1">How do I install libstdc++-v3?</A>
+ <LI><A HREF="#2_2">Is this a drop-in replacement for the
+ libstdc++ that's shipped with g++?</A>
+ <LI><A HREF="#2_3">What is this CVS thing that you keep
+ mentioning?</A>
+ <LI><A HREF="#2_4">How do I know if it works?</A>
+ </OL>
+
+ <LI><A HREF="#3_0">Platform-Specific Issues</A>
+ <OL>
+ <LI><A HREF="#3_1">Can libstdc++-v3 be used with &lt;my
+ favorite compiler&gt;?</A>
+ <LI><A HREF="#3_2">Building under Cygwin hangs/explodes!?</A>
+ </OL>
+
+ <LI><A HREF="#4_0">Known Bugs and Non-Bugs</A>
+ <OL>
+ <LI><A HREF="#4_1">What works already?</A>
+ <LI><A HREF="#4_2">Bugs in gcc/g++ (not libstdc++-v3)</A>
+ <LI><A HREF="#4_3">Bugs in the C++ language/lib specification</A>
+ <LI><A HREF="#4_4">Things in libstdc++ that look like bugs</A>
+ <LI><A HREF="#4_5">Aw, that's easy to fix!</A>
+ </OL>
+
+ <LI><A HREF="#5_0">Miscellaneous</A>
+ <OL>
+ <LI><A HREF="#5_1">string::iterator is not char*;
+ vector&lt;T&gt;::iterator is not T*</A>
+ <LI><A HREF="#5_2">What's next after libstdc++-v3?</A>
+ <LI><A HREF="#5_3">What about the STL from SGI?</A>
+ <LI><A HREF="#5_4">Extensions and Backward Compatibility</A>
+ <LI><A HREF="#5_5">Compiling with &quot;-fnew-abi&quot;</A>
+ <LI><A HREF="#5_6">Is libstdc++-v3 thread-safe?</A>
+ <LI><A HREF="#5_7">How do I get a copy of the ISO C++ Standard?</A>
+ </OL>
+
+</OL>
+
+<HR>
+
+<!-- ####################################################### -->
+
+<H1><A NAME="1_0">1.0 General Information</A></H1>
+<!-- I suspect these will mostly be links to/into existing documents. -->
+ <H2><A NAME="1_1">1.1 What is libstdc++-v3?</A></H2>
+ <P>The GNU Standard C++ Library v3, or libstdc++-2.90.x, is an
+ ongoing project to implement the ISO 14882 Standard C++ library
+ as described in chapters 17 through 27 and annex D. As the
+ library reaches stable plateaus, it is captured in a snapshot
+ and released. The current release is <A
+HREF="ftp://sourceware.cygnus.com/pub/libstdc++/libstdc++-2.90.8.tar.gz">the
+ ninth snapshot</A>. For those who want to see exactly how
+ far the project has come, or just want the latest
+ bleeding-edge code, the up-to-date source is available over
+ anonymous CVS, and can even be browsed over the Web (see below).
+ </P>
+ <P>A more formal description of the V3 goals can be found in the
+ official <A HREF="../17_intro/DESIGN">design document</A>.
+ </P>
+
+<HR>
+ <H2><A NAME="1_2">1.2 Why should I use libstdc++?</A></H2>
+ <P>The recent completion of the ISO C++ standardization gave the
+ C++ community a powerful set of reuseable tools in the form
+ of the C++ Standard Library. However, all existing C++
+ implementations are (as the Draft Standard used to say)
+ &quot;incomplet and incorrekt,&quot; and many suffer from
+ limitations of the compilers that use them.
+ </P>
+ <P>The GNU C/C++/FORTRAN/&lt;pick-a-language&gt; compiler
+ (<TT>gcc</TT>, <TT>g++</TT>, etc) is widely considered to be
+ one of the leading compilers in the world. Its development
+ has recently been taken over by the
+ <A HREF="http://egcs.cygnus.com/">GCC team</A>. All of
+ the rapid development and near-legendary
+ <A
+HREF="http://egcs.cygnus.com/gcc-2.95/buildstat.html">portability</A>
+ that are the hallmarks of an open-source project are being
+ applied to libstdc++.
+ </P>
+ <P>That means that all of the Standard classes and functions
+ (such as <TT>string</TT>, <TT>vector&lt;&gt;</TT>, iostreams,
+ and algorithms) will be freely available and fully compliant.
+ Programmers will no longer need to &quot;roll their own&quot;
+ nor be worried about platform-specific incompatabilities.
+ </P>
+
+<HR>
+ <H2><A NAME="1_3">1.3 Who's in charge of it?</A></H2>
+ <P>The libstdc++ project is contributed to by several developers
+ all over the world, in the same way as GCC (EGCS) or Linux.
+ Benjamin Kosnik, Gabriel Dos Reis, Nathan Myers, and Ulrich
+ Drepper are the lead maintainers of the CVS archive.
+ </P>
+ <P>Development and discussion is held on the libstdc++ mailing
+ list. Subscribing to the list, or searching the list
+ archives, is open to everyone. You can read instructions for
+ doing so on the <A HREF="../index.html">homepage</A>. If you
+ have questions, ideas, code, or are just curious, sign up!
+ </P>
+
+<HR>
+ <H2><A NAME="1_4">1.4 How do I get libstdc++?</A></H2>
+ <P>The ninth (and latest) snapshot of libstdc++-v3 is <A
+HREF="ftp://sourceware.cygnus.com/pub/libstdc++/libstdc++-2.90.8.tar.gz">
+ available via ftp</A>.
+ </P>
+ <P>The <A HREF="../index.html">homepage</A>
+ has instructions for retrieving the latest CVS sources, and for
+ browsing the CVS sources over the web.
+ </P>
+ <P>The subset commonly known as the Standard Template Library
+ (chapters 23 through 25, mostly) is adapted from the SGI STL,
+ which is also an ongoing work.<!-- Possibly a link to SGI's
+ STL here. -->
+ </P>
+
+<HR>
+ <H2><A NAME="1_5">1.5 When is libstdc++ going to be finished?</A></H2>
+ <P>Nathan Myers gave the best of all possible answers in <A
+ HREF="http://www.deja.com/getdoc.xp?AN=469581698&fmt=text">a
+ recent Usenet article</A>.</P>
+
+<HR>
+ <H2><A NAME="1_6">1.6 How do I contribute to the effort?</A></H2>
+ <P>Here is <A HREF="../17_intro/contribute.html">a
+ page devoted to this topic</A>. Subscribing to the mailing
+ list (see above, or the homepage) is a very good idea if you
+ have something to contribute, or if you have spare time and
+ want to help. Contributions don't have to be in the form of
+ source code; anybody who is willing to help write
+ documentation, for example, or has found a bug in code that
+ we all thought was working, is more than welcome!
+ </P>
+
+<HR>
+ <H2><A NAME="1_7">1.7 What happened to libg++? I need that!</A></H2>
+ <P>The most recent libg++ README states that libg++ is no longer
+ being actively maintained. It should not be used for new
+ projects, and is only being kicked along to support older code.
+ </P>
+ <P>The libg++ was designed and created when there was no Standard
+ to provide guidance. Classes like linked lists are now provided
+ for by <TT>list&lt;T&gt;</TT> and do not need to be created by
+ <TT>genclass</TT>. (For that matter, templates exist now and
+ are well-supported, whereas genclass (mostly) predates them.)
+ </P>
+ <P>There are other classes in libg++ that are not specified in the
+ ISO Standard (e.g., statistical analysis). While there are a
+ lot of really useful things that are used by a lot of people
+ (e.g., statistics :-), the Standards Committee couldn't include
+ everything, and so a lot of those &quot;obvious&quot; classes
+ didn't get included.
+ </P>
+ <P>Since libstdc++ is an implementation of the Standard Library, we
+ have no plans at this time to include non-Standard utilities
+ in the implementation, however handy they are. (The extensions
+ provided in the SGI STL aren't maintained by us and don't get
+ a lot of our attention, because they don't require a lot of our
+ time.) It is entirely plausable that the &quot;useful stuff&quot;
+ from libg++ might be extracted into an updated utilities library,
+ but nobody has stated such a project yet.
+ </P>
+ <!-- The advertisement, so to speak, might have to go. Hmmmmm. -->
+ <P>(The <A HREF="http://www.boost.org/">Boost</A> site houses free
+ C++ libraries that do varying things, and happened to be started
+ by members of the Standards Committee. Certain &quot;useful
+ stuff&quot; classes will probably migrate there.)
+ </P>
+ <P>For the bold and/or desperate, the
+ <A HREF="http://egcs.cygnus.com/faq.html#libg++">GCC FAQ</A>
+ describes where to find the last libg++ source.
+ </P>
+
+<HR>
+ <H2><A NAME="1_8">1.8 What if I have more questions?</A></H2>
+ <P>If you have read the README and RELEASE-NOTES files, and your
+ question remains unanswered, then just ask the mailing list.
+ At present, you do not need to be subscribed to the list to
+ send a message to it. More information is available on the
+ homepage (including how to browse the list archives); to send
+ to the list, use <A HREF="mailto:libstdc++@sourceware.cygnus.com">
+ <TT>libstdc++@sourceware.cygnus.com</TT></A>.
+ </P>
+ <P>If you have a question that you think should be included here,
+ or if you have a question <EM>about</EM> a question/answer here,
+ contact <A HREF="mailto:pme@sourceware.cygnus.com">Phil Edwards</A>
+ or <A HREF="mailto:gdr@egcs.cygnus.com">Gabriel Dos Reis</A>.
+ </P>
+
+<HR>
+
+<H1><A NAME="2_0">2.0 Installation</A></H1>
+ <H2><A NAME="2_1">2.1 How do I install libstdc++-v3?</A></H2>
+ <P>Complete instructions are not given here (this is a FAQ, not
+ an installation document), but the tools required are few:
+ <UL>
+ <LI> A release of libstdc++.
+ <LI> A recent release of GCC (version 2.95 works). Note
+ that building GCC is much easier and more automated
+ than building the GCC 2.[78] series was.
+ <LI> If you plan on hacking around with the makefiles, you
+ will need the tools <A
+HREF="http://sourceware.cygnus.com/autoconf/">autoconf</A>and <A
+HREF="http://sourceware.cygnus.com/automake/">automake</A>.
+ <LI> GNU Make is the only make that supports these makefiles.
+ </UL>
+ </P>
+ <P>The file <A HREF="../documentation.html">documentation.html</A>
+ provides a good overview of the steps necessary to build, install,
+ and use the library. Instructions for configuring the library
+ with new flags such as --enable-threads are there also.
+ </P>
+ <P>The top-level install.html and
+ <A HREF="../17_intro/RELEASE-NOTES">RELEASE-NOTES</A> files contain
+ the exact build and installation instructions. You may wish to
+ browse those files over CVSweb ahead of time to get a feel for
+ what's required. RELEASE-NOTES is located in the
+ &quot;.../docs/17_intro/&quot; directory of the distribution.
+ </P>
+
+<HR>
+ <H2><A NAME="2_2">2.2 Is this a drop-in replacement for the
+ libstdc++ that's shipped with g++?</A></H2>
+ <P>Yes, as of 2.90.8, it is intended as such.</P>
+ <P>The installation instructions cover this in more detail, but
+ replacing the older library requires rebuilding some of the
+ code that comes with g++. If you do not want to do that,
+ then you'll be missing out on a lot of functionality, but it
+ can still be done.
+ </P>
+ <P>In that case, you can use the same procedure that used to be
+ required:
+ <OL>
+ <LI> Build GCC as usual.
+ <LI> Build libstdc++-v3 as described in the installation
+ document, under the section &quot;without GCC
+ sources.&quot; Be aware that you will lose the std::
+ namespace encapsulation.
+ <LI> Build your code using -I and -L options so that GCC
+ finds the libstdc++-v3 headers and library before the
+ older headers in the GCC include tree.
+ </OL>
+ </P>
+ <P>If you configured libstdc++-v3 to install under a directory
+ called <B>/lib3</B>, for example, the command line would look
+ something like
+ <!-- Careful, the leading spaces in PRE show up directly. -->
+ <PRE>
+ g++ -Wall -I/lib3/include/g++-v3 -L/lib3/lib foo.cc -o foo
+ </PRE>
+ More information (such as using SGI or GNU extensions, and
+ setting the runtime library path) can be found in the RELEASE-NOTES.
+ </P>
+
+<HR>
+ <H2><A NAME="2_3">2.3 What is this CVS thing that you
+ keep mentioning?</A></H2>
+ <P>The <EM>Concurrent Versions System</EM> is one of several
+ revision control packages. It was selected for GNU projects
+ because it's free and very high quality. The <A
+ HREF="http://www.gnu.org/software/cvs/cvs.html">CVS entry in
+ the GNU software catalogue</A> has a better description as
+ well as a <A HREF="http://www.cyclic.com/">link to the makers
+ of CVS</A>.
+ </P>
+ <P>The &quot;anonymous client checkout&quot; feature of CVS is
+ similar to anonymous FTP in that it allows anyone to retrieve
+ the latest libstdc++ sources.
+ </P>
+ <P>After the first of April, American users will have a
+ &quot;/pharmacy&quot; command-line option...
+ <!-- wonder how long that'll live -->
+ </P>
+
+<HR>
+ <H2><A NAME="2_4">2.4 How do I know if it works?</A></H2>
+ <P>libstdc++-v3 comes with its own testsuite. You do not need
+ to actually install the library (&quot;<TT>gmake
+ install</TT>&quot;) to run the testsuite.
+ </P>
+ <P>To run the testsuite on the library after building it, use
+ &quot;gmake check&quot; while in your build directory. To run
+ the testsuite on the library after building and installing it,
+ use &quot;gmake check-install&quot; instead.
+ </P>
+ <P>The testsuite subdirectory in your build directory will then
+ contain three files of the form YYYYMMDD-mkcheck*.txt. One of
+ them (-mkcheck.txt itself) contains the results of the tests;
+ this can be mailed to the list. The other files (-mkchecklog.txt
+ and -mkcheckfiles.txt) contain messages from the compiler while
+ building the test programs, and a list of the tests to be run,
+ respectively.
+ </P>
+ <P>If you are using the libgcc.a-rebuilding method to enable std::
+ you might find that the testsuite starts dying with nasty linker
+ errors. This is symptomatic of the rebuilt libgcc.a not being
+ installed; the previous one is still in use.
+ </P>
+ <P>If you find bugs in the testsuite programs themselves, or if
+ you think of a new test program that should be added to the
+ suite, <B>please</B> write up your idea and send it to the list!
+ </P>
+
+<HR>
+<H1><A NAME="3_0">3.0 Platform-Specific Issues</A></H1>
+ <H2><A NAME="3_1">3.1 Can libstdc++-v3 be used with &lt;my
+ favorite compiler&gt;?</A></H2>
+ <P>Probably not. Yet.</P>
+ <P>Because GCC advances so rapidly, development and testing of
+ libstdc++ is being done almost entirely under that compiler.
+ If you are curious about whether other, lesser compilers
+ (*grin*) support libstdc++, you are more than welcome to try.
+ Configuring and building the library (see above) will still
+ require certain tools, however. Also keep in mind that
+ <EM>building</EM> libstdc++ does not imply that your compiler
+ will be able to <EM>use</EM> all of the features found in the
+ C++ Standard Library.
+ </P>
+ <P>Since the goal of ISO Standardization is for all C++
+ implementations to be able to share code, the final libstdc++
+ should, in theory, be useable under any ISO-compliant
+ compiler. It will still be targeted and optimized for
+ GCC/g++, however.
+ </P>
+
+<HR>
+ <H2><A NAME="3_2">3.2 Building under Cygwin hangs/explodes!?</A></H2>
+ <P>Sometimes, yes. You're probably in the middle of generating
+ the <TT>numeric_limits</TT> specializations when it hangs,
+ right? Thought so...
+ </P>
+ <P>The <TT>&lt;limits&gt;</TT> header and its associated library
+ code are platform-specific. These files get generated from
+ scratch during installation, and it is this generator that is
+ hanging. More specifically, the only sure way to determine
+ what the <TT>numeric_limits&lt;T&gt;::traps</TT> boolean
+ should be is to actually divide by zero and see if it is
+ trapped or not.
+ </P>
+ <P>Under NT, this will occasionally just hang. On those
+ occasions when the test does not hang, the zero-division is
+ in fact trapped. That doesn't prevent hanging elsewhere.
+ </P>
+ <P>You have two options.
+ You can wait until the signal-handling in Cygwin is reworked
+ and released; this is planned to take &quot;a few weeks&quot;
+ and will result in a fix sometime in late December or early January.
+ Or you can get a prebuilt set of bits/std_limits.h and
+ src/limitsMEMBERS.cc files from Mumit Khan's
+ <A HREF="http://www.xraylith.wisc.edu/~khan/software/gnu-win32/libstdc++-v3.html">Cygwin-related
+ website</A>.
+ </P>
+
+<HR>
+<H1><A NAME="4_0">4.0 Known Bugs and Non-Bugs</A></H1>
+ <EM>Note that this section can get rapdily outdated -- such is the
+ nature of an open-source project. For the latest information, join
+ the mailing list or look through recent archives. The RELEASE-
+ NOTES and BUGS files are generally kept up-to-date.</EM>
+
+ <H2><A NAME="4_1">4.1 What works already?</A></H2>
+ <P>This is a verbatim clip from the &quot;Status&quot; section
+ of the RELEASE-NOTES for the latest snapshot.
+ </P>
+
+<!-- Yeah, I meant that "verbatim clip" thing literally... :-) -->
+
+<pre>
+New:
+---
+- MT safe string. Supported CPUs are alpha, powerpc, x86, sparc32 and sparc64.
+- Configure support for --enable-threads=posix, as well as initial IO
+ locking implementation.
+- Support for native building on Solaris 2.5.1, Solaris 2.6, Solaris
+ 2.7, cygwin, [alpha, powerpc, x86]-linux, and preliminary support for
+ Irix and Aix4.2, Aix 4.3 hosts.
+- --enable-namespaces is on by default.
+- Configure and Makefile support for "drop-in" replacement to
+ libstdc++-v2 completed. It is now possible to bootstrap g++, and
+ have g++ find libstdc++-v3 headers and libraries by default.
+- Synched with CVS egcs libio.
+- Cygwin native compiling supported.
+- Cross compiling and embedded targets (newlib) with multilibs support added.
+- SGI's strstream implementation has been added.
+- Copyright on all sources assigned to the FSF.
+- Configure, build and install documentation has been added.
+- Support to enable long long has been added.
+- More valarray improvements.
+- Extractors and inserters for std::complex have been added.
+- Extractors and inserters for void* have been fixed.
+- autoconf macros are now in _GLIBCPP_ namespace.
+- group checking for num_get implemented.
+- Many, many bug fixes.
+</pre>
+
+
+<HR>
+ <H2><A NAME="4_2">4.2 Bugs in gcc/g++ (not libstdc++-v3)</A></H2>
+ <P>This is by no means meant to be complete nor exhaustive, but
+ mentions some problems that users may encounter when building
+ or using libstdc++. If you are experiencing one of these
+ problems, you can find more information on the libstdc++ and
+ the GCC mailing lists.
+ </P>
+ <UL>
+ <LI>When using associative containers (like <TT>map</TT>), and
+ compiling with <TT>-O3</TT> (or <TT>-finline-functions</TT>)
+ and <TT>-Winline</TT>, I get a zillion errors like:
+ <!-- Careful, the leading spaces in PRE show up directly. -->
+ <PRE>
+ .../include/g++/stl_tree.h: In function `int __black_count(struct __rb_tree_node_base *, struct __rb_tree_node_base *)':
+ .../include/g++/stl_tree.h:1045: warning: can't inline call to `int __black_count(struct __rb_tree_node_base *, struct __rb_tree_node_base *)'
+ .../include/g++/stl_tree.h:1053: warning: called from here
+ </PRE>
+ <P>This has been discussed a number of times; the problem
+ is that __black_count is marked inline but is also a
+ recursive function. As of 12 July 1999, it has been
+ rewritten into an optimized non-recursive form, so
+ fresh checkouts/releases should no longer see this warning.
+ (The compiler can usually figure out how to make that
+ transformation on its own.)
+ </P>
+
+ <LI>The reason that EGCS 1.1.2 cannot be used to build the
+ library is that lookups do not work properly, and so the
+ compiler will ICE when building the locale-related source
+ files. This has been fixed in GCC 2.95.
+ </UL>
+
+<HR>
+ <H2><A NAME="4_3">4.3 Bugs in the C++ language/lib specification</A></H2>
+ <P>Yes, unfortunately, there are some. In a <A
+HREF="/ml/libstdc++/1998/msg00006.html">message
+to the list</A>, Nathan Myers announced that he has started a list of
+ problems in the ISO C++ Standard itself, especially with
+ regard to the chapters that concern the library. The list
+ itself is <A
+ HREF="http://www.cantrip.org/draft-bugs.txt">posted on his
+ website</A>. Developers who are having problems interpreting
+ the Standard may wish to consult his notes.
+ </P>
+ <P>For those people who are not part of the ISO Library Group
+ (i.e., nearly all of us needing to read this page in the first
+ place :-), a public list of the library defects is occasionally
+ published <A HREF="http://anubis.dkuug.dk/jtc1/sc22/wg21/">here</A>.
+ </P>
+
+<HR>
+ <H2><A NAME="4_4">4.4 Things in libstdc++ that look like bugs</A></H2>
+ <P>There are things which are not bugs in the compiler (4.2) nor
+ the language specification (4.3), but aren't really bugs in
+ libstdc++, either. Really!
+ </P>
+ <P>The biggest of these is the quadzillions of warnings about the
+ library headers emitted when <TT>-Weffc++</TT> is used. Making
+ libstdc++ &quot;-Weffc++-clean&quot; is not a goal of the project,
+ for a few reasons. Mainly, that option tries to enforce
+ object-oriented programming, while the Standard Library isn't
+ necessarily trying to be OO. There are multiple solutions
+ under discussion.
+ </P>
+
+<HR>
+ <H2><A NAME="4_5">4.5 Aw, that's easy to fix!</A></H2>
+ <P>If you have found a bug in the library and you think you have
+ a working fix, then send it in! The main GCC site has a page
+ on <A HREF="http://egcs.cygnus.com/contribute.html">submitting
+ patches</A> that covers the procedure, but for libstdc++ you
+ should of course send the patch to our mailing list, not the
+ GCC mailing list. The libstdc++
+ <A HREF="../17_intro/contribute.html">contributors' page</A>
+ also talks about how to submit patches.
+ </P>
+ <P>In addition to the description, the patch, and the ChangeLog
+ entry, it is a Good Thing if you can additionally create a small
+ test program to test for the presence of the bug that your
+ patch fixes. Bugs have a way of being reintroduced; if an old
+ bug creeps back in, it will be caught immediately by the
+ <A HREF="#2_4">testsuite</A> -- but only if such a test exists.
+ </P>
+
+<HR>
+<H1><A NAME="5_0">5.0 Miscellaneous</A></H1>
+ <H2><A NAME="5_1">5.1 string::iterator is not char*;
+ vector&lt;T&gt;::iterator is not T*</A></H2>
+ <P>If you have code that depends on container&lt;T&gt; iterators
+ being implemented as pointer-to-T, your code is broken.
+ </P>
+ <P>While there are arguments for iterators to be implemented in
+ that manner, A) they aren't very good ones in the long term,
+ and B) they were never guaranteed by the Standard anyway. The
+ type-safety achieved by making iterators a real class rather
+ than a typedef for <TT>T*</TT> outweighs nearly all opposing
+ arguments.
+ </P>
+
+<HR>
+ <H2><A NAME="5_2">5.2 What's next after libstdc++-v3?</A></H2>
+ <P>Hopefully, not much. The goal of libstdc++-v3 is to produce
+ a fully-compliant, fully-portable Standard Library. After that,
+ we're mostly done: there won't <EM>be</EM> any more compliance
+ work to do.
+ </P>
+ <P>The ISO Committee will meet periodically to review Defect Reports
+ in the C++ Standard. Undoubtably some of these will result in
+ changes to the Standard, which will be reflected in patches to
+ libstdc++. Some of that is already happening, see 4.2.
+ </P>
+ <P>The current libstdc++ contains extensions to the Library which
+ must be explicitly requested by client code (for example, the
+ hash tables from SGI). Other extensions may be added to
+ libstdc++-v3 if they seem to be &quot;standard&quot; enough.
+ (For example, the &quot;long long&quot; type from C99.)
+ Bugfixes and rewrites (to improve or fix thread safety, for
+ instance) will of course be a continuing task.
+ </P>
+ <P><A
+HREF="http://sourceware.cygnus.com/ml/libstdc++/1999/msg00080.html">This
+ question</A> about the next libstdc++ prompted some brief but
+ interesting <A
+HREF="http://sourceware.cygnus.com/ml/libstdc++/1999/msg00084.html">speculation</A>.
+ </P>
+
+<HR>
+ <H2><A NAME="5_3">5.3 What about the STL from SGI?</A></H2>
+ <P>The <A HREF="http://www.sgi.com/Technology/STL/">STL from SGI</A>
+ is merged into libstdc++-v3 with changes as necessary.
+ Currently release 3.2 is being used. Changes in the STL
+ usually produce some weird bugs and lots of changes in the
+ rest of the libstd++ source as we scramble to keep up. :-)
+ </P>
+ <P>In particular, <TT>string</TT> is not from SGI and makes no
+ use of their &quot;rope&quot; class (which is included as an
+ optional extension), nor is <TT>valarray</TT> and some others.
+ Classes like <TT>vector&lt;&gt;</TT> are, however.
+ </P>
+ <P>The FAQ for SGI's STL (one jump off of their main page) is
+ recommended reading.
+ </P>
+
+<HR>
+ <H2><A NAME="5_4">5.4 Extensions and Backward Compatibility</A></H2>
+ <P>Although you can specify <TT>-I</TT> options to make the
+ preprocessor search the g++-v3/ext and /backward directories,
+ it is better to refer to files there by their path, as in:
+ <!-- Careful, the leading spaces in PRE show up directly. -->
+ <PRE>
+ #include &lt;ext/hash_map&gt;
+ </PRE>
+ </P>
+
+<HR>
+ <H2><A NAME="5_5">5.5 Compiling with &quot;-fnew-abi&quot;</A></H2>
+ <P>The library mostly works if you compile it (and programs you
+ link with it) using &quot;-fnew-abi -fno-honor-std&quot; on a
+ vanilla GCC compiler. However, some features, such as RTTI
+ and error handlers, might not link properly with a vanilla
+ libgcc built in GCC under the old ABI. If you rebuild libgcc
+ using the &quot;-f&quot; flags above, you can get both complete
+ language support and full benefits of -fnew-abi -- short
+ mangled symbol names, far more efficient exception handling,
+ and empty base optimization, to name a few. (Note that the
+ new ABI may change from one GCC snapshot to the next, so you
+ would have to rebuild all your libraries each time you get a
+ new compiler snapshot.)
+ </P>
+ <P>Towards the end of July 1999, this subject was brought up again
+ on the mailing list under a different name. The related
+ <A HREF="/ml/libstdc++/1999-q3/msg00066.html">thread</A>
+ (by the name HOWTO-honor-std) is very instructive. More info
+ is at the end of RELEASE-NOTES.
+ </P>
+ <P>This functionality is now automated and turned on by default.
+ </P>
+
+<HR>
+ <H2><A NAME="5_6">5.6 Is libstdc++-v3 thread-safe?</A></H2>
+ <P>Quick answer: no, as of 2.90.8 (ninth snapshot), the
+ library is not appropriate for multithreaded access. The
+ string class is MT-safe.
+ </P>
+ <P>This is assuming that your idea of &quot;multithreaded&quot;
+ is the same as ours... The general question of multithreading
+ and libstdc++-v3 is addressed in the chapter-specific advice for
+<A HREF="http://sourceware.cygnus.com/libstdc++/17_intro/howto.html#3">Library
+ Introduction</A>. Threadsafe containers are covered in
+ more detail in
+<A HREF="http://sourceware.cygnus.com/libstdc++/23_containers/howto.html">the
+ Received Wisdom section on containers</A>.
+ <!-- I have successfully evaded the topic; my work here is
+ done- no, wait, I have to write those other sections... -->
+ </P>
+
+<HR>
+ <H2><A NAME="5_7">5.7 How do I get a copy of the ISO C++ Standard?</A></H2>
+ <P>Copies of the full ISO 14882 standard are available on line
+ via the ISO mirror site for committee members. Non-members,
+ or those who have not paid for the privilege of sitting on
+ the committee and sustained their two-meeting commitment for
+ voting rights, may get a copy of the standard from their
+ respective national standards organization. In the USA,
+ this national standards organization is ANSI and their
+ website is right <A HREF="http://www.ansi.org">here</A>.
+ (And if you've already registered with them, clicking this
+ link will take you to directly to the place where you can
+<A HREF="http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+14882%2D1998">buy
+ the standard on-line</A>.
+ </P>
+ <P>Who is your country's member body? Visit the
+ <A HREF="http://www.iso.ch/">ISO homepage</A> and find out!
+ </P>
+
+<!-- ####################################################### -->
+
+<HR>
+<P CLASS="fineprint"><EM>
+Comments and suggestions are welcome, and may be sent to
+<A HREF="mailto:pme@sourceware.cygnus.com">Phil Edwards</A> or
+<A HREF="mailto:gdr@egcs.cygnus.com">Gabriel Dos Reis</A>.
+<BR> $Id: index.html,v 1.21 2000/03/26 03:44:35 pme Exp $
+</EM></P>
+
+
+</BODY>
+</HTML>
diff --git a/libstdc++-v3/docs/faq/index.txt b/libstdc++-v3/docs/faq/index.txt
new file mode 100644
index 000000000000..27c2472b897e
--- /dev/null
+++ b/libstdc++-v3/docs/faq/index.txt
@@ -0,0 +1,611 @@
+
+ #[1]home
+
+ libstdc++ Frequently Asked Questions
+
+ The latest version of this document is always available at
+ [2]http://sourceware.cygnus.com/libstdc++/faq/.
+
+ To the [3]libstdc++-v3 homepage.
+ _________________________________________________________________
+
+ Questions
+
+ 1. [4]General Information
+ 1. [5]What is libstdc++-v3?
+ 2. [6]Why should I use libstdc++?
+ 3. [7]Who's in charge of it?
+ 4. [8]How do I get libstdc++?
+ 5. [9]When is libstdc++ going to be finished?
+ 6. [10]How do I contribute to the effort?
+ 7. [11]What happened to libg++? I need that!
+ 8. [12]What if I have more questions?
+ 2. [13]Installation
+ 1. [14]How do I install libstdc++-v3?
+ 2. [15]Is this a drop-in replacement for the libstdc++ that's
+ shipped with g++?
+ 3. [16]What is this CVS thing that you keep mentioning?
+ 4. [17]How do I know if it works?
+ 3. [18]Platform-Specific Issues
+ 1. [19]Can libstdc++-v3 be used with <my favorite compiler>?
+ 2. [20]Building under Cygwin hangs/explodes!?
+ 4. [21]Known Bugs and Non-Bugs
+ 1. [22]What works already?
+ 2. [23]Bugs in gcc/g++ (not libstdc++-v3)
+ 3. [24]Bugs in the C++ language/lib specification
+ 4. [25]Things in libstdc++ that look like bugs
+ 5. [26]Aw, that's easy to fix!
+ 5. [27]Miscellaneous
+ 1. [28]string::iterator is not char*; vector<T>::iterator is not
+ T*
+ 2. [29]What's next after libstdc++-v3?
+ 3. [30]What about the STL from SGI?
+ 4. [31]Extensions and Backward Compatibility
+ 5. [32]Compiling with "-fnew-abi"
+ 6. [33]Is libstdc++-v3 thread-safe?
+ 7. [34]How do I get a copy of the ISO C++ Standard?
+ _________________________________________________________________
+
+ 1.0 General Information
+
+1.1 What is libstdc++-v3?
+
+ The GNU Standard C++ Library v3, or libstdc++-2.90.x, is an ongoing
+ project to implement the ISO 14882 Standard C++ library as described
+ in chapters 17 through 27 and annex D. As the library reaches stable
+ plateaus, it is captured in a snapshot and released. The current
+ release is [35]the ninth snapshot. For those who want to see exactly
+ how far the project has come, or just want the latest bleeding-edge
+ code, the up-to-date source is available over anonymous CVS, and can
+ even be browsed over the Web (see below).
+
+ A more formal description of the V3 goals can be found in the official
+ [36]design document.
+ _________________________________________________________________
+
+1.2 Why should I use libstdc++?
+
+ The recent completion of the ISO C++ standardization gave the C++
+ community a powerful set of reuseable tools in the form of the C++
+ Standard Library. However, all existing C++ implementations are (as
+ the Draft Standard used to say) "incomplet and incorrekt," and many
+ suffer from limitations of the compilers that use them.
+
+ The GNU C/C++/FORTRAN/<pick-a-language> compiler (gcc, g++, etc) is
+ widely considered to be one of the leading compilers in the world. Its
+ development has recently been taken over by the [37]GCC team. All of
+ the rapid development and near-legendary [38]portability that are the
+ hallmarks of an open-source project are being applied to libstdc++.
+
+ That means that all of the Standard classes and functions (such as
+ string, vector<>, iostreams, and algorithms) will be freely available
+ and fully compliant. Programmers will no longer need to "roll their
+ own" nor be worried about platform-specific incompatabilities.
+ _________________________________________________________________
+
+1.3 Who's in charge of it?
+
+ The libstdc++ project is contributed to by several developers all over
+ the world, in the same way as GCC (EGCS) or Linux. Benjamin Kosnik,
+ Gabriel Dos Reis, Nathan Myers, and Ulrich Drepper are the lead
+ maintainers of the CVS archive.
+
+ Development and discussion is held on the libstdc++ mailing list.
+ Subscribing to the list, or searching the list archives, is open to
+ everyone. You can read instructions for doing so on the [39]homepage.
+ If you have questions, ideas, code, or are just curious, sign up!
+ _________________________________________________________________
+
+1.4 How do I get libstdc++?
+
+ The ninth (and latest) snapshot of libstdc++-v3 is [40]available via
+ ftp.
+
+ The [41]homepage has instructions for retrieving the latest CVS
+ sources, and for browsing the CVS sources over the web.
+
+ The subset commonly known as the Standard Template Library (chapters
+ 23 through 25, mostly) is adapted from the SGI STL, which is also an
+ ongoing work.
+ _________________________________________________________________
+
+1.5 When is libstdc++ going to be finished?
+
+ Nathan Myers gave the best of all possible answers in [42]a recent
+ Usenet article.
+ _________________________________________________________________
+
+1.6 How do I contribute to the effort?
+
+ Here is [43]a page devoted to this topic. Subscribing to the mailing
+ list (see above, or the homepage) is a very good idea if you have
+ something to contribute, or if you have spare time and want to help.
+ Contributions don't have to be in the form of source code; anybody who
+ is willing to help write documentation, for example, or has found a
+ bug in code that we all thought was working, is more than welcome!
+ _________________________________________________________________
+
+1.7 What happened to libg++? I need that!
+
+ The most recent libg++ README states that libg++ is no longer being
+ actively maintained. It should not be used for new projects, and is
+ only being kicked along to support older code.
+
+ The libg++ was designed and created when there was no Standard to
+ provide guidance. Classes like linked lists are now provided for by
+ list<T> and do not need to be created by genclass. (For that matter,
+ templates exist now and are well-supported, whereas genclass (mostly)
+ predates them.)
+
+ There are other classes in libg++ that are not specified in the ISO
+ Standard (e.g., statistical analysis). While there are a lot of really
+ useful things that are used by a lot of people (e.g., statistics :-),
+ the Standards Committee couldn't include everything, and so a lot of
+ those "obvious" classes didn't get included.
+
+ Since libstdc++ is an implementation of the Standard Library, we have
+ no plans at this time to include non-Standard utilities in the
+ implementation, however handy they are. (The extensions provided in
+ the SGI STL aren't maintained by us and don't get a lot of our
+ attention, because they don't require a lot of our time.) It is
+ entirely plausable that the "useful stuff" from libg++ might be
+ extracted into an updated utilities library, but nobody has stated
+ such a project yet.
+
+ (The [44]Boost site houses free C++ libraries that do varying things,
+ and happened to be started by members of the Standards Committee.
+ Certain "useful stuff" classes will probably migrate there.)
+
+ For the bold and/or desperate, the [45]GCC FAQ describes where to find
+ the last libg++ source.
+ _________________________________________________________________
+
+1.8 What if I have more questions?
+
+ If you have read the README and RELEASE-NOTES files, and your question
+ remains unanswered, then just ask the mailing list. At present, you do
+ not need to be subscribed to the list to send a message to it. More
+ information is available on the homepage (including how to browse the
+ list archives); to send to the list, use
+ [46]libstdc++@sourceware.cygnus.com.
+
+ If you have a question that you think should be included here, or if
+ you have a question about a question/answer here, contact [47]Phil
+ Edwards or [48]Gabriel Dos Reis.
+ _________________________________________________________________
+
+ 2.0 Installation
+
+2.1 How do I install libstdc++-v3?
+
+ Complete instructions are not given here (this is a FAQ, not an
+ installation document), but the tools required are few:
+ * A release of libstdc++.
+ * A recent release of GCC (version 2.95 works). Note that building
+ GCC is much easier and more automated than building the GCC 2.[78]
+ series was.
+ * If you plan on hacking around with the makefiles, you will need
+ the tools [49]autoconfand [50]automake.
+ * GNU Make is the only make that supports these makefiles.
+
+ The file [51]documentation.html provides a good overview of the steps
+ necessary to build, install, and use the library. Instructions for
+ configuring the library with new flags such as --enable-threads are
+ there also.
+
+ The top-level install.html and [52]RELEASE-NOTES files contain the
+ exact build and installation instructions. You may wish to browse
+ those files over CVSweb ahead of time to get a feel for what's
+ required. RELEASE-NOTES is located in the ".../docs/17_intro/"
+ directory of the distribution.
+ _________________________________________________________________
+
+2.2 Is this a drop-in replacement for the libstdc++ that's shipped with g++?
+
+ Yes, as of 2.90.8, it is intended as such.
+
+ The installation instructions cover this in more detail, but replacing
+ the older library requires rebuilding some of the code that comes with
+ g++. If you do not want to do that, then you'll be missing out on a
+ lot of functionality, but it can still be done.
+
+ In that case, you can use the same procedure that used to be required:
+ 1. Build GCC as usual.
+ 2. Build libstdc++-v3 as described in the installation document,
+ under the section "without GCC sources." Be aware that you will
+ lose the std:: namespace encapsulation.
+ 3. Build your code using -I and -L options so that GCC finds the
+ libstdc++-v3 headers and library before the older headers in the
+ GCC include tree.
+
+ If you configured libstdc++-v3 to install under a directory called
+ /lib3, for example, the command line would look something like
+ g++ -Wall -I/lib3/include/g++-v3 -L/lib3/lib foo.cc -o foo
+
+
+ More information (such as using SGI or GNU extensions, and setting the
+ runtime library path) can be found in the RELEASE-NOTES.
+ _________________________________________________________________
+
+2.3 What is this CVS thing that you keep mentioning?
+
+ The Concurrent Versions System is one of several revision control
+ packages. It was selected for GNU projects because it's free and very
+ high quality. The [53]CVS entry in the GNU software catalogue has a
+ better description as well as a [54]link to the makers of CVS.
+
+ The "anonymous client checkout" feature of CVS is similar to anonymous
+ FTP in that it allows anyone to retrieve the latest libstdc++ sources.
+
+ After the first of April, American users will have a "/pharmacy"
+ command-line option...
+ _________________________________________________________________
+
+2.4 How do I know if it works?
+
+ libstdc++-v3 comes with its own testsuite. You do not need to actually
+ install the library ("gmake install") to run the testsuite.
+
+ To run the testsuite on the library after building it, use "gmake
+ check" while in your build directory. To run the testsuite on the
+ library after building and installing it, use "gmake check-install"
+ instead.
+
+ The testsuite subdirectory in your build directory will then contain
+ three files of the form YYYYMMDD-mkcheck*.txt. One of them
+ (-mkcheck.txt itself) contains the results of the tests; this can be
+ mailed to the list. The other files (-mkchecklog.txt and
+ -mkcheckfiles.txt) contain messages from the compiler while building
+ the test programs, and a list of the tests to be run, respectively.
+
+ If you are using the libgcc.a-rebuilding method to enable std:: you
+ might find that the testsuite starts dying with nasty linker errors.
+ This is symptomatic of the rebuilt libgcc.a not being installed; the
+ previous one is still in use.
+
+ If you find bugs in the testsuite programs themselves, or if you think
+ of a new test program that should be added to the suite, please write
+ up your idea and send it to the list!
+ _________________________________________________________________
+
+ 3.0 Platform-Specific Issues
+
+3.1 Can libstdc++-v3 be used with <my favorite compiler>?
+
+ Probably not. Yet.
+
+ Because GCC advances so rapidly, development and testing of libstdc++
+ is being done almost entirely under that compiler. If you are curious
+ about whether other, lesser compilers (*grin*) support libstdc++, you
+ are more than welcome to try. Configuring and building the library
+ (see above) will still require certain tools, however. Also keep in
+ mind that building libstdc++ does not imply that your compiler will be
+ able to use all of the features found in the C++ Standard Library.
+
+ Since the goal of ISO Standardization is for all C++ implementations
+ to be able to share code, the final libstdc++ should, in theory, be
+ useable under any ISO-compliant compiler. It will still be targeted
+ and optimized for GCC/g++, however.
+ _________________________________________________________________
+
+3.2 Building under Cygwin hangs/explodes!?
+
+ Sometimes, yes. You're probably in the middle of generating the
+ numeric_limits specializations when it hangs, right? Thought so...
+
+ The <limits> header and its associated library code are
+ platform-specific. These files get generated from scratch during
+ installation, and it is this generator that is hanging. More
+ specifically, the only sure way to determine what the
+ numeric_limits<T>::traps boolean should be is to actually divide by
+ zero and see if it is trapped or not.
+
+ Under NT, this will occasionally just hang. On those occasions when
+ the test does not hang, the zero-division is in fact trapped. That
+ doesn't prevent hanging elsewhere.
+
+ You have two options. You can wait until the signal-handling in Cygwin
+ is reworked and released; this is planned to take "a few weeks" and
+ will result in a fix sometime in late December or early January. Or
+ you can get a prebuilt set of bits/std_limits.h and
+ src/limitsMEMBERS.cc files from Mumit Khan's [55]Cygwin-related
+ website.
+ _________________________________________________________________
+
+ 4.0 Known Bugs and Non-Bugs
+
+ Note that this section can get rapdily outdated -- such is the nature
+ of an open-source project. For the latest information, join the
+ mailing list or look through recent archives. The RELEASE- NOTES and
+ BUGS files are generally kept up-to-date.
+
+4.1 What works already?
+
+ This is a verbatim clip from the "Status" section of the RELEASE-NOTES
+ for the latest snapshot.
+New:
+---
+- MT safe string. Supported CPUs are alpha, powerpc, x86, sparc32 and sparc64.
+- Configure support for --enable-threads=posix, as well as initial IO
+ locking implementation.
+- Support for native building on Solaris 2.5.1, Solaris 2.6, Solaris
+ 2.7, cygwin, [alpha, powerpc, x86]-linux, and preliminary support for
+ Irix and Aix4.2, Aix 4.3 hosts.
+- --enable-namespaces is on by default.
+- Configure and Makefile support for "drop-in" replacement to
+ libstdc++-v2 completed. It is now possible to bootstrap g++, and
+ have g++ find libstdc++-v3 headers and libraries by default.
+- Synched with CVS egcs libio.
+- Cygwin native compiling supported.
+- Cross compiling and embedded targets (newlib) with multilibs support added.
+- SGI's strstream implementation has been added.
+- Copyright on all sources assigned to the FSF.
+- Configure, build and install documentation has been added.
+- Support to enable long long has been added.
+- More valarray improvements.
+- Extractors and inserters for std::complex have been added.
+- Extractors and inserters for void* have been fixed.
+- autoconf macros are now in _GLIBCPP_ namespace.
+- group checking for num_get implemented.
+- Many, many bug fixes.
+ _________________________________________________________________
+
+4.2 Bugs in gcc/g++ (not libstdc++-v3)
+
+ This is by no means meant to be complete nor exhaustive, but mentions
+ some problems that users may encounter when building or using
+ libstdc++. If you are experiencing one of these problems, you can find
+ more information on the libstdc++ and the GCC mailing lists.
+ * When using associative containers (like map), and compiling with
+ -O3 (or -finline-functions) and -Winline, I get a zillion errors
+ like:
+ .../include/g++/stl_tree.h: In function `int __black_count(struct __rb_tree_
+node_base *, struct __rb_tree_node_base *)':
+ .../include/g++/stl_tree.h:1045: warning: can't inline call to `int __black_
+count(struct __rb_tree_node_base *, struct __rb_tree_node_base *)'
+ .../include/g++/stl_tree.h:1053: warning: called from here
+
+ This has been discussed a number of times; the problem is that
+ __black_count is marked inline but is also a recursive function.
+ As of 12 July 1999, it has been rewritten into an optimized
+ non-recursive form, so fresh checkouts/releases should no longer
+ see this warning. (The compiler can usually figure out how to make
+ that transformation on its own.)
+ * The reason that EGCS 1.1.2 cannot be used to build the library is
+ that lookups do not work properly, and so the compiler will ICE
+ when building the locale-related source files. This has been fixed
+ in GCC 2.95.
+ _________________________________________________________________
+
+4.3 Bugs in the C++ language/lib specification
+
+ Yes, unfortunately, there are some. In a [56]message to the list,
+ Nathan Myers announced that he has started a list of problems in the
+ ISO C++ Standard itself, especially with regard to the chapters that
+ concern the library. The list itself is [57]posted on his website.
+ Developers who are having problems interpreting the Standard may wish
+ to consult his notes.
+
+ For those people who are not part of the ISO Library Group (i.e.,
+ nearly all of us needing to read this page in the first place :-), a
+ public list of the library defects is occasionally published [58]here.
+ _________________________________________________________________
+
+4.4 Things in libstdc++ that look like bugs
+
+ There are things which are not bugs in the compiler (4.2) nor the
+ language specification (4.3), but aren't really bugs in libstdc++,
+ either. Really!
+
+ The biggest of these is the quadzillions of warnings about the library
+ headers emitted when -Weffc++ is used. Making libstdc++
+ "-Weffc++-clean" is not a goal of the project, for a few reasons.
+ Mainly, that option tries to enforce object-oriented programming,
+ while the Standard Library isn't necessarily trying to be OO. There
+ are multiple solutions under discussion.
+ _________________________________________________________________
+
+4.5 Aw, that's easy to fix!
+
+ If you have found a bug in the library and you think you have a
+ working fix, then send it in! The main GCC site has a page on
+ [59]submitting patches that covers the procedure, but for libstdc++
+ you should of course send the patch to our mailing list, not the GCC
+ mailing list. The libstdc++ [60]contributors' page also talks about
+ how to submit patches.
+
+ In addition to the description, the patch, and the ChangeLog entry, it
+ is a Good Thing if you can additionally create a small test program to
+ test for the presence of the bug that your patch fixes. Bugs have a
+ way of being reintroduced; if an old bug creeps back in, it will be
+ caught immediately by the [61]testsuite -- but only if such a test
+ exists.
+ _________________________________________________________________
+
+ 5.0 Miscellaneous
+
+5.1 string::iterator is not char*; vector<T>::iterator is not T*
+
+ If you have code that depends on container<T> iterators being
+ implemented as pointer-to-T, your code is broken.
+
+ While there are arguments for iterators to be implemented in that
+ manner, A) they aren't very good ones in the long term, and B) they
+ were never guaranteed by the Standard anyway. The type-safety achieved
+ by making iterators a real class rather than a typedef for T*
+ outweighs nearly all opposing arguments.
+ _________________________________________________________________
+
+5.2 What's next after libstdc++-v3?
+
+ Hopefully, not much. The goal of libstdc++-v3 is to produce a
+ fully-compliant, fully-portable Standard Library. After that, we're
+ mostly done: there won't be any more compliance work to do.
+
+ The ISO Committee will meet periodically to review Defect Reports in
+ the C++ Standard. Undoubtably some of these will result in changes to
+ the Standard, which will be reflected in patches to libstdc++. Some of
+ that is already happening, see 4.2.
+
+ The current libstdc++ contains extensions to the Library which must be
+ explicitly requested by client code (for example, the hash tables from
+ SGI). Other extensions may be added to libstdc++-v3 if they seem to be
+ "standard" enough. (For example, the "long long" type from C99.)
+ Bugfixes and rewrites (to improve or fix thread safety, for instance)
+ will of course be a continuing task.
+
+ [62]This question about the next libstdc++ prompted some brief but
+ interesting [63]speculation.
+ _________________________________________________________________
+
+5.3 What about the STL from SGI?
+
+ The [64]STL from SGI is merged into libstdc++-v3 with changes as
+ necessary. Currently release 3.2 is being used. Changes in the STL
+ usually produce some weird bugs and lots of changes in the rest of the
+ libstd++ source as we scramble to keep up. :-)
+
+ In particular, string is not from SGI and makes no use of their "rope"
+ class (which is included as an optional extension), nor is valarray
+ and some others. Classes like vector<> are, however.
+
+ The FAQ for SGI's STL (one jump off of their main page) is recommended
+ reading.
+ _________________________________________________________________
+
+5.4 Extensions and Backward Compatibility
+
+ Although you can specify -I options to make the preprocessor search
+ the g++-v3/ext and /backward directories, it is better to refer to
+ files there by their path, as in:
+ #include <ext/hash_map>
+
+ _________________________________________________________________
+
+5.5 Compiling with "-fnew-abi"
+
+ The library mostly works if you compile it (and programs you link with
+ it) using "-fnew-abi -fno-honor-std" on a vanilla GCC compiler.
+ However, some features, such as RTTI and error handlers, might not
+ link properly with a vanilla libgcc built in GCC under the old ABI. If
+ you rebuild libgcc using the "-f" flags above, you can get both
+ complete language support and full benefits of -fnew-abi -- short
+ mangled symbol names, far more efficient exception handling, and empty
+ base optimization, to name a few. (Note that the new ABI may change
+ from one GCC snapshot to the next, so you would have to rebuild all
+ your libraries each time you get a new compiler snapshot.)
+
+ Towards the end of July 1999, this subject was brought up again on the
+ mailing list under a different name. The related [65]thread (by the
+ name HOWTO-honor-std) is very instructive. More info is at the end of
+ RELEASE-NOTES.
+
+ This functionality is now automated and turned on by default.
+ _________________________________________________________________
+
+5.6 Is libstdc++-v3 thread-safe?
+
+ Quick answer: no, as of 2.90.8 (ninth snapshot), the library is not
+ appropriate for multithreaded access. The string class is MT-safe.
+
+ This is assuming that your idea of "multithreaded" is the same as
+ ours... The general question of multithreading and libstdc++-v3 is
+ addressed in the chapter-specific advice for [66]Library Introduction.
+ Threadsafe containers are covered in more detail in [67]the Received
+ Wisdom section on containers.
+ _________________________________________________________________
+
+5.7 How do I get a copy of the ISO C++ Standard?
+
+ Copies of the full ISO 14882 standard are available on line via the
+ ISO mirror site for committee members. Non-members, or those who have
+ not paid for the privilege of sitting on the committee and sustained
+ their two-meeting commitment for voting rights, may get a copy of the
+ standard from their respective national standards organization. In the
+ USA, this national standards organization is ANSI and their website is
+ right [68]here. (And if you've already registered with them, clicking
+ this link will take you to directly to the place where you can [69]buy
+ the standard on-line.
+
+ Who is your country's member body? Visit the [70]ISO homepage and find
+ out!
+ _________________________________________________________________
+
+ Comments and suggestions are welcome, and may be sent to [71]Phil
+ Edwards or [72]Gabriel Dos Reis.
+ $Id: index.txt,v 1.17 2000/03/26 03:44:35 pme Exp $
+
+References
+
+ 1. http://sourceware.cygnus.com/libstdc++/
+ 2. http://sourceware.cygnus.com/libstdc++/faq/index.html
+ 3. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/index.html
+ 4. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#1_0
+ 5. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#1_1
+ 6. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#1_2
+ 7. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#1_3
+ 8. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#1_4
+ 9. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#1_5
+ 10. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#1_6
+ 11. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#1_7
+ 12. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#1_8
+ 13. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#2_0
+ 14. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#2_1
+ 15. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#2_2
+ 16. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#2_3
+ 17. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#2_4
+ 18. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#3_0
+ 19. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#3_1
+ 20. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#3_2
+ 21. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#4_0
+ 22. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#4_1
+ 23. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#4_2
+ 24. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#4_3
+ 25. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#4_4
+ 26. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#4_5
+ 27. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#5_0
+ 28. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#5_1
+ 29. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#5_2
+ 30. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#5_3
+ 31. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#5_4
+ 32. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#5_5
+ 33. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#5_6
+ 34. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#5_7
+ 35. ftp://sourceware.cygnus.com/pub/libstdc++/libstdc++-2.90.8.tar.gz
+ 36. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/17_intro/DESIGN
+ 37. http://egcs.cygnus.com/
+ 38. http://egcs.cygnus.com/gcc-2.95/buildstat.html
+ 39. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/index.html
+ 40. ftp://sourceware.cygnus.com/pub/libstdc++/libstdc++-2.90.8.tar.gz
+ 41. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/index.html
+ 42. http://www.deja.com/getdoc.xp?AN=469581698&fmt=text
+ 43. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/17_intro/contribute.html
+ 44. http://www.boost.org/
+ 45. http://egcs.cygnus.com/faq.html#libg++
+ 46. mailto:libstdc++@sourceware.cygnus.com
+ 47. mailto:pme@sourceware.cygnus.com
+ 48. mailto:gdr@egcs.cygnus.com
+ 49. http://sourceware.cygnus.com/autoconf/
+ 50. http://sourceware.cygnus.com/automake/
+ 51. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/documentation.html
+ 52. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/17_intro/RELEASE-NOTES
+ 53. http://www.gnu.org/software/cvs/cvs.html
+ 54. http://www.cyclic.com/
+ 55. http://www.xraylith.wisc.edu/~khan/software/gnu-win32/libstdc++-v3.html
+ 56. file://localhost/ml/libstdc++/1998/msg00006.html
+ 57. http://www.cantrip.org/draft-bugs.txt
+ 58. http://anubis.dkuug.dk/jtc1/sc22/wg21/
+ 59. http://egcs.cygnus.com/contribute.html
+ 60. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/17_intro/contribute.html
+ 61. file://localhost/home0/pedwards/EGCS/gcc-2.95.2/libstdc++-v3/docs/faq/index.html#2_4
+ 62. http://sourceware.cygnus.com/ml/libstdc++/1999/msg00080.html
+ 63. http://sourceware.cygnus.com/ml/libstdc++/1999/msg00084.html
+ 64. http://www.sgi.com/Technology/STL/
+ 65. file://localhost/ml/libstdc++/1999-q3/msg00066.html
+ 66. http://sourceware.cygnus.com/libstdc++/17_intro/howto.html#3
+ 67. http://sourceware.cygnus.com/libstdc++/23_containers/howto.html
+ 68. http://www.ansi.org/
+ 69. http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+14882%2D1998
+ 70. http://www.iso.ch/
+ 71. mailto:pme@sourceware.cygnus.com
+ 72. mailto:gdr@egcs.cygnus.com
diff --git a/libstdc++-v3/docs/footer.html b/libstdc++-v3/docs/footer.html
new file mode 100644
index 000000000000..f3740d614e93
--- /dev/null
+++ b/libstdc++-v3/docs/footer.html
@@ -0,0 +1,18 @@
+
+
+<!-- ####################################################### -->
+
+</TD></TR></TABLE></TD></TR></TABLE>
+
+<HR>
+<P CLASS="fineprint"><EM>
+These pages are stoically maintained by
+<A HREF="mailto:pme@sourceware.cygnus.com">Phil Edwards</a>, who might now
+actually be able to maintain them as the directory structure is slowly
+congealing into some kind of permanent structure, and was last modified on
+2000-03-24.
+</EM></P>
+
+<!-- And this closes everything out. -->
+<!--#include virtual="/include/footer-subpages.html"-->
+
diff --git a/libstdc++-v3/docs/gccrebuild.html b/libstdc++-v3/docs/gccrebuild.html
new file mode 100644
index 000000000000..3f167cc0cea5
--- /dev/null
+++ b/libstdc++-v3/docs/gccrebuild.html
@@ -0,0 +1,120 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="libgcc.a, rebuild">
+ <META NAME="DESCRIPTION" CONTENT="How to automatically rebuild libgcc.a.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>How to automatically rebuild libgcc.a.</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/">
+<LINK REL=StyleSheet HREF="lib3styles.css">
+<!-- $Id: gccrebuild.html,v 1.1 2000/01/14 20:03:09 pme Exp $ -->
+</HEAD>
+<BODY>
+
+<H2 CLASS="centered"><TT>--enable-libgcc-rebuild</TT></H2>
+
+<P>If you build libstdc++ using certain flags (e.g., -fnew-abi), then
+ programs that use some of the new C++ language features (like namespace
+ std and RTTI) will only link if the compiler's libgcc is built using
+ the same flags. Other extralinguistic flags (like -fsquangle to change
+ the name mangling algorithm) will have the same effect.
+</P>
+
+<P>Since the compiler and this library are currently separate projects,
+ you would normally have to do this yourself. Passing
+ --enable-libgcc-rebuild to libstdc++'s configure script means that when
+ you type 'make' next, after libstdc++ is built, then libgcc will also
+ be rebuilt. If you've given other --enable/--with switches to libstdc++
+ that would require a core library rebuild, then those compiler options
+ will be automatically used when compiling libgcc, such that both
+ libraries will always be built with the same options.
+</P>
+
+<P>Of course, since they are currently separate projects, the libstdc++
+ scripts have no idea where you've built your GCC, so you must tell it.
+ The argument to this enable switch is the path to the GCC build
+ directory. The GCC configuration documentation refers to this directory
+ as <EM>objdir</EM>; here it will be called <EM>GCCobjdir</EM>.
+</P>
+
+<P>This is a kludge, and will go away eventually.</P>
+
+<HR>
+
+<H3>If you kept your <EM>GCCobjdir</EM></H3>
+<P>Easy as pi, er, pie. Just pass the pathname to the --enable switch
+ (absolute pathnames are best), and build libstdc++ as you normally
+ would. When it is finished, 'make' will go over to <EM>GCCobjdir</EM>
+ and build a new libgcc.a for you.
+</P>
+<P>Once that's done, skip down to &quot;Installing the new libgcc.a.&quot;
+</P>
+
+
+<H3>If you deleted your <EM>GCCobjdir</EM>, or never had one</H3>
+<P>Aaargggghhh, you had to make things difficult. Okay, note for future
+ reference: if you plan on experimenting with weird features, you'll want
+ to keep your build directories around. If you're having to re-unpack
+ the GCC source for this step, the same thing applies.
+</P>
+<P>We don't put a whole lot of effort into supporting this, so you might
+ just have to go the long way 'round if you run into difficulties.
+</P>
+<P>You'll have to trick the configure script into believing that libgcc.a
+ has been previously built. You'll also have to build the libraries that
+ libgcc.a needs. The steps are these:
+ <OL>
+ <LI>Unpack the GCC sources. Call this directory <EM>GCCsrcdir</EM>.
+ <LI>&quot;<TT>mkdir <EM>GCCobjdir</EM> && cd <EM>GCCobjdir</EM> &&
+ <EM>GCCsrcdir</EM>/configure --whatever</TT>&quot;
+ <BR>Configure GCC like you normally would. See
+ <A HREF="http://gcc.gnu.org/install/configure.html">the GCC
+ configuration instructions</A> for all the possible values
+ of <TT>--whatever</TT>.
+ <LI>&quot;<TT>cd libiberty && make</TT>&quot;
+ <LI>&quot;<TT>cd ../gcc; touch libgcc2.ready</TT>&quot;
+ </OL>
+ Now go back to &quot;If you kept your GCCobjdir&quot; and proceed from there.
+</P>
+
+
+<H3>Installing the new libgcc.a</H3>
+<P>The reckless method is
+ <PRE>
+ cd GCCobjdir/gcc
+ make install-libgcc</PRE>
+ This will copy in the new libgcc.a on top of the old one.
+</P>
+<P>The wiser method is to keep the old one around under a different name,
+ and install the new one under another different name, and then make
+ libgcc.a be a hard or soft link to one of the two real libraries. Or
+ copy one of them by a new name into a directory searched by the linker,
+ and use -l (dash ell) to pick it up before finding the default
+ <EM>other</EM> library.
+</P>
+
+<HR>
+
+<P>If you're <B>really</B> interested in using a particular flag (say,
+ -fhonor-std) under <B>all</B> conditions, then you can edit
+ <EM>GCCsrcdir</EM>/gcc/cp/decl2.c and change the initialization of the
+ appropriate <TT>flag_</TT> variable to 1. This will turn that flag
+ on by default, which means that libgcc.a, libstdc++.a, libstdc++.so,
+ and everything else you ever do will be built with that feature
+ unless you specifically turn it <EM>off</EM>.
+</P>
+
+
+<!-- ####################################################### -->
+
+<HR>
+<P CLASS="fineprint"><EM>
+$Id: gccrebuild.html,v 1.1 2000/01/14 20:03:09 pme Exp $
+</EM></P>
+
+
+</BODY>
+</HTML>
+
diff --git a/libstdc++-v3/docs/header.html b/libstdc++-v3/docs/header.html
new file mode 100644
index 000000000000..467a1fd7d732
--- /dev/null
+++ b/libstdc++-v3/docs/header.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="libstdc++, homepage, home, g++, libg++, STL">
+ <META NAME="DESCRIPTION" CONTENT="GNU libstdc++-v3 homepage.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>Standard C++ Library v3</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/">
+<LINK REL=StyleSheet HREF="lib3styles.css">
+<!-- $Id: header.html,v 1.1 2000/03/09 22:19:39 pme Exp $ -->
+</HEAD>
+
+<!-- This does the BODY tag and that funky imagemap. -->
+<!--#include virtual="/include/header-subpages.html"-->
+
+
+<!-- Encloses everything. :-( First row is the sigil; second row
+ is the rest of the page (which is another table, blech). That
+ second row contains two elements; the first is the TOC (in gray)
+ and the second is another table (hork). That second table
+ contains the actual "text" of the page.
+-->
+<TABLE>
+ <TR><TD VALIGN="TOP" ALIGN="LEFT">
+ <P><SPAN CLASS="tocheader">libstdc++</SPAN> v3</P>
+ </TD></TR><TR><TD VALIGN="TOP" bgcolor=#EEEEEE>
+
+
+<!-- TOC (Navigation bar thingy) -->
+<TABLE CELLSPACING=10>
+ <TR><TD COLSPAN=2></TD></TR>
+
+ <TR><TD COLSPAN=2>
+ <A HREF="index.html">Home</A><BR>
+ <A HREF="status.html">Status</A><BR>
+ <A HREF="download.html">Downloading</A><BR>
+ <A HREF="faq/index.html">FAQ</A> (<A HREF="faq/index.txt">text</A>)<BR>
+ <A HREF="documentation.html">Documentation</A><BR>
+ <A HREF="mail.html">Mailing Lists</A><BR>
+ <A HREF="/cgi-bin/gnatsweb.pl?database=libstdc%2b%2b&user=guest&password=guest&cmd=login">Report a Bug</A><BR>
+ <A HREF="thanks.html">Contributors</A><BR>
+ <A HREF="links.html">Links</A><BR>
+ </TD></TR>
+
+<!--
+ <TR><TD COLSPAN=2></TD></TR>
+
+ <TR><TD COLSPAN=2><B>Get announcements:</B><BR><SMALL>
+ <FORM METHOD="get" ACTION="/cgi-bin/ml-request">
+ <INPUT TYPE="hidden" NAME="digest" VALUE="off">
+ <INPUT TYPE="hidden" NAME="operation" VALUE="subscribe">
+ <INPUT TYPE="hidden" NAME="listname" VALUE="libstdc++-announce">
+ <INPUT TYPE="text" NAME="username" VALUE="your e-mail address" size="20">
+ <BR><INPUT TYPE="submit" NAME="submit" VALUE="Subscribe!">
+ </FORM>
+ </SMALL></TD></TR>
+-->
+
+</TABLE></TD><TD></TD><TD>
+ <!-- Why another table for the actual stuff? See JSM's insightful
+ comments in the source of sourceware.cygnus.com.
+ -->
+ <TABLE><TR><TD>
+
+<!-- ####################################################### -->
+
+
diff --git a/libstdc++-v3/docs/index.html b/libstdc++-v3/docs/index.html
new file mode 100644
index 000000000000..86e2f6d95773
--- /dev/null
+++ b/libstdc++-v3/docs/index.html
@@ -0,0 +1,61 @@
+
+<!--#include virtual="/libstdc++/header.html"-->
+
+
+<H2>What... is your name?</H2>
+
+<P>The GNU Standard C++ Library v3, or libstdc++-2.90.x. Also,
+ libstdc++-v3 is the most common nickname.
+</P>
+
+<H2>What... is your quest?</H2>
+
+<P>This is an ongoing project
+ to implement the ISO 14882 Standard C++ Library as described in chapters
+ 17 through 27 and Annex D. <B>Participation is welcome!</B>
+</P>
+
+<H2>What... is the airspeed velocity of an unladen swallow?</H2>
+
+<P><A HREF="http://www.stone-dead.asn.au/movies/holy-grail/scene-23.html">African or European?</A></P>
+<!-- Anyone who hasn't seen Holy Grail shouldn't be programming... how can you
+ understand procedural logic if you haven't seen the witch-burning scene?
+ (Replace 'scene-23' with 'scene-05' for the transcript.)
+-->
+
+<HR>
+
+<H3>News</H3>
+<P>
+<DL>
+ <DT>2000-03-24
+ <DD> Ninth snapshot release,
+ <A HREF="ftp://sourceware.cygnus.com/pub/libstdc++/libstdc++-2.90.8.tar.gz">
+ libstdc++-2.90.8.tar.gz</A>.
+ <DT>1999-12-21
+ <DD> Eighth snapshot release, libstdc++-2.90.7.tar.gz.
+ <DT>1999-08-04
+ <DD> Seventh snapshot release, libstdc++-2.90.6.tar.gz.
+ <DT>1999-05-18
+ <DD> Sixth snapshot release, libstdc++-2.90.5.tar.gz.
+ <DT>1999-03-19
+ <DD> Fifth snapshot release, libstdc++-2.90.4.tar.gz.
+ <DT>1998-12-31
+ <DD> Fourth snapshot release, libstdc++-2.90.3.tar.gz.
+ <DT>1998-11-04
+ <DD> Design, feature checklist and readme documents updated. Also see
+ new &quot;Notes&quot; section.
+ <DT>1998-10-30
+ <DD> Third snapshot release, libstdc++-2.90.2.tar.gz.
+ <DT>1998-07-31
+ <DD> <A HREF="17_intro/DESIGN">Design document available</a>
+ <DT>1998-07-24
+ <DD> Second snapshot release, libstdc++-2.90.1.tar.gz.
+ <DT>1998-07-15
+ <DD> First snapshot release.
+</DL>
+</P>
+
+
+<!--#include virtual="/libstdc++/footer.html"-->
+
diff --git a/libstdc++-v3/docs/install.html b/libstdc++-v3/docs/install.html
new file mode 100644
index 000000000000..99c9c532c02a
--- /dev/null
+++ b/libstdc++-v3/docs/install.html
@@ -0,0 +1,378 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="AUTHOR" CONTENT="pme@sourceware.cygnus.com (Phil Edwards)">
+ <META NAME="KEYWORDS" CONTENT="libstdc++, libstdc++-v3, egcs, g++">
+ <META NAME="DESCRIPTION" CONTENT="README for the GNU libstdc++ effort.">
+ <META NAME="GENERATOR" CONTENT="vi and eight fingers">
+ <TITLE>libstdc++-v3 Installation Instructions</TITLE>
+<LINK REL="home" HREF="http://sourceware.cygnus.com/libstdc++/">
+<LINK REL=StyleSheet HREF="lib3styles.css">
+<!-- $Id: install.html,v 1.11 2000/04/18 22:05:49 pme Exp $ -->
+</HEAD>
+<BODY>
+
+<H1 CLASS="centered"><A NAME="top">libstdc++-v3 INSTALL</A></H1>
+
+<P>The latest version of this document is always available at
+ <A HREF="http://sourceware.cygnus.com/libstdc++/install.html">
+ http://sourceware.cygnus.com/libstdc++/install.html</A>.
+</P>
+
+<P>To the <A HREF="index.html">libstdc++-v3 homepage</A>.
+
+
+<!-- ####################################################### -->
+<HR>
+<H2>Contents</H2>
+<UL>
+ <LI><A HREF="#prereqs">Tools you will need beforehand</A>
+ <LI><A HREF="#srcsetup">Setting up the source directories</A>
+ <LI><A HREF="#config">Configuring</A>
+ <LI><A HREF="#install">Building and installing the library</A>
+ <LI><A HREF="#postinstall">Post-installation</A>
+ <LI><A HREF="#usage">Using the library</A>
+</UL>
+
+<HR>
+
+<!-- ####################################################### -->
+
+<H2><A NAME="prereqs">Tools you will need beforehand</A></H2>
+ <P>You will need a recent version of g++ to compile the snapshot of
+ libstdc++: gcc-2.95.2 works well, or one of the post-2.95.2 egcs
+ snapshots (insert standard caveat about using snapshots rather
+ than formal releases). You will need the full source
+ distribution to whatever compiler release you are using. The
+ GCC snapshots can be had from one of the sites on their
+ <A HREF="http://gcc.gnu.org/mirrors.html">mirror list</A>.
+ </P>
+ <P>In addition, if you plan to modify the makefiles or regenerate the
+ configure scripts: automake (version 1.4 from Cygnus, not the one on
+ the net. It's available
+<A HREF="ftp://sourceware.cygnus.com/pub/libstdc++/000215-automake.tar.gz">here</A>
+ and autoconf (version 2.13 and higher), which is available
+ <A HREF="ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz">here</A>.
+ </P>
+ <P>If you don't have bash, and want to run <TT>'make check'</TT> to
+ test your build, you'll need to get bash 2.x. Also recommended
+ is GNU Make, since it is the only 'make' that will parse these
+ makefiles correctly.
+ </P>
+ <P>Finally, if you are using cygwin to compile libstdc++-v3 on
+ win32, you'll have to get a version of the cygwin.dll that is
+ dated on or after February 1, 2000. This is necessary to
+ successfully run the script "mknumeric_limits" which probes the
+ floating-point environment of the host in question--before this
+ date, Cygwin would freeze when running this script. In addition,
+ you may want to get a current version of libtool (say
+ libtool-1.3.4 and above) as earlier versions supposedly had
+ problems creating shared libraries.
+ </P>
+
+<HR>
+
+<H2><A NAME="srcsetup">Setting up the source directories</A></H2>
+ <P><EM>As the libstdc++-v3 sources and the core GCC sources move
+ towards convergence, more and more effort goes to building the
+ library as the default version to be shipped with g++. With the
+ 2.90.8 snapshot, and especially for CVS versions after this
+ release, this is treated as the usual scenario. If you want to
+ build the library all by itself, you will need to explicitly
+ disable certain features (like namespaces) since the core GCC
+ library, libgcc.a, will not be rebuilt with those same features.
+ </EM>
+ </P>
+
+ <P>By default, all configurations of libstdc++-v3 now have namespaces
+ enabled. Being able to select/de-select this option was a complex task
+ that had hopelessly confused many otherwise intelligent people, and
+ provided an endless stream of silent cursing and cries for help.
+ Because of this, gcc sources are required, and are no longer optional.
+ </P>
+
+ <P>The following definitions will be used throughout the rest of this
+ document:
+ <UL>
+ <LI><EM>gccsrcdir</EM>: The directory holding the source of the
+ compiler. It should have several subdirectories like
+ <EM>gccsrcdir</EM>/libio and <EM>gccsrcdir</EM>/gcc.
+ <LI><EM>libsrcdir</EM>: The directory holding the source of the
+ C++ library.
+ <LI><EM>gccbuilddir</EM>: The build directory for the compiler
+ in <EM>gccsrcdir</EM>. GCC requires that it be built in
+ a different directory than its sources.
+ <LI><EM>libbuilddir</EM>: The build directory for libstdc++.
+ <LI><EM>destdir</EM>: The eventual installation directory for
+ the compiler/libraries, set with the --prefix option to
+ the configure script.
+ </UL>
+ Note:
+ <OL>
+ <LI>The .8 snapshot and following are intended to replace the
+ library that comes with the compiler, so <EM>libsrcdir</EM>
+ and <EM>libbuilddir</EM> must be contained under
+ <EM>gccsrcdir</EM> and <EM>gccbuilddir</EM>, respectively.
+ <LI>The source, build, and installation directories should
+ not be parents of one another; i.e., these should all be
+ separate directories. Please don't build out of the
+ source directory.
+ </OL>
+ </P>
+
+<p>
+Since the release of libstdc++-2.90.8, configuration patches have gone
+into CVS gcc that make the management of the various libstdc++ source
+trees a bit easier. Because of this, both libstdc++-v2 and
+libstdc++-v3 and live together more or less in peace, without the need
+for soft linking. If a CVS gcc source directory after April 5, 2000 is
+being used, then the directions are slightly different: please pick
+which of the following two scenarios best represents your particular
+situation.
+
+<P>
+<B>...with gcc-2.95.2</B>
+ <P>Unpack the <EM>gccsrcdir</EM> and go into that directory. For
+ instance, <TT>gcc-2.95.2</TT> is a valid <EM>gccsrcdir</EM>.
+ Once in <EM>gccsrcdir</EM>, you'll need to rename the directories
+ called <TT> libstdc++ </TT> and <TT> libio </TT> like so:
+ <PRE>
+ mv libstdc++ libstdc++-v2
+ mv libio libio-v2</PRE>
+ </P>
+ <P>Next, unpack the libstdc++-v3 library tarball into the
+ <EM>gccsrcdir</EM> directory; it will create a
+ <EM>libsrcdir</EM> called <TT>libstdc++-<EM>version</EM></TT>:
+ <PRE>
+ gzip -dc libstdc++-version.tar.gz | tar xf -</PRE>
+ </P>
+ <P>Finally, make a soft link between <EM>libsrcdir</EM> and
+ <TT>libstdc++</TT> so that libstdc++-v3 will be the default C++
+ library used.
+ <PRE>
+ ln -s <EM>libsrcdir</EM> libstdc++</PRE>
+ This complexity of having two completely separate libstdc++
+ libraries is necessary so that you can unlink <EM>libsrcdir</EM>
+ and update the compiler sources. If you're not this adventurous, or
+ would not like to switch between different C++ standard libraries,
+ this extra effort is probably wasted; just remove the v2 sources.
+ </P>
+
+<P>
+<B>...with CVS gcc</B>
+ <P> Check out or download the gcc sources: the
+ resulting source director is <EM>gccsrcdir</EM>.
+ </P>
+ <P>Next, unpack the libstdc++-v3 library tarball into this
+ <EM>gccsrcdir</EM> directory; it will create a
+ <EM>libsrcdir</EM> called <TT>libstdc++-<EM>version</EM></TT>:
+ <PRE>
+ gzip -dc libstdc++-version.tar.gz | tar xf -</PRE>
+ </P>
+
+ <P> If CVS libstdc++-v3 is being used instead of a snapshot's
+ tarball, then move the source directory from the cvs checkout into
+ the <EM>gccsrcdir</EM> directory.
+
+ <P>Finally, rename <EM>libsrcdir</EM> to
+ <TT>libstdc++-v3</TT> so that gcc's configure flags will be able
+ to deal with the new library.
+ <PRE>
+ mv <EM>libsrcdir</EM> libstdc++-v3</PRE>
+ </P>
+
+<HR>
+<H2><A NAME="config">Configuring</A></H2>
+
+Due to namespaces, when building libstdc++-v3 you'll have to configure
+the entire <EM>gccsrcdir</EM> directory. The full list of
+libstdc++-v3 specific configuration options, not dependent on the
+specific compiler release being used, can be found <A
+HREF="configopts.html"> here </A>
+<P>
+[Consider possibly using
+--enable-languages=c++ to save time by only building the C++ language
+parts]
+
+<P>
+<B>...with gcc-2.95.2</B>
+<P>
+ <EM>gccsrcdir</EM>/configure --prefix=<EM>destdir</EM>
+ </PRE>
+<P>
+
+<P>
+<B>...with CVS gcc</B>
+<P>
+
+ <EM>gccsrcdir</EM>/configure --prefix=<EM>destdir</EM> --enable-libstdcxx-v3
+
+<P>
+[Adding <TT> --enable-libstdcxx-v3</TT> automatically selects
+libstdc++-v3 as the C++ library to be used alongside the C++ compiler
+being built, and also enables -fhonor-std by default. This option is not available with gcc-2.95.2] </P>
+
+<HR>
+<H2><A NAME="install">Building and installing the library</A></H2>
+ <P>Now you have a few options:</P>
+ <H3>[re]building <EM>everything</EM></H3>
+ <P>If you're building GCC from scratch, you can do the usual
+ <TT> 'make boostrap' </TT> here, and libstdc++-v3 will be built
+ as its default C++ library. The generated g++ will magically
+ use the correct headers, link against the correct library
+ binary, and in general using libstdc++-v3 will be a piece of
+ cake. You're done; run <TT>'make install'</TT> (the GCC
+ Installation instructions) to put the new compiler and libraries
+ into place.
+ </P>
+
+ <H3>[re]building only libstdc++</H3>
+ Due to differences in the configure process, the resulting Makefiles
+ in the<EM>gccbuilddir</EM> will have different rules depending on
+ the source base being used.
+<P>
+<B>...with gcc-2.95.2</B>
+<P>
+ <EM>libstdc++-rule</EM> is <TT>libstdc++</TT>
+
+<P>
+
+<P>
+<B>...with CVS gcc</B>
+<P>
+ <EM>libstdc++-rule</EM> is <TT>libstdc++-v3</TT>
+<P>
+
+To rebuild just libstdc++, use:
+<P>
+ <PRE>make all-target-<EM>libstdc++-rule</EM></PRE>
+ This will configure and build the C++ library in the
+ <EM>gccbuilddir/cpu-vendor-OS/</EM>libstdc++ directory.
+ As en example, for CVS gcc this would be <TT>make all-target-libstdc++-v3</TT>, and for gcc-2.95.2 it would be <TT>make all-target-libstdc++</TT>
+ </P>
+ <P>If the build fails with a &quot;warning: can't inline call&quot;
+ message when compiling stringMAIN.cc, see <A HREF="#Werror">the
+ resolution at the end of this document</A>.
+ </P>
+ <P>You're done. Now install the rebuilt pieces with
+ <PRE>
+ make install
+
+ or
+
+ make install-gcc
+ make install-target-<EM>libstdc++-rule</EM></PRE>
+
+<HR>
+<H2><A NAME="postinstall">Post-installation</A></H2>
+ <P>Installation will create the <EM>destdir</EM> directory and
+ populate it with subdirectories:
+ <PRE>
+ lib/
+ include/g++-v3/
+ bits/
+ backward/
+ ext/</PRE>
+ </P>
+ <P>You can check the status of the build without installing it using
+ <PRE>
+ make check</PRE>
+ or you can check the status of the installed library using
+ <PRE>
+ make check-target-<EM>libstdc++-rule</EM></PRE>
+ These commands will create a 'testsuite' directory underneath
+ <EM>libbuilddir</EM> containing the results of the tests. We are
+ interested in any strange failures of the testsuite; please see
+ <A HREF="faq/index.html#2_4">FAQ 2.4</A> for which files to examine.
+ </P>
+
+
+<HR>
+<H2><A NAME="usage">Using the library</A></H2>
+ <LI><B>Find the new library at runtime (shared linking only)</B>
+ <P>If you only built a static library (libstdc++.a), or if you
+ specified static linking, you don't have to worry about this.
+ But if you built a shared library (libstdc++.so) and linked
+ against it, then you will need to find that library when you
+ run the executable.
+ </P>
+ <P>Methods vary for different platforms and different styles, but
+ the usual ones are printed to the screen during installation.
+ They include:
+ <UL>
+ <LI>At runtime set LD_LIBRARY_PATH in your environment correctly,
+ so that the shared library for libstdc++ can be found and
+ loaded. Be certain that you understand all of the other
+ implications and behavior of LD_LIBRARY_PATH first (few
+ people do, and they get into trouble).
+ <LI>Compile the path to find the library at runtime into the
+ program. This can be done by passing certain options to g++,
+ which will in turn pass them on to the linker. The exact
+ format of the options is dependent on which linker you use:
+ <UL>
+ <LI>GNU ld (default on Linux):<TT> -Wl,--rpath -Wl,<EM>destdir</EM>/lib</TT>
+ <LI>IRIX ld:<TT> -Wl,-rpath -Wl,<EM>destdir</EM>/lib</TT>
+ <LI>Solaris ld:<TT> -Wl,-R<EM>destdir</EM>/lib</TT>
+ <LI>More...?
+ </UL>
+ </UL>
+ </P>
+ <P>Use the <TT>ldd(1)</TT> utility to show which library the system
+ thinks it will get at runtime.
+ </P>
+ </OL
+ </P>
+
+
+<HR>
+<H3><A NAME="Werror"><TT>warning: can't inline call to</TT>...</A></H3>
+ <P>When building the .8 snapshot with g++ 2.95.2, compilation may halt
+ with this warning message. The &quot;problem&quot; is the -Werror
+ flag being passed to the compiler, which says to treat warnings as
+ errors. (This plus a high warning level makes us track down bugs
+ <EM>quickly</EM>.) The compiler can't inline a certain call, prints
+ a warning, and dies.
+ </P>
+ <P>The workaround is to edit either <EM>libsrcdir</EM>/src/Makefile.in
+ (before configuring) or <EM>bld-libstdc++</EM>/src/Makefile
+ (after configuring). There's one line that reads
+ <PRE>
+ WERROR = -Werror</PRE>
+ Delete the flag itself, so that the line reads
+ <PRE>
+ WERROR =</PRE>
+ Then the compiler will still print a warning, but it won't die.
+ </P>
+ <P>For the curious, this &quot;problem&quot; is actually a symptom
+ of something else. The compiler in CVS could inline more than what
+ 2.95.2 does, and the libstdc++ changes were made with that
+ compiler. One of the libstdc++ maintainers explains this
+<A HREF="http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00420.html">here</A>.
+ </P>
+ <P>This has been patched in current CVS sources.
+ </P>
+
+
+<!--
+<HR>
+<H2><A NAME=""></A></H2>
+ <P>
+ </P>
+
+-->
+
+<!-- ####################################################### -->
+
+<HR>
+<P CLASS="fineprint"><EM>
+Comments and suggestions are welcome, and may be sent to
+<A HREF="mailto:pme@sourceware.cygnus.com">Phil Edwards</A> or
+<A HREF="mailto:gdr@egcs.cygnus.com">Gabriel Dos Reis</A>.
+<BR> $Id: install.html,v 1.11 2000/04/18 22:05:49 pme Exp $
+</EM></P>
+
+
+</BODY>
+</HTML>
+
diff --git a/libstdc++-v3/docs/lib3styles.css b/libstdc++-v3/docs/lib3styles.css
new file mode 100644
index 000000000000..ee88c366cd47
--- /dev/null
+++ b/libstdc++-v3/docs/lib3styles.css
@@ -0,0 +1,6 @@
+.centered { text-align: center }
+.tocheader { font-size: large }
+.fineprint { font-size: x-small }
+.larger { font-size: large }
+BODY { background: #FFFFFF }
+PRE { text-align: left ; margin-left: 1em }
diff --git a/libstdc++-v3/docs/links.html b/libstdc++-v3/docs/links.html
new file mode 100644
index 000000000000..bf5774a81f64
--- /dev/null
+++ b/libstdc++-v3/docs/links.html
@@ -0,0 +1,38 @@
+
+<!--#include virtual="/libstdc++/header.html"-->
+
+
+
+<H3>Links</H3>
+
+<P><UL>
+ <LI><A HREF="http://www.sgi.com/Technology/STL">The SGI STL page</A>
+ <LI><A HREF="http://www.stlport.org/">STLport homepage</A>
+</UL></P>
+
+<P><UL>
+ <LI><A HREF="http://math.nist.gov/tnt/">Template Numeric Toolkit</A>
+ <LI><A HREF="http://www.acl.lanl.gov/Pooma/">POOMA</A>
+ <LI><A HREF="http://www.maths.warwick.ac.uk/cpp/lia/">Language independent
+ arithmetic</A>
+ <LI><A HREF="http://www.boost.org">The Boost C++ Libraries</A>
+</UL></P>
+
+<P><UL>
+ <LI><A HREF="http://webnz.com/robert/cpp_site.html">Internet sites for
+ C++ users</A>
+ <LI><A HREF="http://www.unicode.org">Unicode</A>
+</UL></P>
+
+<P><UL>
+ <LI><A HREF="http://www.research.att.com/~bs/">Bjarne Stroustrup's page</A>
+ <LI><A HREF="http://www.cantrip.org/cpp.html">Nathan Myers' locale page</A>
+ <LI><A HREF="http://www.josuttis.com/libbook/">Nicolai Josuttis' Standard
+ Library book</A>
+</UL></P>
+
+
+
+
+<!--#include virtual="/libstdc++/footer.html"-->
+
diff --git a/libstdc++-v3/docs/mail.html b/libstdc++-v3/docs/mail.html
new file mode 100644
index 000000000000..2753484a4c0b
--- /dev/null
+++ b/libstdc++-v3/docs/mail.html
@@ -0,0 +1,67 @@
+
+<!--#include virtual="/libstdc++/header.html"-->
+
+
+
+<H3>Mailing list info</H3>
+
+<P>There are three main mailing lists for this project:
+ <UL>
+ <LI>libstdc++@sourceware.cygnus.com: the main discussion and
+ development list
+ <LI>libstdc++-cvs@sourceware.cygnus.com: a mailing list of
+ CVS-produced messages (exciting reading!)
+ <LI>libstdc++-prs@sourceware.cygnus.com: a mailing list for problem
+ reports and bugs
+ </UL>
+</P>
+
+<P>Use this handy little form to subscribe or unsubscribe from any of
+ these lists:
+<BLOCKQUOTE>
+<form method="get" action="/cgi-bin/ml-request">
+ Mailing list:
+ <select name="listname">
+ <option value="libstdc++">libstdc++
+ <option value="libstdc++-cvs">libstdc++-cvs
+ <option value="libstdc++-prs">libstdc++-prs
+ </select>
+ <br>
+ Your e-mail address:
+ <input type="text" name="username" size="20">
+ <br>
+ <input type="checkbox" name="digest">Digest version
+ <tt>&nbsp;</tt>
+ <select name="operation">
+ <option value="subscribe">subscribe
+ <option value="unsubscribe">unsubscribe
+ </select>
+ <tt>&nbsp;</tt>
+ <input type="Submit" name="submit" value="Send in the request">
+</form>
+</BLOCKQUOTE>
+</P>
+
+<P>Archives are also on the web for extra easy access. Just select
+ the links below to see the appropriate archive:
+ <UL>
+ <LI><A HREF="/ml/libstdc++/">libstdc++</A>
+ <LI><A HREF="/ml/libstdc++-cvs/">libstdc++-cvs</A>
+ <LI><A HREF="/ml/libstdc++-prs/">libstdc++-prs</A>
+ </UL>
+</P>
+
+<P>You can also ftp mbox formatted archives from the
+ <A HREF="ftp://sourceware.cygnus.com/pub/libstdc++/mail-archives/">ftp
+ archives</A>.
+</P>
+
+<P>For more info, and features of the mailing list software, please consult
+ <A HREF="http://sourceware.cygnus.com/ml/index.html#faqs">the
+ documentation page for sourceware mailing lists</A>.
+</P>
+
+
+
+<!--#include virtual="/libstdc++/footer.html"-->
+
diff --git a/libstdc++-v3/docs/status.html b/libstdc++-v3/docs/status.html
new file mode 100644
index 000000000000..bb097f8004a0
--- /dev/null
+++ b/libstdc++-v3/docs/status.html
@@ -0,0 +1,147 @@
+
+<!--#include virtual="/libstdc++/header.html"-->
+
+
+<H3>Status</H3>
+<P>Compiling this library requires a recent version of gcc. (For instance,
+ gcc 2-95 works well.) In addition, <A HREF="/autoconf/">autoconf</A>
+ versions 2.13 and above and <A HREF="/automake/">automake</A> versions
+ 1.3b and above are required and essential ingredients for those mucking
+ about in the Makefiles and trying to configure on new targets.
+</P>
+
+<P>New things that work are in the latest
+ <A HREF="17_intro/RELEASE-NOTES">release notes</A>.
+</P>
+
+<P>Known problems and bugs, which will force us to actually keep this
+ file up-to-date, can be found in <A HREF="17_intro/BUGS">bugs</A>.
+</P>
+
+<P>Things that need to be done and are looking for volunteers can be found
+ in: <A HREF="17_intro/TODO">pick me</A>.
+</P>
+
+<P>This release has been tested with gcc 2.95 on the following
+ platforms. The configuration of --disable-namespaces
+ --disable-libgcc-rebuild was tested. Results for the
+ --enable-namespaces builds should be comparable. Here are the
+ results for snapshots 2.90.N:
+</P>
+
+<TABLE CELLSPACING=4 CELLPADDING=1>
+
+ <!-- Column titles -->
+ <TR>
+ <TH ALIGN=LEFT>.N</TH>
+ <TH ALIGN=LEFT>host</TH>
+ <TH ALIGN=CENTER>build</TH>
+ <TH ALIGN=CENTER>static pass/fail</TH>
+ <TH ALIGN=CENTER>shared pass/fail</TH>
+ </TR>
+
+ <TR>
+ <TD ALIGN=LEFT>.8</TD>
+ <TD ALIGN=LEFT>alpha-unknown-linux-gnu</TD>
+ <TD ALIGN=CENTER>+ (see Note 1)</TD>
+ <TD ALIGN=CENTER>62/5</TD>
+ <TD ALIGN=CENTER>62/5</TD>
+ </TR>
+
+ <TR>
+ <TD ALIGN=LEFT>.8</TD>
+ <TD ALIGN=LEFT>i686-unknown-linux-gnu</TD>
+ <TD ALIGN=CENTER>+</TD>
+ <TD ALIGN=CENTER>65/3</TD>
+ <TD ALIGN=CENTER>65/3</TD>
+ </TR>
+
+ <TR>
+ <TD ALIGN=LEFT>.8</TD>
+ <TD ALIGN=LEFT>powerpc-unknown-linux-gnu</TD>
+ <TD ALIGN=CENTER>+</TD>
+ <TD ALIGN=CENTER>65/3</TD>
+ <TD ALIGN=CENTER>65/3</TD>
+ </TR>
+
+ <TR>
+ <TD ALIGN=LEFT>.8</TD>
+ <TD ALIGN=LEFT>sparc-sun-solaris2.5.1</TD>
+ <TD ALIGN=CENTER>+ (see Note 2)</TD>
+ <TD ALIGN=CENTER>62/6</TD>
+ <TD ALIGN=CENTER>62/6</TD>
+ </TR>
+
+ <TR>
+ <TD ALIGN=LEFT>.8</TD>
+ <TD ALIGN=LEFT>sparc-sun-solaris2.6</TD>
+ <TD ALIGN=CENTER>+ (see Note 2)</TD>
+ <TD ALIGN=CENTER>65/3</TD>
+ <TD ALIGN=CENTER>65/3</TD>
+ </TR>
+
+ <TR>
+ <TD ALIGN=LEFT>.8</TD>
+ <TD ALIGN=LEFT>sparc-sun-solaris2.7</TD>
+ <TD ALIGN=CENTER>+ (see Note 2)</TD>
+ <TD ALIGN=CENTER>65/3</TD>
+ <TD ALIGN=CENTER>65/3</TD>
+ </TR>
+
+
+ <TR>
+ <TD ALIGN=LEFT>.8</TD>
+ <TD ALIGN=LEFT>powerpc-ibm-aix4.x</TD>
+ <TD ALIGN=CENTER>- (see Note 3)</TD>
+ <TD ALIGN=CENTER>0/68</TD>
+ <TD ALIGN=CENTER>0/68</TD>
+ </TR>
+
+ <TR>
+ <TD ALIGN=LEFT>.8</TD>
+ <TD ALIGN=LEFT>i686-cygwin</TD>
+ <TD ALIGN=CENTER>+</TD>
+ <TD ALIGN=CENTER>65/3</TD>
+ <TD ALIGN=CENTER>0/68</TD>
+ </TR>
+
+ <TR>
+ <TD ALIGN=LEFT>.8</TD>
+ <TD ALIGN=LEFT>i686-linux-x-powerpc-elf</TD>
+ <TD ALIGN=CENTER>+</TD>
+ <TD ALIGN=CENTER>65/3</TD>
+ <TD ALIGN=CENTER>65/3</TD>
+ </TR>
+
+</TABLE>
+
+<P>Note 1: A newer compiler than gcc-2.95.2 is required.
+</P>
+
+<P>Note 2: All solaris toolchains were configured with --with-gnu-ld
+--with-gnu-as --with-gnu-binutils --with-gcc. (That's a lot of --with's...)
+</P>
+
+<P>Note 3: Configuration and initial support for AIX has been
+ completed. However, problems with the compiler/linker have
+ prevented testing. For instance, mknumeric_limits will fail unless
+ weak linking is possible, which doesn't seem possible on
+ AIX. The initial bug report is
+ <a href="http://gcc.gnu.org/ml/gcc-bugs/2000-03/msg00574.html"> here </a>
+
+<p>And the
+ response from one of the powerpc port maintainers:
+
+<p>
+<i>
+ I opposed the original solution (involving weak symbols) on ELF, as
+ it seemed to be the wrong idea. I'm not sure what the right fix is,
+ and don't think I have time to work on it right now.</i>
+</p>
+</P>
+
+
+
+
+<!--#include virtual="/libstdc++/footer.html"-->
+
diff --git a/libstdc++-v3/docs/thanks.html b/libstdc++-v3/docs/thanks.html
new file mode 100644
index 000000000000..791272c97ab4
--- /dev/null
+++ b/libstdc++-v3/docs/thanks.html
@@ -0,0 +1,100 @@
+
+<!--#include virtual="/libstdc++/header.html"-->
+
+
+
+<H3 CLASS="centered">Contributors</H3>
+
+<P>
+ <!-- This little ditty was ripped wholesale from Anthony Green's
+ paragraph on the GCJ Credits page. -->
+ Many people contribute to the libstdc++-v3 project,
+ and in many different capacities. Any omissions -- and there probably
+ are many --
+ in this list are accidental. <B>Feel free</B> to contact <A
+ HREF="mailto:pme@sourceware.cygnus.com">pme@sourceware.cygnus.com</A>
+ if you have been left out or some of your contributions are not listed.
+ Please keep this list in alphabetical order.
+
+ <!--
+ Latest update 2000-03-09, more or less.
+ -->
+<UL>
+
+ <LI>Michael Cook for cleanup patches to reduce warnings.
+
+ <LI>Russell Davidson for fstream and stringstream fixes.
+
+ <LI>Gabriel Dos Reis for contributing the valarray implementation,
+ taming g++ diagnostic messages involving templates, maintaining
+ the numerics library (including that pesky &lt;limits&gt; :-), and
+ keeping up-to-date anything to do with numbers.
+
+ <LI>Ulrich Drepper for all kinds of C interface issues, contributing
+ and maintaining complex&lt;&gt;, sanity checking and disbursement,
+ configuration architecture, libio maintenance, early math work.
+
+ <LI>Kevin Ediger for the floating point formatting of num_put::do_put.
+
+ <LI>Phil Edwards for configuration hackery, documentation maintainer,
+ chief breaker of the web pages, and the occasional iostream bugfix.
+
+ <LI>Mark Elbrecht for configuration support for locales and
+ fstream-related fixes.
+
+ <LI>Vadim Egorov for fixes in strings, streambufs, and iostreams.
+
+ <LI>Nicolai Josuttis for additional documentation.
+
+ <LI>Ryszard Kabatek for many, many bugfixes and optimizations of strings,
+ especially member functions, and for auto_ptr fixes.
+
+ <LI>Brendan Kehoe for a lot of early work in just about every part of
+ the library.
+
+ <LI>Mumit Khan for massive porting work to Cygwin/Mingw32.
+
+ <LI>Benjamin Kosnik for, well, everything.
+
+ <LI>Martin v. Loewis for namespace patches and fixes.
+
+ <LI>Philip Martin for lots of string and vector iterator fixes and
+ improvements, and string clean up and testsuites.
+
+ <LI>Alfred Minarik for string and ios bugfixes, and turning the entire
+ testsuite namespace-compatible.
+
+ <LI>Jason Molenda for keeping all the machines running. Doing all
+ this work on scrap paper and the backs of envelopes would have
+ been... difficult.
+
+ <LI>Nathan Myers for inflicting locales on the rest of us, working on
+ iostream, string and string documentation (!), fixing that
+ __black_count loop that so many people bugged us about, and creating
+ the initial documentation (DESIGN, CHECKLIST, and so forth).
+
+ <LI>Chip Salzenberg for patches and improvements to locales, traits,
+ Makefiles, libio, libtool hackery, and &quot;long long&quot; support.
+
+ <LI>Scott Snyder for queue, iterator, istream, and string fixes and
+ testsuite entries.
+
+ <LI>Petter Urkedal for CXXFLAGS, math, and algorithms fixes.
+
+</UL></P>
+
+<P>We'd also like to thank the folks who have contributed time and
+ energy in testing libstdc++-v3:
+
+<UL>
+
+ <LI>Folks for sending in testsuite evaluations.
+
+</UL></P>
+
+<P>It couldn't be done without you!</P>
+
+
+
+<!--#include virtual="/libstdc++/footer.html"-->
+
diff --git a/libstdc++-v3/ext/bvector b/libstdc++-v3/ext/bvector
new file mode 100644
index 000000000000..2ece99c71605
--- /dev/null
+++ b/libstdc++-v3/ext/bvector
@@ -0,0 +1,52 @@
+/*
+ *
+ * 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
+
+#include <bits/stl_range_errors.h>
+#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
+#include <bits/std_vector.h>
+#else
+#include <bits/std_algobase.h>
+#include <bits/atl_alloc.h>
+#endif
+
+#include <ext/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/libstdc++-v3/ext/hash_map b/libstdc++-v3/ext/hash_map
new file mode 100644
index 000000000000..0f046e186f78
--- /dev/null
+++ b/libstdc++-v3/ext/hash_map
@@ -0,0 +1,518 @@
+/*
+ * 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
+
+#include <ext/stl_hashtable.h>
+
+__STL_BEGIN_NAMESPACE
+
+#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
+#pragma set woff 1174
+#pragma set woff 1375
+#endif
+
+// Forward declaration of equality operator; needed for friend declaration.
+
+template <class _Key, class _Tp,
+ class _HashFcn = hash<_Key>,
+ class _EqualKey = equal_to<_Key>,
+ class _Alloc = allocator<_Tp> >
+class hash_map;
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+inline bool operator==(const hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>&,
+ const hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>&);
+
+template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
+ class _Alloc>
+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); }
+
+#ifdef __STL_MEMBER_TEMPLATES
+ template <class _K1, class _T1, class _HF, class _EqK, class _Al>
+ friend bool operator== (const hash_map<_K1, _T1, _HF, _EqK, _Al>&,
+ const hash_map<_K1, _T1, _HF, _EqK, _Al>&);
+#else /* __STL_MEMBER_TEMPLATES */
+ friend bool __STD_QUALIFIER
+ operator== __STL_NULL_TMPL_ARGS (const hash_map&, const hash_map&);
+#endif /* __STL_MEMBER_TEMPLATES */
+
+
+ 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 bool
+operator!=(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
+ const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2) {
+ return !(__hm1 == __hm2);
+}
+
+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 */
+
+// Forward declaration of equality operator; needed for friend declaration.
+
+template <class _Key, class _Tp,
+ class _HashFcn = hash<_Key>,
+ class _EqualKey = equal_to<_Key>,
+ class _Alloc = allocator<_Tp> >
+class hash_multimap;
+
+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);
+
+template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
+ class _Alloc>
+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); }
+
+#ifdef __STL_MEMBER_TEMPLATES
+ template <class _K1, class _T1, class _HF, class _EqK, class _Al>
+ friend bool operator== (const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&,
+ const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&);
+#else /* __STL_MEMBER_TEMPLATES */
+ friend bool __STD_QUALIFIER
+ operator== __STL_NULL_TMPL_ARGS (const hash_multimap&,const hash_multimap&);
+#endif /* __STL_MEMBER_TEMPLATES */
+
+ 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 _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 == __hm2);
+}
+
+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 */
+
+// Specialization of insert_iterator so that it will work for hash_map
+// and hash_multimap.
+
+#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+class insert_iterator<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
+protected:
+ typedef hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
+ _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;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __value) {
+ container->insert(__value);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+class insert_iterator<hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
+protected:
+ typedef hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
+ _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) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __value) {
+ container->insert(__value);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
+
+#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/libstdc++-v3/ext/hash_set b/libstdc++-v3/ext/hash_set
new file mode 100644
index 000000000000..fb54c603d6cd
--- /dev/null
+++ b/libstdc++-v3/ext/hash_set
@@ -0,0 +1,502 @@
+/*
+ * 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
+
+#include <ext/stl_hashtable.h>
+
+__STL_BEGIN_NAMESPACE
+
+#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
+#pragma set woff 1174
+#pragma set woff 1375
+#endif
+
+// Forward declaration of equality operator; needed for friend declaration.
+
+template <class _Value,
+ class _HashFcn = hash<_Value>,
+ class _EqualKey = equal_to<_Value>,
+ class _Alloc = allocator<_Value> >
+class hash_set;
+
+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);
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+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); }
+
+#ifdef __STL_MEMBER_TEMPLATES
+ template <class _Val, class _HF, class _EqK, class _Al>
+ friend bool operator== (const hash_set<_Val, _HF, _EqK, _Al>&,
+ const hash_set<_Val, _HF, _EqK, _Al>&);
+#else /* __STL_MEMBER_TEMPLATES */
+ friend bool __STD_QUALIFIER
+ operator== __STL_NULL_TMPL_ARGS (const hash_set&, const hash_set&);
+#endif /* __STL_MEMBER_TEMPLATES */
+
+ 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 _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 == __hs2);
+}
+
+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 */
+
+
+template <class _Value,
+ class _HashFcn = hash<_Value>,
+ class _EqualKey = equal_to<_Value>,
+ class _Alloc = allocator<_Value> >
+class hash_multiset;
+
+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);
+
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+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); }
+
+#ifdef __STL_MEMBER_TEMPLATES
+ template <class _Val, class _HF, class _EqK, class _Al>
+ friend bool operator== (const hash_multiset<_Val, _HF, _EqK, _Al>&,
+ const hash_multiset<_Val, _HF, _EqK, _Al>&);
+#else /* __STL_MEMBER_TEMPLATES */
+ friend bool __STD_QUALIFIER
+ operator== __STL_NULL_TMPL_ARGS (const hash_multiset&,const hash_multiset&);
+#endif /* __STL_MEMBER_TEMPLATES */
+
+ 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 bool
+operator!=(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
+ const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) {
+ return !(__hs1 == __hs2);
+}
+
+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 */
+
+// Specialization of insert_iterator so that it will work for hash_set
+// and hash_multiset.
+
+#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+class insert_iterator<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > {
+protected:
+ typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
+ _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;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __value) {
+ container->insert(__value);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+class insert_iterator<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > {
+protected:
+ typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
+ _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) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __value) {
+ container->insert(__value);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
+
+#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/libstdc++-v3/ext/rope b/libstdc++-v3/ext/rope
new file mode 100644
index 000000000000..3779defea2be
--- /dev/null
+++ b/libstdc++-v3/ext/rope
@@ -0,0 +1,32 @@
+/*
+ * 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 <bits/stl_algobase.h>
+#include <bits/stl_tempbuf.h>
+#include <bits/stl_algo.h>
+#include <bits/stl_function.h>
+#include <bits/stl_numeric.h>
+#include <bits/stl_alloc.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_uninitialized.h>
+#include <ext/stl_hash_fun.h>
+#include <ext/stl_rope.h>
+
+#endif /* __SGI_STL_ROPE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/ext/ropeimpl.h b/libstdc++-v3/ext/ropeimpl.h
new file mode 100644
index 000000000000..19b8107e7c8c
--- /dev/null
+++ b/libstdc++-v3/ext/ropeimpl.h
@@ -0,0 +1,1586 @@
+/*
+ * 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 <bits/std_cstdio.h>
+
+#ifdef __STL_USE_NEW_IOSTREAMS
+# include <iostream>
+#else /* __STL_USE_NEW_IOSTREAMS */
+# include <bits/std_iostream.h>
+#endif /* __STL_USE_NEW_IOSTREAMS */
+
+#ifdef __STL_USE_EXCEPTIONS
+# include <bits/std_stdexcept.h>
+#endif
+
+__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_ref_count >= 1);
+ if (__r->_M_ref_count > 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_ref_count == 1);
+ __r->_M_ref_count = 2;
+ return __r;
+ } else {
+ _RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len);
+ __stl_assert(__result->_M_ref_count == 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_ref_count
+ && 1 == __balanced->_M_ref_count);
+ }
+# 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_ref_count);
+# 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_ref_count);
+# 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_ref_count);
+# 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_ref_count;
+ 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_ref_count = 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_ref_count == 2);
+ __new_right->_M_ref_count = 1;
+ } else {
+ __stl_assert(__new_right->_M_ref_count >= 1);
+ __right->_M_unref_nonnil();
+ }
+ __stl_assert(__r->_M_ref_count == 1);
+ __r->_M_ref_count = 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_ref_count);
+ 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_ref_count);
+# 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:
+
+ _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;
+ }
+};
+
+#ifdef __STL_USE_NEW_IOSTREAMS
+ template<class _CharT, class _Traits>
+ // Here _CharT is both the stream and rope character type.
+#else
+ template<class _CharT>
+ // Here _CharT is the rope character type. Unlike in the
+ // above case, we somewhat handle the case in which it doesn't
+ // match the stream character type, i.e. char.
+#endif
+class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> {
+ private:
+# ifdef __STL_USE_NEW_IOSTREAMS
+ typedef basic_ostream<_CharT,_Traits> _Insert_ostream;
+# else
+ typedef ostream _Insert_ostream;
+# endif
+ _Insert_ostream& _M_o;
+ public:
+ _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.
+};
+
+#ifdef __STL_USE_NEW_IOSTREAMS
+ template<class _CharT, class _Traits>
+ bool _Rope_insert_char_consumer<_CharT, _Traits>::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.put(__leaf[__i]);
+ return true;
+ }
+
+#else
+ 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;
+ }
+
+
+ __STL_TEMPLATE_NULL
+ 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;
+ }
+#endif
+
+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, __len, __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;
+ }
+}
+
+#ifdef __STL_USE_NEW_IOSTREAMS
+ template<class _CharT, class _Traits>
+ inline void _Rope_fill(basic_ostream<_CharT, _Traits>& __o, size_t __n)
+#else
+ inline void _Rope_fill(ostream& __o, size_t __n)
+#endif
+{
+ 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; }
+
+#ifdef __STL_USE_NEW_IOSTREAMS
+ template<class _CharT, class _Traits, class _Alloc>
+ basic_ostream<_CharT, _Traits>& operator<<
+ (basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r)
+#else
+ template<class _CharT, class _Alloc>
+ ostream& operator<< (ostream& __o, const rope<_CharT, _Alloc>& __r)
+#endif
+{
+ size_t __w = __o.width();
+ bool __left = bool(__o.flags() & ios::left);
+ size_t __pad_len;
+ size_t __rope_len = __r.size();
+# ifdef __STL_USE_NEW_IOSTREAMS
+ _Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
+# else
+ _Rope_insert_char_consumer<_CharT> __c(__o);
+# endif
+ 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_ref_count, __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_ref_count, __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) {
+# ifdef __STL_USE_EXCEPTIONS
+ __STL_THROW(length_error("rope too long"));
+# else
+ abort();
+# endif
+ }
+ 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_ref_count > 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_ref_count);
+# endif
+ _RopeRep* __result =
+ _My_rope::_S_concat(__result_left, __right);
+# ifndef __GC
+ __stl_assert(1 <= __result->_M_ref_count);
+ _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_ref_count);
+ // One each for base_rope and __result
+# endif
+ } else {
+ __result = power(__base_rope, __exponent,
+ _Rope_Concat_fn<_CharT,_Alloc>());
+ }
+ 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];
+
+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 = (__GC_CONST _CharT*)
+ _Atomic_swap((unsigned long *)(&(_M_tree_ptr->_M_c_string)),
+ (unsigned long)__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,allocator<char> > __first,
+ _Rope_iterator<char,allocator<char> > __middle,
+ _Rope_iterator<char,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, allocator<char> > __first,
+ _Rope_iterator<wchar_t, allocator<char> > __middle,
+ _Rope_iterator<wchar_t, 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/libstdc++-v3/ext/slist b/libstdc++-v3/ext/slist
new file mode 100644
index 000000000000..81ca92dc2159
--- /dev/null
+++ b/libstdc++-v3/ext/slist
@@ -0,0 +1,1023 @@
+/*
+ * 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 _CPP_BITS_STL_SLIST_H
+#define _CPP_BITS_STL_SLIST_H 1
+
+#include <bits/stl_algobase.h>
+#include <bits/stl_alloc.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_uninitialized.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 void
+__slist_splice_after(_Slist_node_base* __pos, _Slist_node_base* __head)
+{
+ _Slist_node_base* __before_last = __slist_previous(__head, 0);
+ if (__before_last != __head) {
+ _Slist_node_base* __after = __pos->_M_next;
+ __pos->_M_next = __head->_M_next;
+ __head->_M_next = 0;
+ __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 = 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)
+ { _M_fill_assign(__n, __val); }
+
+ void _M_fill_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)
+ { _M_fill_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); }
+
+ // Experimental new feature: before_begin() returns a
+ // non-dereferenceable iterator that, when incremented, yields
+ // begin(). This iterator may be used as the argument to
+ // insert_after, erase_after, etc. Note that even for an empty
+ // slist, before_begin() is not the same iterator as end(). It
+ // is always necessary to increment before_begin() at least once to
+ // obtain end().
+ iterator before_begin() { return iterator((_Node*) &_M_head); }
+ const_iterator before_begin() const
+ { return const_iterator((_Node*) &_M_head); }
+
+ 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);
+ }
+
+
+ // Removes all of the elements from the list __x to *this, inserting
+ // them immediately after __pos. __x must not be *this. Complexity:
+ // linear in __x.size().
+ void splice_after(iterator __pos, slist& __x)
+ {
+ __slist_splice_after(__pos._M_node, &__x._M_head);
+ }
+
+ // 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>::_M_fill_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 */
+
+// Specialization of insert_iterator so that insertions will be constant
+// time rather than linear time.
+
+#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
+
+template <class _Tp, class _Alloc>
+class insert_iterator<slist<_Tp, _Alloc> > {
+protected:
+ typedef slist<_Tp, _Alloc> _Container;
+ _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) {
+ if (__i == __x.begin())
+ iter = __x.before_begin();
+ else
+ iter = __x.previous(__i);
+ }
+
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __value) {
+ iter = container->insert_after(iter, __value);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
+
+#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
+#pragma reset woff 1174
+#pragma reset woff 1375
+#endif
+
+__STL_END_NAMESPACE
+
+#endif /* _CPP_BITS_STL_SLIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/ext/stl_bvector.h b/libstdc++-v3/ext/stl_bvector.h
new file mode 100644
index 000000000000..b1c153551079
--- /dev/null
+++ b/libstdc++-v3/ext/stl_bvector.h
@@ -0,0 +1,892 @@
+/*
+ *
+ * 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);
+ }
+ bool operator>(const iterator& __x) const { return __x < *this; }
+ bool operator<=(const iterator& __x) const { return !(__x < *this); }
+ bool operator>=(const iterator& __x) const { return !(*this < __x); }
+};
+
+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);
+ }
+ bool operator>(const const_iterator& __x) const { return __x < *this; }
+ bool operator<=(const const_iterator& __x) const { return !(__x < *this); }
+ bool operator>=(const const_iterator& __x) const { return !(*this < __x); }
+};
+
+// 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 <bits/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<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<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)); }
+
+#ifdef __STL_THROW_RANGE_ERRORS
+ void _M_range_check(size_type __n) const {
+ if (__n >= this->size())
+ __stl_throw_range_error("vector<bool>");
+ }
+
+ reference at(size_type __n)
+ { _M_range_check(__n); return (*this)[__n]; }
+ const_reference at(size_type __n) const
+ { _M_range_check(__n); return (*this)[__n]; }
+#endif /* __STL_THROW_RANGE_ERRORS */
+
+ 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 _M_fill_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);
+ }
+ }
+
+ void assign(size_t __n, bool __x) { _M_fill_assign(__n, __x); }
+
+#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)
+ { _M_fill_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) {
+ _M_fill_insert(__pos, __n, __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 _M_fill_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 insert(iterator __position, size_type __n, bool __x) {
+ _M_fill_insert(__position, __n, __x);
+ }
+
+ 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 flip() {
+ for (unsigned int* __p = _M_start._M_p; __p != _M_end_of_storage; ++__p)
+ *__p = ~*__p;
+ }
+
+ void clear() { erase(begin(), end()); }
+};
+
+#ifdef __SGI_STL_VECBOOL_TEMPLATE
+
+// This typedef is non-standard. It is provided for backward compatibility.
+typedef vector<bool, alloc> bit_vector;
+
+#else /* __SGI_STL_VECBOOL_TEMPLATE */
+
+inline void swap(bit_vector& __x, bit_vector& __y) {
+ __x.swap(__y);
+}
+
+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 !(__x == __y);
+}
+
+inline bool
+operator<(const bit_vector& __x, const bit_vector& __y)
+{
+ return lexicographical_compare(__x.begin(), __x.end(),
+ __y.begin(), __y.end());
+}
+
+inline bool operator>(const bit_vector& __x, const bit_vector& __y)
+{
+ return __y < __x;
+}
+
+inline bool operator<=(const bit_vector& __x, const bit_vector& __y)
+{
+ return !(__y < __x);
+}
+
+inline bool operator>=(const bit_vector& __x, const bit_vector& __y)
+{
+ return !(__x < __y);
+}
+
+#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/libstdc++-v3/ext/stl_hash_fun.h b/libstdc++-v3/ext/stl_hash_fun.h
new file mode 100644
index 000000000000..3144e6a07f18
--- /dev/null
+++ b/libstdc++-v3/ext/stl_hash_fun.h
@@ -0,0 +1,93 @@
+/*
+ * 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 _CPP_BITS_STL_HASH_FUN_H
+#define _CPP_BITS_STL_HASH_FUN_H 1
+
+#include <bits/std_cstddef.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 /* _CPP_BITS_STL_HASH_FUN_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/ext/stl_hashtable.h b/libstdc++-v3/ext/stl_hashtable.h
new file mode 100644
index 000000000000..9bd69cd853a4
--- /dev/null
+++ b/libstdc++-v3/ext/stl_hashtable.h
@@ -0,0 +1,1054 @@
+/*
+ * 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 <bits/stl_algobase.h>
+#include <bits/stl_alloc.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_tempbuf.h>
+#include <bits/stl_algo.h>
+#include <bits/stl_uninitialized.h>
+#include <bits/stl_function.h>
+#include <bits/stl_vector.h>
+#include <ext/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.
+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 = 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); }
+
+#ifdef __STL_MEMBER_TEMPLATES
+ 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>&);
+#else /* __STL_MEMBER_TEMPLATES */
+ friend bool __STD_QUALIFIER
+ operator== __STL_NULL_TMPL_ARGS (const hashtable&, const hashtable&);
+#endif /* __STL_MEMBER_TEMPLATES */
+
+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);
+
+#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>
+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 _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);
+}
+
+#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)
+{
+ _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());
+ __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 != __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);
+ __STL_TRY {
+ for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) {
+ const _Node* __cur = __ht._M_buckets[__i];
+ if (__cur) {
+ _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/libstdc++-v3/ext/stl_rope.h b/libstdc++-v3/ext/stl_rope.h
new file mode 100644
index 000000000000..bcf42394d6db
--- /dev/null
+++ b/libstdc++-v3/ext/stl_rope.h
@@ -0,0 +1,2710 @@
+/*
+ * 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.
+ */
+
+/* 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
+# include <bits/stl_threads.h>
+# 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;
+};
+
+// 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 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 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.
+//
+
+//
+// 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>
+# 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_depth(__d), _M_is_balanced(__b), _M_c_string(0)
+ { }
+# ifdef __GC
+ void _M_incr () {}
+# 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()) _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 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 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)
+ {
+ __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 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, 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
+ {
+ __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 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), _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,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;
+ }
+#ifdef __STL_MEMBER_TEMPLATES
+ template<class _CharT2, class _Alloc2>
+ friend bool operator== (const _Rope_char_ptr_proxy<_CharT2,_Alloc2>& __x,
+ const _Rope_char_ptr_proxy<_CharT2,_Alloc2>& __y);
+#else
+ friend bool operator== __STL_NULL_TMPL_ARGS
+ (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x,
+ const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y);
+#endif
+ _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:
+# ifdef __STL_HAS_NAMESPACES
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+ // The one from the base class may not be directly visible.
+# endif
+ _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);
+ }
+#if defined(__STL_MEMBER_TEMPLATES) && defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER)
+ 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);
+#else
+ 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);
+#endif
+
+ reference operator[](size_t __n) {
+ return rope<_CharT,_Alloc>::_S_fetch(_M_root, _M_current_pos + __n);
+ }
+
+#if defined(__STL_MEMBER_TEMPLATES) && defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER)
+ 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);
+#else
+ 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);
+#endif
+};
+
+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+=(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);
+ }
+
+#if defined(__STL_MEMBER_TEMPLATES) && defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER)
+ 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);
+#else
+ 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);
+#endif
+};
+
+#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;
+ 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) {}
+};
+
+#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;
+
+ 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_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));
+
+ 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 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());
+ __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());
+ }
+
+#if defined(__STL_MEMBER_TEMPLATES) && defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER)
+ 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);
+#else
+ friend rope<_CharT,_Alloc> __STD_QUALIFIER
+ operator+ __STL_NULL_TMPL_ARGS (const rope<_CharT,_Alloc>& __left,
+ const rope<_CharT,_Alloc>& __right);
+
+ friend rope<_CharT,_Alloc> __STD_QUALIFIER
+ operator+ __STL_NULL_TMPL_ARGS (const rope<_CharT,_Alloc>& __left,
+ const _CharT* __right);
+
+ friend rope<_CharT,_Alloc> __STD_QUALIFIER
+ operator+ __STL_NULL_TMPL_ARGS (const rope<_CharT,_Alloc>& __left,
+ _CharT __right);
+#endif
+ // 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));
+ // _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 = 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);
+}
+
+#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
+
+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);
+}
+
+#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
+
+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);
+}
+
+#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
+
+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);
+}
+
+#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
+
+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);
+}
+
+#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
+
+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);
+}
+
+#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
+
+#ifdef __STL_USE_NEW_IOSTREAMS
+ template<class _CharT, class _Traits, class _Alloc>
+ basic_ostream<_CharT, _Traits>& operator<<
+ (basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r);
+#else
+ template<class _CharT, class _Alloc>
+ ostream& operator<< (ostream& __o, const rope<_CharT, _Alloc>& __r);
+#endif
+
+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 <ext/ropeimpl.h>
+
+# endif /* __SGI_STL_INTERNAL_ROPE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/ext/tree b/libstdc++-v3/ext/tree
new file mode 100644
index 000000000000..f6faf976e34f
--- /dev/null
+++ b/libstdc++-v3/ext/tree
@@ -0,0 +1,23 @@
+
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+#ifndef _CPP_EXT_TREE
+#define _CPP_EXT_TREE 1
+#include <bits/stl_tree.h>
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/inclosure b/libstdc++-v3/inclosure
new file mode 100755
index 000000000000..e9a14c917ea9
--- /dev/null
+++ b/libstdc++-v3/inclosure
@@ -0,0 +1,100 @@
+#!/bin/bash
+#
+# usage: inclosure [ -I dir ] ... [ -G header-name ] ... header-name ...
+#
+# Locates each standard header and argument header-name in the
+# specified "-I" include path (default is /usr/include) and parses
+# any header names out of its #include directives. These names are
+# treated recursively to identify a _transitive_closure_ of standard
+# header names, which is sorted and sent to standard output. Headers
+# not specified with -G, and included somewhere but not located are
+# reported.
+#
+# Each header reported by this program must be "shadowed" by a
+# file of the same name in a C++ header. See
+# http://www.cantrip.org/cheaders.html
+#
+# BUGS:
+# - Cannot cope with header file names that contain spaces
+# - Ignores comment-block delimiters
+# - Ignores sub-includes under #include_next headers.
+
+OLDH=/tmp/old$$
+echo "this-compensates-for-a-stupid-bug-in-GNU-fgrep." >$OLDH
+HDRS=/tmp/hdrs$$
+>$HDRS
+NEW=/tmp/new$$
+>$NEW
+IGNORES=/tmp/ignores$$
+echo "this-compensates-for-a-stupid-bug-in-GNU-fgrep.">$IGNORES
+
+trap "rm -f $NEW $HDRS $OLDH $IGNORES" 0
+
+# process arguments
+unset INCPATH
+while [ $# != 0 -a "$1" != "${1#-}" ]; do
+ FLAG="${1%%${1##-?}}"
+ case "$FLAG" in -I|-G)
+ ARG="${1##${FLAG}}"
+ if [ "$ARG" = "" ]; then
+ if [ $# != 0 ]; then
+ shift;
+ ARG="$1"
+ else
+ echo "$0: $FLAG needs an argument."
+ exit
+ fi
+ fi ;;
+ esac
+ shift
+ case "$FLAG" in
+ -I) INCPATH="$INCPATH $ARG" ;;
+ -G) echo " $ARG " >>$IGNORES ;;
+ esac
+done
+INCPATH=${INCPATH-"/usr/include"}
+
+# identify headers
+
+STDHDRS="assert.h ctype.h errno.h float.h limits.h \
+ locale.h math.h setjmp.h signal.h stdarg.h stddef.h \
+ stdio.h stdlib.h string.h time.h wchar.h wctype.h "
+OTHERS="$*"
+
+for file in $STDHDRS $OTHERS; do
+ echo "$file"
+done >$HDRS
+
+until cmp -s $OLDH $HDRS; do # (until no new headers found)
+
+ fgrep -v -f $OLDH $HDRS \
+ | while read file; do
+ found=no
+ for dir in $INCPATH; do
+ name="$dir/$file"
+ if [ -f "$name" ]; then
+ cat "$name"
+ found=yes
+ break;
+ fi
+ done
+ if [ "$found" = no ]; then # && echo " $file " | fgrep -v -q -f $IGNORES
+ echo "$0: warning: header $file not found in include path." $1>&2
+ fi
+ done \
+ | sed -n -e \
+'/^[ ]*#[ ]*include[ ]*<[^>]*>/s/^[^<]*<\([^>]*\)>.*/\1/p' \
+ | while read file; do
+ drop=no
+ for ignore in `cat $IGNORES`; do
+ if [ "$ignore" == "$file" ]; then drop=yes; fi
+ done
+ case "$file" in /*) drop=yes;; esac # no absolute paths
+ case $drop in no) echo "$file";; esac
+ done >$NEW
+ mv $HDRS $OLDH
+ cat $OLDH $NEW | sort -u -o $HDRS
+
+done
+cat $HDRS
+
diff --git a/libstdc++-v3/libio/ChangeLog b/libstdc++-v3/libio/ChangeLog
new file mode 100644
index 000000000000..65391f54ba72
--- /dev/null
+++ b/libstdc++-v3/libio/ChangeLog
@@ -0,0 +1,2669 @@
+2000-02-29 Benjamin Kosnik <bkoz@haight.constant.com>
+
+ * 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/libstdc++-v3/libio/Makefile.am b/libstdc++-v3/libio/Makefile.am
new file mode 100644
index 000000000000..07534f2b06e4
--- /dev/null
+++ b/libstdc++-v3/libio/Makefile.am
@@ -0,0 +1,62 @@
+## Makefile for the math subdirectory of the GNU C++ Standard library.
+##
+## Copyright (C) 1999 Cygnus Solutions
+##
+## 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
+
+noinst_LTLIBRARIES = libio.la
+
+includes =
+
+libio_headers = \
+ libio.h libioP.h iolibio.h
+
+if GLIBCPP_NEED_LIBIO
+LIBIO_SRCS = \
+ filedoalloc.c genops.c fileops.c stdfiles.c cleanup.c
+else
+LIBIO_SRCS =
+endif
+
+EXTRA_DIST = iostreamP.h
+
+libio_la_LIBADD = $(LIBIO_SRCS)
+libio_la_DEPENDENCIES = $(libio_la_LIBADD)
+libio_la_SOURCES = $(LIBIO_SRCS)
+
+LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+
+# Specifying that *.o depend on this one header
+$(libio_la_OBJECTS): _G_config.h
+
+# Generate this file.
+_G_config.h: $(srcdir)/gen-params
+ rootme=`pwd`/ ; export rootme; \
+ CC="$(CC) $(CINCLUDES)"; export CC; \
+ CXX="$(CXX) $(CXXINCLUDES) $(NOSTDINC) $(CXXFLAGS)"; export CXX; \
+ CONFIG_NM="$(NM)"; export CONFIG_NM; \
+ $(SHELL) $(srcdir)/gen-params LIB_VERSION=$(VERSION) $(G_CONFIG_ARGS) >tmp-params.h
+ mv tmp-params.h _G_config.h
+
+
+
+
diff --git a/libstdc++-v3/libio/Makefile.in b/libstdc++-v3/libio/Makefile.in
new file mode 100644
index 000000000000..80cbf5fed730
--- /dev/null
+++ b/libstdc++-v3/libio/Makefile.in
@@ -0,0 +1,349 @@
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
+host_alias = @host_alias@
+host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
+AR = @AR@
+AS = @AS@
+BUILD_LIBIO_INCLUDE = @BUILD_LIBIO_INCLUDE@
+CC = @CC@
+CPP = @CPP@
+CSTDIO_CC = @CSTDIO_CC@
+CSTDIO_H = @CSTDIO_H@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+DEBUGFLAGS = @DEBUGFLAGS@
+DLLTOOL = @DLLTOOL@
+EXEEXT = @EXEEXT@
+GCC_OBJDIR = @GCC_OBJDIR@
+GLIBCPP_CFLAGS = @GLIBCPP_CFLAGS@
+GLIBCPP_CXXFLAGS = @GLIBCPP_CXXFLAGS@
+LIBMATHOBJS = @LIBMATHOBJS@
+LIBSTRINGOBJS = @LIBSTRINGOBJS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+NAMESPACES = @NAMESPACES@
+OBJDUMP = @OBJDUMP@
+OPTLEVEL = @OPTLEVEL@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+THREADDEPS = @THREADDEPS@
+THREADINCS = @THREADINCS@
+THREADLIBS = @THREADLIBS@
+THREADOBJS = @THREADOBJS@
+THREADSPEC = @THREADSPEC@
+USE_LONG_DOUBLE = @USE_LONG_DOUBLE@
+VERSION = @VERSION@
+WERRORSUPPRESS = @WERRORSUPPRESS@
+cpu_include_dir = @cpu_include_dir@
+ctype_include_dir = @ctype_include_dir@
+glibcpp_basedir = @glibcpp_basedir@
+
+AUTOMAKE_OPTIONS = 1.3 cygnus
+
+noinst_LTLIBRARIES = libio.la
+
+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 cleanup.c
+@GLIBCPP_NEED_LIBIO_FALSE@LIBIO_SRCS = \
+
+EXTRA_DIST = iostreamP.h
+
+libio_la_LIBADD = $(LIBIO_SRCS)
+libio_la_DEPENDENCIES = $(libio_la_LIBADD)
+libio_la_SOURCES = $(LIBIO_SRCS)
+
+LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+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 =
+@GLIBCPP_NEED_LIBIO_TRUE@libio_la_OBJECTS = filedoalloc.lo genops.lo \
+@GLIBCPP_NEED_LIBIO_TRUE@fileops.lo stdfiles.lo cleanup.lo
+@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)
+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 .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 $<
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+
+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
+
+
+# Specifying that *.o depend on this one header
+$(libio_la_OBJECTS): _G_config.h
+
+# Generate this file.
+_G_config.h: $(srcdir)/gen-params
+ rootme=`pwd`/ ; export rootme; \
+ CC="$(CC) $(CINCLUDES)"; export CC; \
+ CXX="$(CXX) $(CXXINCLUDES) $(NOSTDINC) $(CXXFLAGS)"; export CXX; \
+ CONFIG_NM="$(NM)"; export CONFIG_NM; \
+ $(SHELL) $(srcdir)/gen-params LIB_VERSION=$(VERSION) $(G_CONFIG_ARGS) >tmp-params.h
+ mv tmp-params.h _G_config.h
+
+# 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/libstdc++-v3/libio/cleanup.c b/libstdc++-v3/libio/cleanup.c
new file mode 100644
index 000000000000..691fa838b26a
--- /dev/null
+++ b/libstdc++-v3/libio/cleanup.c
@@ -0,0 +1,17 @@
+#include "libioP.h"
+#if _G_HAVE_ATEXIT
+#include <stdlib.h>
+
+typedef void (*voidfunc) __P((void));
+
+static void
+_IO_register_cleanup ()
+{
+ atexit ((voidfunc)_IO_cleanup);
+ _IO_cleanup_registration_needed = 0;
+}
+
+void (*_IO_cleanup_registration_needed)() = _IO_register_cleanup;
+#else
+void (*_IO_cleanup_registration_needed)() = NULL;
+#endif /* _G_HAVE_ATEXIT */
diff --git a/libstdc++-v3/libio/filedoalloc.c b/libstdc++-v3/libio/filedoalloc.c
new file mode 100644
index 000000000000..a27455c4a5cb
--- /dev/null
+++ b/libstdc++-v3/libio/filedoalloc.c
@@ -0,0 +1,120 @@
+/* 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, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. [rescinded 22 July 1999]
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/* Modified for GNU iostream by Per Bothner 1991, 1992. */
+
+#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 stat st;
+
+#if !defined(_LIBC) && !defined(__linux__)
+ /* If _IO_cleanup_registration_needed is non-zero, we should call the
+ function it points to. This is to make sure _IO_cleanup gets called
+ on exit. We call it from _IO_file_doallocate, since that is likely
+ to get called by any program that does buffered I/O. */
+ if (_IO_cleanup_registration_needed)
+ (*_IO_cleanup_registration_needed) ();
+#endif
+
+ 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/libstdc++-v3/libio/fileops.c b/libstdc++-v3/libio/fileops.c
new file mode 100644
index 000000000000..54e13d3f18fe
--- /dev/null
+++ b/libstdc++-v3/libio/fileops.c
@@ -0,0 +1,811 @@
+/* Copyright (C) 1993, 1995, 1997 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. */
+
+
+#include "libioP.h"
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+
+
+#ifdef _LIBC
+# define open(Name, Flags, Prot) __open (Name, Flags, Prot)
+# define close(FD) __close (FD)
+# define fstat(FD, Statbuf) __fstat (FD, Statbuf)
+# 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)
+#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_file_init (fp)
+ _IO_FILE *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->_offset = _IO_pos_BAD;
+ fp->_IO_file_flags |= CLOSED_FILEBUF_FLAGS;
+
+ _IO_link_in(fp);
+ fp->_fileno = -1;
+}
+
+int
+_IO_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. */
+ _IO_setb (fp, NULL, NULL, 0);
+ _IO_setg (fp, NULL, NULL, NULL);
+ _IO_setp (fp, NULL, NULL);
+
+ _IO_un_link (fp);
+ fp->_flags = _IO_MAGIC|CLOSED_FILEBUF_FLAGS;
+ fp->_fileno = EOF;
+ fp->_offset = _IO_pos_BAD;
+
+ return close_status ? close_status : write_status;
+}
+
+void
+_IO_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);
+}
+
+_IO_FILE *
+_IO_file_fopen (fp, filename, mode)
+ _IO_FILE *fp;
+ const char *filename;
+ const char *mode;
+{
+ int oflags = 0, omode;
+ int read_write, fdesc;
+ int oprot = 0666;
+ 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;
+ }
+ if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+'))
+ {
+ omode = O_RDWR;
+ read_write &= _IO_IS_APPENDING;
+ }
+ fdesc = open (filename, omode|oflags, oprot);
+ 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_off_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT)
+ == _IO_pos_BAD && errno != ESPIPE)
+ return NULL;
+ _IO_link_in (fp);
+ return fp;
+}
+
+_IO_FILE *
+_IO_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_off_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
+ == _IO_pos_BAD && errno != ESPIPE)
+ return NULL;
+ return fp;
+}
+
+_IO_FILE *
+_IO_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;
+}
+
+/* Write TO_DO bytes from DATA to FP.
+ Then mark FP as having empty buffers. */
+
+int
+_IO_do_write (fp, data, to_do)
+ _IO_FILE *fp;
+ const char *data;
+ _IO_size_t to_do;
+{
+ _IO_size_t count;
+ if (to_do == 0)
+ return 0;
+ 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 it
+ 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_pos_t new_pos
+ = _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1);
+ if (new_pos == _IO_pos_BAD)
+ return EOF;
+ fp->_offset = new_pos;
+ }
+ count = _IO_SYSWRITE (fp, data, to_do);
+ if (fp->_cur_column)
+ fp->_cur_column = _IO_adjust_column (fp->_cur_column - 1, data, to_do) + 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->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
+ ? fp->_IO_buf_base : fp->_IO_buf_end);
+ return count != to_do ? EOF : 0;
+}
+
+int
+_IO_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)
+ {
+ __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)
+ _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_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)
+ {
+ /* 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;
+
+ if (f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
+ f->_IO_write_end = f->_IO_write_ptr;
+ f->_flags |= _IO_CURRENTLY_PUTTING;
+ }
+ if (ch == EOF)
+ return _IO_do_flush (f);
+ 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_do_flush (f) == EOF)
+ return EOF;
+ return (unsigned char) ch;
+}
+
+int
+_IO_file_sync (fp)
+ _IO_FILE *fp;
+{
+ _IO_size_t delta;
+ int retval = 0;
+
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+ _IO_flockfile (fp);
+ /* 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_off_t new_pos = _IO_SYSSEEK (fp, delta, 1);
+ if (new_pos != (_IO_off_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); */
+ _IO_cleanup_region_end (1);
+ return retval;
+}
+
+_IO_pos_t
+_IO_file_seekoff (fp, offset, dir, mode)
+ _IO_FILE *fp;
+ _IO_off_t offset;
+ int dir;
+ int mode;
+{
+ _IO_pos_t result;
+ _IO_off_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)
+ {
+ _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 += _IO_pos_as_off (fp->_offset);
+
+ dir = _IO_seek_set;
+ break;
+ case _IO_seek_set:
+ break;
+ case _IO_seek_end:
+ {
+ struct stat 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 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_pos_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);
+ return offset;
+ }
+#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;
+ return offset;
+ }
+#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);
+ return offset;
+ }
+#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;
+}
+
+_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_pos_t
+_IO_file_seek (fp, offset, dir)
+ _IO_FILE *fp;
+ _IO_off_t offset;
+ int dir;
+{
+ return lseek (fp->_fileno, offset, dir);
+}
+
+int
+_IO_file_stat (fp, st)
+ _IO_FILE *fp;
+ void *st;
+{
+ return fstat (fp->_fileno, (struct stat *) st);
+}
+
+int
+_IO_file_close (fp)
+ _IO_FILE *fp;
+{
+ return close (fp->_fileno);
+}
+
+_IO_ssize_t
+_IO_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 == EOF)
+ {
+ 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_file_xsputn (f, data, n)
+ _IO_FILE *f;
+ const void *data;
+ _IO_size_t n;
+{
+ register const char *s = (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)
+ {
+ memcpy (f->_IO_write_ptr, s, count);
+ s += count;
+ }
+ else
+ {
+ register char *p = f->_IO_write_ptr;
+ register int i = (int) count;
+ while (--i >= 0)
+ *p++ = *s++;
+ }
+ f->_IO_write_ptr += count;
+ to_do -= count;
+ }
+ if (to_do + must_flush > 0)
+ {
+ _IO_size_t block_size, dont_write;
+ /* Next flush the (full) buffer. */
+ if (__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;
+ dont_write = block_size >= 128 ? to_do % block_size : 0;
+
+ count = to_do - dont_write;
+ if (_IO_do_write (f, s, count) == EOF)
+ return n - to_do;
+ to_do = dont_write;
+
+ /* 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 (dont_write)
+ to_do -= _IO_default_xsputn (f, s+count, dont_write);
+ }
+ return n - to_do;
+}
+
+#if 0
+/* Work in progress */
+_IO_size_t
+_IO_file_xsgetn (fp, data, n)
+ _IO_FILE *fp;
+ void *data;
+ _IO_size_t n;
+{
+ register _IO_size_t more = n;
+ register char *s = data;
+ for (;;)
+ {
+ /* Data available. */
+ _IO_ssize_t count = fp->_IO_read_end - fp->_IO_read_ptr;
+ if (count > 0)
+ {
+ if (count > more)
+ count = more;
+ if (count > 20)
+ {
+ memcpy (s, fp->_IO_read_ptr, count);
+ s += count;
+ fp->_IO_read_ptr += count;
+ }
+ else if (count <= 0)
+ count = 0;
+ else
+ {
+ register char *p = fp->_IO_read_ptr;
+ register int i = (int) count;
+ while (--i >= 0)
+ *s++ = *p++;
+ fp->_IO_read_ptr = p;
+ }
+ more -= count;
+ }
+#if 0
+ if (! _IO_in put_mode (fp)
+ && ! _IO_have_markers (fp) && ! IO_have_backup (fp))
+ {
+ /* This is an optimization of _IO_file_underflow */
+ if (fp->_flags & _IO_NO_READS)
+ break;
+ /* If we're reading a lot of data, don't bother allocating
+ a buffer. But if we're only reading a bit, perhaps we should ??*/
+ if (count <= 512 && fp->_IO_buf_base == NULL)
+ _IO_doallocbuf (fp);
+ if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
+ _IO_flush_all_linebuffered ();
+
+ _IO_switch_to_get_mode (fp); ???;
+ count = _IO_SYSREAD (fp, s, more);
+ if (count <= 0)
+ {
+ if (count == 0)
+ fp->_flags |= _IO_EOF_SEEN;
+ else
+ fp->_flags |= _IO_ERR_SEEN, count = 0;
+ }
+
+ s += count;
+ more -= count;
+ }
+#endif
+ if (more == 0 || __underflow (fp) == EOF)
+ break;
+ }
+ return n - more;
+}
+#endif
+
+struct _IO_jump_t _IO_file_jumps =
+{
+ JUMP_INIT_DUMMY,
+ JUMP_INIT(finish, _IO_file_finish),
+ JUMP_INIT(overflow, _IO_file_overflow),
+ JUMP_INIT(underflow, _IO_file_underflow),
+ JUMP_INIT(uflow, _IO_default_uflow),
+ JUMP_INIT(pbackfail, _IO_default_pbackfail),
+ JUMP_INIT(xsputn, _IO_file_xsputn),
+ JUMP_INIT(xsgetn, _IO_default_xsgetn),
+ JUMP_INIT(seekoff, _IO_file_seekoff),
+ JUMP_INIT(seekpos, _IO_default_seekpos),
+ JUMP_INIT(setbuf, _IO_file_setbuf),
+ JUMP_INIT(sync, _IO_file_sync),
+ JUMP_INIT(doallocate, _IO_file_doallocate),
+ JUMP_INIT(read, _IO_file_read),
+ JUMP_INIT(write, _IO_file_write),
+ JUMP_INIT(seek, _IO_file_seek),
+ JUMP_INIT(close, _IO_file_close),
+ JUMP_INIT(stat, _IO_file_stat)
+};
diff --git a/libstdc++-v3/libio/gen-params b/libstdc++-v3/libio/gen-params
new file mode 100755
index 000000000000..6c07b46b36bf
--- /dev/null
+++ b/libstdc++-v3/libio/gen-params
@@ -0,0 +1,751 @@
+#!/bin/sh
+# Copyright (C) 1992, 1993, 1994, 1997, 1998, 1999 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.
+
+# Written by Per Bothner (bothner@cygnus.com)
+
+# This is a shell-script that figures out various things about a
+# system, and writes (to stdout) a C-style include files with
+# suitable definitions, including all the standard Posix types.
+# It works by compiling various test programs -- some are run through
+# the C pre-processor, and the output examined.
+# The test programs are only compiled, not executed, so the script
+# should even if you're cross-compiling.
+# It uses $CC (which defaults to cc) to compile C programs (extension .c),
+# and $CXX (which defaults to gcc) to compile C++ programs (extension .C).
+# The shell-script is written for libg++.a.
+
+# Usage: gen-params [NAME1=name1 ...]
+# - where an assignment (such as size_t="unsigned int" means to
+# use that value, instead of trying to figure it out.
+
+# Uncomment following line for debugging
+# set -x
+
+SED=sed
+
+# Evaluate the arguments (which should be assignments):
+for arg in "$@"; do
+ # Quote arg (i.e. FOO=bar => FOO='bar'), then eval it.
+ eval `echo "$arg" | ${SED} -e "s|^\(.*\)=\(.*\)|\1='\2'|"`
+done
+
+macro_prefix=${macro_prefix-"_G_"}
+rootdir=`pwd`/..
+gccdir=${gccdir-${rootdir}/gcc}
+binutilsdir=${binutilsdir-${rootdir}/binutils}
+CC=${CC-`if [ -f ${gccdir}/xgcc ] ; \
+ then echo ${gccdir}/xgcc -B${gccdir}/ ; \
+ else echo cc ; fi`}
+CXX=${CXX-`if [ -f ${gccdir}/xgcc ] ; \
+ then echo ${gccdir}/xgcc -B${gccdir}/ ; \
+ else echo gcc ; fi`}
+CPP=${CPP-`echo ${CC} -E`}
+CONFIG_NM=${CONFIG_NM-`if [ -f ${binutilsdir}/nm.new ] ; \
+ then echo ${binutilsdir}/nm.new ; \
+ else echo nm ; fi`}
+
+# 2000-02-20 bkoz
+# Eventually use AC_CHECK_PROG(NM,nm,nm) instead of this hackery.
+# For now, as solaris and cygwin seem to require this, hardwire it.
+if test -z "$CONFIG_NM"; then
+ CONFIG_NM=nm
+fi
+
+cat <<!EOF!
+/* AUTOMATICALLY GENERATED; DO NOT EDIT! */
+#ifndef ${macro_prefix}config_h
+#define ${macro_prefix}config_h
+!EOF!
+
+if [ x"${LIB_VERSION}" != "x" ] ; then
+ echo "#define ${macro_prefix}LIB_VERSION" '"'${LIB_VERSION}'"'
+fi
+
+# This program is used to test if the compiler prepends '_' before identifiers.
+# It is also used to check the g++ uses '$' or '.' various places.
+
+if test -z "${NAMES_HAVE_UNDERSCORE}" \
+ || test -z "${DOLLAR_IN_LABEL}" \
+ || test -z "${VTABLE_LABEL_PREFIX}"; then
+ cat >dummy.h <<!EOF!
+#ifdef __GNUG__
+#pragma interface
+#endif
+ struct filebuf {
+ virtual int foo();
+ };
+!EOF!
+ cat >dummy.C <<!EOF!
+#ifdef __GNUG__
+#pragma implementation
+#endif
+#include "dummy.h"
+ int filebuf::foo() { return 0; }
+ extern "C" int FUNC(int);
+ int FUNC(int i) { return i+10; }
+!EOF!
+
+ if ${CXX} -O -c dummy.C ; then
+ if test -z "${NAMES_HAVE_UNDERSCORE}" ; then
+ if test "`${CONFIG_NM} dummy.o | grep _FUNC`" != ""; then
+ NAMES_HAVE_UNDERSCORE=1
+ elif test "`${CONFIG_NM} dummy.o | grep FUNC`" != ""; then
+ NAMES_HAVE_UNDERSCORE=0
+ else
+ echo "${CONFIG_NM} failed to find FUNC in dummy.o!" 1>&2; exit -1;
+ fi
+ fi
+ echo "#define ${macro_prefix}NAMES_HAVE_UNDERSCORE ${NAMES_HAVE_UNDERSCORE}"
+
+ if test -z "${VTABLE_LABEL_PREFIX}" ; then
+ # Determine how virtual function tables are named. This is fragile,
+ # because different nm's produce output in different formats.
+ ${CONFIG_NM} dummy.o >TMP
+ if [ -n "`${SED} -n -e 's/ virtual table/nope/p' <TMP`" ] ; then
+ ${CONFIG_NM} --no-cplus dummy.o >TMP 2>/dev/null ||
+ ${CONFIG_NM} --no-demangle dummy.o >TMP 2>/dev/null ||
+ ${CONFIG_NM} dummy.o >TMP 2>/dev/null
+ fi
+ # First we look for a pattern that matches historical output from g++.
+ # We surround the actual label name by <> to separate it from
+ # other nm junk.
+ ${SED} -n -e 's/_*vt[$_.]7*filebuf/<&>/p' <TMP >dummy.out
+ # For paranoia's sake (e.g. if we're using some other C++ compiler)
+ # we try a more general pattern, and append the result.
+ grep -v foo <TMP \
+ | ${SED} -n -e 's/[a-zA-Z0-9_.$]*filebuf[a-zA-Z0-9_.$]*/<&>/p' \
+ >>dummy.out
+ # Now we get rid of the <>, and any other junk on the nm output line.
+ # (We get rid of <filebuf> in case nm included debugging output for
+ # class filebuf itself.) On windows32, we also need to delete the
+ # unique sections (.data$_vt$*), otherwise we get the wrong result.
+ # Finally, we select the first line of the result, and hope that's
+ # what we wanted!
+ vtab_name=`${SED} -n -e '/<filebuf>/d' \
+ -e '/\.data[$_.]<_vt\$7filebuf>/d' \
+ -e 's/^.*<\(.*\)>.*$/\1/p' \
+ <dummy.out | ${SED} -n -e '1p'`
+ case "${vtab_name}" in
+ *7filebuf) echo "#define ${macro_prefix}VTABLE_LABEL_HAS_LENGTH 1" ;;
+ *) echo "#define ${macro_prefix}VTABLE_LABEL_HAS_LENGTH 0" ;;
+ esac
+ VTABLE_LABEL_PREFIX=`echo $vtab_name | ${SED} -e 's/7*filebuf//'`
+ fi
+ echo "#define ${macro_prefix}VTABLE_LABEL_PREFIX" '"'"${VTABLE_LABEL_PREFIX}"'"'
+ if [ "${VTABLE_LABEL_PREFIX}" = "__vt_" -o \
+ "${VTABLE_LABEL_PREFIX}" = "___vt_" ] ; then
+ echo "#define ${macro_prefix}USING_THUNKS"
+ fi
+
+ # VTABLE_LABEL_PREFIX_ID is the same as VTABLE_LABEL_PREFIX,
+ # but the former is a C identifier, while the latter is a quoted
+ # st
+ if [ -z ""`echo ${VTABLE_LABEL_PREFIX} | ${SED} -e 's/[a-zA-Z0-9_]//g'` ] ; then
+ if [ "${NAMES_HAVE_UNDERSCORE}" = "1" ] ; then
+ VTABLE_LABEL_PREFIX=`echo ${VTABLE_LABEL_PREFIX} | ${SED} -e 's/^_//'`
+ fi
+ echo "#define ${macro_prefix}VTABLE_LABEL_PREFIX_ID ${VTABLE_LABEL_PREFIX}"
+ fi
+
+# if test -n "${DOLLAR_IN_LABEL}" ; then
+# echo "#define ${macro_prefix}DOLLAR_IN_LABEL ${DOLLAR_IN_LABEL}"
+# elif test "`${CONFIG_NM} dummy.o | grep 'vt[$$]7filebuf'`" != ""; then
+# echo "#define ${macro_prefix}DOLLAR_IN_LABEL 1"
+# elif test "`${CONFIG_NM} dummy.o | grep 'vt[.]7filebuf'`" != ""; then
+# echo "#define ${macro_prefix}DOLLAR_IN_LABEL 0"
+# elif test "`${CONFIG_NM} dummy.o | grep 'vtbl__7filebuf'`" != ""; then
+# echo "#define ${macro_prefix}DOLLAR_IN_LABEL 0"
+# else
+# echo "gen-params: ${CONFIG_NM} failed to find vt[.\$]filebuf in dummy.o!" 1>&2; exit 1
+# fi
+ else
+ # The compile failed for some reason (no C++?)
+ echo "gen-params: could not compile dummy.C with ${CXX}" 1>&2; exit 1;
+ fi
+fi
+
+# A little test program to check if struct stat has st_blksize.
+cat >dummy.c <<!EOF!
+#include <sys/types.h>
+#include <sys/stat.h>
+int BLKSIZE(struct stat *st)
+{
+ return st->st_blksize;
+}
+!EOF!
+
+if ${CC} -c dummy.c >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}HAVE_ST_BLKSIZE 1"
+else
+ echo "#define ${macro_prefix}HAVE_ST_BLKSIZE 0"
+fi
+
+# A little test program to check if the name 'clog' is defined in libm,
+# as it is under DEC UNIX.
+cat >dummy.c <<!EOF!
+int clog;
+main () {}
+!EOF!
+
+if ${CC} dummy.c -lm 2>&1 >/dev/null | grep clog >/dev/null; then
+ echo "#define ${macro_prefix}CLOG_CONFLICT 1"
+fi
+
+echo ""
+
+# Next, generate definitions for the standard types (such as mode_t)
+# compatible with those in the standard C header files.
+# It works by a dummy program through the C pre-processor, and then
+# using sed to search for typedefs in the output.
+
+for hdr in wchar wctype; do
+ eval $hdr=0
+ cat >dummy.c <<EOF
+#include <${hdr}.h>
+EOF
+ if ${CPP} dummy.c >/dev/null 2>&1 ; then eval $hdr=1; fi
+done
+
+cat >dummy.c <<!EOF!
+#include <sys/types.h>
+#include <stddef.h>
+#ifdef __STDC__
+#include <stdarg.h>
+#else /* !__STDC__ */
+#include <varargs.h>
+#endif /* __STDC__ */
+#include <stdio.h>
+#include <time.h>
+#include <signal.h>
+#ifdef __STDC__
+#include <limits.h>
+#endif
+#if WCHAR == 1
+#include <wchar.h>
+#endif
+#if WCTYPE == 1
+#include <wctype.h>
+#endif
+#ifdef size_t
+typedef size_t Xsize_t;
+#elif defined(__SIZE_TYPE__)
+typedef __SIZE_TYPE__ Xsize_t;
+#endif
+#ifdef ptrdiff_t
+typedef ptrdiff_t Xptrdiff_t;
+#elif defined(__PTRDIFF_TYPE__)
+typedef __PTRDIFF_TYPE__ Xptrdiff_t;
+#endif
+#ifdef wchar_t
+typedef wchar_t Xwchar_t;
+#elif defined(__WCHAR_TYPE__)
+typedef __WCHAR_TYPE__ Xwchar_t;
+#endif
+#ifdef va_list
+typedef va_list XXXva_list;
+#endif
+#ifdef BUFSIZ
+long XBUFSIZ=BUFSIZ;
+#endif
+#ifdef FOPEN_MAX
+long XFOPEN_MAX=FOPEN_MAX;
+#endif
+#ifdef FILENAME_MAX
+long XFILENAME_MAX=FILENAME_MAX;
+#endif
+#ifdef SHRT_MAX
+long XSHRT_MAX=SHRT_MAX;
+#endif
+#ifdef INT_MAX
+long XINT_MAX=INT_MAX;
+#endif
+#ifdef LONG_MAX
+long XLONG_MAX=LONG_MAX;
+#endif
+#ifdef LONG_LONG_MAX
+long XLONG_LONG_MAX=LONG_LONG_MAX;
+#endif
+!EOF!
+
+if ${CPP} dummy.c -DWCHAR=$wchar -DWCTYPE=$wctype >TMP ; then true
+else
+ echo "gen-params: could not invoke ${CPP} on dummy.c" 1>&2 ; exit 1
+fi
+tr ' ' ' ' <TMP >dummy.out
+
+for TYPE in dev_t clock_t fpos_t gid_t ino_t mode_t nlink_t off_t pid_t ptrdiff_t sigset_t size_t ssize_t time_t uid_t va_list wchar_t wint_t int16_t uint16_t int32_t uint_32_t u_int16_t u_int32_t; do
+ eval IMPORTED=\$$TYPE
+ if [ -n "${IMPORTED}" ] ; then
+ eval "$TYPE='$IMPORTED'"
+ else
+ t=$TYPE
+ VALUE=''
+
+ # Follow `typedef VALUE TYPE' chains, but don't loop indefinitely.
+ for iteration in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
+ # Search dummy.out for a typedef for X*$t.
+ sed_script="
+ s/unsigned long long int/_G_ullong/g
+ s/long long int/_G_llong/g
+ s/unsigned long long/_G_ullong/g
+ s/long long/_G_llong/g
+ /.*typedef *\\(.*[^ ]\\) *X*$t *;.*/{s||\1|;p;q;}
+ /.*typedef *\\(.*[^ a-zA-Z0-9_]\\)X*$t *;.*/{s||\1|;p;q;}
+ "
+ t=`${SED} -n "$sed_script" <dummy.out`
+ case "$t" in
+ '')
+ break;;
+ *)
+ # Found a type $t; save it in VALUE.
+ VALUE=$t
+ # If it won't cause problems in matching,
+ # look for a typedef for it in turn.
+ case "$VALUE" in
+ *.* | */* | *\ * | *\** | *\[* | *\\*) break;;
+ esac;;
+ esac
+ done
+
+ case "$VALUE" in
+ ?*) eval "$TYPE=\"$VALUE\""
+ esac
+ fi
+done
+
+# Look for some standard macros.
+for NAME in BUFSIZ FOPEN_MAX FILENAME_MAX NULL; do
+ eval IMPORTED=\$$NAME
+ if [ -n "${IMPORTED}" ] ; then
+ eval "$NAME='$IMPORTED /* specified */'"
+ else
+ rm -f TMP
+ ${SED} -n -e 's| *;|;|g' -e "s|long X${NAME}= *\(.*\);|\1|w TMP" \
+ <dummy.out>/dev/null
+ # Now select the first definition.
+ if [ -s TMP ]; then
+ eval "$NAME='"`${SED} -e '2,$d' <TMP`"'"
+ fi
+ fi
+done
+
+# These macros must be numerical constants; strip any trailing 'L's.
+for NAME in SHRT_MAX INT_MAX LONG_MAX LONG_LONG_MAX; do
+ eval IMPORTED=\$$NAME
+ if [ -n "${IMPORTED}" ] ; then
+ eval "$NAME='$IMPORTED /* specified */'"
+ else
+ rm -f TMP
+ ${SED} -n -e 's| *;|;|g' -e "s|long X${NAME}= *\([0-9]*\)L* *;|\1|w TMP" \
+ <dummy.out>/dev/null
+ # Now select the first definition.
+ if [ -s TMP ]; then
+ eval "$NAME='"`${SED} -e '2,$d' <TMP`"'"
+ fi
+ fi
+done
+
+# Figure out integral type sizes.
+
+default_int16='short /* deduction failed */'
+default_int32='long /* deduction failed */'
+INT16=32767
+INT32=2147483647
+
+if [ "${SHRT_MAX}" = $INT16 ] ; then
+ default_int16='short /* deduced */'
+ if [ "${LONG_MAX}" = $INT32 ] ; then
+ default_int32='long /* deduced */'
+ elif [ "${INT_MAX}" = $INT32 ] ; then
+ default_int32='int /* deduced */'
+ fi
+fi
+
+[ -n "$u_int16_t" ] && uint16_t="$u_int16_t"
+[ -n "$u_int32_t" ] && uint32_t="$u_int32_t"
+
+[ -z "$int16_t" ] && int16_t="$default_int16"
+[ -z "$uint16_t" ] && uint16_t="unsigned $int16_t"
+[ -z "$int32_t" ] && int32_t="$default_int32"
+[ -z "$uint32_t" ] && uint32_t="unsigned $int32_t"
+
+cat <<!EOF!
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+typedef int ${macro_prefix}int8_t __attribute__((__mode__(__QI__)));
+typedef unsigned int ${macro_prefix}uint8_t __attribute__((__mode__(__QI__)));
+typedef int ${macro_prefix}int16_t __attribute__((__mode__(__HI__)));
+typedef unsigned int ${macro_prefix}uint16_t __attribute__((__mode__(__HI__)));
+typedef int ${macro_prefix}int32_t __attribute__((__mode__(__SI__)));
+typedef unsigned int ${macro_prefix}uint32_t __attribute__((__mode__(__SI__)));
+typedef int ${macro_prefix}int64_t __attribute__((__mode__(__DI__)));
+typedef unsigned int ${macro_prefix}uint64_t __attribute__((__mode__(__DI__)));
+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 8
+__extension__ typedef long long ${macro_prefix}llong;
+__extension__ typedef unsigned long long ${macro_prefix}ullong;
+#endif
+#else
+typedef $int16_t ${macro_prefix}int16_t;
+typedef $uint16_t ${macro_prefix}uint16_t;
+typedef $int32_t ${macro_prefix}int32_t;
+typedef $uint32_t ${macro_prefix}uint32_t;
+#endif
+
+typedef ${clock_t-int /* default */} ${macro_prefix}clock_t;
+typedef ${dev_t-int /* default */} ${macro_prefix}dev_t;
+typedef ${fpos_t-long /* default */} ${macro_prefix}fpos_t;
+typedef ${gid_t-int /* default */} ${macro_prefix}gid_t;
+typedef ${ino_t-int /* default */} ${macro_prefix}ino_t;
+typedef ${mode_t-int /* default */} ${macro_prefix}mode_t;
+typedef ${nlink_t-int /* default */} ${macro_prefix}nlink_t;
+typedef ${off_t-long /* default */} ${macro_prefix}off_t;
+typedef ${pid_t-int /* default */} ${macro_prefix}pid_t;
+#ifndef __PTRDIFF_TYPE__
+#define __PTRDIFF_TYPE__ ${ptrdiff_t-long int /* default */}
+#endif
+typedef __PTRDIFF_TYPE__ ${macro_prefix}ptrdiff_t;
+typedef ${sigset_t-int /* default */} ${macro_prefix}sigset_t;
+#ifndef __SIZE_TYPE__
+#define __SIZE_TYPE__ ${size_t-unsigned long /* default */}
+#endif
+typedef __SIZE_TYPE__ ${macro_prefix}size_t;
+typedef ${time_t-int /* default */} ${macro_prefix}time_t;
+typedef ${uid_t-int /* default */} ${macro_prefix}uid_t;
+typedef ${wchar_t-int /* default */} ${macro_prefix}wchar_t;
+
+#define ${macro_prefix}BUFSIZ ${BUFSIZ-1024 /* default */}
+#define ${macro_prefix}FOPEN_MAX ${FOPEN_MAX-32 /* default */}
+#define ${macro_prefix}FILENAME_MAX ${FILENAME_MAX-1024 /* default */}
+#if defined (__cplusplus) || defined (__STDC__)
+#define ${macro_prefix}ARGS(ARGLIST) ARGLIST
+#else
+#define ${macro_prefix}ARGS(ARGLIST) ()
+#endif
+#if !defined (__GNUG__) || defined (__STRICT_ANSI__)
+#define ${macro_prefix}NO_NRV
+#endif
+#if !defined (__GNUG__)
+#define _G_NO_EXTERN_TEMPLATES
+#endif
+!EOF!
+
+# ssize_t is the signed version of size_t
+if [ -n "${ssize_t}" ] ; then
+ echo "typedef ${ssize_t} ${macro_prefix}ssize_t;"
+elif [ -z "${size_t}" ] ; then
+ echo "typedef long ${macro_prefix}ssize_t;"
+else
+ # Remove "unsigned" from ${size_t} to get ${ssize_t}.
+ tmp="`echo ${size_t} | ${SED} -e 's|unsigned||g' -e 's| | |g'`"
+ if [ -z "$tmp" ] ; then
+ tmp=int
+ else
+ # check $tmp doesn't conflict with <unistd.h>
+ echo "#include <unistd.h>
+ extern $tmp read();" >dummy.c
+ ${CC} -c dummy.c >/dev/null 2>&1 || tmp=int
+ fi
+ echo "typedef $tmp /* default */ ${macro_prefix}ssize_t;"
+fi
+
+# wint_t is often the integral type to which wchar_t promotes.
+if [ -z "${wint_t}" ] ; then
+ for TYPE in int 'unsigned int' 'long int' 'long unsigned int'; do
+ cat >dummy.C <<!EOF!
+#ifndef __WCHAR_TYPE__
+#define __WCHAR_TYPE__ ${wchar_t-int /* default */}
+#endif
+typedef __WCHAR_TYPE__ ${macro_prefix}wchar_t;
+void foo ($TYPE);
+void foo (double);
+void bar (${macro_prefix}wchar_t w)
+{
+ foo (w);
+}
+!EOF!
+ if ${CXX} -c dummy.C >/dev/null 2>&1 ; then
+ wint_t="$TYPE /* default */"
+ break
+ fi
+ done
+fi
+echo "typedef ${wint_t-int /* wchar_t is broken */} ${macro_prefix}wint_t;"
+
+# va_list can cause problems (e.g. some systems have va_list as a struct).
+# Check to see if ${va_list-char*} really is compatible with stdarg.h.
+cat >dummy.C <<!EOF!
+#define X_va_list ${va_list-char* /* default */}
+extern long foo(X_va_list ap); /* Check that X_va_list compiles on its own */
+extern "C" {
+#include <stdarg.h>
+}
+long foo(X_va_list ap) { return va_arg(ap, long); }
+long bar(int i, ...)
+{ va_list ap; long j; va_start(ap, i); j = foo(ap); va_end(ap); return j; }
+!EOF!
+if ${CXX} -c dummy.C >/dev/null 2>&1 ; then
+ # Ok: We have something that works.
+ echo "typedef ${va_list-char* /* default */} ${macro_prefix}va_list;"
+else
+ echo "#define ${macro_prefix}NEED_STDARG_H"
+ # Check and see if we have __gnuc_va_list, as we might set up define
+ # loops if we use va_list.
+ cat >dummy.C <<!EOF!
+#include <stdarg.h>
+long foo(__gnuc_va_list ap) { return va_arg(ap, long); }
+!EOF!
+ if ${CXX} -c dummy.C >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}va_list __gnuc_va_list"
+ else
+ echo "#define ${macro_prefix}va_list va_list"
+ fi
+fi
+
+cat >dummy.c <<!EOF!
+#include <signal.h>
+extern int (*signal())();
+extern int dummy (int);
+main()
+{
+ int (*oldsig)(int) = signal (1, dummy);
+ (void) signal (2, oldsig);
+ return 0;
+}
+!EOF!
+if ${CC} -c dummy.c >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}signal_return_type int"
+else
+ echo "#define ${macro_prefix}signal_return_type void"
+fi
+
+# check sprintf return type
+
+cat >dummy.c <<!EOF!
+#include <stdio.h>
+extern int sprintf(); char buf[100];
+int main() { return sprintf(buf, "%d", 34); }
+!EOF!
+if ${CC} -c dummy.c >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}sprintf_return_type int"
+else
+ echo "#define ${macro_prefix}sprintf_return_type char*"
+fi
+
+if test -n "${HAVE_ATEXIT}" ; then
+ echo "#define ${macro_prefix}HAVE_ATEXIT ${HAVE_ATEXIT}"
+else
+ cat >dummy.c <<!EOF!
+#include <stdlib.h>
+int main()
+{
+ atexit (0);
+}
+!EOF!
+ if ${CC} dummy.c >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}HAVE_ATEXIT 1"
+ else
+ echo "#define ${macro_prefix}HAVE_ATEXIT 0"
+ fi
+fi
+
+
+# *** Check for presence of certain include files ***
+
+# check for sys/resource.h
+
+if test -n "${HAVE_SYS_RESOURCE}" ; then
+ echo "#define ${macro_prefix}HAVE_SYS_RESOURCE ${HAVE_SYS_RESOURCE}"
+else
+ cat >dummy.c <<!EOF!
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+ int main()
+ {
+ struct rusage res;
+ getrusage(RUSAGE_SELF, &res);
+ return (int)(res.ru_utime.tv_sec + (res.ru_utime.tv_usec / 1000000.0));
+ }
+!EOF!
+ # Note: We link because some systems have sys/resource, but not getrusage().
+ if ${CC} dummy.c >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}HAVE_SYS_RESOURCE 1"
+ else
+ echo "#define ${macro_prefix}HAVE_SYS_RESOURCE 0"
+ fi
+fi
+
+# check for struct tms in sys/times.h
+
+if test -n "${HAVE_SYS_TIMES}" ; then
+ echo "#define ${macro_prefix}HAVE_SYS_TIMES ${HAVE_SYS_TIMES}"
+else
+ cat >dummy.c <<!EOF!
+#include <sys/types.h>
+#include <sys/times.h>
+ int main()
+ {
+ struct tms s;
+ return s.tms_utime;
+ }
+!EOF!
+ if ${CC} -c dummy.c >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}HAVE_SYS_TIMES 1"
+ else
+ echo "#define ${macro_prefix}HAVE_SYS_TIMES 0"
+ fi
+fi
+
+# check for sys/socket.h
+
+if test -n "${HAVE_SYS_SOCKET}" ; then
+ echo "#define ${macro_prefix}HAVE_SYS_SOCKET ${HAVE_SYS_SOCKET}"
+else
+ echo '#include <sys/types.h>' >dummy.c
+ echo '#include <sys/socket.h>' >>dummy.c
+ if ${CC} -c dummy.c >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}HAVE_SYS_SOCKET 1"
+ else
+ echo "#define ${macro_prefix}HAVE_SYS_SOCKET 0"
+ fi
+fi
+
+# check for sys/cdefs.h
+
+if test -n "${HAVE_SYS_CDEFS}" ; then
+ echo "#define ${macro_prefix}HAVE_SYS_CDEFS ${HAVE_SYS_CDEFS}"
+else
+ echo '#include <sys/cdefs.h>' >dummy.c
+ echo 'extern int myfunc __P((int, int));' >>dummy.c
+ if ${CC} -c dummy.c >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}HAVE_SYS_CDEFS 1"
+ else
+ echo "#define ${macro_prefix}HAVE_SYS_CDEFS 0"
+ fi
+fi
+
+# Check for a (Posix-compatible) sys/wait.h */
+
+if test -n "${HAVE_SYS_WAIT}" ; then
+ echo "#define ${macro_prefix}HAVE_SYS_WAIT ${HAVE_SYS_WAIT}"
+else
+ cat >dummy.c <<!EOF!
+#include <sys/types.h>
+#include <sys/wait.h>
+ int f() { int i; wait(&i); return i; }
+!EOF!
+ if ${CC} -c dummy.c >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}HAVE_SYS_WAIT 1"
+ else
+ echo "#define ${macro_prefix}HAVE_SYS_WAIT 0"
+ fi
+fi
+
+if test -n "${HAVE_UNISTD}" ; then
+ echo "#define ${macro_prefix}HAVE_UNISTD ${HAVE_UNISTD}"
+else
+ echo '#include <unistd.h>' >dummy.c
+ if ${CC} -c dummy.c >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}HAVE_UNISTD 1"
+ else
+ echo "#define ${macro_prefix}HAVE_UNISTD 0"
+ fi
+fi
+
+if test -n "${HAVE_DIRENT}" ; then
+ echo "#define ${macro_prefix}HAVE_DIRENT ${HAVE_DIRENT}"
+else
+ echo '#include <sys/types.h>
+#include <dirent.h>' >dummy.c
+ if ${CC} -c dummy.c >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}HAVE_DIRENT 1"
+ else
+ echo "#define ${macro_prefix}HAVE_DIRENT 0"
+ fi
+fi
+
+if test -n "${HAVE_CURSES}" ; then
+ echo "#define ${macro_prefix}HAVE_CURSES ${HAVE_CURSES}"
+else
+ echo '#include <curses.h>' >dummy.c
+ if ${CC} -c dummy.c >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}HAVE_CURSES 1"
+ else
+ echo "#define ${macro_prefix}HAVE_CURSES 0"
+ fi
+fi
+
+# There is no test for this at the moment; it is just set by the
+# configuration files.
+if test -n "${MATH_H_INLINES}" ; then
+ echo "#define ${macro_prefix}MATH_H_INLINES ${MATH_H_INLINES}"
+else
+ echo "#define ${macro_prefix}MATH_H_INLINES 0"
+fi
+
+if test -n "${HAVE_BOOL}" ; then
+ echo "#define ${macro_prefix}HAVE_BOOL ${HAVE_BOOL}"
+else
+ echo 'bool i=true,j=false;' >dummy.C
+ if ${CXX} -c dummy.C >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}HAVE_BOOL 1"
+ else
+ echo "#define ${macro_prefix}HAVE_BOOL 0"
+ fi
+fi
+
+if test -n "${NO_USE_DTOA}" ; then
+ echo "#define ${macro_prefix}NO_USE_DTOA 1"
+fi
+if test -n "${USE_INT32_FLAGS}" ; then
+ echo "#define ${macro_prefix}USE_INT32_FLAGS 1"
+fi
+
+if test -n "$HAVE_PRINTF_FP"; then
+ echo "#define ${macro_prefix}HAVE_PRINTF_FP $HAVE_PRINTF_FP"
+ echo "#define ${macro_prefix}HAVE_LONG_DOUBLE_IO $HAVE_LONG_DOUBLE_IO"
+else
+ # A little test program to check if __printf_fp is available.
+ cat >dummy.c <<EOF
+int main()
+{
+ return __printf_fp ();
+}
+EOF
+
+ if ${CC} dummy.c >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}HAVE_PRINTF_FP 1"
+ echo "#define ${macro_prefix}HAVE_LONG_DOUBLE_IO 1"
+ else
+ echo "#define ${macro_prefix}HAVE_PRINTF_FP 0"
+ echo "#define ${macro_prefix}HAVE_LONG_DOUBLE_IO 0"
+ fi
+fi
+
+# Uncomment the following line if you don't have working templates.
+# echo "#define ${macro_prefix}NO_TEMPLATES"
+
+# Override bogus definitions of NULL in system headers.
+cat <<EOF
+#undef NULL
+#define __need_NULL
+#include <stddef.h>
+EOF
+
+rm -f dummy.C dummy.o dummy.c dummy.out TMP core a.out
+
+echo "#endif /* !${macro_prefix}config_h */"
diff --git a/libstdc++-v3/libio/genops.c b/libstdc++-v3/libio/genops.c
new file mode 100644
index 000000000000..b899e150afab
--- /dev/null
+++ b/libstdc++-v3/libio/genops.c
@@ -0,0 +1,946 @@
+/* Copyright (C) 1993, 1995, 1997, 1998 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>
+
+void
+_IO_un_link (fp)
+ _IO_FILE *fp;
+{
+ if (fp->_flags & _IO_LINKED)
+ {
+ _IO_FILE **f;
+ for (f = &_IO_list_all; *f != NULL; f = &(*f)->_chain)
+ {
+ if (*f == fp)
+ {
+ *f = fp->_chain;
+ break;
+ }
+ }
+ fp->_flags &= ~_IO_LINKED;
+ }
+}
+
+void
+_IO_link_in (fp)
+ _IO_FILE *fp;
+{
+ if ((fp->_flags & _IO_LINKED) == 0)
+ {
+ fp->_flags |= _IO_LINKED;
+ fp->_chain = _IO_list_all;
+ _IO_list_all = fp;
+ }
+}
+
+/* Return minimum _pos markers
+ Assumes the current get area is the main get area. */
+static _IO_size_t _IO_least_marker __P ((_IO_FILE *fp));
+
+static _IO_size_t
+_IO_least_marker (fp)
+ _IO_FILE *fp;
+{
+ _IO_ssize_t least_so_far = fp->_IO_read_end - 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;
+
+ 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 _gbase and _IO_save_base. */
+ tmp = fp->_IO_read_base;
+ fp->_IO_read_base = fp->_IO_save_base;
+ fp->_IO_save_base = tmp;
+
+ 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;
+{
+ return _IO_OVERFLOW (f, ch);
+}
+
+static int save_for_backup __P ((_IO_FILE *fp));
+
+ static int
+save_for_backup (fp)
+ _IO_FILE *fp;
+{
+ /* Append [_IO_read_base.._IO_read_end] to backup area. */
+ int least_mark = _IO_least_marker (fp);
+ /* needed_size is how much space we need in the backup area. */
+ int needed_size = (fp->_IO_read_end - fp->_IO_read_base) - least_mark;
+ int current_Bsize = fp->_IO_save_end - fp->_IO_save_base;
+ int avail; /* Extra space available for future expansion. */
+ int 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)
+ {
+ memcpy (new_buffer + avail,
+ fp->_IO_save_end + least_mark,
+ -least_mark);
+ memcpy (new_buffer + avail - least_mark,
+ fp->_IO_read_base,
+ fp->_IO_read_end - fp->_IO_read_base);
+ }
+ 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,
+ fp->_IO_read_end - fp->_IO_read_base);
+ }
+ else if (needed_size > 0)
+ memcpy (fp->_IO_save_base + avail,
+ fp->_IO_read_base + least_mark,
+ needed_size);
+ }
+ /* FIXME: Dubious arithmetic if pointers are NULL */
+ fp->_IO_backup_base = fp->_IO_save_base + avail;
+ /* Adjust all the streammarkers. */
+ delta = fp->_IO_read_end - 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 (_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))
+ return EOF;
+ }
+ else if (_IO_have_backup (fp))
+ _IO_free_backup_area (fp);
+ return _IO_UNDERFLOW (fp);
+}
+
+int
+__uflow (fp)
+ _IO_FILE *fp;
+{
+ 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))
+ 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)
+ {
+ memcpy (f->_IO_write_ptr, s, count);
+ s += count;
+ f->_IO_write_ptr += 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 || __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)
+ {
+ memcpy (s, fp->_IO_read_ptr, count);
+ s += count;
+ 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_pos_t
+_IO_default_seekpos (fp, pos, mode)
+ _IO_FILE *fp;
+ _IO_pos_t pos;
+ int mode;
+{
+ return _IO_SEEKOFF (fp, _IO_pos_as_off (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;
+{
+ 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;
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_init (*fp->_lock);
+#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 (fp);
+}
+
+_IO_pos_t
+_IO_default_seekoff (fp, offset, dir, mode)
+ _IO_FILE *fp;
+ _IO_off_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;
+ _IO_FILE *fp;
+ for (fp = _IO_list_all; fp != NULL; fp = fp->_chain)
+ if (fp->_IO_write_ptr > fp->_IO_write_base
+ && _IO_OVERFLOW (fp, EOF) == EOF)
+ result = EOF;
+ return result;
+}
+
+void
+_IO_flush_all_linebuffered ()
+{
+ _IO_FILE *fp;
+ for (fp = _IO_list_all; fp != NULL; fp = fp->_chain)
+ if ((fp->_flags & _IO_NO_WRITES) == 0 && fp->_flags & _IO_LINE_BUF)
+ _IO_OVERFLOW (fp, EOF);
+}
+
+static void _IO_unbuffer_all __P ((void));
+
+static void
+_IO_unbuffer_all ()
+{
+ _IO_FILE *fp;
+ for (fp = _IO_list_all; fp != NULL; fp = fp->_chain)
+ if (! (fp->_flags & _IO_UNBUFFERED))
+ _IO_SETBUF (fp, NULL, 0);
+}
+
+void
+_IO_cleanup ()
+{
+ _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_all ();
+}
+
+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)
+ {
+ /* Need to handle a filebuf in write mode (switch to read mode). FIXME!*/
+ if (_IO_have_backup (fp) && !_IO_in_backup (fp))
+ _IO_switch_to_backup_area (fp);
+
+ 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;
+ _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;
+ if (c != EOF && *fp->_IO_read_ptr != c)
+ *fp->_IO_read_ptr = c;
+ return (unsigned char) *fp->_IO_read_ptr;
+}
+
+_IO_pos_t
+_IO_default_seek (fp, offset, dir)
+ _IO_FILE *fp;
+ _IO_off_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;
+}
+
+
+#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)
+#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL)
+void _cleanup () __attribute__ ((weak, alias ("_IO_cleanup")));
+#endif
+
+#ifdef text_set_element
+text_set_element(__libc_atexit, _cleanup);
+#endif
diff --git a/libstdc++-v3/libio/iolibio.h b/libstdc++-v3/libio/iolibio.h
new file mode 100644
index 000000000000..083b198b4485
--- /dev/null
+++ b/libstdc++-v3/libio/iolibio.h
@@ -0,0 +1,63 @@
+#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 _IO_FILE *_IO_fdopen __P((int, const char*));
+extern int _IO_fflush __P((_IO_FILE*));
+extern int _IO_fgetpos __P((_IO_FILE*, _IO_fpos_t*));
+extern char* _IO_fgets __P((char*, int, _IO_FILE*));
+extern _IO_FILE *_IO_fopen __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 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));
+
+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_fpos_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)
+#if _G_IO_IO_FILE_VERSION == 0x20001
+#define _IO_freopen(FILENAME, MODE, FP) \
+ (_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE, 0))
+#else
+#define _IO_freopen(FILENAME, MODE, FP) \
+ (_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE))
+#endif
+#define _IO_fileno(FP) ((FP)->_fileno)
+extern _IO_FILE* _IO_popen __P((const char*, const char*));
+#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)
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/libstdc++-v3/libio/libio.h b/libstdc++-v3/libio/libio.h
new file mode 100644
index 000000000000..1bc57b2fcc74
--- /dev/null
+++ b/libstdc++-v3/libio/libio.h
@@ -0,0 +1,365 @@
+/* Copyright (C) 1991, 92, 93, 94, 95, 97, 98 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>
+#define _IO_pos_t _G_fpos_t /* obsolete */
+#define _IO_fpos_t _G_fpos_t
+#define _IO_size_t _G_size_t
+#define _IO_ssize_t _G_ssize_t
+#define _IO_off_t _G_off_t
+#define _IO_pid_t _G_pid_t
+#define _IO_uid_t _G_uid_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
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+#define _IO_fpos64_t _G_fpos64_t
+#define _IO_off64_t _G_off64_t
+#endif
+
+#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 __P
+# if _G_HAVE_SYS_CDEFS
+# include <sys/cdefs.h>
+# else
+# ifdef __STDC__
+# define __P(p) p
+# else
+# define __P(p) ()
+# endif
+# endif
+#endif /*!__P*/
+
+#ifndef __PMT
+# ifdef __STDC__
+# define __PMT(p) p
+# else
+# define __PMT(p) ()
+# endif
+#endif /*!__P*/
+
+/* For backward compatibility */
+#ifndef _PARAMS
+# define _PARAMS(protos) __P(protos)
+#endif /*!_PARAMS*/
+
+#ifndef __STDC__
+# define const
+#endif
+#define _IO_UNIFIED_JUMPTABLES 1
+#if !_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
+
+/* 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 <bits/stdio-lock.h>
+# else
+# include <stdio-lock.h>
+# endif
+# define _IO_LOCK_T _IO_lock_t *
+# else
+/*# include <comthread.h>*/
+# endif
+#else
+# if defined(__GLIBC__) && __GLIBC__ >= 2
+ typedef void _IO_lock_t;
+# define _IO_LOCK_T void *
+# else
+# ifdef __linux__
+ struct _IO_lock_t { void *ptr; short int field1; short int field2; };
+# define _IO_LOCK_T struct _IO_lock_t
+# else
+ typedef void _IO_lock_t;
+# define _IO_LOCK_T void *
+# endif
+# endif
+#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
+};
+
+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;
+#ifdef _G_IO_IO_FILE_VERSION
+ _IO_off_t _old_offset;
+#else
+ _IO_off_t _offset;
+#endif
+
+#define __HAVE_COLUMN /* temporary */
+ /* 1+column number of pbase(); 0 is unknown. */
+ unsigned short _cur_column;
+ char _unused;
+ char _shortbuf[1];
+
+ /* char* _save_gptr; char* _save_egptr; */
+
+#ifdef _IO_LOCK_T
+ _IO_LOCK_T _lock;
+#endif
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+ _IO_off64_t _offset;
+ int _unused2[16]; /* Make sure we don't get into trouble again. */
+#endif
+};
+
+#ifndef __cplusplus
+typedef struct _IO_FILE _IO_FILE;
+#endif
+
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+#define _IO_stdin_ _IO_2_1_stdin_
+#define _IO_stdout_ _IO_2_1_stdout_
+#define _IO_stderr_ _IO_2_1_stderr_
+#endif
+
+struct _IO_FILE_plus;
+extern struct _IO_FILE_plus _IO_stdin_, _IO_stdout_, _IO_stderr_;
+#define _IO_stdin ((_IO_FILE*)(&_IO_stdin_))
+#define _IO_stdout ((_IO_FILE*)(&_IO_stdout_))
+#define _IO_stderr ((_IO_FILE*)(&_IO_stderr_))
+
+
+/* Define the user-visible type, with user-friendly member names. */
+typedef struct
+{
+ _IO_ssize_t (*read) __PMT ((struct _IO_FILE *, void *, _IO_ssize_t));
+ _IO_ssize_t (*write) __PMT ((struct _IO_FILE *, const void *, _IO_ssize_t));
+ _IO_off_t (*seek) __PMT ((struct _IO_FILE *, _IO_off_t, int));
+ int (*close) __PMT ((struct _IO_FILE *));
+} _IO_cookie_io_functions_t;
+
+/* Special file type for fopencookie function. */
+struct _IO_cookie_file
+{
+ struct _IO_FILE file;
+ const void *vtable;
+ void *cookie;
+ _IO_cookie_io_functions_t io_functions;
+};
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int __underflow __P ((_IO_FILE *));
+extern int __uflow __P ((_IO_FILE *));
+extern int __overflow __P ((_IO_FILE *, int));
+
+#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_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0)
+#define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0)
+
+extern int _IO_getc __P ((_IO_FILE *__fp));
+extern int _IO_putc __P ((int __c, _IO_FILE *__fp));
+extern int _IO_feof __P ((_IO_FILE *__fp));
+extern int _IO_ferror __P ((_IO_FILE *__fp));
+
+extern int _IO_peekc_locked __P ((_IO_FILE *__fp));
+
+/* This one is for Emacs. */
+#define _IO_PENDING_OUTPUT_COUNT(_fp) \
+ ((_fp)->_IO_write_ptr - (_fp)->_IO_write_base)
+
+extern void _IO_flockfile __P ((_IO_FILE *));
+extern void _IO_funlockfile __P ((_IO_FILE *));
+extern int _IO_ftrylockfile __P ((_IO_FILE *));
+
+#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 __P ((_IO_FILE *, const char *, _IO_va_list, int *));
+extern int _IO_vfprintf __P ((_IO_FILE *, const char *, _IO_va_list));
+extern _IO_ssize_t _IO_padn __P ((_IO_FILE *, int, _IO_ssize_t));
+extern _IO_size_t _IO_sgetn __P ((_IO_FILE *, void *, _IO_size_t));
+
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_off64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern _IO_off64_t _IO_seekpos __P ((_IO_FILE *, _IO_off64_t, int));
+#else
+extern _IO_off_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
+extern _IO_off_t _IO_seekpos __P ((_IO_FILE *, _IO_off_t, int));
+#endif
+
+extern void _IO_free_backup_area __P ((_IO_FILE *));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IO_STDIO_H */
diff --git a/libstdc++-v3/libio/libioP.h b/libstdc++-v3/libio/libioP.h
new file mode 100644
index 000000000000..be70f526bbe6
--- /dev/null
+++ b/libstdc++-v3/libio/libioP.h
@@ -0,0 +1,648 @@
+/* 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. */
+
+#ifndef _POSIX_SOURCE
+# define _POSIX_SOURCE
+#endif
+
+#include <errno.h>
+#ifndef __set_errno
+# define __set_errno(Val) errno = (Val)
+#endif
+
+#ifdef _IO_MTSAFE_IO
+# if defined __GLIBC__ && __GLIBC__ >= 2
+# if __GLIBC_MINOR__ > 0
+# include <bits/libc-lock.h>
+# else
+# include <libc-lock.h>
+# endif
+# else
+/*# include <comthread.h>*/
+# endif
+#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).
+ */
+
+#define _IO_JUMPS(THIS) ((struct _IO_FILE_plus *) (THIS))->vtable
+#ifdef _G_USING_THUNKS
+# define JUMP_FIELD(TYPE, NAME) TYPE NAME
+# define JUMP0(FUNC, THIS) _IO_JUMPS(THIS)->FUNC (THIS)
+# define JUMP1(FUNC, THIS, X1) _IO_JUMPS(THIS)->FUNC (THIS, X1)
+# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS(THIS)->FUNC (THIS, X1, X2)
+# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS(THIS)->FUNC (THIS, X1,X2, X3)
+# define JUMP_INIT(NAME, VALUE) VALUE
+# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0), JUMP_INIT (dummy2, 0)
+#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(THIS)->FUNC.pfn (THIS)
+# define JUMP1(FUNC, THIS, X1) _IO_JUMPS(THIS)->FUNC.pfn (THIS, X1)
+# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS(THIS)->FUNC.pfn (THIS, X1, X2)
+# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS(THIS)->FUNC.pfn (THIS, X1,X2,X3)
+# define JUMP_INIT(NAME, VALUE) {0, 0, VALUE}
+# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0)
+#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)
+
+/* 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)
+
+/* 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)
+
+/* 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)
+
+/* 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)
+
+/* 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)
+
+/* 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)
+
+/* 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. */
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+typedef _IO_off64_t (*_IO_seekoff_t) __PMT ((_IO_FILE *FP, _IO_off64_t OFF,
+ int DIR, int MODE));
+#else
+typedef _IO_off_t (*_IO_seekoff_t) __PMT ((_IO_FILE *FP, _IO_off_t OFF,
+ int DIR, int MODE));
+#endif
+#define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3 (__seekoff, FP, OFF, DIR, MODE)
+
+/* The 'seekpos' hook also moves the stream position,
+ but to an absolute position given by a fpos_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. */
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+typedef _IO_off64_t (*_IO_seekpos_t) __PMT ((_IO_FILE *, _IO_off64_t, int));
+#else
+typedef _IO_off_t (*_IO_seekpos_t) __PMT ((_IO_FILE *, _IO_off_t, int));
+#endif
+#define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2 (__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)
+
+/* 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)
+
+/* 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)
+
+/* 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)
+
+/* 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)
+
+/* 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. */
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+typedef _IO_off64_t (*_IO_seek_t) __PMT ((_IO_FILE *, _IO_off64_t, int));
+#else
+typedef _IO_off_t (*_IO_seek_t) __PMT ((_IO_FILE *, _IO_off_t, int));
+#endif
+#define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2 (__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)
+
+/* 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)
+
+#if _G_IO_IO_FILE_VERSION == 0x20001
+/* 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)
+
+/* 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)
+#endif
+
+
+#define _IO_CHAR_TYPE char /* unsigned char ? */
+#define _IO_INT_TYPE int
+
+struct _IO_jump_t
+{
+ JUMP_FIELD(_G_size_t, __dummy);
+#ifdef _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);
+#if _G_IO_IO_FILE_VERSION == 0x20001
+ JUMP_FIELD(_IO_showmanyc_t, __showmanyc);
+ JUMP_FIELD(_IO_imbue_t, __imbue);
+#endif
+#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;
+};
+
+/* Generic functions */
+
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_off64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern _IO_off64_t _IO_seekpos __P ((_IO_FILE *, _IO_off64_t, int));
+#else
+extern _IO_off_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
+extern _IO_off_t _IO_seekpos __P ((_IO_FILE *, _IO_off_t, int));
+#endif
+
+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 ((_IO_FILE *));
+extern void _IO_link_in __P ((_IO_FILE *));
+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)
+
+/* Marker-related function. */
+
+extern void _IO_init_marker __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_seekmark __P ((_IO_FILE *, struct _IO_marker *, int));
+
+/* Default jumptable functions. */
+
+extern int _IO_default_underflow __P ((_IO_FILE *));
+extern int _IO_default_uflow __P ((_IO_FILE *));
+extern int _IO_default_doallocate __P ((_IO_FILE *));
+extern void _IO_default_finish __P ((_IO_FILE *, int));
+extern int _IO_default_pbackfail __P ((_IO_FILE *, int));
+extern _IO_FILE* _IO_default_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
+extern _IO_size_t _IO_default_xsputn __P ((_IO_FILE *, const void *,
+ _IO_size_t));
+extern _IO_size_t _IO_default_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+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));
+#else
+extern _IO_off_t _IO_default_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
+extern _IO_off_t _IO_default_seekpos __P ((_IO_FILE *, _IO_off_t, int));
+#endif
+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 *));
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_off64_t _IO_default_seek __P ((_IO_FILE *, _IO_off64_t, int));
+#else
+extern _IO_off_t _IO_default_seek __P ((_IO_FILE *, _IO_off_t, int));
+#endif
+extern int _IO_default_sync __P ((_IO_FILE *));
+#define _IO_default_close ((_IO_close_t) _IO_default_sync)
+
+extern struct _IO_jump_t _IO_file_jumps;
+extern struct _IO_jump_t _IO_streambuf_jumps;
+extern struct _IO_jump_t _IO_proc_jumps;
+extern struct _IO_jump_t _IO_str_jumps;
+extern int _IO_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
+extern int _IO_flush_all __P ((void));
+extern void _IO_cleanup __P ((void));
+extern void _IO_flush_all_linebuffered __P ((void));
+
+#define _IO_do_flush(_f) \
+ _IO_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_setp(__fp, __p, __ep) \
+ ((__fp)->_IO_write_base = (__fp)->_IO_write_ptr = __p, (__fp)->_IO_write_end = (__ep))
+#define _IO_have_backup(fp) ((fp)->_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)
+
+/* 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));
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_off64_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern _IO_off64_t _IO_file_seek __P ((_IO_FILE *, _IO_off64_t, int));
+#else
+extern _IO_off_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
+extern _IO_off_t _IO_file_seek __P ((_IO_FILE *, _IO_off_t, int));
+#endif
+extern _IO_size_t _IO_file_xsputn __P ((_IO_FILE *, const 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 >= 0)
+extern void _IO_file_init __P ((_IO_FILE *));
+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));
+#if _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_FILE* _IO_file_fopen __P ((_IO_FILE *, const char *, const char *,
+ int));
+#else
+extern _IO_FILE* _IO_file_fopen __P ((_IO_FILE *, const char *, const char *));
+#endif
+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 void _IO_file_finish __P ((_IO_FILE *, int));
+
+/* Jumptable functions for proc_files. */
+extern _IO_FILE* _IO_proc_open __P ((_IO_FILE *, const char *, const char *));
+extern int _IO_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));
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_off64_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+#else
+extern _IO_off_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
+#endif
+extern void _IO_str_finish __P ((_IO_FILE *, int));
+
+/* Other strfile functions */
+extern void _IO_str_init_static __P ((_IO_FILE *, char *, int, char *));
+extern void _IO_str_init_readonly __P ((_IO_FILE *, const char *, int));
+extern _IO_ssize_t _IO_str_count __P ((_IO_FILE *));
+
+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 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 _IO_FILE *_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
+
+# include <unistd.h>
+# include <fcntl.h>
+# include <sys/mman.h>
+# include <sys/param.h>
+
+# 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
+# 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 *) -1) \
+ 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)
+
+#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_off_t _IO_lseek __P ((int, _IO_off_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));
+
+/* Operations on _IO_fpos_t.
+ Normally, these are trivial, but we provide hooks for configurations
+ where an _IO_fpos_t is a struct.
+ Note that _IO_off_t must be an integral type. */
+
+/* _IO_pos_BAD is an _IO_off_t value indicating error, unknown, or EOF. */
+#ifndef _IO_pos_BAD
+# if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+# define _IO_pos_BAD ((_IO_off64_t) -1)
+# else
+# define _IO_pos_BAD ((_IO_off_t) -1)
+# endif
+#endif
+/* _IO_pos_as_off converts an _IO_fpos_t value to an _IO_off_t value. */
+#ifndef _IO_pos_as_off
+# if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+# define _IO_pos_as_off(__pos) ((_IO_off64_t) (__pos))
+# else
+# define _IO_pos_as_off(__pos) ((_IO_off_t) (__pos))
+# endif
+#endif
+/* _IO_pos_adjust adjust an _IO_fpos_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_fpos_t value indicating beginning of file. */
+#ifndef _IO_pos_0
+# if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+# define _IO_pos_0 ((_IO_fpos64_t) 0)
+# else
+# define _IO_pos_0 ((_IO_fpos_t) 0)
+# endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef _IO_MTSAFE_IO
+/* check following! */
+# define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \
+ { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD, \
+ 0, 0, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock }
+#else
+/* check following! */
+# define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \
+ { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD }
+#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/libstdc++-v3/libio/stdfiles.c b/libstdc++-v3/libio/stdfiles.c
new file mode 100644
index 000000000000..8453e33c34cd
--- /dev/null
+++ b/libstdc++-v3/libio/stdfiles.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 1993, 1994, 1996, 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. */
+
+
+/* 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
+#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), &_IO_file_jumps}
+#else
+#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
+ struct _IO_FILE_plus NAME \
+ = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps}
+#endif
+
+DEF_STDFILE(_IO_stdin_, 0, 0, _IO_NO_WRITES);
+DEF_STDFILE(_IO_stdout_, 1, &_IO_stdin_.file, _IO_NO_READS);
+DEF_STDFILE(_IO_stderr_, 2, &_IO_stdout_.file,
+ _IO_NO_READS+_IO_UNBUFFERED);
+
+_IO_FILE *_IO_list_all = &_IO_stderr_.file;
diff --git a/libstdc++-v3/m4/lc_messages.m4 b/libstdc++-v3/m4/lc_messages.m4
new file mode 100644
index 000000000000..df4f242d3ccb
--- /dev/null
+++ b/libstdc++-v3/m4/lc_messages.m4
@@ -0,0 +1,19 @@
+# Check whether LC_MESSAGES is available in <locale.h>.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# This file file be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+AC_DEFUN(AC_LC_MESSAGES,
+ [if test $ac_cv_header_locale_h = yes; then
+ AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
+ [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+ ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
+ if test $ac_cv_val_LC_MESSAGES = yes; then
+ AC_DEFINE(HAVE_LC_MESSAGES)
+ fi
+ fi])
diff --git a/libstdc++-v3/m4/mathfcts.m4 b/libstdc++-v3/m4/mathfcts.m4
new file mode 100644
index 000000000000..bb1d23c05562
--- /dev/null
+++ b/libstdc++-v3/m4/mathfcts.m4
@@ -0,0 +1,15 @@
+# Check for functions in math library.
+# Ulrich Drepper <drepper@cygnus.com>, 1998.
+#
+# This file can be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
+AC_DEFUN(AC_REPLACE_MATHFUNCS,
+[AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
+AC_SUBST(LIBMATHOBJS)dnl
+])
diff --git a/libstdc++-v3/m4/stringfcts.m4 b/libstdc++-v3/m4/stringfcts.m4
new file mode 100644
index 000000000000..70652f84c524
--- /dev/null
+++ b/libstdc++-v3/m4/stringfcts.m4
@@ -0,0 +1,15 @@
+# Check for string functions.
+# Ulrich Drepper <drepper@cygnus.com>, 1998.
+#
+# This file can be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
+AC_DEFUN(AC_REPLACE_STRINGFUNCS,
+[AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
+AC_SUBST(LIBSTRINGOBJS)dnl
+])
diff --git a/libstdc++-v3/math/Makefile.am b/libstdc++-v3/math/Makefile.am
new file mode 100644
index 000000000000..4e192c50981e
--- /dev/null
+++ b/libstdc++-v3/math/Makefile.am
@@ -0,0 +1,56 @@
+## Makefile for the math subdirectory of the GNU C++ Standard library.
+##
+## Copyright (C) 1997, 1998, 1999, 2000 Cygnus Solutions
+##
+## 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
+
+noinst_LTLIBRARIES = libmath.la
+
+EXTRA_LONG_DOUBLE_yes = \
+ signbitl.c cabsl.c
+
+EXTRA_DIST = \
+ ccos.c ccosf.c ccosh.c ccoshf.c ccoshl.c ccosl.c \
+ cexp.c cexpf.c cexpl.c \
+ c_log.c c_logf.c c_logl.c clog10.c clog10f.c clog10l.c \
+ cpow.c cpowf.c cpowl.c csin.c csinf.c csinh.c csinhf.c csinhl.c \
+ csinl.c csqrt.c csqrtf.c csqrtl.c ctan.c ctanf.c ctanh.c \
+ ctanhf.c ctanhl.c ctanl.c carg.c cargf.c cargl.c hypot.c hypotf.c\
+ hypotl.c atan2f.c expf.c \
+ $(EXTRA_LONG_DOUBLE_yes)
+
+libmath_la_LIBADD = \
+ @LIBMATHOBJS@ \
+ $(EXTRA_LONG_DOUBLE_$(USE_LONG_DOUBLE))
+
+libmath_la_DEPENDENCIES = $(libmath_la_LIBADD)
+
+libmath_la_SOURCES = \
+ signbit.c signbitf.c cabs.c cabsf.c
+
+LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+
+TOPLEVEL_INCLUDES = -I$(includedir)
+INCLUDES = -I.. $(TOPLEVEL_INCLUDES)
+
+
+
diff --git a/libstdc++-v3/math/Makefile.in b/libstdc++-v3/math/Makefile.in
new file mode 100644
index 000000000000..79f40e23eda1
--- /dev/null
+++ b/libstdc++-v3/math/Makefile.in
@@ -0,0 +1,348 @@
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
+host_alias = @host_alias@
+host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
+AR = @AR@
+AS = @AS@
+BUILD_LIBIO_INCLUDE = @BUILD_LIBIO_INCLUDE@
+CC = @CC@
+CPP = @CPP@
+CSTDIO_CC = @CSTDIO_CC@
+CSTDIO_H = @CSTDIO_H@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+DEBUGFLAGS = @DEBUGFLAGS@
+DLLTOOL = @DLLTOOL@
+EXEEXT = @EXEEXT@
+GCC_OBJDIR = @GCC_OBJDIR@
+GLIBCPP_CFLAGS = @GLIBCPP_CFLAGS@
+GLIBCPP_CXXFLAGS = @GLIBCPP_CXXFLAGS@
+LIBMATHOBJS = @LIBMATHOBJS@
+LIBSTRINGOBJS = @LIBSTRINGOBJS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+NAMESPACES = @NAMESPACES@
+OBJDUMP = @OBJDUMP@
+OPTLEVEL = @OPTLEVEL@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+THREADDEPS = @THREADDEPS@
+THREADINCS = @THREADINCS@
+THREADLIBS = @THREADLIBS@
+THREADOBJS = @THREADOBJS@
+THREADSPEC = @THREADSPEC@
+USE_LONG_DOUBLE = @USE_LONG_DOUBLE@
+VERSION = @VERSION@
+WERRORSUPPRESS = @WERRORSUPPRESS@
+cpu_include_dir = @cpu_include_dir@
+ctype_include_dir = @ctype_include_dir@
+glibcpp_basedir = @glibcpp_basedir@
+
+AUTOMAKE_OPTIONS = 1.3 cygnus
+
+noinst_LTLIBRARIES = libmath.la
+
+EXTRA_LONG_DOUBLE_yes = \
+ signbitl.c cabsl.c
+
+
+EXTRA_DIST = \
+ ccos.c ccosf.c ccosh.c ccoshf.c ccoshl.c ccosl.c \
+ cexp.c cexpf.c cexpl.c \
+ c_log.c c_logf.c c_logl.c clog10.c clog10f.c clog10l.c \
+ cpow.c cpowf.c cpowl.c csin.c csinf.c csinh.c csinhf.c csinhl.c \
+ csinl.c csqrt.c csqrtf.c csqrtl.c ctan.c ctanf.c ctanh.c \
+ ctanhf.c ctanhl.c ctanl.c carg.c cargf.c cargl.c hypot.c hypotf.c\
+ hypotl.c atan2f.c expf.c \
+ $(EXTRA_LONG_DOUBLE_yes)
+
+
+libmath_la_LIBADD = \
+ @LIBMATHOBJS@ \
+ $(EXTRA_LONG_DOUBLE_$(USE_LONG_DOUBLE))
+
+
+libmath_la_DEPENDENCIES = $(libmath_la_LIBADD)
+
+libmath_la_SOURCES = \
+ signbit.c signbitf.c cabs.c cabsf.c
+
+
+LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+
+TOPLEVEL_INCLUDES = -I$(includedir)
+INCLUDES = -I.. $(TOPLEVEL_INCLUDES)
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I..
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+libmath_la_LDFLAGS =
+libmath_la_OBJECTS = signbit.lo signbitf.lo cabs.lo cabsf.lo
+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)
+DIST_COMMON = Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = gtar
+GZIP_ENV = --best
+SOURCES = $(libmath_la_SOURCES)
+OBJECTS = $(libmath_la_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .s
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --cygnus math/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 $<
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+
+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:
+
+libmath.la: $(libmath_la_OBJECTS) $(libmath_la_DEPENDENCIES)
+ $(LINK) $(libmath_la_LDFLAGS) $(libmath_la_OBJECTS) $(libmath_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 = math
+
+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/libstdc++-v3/math/atan2f.c b/libstdc++-v3/math/atan2f.c
new file mode 100644
index 000000000000..1c59dae7a9aa
--- /dev/null
+++ b/libstdc++-v3/math/atan2f.c
@@ -0,0 +1,39 @@
+/* Compute arc tangent. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+float
+atan2f (float x, float y)
+{
+ /* We use the double version. */
+ return atan2 (x, y);
+}
diff --git a/libstdc++-v3/math/c_log.c b/libstdc++-v3/math/c_log.c
new file mode 100644
index 000000000000..c3b8c5588582
--- /dev/null
+++ b/libstdc++-v3/math/c_log.c
@@ -0,0 +1,63 @@
+/* Compute complex natural logarithm. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+#include <math.h>
+#include "mathconf.h"
+
+__complex__ double
+c_log (__complex__ double x)
+{
+ __complex__ double result;
+
+ if (x == 0.0)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = copysign (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabs (__real__ x);
+ }
+ else if (__real__ x == __real__ x && __imag__ x == __imag__ x)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = log (hypot (__real__ x, __imag__ x));
+ __imag__ result = atan2 (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = NAN;
+ if (INFINITE_P (__real__ x) || INFINITE_P (__imag__ x))
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VAL;
+ else
+ __real__ result = NAN;
+ }
+
+ return result;
+}
diff --git a/libstdc++-v3/math/c_logf.c b/libstdc++-v3/math/c_logf.c
new file mode 100644
index 000000000000..aff2111391cd
--- /dev/null
+++ b/libstdc++-v3/math/c_logf.c
@@ -0,0 +1,64 @@
+/* Compute complex natural logarithm. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+c_logf (__complex__ float x)
+{
+ __complex__ float result;
+
+ if (x == 0.0)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = copysignf (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabsf (__real__ x);
+ }
+ else if (__real__ x == __real__ x && __imag__ x == __imag__ x)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = logf (hypotf (__real__ x, __imag__ x));
+ __imag__ result = atan2f (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = NAN;
+ if (INFINITEF_P (__real__ x) || INFINITEF_P (__imag__ x))
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VALF;
+ else
+ __real__ result = NAN;
+ }
+
+ return result;
+}
diff --git a/libstdc++-v3/math/c_logl.c b/libstdc++-v3/math/c_logl.c
new file mode 100644
index 000000000000..e1d60cdaa1b2
--- /dev/null
+++ b/libstdc++-v3/math/c_logl.c
@@ -0,0 +1,69 @@
+/* Compute complex natural logarithm. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+/* Thanks to SGI we have to trick here. At least Irix 6.2 provides hypotl,
+ but it has a wrong prototype. Grrr. */
+extern long double local_hypotl (long double, long double) asm ("hypotl");
+
+
+__complex__ long double
+c_logl (__complex__ long double x)
+{
+ __complex__ long double result;
+
+ if (x == 0.0)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = copysignl (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabsl (__real__ x);
+ }
+ else if (__real__ x == __real__ x && __imag__ x == __imag__ x)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = logl (local_hypotl (__real__ x, __imag__ x));
+ __imag__ result = atan2l (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = NAN;
+ if (INFINITEL_P (__real__ x) || INFINITEL_P (__imag__ x))
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VALL;
+ else
+ __real__ result = NAN;
+ }
+
+ return result;
+}
diff --git a/libstdc++-v3/math/cabs.c b/libstdc++-v3/math/cabs.c
new file mode 100644
index 000000000000..f2f41e2bd1ba
--- /dev/null
+++ b/libstdc++-v3/math/cabs.c
@@ -0,0 +1,38 @@
+/* Return the complex absolute value of double complex value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+double
+cabs (__complex__ double z)
+{
+ return hypot (__real__ z, __imag__ z);
+}
diff --git a/libstdc++-v3/math/cabsf.c b/libstdc++-v3/math/cabsf.c
new file mode 100644
index 000000000000..53358cfc568d
--- /dev/null
+++ b/libstdc++-v3/math/cabsf.c
@@ -0,0 +1,38 @@
+/* Return the complex absolute value of double complex value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+float
+cabsf (__complex__ float z)
+{
+ return hypotf (__real__ z, __imag__ z);
+}
diff --git a/libstdc++-v3/math/cabsl.c b/libstdc++-v3/math/cabsl.c
new file mode 100644
index 000000000000..4b36a3afcbb1
--- /dev/null
+++ b/libstdc++-v3/math/cabsl.c
@@ -0,0 +1,42 @@
+/* Return the complex absolute value of double complex value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+#include <math.h>
+#include "mathconf.h"
+
+/* Thanks to SGI we have to trick here. At least Irix 6.2 provides hypotl,
+ but it has a wrong prototype. Grrr. */
+extern long double local_hypotl (long double, long double) asm ("hypotl");
+
+
+long double
+__mycabsl (__complex__ long double z)
+{
+ return local_hypotl (__real__ z, __imag__ z);
+}
diff --git a/libstdc++-v3/math/carg.c b/libstdc++-v3/math/carg.c
new file mode 100644
index 000000000000..81da1c63fd28
--- /dev/null
+++ b/libstdc++-v3/math/carg.c
@@ -0,0 +1,37 @@
+/* Compute argument of complex double value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+#include <math.h>
+#include "mathconf.h"
+
+double
+carg (__complex__ double x)
+{
+ return __atan2 (__imag__ x, __real__ x);
+}
diff --git a/libstdc++-v3/math/cargf.c b/libstdc++-v3/math/cargf.c
new file mode 100644
index 000000000000..90a2f417cccb
--- /dev/null
+++ b/libstdc++-v3/math/cargf.c
@@ -0,0 +1,38 @@
+/* Compute argument of complex float value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+float
+cargf (__complex__ float x)
+{
+ return atan2f (__imag__ x, __real__ x);
+}
diff --git a/libstdc++-v3/math/cargl.c b/libstdc++-v3/math/cargl.c
new file mode 100644
index 000000000000..f99ad330d88c
--- /dev/null
+++ b/libstdc++-v3/math/cargl.c
@@ -0,0 +1,38 @@
+/* Compute argument of complex long double value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+long double
+cargl (__complex__ long double x)
+{
+ return __atan2l (__imag__ x, __real__ x);
+}
diff --git a/libstdc++-v3/math/ccos.c b/libstdc++-v3/math/ccos.c
new file mode 100644
index 000000000000..208c6e6abc37
--- /dev/null
+++ b/libstdc++-v3/math/ccos.c
@@ -0,0 +1,68 @@
+/* Return cosine of complex double value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+__complex__ double
+ccos (__complex__ double x)
+{
+ __complex__ double res;
+
+ if (!FINITE_P (__real__ x) || __imag__ x != __imag__ x)
+ {
+ if (__real__ x == 0.0 || __imag__ x == 0.0)
+ {
+ __real__ res = NAN;
+ __imag__ res = 0.0;
+ }
+ else if (INFINITE_P (__imag__ x))
+ {
+ __real__ res = HUGE_VAL;
+ __imag__ res = NAN;
+ }
+ else
+ {
+ __real__ res = NAN;
+ __imag__ res = NAN;
+ }
+ }
+ else
+ {
+ __complex__ double y;
+
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ res = ccosh (y);
+ }
+
+ return res;
+}
diff --git a/libstdc++-v3/math/ccosf.c b/libstdc++-v3/math/ccosf.c
new file mode 100644
index 000000000000..0cbf4a040fea
--- /dev/null
+++ b/libstdc++-v3/math/ccosf.c
@@ -0,0 +1,68 @@
+/* Return cosine of complex float value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+__complex__ float
+ccosf (__complex__ float x)
+{
+ __complex__ float res;
+
+ if (!FINITEF_P (__real__ x) || __imag__ x != __imag__ x)
+ {
+ if (__real__ x == 0.0 || __imag__ x == 0.0)
+ {
+ __real__ res = NAN;
+ __imag__ res = 0.0;
+ }
+ else if (INFINITE_P (__imag__ x))
+ {
+ __real__ res = HUGE_VALF;
+ __imag__ res = NAN;
+ }
+ else
+ {
+ __real__ res = NAN;
+ __imag__ res = NAN;
+ }
+ }
+ else
+ {
+ __complex__ float y;
+
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ res = ccoshf (y);
+ }
+
+ return res;
+}
diff --git a/libstdc++-v3/math/ccosh.c b/libstdc++-v3/math/ccosh.c
new file mode 100644
index 000000000000..79fe94e45cb0
--- /dev/null
+++ b/libstdc++-v3/math/ccosh.c
@@ -0,0 +1,93 @@
+/* Complex cosine hyperbole function for double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+ccosh (__complex__ double x)
+{
+ __complex__ double retval;
+
+ if (FINITE_P (__real__ x))
+ {
+ /* Real part is finite. */
+ if (FINITE_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ double sinh_val = sinh (__real__ x);
+ double cosh_val = cosh (__real__ x);
+ double sinix = sin (__imag__ x);
+ double cosix = cos (__imag__ x);
+
+ __real__ retval = cosh_val * cosix;
+ __imag__ retval = sinh_val * sinix;
+ }
+ else
+ {
+ __imag__ retval = __real__ x == 0.0 ? 0.0 : NAN;
+ __real__ retval = NAN + NAN;
+ }
+ }
+ else if (INFINITE_P (__real__ x))
+ {
+ /* Real part is infinite. */
+ if (__imag__ x == 0.0)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = HUGE_VAL;
+ __imag__ retval = __imag__ x * copysign (1.0, __real__ x);
+ }
+ else if (FINITE_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ double sinix = sin (__imag__ x);
+ double cosix = cos (__imag__ x);
+
+ __real__ retval = copysign (HUGE_VAL, cosix);
+ __imag__ retval = (copysign (HUGE_VAL, sinix)
+ * copysign (1.0, __real__ x));
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VAL;
+ __imag__ retval = NAN + NAN;
+ }
+ }
+ else
+ {
+ __real__ retval = NAN;
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : NAN;
+ }
+
+ return retval;
+}
diff --git a/libstdc++-v3/math/ccoshf.c b/libstdc++-v3/math/ccoshf.c
new file mode 100644
index 000000000000..51c5890e2a7b
--- /dev/null
+++ b/libstdc++-v3/math/ccoshf.c
@@ -0,0 +1,92 @@
+/* Complex cosine hyperbole function for float. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+ccoshf (__complex__ float x)
+{
+ __complex__ float retval;
+
+ if (FINITEF_P (__real__ x))
+ {
+ /* Real part is finite. */
+ if (FINITEF_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ float sinh_val = sinhf (__real__ x);
+ float cosh_val = coshf (__real__ x);
+ float sinix = sinf (__imag__ x);
+ float cosix = cosf (__imag__ x);
+
+ __real__ retval = cosh_val * cosix;
+ __imag__ retval = sinh_val * sinix;
+ }
+ else
+ {
+ __imag__ retval = __real__ x == 0.0 ? 0.0 : NAN;
+ __real__ retval = NAN;
+ }
+ }
+ else if (INFINITEF_P (__real__ x))
+ {
+ /* Real part is infinite. */
+ if (__imag__ x == 0.0)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = HUGE_VALF;
+ __imag__ retval = __imag__ x * copysignf (1.0, __real__ x);
+ }
+ else if (FINITEF_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ float sinix = sinf (__imag__ x);
+ float cosix = cosf (__imag__ x);
+
+ __real__ retval = copysignf (HUGE_VALF, cosix);
+ __imag__ retval = (copysignf (HUGE_VALF, sinix)
+ * copysignf (1.0, __real__ x));
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VALF;
+ __imag__ retval = NAN + NAN;
+ }
+ }
+ else
+ {
+ __real__ retval = NAN;
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : NAN;
+ }
+
+ return retval;
+}
diff --git a/libstdc++-v3/math/ccoshl.c b/libstdc++-v3/math/ccoshl.c
new file mode 100644
index 000000000000..7bb2dacf3b88
--- /dev/null
+++ b/libstdc++-v3/math/ccoshl.c
@@ -0,0 +1,92 @@
+/* Complex cosine hyperbole function for long double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ long double
+ccoshl (__complex__ long double x)
+{
+ __complex__ long double retval;
+
+ if (FINITEL_P (__real__ x))
+ {
+ /* Real part is finite. */
+ if (FINITEL_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ long double sinh_val = sinhl (__real__ x);
+ long double cosh_val = coshl (__real__ x);
+ long double sinix = sinl (__imag__ x);
+ long double cosix = cosl (__imag__ x);
+
+ __real__ retval = cosh_val * cosix;
+ __imag__ retval = sinh_val * sinix;
+ }
+ else
+ {
+ __imag__ retval = __real__ x == 0.0 ? 0.0 : NAN;
+ __real__ retval = NAN + NAN;
+ }
+ }
+ else if (INFINITEL_P (__real__ x))
+ {
+ /* Real part is infinite. */
+ if (__imag__ x == 0.0)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = HUGE_VALL;
+ __imag__ retval = __imag__ x * copysignl (1.0, __real__ x);
+ }
+ else if (FINITEL_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ long double sinix = sinl (__imag__ x);
+ long double cosix = cosl (__imag__ x);
+
+ __real__ retval = copysignl (HUGE_VALL, cosix);
+ __imag__ retval = (copysignl (HUGE_VALL, sinix)
+ * copysignl (1.0, __real__ x));
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VALL;
+ __imag__ retval = NAN + NAN;
+ }
+ }
+ else
+ {
+ __real__ retval = NAN;
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : NAN;
+ }
+
+ return retval;
+}
diff --git a/libstdc++-v3/math/ccosl.c b/libstdc++-v3/math/ccosl.c
new file mode 100644
index 000000000000..6531476488c4
--- /dev/null
+++ b/libstdc++-v3/math/ccosl.c
@@ -0,0 +1,69 @@
+/* Return cosine of complex long double value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ long double
+ccosl (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ if (!FINITEL_P (__real__ x) || __imag__ x != __imag__ x)
+ {
+ if (__real__ x == 0.0 || __imag__ x == 0.0)
+ {
+ __real__ res = NAN;
+ __imag__ res = 0.0;
+ }
+ else if (INFINITEL_P (__imag__ x))
+ {
+ __real__ res = HUGE_VALL;
+ __imag__ res = NAN;
+ }
+ else
+ {
+ __real__ res = NAN;
+ __imag__ res = NAN;
+ }
+ }
+ else
+ {
+ __complex__ long double y;
+
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ res = ccoshl (y);
+ }
+
+ return res;
+}
diff --git a/libstdc++-v3/math/cexp.c b/libstdc++-v3/math/cexp.c
new file mode 100644
index 000000000000..210220bc58c7
--- /dev/null
+++ b/libstdc++-v3/math/cexp.c
@@ -0,0 +1,111 @@
+/* Return value of complex exponential function for double complex value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+cexp (__complex__ double x)
+{
+ __complex__ double retval;
+
+ if (FINITE_P (__real__ x))
+ {
+ /* Real part is finite. */
+ if (FINITE_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ double exp_val = exp (__real__ x);
+ double sinix = sin (__imag__ x);
+ double cosix = cos (__imag__ x);
+
+ if (FINITE_P (exp_val))
+ {
+ __real__ retval = exp_val * cosix;
+ __imag__ retval = exp_val * sinix;
+ }
+ else
+ {
+ __real__ retval = copysign (exp_val, cosix);
+ __imag__ retval = copysign (exp_val, sinix);
+ }
+ }
+ else
+ {
+ /* If the imaginary part is +-inf or NaN and the real part
+ is not +-inf the result is NaN + iNaN. */
+ __real__ retval = NAN;
+ __imag__ retval = NAN;
+ }
+ }
+ else if (INFINITE_P (__real__ x))
+ {
+ /* Real part is infinite. */
+ if (FINITE_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ double value = signbit (__real__ x) ? 0.0 : HUGE_VAL;
+
+ if (__imag__ x == 0.0)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = value;
+ __imag__ retval = __imag__ x;
+ }
+ else
+ {
+ double sinix = sin (__imag__ x);
+ double cosix = cos (__imag__ x);
+
+ __real__ retval = copysign (value, cosix);
+ __imag__ retval = copysign (value, sinix);
+ }
+ }
+ else if (signbit (__real__ x) == 0)
+ {
+ __real__ retval = HUGE_VAL;
+ __imag__ retval = NAN;
+ }
+ else
+ {
+ __real__ retval = 0.0;
+ __imag__ retval = copysign (0.0, __imag__ x);
+ }
+ }
+ else
+ {
+ /* If the real part is NaN the result is NaN + iNaN. */
+ __real__ retval = NAN;
+ __imag__ retval = NAN;
+ }
+
+ return retval;
+}
diff --git a/libstdc++-v3/math/cexpf.c b/libstdc++-v3/math/cexpf.c
new file mode 100644
index 000000000000..0888cb70fa4f
--- /dev/null
+++ b/libstdc++-v3/math/cexpf.c
@@ -0,0 +1,110 @@
+/* Return value of complex exponential function for float complex value. */
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+cexpf (__complex__ float x)
+{
+ __complex__ float retval;
+
+ if (FINITEF_P (__real__ x))
+ {
+ /* Real part is finite. */
+ if (FINITEF_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ float exp_val = expf (__real__ x);
+ float sinix = sinf (__imag__ x);
+ float cosix = cosf (__imag__ x);
+
+ if (FINITEF_P (exp_val))
+ {
+ __real__ retval = exp_val * cosix;
+ __imag__ retval = exp_val * sinix;
+ }
+ else
+ {
+ __real__ retval = copysignf (exp_val, cosix);
+ __imag__ retval = copysignf (exp_val, sinix);
+ }
+ }
+ else
+ {
+ /* If the imaginary part is +-inf or NaN and the real part
+ is not +-inf the result is NaN + iNaN. */
+ __real__ retval = NAN;
+ __imag__ retval = NAN;
+ }
+ }
+ else if (INFINITEF_P (__real__ x))
+ {
+ /* Real part is infinite. */
+ if (FINITEF_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ float value = signbit (__real__ x) ? 0.0 : HUGE_VALF;
+
+ if (__imag__ x == 0.0)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = value;
+ __imag__ retval = __imag__ x;
+ }
+ else
+ {
+ float sinix = sinf (__imag__ x);
+ float cosix = cosf (__imag__ x);
+
+ __real__ retval = copysignf (value, cosix);
+ __imag__ retval = copysignf (value, sinix);
+ }
+ }
+ else if (signbit (__real__ x) == 0)
+ {
+ __real__ retval = HUGE_VALF;
+ __imag__ retval = NAN;
+ }
+ else
+ {
+ __real__ retval = 0.0;
+ __imag__ retval = copysignf (0.0, __imag__ x);
+ }
+ }
+ else
+ {
+ /* If the real part is NaN the result is NaN + iNaN. */
+ __real__ retval = NAN;
+ __imag__ retval = NAN;
+ }
+
+ return retval;
+}
diff --git a/libstdc++-v3/math/cexpl.c b/libstdc++-v3/math/cexpl.c
new file mode 100644
index 000000000000..83cb4db5e584
--- /dev/null
+++ b/libstdc++-v3/math/cexpl.c
@@ -0,0 +1,110 @@
+/* Return value of complex exp function for long double complex value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ long double
+cexpl (__complex__ long double x)
+{
+ __complex__ long double retval;
+
+ if (FINITEL_P (__real__ x))
+ {
+ /* Real part is finite. */
+ if (FINITEL_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ long double exp_val = expl (__real__ x);
+ long double sinix = sinl (__imag__ x);
+ long double cosix = cosl (__imag__ x);
+
+ if (FINITEL_P (exp_val))
+ {
+ __real__ retval = exp_val * cosix;
+ __imag__ retval = exp_val * sinix;
+ }
+ else
+ {
+ __real__ retval = copysignl (exp_val, cosix);
+ __imag__ retval = copysignl (exp_val, sinix);
+ }
+ }
+ else
+ {
+ /* If the imaginary part is +-inf or NaN and the real part
+ is not +-inf the result is NaN + iNaN. */
+ __real__ retval = NAN;
+ __imag__ retval = NAN;
+ }
+ }
+ else if (INFINITEL_P (__real__ x))
+ {
+ /* Real part is infinite. */
+ if (FINITEL_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL;
+
+ if (__imag__ x == 0.0)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = value;
+ __imag__ retval = __imag__ x;
+ }
+ else
+ {
+ long double sinix = sinl (__imag__ x);
+ long double cosix = cosl (__imag__ x);
+
+ __real__ retval = copysignl (value, cosix);
+ __imag__ retval = copysignl (value, sinix);
+ }
+ }
+ else if (signbit (__real__ x) == 0)
+ {
+ __real__ retval = HUGE_VALL;
+ __imag__ retval = NAN;
+ }
+ else
+ {
+ __real__ retval = 0.0;
+ __imag__ retval = copysignl (0.0, __imag__ x);
+ }
+ }
+ else
+ {
+ /* If the real part is NaN the result is NaN + iNaN. */
+ __real__ retval = NAN;
+ __imag__ retval = NAN;
+ }
+
+ return retval;
+}
diff --git a/libstdc++-v3/math/clog10.c b/libstdc++-v3/math/clog10.c
new file mode 100644
index 000000000000..e158a9900e38
--- /dev/null
+++ b/libstdc++-v3/math/clog10.c
@@ -0,0 +1,65 @@
+/* Compute complex base 10 logarithm. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+clog10 (__complex__ double x)
+{
+ __complex__ double result;
+
+ if (x == 0.0)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = copysign (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabs (__real__ x);
+ }
+ else if (__real__ x != __real__ x && __imag__ x != __imag__ x)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = log10 (hypot (__real__ x, __imag__ x));
+ __imag__ result = atan2 (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = NAN;
+ if (INFINITE_P (__real__ x) || INFINITE_P (__imag__ x))
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VAL;
+ else
+ __real__ result = NAN;
+ }
+
+ return result;
+}
diff --git a/libstdc++-v3/math/clog10f.c b/libstdc++-v3/math/clog10f.c
new file mode 100644
index 000000000000..b241cec994a2
--- /dev/null
+++ b/libstdc++-v3/math/clog10f.c
@@ -0,0 +1,64 @@
+/* Compute complex base 10 logarithm. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+clog10f (__complex__ float x)
+{
+ __complex__ float result;
+
+ if (x == 0.0)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = copysignf (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabsf (__real__ x);
+ }
+ else if (__real__ x == __real__ x && __imag__ x == __imag__ x)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = log10f (hypotf (__real__ x, __imag__ x));
+ __imag__ result = atan2f (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = NAN;
+ if (INFINITEF_P (__real__ x) || INFINITEF_P (__imag__ x))
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VALF;
+ else
+ __real__ result = NAN;
+ }
+
+ return result;
+}
diff --git a/libstdc++-v3/math/clog10l.c b/libstdc++-v3/math/clog10l.c
new file mode 100644
index 000000000000..e183862ffcc5
--- /dev/null
+++ b/libstdc++-v3/math/clog10l.c
@@ -0,0 +1,68 @@
+/* Compute complex natural logarithm. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+#include <math.h>
+#include "mathconf.h"
+
+/* Thanks to SGI we have to trick here. At least Irix 6.2 provides hypotl,
+ but it has a wrong prototype. Grrr. */
+extern long double local_hypotl (long double, long double) asm ("hypotl");
+
+
+__complex__ long double
+clog10l (__complex__ long double x)
+{
+ __complex__ long double result;
+
+ if (x == 0.0)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = copysignl (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabsl (__real__ x);
+ }
+ else if (__real__ x == __real__ x && __imag__ x == __imag__ x)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = log10l (local_hypotl (__real__ x, __imag__ x));
+ __imag__ result = atan2l (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = NAN;
+ if (INFINITEL_P (__real__ x) || INFINITEL_P (__imag__ x))
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VALL;
+ else
+ __real__ result = NAN;
+ }
+
+ return result;
+}
diff --git a/libstdc++-v3/math/complex-stub.h b/libstdc++-v3/math/complex-stub.h
new file mode 100644
index 000000000000..afc7ef68f654
--- /dev/null
+++ b/libstdc++-v3/math/complex-stub.h
@@ -0,0 +1,88 @@
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+/* This is no header meant to be used in general. It's simply here to
+ get libstdc++ compiled. It should never be installed in an official
+ directory. */
+
+#ifndef _COMPLEX_H
+#define _COMPLEX_H 1
+
+__complex__ double ccos (__complex__ double x);
+__complex__ float ccosf (__complex__ float x);
+__complex__ long double ccosl (__complex__ long double x);
+
+__complex__ double ccosh (__complex__ double x);
+__complex__ float ccoshf (__complex__ float x);
+__complex__ long double ccoshl (__complex__ long double x);
+
+__complex__ double cexp (__complex__ double x);
+__complex__ float cexpf (__complex__ float x);
+__complex__ long double cexpl (__complex__ long double x);
+
+__complex__ double clog10 (__complex__ double x);
+__complex__ float clog10f (__complex__ float x);
+__complex__ long double clog10l (__complex__ long double x);
+
+__complex__ double cpow (__complex__ double x, __complex__ double c);
+__complex__ float cpowf (__complex__ float x, __complex__ float c);
+__complex__ long double cpowl (__complex__ long double x, __complex__ long double c);
+
+__complex__ double csin (__complex__ double x);
+__complex__ float csinf (__complex__ float x);
+__complex__ long double csinl (__complex__ long double x);
+
+__complex__ double csinh (__complex__ double x);
+__complex__ float csinhf (__complex__ float x);
+__complex__ long double csinhl (__complex__ long double x);
+
+__complex__ double csqrt (__complex__ double x);
+__complex__ float csqrtf (__complex__ float x);
+__complex__ long double csqrtl (__complex__ long double x);
+
+__complex__ double ctan (__complex__ double x);
+__complex__ float ctanf (__complex__ float x);
+__complex__ long double ctanl (__complex__ long double x);
+
+__complex__ double ctanh (__complex__ double x);
+__complex__ float ctanhf (__complex__ float x);
+__complex__ long double ctanhl (__complex__ long double x);
+
+double carg (__complex__ double x);
+float cargf (__complex__ float x);
+long double cargl (__complex__ long double x);
+
+double cabs (__complex__ double x);
+float cabsf (__complex__ float x);
+long double cabsl (__complex__ long double x);
+
+double nan (void);
+
+#endif
+
diff --git a/libstdc++-v3/math/copysignf.c b/libstdc++-v3/math/copysignf.c
new file mode 100644
index 000000000000..968c1472b60a
--- /dev/null
+++ b/libstdc++-v3/math/copysignf.c
@@ -0,0 +1,39 @@
+/* Copy sign of one number to another. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+float
+copysignf (float x, float y)
+{
+ /* We use the double version. */
+ return copysign (x, y);
+}
diff --git a/libstdc++-v3/math/cpow.c b/libstdc++-v3/math/cpow.c
new file mode 100644
index 000000000000..5d816a1d0d64
--- /dev/null
+++ b/libstdc++-v3/math/cpow.c
@@ -0,0 +1,39 @@
+/* Complex power of double values. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+cpow (__complex__ double x, __complex__ double c)
+{
+ return cexp (c * c_log (x));
+}
diff --git a/libstdc++-v3/math/cpowf.c b/libstdc++-v3/math/cpowf.c
new file mode 100644
index 000000000000..d4aa5904f86f
--- /dev/null
+++ b/libstdc++-v3/math/cpowf.c
@@ -0,0 +1,38 @@
+/* Complex power of float values. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+cpowf (__complex__ float x, __complex__ float c)
+{
+ return cexpf (c * c_logf (x));
+}
diff --git a/libstdc++-v3/math/cpowl.c b/libstdc++-v3/math/cpowl.c
new file mode 100644
index 000000000000..65856d48ec4b
--- /dev/null
+++ b/libstdc++-v3/math/cpowl.c
@@ -0,0 +1,40 @@
+/* Complex power of long double values. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+#include <math.h>
+#include "mathconf.h"
+
+__complex__ long double
+cpowl (__complex__ long double x, __complex__ long double c)
+{
+ return cexpl (c * c_logl (x));
+}
+
+
+
diff --git a/libstdc++-v3/math/csin.c b/libstdc++-v3/math/csin.c
new file mode 100644
index 000000000000..bde60196e1b1
--- /dev/null
+++ b/libstdc++-v3/math/csin.c
@@ -0,0 +1,115 @@
+/* Complex sine function for double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+csin (__complex__ double x)
+{
+ __complex__ double retval;
+ int negate = signbit (__real__ x);
+
+ __real__ x = fabs (__real__ x);
+
+ if (FINITE_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ if (FINITE_P (__real__ x))
+ {
+ /* Real part is finite. */
+ double sinh_val = sinh (__imag__ x);
+ double cosh_val = cosh (__imag__ x);
+ double sinix = sin (__real__ x);
+ double cosix = cos (__real__ x);
+
+ __real__ retval = cosh_val * sinix;
+ __imag__ retval = sinh_val * cosix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (__imag__ x == 0.0)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = NAN;
+ __imag__ retval = __imag__ x;
+ }
+ else
+ {
+ __real__ retval = NAN;
+ __imag__ retval = NAN;
+ }
+ }
+ }
+ else if (INFINITE_P (__imag__ x))
+ {
+ /* Imaginary part is infinite. */
+ if (__real__ x == 0.0)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = copysign (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __imag__ x;
+ }
+ else if (FINITE_P (__real__ x))
+ {
+ /* Real part is finite. */
+ double sinix = sin (__real__ x);
+ double cosix = cos (__real__ x);
+
+ __real__ retval = copysign (HUGE_VAL, sinix);
+ __imag__ retval = copysign (HUGE_VAL, cosix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ if (signbit (__imag__ x))
+ __imag__ retval = -__imag__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = NAN;
+ __imag__ retval = HUGE_VAL;
+ }
+ }
+ else
+ {
+ if (__real__ x == 0.0)
+ __real__ retval = copysign (0.0, negate ? -1.0 : 1.0);
+ else
+ __real__ retval = NAN;
+ __imag__ retval = NAN;
+ }
+
+ return retval;
+}
diff --git a/libstdc++-v3/math/csinf.c b/libstdc++-v3/math/csinf.c
new file mode 100644
index 000000000000..8c66865380a4
--- /dev/null
+++ b/libstdc++-v3/math/csinf.c
@@ -0,0 +1,115 @@
+/* Complex sine function for float. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+csinf (__complex__ float x)
+{
+ __complex__ float retval;
+ int negate = signbit (__real__ x);
+
+ __real__ x = fabsf (__real__ x);
+
+ if (FINITEF_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ if (FINITEF_P (__real__ x))
+ {
+ /* Real part is finite. */
+ float sinh_val = sinhf (__imag__ x);
+ float cosh_val = coshf (__imag__ x);
+ float sinix = sinf (__real__ x);
+ float cosix = cosf (__real__ x);
+
+ __real__ retval = cosh_val * sinix;
+ __imag__ retval = sinh_val * cosix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (__imag__ x == 0.0)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = NAN;
+ __imag__ retval = __imag__ x;
+ }
+ else
+ {
+ __real__ retval = NAN;
+ __imag__ retval = NAN;
+ }
+ }
+ }
+ else if (INFINITEF_P (__imag__ x))
+ {
+ /* Imaginary part is infinite. */
+ if (__real__ x == 0.0)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = copysignf (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __imag__ x;
+ }
+ else if (FINITEF_P (__real__ x))
+ {
+ /* Real part is finite. */
+ float sinix = sinf (__real__ x);
+ float cosix = cosf (__real__ x);
+
+ __real__ retval = copysignf (HUGE_VALF, sinix);
+ __imag__ retval = copysignf (HUGE_VALF, cosix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ if (signbit (__imag__ x))
+ __imag__ retval = -__imag__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = NAN;
+ __imag__ retval = HUGE_VALF;
+ }
+ }
+ else
+ {
+ if (__real__ x == 0.0)
+ __real__ retval = copysignf (0.0, negate ? -1.0 : 1.0);
+ else
+ __real__ retval = NAN;
+ __imag__ retval = NAN;
+ }
+
+ return retval;
+}
diff --git a/libstdc++-v3/math/csinh.c b/libstdc++-v3/math/csinh.c
new file mode 100644
index 000000000000..9da924b1c66b
--- /dev/null
+++ b/libstdc++-v3/math/csinh.c
@@ -0,0 +1,110 @@
+/* Complex sine hyperbole function for double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+csinh (__complex__ double x)
+{
+ __complex__ double retval;
+ int negate = signbit (__real__ x);
+
+ __real__ x = fabs (__real__ x);
+
+ if (FINITE_P (__real__ x))
+ {
+ /* Real part is finite. */
+ if (FINITE_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ double sinh_val = sinh (__real__ x);
+ double cosh_val = cosh (__real__ x);
+ double sinix = sin (__imag__ x);
+ double cosix = cos (__imag__ x);
+
+ __real__ retval = sinh_val * cosix;
+ __imag__ retval = cosh_val * sinix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (__real__ x == 0.0)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = copysign (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = NAN + NAN;
+ }
+ else
+ {
+ __real__ retval = NAN;
+ __imag__ retval = NAN;
+ }
+ }
+ }
+ else if (INFINITE_P (__real__ x))
+ {
+ /* Real part is infinite. */
+ if (__imag__ x == 0.0)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = negate ? -HUGE_VAL : HUGE_VAL;
+ __imag__ retval = __imag__ x;
+ }
+ else if (FINITE_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ double sinix = sin (__imag__ x);
+ double cosix = cos (__imag__ x);
+
+ __real__ retval = copysign (HUGE_VAL, cosix);
+ __imag__ retval = copysign (HUGE_VAL, sinix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VAL;
+ __imag__ retval = NAN + NAN;
+ }
+ }
+ else
+ {
+ __real__ retval = NAN;
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : NAN;
+ }
+
+ return retval;
+}
diff --git a/libstdc++-v3/math/csinhf.c b/libstdc++-v3/math/csinhf.c
new file mode 100644
index 000000000000..3aaf49aa2083
--- /dev/null
+++ b/libstdc++-v3/math/csinhf.c
@@ -0,0 +1,89 @@
+/* Complex sine hyperbole function for float.
+ Copyright (C) 1997,1998 Free Software Foundation, Inc.
+
+ This file is part of the libstdc++ version 3 distribution.
+
+ This software is a copyrighted work licensed under the terms of the
+ Cygnus libstdc++ license. Please consult the file LICENSE.STD for
+ details. */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+csinhf (__complex__ float x)
+{
+ __complex__ float retval;
+ int negate = signbit (__real__ x);
+
+ __real__ x = fabsf (__real__ x);
+
+ if (FINITEF_P (__real__ x))
+ {
+ /* Real part is finite. */
+ if (FINITEF_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ float sinh_val = sinhf (__real__ x);
+ float cosh_val = coshf (__real__ x);
+ float sinix = sin (__imag__ x);
+ float cosix = cos (__imag__ x);
+
+ __real__ retval = sinh_val * cosix;
+ __imag__ retval = cosh_val * sinix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (__real__ x == 0.0)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = copysignf (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = NAN + NAN;
+ }
+ else
+ {
+ __real__ retval = NAN;
+ __imag__ retval = NAN;
+ }
+ }
+ }
+ else if (INFINITEF_P (__real__ x))
+ {
+ /* Real part is infinite. */
+ if (__imag__ x == 0.0)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = negate ? -HUGE_VALF : HUGE_VALF;
+ __imag__ retval = __imag__ x;
+ }
+ else if (FINITEF_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ float sinix = sinf (__imag__ x);
+ float cosix = cosf (__imag__ x);
+
+ __real__ retval = copysignf (HUGE_VALF, cosix);
+ __imag__ retval = copysignf (HUGE_VALF, sinix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VALF;
+ __imag__ retval = NAN + NAN;
+ }
+ }
+ else
+ {
+ __real__ retval = NAN;
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : NAN;
+ }
+
+ return retval;
+}
diff --git a/libstdc++-v3/math/csinhl.c b/libstdc++-v3/math/csinhl.c
new file mode 100644
index 000000000000..efd45a24323d
--- /dev/null
+++ b/libstdc++-v3/math/csinhl.c
@@ -0,0 +1,110 @@
+/* Complex sine hyperbole function for long double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ long double
+csinhl (__complex__ long double x)
+{
+ __complex__ long double retval;
+ int negate = signbit (__real__ x);
+
+ __real__ x = fabsl (__real__ x);
+
+ if (FINITEL_P (__real__ x))
+ {
+ /* Real part is finite. */
+ if (FINITEL_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ long double sinh_val = sinhl (__real__ x);
+ long double cosh_val = coshl (__real__ x);
+ long double sinix = sinl (__imag__ x);
+ long double cosix = cosl (__imag__ x);
+
+ __real__ retval = sinh_val * cosix;
+ __imag__ retval = cosh_val * sinix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (__real__ x == 0.0)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = copysignl (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = NAN + NAN;
+ }
+ else
+ {
+ __real__ retval = NAN;
+ __imag__ retval = NAN;
+ }
+ }
+ }
+ else if (INFINITEL_P (__real__ x))
+ {
+ /* Real part is infinite. */
+ if (__imag__ x == 0.0)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = negate ? -HUGE_VALL : HUGE_VALL;
+ __imag__ retval = __imag__ x;
+ }
+ else if (FINITEL_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ long double sinix = sinl (__imag__ x);
+ long double cosix = cosl (__imag__ x);
+
+ __real__ retval = copysignl (HUGE_VALL, cosix);
+ __imag__ retval = copysignl (HUGE_VALL, sinix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VALL;
+ __imag__ retval = NAN + NAN;
+ }
+ }
+ else
+ {
+ __real__ retval = NAN;
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : NAN;
+ }
+
+ return retval;
+}
diff --git a/libstdc++-v3/math/csinl.c b/libstdc++-v3/math/csinl.c
new file mode 100644
index 000000000000..423b459d667a
--- /dev/null
+++ b/libstdc++-v3/math/csinl.c
@@ -0,0 +1,115 @@
+/* Complex sine function for long double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ long double
+csinl (__complex__ long double x)
+{
+ __complex__ long double retval;
+ int negate = signbit (__real__ x);
+
+ __real__ x = fabsl (__real__ x);
+
+ if (FINITEL_P (__imag__ x))
+ {
+ /* Imaginary part is finite. */
+ if (FINITEL_P (__real__ x))
+ {
+ /* Real part is finite. */
+ long double sinh_val = sinhl (__imag__ x);
+ long double cosh_val = coshl (__imag__ x);
+ long double sinix = sinl (__real__ x);
+ long double cosix = cosl (__real__ x);
+
+ __real__ retval = cosh_val * sinix;
+ __imag__ retval = sinh_val * cosix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (__imag__ x == 0.0)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = NAN;
+ __imag__ retval = __imag__ x;
+ }
+ else
+ {
+ __real__ retval = NAN;
+ __imag__ retval = NAN;
+ }
+ }
+ }
+ else if (INFINITEL_P (__imag__ x))
+ {
+ /* Imaginary part is infinite. */
+ if (__real__ x == 0.0)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = copysignl (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __imag__ x;
+ }
+ else if (FINITEL_P (__real__ x))
+ {
+ /* Real part is finite. */
+ long double sinix = sinl (__real__ x);
+ long double cosix = cosl (__real__ x);
+
+ __real__ retval = copysignl (HUGE_VALL, sinix);
+ __imag__ retval = copysignl (HUGE_VALL, cosix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ if (signbit (__imag__ x))
+ __imag__ retval = -__imag__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = NAN;
+ __imag__ retval = HUGE_VALL;
+ }
+ }
+ else
+ {
+ if (__real__ x == 0.0)
+ __real__ retval = copysignl (0.0, negate ? -1.0 : 1.0);
+ else
+ __real__ retval = NAN;
+ __imag__ retval = NAN;
+ }
+
+ return retval;
+}
diff --git a/libstdc++-v3/math/csqrt.c b/libstdc++-v3/math/csqrt.c
new file mode 100644
index 000000000000..53551653ae0d
--- /dev/null
+++ b/libstdc++-v3/math/csqrt.c
@@ -0,0 +1,110 @@
+/* Complex square root of double value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+csqrt (__complex__ double x)
+{
+ __complex__ double res;
+
+ if (!FINITE_P (__real__ x) || !FINITE_P (__imag__ x))
+ {
+ if (INFINITE_P (__imag__ x))
+ {
+ __real__ res = HUGE_VAL;
+ __imag__ res = __imag__ x;
+ }
+ else if (INFINITE_P (__real__ x))
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = __imag__ x != __imag__ x ? NAN : 0;
+ __imag__ res = copysign (HUGE_VAL, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __real__ x;
+ __imag__ res = (__imag__ x != __imag__ x
+ ? NAN : copysign (0.0, __imag__ x));
+ }
+ }
+ else
+ {
+ __real__ res = NAN;
+ __imag__ res = NAN;
+ }
+ }
+ else
+ {
+ if (__imag__ x == 0.0)
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = 0.0;
+ __imag__ res = copysign (sqrt (-__real__ x), __imag__ x);
+ }
+ else
+ {
+ __real__ res = fabs (sqrt (__real__ x));
+ __imag__ res = copysign (0.0, __imag__ x);
+ }
+ }
+ else if (__real__ x == 0.0)
+ {
+ double r = sqrt (0.5 * fabs (__imag__ x));
+
+ __real__ res = copysign (r, __imag__ x);
+ __imag__ res = r;
+ }
+ else
+ {
+ __complex__ double q;
+ double t, r;
+
+ if (fabs (__imag__ x) < 2.0e-4 * fabs (__real__ x))
+ t = 0.25 * __imag__ x * (__imag__ x / __real__ x);
+ else
+ t = 0.5 * (hypot (__real__ x, __imag__ x) - __real__ x);
+
+ r = sqrt (t);
+
+ __real__ q = __imag__ x / (2.0 * r);
+ __imag__ q = r;
+
+ /* Heron iteration in complex arithmetic. */
+ res = 0.5 * (q + q / x);
+ }
+ }
+
+ return res;
+}
diff --git a/libstdc++-v3/math/csqrtf.c b/libstdc++-v3/math/csqrtf.c
new file mode 100644
index 000000000000..a239588a646d
--- /dev/null
+++ b/libstdc++-v3/math/csqrtf.c
@@ -0,0 +1,110 @@
+/* Complex square root of float value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+csqrtf (__complex__ float x)
+{
+ __complex__ float res;
+
+ if (!FINITEF_P (__real__ x) || !FINITEF_P (__imag__ x))
+ {
+ if (INFINITEF_P (__imag__ x))
+ {
+ __real__ res = HUGE_VALF;
+ __imag__ res = __imag__ x;
+ }
+ else if (INFINITEF_P (__real__ x))
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = __imag__ x != __imag__ x ? NAN : 0;
+ __imag__ res = copysignf (HUGE_VALF, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __real__ x;
+ __imag__ res = (__imag__ x != __imag__ x
+ ? NAN : copysignf (0.0, __imag__ x));
+ }
+ }
+ else
+ {
+ __real__ res = NAN;
+ __imag__ res = NAN;
+ }
+ }
+ else
+ {
+ if (__imag__ x == 0.0)
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = 0.0;
+ __imag__ res = copysignf (sqrtf (-__real__ x), __imag__ x);
+ }
+ else
+ {
+ __real__ res = fabsf (sqrtf (__real__ x));
+ __imag__ res = copysignf (0.0, __imag__ x);
+ }
+ }
+ else if (__real__ x == 0.0)
+ {
+ float r = sqrtf (0.5 * fabsf (__imag__ x));
+
+ __real__ res = copysignf (r, __imag__ x);
+ __imag__ res = r;
+ }
+ else
+ {
+ __complex__ float q;
+ float t, r;
+
+ if (fabsf (__imag__ x) < 2.0e-4 * fabsf (__real__ x))
+ t = 0.25 * __imag__ x * (__imag__ x / __real__ x);
+ else
+ t = 0.5 * (hypotf (__real__ x, __imag__ x) - __real__ x);
+
+ r = sqrtf (t);
+
+ __real__ q = __imag__ x / (2.0 * r);
+ __imag__ q = r;
+
+ /* Heron iteration in complex arithmetic. */
+ res = 0.5 * (q + q / x);
+ }
+ }
+
+ return res;
+}
diff --git a/libstdc++-v3/math/csqrtl.c b/libstdc++-v3/math/csqrtl.c
new file mode 100644
index 000000000000..d871a69afb01
--- /dev/null
+++ b/libstdc++-v3/math/csqrtl.c
@@ -0,0 +1,114 @@
+/* Complex square root of long double value. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+/* Thanks to SGI we have to trick here. At least Irix 6.2 provides hypotl,
+ but it has a wrong prototype. Grrr. */
+extern long double local_hypotl (long double, long double) asm ("hypotl");
+
+
+__complex__ long double
+csqrtl (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ if (!FINITEL_P (__real__ x) || !FINITEL_P (__imag__ x))
+ {
+ if (INFINITEL_P (__imag__ x))
+ {
+ __real__ res = HUGE_VALL;
+ __imag__ res = __imag__ x;
+ }
+ else if (INFINITEL_P (__real__ x))
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = __imag__ x != __imag__ x ? NAN : 0;
+ __imag__ res = copysignl (HUGE_VALL, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __real__ x;
+ __imag__ res = (__imag__ x != __imag__ x
+ ? NAN : copysignl (0.0, __imag__ x));
+ }
+ }
+ else
+ {
+ __real__ res = NAN;
+ __imag__ res = NAN;
+ }
+ }
+ else
+ {
+ if (__imag__ x == 0.0)
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = 0.0;
+ __imag__ res = copysignl (sqrtl (-__real__ x), __imag__ x);
+ }
+ else
+ {
+ __real__ res = fabsl (sqrtl (__real__ x));
+ __imag__ res = copysignl (0.0, __imag__ x);
+ }
+ }
+ else if (__real__ x == 0.0)
+ {
+ long double r = sqrtl (0.5 * fabsl (__imag__ x));
+
+ __real__ res = copysignl (r, __imag__ x);
+ __imag__ res = r;
+ }
+ else
+ {
+ __complex__ long double q;
+ long double t, r;
+
+ if (fabsl (__imag__ x) < 2.0e-4 * fabsl (__real__ x))
+ t = 0.25 * __imag__ x * (__imag__ x / __real__ x);
+ else
+ t = 0.5 * (local_hypotl (__real__ x, __imag__ x) - __real__ x);
+
+ r = sqrtl (t);
+
+ __real__ q = __imag__ x / (2.0 * r);
+ __imag__ q = r;
+
+ /* Heron iteration in complex arithmetic. */
+ res = 0.5 * (q + q / x);
+ }
+ }
+
+ return res;
+}
diff --git a/libstdc++-v3/math/ctan.c b/libstdc++-v3/math/ctan.c
new file mode 100644
index 000000000000..2a35c1822c3c
--- /dev/null
+++ b/libstdc++-v3/math/ctan.c
@@ -0,0 +1,70 @@
+/* Complex tangent function for double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+ctan (__complex__ double x)
+{
+ __complex__ double res;
+
+ if (!FINITE_P (__real__ x) || !FINITE_P (__imag__ x))
+ {
+ if (INFINITE_P (__imag__ x))
+ {
+ __real__ res = copysign (0.0, __real__ x);
+ __imag__ res = copysign (1.0, __imag__ x);
+ }
+ else if (__real__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = NAN;
+ __imag__ res = NAN;
+ }
+ }
+ else
+ {
+ double sin2rx = sin (2.0 * __real__ x);
+ double cos2rx = cos (2.0 * __real__ x);
+ double den;
+
+ den = cos2rx + cosh (2.0 * __imag__ x);
+
+ __real__ res = sin2rx / den;
+ __imag__ res = sinh (2.0 * __imag__ x) / den;
+ }
+
+ return res;
+}
diff --git a/libstdc++-v3/math/ctanf.c b/libstdc++-v3/math/ctanf.c
new file mode 100644
index 000000000000..ebd8cfa3eb0b
--- /dev/null
+++ b/libstdc++-v3/math/ctanf.c
@@ -0,0 +1,70 @@
+/* Complex tangent function for float. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+ctanf (__complex__ float x)
+{
+ __complex__ float res;
+
+ if (!FINITEF_P (__real__ x) || !FINITEF_P (__imag__ x))
+ {
+ if (INFINITEF_P (__imag__ x))
+ {
+ __real__ res = copysignf (0.0, __real__ x);
+ __imag__ res = copysignf (1.0, __imag__ x);
+ }
+ else if (__real__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = NAN;
+ __imag__ res = NAN;
+ }
+ }
+ else
+ {
+ float sin2rx = sinf (2.0f * __real__ x);
+ float cos2rx = cosf (2.0f * __real__ x);
+ float den;
+
+ den = cos2rx + coshf (2.0 * __imag__ x);
+
+ __real__ res = sin2rx / den;
+ __imag__ res = sinhf (2.0 * __imag__ x) / den;
+ }
+
+ return res;
+}
diff --git a/libstdc++-v3/math/ctanh.c b/libstdc++-v3/math/ctanh.c
new file mode 100644
index 000000000000..5db5cd65a8a8
--- /dev/null
+++ b/libstdc++-v3/math/ctanh.c
@@ -0,0 +1,70 @@
+/* Complex hyperbole tangent for double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ double
+ctanh (__complex__ double x)
+{
+ __complex__ double res;
+
+ if (!FINITE_P (__real__ x) || !FINITE_P (__imag__ x))
+ {
+ if (INFINITE_P (__real__ x))
+ {
+ __real__ res = copysign (1.0, __real__ x);
+ __imag__ res = copysign (0.0, __imag__ x);
+ }
+ else if (__imag__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = NAN;
+ __imag__ res = NAN;
+ }
+ }
+ else
+ {
+ double sin2ix = sin (2.0 * __imag__ x);
+ double cos2ix = cos (2.0 * __imag__ x);
+ double den;
+
+ den = (cosh (2.0 * __real__ x) + cos2ix);
+
+ __real__ res = sinh (2.0 * __real__ x) / den;
+ __imag__ res = sin2ix / den;
+ }
+
+ return res;
+}
diff --git a/libstdc++-v3/math/ctanhf.c b/libstdc++-v3/math/ctanhf.c
new file mode 100644
index 000000000000..b5f1ccea94ab
--- /dev/null
+++ b/libstdc++-v3/math/ctanhf.c
@@ -0,0 +1,70 @@
+/* Complex hyperbole tangent for float. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ float
+ctanhf (__complex__ float x)
+{
+ __complex__ float res;
+
+ if (!FINITEF_P (__real__ x) || !FINITEF_P (__imag__ x))
+ {
+ if (INFINITEF_P (__real__ x))
+ {
+ __real__ res = copysignf (1.0, __real__ x);
+ __imag__ res = copysignf (0.0, __imag__ x);
+ }
+ else if (__imag__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = NAN;
+ __imag__ res = NAN;
+ }
+ }
+ else
+ {
+ float sin2ix = sinf (2.0f * __imag__ x);
+ float cos2ix = cosf (2.0f * __imag__ x);
+ float den;
+
+ den = (coshf (2.0 * __real__ x) + cos2ix);
+
+ __real__ res = sinhf (2.0 * __real__ x) / den;
+ __imag__ res = sin2ix / den;
+ }
+
+ return res;
+}
diff --git a/libstdc++-v3/math/ctanhl.c b/libstdc++-v3/math/ctanhl.c
new file mode 100644
index 000000000000..3fdf1fcb6c81
--- /dev/null
+++ b/libstdc++-v3/math/ctanhl.c
@@ -0,0 +1,70 @@
+/* Complex hyperbole tangent for long double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ long double
+ctanhl (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ if (!FINITEL_P (__real__ x) || !FINITEL_P (__imag__ x))
+ {
+ if (INFINITEL_P (__real__ x))
+ {
+ __real__ res = copysignl (1.0, __real__ x);
+ __imag__ res = copysignl (0.0, __imag__ x);
+ }
+ else if (__imag__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = NAN;
+ __imag__ res = NAN;
+ }
+ }
+ else
+ {
+ long double sin2ix = sinl (2.0 * __imag__ x);
+ long double cos2ix = cosl (2.0 * __imag__ x);
+ long double den;
+
+ den = (coshl (2.0 * __real__ x) + cos2ix);
+
+ __real__ res = sinhl (2.0 * __real__ x) / den;
+ __imag__ res = sin2ix / den;
+ }
+
+ return res;
+}
diff --git a/libstdc++-v3/math/ctanl.c b/libstdc++-v3/math/ctanl.c
new file mode 100644
index 000000000000..0af4cecf6e23
--- /dev/null
+++ b/libstdc++-v3/math/ctanl.c
@@ -0,0 +1,69 @@
+/* Complex tangent function for long double. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+#include <math.h>
+#include "mathconf.h"
+
+
+__complex__ long double
+ctanl (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ if (!FINITEL_P (__real__ x) || !FINITEL_P (__imag__ x))
+ {
+ if (INFINITEL_P (__imag__ x))
+ {
+ __real__ res = copysignl (0.0, __real__ x);
+ __imag__ res = copysignl (1.0, __imag__ x);
+ }
+ else if (__real__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = NAN;
+ __imag__ res = NAN;
+ }
+ }
+ else
+ {
+ long double sin2rx = sinl (2.0 * __real__ x);
+ long double cos2rx = cosl (2.0 * __real__ x);
+ long double den;
+
+ den = cos2rx + coshl (2.0 * __imag__ x);
+
+ __real__ res = sin2rx / den;
+ __imag__ res = sinhl (2.0 * __imag__ x) / den;
+ }
+
+ return res;
+}
diff --git a/libstdc++-v3/math/expf.c b/libstdc++-v3/math/expf.c
new file mode 100644
index 000000000000..a597502f8a01
--- /dev/null
+++ b/libstdc++-v3/math/expf.c
@@ -0,0 +1,39 @@
+/* Compute exponential function. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+float
+expf (float x)
+{
+ /* We use the double version. */
+ return exp (x);
+}
diff --git a/libstdc++-v3/math/hypot.c b/libstdc++-v3/math/hypot.c
new file mode 100644
index 000000000000..9e3c07b02222
--- /dev/null
+++ b/libstdc++-v3/math/hypot.c
@@ -0,0 +1,38 @@
+/* Compute hypothenuse. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+/* If the platform is so pathetic that is has no hypot function it does
+ not deserve it better than getting this version. */
+extern double sqrt (double);
+
+double
+hypot (double x, double y)
+{
+ return sqrt (x * x + y * y);
+}
diff --git a/libstdc++-v3/math/hypotf.c b/libstdc++-v3/math/hypotf.c
new file mode 100644
index 000000000000..29d1681f5cc5
--- /dev/null
+++ b/libstdc++-v3/math/hypotf.c
@@ -0,0 +1,48 @@
+/* Compute hypothenuse. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+#include <config.h>
+
+/* If there is a `double' version use it. Otherwise make it simply and
+ stupid. */
+extern double hypot (double, double);
+extern double sqrt (double);
+extern float sqrtf (float);
+
+float
+hypotf (float x, float y)
+{
+#ifdef HAVE_HYPOT
+ return hypot (x, y);
+#elif HAVE_SQRTF
+ return sqrtf (x * x + y * y);
+#else
+ return sqrt (x * x + y * y);
+#endif
+}
diff --git a/libstdc++-v3/math/hypotl.c b/libstdc++-v3/math/hypotl.c
new file mode 100644
index 000000000000..1ec8a9ce7eec
--- /dev/null
+++ b/libstdc++-v3/math/hypotl.c
@@ -0,0 +1,37 @@
+/* Compute hypothenuse. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+/* The platform supports some long double functions but not hypotl. Blarg. */
+extern long double sqrtl (long double);
+
+long double
+hypotl (long double x, long double y)
+{
+ return sqrtl (x * x + y * y);
+}
diff --git a/libstdc++-v3/math/mathconf.h b/libstdc++-v3/math/mathconf.h
new file mode 100644
index 000000000000..53312dce0e56
--- /dev/null
+++ b/libstdc++-v3/math/mathconf.h
@@ -0,0 +1,381 @@
+/* Configuration data for libmath subpart of libstdc++. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <bits/c++config.h>
+
+#ifdef _GLIBCPP_HAVE_ENDIAN_H
+# include <endian.h>
+#else
+# ifdef _GLIBCPP_HAVE_MACHINE_ENDIAN_H
+# include <machine/endian.h>
+# else
+# ifdef _GLIBCPP_HAVE_SYS_MACHINE_H
+# include <sys/machine.h>
+# else
+# if defined _GLIBCPP_HAVE_SYS_ISA_DEFS_H || defined _GLIBCPP_HAVE_MACHINE_PARAM_H
+/* This is on Solaris. */
+# ifdef _GLIBCPP_HAVE_SYS_ISA_DEFS_H
+# include <sys/isa_defs.h>
+# endif
+# ifdef _GLIBCPP_HAVE_MACHINE_PARAM_H
+# include <machine/param.h>
+# endif
+# ifdef _LITTLE_ENDIAN
+# define LITTLE_ENDIAN 1
+# endif
+# ifdef _BIG_ENDIAN
+# define BIG_ENDIAN 1
+# endif
+# define BYTE_ORDER 1
+# else
+/* We have to rely on the AC_C_BIGENDIAN test. */
+# ifdef WORDS_BIGENDIAN
+# define BIG_ENDIAN 1
+# else
+# define LITTLE_ENDIAN 1
+# endif
+# define BYTE_ORDER 1
+# endif
+# endif
+# endif
+#endif
+
+typedef unsigned int U_int32_t __attribute ((mode (SI)));
+typedef int Int32_t __attribute ((mode (SI)));
+
+#ifdef _GLIBCPP_HAVE_NAN_H
+# include <nan.h>
+#endif
+
+#ifdef _GLIBCPP_HAVE_IEEEFP_H
+# include <ieeefp.h>
+#endif
+
+#ifdef _GLIBCPP_HAVE_FP_H
+# include <fp.h>
+#endif
+
+#ifdef _GLIBCPP_HAVE_FLOAT_H
+# include <float.h>
+#endif
+
+/* `float' variant of HUGE_VAL. */
+#ifndef HUGE_VALF
+# ifdef HUGE_VALf
+# define HUGE_VALF HUGE_VALf
+# else
+# define HUGE_VALF HUGE_VAL
+# endif
+#endif
+
+/* `long double' variant of HUGE_VAL. */
+#ifndef HUGE_VALL
+# ifdef HUGE_VALl
+# define HUGE_VALL HUGE_VALl
+# else
+# define HUGE_VALL HUGE_VAL
+# endif
+#endif
+
+/* Make sure that at least HUGE_VAL is defined. */
+#ifndef HUGE_VAL
+# ifdef HUGE
+# define HUGE_VAL HUGE
+# else
+# ifdef MAXFLOAT
+# define HUGE_VAL MAXFLOAT
+# else
+# error "We need HUGE_VAL!"
+# endif
+# endif
+#endif
+
+#ifndef NAN
+# define NAN (nan())
+#endif
+
+#ifndef M_PI
+# define M_PI 3.14159265358979323846
+#endif
+
+/* Test whether number is finite. */
+#ifdef isfinite
+/* This is an ISO C 9x function. */
+# define FINITE_P(X) isfinite (X)
+# define FINITEF_P(X) isfinite (X)
+# define FINITEL_P(X) isfinite (X)
+#else
+# ifdef IsNANorINF
+/* This is for Solaris, which does not have special macros for other
+ types. */
+# define FINITE_P(X) (!IsNANorINF (X))
+# define FINITEF_P(X) (!IsNANorINF (X))
+# define FINITEL_P(X) (!IsNANorINF (X))
+# else
+# if defined _GLIBCPP_HAVE_ISINF && defined _GLIBCPP_HAVE_ISNAN
+# define FINITE_P(X) ({ double __x = (X); !isinf (__x) && !isnan (__x); })
+# else
+# ifdef _GLIBCPP_HAVE_FINITE
+# define FINITE_P(X) finite (X)
+# else
+# error "We need FINITE_P"
+# endif
+# endif
+# if defined _GLIBCPP_HAVE_ISINFF && defined _GLIBCPP_HAVE_ISNANF
+# define FINITEF_P(X) ({ float __x = (X); !isinff (__x) && !isnanf (__x); })
+# else
+# ifdef _GLIBCPP_HAVE_FINITE
+# define FINITEF_P(X) finite (X)
+# else
+# define FINITEF_P(X) FINITE_P (X)
+# endif
+# endif
+# if defined _GLIBCPP_HAVE_ISINFL && defined _GLIBCPP_HAVE_ISNANL
+# define FINITEL_P(X) ({ long double __x = (X); \
+ !isinfl (__x) && !isnanl (__x); })
+# else
+# ifdef _GLIBCPP_HAVE_QFINITE
+# define FINITEL_P(X) qfinite (X)
+# else
+# define FINITEL_P(X) FINITE_P (X)
+# endif
+# endif
+# endif
+#endif
+
+/* Test whether number is infinite. */
+#ifdef isinf
+/* This is an ISO C 9x macro. */
+# define INFINITE_P(X) isinf (X)
+# define INFINITEF_P(X) isinf (X)
+# define INFINITEL_P(X) isinf (X)
+#else
+# ifdef IsINF
+/* This is for Solaris, which does not have special macros for other
+ types. */
+# define INFINITE_P(X) IsINF (X)
+# define INFINITEF_P(X) IsINF (X)
+# define INFINITEL_P(X) IsINF (X)
+# else
+# if defined _GLIBCPP_HAVE_ISINF
+# define INFINITE_P(X) isinf (X)
+# else
+# ifdef _GLIBCPP_HAVE_FPCLASS
+# ifdef _FPCLASS_PINF
+/* Mingw defines _FPCLASS_PINF. */
+# define FP_PINF _FPCLASS_PINF
+# endif
+/* This is for Irix and Mingw. */
+# define INFINITE_P(X) (fpclass (fabs (X)) == FP_PINF)
+# else
+# ifdef IS_INF
+/* This is for AIX. */
+# define INFINITE_P(X) ({ double __d = (X); IS_INF (__d); })
+# else
+# error "We need INFINITE_P"
+# endif
+# endif
+# endif
+# if defined _GLIBCPP_HAVE_ISINFF
+# define INFINITEF_P(X) isinff (X)
+# else
+# define INFINITEF_P(X) INFINITE_P (X)
+# endif
+# if defined _GLIBCPP_HAVE_ISINFL
+# define INFINITEL_P(X) isinfl (X)
+# else
+# ifdef _GLIBCPP_HAVE_QFPCLASS
+# define INFINITEL_P(X) (qfpclass (fabsl (X)) == FP_PINF)
+# else
+# define INFINITEL_P(X) INFINITE_P (X)
+# endif
+# endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _GLIBCPP_HAVE_COMPLEX_H
+# include <complex.h>
+#else
+# include "complex-stub.h"
+#endif
+__complex__ double c_log (__complex__ double x);
+__complex__ float c_logf (__complex__ float x);
+__complex__ long double c_logl (__complex__ long double x);
+
+/* signbit is a macro in ISO C 9x. */
+#ifndef signbit
+extern int __signbitf (float);
+extern int __signbit (double);
+extern int __signbitl (long double);
+
+# define signbit(x) \
+ (sizeof (x) == sizeof (float) ? \
+ __signbitf (x) \
+ : sizeof (x) == sizeof (double) ? \
+ __signbit (x) : __signbitl (x))
+#endif
+
+#if BYTE_ORDER == BIG_ENDIAN
+typedef union
+{
+ double value;
+ struct
+ {
+ U_int32_t msw;
+ U_int32_t lsw;
+ } parts;
+} ieee_double_shape_type;
+#endif
+#if BYTE_ORDER == LITTLE_ENDIAN
+typedef union
+{
+ double value;
+ struct
+ {
+ U_int32_t lsw;
+ U_int32_t msw;
+ } parts;
+} ieee_double_shape_type;
+#endif
+/* Get the more significant 32 bit int from a double. */
+#define GET_HIGH_WORD(i,d) \
+do { \
+ ieee_double_shape_type gh_u; \
+ gh_u.value = (d); \
+ (i) = gh_u.parts.msw; \
+} while (0)
+
+
+typedef union
+{
+ float value;
+ U_int32_t word;
+} ieee_float_shape_type;
+/* Get a 32 bit int from a float. */
+#define GET_FLOAT_WORD(i,d) \
+do { \
+ ieee_float_shape_type gf_u; \
+ gf_u.value = (d); \
+ (i) = gf_u.word; \
+} while (0)
+
+
+#if BYTE_ORDER == BIG_ENDIAN
+typedef union
+{
+ long double value;
+ struct
+ {
+ unsigned int sign_exponent:16;
+ unsigned int empty:16;
+ U_int32_t msw;
+ U_int32_t lsw;
+ } parts;
+} ieee_long_double_shape_type;
+#endif
+#if BYTE_ORDER == LITTLE_ENDIAN
+typedef union
+{
+ long double value;
+ struct
+ {
+ U_int32_t lsw;
+ U_int32_t msw;
+ unsigned int sign_exponent:16;
+ unsigned int empty:16;
+ } parts;
+} ieee_long_double_shape_type;
+#endif
+/* Get int from the exponent of a long double. */
+#define GET_LDOUBLE_EXP(exp,d) \
+do { \
+ ieee_long_double_shape_type ge_u; \
+ ge_u.value = (d); \
+ (exp) = ge_u.parts.sign_exponent; \
+} while (0)
+
+
+/* Replacement for non-existing float functions. */
+#ifndef _GLIBCPP_HAVE_FABSF
+# ifdef __GNUC__
+/* gcc has fabsf as a builtin command. */
+extern float fabsf (float);
+# else
+# define fabsf(x) fabs (x)
+# endif
+#endif
+#ifndef _GLIBCPP_HAVE_COSF
+# define cosf(x) cos (x)
+#endif
+#ifndef _GLIBCPP_HAVE_COSHF
+# define coshf(x) cosh (x)
+#endif
+#ifndef _GLIBCPP_HAVE_EXPF
+# define expf(x) expf (x)
+#endif
+#ifndef _GLIBCPP_HAVE_LOGF
+# define logf(x) log(x)
+#endif
+#ifndef _GLIBCPP_HAVE_LOG10F
+# define log10f(x) log10 (x)
+#endif
+#ifndef _GLIBCPP_HAVE_POWF
+# define powf(x, y) pow (x, y)
+#endif
+#ifndef _GLIBCPP_HAVE_SINF
+# define sinf(x) sin (x)
+#endif
+#ifndef _GLIBCPP_HAVE_SINHF
+# define sinhf(x) sinh (x)
+#endif
+#ifndef _GLIBCPP_HAVE_SQRTF
+# define sqrtf(x) sqrt (x)
+#endif
+#ifndef _GLIBCPP_HAVE_TANF
+# define tanf(x) tan (x)
+#endif
+#ifndef _GLIBCPP_HAVE_TANHF
+# define tanhf(x) tanh (x)
+#endif
+#ifndef _GLIBCPP_HAVE_STRTOF
+# define strtof(s, e) strtod (s, e)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+
diff --git a/libstdc++-v3/math/nan.c b/libstdc++-v3/math/nan.c
new file mode 100644
index 000000000000..779173adb160
--- /dev/null
+++ b/libstdc++-v3/math/nan.c
@@ -0,0 +1,36 @@
+/* Return quiet nan. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <stdlib.h>
+#include <string.h>
+
+double
+nan ()
+{ return strtod ("nan", NULL); }
diff --git a/libstdc++-v3/math/signbit.c b/libstdc++-v3/math/signbit.c
new file mode 100644
index 000000000000..0d58ed88880c
--- /dev/null
+++ b/libstdc++-v3/math/signbit.c
@@ -0,0 +1,41 @@
+/* Return nonzero value if number is negative. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+int
+__signbit (double x)
+{
+ Int32_t hx;
+
+ GET_HIGH_WORD (hx, x);
+ return hx & 0x80000000;
+}
diff --git a/libstdc++-v3/math/signbitf.c b/libstdc++-v3/math/signbitf.c
new file mode 100644
index 000000000000..5e2eee133a48
--- /dev/null
+++ b/libstdc++-v3/math/signbitf.c
@@ -0,0 +1,41 @@
+/* Return nonzero value if number is negative. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+
+#include <math.h>
+#include "mathconf.h"
+
+int
+__signbitf (float x)
+{
+ Int32_t hx;
+
+ GET_FLOAT_WORD (hx, x);
+ return hx & 0x80000000;
+}
diff --git a/libstdc++-v3/math/signbitl.c b/libstdc++-v3/math/signbitl.c
new file mode 100644
index 000000000000..682d1d30a3b7
--- /dev/null
+++ b/libstdc++-v3/math/signbitl.c
@@ -0,0 +1,40 @@
+/* Return nonzero value if number is negative. */
+
+/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
+
+ This file is part of the GNU ISO C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this library; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+
+ As a special exception, you may use this file as part of a free software
+ library without restriction. Specifically, if other files instantiate
+ templates or use macros or inline functions from this file, or you compile
+ this file and link it with other files to produce an executable, this
+ file does not by itself cause the resulting executable to be covered by
+ the GNU General Public License. This exception does not however
+ invalidate any other reasons why the executable file might be covered by
+ the GNU General Public License. */
+
+#include <math.h>
+#include "mathconf.h"
+
+int
+__signbitl (long double x)
+{
+ Int32_t e;
+
+ GET_LDOUBLE_EXP (e, x);
+ return e & 0x8000;
+}
diff --git a/libstdc++-v3/mkc++config b/libstdc++-v3/mkc++config
new file mode 100755
index 000000000000..381de6b1368c
--- /dev/null
+++ b/libstdc++-v3/mkc++config
@@ -0,0 +1,58 @@
+#! /bin/sh
+
+# 2000-02-01 bkoz
+# Script to take the generated "config.h" from autoconf and make the
+# macros within it namespace safe (ie wrapping them in _GLIBCPP_ so
+# that "HAVE_LC_MESSAGES" becomes "_GLIBCPP_HAVE_LC_MESSAGES" etc etc.
+
+echo "running mkc++config"
+
+BUILD_DIR=$1
+if [ ! -d "$BUILD_DIR" ]; then
+ echo "build directory $BUILD_DIR not found, exiting."
+ exit 1
+fi
+
+SRC_DIR=$2
+if [ ! -d "$SRC_DIR" ]; then
+ echo "source directory $SRC_DIR not found, exiting."
+ exit 1
+fi
+
+BASE_H="$SRC_DIR/bits/c++config.h"
+IN_H="$BUILD_DIR/config.h"
+OUT_H="$BUILD_DIR/bits/c++config.h"
+
+if [ ! -f $IN_H ]; then
+ echo "necessary file $IN_H not found, exiting"
+ exit 1
+fi
+
+if [ ! -d "$BUILD_DIR/bits" ]; then
+ mkdir "$BUILD_DIR/bits"
+fi
+
+
+# Part 1
+# sed config.h from autoconf and make it namespace safe.
+sed 's/HAVE_/_GLIBCPP_HAVE_/g' < $IN_H > temp-1
+sed 's/PACKAGE/_GLIBCPP_PACKAGE/g' < temp-1 > temp-2
+sed 's/VERSION/_GLIBCPP_VERSION/g' < temp-2 > temp-3
+sed 's/WORDS_/_GLIBCPP_WORDS_/g' < temp-3 > temp-4
+
+
+# Part 2
+# cat this into generated bits/c++config.h
+cat $BASE_H temp-4 > $OUT_H
+rm temp-1 temp-2 temp-3 temp-4
+
+
+# Part 3
+# complete macro guards for resulting file
+cat <<EOF >> $OUT_H
+
+#endif // _CPP_CPPCONFIG_
+EOF
+
+exit 0
+
diff --git a/libstdc++-v3/mkcheck.in b/libstdc++-v3/mkcheck.in
new file mode 100755
index 000000000000..e78b1bb6b8e6
--- /dev/null
+++ b/libstdc++-v3/mkcheck.in
@@ -0,0 +1,302 @@
+#!/usr/bin/env bash
+
+# 1999-07-19 bkoz
+# Script to do automated testing and data collection for
+# various test files, and avoid doing this 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.
+
+# invocation == mkcheck [01] (path to build) (path to src) (path to install)
+
+if [ $# != 3 ] && [ $# != 4 ]; then
+ echo 'Usage: mkcheck 0 (path to build) (path to src)'
+ echo ' mkcheck 1 (path to build) (path to src) (path to install)'
+ exit 1
+fi
+echo "running mkcheck"
+
+#
+# 1: variables
+#
+# WHICH determines if you are testing the installed binary and headers, or
+# the build binary and headers.
+WHICH=$1
+if [ $WHICH != "1" ]; then
+ WHICH=0
+ echo "$0: testing the build directory"
+elif [ $WHICH -eq 1 ]; then
+ echo "$0: testing the install directory $1"
+fi
+
+BUILD_DIR=$2
+if [ ! -d "$BUILD_DIR" ]; then
+ echo "build directory $BUILD_DIR not found, exiting."
+ exit 1
+fi
+
+SRC_DIR=$3
+if [ ! -d "$SRC_DIR" ]; then
+ echo "source directory $SRC_DIR not found, exiting."
+ exit 1
+fi
+
+if [ $WHICH -eq 1 ]; then
+ PREFIX_DIR=$4
+ if [ ! -d "$PREFIX_DIR" ]; then
+ echo "install directory $PREFIX_DIR not found, exiting."
+ exit 1
+ fi
+fi
+
+# INC_PATH == include path to new headers for use on gcc command-line
+if [ $WHICH != "1" ]; then
+ INC_PATH="-I$BUILD_DIR -I$SRC_DIR/@ctype_include_dir@ -I$SRC_DIR/@cpu_include_dir@ -I$SRC_DIR/std -I$SRC_DIR -I$SRC_DIR/libio"
+elif [ $WHICH -eq 1 ]; then
+ INC_PATH=""
+fi
+
+#LIB_PATH == where to find the build library binaries.
+if [ $WHICH != "1" ]; then
+ LIB_PATH="-L$BUILD_DIR/src/.libs"
+ CXX="../../gcc/g++ -B../../gcc/"
+elif [ $WHICH -eq 1 ]; then
+ LIB_PATH="-L$PREFIX_DIR/lib"
+ CXX="$PREFIX_DIR/bin/g++"
+fi
+
+# gcc compiler flags
+#CXX_FLAG="-fsquangle -fhonor-std -fnew-exceptions -g -O2 -DDEBUG_ASSERT "
+#CXX_FLAG="-g -O2 -DDEBUG_ASSERT "
+CXX_FLAG="-g -DDEBUG_ASSERT "
+
+# a specific flag to force the use of shared libraries, if any
+SH_FLAG=
+
+# a specific flag to force the use of static libraries, if any
+ST_FLAG="-static"
+
+# Set up the testing directory, which should be in a directory called
+# "testsuite" in the root level of the build directory.
+TEST_DIR="`pwd`/testsuite"
+if [ ! -d "$TEST_DIR" ]; then
+ echo "making directory $TEST_DIR"
+ mkdir $TEST_DIR
+ chmod 777 $TEST_DIR
+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
+#
+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.
+if [ ! -x "$TEST_DIR/printnow" ]; then
+ echo "making utility $TEST_DIR/printnow"
+ gcc -o "$TEST_DIR/printnow" "$SRC_DIR/testsuite/printnow.c"
+ strip "$TEST_DIR/printnow"
+fi
+
+# Remove old executables.
+rm -rf "$TEST_DIR/*exe"
+rm -rf "$TEST_DIR/core" "$TEST_DIR/*core"
+
+# Copy over the data files for filebufs in read-only mode
+cp $SRC_DIR/testsuite/27_io/*.txt $TEST_DIR
+cp $SRC_DIR/testsuite/27_io/*.tst $TEST_DIR
+
+# Emit useful info about compiler and platform
+echo "host: $(uname -mrsv)" >> $RESULTS_FILE
+echo "compiler: $(g++ --version)" >> $RESULTS_FILE
+echo "compiler flags: $CXX_FLAG $ST_FLAG" >> $RESULTS_FILE
+echo "date: $(date +%Y%m%d)" >> $RESULTS_FILE
+echo "" >> $RESULTS_FILE
+
+echo "p == pass/fail execution test" >> $RESULTS_FILE
+echo "ctime == time to compile and link" >> $RESULTS_FILE
+echo "etime == time for executable to run (take with salt)" >> $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
+
+
+#
+# 3: compile, link, execute, time
+#
+for NAME in `cat $TESTS_FILE`
+do
+ echo "$NAME"
+ 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/'`"
+ CNAME="$SRC_DIR/testsuite/$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).
+ COMP_TIME_START=$($TEST_DIR/printnow)
+ $CXX $CXX_FLAG $ST_FLAG $INC_PATH $LIB_PATH $CNAME \
+ -o $ST_NAME 2>> $LOG_FILE
+ COMP_TIME_END=$($TEST_DIR/printnow)
+
+ if [ $COMP_TIME_START -lt $COMP_TIME_END ]; then
+ C_TIME=$[ $COMP_TIME_END - $COMP_TIME_START ]
+ else
+ C_TIME="0"
+ fi
+
+ if [ -f $ST_NAME ]; then
+ case @host_os@ in
+ *solaris*)
+ # These numbers seem to match up to text/data/total,
+ # although their meanings seem to be different. Very
+ # important to not compare these numbers across platforms.
+ ST_TEXT="$(size $ST_NAME | awk '{print $1}')"
+ ST_DATA="$(size $ST_NAME | awk '{print $3}')"
+ ST_SIZE="$(size $ST_NAME | awk '{print $7}')"
+ ;;
+ *)
+ ST_TEXT="$(size -A $ST_NAME | grep text | awk '{print $2}')"
+ ST_DATA="$(size -A $ST_NAME | grep data | awk '{print $2}')"
+ ST_SIZE="$(size -A $ST_NAME | grep otal | awk '{print $2}')"
+ ;;
+ esac
+
+ # Actually run the executable and time it . . .
+ TIMEFORMAT='timemark %R'
+ E_TIME_TEXT="$(exec 2>&1; time $ST_NAME)"
+ E_TIME="$(echo $E_TIME_TEXT | awk '{print $2}')"
+ # joining those two commands does not work due to quoting problems:
+ #E_TIME="$(exec 2>&1; time $ST_NAME | awk '{print $2}')"
+ # this will work as a fallback on certain systems...?
+ #E_TIME=$(exec 2>&1; time $ST_NAME | cut -d ' ' -f 2)
+
+ if [ -f core ]; then
+ ST_EXEC='-'
+ echo "st_fail" | awk '{printf("\t%s\n", $1)}'
+ rm core
+ else
+ # XXX this should probably be a function?
+
+ # 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
+ # 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 $PRE_NAME | sed 's/cc$/diff/'`"
+ # construct wildcard names,ie for $NAME=filebuf.cc, makes
+ # "filebuf*.tst"
+ ST_DATA_FILES="`echo $NAME | sed 's/\.cc/\*\.tst/g'`"
+ # make sure there is at least one, then go
+ ST_E="`echo $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 $ST_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
+ ST_EXEC="-"
+ echo "st_fail" | awk '{printf("\t%s\n", $1)}'
+ echo "$ST_OUT_FILE has some problems, dude"
+ else
+ ST_EXEC="+"
+ echo "st_pass" | awk '{printf("\t%s\n", $1)}'
+ fi
+ rm $DIFF_FILE
+ done
+ else
+ # the file does no output, and didn't core, so
+ # assume passed.
+ ST_EXEC="+"
+ echo "st_pass" | awk '{printf("\t%s\t", $1)}'
+ fi
+ fi
+ rm "$ST_NAME"
+ else
+ # the file did not compile. Write out compilation info to the log file.
+ echo "$CXX $CXX_FLAG $ST_FLAG $INC_PATH $LIB_PATH $CNAME -o $ST_NAME" \
+ 2>> $LOG_FILE
+
+ ST_EXEC="-"
+ echo "st_fail" | awk '{printf("\t%s\t", $1)}'
+ ST_TEXT="0"
+ ST_DATA="0"
+ ST_SIZE="0"
+ fi
+
+ echo $ST_EXEC | awk '{printf ("%.1s ", $1)}'>>$RESULTS_FILE
+ echo $C_TIME $E_TIME |awk '{printf("%d\t%.3f\t", $1, $2)}'>>$RESULTS_FILE
+ echo $ST_TEXT $ST_DATA | awk '{printf("%s\t%s\t", $1, $2)}'>>$RESULTS_FILE
+ echo $ST_SIZE | awk '{printf("%s\t", $1)}'>>$RESULTS_FILE
+ echo $NAME | awk '{printf("%s\n", $1)}'>>$RESULTS_FILE
+
+ echo "" >> $RESULTS_FILE
+ echo ""
+done
+
+# grep can count faster than we can...
+total_failures=$(egrep -c "^\-" $RESULTS_FILE)
+total_successes=$(egrep -c "^\+" $RESULTS_FILE)
+resultstext="pass/fail results: ${total_successes}/${total_failures}"
+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
+
+exit 0
+
diff --git a/libstdc++-v3/mkcshadow b/libstdc++-v3/mkcshadow
new file mode 100755
index 000000000000..277ecee98a29
--- /dev/null
+++ b/libstdc++-v3/mkcshadow
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+# mkcshadow: reads header names (like "features.h" or "sys/types.h")
+# from stdin, and creates shadow headers under cshadow/, except where
+# a header of the same name is already in shadow/.
+
+while read header; do
+
+ if [ ! -f shadow/$header ]; then
+
+ # strip off directory names while making
+ # any necessary directories
+
+ dir=cshadow
+ case "$header" in */*)
+ right="$header"
+ while [ "$right" != "${right##*/}" ] ; do
+ dir="$dir/${right%%/*}"
+ if [ ! -d "$dir" ]; then mkdir "$dir"; fi
+ right="${right#*/}"
+ done
+ ;;
+ esac
+
+ UPNAME=`echo $header | tr 'a-z./-' 'A-Z___'`
+ cat >"cshadow/$header" <<EOF
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Note: this file was automatically generated by the "mkcshadow"
+// script. RTFM!
+
+#ifndef _INCLUDED_CPP_${UPNAME}_
+
+# ifdef _IN_C_SWAMP_ /* sub-included by a C header */
+# include_next <${header}>
+# else
+
+ namespace _C_Swamp { namespace _C_Shadow { } }
+ using namespace ::_C_Swamp::_C_Shadow;
+ namespace _C_Swamp_ {
+ extern "C" {
+# define _IN_C_SWAMP_
+# include_next <${header}>
+ } // close extern "C"
+ } // close namespace _C_Swamp::
+
+# endif /* _IN_C_SWAMP_ */
+#endif /* _INCLUDED_CPP_${UPNAME}_ */
+
+EOF
+
+ fi
+done
+
+
+
diff --git a/libstdc++-v3/mknumeric_limits b/libstdc++-v3/mknumeric_limits
new file mode 100755
index 000000000000..89e7a611130d
--- /dev/null
+++ b/libstdc++-v3/mknumeric_limits
@@ -0,0 +1,268 @@
+#! /bin/sh
+
+# mknumeric_limits: generates
+# - part of bits/std_limits.h completed by gen-num-limits.cc
+# - src/limitsMEMBERS.cc that contains the definition of various
+# static data members of specialization of class template numeric_limits
+#
+
+echo "running mknumeric_limits"
+
+: ${CXX:=g++}
+
+case `uname` in
+ CYGWIN*)
+ LDFLAGS='-nodefaultlibs -lcygwin -lc -lkernel32 -lgcc' ;;
+ *)
+ LDFLAGS='-nodefaultlibs -lgcc -lc' ;;
+esac
+
+BUILD_DIR=$1
+if [ ! -d "$BUILD_DIR" ]; then
+ echo "build directory $BUILD_DIR not found, exiting."
+ exit 1
+fi
+
+if [ ! -d "$BUILD_DIR/bits" ]; then
+ mkdir "$BUILD_DIR/bits"
+fi
+if [ ! -d "$BUILD_DIR/src" ]; then
+ mkdir "$BUILD_DIR/src"
+fi
+
+OUT_H="$BUILD_DIR/bits/std_limits.h"
+OUT_C="$BUILD_DIR/src/limitsMEMBERS.cc"
+
+if [ -f $OUT_C ]; then
+ rm -f $OUT_H OUT_C
+fi
+
+SRC_DIR=$2
+if [ ! -d "$SRC_DIR" ]; then
+ echo "source directory $SRC_DIR not found, exiting."
+ exit 1
+fi
+
+XCOMPILE=$3
+if [ $XCOMPILE -eq 1 ]; then
+ echo "using default values for cross compiles"
+ cp $SRC_DIR/bits/limits_generic.h $OUT_H
+ cp $SRC_DIR/src/limits_generic.cc $OUT_C
+ exit 0;
+fi
+
+cat <<EOF > $OUT_H
+// The template and inlines for the -*- C++ -*- numeric_limits classes.
+
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Note: this is not a conforming implementation.
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
+
+//
+// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT!
+//
+
+//
+// ISO 14882:1998
+// 18.2.1
+//
+
+#ifndef _CPP_NUMERIC_LIMITS
+#define _CPP_NUMERIC_LIMITS 1
+
+#include <bits/c++config.h>
+#include <bits/std_cfloat.h>
+
+namespace std {
+
+ enum float_round_style {
+ round_indeterminate = -1,
+ round_toward_zero = 0,
+ round_to_nearest = 1,
+ round_toward_infinity = 2,
+ round_toward_neg_infinity = 3
+ };
+
+ enum float_denorm_style {
+ denorm_indeterminate = -1,
+ denorm_absent = 0,
+ denorm_present = 1
+ };
+
+ template<typename _Tp> struct numeric_limits {
+ static const bool is_specialized = false;
+
+ static _Tp min() throw() { return static_cast<_Tp>(0); }
+ static _Tp max() throw() { return static_cast<_Tp>(0); }
+
+ static const int digits = 0;
+ static const int digits10 = 0;
+ static const bool is_signed = false;
+ static const bool is_integer = false;
+ static const bool is_exact = false;
+ static const int radix = 0;
+
+ static _Tp epsilon() throw() { return static_cast<_Tp>(0); }
+ static _Tp round_error() throw() { return static_cast<_Tp>(0); }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static _Tp infinity() throw() { return static_cast<_Tp>(0); }
+ static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); }
+ static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); }
+ static _Tp denorm_min() throw() { return static_cast<_Tp>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = false;
+ static const bool is_modulo = false;
+
+ static const bool traps = false;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ template<typename _Tp> _Tp __limits_infinity();
+ template<typename _Tp> _Tp __limits_quiet_NaN();
+ template<typename _Tp> _Tp __limits_signaling_NaN();
+ template<typename _Tp> _Tp __limits_denorm_min();
+
+EOF
+
+echo "$CXX $CPPFLAGS -I$BUILD_DIR \
+ -o "$BUILD_DIR/src/gen-num-limits" "$SRC_DIR/src/gen-num-limits.cc" \
+ $LDFLAGS"
+
+$CXX $CPPFLAGS -I$BUILD_DIR \
+ -o "$BUILD_DIR/src/gen-num-limits" "$SRC_DIR/src/gen-num-limits.cc" \
+ $LDFLAGS
+
+if [ ! -f "$BUILD_DIR/src/gen-num-limits" ]; then
+ echo "gen-num-limits failed to build, exiting."
+ exit 1
+fi
+
+"$BUILD_DIR/src/gen-num-limits" >> $OUT_H
+
+cat <<EOF >> $OUT_H
+} // namespace std
+
+#endif // _CPP_NUMERIC_LIMITS
+EOF
+
+trait_name=numeric_limits
+
+cat <<EOF > $OUT_C
+// Static data members of -*- C++ -*- numeric_limits classes
+
+// Copyright (C) 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>
+
+//
+// ISO C++ 14882:1998
+// 18.2.1
+//
+
+#include <bits/std_limits.h>
+namespace std {
+EOF
+
+for type_name in bool char 'signed char' 'unsigned char' \
+ short 'unsigned short' int 'unsigned int' \
+ long 'unsigned long' 'long long' 'unsigned long long' \
+ float double 'long double'
+ do
+ grep "<$type_name>" $OUT_H >/dev/null 2>&1 || continue
+ cat <<EOF >> $OUT_C
+
+ const bool $trait_name<$type_name>::is_specialized;
+ const int $trait_name<$type_name>::digits;
+ const int $trait_name<$type_name>::digits10;
+ const bool $trait_name<$type_name>::is_signed;
+ const bool $trait_name<$type_name>::is_integer;
+ const bool $trait_name<$type_name>::is_exact;
+ const int $trait_name<$type_name>::radix;
+ const int $trait_name<$type_name>::min_exponent;
+ const int $trait_name<$type_name>::min_exponent10;
+ const int $trait_name<$type_name>::max_exponent;
+ const int $trait_name<$type_name>::max_exponent10;
+ const bool $trait_name<$type_name>::has_infinity;
+ const bool $trait_name<$type_name>::has_quiet_NaN;
+ const bool $trait_name<$type_name>::has_signaling_NaN;
+ const float_denorm_style $trait_name<$type_name>::has_denorm;
+ const bool $trait_name<$type_name>::has_denorm_loss;
+ const bool $trait_name<$type_name>::is_iec559;
+ const bool $trait_name<$type_name>::is_bounded;
+ const bool $trait_name<$type_name>::is_modulo;
+ const bool $trait_name<$type_name>::traps;
+ const bool $trait_name<$type_name>::tinyness_before;
+ const float_round_style $trait_name<$type_name>::round_style;
+EOF
+
+done
+
+cat <<EOF >> $OUT_C
+} // namespace std
+
+
+EOF
diff --git a/libstdc++-v3/shadow/assert.h b/libstdc++-v3/shadow/assert.h
new file mode 100644
index 000000000000..f9f4d046595f
--- /dev/null
+++ b/libstdc++-v3/shadow/assert.h
@@ -0,0 +1,35 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+// no include guard here.
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <cassert>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
diff --git a/libstdc++-v3/shadow/ctype.h b/libstdc++-v3/shadow/ctype.h
new file mode 100644
index 000000000000..374d27abd15b
--- /dev/null
+++ b/libstdc++-v3/shadow/ctype.h
@@ -0,0 +1,55 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+
+#ifndef _INCLUDED_CPP_CTYPE_H_
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <cctype>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+
+# ifndef _IN_C_SWAMP_
+ using ::std::isalnum;
+ using ::std::isalpha;
+ using ::std::iscntrl;
+ using ::std::isdigit;
+ using ::std::isgraph;
+ using ::std::islower;
+ using ::std::isprint;
+ using ::std::ispunct;
+ using ::std::isspace;
+ using ::std::isupper;
+ using ::std::isxdigit;
+ using ::std::tolower;
+ using ::std::toupper;
+# define _INCLUDED_CPP_CTYPE_H_ 1
+# endif
+
+#endif /* _INCLUDED_CPP_CTYPE_H_ */
diff --git a/libstdc++-v3/shadow/errno.h b/libstdc++-v3/shadow/errno.h
new file mode 100644
index 000000000000..b4a9ca71d7ac
--- /dev/null
+++ b/libstdc++-v3/shadow/errno.h
@@ -0,0 +1,37 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#ifndef _INCLUDED_CPP_ERRNO_H_
+# define _INCLUDED_CPP_ERRNO_H_ 1
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <cerrno>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+#endif /* _INCLUDED_CPP_ERRNO_H_ */
diff --git a/libstdc++-v3/shadow/float.h b/libstdc++-v3/shadow/float.h
new file mode 100644
index 000000000000..5d2cca9d65c9
--- /dev/null
+++ b/libstdc++-v3/shadow/float.h
@@ -0,0 +1,38 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+
+#ifndef _INCLUDED_CPP_FLOAT_H_
+# define _INCLUDED_CPP_FLOAT_H_ 1
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <cfloat>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+#endif /* _INCLUDED_CPP_FLOAT_H_ */
diff --git a/libstdc++-v3/shadow/libio.h b/libstdc++-v3/shadow/libio.h
new file mode 100644
index 000000000000..44c2cc66cc76
--- /dev/null
+++ b/libstdc++-v3/shadow/libio.h
@@ -0,0 +1,44 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#ifndef _INCLUDED_CPP_LIBIO_H_
+
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <bits/wrap_libio.h>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+
+# ifndef _IN_C_SWAMP_
+ // using ::std::stuff
+
+# define _INCLUDED_CPP_LIBIO_H_ 1
+# endif
+
+#endif /* _INCLUDED_CPP_LIBIO_H_ */
diff --git a/libstdc++-v3/shadow/limits.h b/libstdc++-v3/shadow/limits.h
new file mode 100644
index 000000000000..271c883a57e3
--- /dev/null
+++ b/libstdc++-v3/shadow/limits.h
@@ -0,0 +1,38 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+
+#ifndef _INCLUDED_CPP_LIMITS_H_
+# define _INCLUDED_CPP_LIMITS_H_ 1
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <climits>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+#endif /* _INCLUDED_CPP_LIMITS_H_ */
diff --git a/libstdc++-v3/shadow/locale.h b/libstdc++-v3/shadow/locale.h
new file mode 100644
index 000000000000..4128db8ba2da
--- /dev/null
+++ b/libstdc++-v3/shadow/locale.h
@@ -0,0 +1,45 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+
+#ifndef _INCLUDED_CPP_LOCALE_H_
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <clocale>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+
+# ifndef _IN_C_SWAMP_
+ using ::std::lconv;
+ using ::std::setlocale;
+ using ::std::localeconv;
+# define _INCLUDED_CPP_LOCALE_H_ 1
+# endif
+
+#endif /* _INCLUDED_CPP_LOCALE_H_ */
diff --git a/libstdc++-v3/shadow/math.h b/libstdc++-v3/shadow/math.h
new file mode 100644
index 000000000000..dbaf7ecc1fa3
--- /dev/null
+++ b/libstdc++-v3/shadow/math.h
@@ -0,0 +1,63 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#ifndef _INCLUDED_CPP_MATH_H_
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <cmath>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+
+# ifndef _IN_C_SWAMP_
+ using ::std::acos;
+ using ::std::asin;
+ using ::std::atan;
+ using ::std::atan2;
+ using ::std::cos;
+ using ::std::sin;
+ using ::std::tan;
+ using ::std::cosh;
+ using ::std::sinh;
+ using ::std::tanh;
+ using ::std::exp;
+ using ::std::frexp;
+ using ::std::ldexp;
+ using ::std::log;
+ using ::std::log10;
+ using ::std::modf;
+ using ::std::pow;
+ using ::std::sqrt;
+ using ::std::ceil;
+ using ::std::fabs;
+ using ::std::floor;
+ using ::std::fmod;
+# define _INCLUDED_CPP_MATH_H_ 1
+# endif
+
+#endif /* _INCLUDED_CPP_MATH_H_ */
diff --git a/libstdc++-v3/shadow/setjmp.h b/libstdc++-v3/shadow/setjmp.h
new file mode 100644
index 000000000000..309bd4b01916
--- /dev/null
+++ b/libstdc++-v3/shadow/setjmp.h
@@ -0,0 +1,44 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+
+#ifndef _INCLUDED_CPP_SETJMP_H_
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <csetjmp>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+
+# ifndef _IN_C_SWAMP_
+ using ::std::jmp_buf;
+ using ::std::longjmp;
+# define _INCLUDED_CPP_SETJMP_H_ 1
+# endif
+
+#endif /* _INCLUDED_CPP_SETJMP_H_ */
diff --git a/libstdc++-v3/shadow/signal.h b/libstdc++-v3/shadow/signal.h
new file mode 100644
index 000000000000..bd51357347ea
--- /dev/null
+++ b/libstdc++-v3/shadow/signal.h
@@ -0,0 +1,45 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+
+#ifndef _INCLUDED_CPP_SIGNAL_H_
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <csignal>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+
+# ifndef _IN_C_SWAMP_
+ using ::std::sig_atomic_t;
+ using ::std::raise;
+ using ::std::signal;
+# define _INCLUDED_CPP_SIGNAL_H_ 1
+# endif
+
+#endif /* _INCLUDED_CPP_SIGNAL_H_ */
diff --git a/libstdc++-v3/shadow/stdarg.h b/libstdc++-v3/shadow/stdarg.h
new file mode 100644
index 000000000000..e6265add1776
--- /dev/null
+++ b/libstdc++-v3/shadow/stdarg.h
@@ -0,0 +1,42 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#ifndef _INCLUDED_CPP_STDARG_H_
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <cstdarg>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+
+# ifndef _IN_C_SWAMP_
+ using ::std::va_list;
+# define _INCLUDED_CPP_STDARG_H_ 1
+# endif
+
+#endif /* _INCLUDED_CPP_STDARG_H_ */
diff --git a/libstdc++-v3/shadow/stddef.h b/libstdc++-v3/shadow/stddef.h
new file mode 100644
index 000000000000..5aa4aa6fe17a
--- /dev/null
+++ b/libstdc++-v3/shadow/stddef.h
@@ -0,0 +1,51 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#ifndef _INCLUDED_CPP_STDDEF_H_
+
+// turn off glibc weirdness. other libs have similar foolishness.
+#undef __need_wchar_t
+#undef __need_size_t
+#undef __need_ptrdiff_t
+#undef __need_NULL
+#undef __need_wint_t
+
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <cstddef>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+
+# ifndef _IN_C_SWAMP_
+ using ::std::ptrdiff_t;
+ using ::std::size_t;
+# define _INCLUDED_CPP_STDDEF_H_ 1
+# endif
+
+#endif /* _INCLUDED_CPP_STDDEF_H_ */
diff --git a/libstdc++-v3/shadow/stdio.h b/libstdc++-v3/shadow/stdio.h
new file mode 100644
index 000000000000..9508cac1a964
--- /dev/null
+++ b/libstdc++-v3/shadow/stdio.h
@@ -0,0 +1,84 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#ifndef _INCLUDED_CPP_STDIO_H_
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <cstdio>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+
+# ifndef _IN_C_SWAMP_
+ using ::std::size_t;
+ using ::std::fpos_t;
+ using ::std::remove;
+ using ::std::rename;
+ using ::std::tmpfile;
+ using ::std::tmpnam;
+ using ::std::fclose;
+ using ::std::fflush;
+ using ::std::fopen;
+ using ::std::freopen;
+ using ::std::setbuf;
+ using ::std::setvbuf;
+ using ::std::fprintf;
+ using ::std::fscanf;
+ using ::std::printf;
+ using ::std::scanf;
+ using ::std::sprintf;
+ using ::std::sscanf;
+ using ::std::vfprintf;
+ using ::std::vprintf;
+ using ::std::vsprintf;
+ using ::std::fgetc;
+ using ::std::fgets;
+ using ::std::fputc;
+ using ::std::fputs;
+ using ::std::getc;
+ using ::std::getchar;
+ using ::std::gets;
+ using ::std::putc;
+ using ::std::putchar;
+ using ::std::puts;
+ using ::std::ungetc;
+ using ::std::fread;
+ using ::std::fwrite;
+ using ::std::fgetpos;
+ using ::std::fseek;
+ using ::std::fsetpos;
+ using ::std::ftell;
+ using ::std::rewind;
+ using ::std::clearerr;
+ using ::std::feof;
+ using ::std::ferror;
+ using ::std::perror;
+# define _INCLUDED_CPP_STDIO_H_ 1
+# endif
+
+#endif /* _INCLUDED_CPP_STDIO_H_ */
diff --git a/libstdc++-v3/shadow/stdlib.h b/libstdc++-v3/shadow/stdlib.h
new file mode 100644
index 000000000000..9b191a48a03f
--- /dev/null
+++ b/libstdc++-v3/shadow/stdlib.h
@@ -0,0 +1,72 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#ifndef _INCLUDED_CPP_STDLIB_H_
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <cstdlib>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+
+# ifndef _IN_C_SWAMP_
+ using ::std::size_t;
+ using ::std::div_t;
+ using ::std::ldiv_t;
+ using ::std::atof;
+ using ::std::atoi;
+ using ::std::atol;
+ using ::std::strtod;
+ using ::std::strtol;
+ using ::std::strtoul;
+ using ::std::rand;
+ using ::std::srand;
+ using ::std::calloc;
+ using ::std::free;
+ using ::std::malloc;
+ using ::std::realloc;
+ using ::std::abort;
+ using ::std::atexit;
+ using ::std::exit;
+ using ::std::getenv;
+ using ::std::system;
+ using ::std::bsearch;
+ using ::std::qsort;
+ using ::std::abs;
+ using ::std::div;
+ using ::std::labs;
+ using ::std::ldiv;
+ using ::std::mblen;
+ using ::std::mbtowc;
+ using ::std::wctomb;
+ using ::std::mbstowcs;
+ using ::std::wcstombs;
+# define _INCLUDED_CPP_STDLIB_H_ 1
+# endif
+
+#endif /* _INCLUDED_CPP_STDLIB_H_ */
diff --git a/libstdc++-v3/shadow/string.h b/libstdc++-v3/shadow/string.h
new file mode 100644
index 000000000000..66d8490f8886
--- /dev/null
+++ b/libstdc++-v3/shadow/string.h
@@ -0,0 +1,63 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#ifndef _INCLUDED_CPP_STRING_H_
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <cstring>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+
+# ifndef _IN_C_SWAMP_
+ using ::std::memcpy;
+ using ::std::memmove;
+ using ::std::strcpy;
+ using ::std::strncpy;
+ using ::std::strcat;
+ using ::std::strncat;
+ using ::std::memcmp;
+ using ::std::strcmp;
+ using ::std::strcoll;
+ using ::std::strncmp;
+ using ::std::strxfrm;
+ using ::std::memchr;
+ using ::std::strchr;
+ using ::std::strcspn;
+ using ::std::strpbrk;
+ using ::std::strrchr;
+ using ::std::strspn;
+ using ::std::strstr;
+ using ::std::strtok;
+ using ::std::memset;
+ using ::std::strerror;
+ using ::std::strlen;
+# define _INCLUDED_CPP_STRING_H_ 1
+# endif
+
+#endif /* _INCLUDED_CPP_STRING_H_ */
diff --git a/libstdc++-v3/shadow/time.h b/libstdc++-v3/shadow/time.h
new file mode 100644
index 000000000000..bfd537cb206b
--- /dev/null
+++ b/libstdc++-v3/shadow/time.h
@@ -0,0 +1,60 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#ifndef _INCLUDED_CPP_TIME_H_
+
+// turn off glibc-2.0 weirdness. Other systems define similar foolishness
+#undef __need_time_t
+#undef __need_clock_t
+#undef __need_timespec))
+
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <ctime>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+
+# ifndef _IN_C_SWAMP_
+ using ::std::size_t; /* handled in <cstddef> */
+ using ::std::clock_t;
+ using ::std::time_t;
+ using ::std::tm;
+ using ::std::clock;
+ using ::std::difftime;
+ using ::std::mktime;
+ using ::std::time;
+ using ::std::asctime;
+ using ::std::ctime;
+ using ::std::gmtime;
+ using ::std::localtime;
+ using ::std::strftime;
+# define _INCLUDED_CPP_TIME_H_ 1
+# endif
+
+#endif /* _INCLUDED_CPP_TIME_H_ */
diff --git a/libstdc++-v3/shadow/unistd.h b/libstdc++-v3/shadow/unistd.h
new file mode 100644
index 000000000000..a598eca3f091
--- /dev/null
+++ b/libstdc++-v3/shadow/unistd.h
@@ -0,0 +1,44 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#ifndef _INCLUDED_CPP_UNISTD_H_
+
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <bits/wrap_unistd.h>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+
+# ifndef _IN_C_SWAMP_
+ // using ::std::stuff
+
+# define _INCLUDED_CPP_UNISTD_H_ 1
+# endif
+
+#endif /* _INCLUDED_CPP_UNISTD_H_ */
diff --git a/libstdc++-v3/shadow/wchar.h b/libstdc++-v3/shadow/wchar.h
new file mode 100644
index 000000000000..ac136583367f
--- /dev/null
+++ b/libstdc++-v3/shadow/wchar.h
@@ -0,0 +1,109 @@
+// -*- C++ -*- header wrapper.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#ifndef _INCLUDED_CPP_WCHAR_H_
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <cwchar>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+
+# ifndef _IN_C_SWAMP_
+ using ::std::size_t; /* handled in <cstddef> */
+ using ::std::wint_t;
+ using ::std::mbstate_t;
+
+# if 0 /* glibc-2.0 doesn't define these */
+ using ::std::fgetwc;
+ using ::std::fgetws;
+ using ::std::fputwc;
+ using ::std::fputws;
+ using ::std::ungetwc;
+ using ::std::getwc;
+ using ::std::getwchar;
+ using ::std::putwc;
+ using ::std::putwchar;
+ using ::std::wprintf;
+ using ::std::wsprintf;
+ using ::std::wvsprintf;
+ using ::std::wfsprintf;
+ using ::std::wscanf;
+ using ::std::wsscanf;
+ using ::std::wvsscanf;
+ using ::std::wfscanf;
+ // XXX etc.
+ using ::std::wcsftime;
+# endif
+
+ using ::std::wcscpy;
+ using ::std::wcscat;
+ using ::std::wcscmp;
+ using ::std::wcscoll;
+ using ::std::wcsxfrm;
+ using ::std::wcsdup;
+ using ::std::wcschr;
+ using ::std::wcscspn;
+ using ::std::wcspbrk;
+ using ::std::wcsstr;
+ using ::std::wcstok;
+ using ::std::wcslen;
+# ifndef __sun
+ using ::std::wmemchr;
+ using ::std::wmemcmp;
+ using ::std::wmemcpy;
+ using ::std::wmemmove;
+ using ::std::wmemset;
+ using ::std::btowc;
+ using ::std::wctob;
+ using ::std::mbsinit;
+ using ::std::mbrtowc;
+ using ::std::wcrtomb;
+ using ::std::mbrlen;
+# endif
+# ifdef __USE_GNU
+ using ::std::mbsrtowcs;
+ using ::std::wcsrtombs;
+ using ::std::mbsnrtowcs;
+ using ::std::mbsnrtombs;
+ using ::std::wcwidth;
+ using ::std::wcswidth;
+ using ::std::wcscmpy;
+# endif
+ using ::std::wcstod;
+ using ::std::wcstol;
+ using ::std::wcstoul;
+ using ::std::wcsncat;
+ using ::std::wcsncmp;
+ using ::std::wcsncpy;
+ using ::std::wcsrchr;
+ using ::std::wcsspn;
+# define _INCLUDED_CPP_WCHAR_H_ 1
+# endif /* _IN_C_SWAMP_ */
+
+#endif /* _INCLUDED_CPP_WCHAR_H_ */
diff --git a/libstdc++-v3/shadow/wctype.h b/libstdc++-v3/shadow/wctype.h
new file mode 100644
index 000000000000..85ce63dfb89d
--- /dev/null
+++ b/libstdc++-v3/shadow/wctype.h
@@ -0,0 +1,59 @@
+// -*- C++ -*- header wrapper.
+
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _INCLUDED_CPP_CWCTYPE_H_
+# undef _SHADOW_NAME
+# define _SHADOW_NAME <cwctype>
+# include <bits/generic_shadow.h>
+# undef _SHADOW_NAME
+
+# ifndef _IN_C_SWAMP_
+ using ::std::size_t;
+ using ::std::wint_t;
+ using ::std::wctype_t;
+ using ::std::wctrans_t;
+ using ::std::iswalpha;
+ using ::std::iswupper;
+ using ::std::iswlower;
+ using ::std::iswdigit;
+ using ::std::iswxdigit;
+ using ::std::iswalnum;
+ using ::std::iswspace;
+ using ::std::iswpunct;
+ using ::std::iswprint;
+ using ::std::iswgraph;
+ using ::std::iswcntrl;
+ using ::std::iswctype;
+ using ::std::towlower;
+ using ::std::towupper;
+# define _INCLUDED_CPP_CWCTYPE_H_ 1
+# endif
+
+#endif /* _INCLUDED_CPP_CWCTYPE_H_ */
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
new file mode 100644
index 000000000000..770c482acb12
--- /dev/null
+++ b/libstdc++-v3/src/Makefile.am
@@ -0,0 +1,515 @@
+## Makefile for the src subdirectory of the GNU C++ Standard library.
+##
+## Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+##
+## This file is part of the libstdc++ version 3 distribution.
+## Process this file with automake to produce Makefile.in.
+
+## This file is part of the GNU ISO C++ Library. This library is free
+## software; you can redistribute it and/or modify it under the
+## terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option)
+## any later version.
+
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License along
+## with this library; see the file COPYING. If not, write to the Free
+## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+## USA.
+
+AUTOMAKE_OPTIONS = 1.3 gnits
+MAINT_CHARSET = latin1
+
+# Cross compiler and multilib support.
+# Install a library built with a cross compiler in tooldir, not libdir.
+if USE_LIBDIR
+toolexeclibdir = $(libdir)$(MULTISUBDIR)
+else
+toolexecdir = $(exec_prefix)/$(target_alias)
+toolexeclibdir = $(toolexecdir)/lib$(MULTISUBDIR)
+endif
+
+toolexeclib_LTLIBRARIES = libstdc++.la
+
+
+WERROR = -Werror
+# OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fsquangle -fnew-exceptions \
+# -fdata-sections -ffunction-sections \
+# -fvtable-gc -Wl,--gc-sections
+# AC_CXXFLAGS = @OPTLEVEL@ @DEBUGFLAGS@ @NAMESPACES@
+AC_CXXFLAGS = @DEBUGFLAGS@
+AM_CXXFLAGS = -fno-implicit-templates \
+ -Wall -Wno-format -W -Wwrite-strings -Winline $(WERROR) \
+ $(OPTIMIZE_CXXFLAGS) $(AC_CXXFLAGS)
+
+# Need to explicitly set this so that AM_CXXFLAGS is last. (That way,
+# things like -O2 passed down from the toplevel can be overridden by
+# --enable-debug.)
+CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
+
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
+
+# We have a problem when building the shared libstdc++ object if the
+# rules automake generates would be used. We cannot allow CXX to be used
+# in libtool since this would add -lstdc++ to the link line which of
+# course is impossible.
+CXXLINK = $(LIBTOOL) --mode=link "$(CC)" $(AM_CXXFLAGS) $(LDFLAGS) -o $@
+
+TOPLEVEL_INCLUDES = -I$(includedir)
+LIBIO_INCLUDES = @BUILD_LIBIO_INCLUDE@ -I$(top_srcdir)/libio
+
+CONFIG_INCLUDES = \
+ -I$(top_srcdir)/@cpu_include_dir@ \
+ -I$(top_srcdir)/@ctype_include_dir@
+
+INCLUDES = \
+ -nostdinc++ -I$(top_srcdir) \
+ $(LIBIO_INCLUDES) $(CONFIG_INCLUDES) $(TOPLEVEL_INCLUDES)
+
+headers = \
+ bits/cpp_type_traits.h \
+ bits/std_cctype.h bits/ctype_base.h bits/ctype_specializations.h \
+ bits/char_traits.h \
+ bits/basic_string.h bits/std_string.h bits/string.tcc \
+ bits/generic_shadow.h bits/std_utility.h \
+ bits/std_complex.h \
+ bits/valarray_array.h bits/valarray_array.tcc bits/valarray_meta.h \
+ bits/std_valarray.h bits/mask_array.h bits/slice.h bits/slice_array.h \
+ bits/gslice.h bits/gslice_array.h bits/indirect_array.h \
+ bits/std_cassert.h bits/std_cwctype.h bits/std_ciso646.h \
+ bits/std_cerrno.h bits/std_cfloat.h bits/std_climits.h \
+ bits/std_clocale.h bits/std_cmath.h \
+ bits/std_csetjmp.h bits/std_csignal.h bits/std_cstdarg.h \
+ bits/std_cstddef.h bits/std_cstdio.h bits/std_cstdlib.h \
+ bits/std_cstring.h bits/std_ctime.h bits/std_cwchar.h \
+ bits/std_typeinfo.h bits/std_new.h \
+ bits/std_exception.h bits/exception_support.h \
+ bits/std_fstream.h bits/std_iomanip.h \
+ bits/ios_base.h bits/fpos.h bits/basic_ios.h bits/basic_ios.tcc \
+ bits/std_ios.h bits/std_iosfwd.h bits/std_iostream.h \
+ bits/std_istream.h bits/istream.tcc bits/std_locale.h \
+ bits/fstream.tcc bits/ostream.tcc bits/sbuf_iter.h bits/sstream.tcc \
+ bits/std_ostream.h bits/std_sstream.h bits/std_streambuf.h \
+ bits/streambuf.tcc bits/basic_file.h \
+ bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h \
+ bits/stl_pthread_alloc.h bits/pthread_allocimpl.h \
+ bits/stl_threads.h bits/stl_iterator_base.h \
+ backward/algo.h backward/algobase.h backward/alloc.h \
+ backward/bvector.h backward/defalloc.h backward/deque.h \
+ backward/function.h backward/hash_map.h backward/hash_set.h \
+ backward/hashtable.h backward/heap.h backward/iterator.h \
+ backward/list.h backward/map.h backward/multimap.h \
+ backward/multiset.h backward/pair.h \
+ backward/rope.h backward/set.h backward/slist.h backward/stack.h \
+ backward/tempbuf.h backward/tree.h backward/vector.h \
+ bits/std_bitset.h bits/std_deque.h bits/std_functional.h \
+ bits/std_iterator.h bits/std_list.h \
+ bits/std_map.h bits/std_memory.h bits/std_numeric.h \
+ bits/std_queue.h bits/std_set.h bits/std_stack.h \
+ bits/std_stdexcept.h bits/std_vector.h \
+ bits/stl_algo.h bits/stl_algobase.h bits/stl_alloc.h \
+ bits/stl_deque.h bits/stl_function.h \
+ bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h \
+ bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h \
+ bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h \
+ bits/stl_relops.h bits/stl_set.h \
+ bits/stl_stack.h bits/stl_string_fwd.h bits/stl_tempbuf.h \
+ bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h \
+ bits/type_traits.h bits/stl_range_errors.h bits/std_algorithm.h \
+ bits/std_strstream.h \
+ ext/ropeimpl.h ext/stl_rope.h \
+ ext/stl_bvector.h bits/stl_config.h bits/stl_construct.h \
+ ext/stl_hashtable.h ext/stl_hash_fun.h \
+ ext/hash_map ext/hash_set ext/rope ext/slist \
+ ext/tree ext/bvector \
+ shadow/assert.h shadow/ctype.h shadow/errno.h shadow/float.h \
+ shadow/libio.h \
+ shadow/limits.h shadow/locale.h shadow/math.h shadow/setjmp.h \
+ shadow/signal.h shadow/stdarg.h shadow/stddef.h shadow/stdio.h \
+ shadow/stdlib.h shadow/string.h shadow/time.h \
+ shadow/unistd.h shadow/wchar.h shadow/wctype.h \
+ shadow/bits/std_cassert.h shadow/bits/std_cctype.h \
+ shadow/bits/std_cerrno.h shadow/bits/std_cfloat.h \
+ shadow/bits/std_climits.h shadow/bits/std_clocale.h \
+ shadow/bits/std_cmath.h shadow/bits/std_csetjmp.h \
+ shadow/bits/std_csignal.h shadow/bits/std_cstdarg.h \
+ shadow/bits/std_cstddef.h shadow/bits/std_cstdio.h \
+ shadow/bits/std_cstdlib.h shadow/bits/std_cstring.h \
+ shadow/bits/std_ctime.h shadow/bits/std_cwchar.h \
+ shadow/bits/std_cwctype.h \
+ shadow/bits/wrap_libio.h shadow/bits/wrap_unistd.h \
+ shadow/sys/cdefs.h
+
+std_headers = \
+ algorithm bitset cassert cctype cerrno cfloat climits clocale ciso646 \
+ cmath complex csetjmp csignal cstdarg cstddef cstdio cstdlib \
+ cstring ctime cwchar cwctype deque exception fstream functional \
+ iomanip ios iosfwd iostream istream iterator limits list locale \
+ map memory new numeric ostream queue set sstream stack stdexcept \
+ streambuf string strstream typeinfo utility valarray vector
+
+if GLIBCPP_NEED_LIBIO
+libio_headers = \
+ $(top_builddir)/libio/_G_config.h $(top_srcdir)/libio/libio.h
+else
+libio_headers =
+endif
+
+generated_headers = \
+ bits/std_limits.h bits/c++config.h bits/c++threads.h bits/c++io.h
+
+cpu_headers = \
+ $(top_srcdir)/@cpu_include_dir@/atomicity.h
+
+string_sources = \
+ stringMAIN.cc stringCTORNC.cc stringCTORAL.cc \
+ stringCTORCPR.cc stringCTORCPRAL.cc stringCTORPRAL.cc \
+ stringCTORPAL.cc stringCTORDUPAL.cc stringCTORPP.cc stringCTORII.cc \
+ stringMUTATE.cc stringRESERVE.cc \
+ stringSWAP.cc stringSLOP.cc \
+ stringRESIZE.cc stringAPPCOPY.cc stringAPPCPR.cc stringAPPPR.cc \
+ stringAPPDUP.cc stringAPPII.cc stringASSCP.cc stringASSII.cc \
+ stringINSII.cc stringREPRR.cc stringREPIIDUP.cc stringREPII.cc \
+ stringREPIII.cc stringREP4I.cc stringREPIIPP.cc stringREPIIPP2.cc \
+ stringCOPY.cc stringCONII.cc stringCONIIF.cc stringCONPPF.cc \
+ stringCONPPF2.cc stringCONSC.cc \
+ stringFIND.cc stringFINDC.cc stringRFIND.cc \
+ stringRFINDC.cc stringFFO.cc stringFLO.cc stringFFNO.cc \
+ stringFLNO.cc stringFLNOC.cc stringCOMPARE.cc stringCOMPARE2.cc \
+ stringCOMPAREP.cc stringCOMPAREP2.cc stringADDPS.cc stringADDCS.cc \
+ stringEXTRACT.cc stringINSERT.cc stringGETLINE.cc stringSCOPY.cc \
+ stringEQ.cc
+
+wstring_sources = \
+ wstringMAIN.cc wstringCTORNC.cc wstringCTORAL.cc \
+ wstringCTORCPR.cc wstringCTORCPRAL.cc wstringCTORPRAL.cc \
+ wstringCTORPAL.cc wstringCTORDUPAL.cc wstringCTORPP.cc \
+ wstringCTORII.cc \
+ wstringMUTATE.cc wstringRESERVE.cc \
+ wstringSWAP.cc wstringSLOP.cc \
+ wstringRESIZE.cc wstringAPPCOPY.cc wstringAPPCPR.cc wstringAPPPR.cc \
+ wstringAPPDUP.cc wstringAPPII.cc wstringASSCP.cc wstringASSII.cc \
+ wstringINSII.cc wstringREPRR.cc wstringREPIIDUP.cc wstringREPII.cc \
+ wstringREPIII.cc wstringREP4I.cc wstringREPIIPP.cc wstringREPIIPP2.cc \
+ wstringCOPY.cc wstringCONII.cc wstringCONIIF.cc wstringCONPPF.cc \
+ wstringCONPPF2.cc wstringCONSC.cc \
+ wstringFIND.cc wstringFINDC.cc wstringRFIND.cc \
+ wstringRFINDC.cc wstringFFO.cc wstringFLO.cc wstringFFNO.cc \
+ wstringFLNO.cc wstringFLNOC.cc wstringCOMPARE.cc wstringCOMPARE2.cc \
+ wstringCOMPAREP.cc wstringCOMPAREP2.cc wstringADDPS.cc \
+ wstringADDCS.cc wstringEXTRACT.cc wstringINSERT.cc wstringGETLINE.cc \
+ wstringSCOPY.cc wstringEQ.cc
+
+sources = \
+ limitsMEMBERS.cc c++io.cc \
+ cmath.cc \
+ complex.cc complexf.cc complexl.cc complex_io.cc \
+ stdexcept.cc ios.cc stdstreams.cc strstream.cc \
+ locale.cc localename.cc \
+ locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc \
+ $(string_sources) $(wstring_sources)
+
+VPATH += $(top_srcdir) $(top_srcdir)/std $(top_srcdir)/src
+VPATH += $(top_srcdir)/@ctype_include_dir@
+
+
+# Actual sources for the distro, but don't build these.
+EXTRA_sources = string-inst.cc
+
+libstdc___la_SOURCES = $(sources)
+
+libstdc___la_LIBADD = ../math/libmath.la ../libio/libio.la
+
+libstdc___la_LDFLAGS = -version-info 3:0:0 -lm
+
+
+# We cannot use the default rules to install headers since we cannot
+# statically decide which headers to install. So we have our own special
+# installation routine here.
+myincludep = $(DESTDIR)$(includedir)/g++-v3/
+
+install: myinstallheaders
+
+# NB: As libio_headers may be empty, need this to make sure bash doesn't
+# choke on an empty for... loop by using libio_headers_install
+
+myinstallheaders: $(headers:%=$(myincludep)%)
+ if test -z "$(MULTISUBDIR)"; then \
+ for i in $(std_headers); do \
+ echo "$(INSTALL_DATA) $(top_srcdir)/std/$$i $(myincludep)"; \
+ $(INSTALL_DATA) $(top_srcdir)/std/$$i $(myincludep); \
+ done; \
+ for i in $(generated_headers); do \
+ echo "$(INSTALL_DATA) $(top_builddir)/$$i $(myincludep)bits/"; \
+ $(INSTALL_DATA) $(top_builddir)/$$i $(myincludep)bits/; \
+ done; \
+ libio_headers_install='$(libio_headers)'; \
+ for i in $$libio_headers_install; do \
+ echo "$(INSTALL_DATA) $$i $(myincludep)"; \
+ $(INSTALL_DATA) $$i $(myincludep); \
+ done; \
+ echo "$(INSTALL_DATA) $(cpu_headers) $(myincludep)"; \
+ $(INSTALL_DATA) $(cpu_headers) $(myincludep); \
+ fi;
+
+$(headers:%=$(myincludep)%): $(myincludep)%: %
+ if test -z "$(MULTISUBDIR)"; then \
+ $(mkinstalldirs) $(@D); \
+ echo " $(INSTALL_DATA) $^ $@"; \
+ $(INSTALL_DATA) $^ $@; \
+ fi;
+
+# For the next time we have to handle misc-inst.cc and locale-inst.cc
+# in a special way since we cannot instantiate all classes due to
+# missing definitions for things like vptrs, type_info bits, etc. when
+# using -fno-implicit-templates.
+misc-inst.o: misc-inst.cc
+ $(CXXCOMPILE) -fimplicit-templates -c $<
+misc-inst.lo: misc-inst.cc
+ $(LTCXXCOMPILE) -fimplicit-templates -c $<
+locale-inst.o: locale-inst.cc
+ $(CXXCOMPILE) -fimplicit-templates -c $<
+locale-inst.lo: locale-inst.cc
+ $(LTCXXCOMPILE) -fimplicit-templates -c $<
+
+stringMAIN.lo \
+stringCTORNC.lo \
+stringCTORAL.lo \
+stringCTORCPR.lo \
+stringCTORCPRAL.lo \
+stringCTORPRAL.lo \
+stringCTORPAL.lo \
+stringCTORDUPAL.lo \
+stringCTORPP.lo \
+stringCTORII.lo \
+stringMUTATE.lo \
+stringRESERVE.lo \
+stringSWAP.lo \
+stringSLOP.lo \
+stringRESIZE.lo \
+stringAPPCOPY.lo \
+stringAPPCPR.lo \
+stringAPPPR.lo \
+stringAPPDUP.lo \
+stringAPPII.lo \
+stringASSCP.lo \
+stringASSII.lo \
+stringINSII.lo \
+stringREPRR.lo \
+stringREPIIDUP.lo \
+stringREPII.lo \
+stringREPIII.lo \
+stringREP4I.lo \
+stringREPIIPP.lo \
+stringREPIIPP2.lo \
+stringCOPY.lo \
+stringCONII.lo \
+stringCONIIF.lo \
+stringCONPPF.lo \
+stringCONPPF2.lo \
+stringCONSC.lo \
+stringFIND.lo \
+stringFINDC.lo \
+stringRFIND.lo \
+stringRFINDC.lo \
+stringFFO.lo \
+stringFLO.lo \
+stringFFNO.lo \
+stringFLNO.lo \
+stringFLNOC.lo \
+stringCOMPARE.lo \
+stringCOMPARE2.lo \
+stringCOMPAREP.lo \
+stringCOMPAREP2.lo \
+stringADDPS.lo \
+stringADDCS.lo \
+stringEXTRACT.lo \
+stringINSERT.lo \
+stringGETLINE.lo \
+stringSCOPY.lo \
+stringEQ.lo : string-inst.cc
+ $(LTCXXCOMPILE) -fimplicit-templates \
+ -c -D`echo $@ | tr -dc 'A-Z'` $< -o $@
+
+wstringMAIN.lo \
+wstringCTORNC.lo \
+wstringCTORAL.lo \
+wstringCTORCPR.lo \
+wstringCTORCPRAL.lo \
+wstringCTORPRAL.lo \
+wstringCTORPAL.lo \
+wstringCTORDUPAL.lo \
+wstringCTORPP.lo \
+wstringCTORII.lo \
+wstringMUTATE.lo \
+wstringRESERVE.lo \
+wstringSWAP.lo \
+wstringSLOP.lo \
+wstringRESIZE.lo \
+wstringAPPCOPY.lo \
+wstringAPPCPR.lo \
+wstringAPPPR.lo \
+wstringAPPDUP.lo \
+wstringAPPII.lo \
+wstringASSCP.lo \
+wstringASSII.lo \
+wstringINSII.lo \
+wstringREPRR.lo \
+wstringREPIIDUP.lo \
+wstringREPII.lo \
+wstringREPIII.lo \
+wstringREP4I.lo \
+wstringREPIIPP.lo \
+wstringREPIIPP2.lo \
+wstringCOPY.lo \
+wstringCONII.lo \
+wstringCONIIF.lo \
+wstringCONPPF.lo \
+wstringCONPPF2.lo \
+wstringCONSC.lo \
+wstringFIND.lo \
+wstringFINDC.lo \
+wstringRFIND.lo \
+wstringRFINDC.lo \
+wstringFFO.lo \
+wstringFLO.lo \
+wstringFFNO.lo \
+wstringFLNO.lo \
+wstringFLNOC.lo \
+wstringCOMPARE.lo \
+wstringCOMPARE2.lo \
+wstringCOMPAREP.lo \
+wstringCOMPAREP2.lo \
+wstringADDPS.lo \
+wstringADDCS.lo \
+wstringEXTRACT.lo \
+wstringINSERT.lo \
+wstringGETLINE.lo \
+wstringSCOPY.lo \
+wstringEQ.lo : string-inst.cc
+ $(LTCXXCOMPILE) -fimplicit-templates \
+ -c -D`echo $@ | tr -dc 'A-Z'` -DC=wchar_t $< -o $@
+
+stringMAIN.o \
+stringCTORNC.o \
+stringCTORAL.o \
+stringCTORCPR.o \
+stringCTORCPRAL.o \
+stringCTORPRAL.o \
+stringCTORPAL.o \
+stringCTORDUPAL.o \
+stringCTORPP.o \
+stringCTORII.o \
+stringMUTATE.o \
+stringRESERVE.o \
+stringSWAP.o \
+stringSLOP.o \
+stringRESIZE.o \
+stringAPPCOPY.o \
+stringAPPCPR.o \
+stringAPPPR.o \
+stringAPPDUP.o \
+stringAPPII.o \
+stringASSCP.o \
+stringASSII.o \
+stringINSII.o \
+stringREPRR.o \
+stringREPIIDUP.o \
+stringREPII.o \
+stringREPIII.o \
+stringREP4I.o \
+stringREPIIPP.o \
+stringREPIIPP2.o \
+stringCOPY.o \
+stringCONII.o \
+stringCONIIF.o \
+stringCONPPF.o \
+stringCONPPF2.o \
+stringCONSC.o \
+stringFIND.o \
+stringFINDC.o \
+stringRFIND.o \
+stringRFINDC.o \
+stringFFO.o \
+stringFLO.o \
+stringFFNO.o \
+stringFLNO.o \
+stringFLNOC.o \
+stringCOMPARE.o \
+stringCOMPARE2.o \
+stringCOMPAREP.o \
+stringCOMPAREP2.o \
+stringADDPS.o \
+stringADDCS.o \
+stringEXTRACT.o \
+stringINSERT.o \
+stringGETLINE.o \
+stringSCOPY.o \
+stringEQ.o : string-inst.cc
+ $(CXXCOMPILE) -fimplicit-templates \
+ -c -D`echo $@ | tr -dc 'A-Z'` $< -o $@
+
+wstringMAIN.o \
+wstringCTORNC.o \
+wstringCTORAL.o \
+wstringCTORCPR.o \
+wstringCTORCPRAL.o \
+wstringCTORPRAL.o \
+wstringCTORPAL.o \
+wstringCTORDUPAL.o \
+wstringCTORPP.o \
+wstringCTORII.o \
+wstringMUTATE.o \
+wstringRESERVE.o \
+wstringSWAP.o \
+wstringSLOP.o \
+wstringRESIZE.o \
+wstringAPPCOPY.o \
+wstringAPPCPR.o \
+wstringAPPPR.o \
+wstringAPPDUP.o \
+wstringAPPII.o \
+wstringASSCP.o \
+wstringASSII.o \
+wstringINSII.o \
+wstringREPRR.o \
+wstringREPIIDUP.o \
+wstringREPII.o \
+wstringREPIII.o \
+wstringREP4I.o \
+wstringREPIIPP.o \
+wstringREPIIPP2.o \
+wstringCOPY.o \
+wstringCONII.o \
+wstringCONIIF.o \
+wstringCONPPF.o \
+wstringCONPPF2.o \
+wstringCONSC.o \
+wstringFIND.o \
+wstringFINDC.o \
+wstringRFIND.o \
+wstringRFINDC.o \
+wstringFFO.o \
+wstringFLO.o \
+wstringFFNO.o \
+wstringFLNO.o \
+wstringFLNOC.o \
+wstringCOMPARE.o \
+wstringCOMPARE2.o \
+wstringCOMPAREP.o \
+wstringCOMPAREP2.o \
+wstringADDPS.o \
+wstringADDCS.o \
+wstringEXTRACT.o \
+wstringINSERT.o \
+wstringGETLINE.o \
+wstringSCOPY.o \
+wstringEQ.o : string-inst.cc
+ $(CXXCOMPILE) -fimplicit-templates \
+ -c -D`echo $@ | tr -dc 'A-Z'` -DC=wchar_t $< -o $@
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
new file mode 100644
index 000000000000..2536173ee4fa
--- /dev/null
+++ b/libstdc++-v3/src/Makefile.in
@@ -0,0 +1,858 @@
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
+host_alias = @host_alias@
+host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
+AR = @AR@
+AS = @AS@
+BUILD_LIBIO_INCLUDE = @BUILD_LIBIO_INCLUDE@
+CC = @CC@
+CPP = @CPP@
+CSTDIO_CC = @CSTDIO_CC@
+CSTDIO_H = @CSTDIO_H@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+DEBUGFLAGS = @DEBUGFLAGS@
+DLLTOOL = @DLLTOOL@
+EXEEXT = @EXEEXT@
+GCC_OBJDIR = @GCC_OBJDIR@
+GLIBCPP_CFLAGS = @GLIBCPP_CFLAGS@
+GLIBCPP_CXXFLAGS = @GLIBCPP_CXXFLAGS@
+LIBMATHOBJS = @LIBMATHOBJS@
+LIBSTRINGOBJS = @LIBSTRINGOBJS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+NAMESPACES = @NAMESPACES@
+OBJDUMP = @OBJDUMP@
+OPTLEVEL = @OPTLEVEL@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+THREADDEPS = @THREADDEPS@
+THREADINCS = @THREADINCS@
+THREADLIBS = @THREADLIBS@
+THREADOBJS = @THREADOBJS@
+THREADSPEC = @THREADSPEC@
+USE_LONG_DOUBLE = @USE_LONG_DOUBLE@
+VERSION = @VERSION@
+WERRORSUPPRESS = @WERRORSUPPRESS@
+cpu_include_dir = @cpu_include_dir@
+ctype_include_dir = @ctype_include_dir@
+glibcpp_basedir = @glibcpp_basedir@
+
+AUTOMAKE_OPTIONS = 1.3 gnits
+MAINT_CHARSET = latin1
+@USE_LIBDIR_TRUE@toolexeclibdir = \
+@USE_LIBDIR_TRUE@$(libdir)$(MULTISUBDIR)
+@USE_LIBDIR_FALSE@toolexeclibdir = \
+@USE_LIBDIR_FALSE@$(toolexecdir)/lib$(MULTISUBDIR)
+@USE_LIBDIR_FALSE@toolexecdir = \
+@USE_LIBDIR_FALSE@$(exec_prefix)/$(target_alias)
+
+toolexeclib_LTLIBRARIES = libstdc++.la
+
+WERROR = -Werror
+# OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fsquangle -fnew-exceptions \
+# -fdata-sections -ffunction-sections \
+# -fvtable-gc -Wl,--gc-sections
+# AC_CXXFLAGS = @OPTLEVEL@ @DEBUGFLAGS@ @NAMESPACES@
+AC_CXXFLAGS = @DEBUGFLAGS@
+AM_CXXFLAGS = -fno-implicit-templates \
+ -Wall -Wno-format -W -Wwrite-strings -Winline $(WERROR) \
+ $(OPTIMIZE_CXXFLAGS) $(AC_CXXFLAGS)
+
+
+# Need to explicitly set this so that AM_CXXFLAGS is last. (That way,
+# things like -O2 passed down from the toplevel can be overridden by
+# --enable-debug.)
+CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
+
+
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
+
+
+# We have a problem when building the shared libstdc++ object if the
+# rules automake generates would be used. We cannot allow CXX to be used
+# in libtool since this would add -lstdc++ to the link line which of
+# course is impossible.
+CXXLINK = $(LIBTOOL) --mode=link "$(CC)" $(AM_CXXFLAGS) $(LDFLAGS) -o $@
+
+TOPLEVEL_INCLUDES = -I$(includedir)
+LIBIO_INCLUDES = @BUILD_LIBIO_INCLUDE@ -I$(top_srcdir)/libio
+
+CONFIG_INCLUDES = \
+ -I$(top_srcdir)/@cpu_include_dir@ \
+ -I$(top_srcdir)/@ctype_include_dir@
+
+
+INCLUDES = \
+ -nostdinc++ -I$(top_srcdir) \
+ $(LIBIO_INCLUDES) $(CONFIG_INCLUDES) $(TOPLEVEL_INCLUDES)
+
+
+headers = \
+ bits/cpp_type_traits.h \
+ bits/std_cctype.h bits/ctype_base.h bits/ctype_specializations.h \
+ bits/char_traits.h \
+ bits/basic_string.h bits/std_string.h bits/string.tcc \
+ bits/generic_shadow.h bits/std_utility.h \
+ bits/std_complex.h \
+ bits/valarray_array.h bits/valarray_array.tcc bits/valarray_meta.h \
+ bits/std_valarray.h bits/mask_array.h bits/slice.h bits/slice_array.h \
+ bits/gslice.h bits/gslice_array.h bits/indirect_array.h \
+ bits/std_cassert.h bits/std_cwctype.h bits/std_ciso646.h \
+ bits/std_cerrno.h bits/std_cfloat.h bits/std_climits.h \
+ bits/std_clocale.h bits/std_cmath.h \
+ bits/std_csetjmp.h bits/std_csignal.h bits/std_cstdarg.h \
+ bits/std_cstddef.h bits/std_cstdio.h bits/std_cstdlib.h \
+ bits/std_cstring.h bits/std_ctime.h bits/std_cwchar.h \
+ bits/std_typeinfo.h bits/std_new.h \
+ bits/std_exception.h bits/exception_support.h \
+ bits/std_fstream.h bits/std_iomanip.h \
+ bits/ios_base.h bits/fpos.h bits/basic_ios.h bits/basic_ios.tcc \
+ bits/std_ios.h bits/std_iosfwd.h bits/std_iostream.h \
+ bits/std_istream.h bits/istream.tcc bits/std_locale.h \
+ bits/fstream.tcc bits/ostream.tcc bits/sbuf_iter.h bits/sstream.tcc \
+ bits/std_ostream.h bits/std_sstream.h bits/std_streambuf.h \
+ bits/streambuf.tcc bits/basic_file.h \
+ bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h \
+ bits/stl_pthread_alloc.h bits/pthread_allocimpl.h \
+ bits/stl_threads.h bits/stl_iterator_base.h \
+ backward/algo.h backward/algobase.h backward/alloc.h \
+ backward/bvector.h backward/defalloc.h backward/deque.h \
+ backward/function.h backward/hash_map.h backward/hash_set.h \
+ backward/hashtable.h backward/heap.h backward/iterator.h \
+ backward/list.h backward/map.h backward/multimap.h \
+ backward/multiset.h backward/pair.h \
+ backward/rope.h backward/set.h backward/slist.h backward/stack.h \
+ backward/tempbuf.h backward/tree.h backward/vector.h \
+ bits/std_bitset.h bits/std_deque.h bits/std_functional.h \
+ bits/std_iterator.h bits/std_list.h \
+ bits/std_map.h bits/std_memory.h bits/std_numeric.h \
+ bits/std_queue.h bits/std_set.h bits/std_stack.h \
+ bits/std_stdexcept.h bits/std_vector.h \
+ bits/stl_algo.h bits/stl_algobase.h bits/stl_alloc.h \
+ bits/stl_deque.h bits/stl_function.h \
+ bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h \
+ bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h \
+ bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h \
+ bits/stl_relops.h bits/stl_set.h \
+ bits/stl_stack.h bits/stl_string_fwd.h bits/stl_tempbuf.h \
+ bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h \
+ bits/type_traits.h bits/stl_range_errors.h bits/std_algorithm.h \
+ bits/std_strstream.h \
+ ext/ropeimpl.h ext/stl_rope.h \
+ ext/stl_bvector.h bits/stl_config.h bits/stl_construct.h \
+ ext/stl_hashtable.h ext/stl_hash_fun.h \
+ ext/hash_map ext/hash_set ext/rope ext/slist \
+ ext/tree ext/bvector \
+ shadow/assert.h shadow/ctype.h shadow/errno.h shadow/float.h \
+ shadow/libio.h \
+ shadow/limits.h shadow/locale.h shadow/math.h shadow/setjmp.h \
+ shadow/signal.h shadow/stdarg.h shadow/stddef.h shadow/stdio.h \
+ shadow/stdlib.h shadow/string.h shadow/time.h \
+ shadow/unistd.h shadow/wchar.h shadow/wctype.h \
+ shadow/bits/std_cassert.h shadow/bits/std_cctype.h \
+ shadow/bits/std_cerrno.h shadow/bits/std_cfloat.h \
+ shadow/bits/std_climits.h shadow/bits/std_clocale.h \
+ shadow/bits/std_cmath.h shadow/bits/std_csetjmp.h \
+ shadow/bits/std_csignal.h shadow/bits/std_cstdarg.h \
+ shadow/bits/std_cstddef.h shadow/bits/std_cstdio.h \
+ shadow/bits/std_cstdlib.h shadow/bits/std_cstring.h \
+ shadow/bits/std_ctime.h shadow/bits/std_cwchar.h \
+ shadow/bits/std_cwctype.h \
+ shadow/bits/wrap_libio.h shadow/bits/wrap_unistd.h \
+ shadow/sys/cdefs.h
+
+
+std_headers = \
+ algorithm bitset cassert cctype cerrno cfloat climits clocale ciso646 \
+ cmath complex csetjmp csignal cstdarg cstddef cstdio cstdlib \
+ cstring ctime cwchar cwctype deque exception fstream functional \
+ iomanip ios iosfwd iostream istream iterator limits list locale \
+ map memory new numeric ostream queue set sstream stack stdexcept \
+ streambuf string strstream typeinfo utility valarray vector
+
+@GLIBCPP_NEED_LIBIO_TRUE@libio_headers = \
+@GLIBCPP_NEED_LIBIO_TRUE@\
+@GLIBCPP_NEED_LIBIO_TRUE@ $(top_builddir)/libio/_G_config.h $(top_srcdir)/libio/libio.h
+@GLIBCPP_NEED_LIBIO_FALSE@libio_headers = \
+
+generated_headers = \
+ bits/std_limits.h bits/c++config.h bits/c++threads.h bits/c++io.h
+
+
+cpu_headers = \
+ $(top_srcdir)/@cpu_include_dir@/atomicity.h
+
+
+string_sources = \
+ stringMAIN.cc stringCTORNC.cc stringCTORAL.cc \
+ stringCTORCPR.cc stringCTORCPRAL.cc stringCTORPRAL.cc \
+ stringCTORPAL.cc stringCTORDUPAL.cc stringCTORPP.cc stringCTORII.cc \
+ stringMUTATE.cc stringRESERVE.cc \
+ stringSWAP.cc stringSLOP.cc \
+ stringRESIZE.cc stringAPPCOPY.cc stringAPPCPR.cc stringAPPPR.cc \
+ stringAPPDUP.cc stringAPPII.cc stringASSCP.cc stringASSII.cc \
+ stringINSII.cc stringREPRR.cc stringREPIIDUP.cc stringREPII.cc \
+ stringREPIII.cc stringREP4I.cc stringREPIIPP.cc stringREPIIPP2.cc \
+ stringCOPY.cc stringCONII.cc stringCONIIF.cc stringCONPPF.cc \
+ stringCONPPF2.cc stringCONSC.cc \
+ stringFIND.cc stringFINDC.cc stringRFIND.cc \
+ stringRFINDC.cc stringFFO.cc stringFLO.cc stringFFNO.cc \
+ stringFLNO.cc stringFLNOC.cc stringCOMPARE.cc stringCOMPARE2.cc \
+ stringCOMPAREP.cc stringCOMPAREP2.cc stringADDPS.cc stringADDCS.cc \
+ stringEXTRACT.cc stringINSERT.cc stringGETLINE.cc stringSCOPY.cc \
+ stringEQ.cc
+
+
+wstring_sources = \
+ wstringMAIN.cc wstringCTORNC.cc wstringCTORAL.cc \
+ wstringCTORCPR.cc wstringCTORCPRAL.cc wstringCTORPRAL.cc \
+ wstringCTORPAL.cc wstringCTORDUPAL.cc wstringCTORPP.cc \
+ wstringCTORII.cc \
+ wstringMUTATE.cc wstringRESERVE.cc \
+ wstringSWAP.cc wstringSLOP.cc \
+ wstringRESIZE.cc wstringAPPCOPY.cc wstringAPPCPR.cc wstringAPPPR.cc \
+ wstringAPPDUP.cc wstringAPPII.cc wstringASSCP.cc wstringASSII.cc \
+ wstringINSII.cc wstringREPRR.cc wstringREPIIDUP.cc wstringREPII.cc \
+ wstringREPIII.cc wstringREP4I.cc wstringREPIIPP.cc wstringREPIIPP2.cc \
+ wstringCOPY.cc wstringCONII.cc wstringCONIIF.cc wstringCONPPF.cc \
+ wstringCONPPF2.cc wstringCONSC.cc \
+ wstringFIND.cc wstringFINDC.cc wstringRFIND.cc \
+ wstringRFINDC.cc wstringFFO.cc wstringFLO.cc wstringFFNO.cc \
+ wstringFLNO.cc wstringFLNOC.cc wstringCOMPARE.cc wstringCOMPARE2.cc \
+ wstringCOMPAREP.cc wstringCOMPAREP2.cc wstringADDPS.cc \
+ wstringADDCS.cc wstringEXTRACT.cc wstringINSERT.cc wstringGETLINE.cc \
+ wstringSCOPY.cc wstringEQ.cc
+
+
+sources = \
+ limitsMEMBERS.cc c++io.cc \
+ cmath.cc \
+ complex.cc complexf.cc complexl.cc complex_io.cc \
+ stdexcept.cc ios.cc stdstreams.cc strstream.cc \
+ locale.cc localename.cc \
+ locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc \
+ $(string_sources) $(wstring_sources)
+
+VPATH = $(top_srcdir) $(top_srcdir)/std $(top_srcdir)/src $(top_srcdir)/@ctype_include_dir@
+
+# Actual sources for the distro, but don't build these.
+EXTRA_sources = string-inst.cc
+
+libstdc___la_SOURCES = $(sources)
+
+libstdc___la_LIBADD = ../math/libmath.la ../libio/libio.la
+
+libstdc___la_LDFLAGS = -version-info 3:0:0 -lm
+
+# We cannot use the default rules to install headers since we cannot
+# statically decide which headers to install. So we have our own special
+# installation routine here.
+myincludep = $(DESTDIR)$(includedir)/g++-v3/
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I..
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+libstdc___la_DEPENDENCIES = ../math/libmath.la ../libio/libio.la
+libstdc___la_OBJECTS = limitsMEMBERS.lo c++io.lo cmath.lo complex.lo \
+complexf.lo complexl.lo complex_io.lo stdexcept.lo ios.lo stdstreams.lo \
+strstream.lo locale.lo localename.lo locale-inst.lo stl-inst.lo \
+misc-inst.lo valarray-inst.lo stringMAIN.lo stringCTORNC.lo \
+stringCTORAL.lo stringCTORCPR.lo stringCTORCPRAL.lo stringCTORPRAL.lo \
+stringCTORPAL.lo stringCTORDUPAL.lo stringCTORPP.lo stringCTORII.lo \
+stringMUTATE.lo stringRESERVE.lo stringSWAP.lo stringSLOP.lo \
+stringRESIZE.lo stringAPPCOPY.lo stringAPPCPR.lo stringAPPPR.lo \
+stringAPPDUP.lo stringAPPII.lo stringASSCP.lo stringASSII.lo \
+stringINSII.lo stringREPRR.lo stringREPIIDUP.lo stringREPII.lo \
+stringREPIII.lo stringREP4I.lo stringREPIIPP.lo stringREPIIPP2.lo \
+stringCOPY.lo stringCONII.lo stringCONIIF.lo stringCONPPF.lo \
+stringCONPPF2.lo stringCONSC.lo stringFIND.lo stringFINDC.lo \
+stringRFIND.lo stringRFINDC.lo stringFFO.lo stringFLO.lo stringFFNO.lo \
+stringFLNO.lo stringFLNOC.lo stringCOMPARE.lo stringCOMPARE2.lo \
+stringCOMPAREP.lo stringCOMPAREP2.lo stringADDPS.lo stringADDCS.lo \
+stringEXTRACT.lo stringINSERT.lo stringGETLINE.lo stringSCOPY.lo \
+stringEQ.lo wstringMAIN.lo wstringCTORNC.lo wstringCTORAL.lo \
+wstringCTORCPR.lo wstringCTORCPRAL.lo wstringCTORPRAL.lo \
+wstringCTORPAL.lo wstringCTORDUPAL.lo wstringCTORPP.lo wstringCTORII.lo \
+wstringMUTATE.lo wstringRESERVE.lo wstringSWAP.lo wstringSLOP.lo \
+wstringRESIZE.lo wstringAPPCOPY.lo wstringAPPCPR.lo wstringAPPPR.lo \
+wstringAPPDUP.lo wstringAPPII.lo wstringASSCP.lo wstringASSII.lo \
+wstringINSII.lo wstringREPRR.lo wstringREPIIDUP.lo wstringREPII.lo \
+wstringREPIII.lo wstringREP4I.lo wstringREPIIPP.lo wstringREPIIPP2.lo \
+wstringCOPY.lo wstringCONII.lo wstringCONIIF.lo wstringCONPPF.lo \
+wstringCONPPF2.lo wstringCONSC.lo wstringFIND.lo wstringFINDC.lo \
+wstringRFIND.lo wstringRFINDC.lo wstringFFO.lo wstringFLO.lo \
+wstringFFNO.lo wstringFLNO.lo wstringFLNOC.lo wstringCOMPARE.lo \
+wstringCOMPARE2.lo wstringCOMPAREP.lo wstringCOMPAREP2.lo \
+wstringADDPS.lo wstringADDCS.lo wstringEXTRACT.lo wstringINSERT.lo \
+wstringGETLINE.lo wstringSCOPY.lo wstringEQ.lo
+CXXFLAGS = @CXXFLAGS@
+CXXLD = $(CXX)
+DIST_COMMON = Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = gtar
+GZIP_ENV = --best
+SOURCES = $(libstdc___la_SOURCES)
+OBJECTS = $(libstdc___la_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .cc .lo .o .s
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --cygnus src/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-toolexeclibLTLIBRARIES:
+
+clean-toolexeclibLTLIBRARIES:
+ -test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES)
+
+distclean-toolexeclibLTLIBRARIES:
+
+maintainer-clean-toolexeclibLTLIBRARIES:
+
+install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)
+ @list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(toolexeclibdir)/$$p"; \
+ $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(toolexeclibdir)/$$p; \
+ else :; fi; \
+ done
+
+uninstall-toolexeclibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(toolexeclibdir)/$$p; \
+ done
+
+.c.o:
+ $(COMPILE) -c $<
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+
+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:
+
+libstdc++.la: $(libstdc___la_OBJECTS) $(libstdc___la_DEPENDENCIES)
+ $(CXXLINK) -rpath $(toolexeclibdir) $(libstdc___la_LDFLAGS) $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) $(LIBS)
+.cc.o:
+ $(CXXCOMPILE) -c $<
+.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 = src
+
+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-toolexeclibLTLIBRARIES
+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-toolexeclibLTLIBRARIES
+uninstall: uninstall-am
+all-am: Makefile $(LTLIBRARIES)
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)
+
+
+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-toolexeclibLTLIBRARIES mostlyclean-compile \
+ mostlyclean-libtool mostlyclean-tags \
+ mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-toolexeclibLTLIBRARIES clean-compile clean-libtool \
+ clean-tags clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am: distclean-toolexeclibLTLIBRARIES distclean-compile \
+ distclean-libtool distclean-tags distclean-generic \
+ clean-am
+ -rm -f libtool
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-toolexeclibLTLIBRARIES \
+ 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-toolexeclibLTLIBRARIES \
+distclean-toolexeclibLTLIBRARIES clean-toolexeclibLTLIBRARIES \
+maintainer-clean-toolexeclibLTLIBRARIES \
+uninstall-toolexeclibLTLIBRARIES install-toolexeclibLTLIBRARIES \
+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
+
+
+install: myinstallheaders
+
+# NB: As libio_headers may be empty, need this to make sure bash doesn't
+# choke on an empty for... loop by using libio_headers_install
+
+myinstallheaders: $(headers:%=$(myincludep)%)
+ if test -z "$(MULTISUBDIR)"; then \
+ for i in $(std_headers); do \
+ echo "$(INSTALL_DATA) $(top_srcdir)/std/$$i $(myincludep)"; \
+ $(INSTALL_DATA) $(top_srcdir)/std/$$i $(myincludep); \
+ done; \
+ for i in $(generated_headers); do \
+ echo "$(INSTALL_DATA) $(top_builddir)/$$i $(myincludep)bits/"; \
+ $(INSTALL_DATA) $(top_builddir)/$$i $(myincludep)bits/; \
+ done; \
+ libio_headers_install='$(libio_headers)'; \
+ for i in $$libio_headers_install; do \
+ echo "$(INSTALL_DATA) $$i $(myincludep)"; \
+ $(INSTALL_DATA) $$i $(myincludep); \
+ done; \
+ echo "$(INSTALL_DATA) $(cpu_headers) $(myincludep)"; \
+ $(INSTALL_DATA) $(cpu_headers) $(myincludep); \
+ fi;
+
+$(headers:%=$(myincludep)%): $(myincludep)%: %
+ if test -z "$(MULTISUBDIR)"; then \
+ $(mkinstalldirs) $(@D); \
+ echo " $(INSTALL_DATA) $^ $@"; \
+ $(INSTALL_DATA) $^ $@; \
+ fi;
+
+# For the next time we have to handle misc-inst.cc and locale-inst.cc
+# in a special way since we cannot instantiate all classes due to
+# missing definitions for things like vptrs, type_info bits, etc. when
+# using -fno-implicit-templates.
+misc-inst.o: misc-inst.cc
+ $(CXXCOMPILE) -fimplicit-templates -c $<
+misc-inst.lo: misc-inst.cc
+ $(LTCXXCOMPILE) -fimplicit-templates -c $<
+locale-inst.o: locale-inst.cc
+ $(CXXCOMPILE) -fimplicit-templates -c $<
+locale-inst.lo: locale-inst.cc
+ $(LTCXXCOMPILE) -fimplicit-templates -c $<
+
+stringMAIN.lo \
+stringCTORNC.lo \
+stringCTORAL.lo \
+stringCTORCPR.lo \
+stringCTORCPRAL.lo \
+stringCTORPRAL.lo \
+stringCTORPAL.lo \
+stringCTORDUPAL.lo \
+stringCTORPP.lo \
+stringCTORII.lo \
+stringMUTATE.lo \
+stringRESERVE.lo \
+stringSWAP.lo \
+stringSLOP.lo \
+stringRESIZE.lo \
+stringAPPCOPY.lo \
+stringAPPCPR.lo \
+stringAPPPR.lo \
+stringAPPDUP.lo \
+stringAPPII.lo \
+stringASSCP.lo \
+stringASSII.lo \
+stringINSII.lo \
+stringREPRR.lo \
+stringREPIIDUP.lo \
+stringREPII.lo \
+stringREPIII.lo \
+stringREP4I.lo \
+stringREPIIPP.lo \
+stringREPIIPP2.lo \
+stringCOPY.lo \
+stringCONII.lo \
+stringCONIIF.lo \
+stringCONPPF.lo \
+stringCONPPF2.lo \
+stringCONSC.lo \
+stringFIND.lo \
+stringFINDC.lo \
+stringRFIND.lo \
+stringRFINDC.lo \
+stringFFO.lo \
+stringFLO.lo \
+stringFFNO.lo \
+stringFLNO.lo \
+stringFLNOC.lo \
+stringCOMPARE.lo \
+stringCOMPARE2.lo \
+stringCOMPAREP.lo \
+stringCOMPAREP2.lo \
+stringADDPS.lo \
+stringADDCS.lo \
+stringEXTRACT.lo \
+stringINSERT.lo \
+stringGETLINE.lo \
+stringSCOPY.lo \
+stringEQ.lo : string-inst.cc
+ $(LTCXXCOMPILE) -fimplicit-templates \
+ -c -D`echo $@ | tr -dc 'A-Z'` $< -o $@
+
+wstringMAIN.lo \
+wstringCTORNC.lo \
+wstringCTORAL.lo \
+wstringCTORCPR.lo \
+wstringCTORCPRAL.lo \
+wstringCTORPRAL.lo \
+wstringCTORPAL.lo \
+wstringCTORDUPAL.lo \
+wstringCTORPP.lo \
+wstringCTORII.lo \
+wstringMUTATE.lo \
+wstringRESERVE.lo \
+wstringSWAP.lo \
+wstringSLOP.lo \
+wstringRESIZE.lo \
+wstringAPPCOPY.lo \
+wstringAPPCPR.lo \
+wstringAPPPR.lo \
+wstringAPPDUP.lo \
+wstringAPPII.lo \
+wstringASSCP.lo \
+wstringASSII.lo \
+wstringINSII.lo \
+wstringREPRR.lo \
+wstringREPIIDUP.lo \
+wstringREPII.lo \
+wstringREPIII.lo \
+wstringREP4I.lo \
+wstringREPIIPP.lo \
+wstringREPIIPP2.lo \
+wstringCOPY.lo \
+wstringCONII.lo \
+wstringCONIIF.lo \
+wstringCONPPF.lo \
+wstringCONPPF2.lo \
+wstringCONSC.lo \
+wstringFIND.lo \
+wstringFINDC.lo \
+wstringRFIND.lo \
+wstringRFINDC.lo \
+wstringFFO.lo \
+wstringFLO.lo \
+wstringFFNO.lo \
+wstringFLNO.lo \
+wstringFLNOC.lo \
+wstringCOMPARE.lo \
+wstringCOMPARE2.lo \
+wstringCOMPAREP.lo \
+wstringCOMPAREP2.lo \
+wstringADDPS.lo \
+wstringADDCS.lo \
+wstringEXTRACT.lo \
+wstringINSERT.lo \
+wstringGETLINE.lo \
+wstringSCOPY.lo \
+wstringEQ.lo : string-inst.cc
+ $(LTCXXCOMPILE) -fimplicit-templates \
+ -c -D`echo $@ | tr -dc 'A-Z'` -DC=wchar_t $< -o $@
+
+stringMAIN.o \
+stringCTORNC.o \
+stringCTORAL.o \
+stringCTORCPR.o \
+stringCTORCPRAL.o \
+stringCTORPRAL.o \
+stringCTORPAL.o \
+stringCTORDUPAL.o \
+stringCTORPP.o \
+stringCTORII.o \
+stringMUTATE.o \
+stringRESERVE.o \
+stringSWAP.o \
+stringSLOP.o \
+stringRESIZE.o \
+stringAPPCOPY.o \
+stringAPPCPR.o \
+stringAPPPR.o \
+stringAPPDUP.o \
+stringAPPII.o \
+stringASSCP.o \
+stringASSII.o \
+stringINSII.o \
+stringREPRR.o \
+stringREPIIDUP.o \
+stringREPII.o \
+stringREPIII.o \
+stringREP4I.o \
+stringREPIIPP.o \
+stringREPIIPP2.o \
+stringCOPY.o \
+stringCONII.o \
+stringCONIIF.o \
+stringCONPPF.o \
+stringCONPPF2.o \
+stringCONSC.o \
+stringFIND.o \
+stringFINDC.o \
+stringRFIND.o \
+stringRFINDC.o \
+stringFFO.o \
+stringFLO.o \
+stringFFNO.o \
+stringFLNO.o \
+stringFLNOC.o \
+stringCOMPARE.o \
+stringCOMPARE2.o \
+stringCOMPAREP.o \
+stringCOMPAREP2.o \
+stringADDPS.o \
+stringADDCS.o \
+stringEXTRACT.o \
+stringINSERT.o \
+stringGETLINE.o \
+stringSCOPY.o \
+stringEQ.o : string-inst.cc
+ $(CXXCOMPILE) -fimplicit-templates \
+ -c -D`echo $@ | tr -dc 'A-Z'` $< -o $@
+
+wstringMAIN.o \
+wstringCTORNC.o \
+wstringCTORAL.o \
+wstringCTORCPR.o \
+wstringCTORCPRAL.o \
+wstringCTORPRAL.o \
+wstringCTORPAL.o \
+wstringCTORDUPAL.o \
+wstringCTORPP.o \
+wstringCTORII.o \
+wstringMUTATE.o \
+wstringRESERVE.o \
+wstringSWAP.o \
+wstringSLOP.o \
+wstringRESIZE.o \
+wstringAPPCOPY.o \
+wstringAPPCPR.o \
+wstringAPPPR.o \
+wstringAPPDUP.o \
+wstringAPPII.o \
+wstringASSCP.o \
+wstringASSII.o \
+wstringINSII.o \
+wstringREPRR.o \
+wstringREPIIDUP.o \
+wstringREPII.o \
+wstringREPIII.o \
+wstringREP4I.o \
+wstringREPIIPP.o \
+wstringREPIIPP2.o \
+wstringCOPY.o \
+wstringCONII.o \
+wstringCONIIF.o \
+wstringCONPPF.o \
+wstringCONPPF2.o \
+wstringCONSC.o \
+wstringFIND.o \
+wstringFINDC.o \
+wstringRFIND.o \
+wstringRFINDC.o \
+wstringFFO.o \
+wstringFLO.o \
+wstringFFNO.o \
+wstringFLNO.o \
+wstringFLNOC.o \
+wstringCOMPARE.o \
+wstringCOMPARE2.o \
+wstringCOMPAREP.o \
+wstringCOMPAREP2.o \
+wstringADDPS.o \
+wstringADDCS.o \
+wstringEXTRACT.o \
+wstringINSERT.o \
+wstringGETLINE.o \
+wstringSCOPY.o \
+wstringEQ.o : string-inst.cc
+ $(CXXCOMPILE) -fimplicit-templates \
+ -c -D`echo $@ | tr -dc 'A-Z'` -DC=wchar_t $< -o $@
+
+# 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/libstdc++-v3/src/bitset.cc b/libstdc++-v3/src/bitset.cc
new file mode 100644
index 000000000000..cd8c71f0e256
--- /dev/null
+++ b/libstdc++-v3/src/bitset.cc
@@ -0,0 +1,107 @@
+/* Low-level implementation of bitset template class from ISO C++. */
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#include <bits/std_bitset.h>
+#include <bits/std_climits.h>
+
+
+static const size_t word_bits = sizeof (__bitset_word) * CHAR_BIT;
+
+
+void
+__bitset_base_lshift (__bitset_word *arr, size_t n, size_t nlast,
+ size_t offset, size_t nbits)
+{
+ arr[n - 1] = arr[n - 1 - offset] << nbits;
+
+ for (size_t cnt = n - 1; cnt > offset; --cnt)
+ {
+ arr[cnt] |= arr[cnt - 1 - offset] >> (word_bits - nbits);
+ arr[cnt - 1] = arr[cnt - 1 - offset] << nbits;
+ }
+
+ memset (arr, '\0', offset * sizeof (__bitset_word));
+}
+
+
+void
+__bitset_base_rshift (__bitset_word *arr, size_t n, size_t nlast,
+ size_t offset, size_t nbits)
+{
+ arr[0] = arr[offset] >> nbits;
+
+ for (size_t cnt = offset + 1; cnt < n; ++cnt)
+ {
+ arr[cnt - 1 - offset] |= arr[cnt] << (word_bits - nbits);
+ arr[cnt - offset] = arr[cnt] >> nbits;
+ }
+
+ memset (&arr[n - offset], '\0', offset * sizeof (__bitset_word));
+}
+
+
+size_t
+__bitset_base_count (__bitset_word *arr, size_t n)
+{
+ size_t result = 0;
+
+ while (n > 0)
+ {
+ __bitset_word word = arr[n];
+
+ if (sizeof (__bitset_word) == 4)
+ {
+ word = (word & 0x55555555) + ((word >> 1) & 0x55555555);
+ word = (word & 0x33333333) + ((word >> 2) & 0x33333333);
+ word = (word + (word >> 4)) & 0x0f0f0f0f;
+ word = word + (word >> 8);
+ word = (word + (word >> 16)) & 0xff;
+ }
+ else
+ {
+ // The only other possibility is a 64 bit word.
+ word = ((word & ((0x55555555UL << 16) << 16 | 0x55555555UL))
+ + ((word >> 1)
+ & ((0x55555555UL << 16) << 16 | 0x55555555UL)));
+ word = ((word & ((0x33333333UL << 16) << 16 | 0x33333333UL))
+ + ((word >> 1)
+ & ((0x33333333UL << 16) << 16 | 0x33333333UL)));
+ word = ((word + (word >> 4))
+ & ((0x0f0f0f0fUL << 16) << 16 | 0x0f0f0f0fUL));
+ word = (word + (word >> 8));
+ word = (word + (word >> 16));
+ word = (word + ((word >> 16) >> 16)) & 0xff;
+ }
+
+ result += word;
+ }
+
+ return result;
+}
diff --git a/libstdc++-v3/src/cmath.cc b/libstdc++-v3/src/cmath.cc
new file mode 100644
index 000000000000..8134e7214722
--- /dev/null
+++ b/libstdc++-v3/src/cmath.cc
@@ -0,0 +1,85 @@
+// -*- C++ -*- C math library.
+
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 26.5 C library
+// Code for signatures not found in the C library
+//
+
+#include <bits/std_cmath.h>
+
+namespace std {
+
+ namespace {
+ template <typename T>
+ inline T pow_helper(T x, unsigned int y)
+ {
+ T z = y&1? x : 1;
+ while(y >>= 1)
+ {
+ x *= x;
+ if(y & 1) z *= x;
+ }
+ return z;
+ }
+ }
+
+ float
+ pow(float x, int y)
+ {
+ if(y < 0)
+ return 1.0f/pow_helper(x, -y);
+ else
+ return pow_helper(x, y);
+ }
+
+ double
+ pow(double x, int y)
+ {
+ if(y < 0)
+ return 1.0/pow_helper(x, -y);
+ else
+ return pow_helper(x, y);
+ }
+
+ long double
+ pow(long double x, int y)
+ {
+ if(y < 0)
+ return 1.0l/pow_helper(x, -y);
+ else
+ return pow_helper(x, y);
+ }
+
+} // std
+
+
+
+
+
diff --git a/libstdc++-v3/src/complex.cc b/libstdc++-v3/src/complex.cc
new file mode 100644
index 000000000000..b19a74a9dabd
--- /dev/null
+++ b/libstdc++-v3/src/complex.cc
@@ -0,0 +1,274 @@
+// The template and inlines for the -*- C++ -*- complex number classes.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <bits/std_cmath.h>
+#include <bits/std_complex.h>
+
+// This is a ISO C 9X header.
+#include <math/mathconf.h>
+#undef complex
+
+#ifndef FLT
+# define FLT double
+# define FCT(name) ::name
+#endif
+
+namespace std
+{
+
+ template<>
+ FLT
+ abs(const complex<FLT>& __x)
+ { return FCT(cabs)(__x._M_value); }
+
+ template<>
+ FLT
+ arg(const complex<FLT>& __x)
+ { return FCT(carg)(__x._M_value); }
+
+ template<>
+ complex<FLT>
+ polar(const FLT& __rho, const FLT& __theta)
+ {
+#if defined _G_HAVE_SINCOS && !defined __osf__
+ // Although sincos does exist on OSF3.2 and OSF4.0 we cannot use it
+ // since the necessary types are not defined in the headers.
+ FLT __sinx, __cosx;
+ FCT(sincos)(__theta, &__sinx, &__cosx);
+ return complex<FLT>(__rho * __cosx, __rho * __sinx);
+#else
+#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
+ && defined(_GLIBCPP_FLOAT_SPECIALIZATION)
+ complex<FLT> __tmpf(__rho * FCT(cos)(__theta),
+ __rho * FCT(sin)(__theta));
+ return __tmpf;
+#else
+ return complex<FLT>(__rho * FCT(cos)(__theta),
+ __rho * FCT(sin)(__theta));
+#endif
+#endif
+ }
+
+ template<>
+ complex<FLT>
+ cos(const complex<FLT>& __x)
+#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
+ && defined(_GLIBCPP_FLOAT_SPECIALIZATION)
+ {
+ complex<FLT> __tmpf(FCT(ccos)(__x._M_value));
+ return __tmpf;
+ }
+#else
+ { return complex<FLT>(FCT(ccos)(__x._M_value)); }
+#endif
+
+ template<>
+ complex<FLT>
+ cosh(const complex<FLT>& __x)
+#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
+ && defined(_GLIBCPP_FLOAT_SPECIALIZATION)
+ {
+ complex<FLT> __tmpf(FCT(ccosh)(__x._M_value));
+ return __tmpf;
+ }
+#else
+ { return complex<FLT>(FCT(ccosh)(__x._M_value)); }
+#endif
+
+ template<>
+ complex<FLT>
+ exp(const complex<FLT>& __x)
+#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
+ && defined(_GLIBCPP_FLOAT_SPECIALIZATION)
+ {
+ complex<FLT> __tmpf(FCT(cexp)(__x._M_value));
+ return __tmpf;
+ }
+#else
+ { return complex<FLT>(FCT(cexp)(__x._M_value)); }
+#endif
+
+ template<>
+ complex<FLT>
+ log(const complex<FLT>& __x)
+#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
+ && defined(_GLIBCPP_FLOAT_SPECIALIZATION)
+ {
+ complex<FLT> __tmpf(FCT(c_log)(__x._M_value));
+ return __tmpf;
+ }
+#else
+ { return complex<FLT>(FCT(c_log)(__x._M_value)); }
+#endif
+
+ template<>
+ complex<FLT>
+ log10(const complex<FLT>& __x)
+#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
+ && defined(_GLIBCPP_FLOAT_SPECIALIZATION)
+ {
+ complex<FLT> __tmpf(FCT(clog10)(__x._M_value));
+ return __tmpf;
+ }
+#else
+ { return complex<FLT>(FCT(clog10)(__x._M_value)); }
+#endif
+
+ template<>
+ complex<FLT>
+ pow(const complex<FLT>& __x, int __n)
+#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
+ && defined(_GLIBCPP_FLOAT_SPECIALIZATION)
+ {
+ complex<FLT> __tmpf(FCT(cexp) (__n * FCT(c_log)(__x._M_value)));
+ return __tmpf;
+ }
+#else
+ { return complex<FLT>(FCT(cexp) (__n * FCT(c_log)(__x._M_value))); }
+#endif
+
+
+ template<>
+ complex<FLT>
+ pow(const complex<FLT>& __x, const FLT& __y)
+#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
+ && defined(_GLIBCPP_FLOAT_SPECIALIZATION)
+ {
+ complex<FLT> __tmpf(FCT(cexp) (__y * FCT(c_log)(__x._M_value)));
+ return __tmpf;
+ }
+#else
+ { return complex<FLT>(FCT(cexp) (__y * FCT(c_log)(__x._M_value))); }
+#endif
+
+ template<>
+ complex<FLT>
+ pow(const complex<FLT>& __x, const complex<FLT>& __y)
+#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
+ && defined(_GLIBCPP_FLOAT_SPECIALIZATION)
+ {
+ complex<FLT> __tmpf(FCT(cpow)(__x._M_value, __y._M_value));
+ return __tmpf;
+ }
+#else
+ { return complex<FLT>(FCT(cpow)(__x._M_value, __y._M_value)); }
+#endif
+
+ template<>
+ complex<FLT>
+ pow(const FLT& __x, const complex<FLT>& __y)
+#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
+ && defined(_GLIBCPP_FLOAT_SPECIALIZATION)
+ {
+ complex<FLT> __tmpf(FCT(cexp)(__y._M_value * FCT(log)(__x)));
+ return __tmpf;
+ }
+#else
+ { return complex<FLT>(FCT(cexp)(__y._M_value * FCT(log)(__x))); }
+#endif
+
+ template<>
+ complex<FLT>
+ sin(const complex<FLT>& __x)
+#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
+ && defined(_GLIBCPP_FLOAT_SPECIALIZATION)
+ {
+ complex<FLT> __tmpf(FCT(csin)(__x._M_value));
+ return __tmpf;
+ }
+#else
+ { return complex<FLT>(FCT(csin)(__x._M_value)); }
+#endif
+
+ template<>
+ complex<FLT>
+ sinh(const complex<FLT>& __x)
+#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
+ && defined(_GLIBCPP_FLOAT_SPECIALIZATION)
+ {
+ complex<FLT> __tmpf(FCT(csinh)(__x._M_value));
+ return __tmpf;
+ }
+#else
+ { return complex<FLT>(FCT(csinh)(__x._M_value)); }
+#endif
+
+ template<>
+ complex<FLT>
+ sqrt(const complex<FLT>& __x)
+#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
+ && defined(_GLIBCPP_FLOAT_SPECIALIZATION)
+ {
+ complex<FLT> __tmpf(FCT(csqrt)(__x._M_value));
+ return __tmpf;
+ }
+#else
+ { return complex<FLT>(FCT(csqrt)(__x._M_value)); }
+#endif
+
+ template<>
+ complex<FLT>
+ tan(const complex<FLT>& __x)
+#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
+ && defined(_GLIBCPP_FLOAT_SPECIALIZATION)
+ {
+ complex<FLT> __tmpf(FCT(ctan)(__x._M_value));
+ return __tmpf;
+ }
+#else
+ { return complex<FLT>(FCT(ctan)(__x._M_value)); }
+#endif
+
+ template<>
+ complex<FLT>
+ tanh(const complex<FLT>& __x)
+#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
+ && defined(_GLIBCPP_FLOAT_SPECIALIZATION)
+ {
+ complex<FLT> __tmpf(FCT(ctanh)(__x._M_value));
+ return __tmpf;
+ }
+#else
+ { return complex<FLT>(FCT(ctanh)(__x._M_value)); }
+#endif
+
+} // namespace std
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/src/complex_io.cc b/libstdc++-v3/src/complex_io.cc
new file mode 100644
index 000000000000..3733416dc2ea
--- /dev/null
+++ b/libstdc++-v3/src/complex_io.cc
@@ -0,0 +1,160 @@
+// The template and inlines for the -*- C++ -*- complex number classes.
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <bits/std_complex.h>
+#include <bits/std_istream.h>
+#include <bits/std_ostream.h>
+#include <bits/std_sstream.h>
+
+
+namespace std
+{
+
+ template<typename _Tp, typename _CharT, class _Traits>
+ basic_istream <_CharT, _Traits> &
+ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
+ {
+#if !defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) && !defined(_GLIBCPP_BUGGY_COMPLEX)
+ _Tp __re_x, __im_x;
+ _CharT __ch;
+ __is >> __ch;
+ if (__ch == '(')
+ {
+ __is >> __re_x >> __ch;
+ if (__ch == ',')
+ {
+ __is >> __im_x >> __ch;
+ if (__ch == ')')
+ {
+ __x = complex<_Tp>(__re_x, __im_x);
+ return __is;
+ }
+ }
+ else if (__ch == ')')
+ {
+ __x = complex<_Tp>(__re_x, _Tp(0));
+ return __is;
+ }
+ }
+ else
+ {
+ __is.putback(__ch);
+ __is >> __re_x;
+ __x = complex<_Tp>(__re_x, _Tp(0));
+ return __is;
+ }
+ __is.setstate(ios_base::failbit);
+#else
+ __x = complex<_Tp>(_Tp(0), _Tp(0));
+#endif
+ return __is;
+ }
+
+ template<typename _Tp, typename _CharT, class _Traits>
+ basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
+ {
+ basic_ostringstream<_CharT, _Traits> __s;
+ __s.flags(__os.flags());
+#ifdef _G_HAVE_LOCALE
+ __s.imbue(__os.getloc());
+#endif
+ __s.precision (__os.precision());
+ __s << '(' << __x.real() << "," << __x.imag() << ')' << ends;
+ return __os << __s.str();
+ }
+
+
+ template
+ basic_istream< char, char_traits<char> >&
+ operator>>(basic_istream< char, char_traits<char> >&,
+ complex<float>&);
+
+ template
+ basic_ostream< char, char_traits<char> >&
+ operator<<(basic_ostream< char, char_traits<char> >&,
+ const complex<float>&);
+
+ template
+ basic_istream< char, char_traits<char> >&
+ operator>>(basic_istream< char, char_traits<char> >&,
+ complex<double>&);
+
+ template
+ basic_ostream< char, char_traits<char> >&
+ operator<<(basic_ostream< char, char_traits<char> >&,
+ const complex<double>&);
+
+ template
+ basic_istream< char, char_traits<char> >&
+ operator>>(basic_istream< char, char_traits<char> >&,
+ complex<long double>&);
+
+ template
+ basic_ostream< char, char_traits<char> >&
+ operator<<(basic_ostream< char, char_traits<char> >&,
+ const complex<long double>&);
+
+ template
+ basic_istream< wchar_t, char_traits<wchar_t> >&
+ operator>>(basic_istream< wchar_t, char_traits<wchar_t> >&,
+ complex<float>&);
+
+ template
+ basic_ostream< wchar_t, char_traits<wchar_t> >&
+ operator<<(basic_ostream< wchar_t, char_traits<wchar_t> >&,
+ const complex<float>&);
+
+ template
+ basic_istream< wchar_t, char_traits<wchar_t> >&
+ operator>>(basic_istream< wchar_t, char_traits<wchar_t> >&,
+ complex<double>&);
+
+ template
+ basic_ostream< wchar_t, char_traits<wchar_t> >&
+ operator<<(basic_ostream< wchar_t, char_traits<wchar_t> >&,
+ const complex<double>&);
+
+ template
+ basic_istream< wchar_t, char_traits<wchar_t> >&
+ operator>>(basic_istream< wchar_t, char_traits<wchar_t> >&,
+ complex<long double>&);
+
+ template
+ basic_ostream< wchar_t, char_traits<wchar_t> >&
+ operator<<(basic_ostream< wchar_t, char_traits<wchar_t> >&,
+ const complex<long double>&);
+}
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/src/complexf.cc b/libstdc++-v3/src/complexf.cc
new file mode 100644
index 000000000000..5ef12afce18f
--- /dev/null
+++ b/libstdc++-v3/src/complexf.cc
@@ -0,0 +1,5 @@
+#define FLT float
+#define FCT(name) ::name##f
+// Used in complex.cc to work around GCC's buggy __complex__ float support.
+#define _GLIBCPP_FLOAT_SPECIALIZATION 1
+#include "complex.cc"
diff --git a/libstdc++-v3/src/complexl.cc b/libstdc++-v3/src/complexl.cc
new file mode 100644
index 000000000000..4c11abd9407e
--- /dev/null
+++ b/libstdc++-v3/src/complexl.cc
@@ -0,0 +1,8 @@
+#include <bits/c++config.h>
+#ifdef _GLIBCPP_HAVE_SINL
+/* We compile these functions only when we have the long double functions
+ available. */
+#define FLT long double
+#define FCT(name) ::name##l
+#include "complex.cc"
+#endif
diff --git a/libstdc++-v3/src/gen-num-limits.cc b/libstdc++-v3/src/gen-num-limits.cc
new file mode 100644
index 000000000000..8dd3a16e2488
--- /dev/null
+++ b/libstdc++-v3/src/gen-num-limits.cc
@@ -0,0 +1,707 @@
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// Written by Gabriel Dos Reis <gdr@egcs.cygnus.com>
+//
+// Note: This program outputs speciliazations of ISO C++ class template
+// numeric_limits<> as described in 18.2.1.
+// Do not compile with optimization turned on.
+//
+
+#include <bits/c++config.h>
+
+//
+// Force Linux <limits.h> to define the *LONG_LONG*
+//
+#if __linux__ && _GLIBCPP_USE_LONG_LONG
+# ifndef __USE_GNU
+# define __USE_GNU 1
+# endif
+# ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+# endif
+#endif
+
+#include <limits.h>
+#include <float.h>
+#include <stdio.h>
+#include <signal.h>
+#include <setjmp.h>
+#include <math.h>
+#ifdef _GLIBCPP_USE_WCHAR_T
+#include <wchar.h>
+#endif
+
+
+const char tab[] = " ";
+const char tab2[] = " ";
+const char* bool_alpha[] = { "false", "true" };
+const double log10_of_two = .30102999566398119;
+const int bits_per_byte = CHAR_BIT;
+const int integer_base_rep = 2;
+
+
+//
+// numeric_limits members are all static (as it is usually the case for
+// traits) and of three kinds: predicates, values and functions.
+// Actually there is no harm to think of values and functions as being
+// of the same kind. Their main purposes are to denote values.
+//
+
+
+//
+// Integer types: bool, char, signed char, unsigned char, wchar_t,
+// short, unsigned short, int, unsigned, long, unsigned long,
+// and possibly long long and unsigned long long
+//
+// Here ISO 14882 disagrees with LIA-1 in stating bool to be an
+// integer type. Therefore itn't suprising to see ambiguity in the
+// interpretation of some members. Need to keep track of the discusion
+// in LWG on this topic.
+//
+// Integer types are first promoted to int or long before the actual
+// arithmetical operations are carried out. Therefore testing whether
+// traps occur amounts -- for integer types -- to test whether traps
+// occur for int, unsigned, long, unsigned long. Furthermore
+// overflow cannot happen for unsigned integer types.
+
+jmp_buf env;
+
+void signal_handler(int sig)
+{
+#ifdef __CYGWIN__
+ static sigset_t x;
+ signal (sig, signal_handler);
+ sigemptyset (&x);
+ sigprocmask(SIG_SETMASK, &x, NULL);
+#endif /* __CYGWIN__ */
+ longjmp(env, sig);
+}
+
+template<typename Operation>
+bool trapping(const Operation& op)
+{
+ if (setjmp(env) == 0) op();
+ else return true;
+ return false;
+}
+
+template<typename T> struct division_by_zero {
+ void operator() () const
+ {
+ volatile T zero = T();
+ volatile T one = T(1);
+ volatile T infinity = one / zero;
+ }
+};
+
+template<typename T> struct overflow {
+ void operator() () const
+ {
+ T i = T(1);
+ T j = T();
+ while (i>j) {
+ j = i;
+ i = i * 2 + 1;
+ }
+ }
+};
+
+template<typename T> struct underflow {};
+
+// traps
+template<typename T> void traps()
+{
+ signal(SIGFPE, signal_handler);
+ bool trap_flag = trapping(division_by_zero<T>());
+ signal(SIGFPE, signal_handler);
+ trap_flag = trap_flag && trapping(overflow<T>());
+ const char* p = bool_alpha[trap_flag];
+ printf("%s%s = %s;\n", tab2, "static const bool traps", p);
+}
+
+#define SPECIALIZE_TRAPPING(T) \
+template<> void traps< T >() \
+{ \
+ signal(SIGFPE, signal_handler); \
+ const char* p = bool_alpha[trapping(division_by_zero<T>())]; \
+ printf("%s%s = %s;\n", tab2, "static const bool traps", p); \
+}
+
+SPECIALIZE_TRAPPING(unsigned char);
+SPECIALIZE_TRAPPING(unsigned short);
+SPECIALIZE_TRAPPING(unsigned int);
+SPECIALIZE_TRAPPING(unsigned long);
+#if _GLIBCPP_USE_LONG_LONG
+SPECIALIZE_TRAPPING(unsigned long long);
+#endif
+
+#undef SPECIALIZE_TRAPPING
+
+template<typename T> struct type_name_trait {
+ static const char type_name[];
+ static const char trait_name[];
+};
+
+#define DEFINED_TYPE_NAME(T) \
+const char type_name_trait< T >::type_name[] = #T; \
+const char type_name_trait< T >::trait_name[] = "numeric_limits<" #T ">";
+
+DEFINED_TYPE_NAME(bool);
+DEFINED_TYPE_NAME(char);
+DEFINED_TYPE_NAME(signed char);
+DEFINED_TYPE_NAME(unsigned char);
+DEFINED_TYPE_NAME(wchar_t);
+DEFINED_TYPE_NAME(short);
+DEFINED_TYPE_NAME(unsigned short);
+DEFINED_TYPE_NAME(int);
+DEFINED_TYPE_NAME(unsigned int);
+DEFINED_TYPE_NAME(long);
+DEFINED_TYPE_NAME(unsigned long);
+#ifdef _GLIBCPP_USE_LONG_LONG
+DEFINED_TYPE_NAME(long long);
+DEFINED_TYPE_NAME(unsigned long long);
+#endif
+DEFINED_TYPE_NAME(float);
+DEFINED_TYPE_NAME(double);
+DEFINED_TYPE_NAME(long double);
+
+#undef DEFINED_TYPE_NAME
+
+// declarator
+template<typename T> struct declarator : type_name_trait<T> {
+ typedef type_name_trait<T> base;
+ static void start()
+ {
+ printf("%s%s %s %s\n", tab, "template<> struct",
+ base::trait_name, "{");
+ }
+
+ static void end()
+ {
+ printf("%s};\n\n", tab);
+ }
+};
+
+
+//
+// Predicates
+//
+template<typename T> struct predicate {
+ static const bool is_signed;
+ static const bool is_integer;
+ static const bool is_exact;
+
+ static const bool has_infinity;
+ static const bool has_quiet_nan;
+ static const bool has_signaling_nan;
+ static const bool has_denorm;
+ static const bool has_denorm_loss;
+
+ static const bool is_iec559;
+ static const bool is_bounded;
+
+ static const bool traps;
+};
+
+template<typename T>
+const bool predicate<T>::is_signed = T(-1) < 0;
+
+// Non integer types should specialize this
+template<typename T>
+const bool predicate<T>::is_integer = true;
+
+// Non exact types should specialize this;
+template<typename T>
+const bool predicate<T>::is_exact = true;
+
+#define SPECIALIZE_EXACTNESS(T) \
+const bool predicate< T >::is_integer = false; \
+const bool predicate< T >::is_exact = false
+
+SPECIALIZE_EXACTNESS(float);
+SPECIALIZE_EXACTNESS(double);
+SPECIALIZE_EXACTNESS(long double);
+
+#undef SPECIALIZE_EXACTNESS
+
+
+template<typename T>
+const bool predicate<T>::has_infinity = false;
+
+template<typename T>
+const bool predicate<T>::has_quiet_nan = false;
+
+template<typename T>
+const bool predicate<T>::has_signaling_nan = false;
+
+template<typename T>
+const bool predicate<T>::has_denorm = false;
+
+template<typename T>
+const bool predicate<T>::has_denorm_loss = false;
+
+
+
+// Each type conforming to IEC559 specifications should specialize this.
+template<typename T>
+const bool predicate<T>::is_iec559 = false;
+
+#define SPECIALIZE_IEC559(T) \
+const bool predicate< T >::is_iec559 = true
+
+SPECIALIZE_IEC559(bool);
+SPECIALIZE_IEC559(int);
+SPECIALIZE_IEC559(unsigned int);
+SPECIALIZE_IEC559(long);
+SPECIALIZE_IEC559(unsigned long);
+#ifdef _GLIBCPP_USE_LONG_LONG
+SPECIALIZE_IEC559(long long);
+SPECIALIZE_IEC559(unsigned long long);
+#endif
+
+#undef SPECIALIZE_IEC559
+
+//
+// Values
+//
+
+template<typename T> struct value {
+ static const char min[];
+ static const char max[];
+
+ static const int digits;
+ static const int digits10;
+
+ static const int radix;
+ static const char epsilon[];
+ static const char round_error[];
+
+ static const int min_exponent;
+ static const int min_exponent10;
+ static const int max_exponent;
+ static const int max_exponent10;
+};
+
+#define DEFINE_EXTREMA(T, m, M) DO_DEFINE_EXTREMA(T, m, M)
+#define DO_DEFINE_EXTREMA(T, m, M) \
+const char value< T >::min[] = #m; \
+const char value< T >::max[] = #M
+
+DEFINE_EXTREMA(bool, false, true);
+DEFINE_EXTREMA(char, CHAR_MIN, CHAR_MAX);
+DEFINE_EXTREMA(signed char, SCHAR_MIN, SCHAR_MAX);
+DEFINE_EXTREMA(unsigned char, 0, UCHAR_MAX);
+#ifdef _GLIBCPP_USE_WCHAR_T
+DEFINE_EXTREMA(wchar_t, WCHAR_MIN, WCHAR_MAX);
+#endif
+DEFINE_EXTREMA(short, SHRT_MIN, SHRT_MAX);
+DEFINE_EXTREMA(unsigned short, 0, USHRT_MAX);
+DEFINE_EXTREMA(int, INT_MIN, INT_MAX);
+DEFINE_EXTREMA(unsigned int, 0, UINT_MAX);
+DEFINE_EXTREMA(long, LONG_MIN, LONG_MAX);
+DEFINE_EXTREMA(unsigned long, 0, ULONG_MAX);
+#ifdef _GLIBCPP_USE_LONG_LONG
+DEFINE_EXTREMA(long long, LONG_LONG_MIN, LONG_LONG_MAX);
+DEFINE_EXTREMA(unsigned long long, 0, ULONG_LONG_MAX);
+#endif
+DEFINE_EXTREMA(float, FLT_MIN, FLT_MAX);
+DEFINE_EXTREMA(double, DBL_MIN, DBL_MAX);
+DEFINE_EXTREMA(long double, LDBL_MIN, LDBL_MAX);
+
+#undef DEFINE_EXTREMA
+#undef DO_DEFINE_EXTREMA
+
+// Non integer types should specialize this
+template<typename T>
+const int value<T>::digits =
+ bits_per_byte * sizeof(T) - int(predicate<T>::is_signed);
+
+// Non integer types should specialize this. Alwyas two for
+// integer types.
+template<typename T>
+const int value<T>::radix = 2;
+
+#define SPECIALIZE_DIGITS(T, D, D10) \
+const int value< T >::digits = D; \
+const int value< T >::digits10 = D10
+
+SPECIALIZE_DIGITS(float, FLT_MANT_DIG, FLT_DIG);
+SPECIALIZE_DIGITS(double, DBL_MANT_DIG, DBL_DIG);
+SPECIALIZE_DIGITS(long double, LDBL_MANT_DIG, LDBL_DIG);
+
+#undef SPECIALIZE_DIGITS
+
+
+#define SPECIALIZE_RADIX(T, R) const int value< T >::radix = R
+
+SPECIALIZE_RADIX(float, FLT_RADIX);
+SPECIALIZE_RADIX(double, FLT_RADIX);
+SPECIALIZE_RADIX(long double, FLT_RADIX);
+
+#undef SPECIALIZE_RADIX
+
+
+template<typename T>
+const char value<T>::epsilon[] = "0";
+
+template<typename T>
+const char value<T>::round_error[] = "0";
+
+#define SPECIALIZE_EPSILON(T, E) DO_SPECIALIZE_EPSILON(T, E)
+#define DO_SPECIALIZE_EPSILON(T, E) const char value< T >::epsilon[] = #E
+
+SPECIALIZE_EPSILON(float, FLT_EPSILON);
+SPECIALIZE_EPSILON(double, DBL_EPSILON);
+SPECIALIZE_EPSILON(long double, LDBL_EPSILON);
+
+#undef DO_SPECIALIZE_EPSILON
+#undef SPECIALIZE_EPSILON
+
+
+#define SPECIALIZE_ROUND_ERROR(T, R) const char value< T >::round_error[] = #R
+
+SPECIALIZE_ROUND_ERROR(float, 1.0f);
+SPECIALIZE_ROUND_ERROR(double, 1.0);
+SPECIALIZE_ROUND_ERROR(long double, 1.0L);
+
+#undef SPECIALIZE_ROUND_ERROR
+
+
+template<typename T>
+const int value<T>::min_exponent = 0;
+
+template<typename T>
+const int value<T>::min_exponent10 = 0;
+
+template<typename T>
+const int value<T>::max_exponent = 0;
+
+template<typename T>
+const int value<T>::max_exponent10 = 0;
+
+#define SPECIALIZE_EXPONENTS(T, m, m10, M, M10) \
+const int value< T >::min_exponent = m; \
+const int value< T >::min_exponent10 = m10; \
+const int value< T >::max_exponent = M; \
+const int value< T >::max_exponent10 = M10
+
+SPECIALIZE_EXPONENTS(float, FLT_MIN_EXP, FLT_MIN_10_EXP,
+ FLT_MAX_EXP, FLT_MAX_10_EXP);
+SPECIALIZE_EXPONENTS(double, DBL_MIN_EXP, DBL_MIN_10_EXP,
+ DBL_MAX_EXP, DBL_MAX_10_EXP);
+SPECIALIZE_EXPONENTS(long double, LDBL_MIN_EXP, LDBL_MIN_10_EXP,
+ LDBL_MAX_EXP, LDBL_MAX_10_EXP);
+
+#undef SPECIALIZE_EXPONENTS
+
+//
+// Functions to output predicates and values.
+//
+
+template<typename T> void is_signed()
+{
+ printf("%s%s = %s;\n", tab2, "static const bool is_signed",
+ bool_alpha[predicate<T>::is_signed]);
+}
+
+// a fundamental type is modulo iff it isn't signed
+template<typename T> void is_modulo()
+{
+ printf("%s%s = %s;\n", tab2, "static const bool is_modulo",
+ bool_alpha[! predicate<T>::is_signed]);
+}
+
+template<typename T>
+void min()
+{
+ printf("%s%s%s%s\n%s%s%s%s\n", tab2, "static ", declarator<T>::type_name,
+ " min() throw()", tab2, "{ return ", value<T>::min, "; }");
+}
+
+template<typename T>
+void max()
+{
+ printf("%s%s%s%s\n%s%s%s%s\n", tab2, "static ", declarator<T>::type_name,
+ " max() throw()", tab2, "{ return ", value<T>::max, "; }");
+}
+
+template<typename T>
+void is_integer()
+{
+ printf("%s%s = %s;\n", tab2, "static const bool is_integer",
+ bool_alpha[predicate<T>::is_integer]);
+}
+
+template<typename T>
+void is_exact()
+{
+ printf("%s%s = %s;\n", tab2, "static const bool is_exact",
+ bool_alpha[predicate<T>::is_exact]);
+}
+
+template<typename T>
+void digits()
+{
+ printf("%s%s = %d;\n", tab2, "static const int digits",
+ value<T>::digits);
+}
+
+template<typename T>
+void digits10()
+{
+ printf("%s%s = %d;\n", tab2, "static const int digits10",
+ int(log10_of_two * value<T>::digits));
+}
+
+template<typename T>
+void radix()
+{
+ printf("%s%s = %d;\n", tab2, "static const int radix",
+ value<T>::radix);
+}
+
+template<typename T>
+void epsilon()
+{
+ printf("%s%s %s %s\n%s%s %s%s\n", tab2, "static",
+ declarator<T>::type_name, "epsilon() throw()",
+ tab2, "{ return", value<T>::epsilon, "; }");
+}
+
+template<typename T>
+void round_error()
+{
+ printf("%s%s %s %s\n%s%s %s%s\n", tab2, "static",
+ declarator<T>::type_name, "round_error() throw()",
+ tab2, "{ return", value<T>::round_error, "; }");
+}
+
+template<typename T>
+void min_exponent()
+{
+ printf("%s%s = %d;\n", tab2, "static const int min_exponent",
+ value<T>::min_exponent);
+}
+
+template<typename T>
+void min_exponent10()
+{
+ printf("%s%s = %d;\n", tab2, "static const int min_exponent10",
+ value<T>::min_exponent10);
+}
+
+template<typename T>
+void max_exponent()
+{
+ printf("%s%s = %d;\n", tab2, "static const int max_exponent",
+ value<T>::max_exponent);
+}
+
+template<typename T>
+void max_exponent10()
+{
+ printf("%s%s = %d;\n", tab2, "static const int max_exponent10",
+ value<T>::max_exponent10);
+}
+
+template<typename T>
+void has_infinity()
+{
+ printf("%s%s = %s;\n", tab2, "static const bool has_infinity",
+ bool_alpha[predicate<T>::has_infinity]);
+}
+
+template<typename T>
+void has_quiet_nan()
+{
+ printf("%s%s = %s;\n", tab2, "static const bool has_quiet_NaN",
+ bool_alpha[predicate<T>::has_quiet_nan]);
+}
+
+template<typename T>
+void has_signaling_nan()
+{
+ printf("%s%s = %s;\n", tab2, "static const bool has_signaling_NaN",
+ bool_alpha[predicate<T>::has_signaling_nan]);
+}
+
+template<typename T>
+void has_denorm_loss()
+{
+ printf("%s%s = %s;\n", tab2, "static const bool has_denorm_loss",
+ bool_alpha[predicate<T>::has_denorm_loss]);
+}
+
+template<typename T> struct infinity_trait {
+ static void has_denorm()
+ {
+ printf("%s%s;\n", tab2, "static const float_denorm_style "
+ "has_denorm = denorm_absent");
+ }
+
+ static void infinity()
+ {
+ printf("%s%s %s %s\n%s%s%s%s\n", tab2, "static",
+ declarator<T>::type_name, "infinity() throw()",
+ tab2, "{ return static_cast<", declarator<T>::type_name,
+ ">(0); }");
+ }
+
+ static void quiet_NaN()
+ {
+ printf("%s%s %s %s\n%s%s%s%s\n", tab2, "static",
+ declarator<T>::type_name, "quiet_NaN() throw()",
+ tab2, "{ return static_cast<", declarator<T>::type_name,
+ ">(0); }");
+ }
+
+ static void signaling_NaN()
+ {
+ printf("%s%s %s %s\n%s%s%s%s\n", tab2, "static",
+ declarator<T>::type_name, "signaling_NaN() throw()",
+ tab2, "{ return static_cast<", declarator<T>::type_name,
+ ">(0); }");
+ }
+
+ static void denorm_min()
+ {
+ printf("%s%s %s %s\n%s%s%s%s\n", tab2, "static",
+ declarator<T>::type_name, "denorm_min() throw()",
+ tab2, "{ return static_cast<", declarator<T>::type_name,
+ ">(0); }");
+ }
+};
+
+
+template<typename T>
+void is_iec559()
+{
+ printf("%s%s = %s;\n", tab2, "static const bool is_iec559",
+ bool_alpha[predicate<T>::is_iec559]);
+}
+
+// tinyness_before
+template<typename T>
+void tinyness_before()
+{
+ printf("%s%s;\n", tab2, "static const bool tinyness_before = false");
+}
+
+// round style
+template<typename T>
+void round_style()
+{
+ printf("%s%s;\n", tab2, "static const float_round_style "
+ "round_style = round_toward_zero");
+}
+
+
+
+// type traits
+template<typename T> struct type_trait {
+
+ type_trait()
+ {
+ declarator<T>::start();
+ printf("%s%s;\n\n", tab2, "static const bool is_specialized = true");
+ min<T>();
+ max<T>();
+ printf("\n");
+ digits<T>();
+ digits10<T>();
+ is_signed<T>();
+ is_integer<T>();
+ is_exact<T>();
+ radix<T>();
+ epsilon<T>();
+ round_error<T>();
+ printf("\n");
+ min_exponent<T>();
+ min_exponent10<T>();
+ max_exponent<T>();
+ max_exponent10<T>();
+ printf("\n");
+ has_infinity<T>();
+ has_quiet_nan<T>();
+ has_signaling_nan<T>();
+ infinity_trait<T>::has_denorm();
+ has_denorm_loss<T>();
+ printf("\n");
+ infinity_trait<T>::infinity();
+ infinity_trait<T>::quiet_NaN();
+ infinity_trait<T>::signaling_NaN();
+ infinity_trait<T>::denorm_min();
+ printf("\n");
+ is_iec559<T>();
+ printf("%s%s;\n", tab2, "static const bool is_bounded = true");
+ is_modulo<T>();
+ printf("\n");
+ traps<T>();
+ tinyness_before<T>();
+ round_style<T>();
+ declarator<T>::end();
+ }
+};
+
+int main()
+{
+ type_trait<bool>();
+
+ type_trait<char>();
+ type_trait<signed char>();
+ type_trait<unsigned char>();
+#if defined( _GLIBCPP_USE_WCHAR_T) && defined(_GLIBCPP_HAS_WCHAR_MIN_MAX)
+ type_trait<wchar_t>();
+#endif
+
+ type_trait<short>();
+ type_trait<unsigned short>();
+
+ type_trait<int>();
+ type_trait<unsigned int>();
+
+ type_trait<long>();
+ type_trait<unsigned long>();
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ type_trait<long long>();
+ type_trait<unsigned long long>();
+#endif
+
+ type_trait<float>();
+ type_trait<double>();
+ type_trait<long double>();
+
+ // x86/linux gets this weirdness for the min/max functions:
+ // static long double min() throw()
+ // { return (__extension__ ((union __convert_long_double)
+ // {__convert_long_double_i: {0x0, 0x80000000, 0x1, 0x0}})
+ // .__convert_long_double_d); }
+}
+
diff --git a/libstdc++-v3/src/ios.cc b/libstdc++-v3/src/ios.cc
new file mode 100644
index 000000000000..ca13e3991f5c
--- /dev/null
+++ b/libstdc++-v3/src/ios.cc
@@ -0,0 +1,321 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.4 Iostreams base classes
+//
+
+#include <bits/std_ios.h>
+#include <bits/std_iostream.h>
+#include <bits/std_fstream.h>
+
+namespace std {
+
+ // Out-of-line definitions for static const ios_base members.
+ const ios_base::fmtflags ios_base::boolalpha;
+ const ios_base::fmtflags ios_base::dec;
+ const ios_base::fmtflags ios_base::fixed;
+ const ios_base::fmtflags ios_base::hex;
+ const ios_base::fmtflags ios_base::internal;
+ const ios_base::fmtflags ios_base::left;
+ const ios_base::fmtflags ios_base::oct;
+ const ios_base::fmtflags ios_base::right;
+ const ios_base::fmtflags ios_base::scientific;
+ const ios_base::fmtflags ios_base::showbase;
+ const ios_base::fmtflags ios_base::showpoint;
+ const ios_base::fmtflags ios_base::showpos;
+ const ios_base::fmtflags ios_base::skipws;
+ const ios_base::fmtflags ios_base::unitbuf;
+ const ios_base::fmtflags ios_base::uppercase;
+ const ios_base::fmtflags ios_base::adjustfield;
+ const ios_base::fmtflags ios_base::basefield;
+ const ios_base::fmtflags ios_base::floatfield;
+
+ const ios_base::iostate ios_base::badbit;
+ const ios_base::iostate ios_base::eofbit;
+ const ios_base::iostate ios_base::failbit;
+ const ios_base::iostate ios_base::goodbit;
+
+ const ios_base::openmode ios_base::app;
+ const ios_base::openmode ios_base::ate;
+ const ios_base::openmode ios_base::binary;
+ const ios_base::openmode ios_base::in;
+ const ios_base::openmode ios_base::out;
+ const ios_base::openmode ios_base::trunc;
+
+ const ios_base::seekdir ios_base::beg;
+ const ios_base::seekdir ios_base::cur;
+ const ios_base::seekdir ios_base::end;
+
+ ios_base::failure::failure(const string& __str)
+ {
+ strncpy(_M_name, __str.c_str(), _M_bufsize);
+ _M_name[_M_bufsize - 1] = '\0';
+ }
+
+ int ios_base::Init::_M_ios_base_init = 0;
+
+ ios_base::Init::Init()
+ {
+ if (++_M_ios_base_init == 1)
+ {
+ // NB: std_iostream.h creates the four standard files with
+ // default buffers. At this point, we swap out the default
+ // buffers for the properly-constructed ones, and dispose of
+ // the default buffers.
+ streambuf* __old;
+ _M_cout = new filebuf(1, "stdout", ios_base::out);
+ _M_cin = new filebuf(0, "stdin", ios_base::in);
+ _M_cerr = new filebuf(2, "stderr", ios_base::out);
+ __old = cout.rdbuf(_M_cout);
+ __old->~streambuf();
+ __old = cin.rdbuf(_M_cin);
+ __old->~streambuf();
+ cin.tie(&cout);
+ __old = cerr.rdbuf(_M_cerr);
+ __old->~streambuf();
+ cerr.flags(ios_base::unitbuf);
+ __old = clog.rdbuf(_M_cerr);
+ __old->~streambuf();
+#ifdef _GLIBCPP_USE_WCHAR_T
+ wstreambuf* __wold;
+ _M_wcout = new wfilebuf(1, "stdout", ios_base::out);
+ _M_wcin = new wfilebuf(0, "stdin", ios_base::in);
+ _M_wcerr = new wfilebuf(2, "stderr", ios_base::out);
+ __wold = wcout.rdbuf(_M_wcout);
+ __wold->~wstreambuf();
+ __wold = wcin.rdbuf(_M_wcin);
+ __wold->~wstreambuf();
+ wcin.tie(&wcout);
+ __wold = wcerr.rdbuf(_M_wcerr);
+ __wold->~wstreambuf();
+ wcerr.flags(ios_base::unitbuf);
+ __wold = wclog.rdbuf(_M_wcerr);
+ __wold->~wstreambuf();
+#endif
+ }
+ }
+
+ ios_base::Init::~Init()
+ {
+ if (--_M_ios_base_init == 0)
+ {
+ cout.flush();
+ cerr.flush();
+ clog.flush();
+ delete _M_cout;
+ delete _M_cin;
+ delete _M_cerr;
+ _M_cout = NULL;
+ _M_cin = NULL;
+ _M_cerr = NULL;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ wcout.flush();
+ wcerr.flush();
+ wclog.flush();
+ delete _M_wcout;
+ delete _M_wcin;
+ delete _M_wcerr;
+ _M_wcout = NULL;
+ _M_wcin = NULL;
+ _M_wcerr = NULL;
+#endif
+ }
+ }
+
+ // 27.4.2.5 ios_base storage functions
+ int
+ ios_base::xalloc() throw()
+ {
+ // XXX MT
+ // XXX should be a symbol. (Reserve 0..3 for builtins.)
+ static int top = 4;
+ return top++;
+ }
+
+ // 27.4.2.5 iword/pword storage
+ ios_base::_Words&
+ ios_base::_M_grow_words(int ix)
+ {
+ // Precondition: _M_word_limit <= ix
+ _Words zero = { 0, 0 };
+ int newlimit = _S_local_words;
+ _Words* words = _M_word_array;
+ int i = 0;
+ if (_S_local_words <= ix)
+ {
+ newlimit = ix+1;
+ try
+ { words = new _Words[ix+1]; }
+ catch (...)
+ {
+ _M_dummy = zero; // XXX MT? Not on "normal" machines.
+ // XXX now in basic_ios
+ // _M_clear(_M_rdstate() | badbit); // may throw
+ return _M_dummy;
+ }
+ do { words[i] = _M_words[i]; } while (++i < _M_word_limit);
+ if (_M_words != _M_word_array) delete [] _M_words;
+ }
+
+ do { words[i] = zero; } while (++i < newlimit);
+ _M_words = words;
+ _M_word_limit = newlimit;
+ return words[ix];
+ }
+
+ // Called only by basic_ios<>::init.
+ void
+ ios_base::_M_init()
+ {
+ // NB: May be called more than once
+ _M_flags = skipws | dec;
+ _M_width = 0;
+ _M_precision = 6;
+ _M_callbacks = 0;
+ _M_words = 0;
+ _M_word_limit = 0;
+ _M_locale_ios = locale();
+ // No init needed for _M_word_array or _M_dummy.
+ }
+
+ // 27.4.2.3 ios_base locale functions
+ locale
+ ios_base::imbue(const locale& __loc)
+ {
+ locale __old = _M_locale_ios;
+ _M_locale_ios = __loc;
+ // Make sure there's a callback for the format caches so they will be
+ // marked dirty.
+ _Format_cache<char>::_S_get(*this);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ _Format_cache<wchar_t>::_S_get(*this);
+#endif
+ _M_call_callbacks(imbue_event);
+ return __old;
+ }
+
+ ios_base::ios_base()
+ {
+ // Do nothing; init() does it. Static init to 0 makes everything sane.
+ }
+
+ // 27.4.2.7 ios_base constructors/destructors
+ ios_base::~ios_base()
+ {
+ _M_call_callbacks(erase_event);
+ _M_dispose_callbacks();
+ if (_M_words != _M_word_array)
+ delete [] _M_words;
+ // XXX done?
+ }
+
+ void
+ ios_base::register_callback(event_callback __fn, int __index)
+ { _M_callbacks = new _Callback_list(__fn, __index, _M_callbacks); }
+
+ void
+ ios_base::_M_call_callbacks(event __e) throw()
+ {
+ for (_Callback_list* __p = _M_callbacks; __p; __p = __p->_M_next)
+ {
+ try {
+ (*__p->_M_fn) (__e, *this, __p->_M_index);
+ }
+ catch (...) {
+ }
+ }
+ }
+
+ void
+ ios_base::_M_dispose_callbacks(void)
+ {
+ _Callback_list* __p = _M_callbacks;
+ while (__p && __p->_M_remove_reference() == 0)
+ {
+ _Callback_list* __next = __p->_M_next;
+ delete __p;
+ __p = __next;
+ }
+ _M_callbacks = 0;
+ }
+
+ bool
+ ios_base::sync_with_stdio(bool __sync)
+ {
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ // 49. Underspecification of ios_base::sync_with_stdio
+ bool __retval = __ioinit._M_cin->_M_file->get_fileno() == 0;
+
+ // Turn off sync with C FILE* for cin, cout, cerr, clog.
+ if (!__sync && __retval)
+ {
+ __ioinit._M_cout = new filebuf();
+ __ioinit._M_cout->open("stdout", ios_base::out);
+ __ioinit._M_cin = new filebuf();
+ __ioinit._M_cin->open("stdin", ios_base::in);
+ __ioinit._M_cerr = new filebuf();
+ __ioinit._M_cerr->open("stderr", ios_base::out);
+ cout.rdbuf(__ioinit._M_cout);
+ cin.rdbuf(__ioinit._M_cin);
+ cerr.rdbuf(__ioinit._M_cerr);
+ cerr.flags(ios_base::unitbuf);
+ clog.rdbuf(__ioinit._M_cerr);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ __ioinit._M_wcout = new wfilebuf();
+ __ioinit._M_wcout->open("stdout", ios_base::out);
+ __ioinit._M_wcin = new wfilebuf();
+ __ioinit._M_wcin->open("stdin", ios_base::in);
+ __ioinit._M_wcerr = new wfilebuf();
+ __ioinit._M_wcerr->open("stderr", ios_base::out);
+ wcout.rdbuf(__ioinit._M_wcout);
+ wcin.rdbuf(__ioinit._M_wcin);
+ wcerr.rdbuf(__ioinit._M_wcerr);
+ wcerr.flags(ios_base::unitbuf);
+ wclog.rdbuf(__ioinit._M_wcerr);
+#endif
+ }
+
+ return __retval;
+#endif
+ }
+
+} // namespace std
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/src/limits_generic.cc b/libstdc++-v3/src/limits_generic.cc
new file mode 100644
index 000000000000..655e36550030
--- /dev/null
+++ b/libstdc++-v3/src/limits_generic.cc
@@ -0,0 +1,340 @@
+// Static data members of -*- C++ -*- numeric_limits classes
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
+
+//
+// ISO C++ 14882:1998
+// 18.2.1
+//
+
+#include <bits/std_limits.h>
+namespace std {
+
+ const bool numeric_limits<bool>::is_specialized;
+ const int numeric_limits<bool>::digits;
+ const int numeric_limits<bool>::digits10;
+ const bool numeric_limits<bool>::is_signed;
+ const bool numeric_limits<bool>::is_integer;
+ const bool numeric_limits<bool>::is_exact;
+ const int numeric_limits<bool>::radix;
+ const int numeric_limits<bool>::min_exponent;
+ const int numeric_limits<bool>::min_exponent10;
+ const int numeric_limits<bool>::max_exponent;
+ const int numeric_limits<bool>::max_exponent10;
+ const bool numeric_limits<bool>::has_infinity;
+ const bool numeric_limits<bool>::has_quiet_NaN;
+ const bool numeric_limits<bool>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<bool>::has_denorm;
+ const bool numeric_limits<bool>::has_denorm_loss;
+ const bool numeric_limits<bool>::is_iec559;
+ const bool numeric_limits<bool>::is_bounded;
+ const bool numeric_limits<bool>::is_modulo;
+ const bool numeric_limits<bool>::traps;
+ const bool numeric_limits<bool>::tinyness_before;
+ const float_round_style numeric_limits<bool>::round_style;
+
+ const bool numeric_limits<char>::is_specialized;
+ const int numeric_limits<char>::digits;
+ const int numeric_limits<char>::digits10;
+ const bool numeric_limits<char>::is_signed;
+ const bool numeric_limits<char>::is_integer;
+ const bool numeric_limits<char>::is_exact;
+ const int numeric_limits<char>::radix;
+ const int numeric_limits<char>::min_exponent;
+ const int numeric_limits<char>::min_exponent10;
+ const int numeric_limits<char>::max_exponent;
+ const int numeric_limits<char>::max_exponent10;
+ const bool numeric_limits<char>::has_infinity;
+ const bool numeric_limits<char>::has_quiet_NaN;
+ const bool numeric_limits<char>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<char>::has_denorm;
+ const bool numeric_limits<char>::has_denorm_loss;
+ const bool numeric_limits<char>::is_iec559;
+ const bool numeric_limits<char>::is_bounded;
+ const bool numeric_limits<char>::is_modulo;
+ const bool numeric_limits<char>::traps;
+ const bool numeric_limits<char>::tinyness_before;
+ const float_round_style numeric_limits<char>::round_style;
+
+ const bool numeric_limits<signed char>::is_specialized;
+ const int numeric_limits<signed char>::digits;
+ const int numeric_limits<signed char>::digits10;
+ const bool numeric_limits<signed char>::is_signed;
+ const bool numeric_limits<signed char>::is_integer;
+ const bool numeric_limits<signed char>::is_exact;
+ const int numeric_limits<signed char>::radix;
+ const int numeric_limits<signed char>::min_exponent;
+ const int numeric_limits<signed char>::min_exponent10;
+ const int numeric_limits<signed char>::max_exponent;
+ const int numeric_limits<signed char>::max_exponent10;
+ const bool numeric_limits<signed char>::has_infinity;
+ const bool numeric_limits<signed char>::has_quiet_NaN;
+ const bool numeric_limits<signed char>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<signed char>::has_denorm;
+ const bool numeric_limits<signed char>::has_denorm_loss;
+ const bool numeric_limits<signed char>::is_iec559;
+ const bool numeric_limits<signed char>::is_bounded;
+ const bool numeric_limits<signed char>::is_modulo;
+ const bool numeric_limits<signed char>::traps;
+ const bool numeric_limits<signed char>::tinyness_before;
+ const float_round_style numeric_limits<signed char>::round_style;
+
+ const bool numeric_limits<unsigned char>::is_specialized;
+ const int numeric_limits<unsigned char>::digits;
+ const int numeric_limits<unsigned char>::digits10;
+ const bool numeric_limits<unsigned char>::is_signed;
+ const bool numeric_limits<unsigned char>::is_integer;
+ const bool numeric_limits<unsigned char>::is_exact;
+ const int numeric_limits<unsigned char>::radix;
+ const int numeric_limits<unsigned char>::min_exponent;
+ const int numeric_limits<unsigned char>::min_exponent10;
+ const int numeric_limits<unsigned char>::max_exponent;
+ const int numeric_limits<unsigned char>::max_exponent10;
+ const bool numeric_limits<unsigned char>::has_infinity;
+ const bool numeric_limits<unsigned char>::has_quiet_NaN;
+ const bool numeric_limits<unsigned char>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<unsigned char>::has_denorm;
+ const bool numeric_limits<unsigned char>::has_denorm_loss;
+ const bool numeric_limits<unsigned char>::is_iec559;
+ const bool numeric_limits<unsigned char>::is_bounded;
+ const bool numeric_limits<unsigned char>::is_modulo;
+ const bool numeric_limits<unsigned char>::traps;
+ const bool numeric_limits<unsigned char>::tinyness_before;
+ const float_round_style numeric_limits<unsigned char>::round_style;
+
+ const bool numeric_limits<short>::is_specialized;
+ const int numeric_limits<short>::digits;
+ const int numeric_limits<short>::digits10;
+ const bool numeric_limits<short>::is_signed;
+ const bool numeric_limits<short>::is_integer;
+ const bool numeric_limits<short>::is_exact;
+ const int numeric_limits<short>::radix;
+ const int numeric_limits<short>::min_exponent;
+ const int numeric_limits<short>::min_exponent10;
+ const int numeric_limits<short>::max_exponent;
+ const int numeric_limits<short>::max_exponent10;
+ const bool numeric_limits<short>::has_infinity;
+ const bool numeric_limits<short>::has_quiet_NaN;
+ const bool numeric_limits<short>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<short>::has_denorm;
+ const bool numeric_limits<short>::has_denorm_loss;
+ const bool numeric_limits<short>::is_iec559;
+ const bool numeric_limits<short>::is_bounded;
+ const bool numeric_limits<short>::is_modulo;
+ const bool numeric_limits<short>::traps;
+ const bool numeric_limits<short>::tinyness_before;
+ const float_round_style numeric_limits<short>::round_style;
+
+ const bool numeric_limits<unsigned short>::is_specialized;
+ const int numeric_limits<unsigned short>::digits;
+ const int numeric_limits<unsigned short>::digits10;
+ const bool numeric_limits<unsigned short>::is_signed;
+ const bool numeric_limits<unsigned short>::is_integer;
+ const bool numeric_limits<unsigned short>::is_exact;
+ const int numeric_limits<unsigned short>::radix;
+ const int numeric_limits<unsigned short>::min_exponent;
+ const int numeric_limits<unsigned short>::min_exponent10;
+ const int numeric_limits<unsigned short>::max_exponent;
+ const int numeric_limits<unsigned short>::max_exponent10;
+ const bool numeric_limits<unsigned short>::has_infinity;
+ const bool numeric_limits<unsigned short>::has_quiet_NaN;
+ const bool numeric_limits<unsigned short>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<unsigned short>::has_denorm;
+ const bool numeric_limits<unsigned short>::has_denorm_loss;
+ const bool numeric_limits<unsigned short>::is_iec559;
+ const bool numeric_limits<unsigned short>::is_bounded;
+ const bool numeric_limits<unsigned short>::is_modulo;
+ const bool numeric_limits<unsigned short>::traps;
+ const bool numeric_limits<unsigned short>::tinyness_before;
+ const float_round_style numeric_limits<unsigned short>::round_style;
+
+ const bool numeric_limits<int>::is_specialized;
+ const int numeric_limits<int>::digits;
+ const int numeric_limits<int>::digits10;
+ const bool numeric_limits<int>::is_signed;
+ const bool numeric_limits<int>::is_integer;
+ const bool numeric_limits<int>::is_exact;
+ const int numeric_limits<int>::radix;
+ const int numeric_limits<int>::min_exponent;
+ const int numeric_limits<int>::min_exponent10;
+ const int numeric_limits<int>::max_exponent;
+ const int numeric_limits<int>::max_exponent10;
+ const bool numeric_limits<int>::has_infinity;
+ const bool numeric_limits<int>::has_quiet_NaN;
+ const bool numeric_limits<int>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<int>::has_denorm;
+ const bool numeric_limits<int>::has_denorm_loss;
+ const bool numeric_limits<int>::is_iec559;
+ const bool numeric_limits<int>::is_bounded;
+ const bool numeric_limits<int>::is_modulo;
+ const bool numeric_limits<int>::traps;
+ const bool numeric_limits<int>::tinyness_before;
+ const float_round_style numeric_limits<int>::round_style;
+
+ const bool numeric_limits<unsigned int>::is_specialized;
+ const int numeric_limits<unsigned int>::digits;
+ const int numeric_limits<unsigned int>::digits10;
+ const bool numeric_limits<unsigned int>::is_signed;
+ const bool numeric_limits<unsigned int>::is_integer;
+ const bool numeric_limits<unsigned int>::is_exact;
+ const int numeric_limits<unsigned int>::radix;
+ const int numeric_limits<unsigned int>::min_exponent;
+ const int numeric_limits<unsigned int>::min_exponent10;
+ const int numeric_limits<unsigned int>::max_exponent;
+ const int numeric_limits<unsigned int>::max_exponent10;
+ const bool numeric_limits<unsigned int>::has_infinity;
+ const bool numeric_limits<unsigned int>::has_quiet_NaN;
+ const bool numeric_limits<unsigned int>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<unsigned int>::has_denorm;
+ const bool numeric_limits<unsigned int>::has_denorm_loss;
+ const bool numeric_limits<unsigned int>::is_iec559;
+ const bool numeric_limits<unsigned int>::is_bounded;
+ const bool numeric_limits<unsigned int>::is_modulo;
+ const bool numeric_limits<unsigned int>::traps;
+ const bool numeric_limits<unsigned int>::tinyness_before;
+ const float_round_style numeric_limits<unsigned int>::round_style;
+
+ const bool numeric_limits<long>::is_specialized;
+ const int numeric_limits<long>::digits;
+ const int numeric_limits<long>::digits10;
+ const bool numeric_limits<long>::is_signed;
+ const bool numeric_limits<long>::is_integer;
+ const bool numeric_limits<long>::is_exact;
+ const int numeric_limits<long>::radix;
+ const int numeric_limits<long>::min_exponent;
+ const int numeric_limits<long>::min_exponent10;
+ const int numeric_limits<long>::max_exponent;
+ const int numeric_limits<long>::max_exponent10;
+ const bool numeric_limits<long>::has_infinity;
+ const bool numeric_limits<long>::has_quiet_NaN;
+ const bool numeric_limits<long>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<long>::has_denorm;
+ const bool numeric_limits<long>::has_denorm_loss;
+ const bool numeric_limits<long>::is_iec559;
+ const bool numeric_limits<long>::is_bounded;
+ const bool numeric_limits<long>::is_modulo;
+ const bool numeric_limits<long>::traps;
+ const bool numeric_limits<long>::tinyness_before;
+ const float_round_style numeric_limits<long>::round_style;
+
+ const bool numeric_limits<unsigned long>::is_specialized;
+ const int numeric_limits<unsigned long>::digits;
+ const int numeric_limits<unsigned long>::digits10;
+ const bool numeric_limits<unsigned long>::is_signed;
+ const bool numeric_limits<unsigned long>::is_integer;
+ const bool numeric_limits<unsigned long>::is_exact;
+ const int numeric_limits<unsigned long>::radix;
+ const int numeric_limits<unsigned long>::min_exponent;
+ const int numeric_limits<unsigned long>::min_exponent10;
+ const int numeric_limits<unsigned long>::max_exponent;
+ const int numeric_limits<unsigned long>::max_exponent10;
+ const bool numeric_limits<unsigned long>::has_infinity;
+ const bool numeric_limits<unsigned long>::has_quiet_NaN;
+ const bool numeric_limits<unsigned long>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<unsigned long>::has_denorm;
+ const bool numeric_limits<unsigned long>::has_denorm_loss;
+ const bool numeric_limits<unsigned long>::is_iec559;
+ const bool numeric_limits<unsigned long>::is_bounded;
+ const bool numeric_limits<unsigned long>::is_modulo;
+ const bool numeric_limits<unsigned long>::traps;
+ const bool numeric_limits<unsigned long>::tinyness_before;
+ const float_round_style numeric_limits<unsigned long>::round_style;
+
+ const bool numeric_limits<float>::is_specialized;
+ const int numeric_limits<float>::digits;
+ const int numeric_limits<float>::digits10;
+ const bool numeric_limits<float>::is_signed;
+ const bool numeric_limits<float>::is_integer;
+ const bool numeric_limits<float>::is_exact;
+ const int numeric_limits<float>::radix;
+ const int numeric_limits<float>::min_exponent;
+ const int numeric_limits<float>::min_exponent10;
+ const int numeric_limits<float>::max_exponent;
+ const int numeric_limits<float>::max_exponent10;
+ const bool numeric_limits<float>::has_infinity;
+ const bool numeric_limits<float>::has_quiet_NaN;
+ const bool numeric_limits<float>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<float>::has_denorm;
+ const bool numeric_limits<float>::has_denorm_loss;
+ const bool numeric_limits<float>::is_iec559;
+ const bool numeric_limits<float>::is_bounded;
+ const bool numeric_limits<float>::is_modulo;
+ const bool numeric_limits<float>::traps;
+ const bool numeric_limits<float>::tinyness_before;
+ const float_round_style numeric_limits<float>::round_style;
+
+ const bool numeric_limits<double>::is_specialized;
+ const int numeric_limits<double>::digits;
+ const int numeric_limits<double>::digits10;
+ const bool numeric_limits<double>::is_signed;
+ const bool numeric_limits<double>::is_integer;
+ const bool numeric_limits<double>::is_exact;
+ const int numeric_limits<double>::radix;
+ const int numeric_limits<double>::min_exponent;
+ const int numeric_limits<double>::min_exponent10;
+ const int numeric_limits<double>::max_exponent;
+ const int numeric_limits<double>::max_exponent10;
+ const bool numeric_limits<double>::has_infinity;
+ const bool numeric_limits<double>::has_quiet_NaN;
+ const bool numeric_limits<double>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<double>::has_denorm;
+ const bool numeric_limits<double>::has_denorm_loss;
+ const bool numeric_limits<double>::is_iec559;
+ const bool numeric_limits<double>::is_bounded;
+ const bool numeric_limits<double>::is_modulo;
+ const bool numeric_limits<double>::traps;
+ const bool numeric_limits<double>::tinyness_before;
+ const float_round_style numeric_limits<double>::round_style;
+
+ const bool numeric_limits<long double>::is_specialized;
+ const int numeric_limits<long double>::digits;
+ const int numeric_limits<long double>::digits10;
+ const bool numeric_limits<long double>::is_signed;
+ const bool numeric_limits<long double>::is_integer;
+ const bool numeric_limits<long double>::is_exact;
+ const int numeric_limits<long double>::radix;
+ const int numeric_limits<long double>::min_exponent;
+ const int numeric_limits<long double>::min_exponent10;
+ const int numeric_limits<long double>::max_exponent;
+ const int numeric_limits<long double>::max_exponent10;
+ const bool numeric_limits<long double>::has_infinity;
+ const bool numeric_limits<long double>::has_quiet_NaN;
+ const bool numeric_limits<long double>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<long double>::has_denorm;
+ const bool numeric_limits<long double>::has_denorm_loss;
+ const bool numeric_limits<long double>::is_iec559;
+ const bool numeric_limits<long double>::is_bounded;
+ const bool numeric_limits<long double>::is_modulo;
+ const bool numeric_limits<long double>::traps;
+ const bool numeric_limits<long double>::tinyness_before;
+ const float_round_style numeric_limits<long double>::round_style;
+} // namespace std
+
+
diff --git a/libstdc++-v3/src/locale-inst.cc b/libstdc++-v3/src/locale-inst.cc
new file mode 100644
index 000000000000..81fb20951850
--- /dev/null
+++ b/libstdc++-v3/src/locale-inst.cc
@@ -0,0 +1,311 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+#include <bits/std_clocale.h>
+#include <bits/std_cstring.h>
+#include <bits/std_cassert.h>
+#include <bits/std_limits.h>
+#include <bits/std_exception.h>
+#include <bits/std_stdexcept.h>
+#include <bits/std_locale.h>
+#include <bits/locale_facets.tcc>
+#include <bits/std_istream.h>
+#include <bits/std_ostream.h>
+
+namespace std {
+
+ typedef ostreambuf_iterator<char, char_traits<char> > obuf_iterator;
+ typedef istreambuf_iterator<char, char_traits<char> > ibuf_iterator;
+ typedef ostreambuf_iterator<wchar_t, char_traits<wchar_t> > wobuf_iterator;
+ typedef istreambuf_iterator<wchar_t, char_traits<wchar_t> > wibuf_iterator;
+
+ // moneypunct, money_get, and money_put
+
+ const money_base::pattern
+ money_base::__default_pattern = {{symbol, sign, none, value}};
+
+ template class moneypunct<char, false>;
+ template class moneypunct<char, true>;
+ template class moneypunct_byname<char, false>;
+ template class moneypunct_byname<char, true>;
+ template class _Moneypunct<char>;
+ template class money_get<char, obuf_iterator>;
+ template class money_put<char, obuf_iterator>;
+ template class money_get<char, ibuf_iterator>;
+ template class money_put<char, ibuf_iterator>;
+ template class _Format_cache<char>;
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class moneypunct<wchar_t, false>;
+ template class moneypunct<wchar_t, true>;
+ template class moneypunct_byname<wchar_t, false>;
+ template class moneypunct_byname<wchar_t, true>;
+ template class _Moneypunct<wchar_t>;
+ template class money_get<wchar_t, wobuf_iterator>;
+ template class money_put<wchar_t, wobuf_iterator>;
+ template class money_get<wchar_t, wibuf_iterator>;
+ template class money_put<wchar_t, wibuf_iterator>;
+ template class _Format_cache<wchar_t>;
+#endif
+
+ // numpunct, numpunct_byname, num_get, and num_put
+ template class numpunct<char>;
+ template class numpunct_byname<char>;
+ template class _Numpunct<char>;
+ template class num_get<char, ibuf_iterator>;
+ template class num_put<char, obuf_iterator>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class numpunct<wchar_t>;
+ template class numpunct_byname<wchar_t>;
+ template class _Numpunct<wchar_t>;
+ template class num_get<wchar_t, wibuf_iterator>;
+ template class num_put<wchar_t, wobuf_iterator>;
+#endif
+
+ // _Punct
+ template class _Punct<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class _Punct<wchar_t>;
+#endif
+
+ // time_get and time_put
+ //template class time_get<char, obuf_iterator>;
+ template class time_put<char, obuf_iterator>;
+ template class time_get<char, ibuf_iterator>;
+ template class time_put<char, ibuf_iterator>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ //template class time_get<wchar_t, wobuf_iterator>;
+ template class time_put<wchar_t, wobuf_iterator>;
+ template class time_get<wchar_t, wibuf_iterator>;
+ template class time_put<wchar_t, wibuf_iterator>;
+#endif
+
+ // messages
+ template class _Messages<char>;
+ template class messages<char>;
+ template class messages_byname<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class _Messages<wchar_t>;
+ template class messages<wchar_t>;
+ template class messages_byname<wchar_t>;
+#endif
+
+ // ctype
+ // template class ctype<unsigned char>; // No definitions avail.
+ // template class ctype<signed char>; // No definitions avail.
+ template class _Ctype<char>;
+ template class _Ctype_nois<char>;
+ template class ctype_byname<char>;
+ template class _Codecvt<char, char, mbstate_t>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class _Ctype<wchar_t>;
+ template class _Ctype_nois<wchar_t>;
+ template class ctype_byname<wchar_t>;
+ template class _Codecvt<wchar_t, char, mbstate_t>;
+#endif
+
+ // collate
+ template class _Collate<char>;
+ template class collate_byname<char>;
+ template class _Weekdaynames<char, int>;
+ template class _Monthnames<char, int>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class _Collate<wchar_t>;
+ template class collate_byname<wchar_t>;
+ template class _Weekdaynames<wchar_t, int>;
+ template class _Monthnames<wchar_t, int>;
+#endif
+
+ // use_facet
+ template
+ const num_put<char, obuf_iterator >&
+ use_facet<num_put<char, obuf_iterator> >(const locale &);
+ template
+ const num_get<char, ibuf_iterator >&
+ use_facet<num_get<char, ibuf_iterator> >(const locale &);
+ template
+ const ctype<char>&
+ use_facet<ctype<char> >(const locale& __loc);
+ template
+ const codecvt<char, char, mbstate_t>&
+ use_facet<codecvt<char, char, mbstate_t> >(locale const &);
+ template
+ const num_put<char, obuf_iterator>&
+ _Use_facet_failure_handler<num_put<char, obuf_iterator> >
+ (const locale &);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template
+ const num_put<wchar_t, wobuf_iterator>&
+ use_facet<num_put<wchar_t, wobuf_iterator> >(const locale &);
+ template
+ const num_get<wchar_t, wibuf_iterator>&
+ use_facet<num_get<wchar_t, wibuf_iterator> >(const locale &);
+ template
+ const ctype<wchar_t>&
+ use_facet<ctype<wchar_t> >(const locale& __loc);
+ template
+ const codecvt<wchar_t, wchar_t, mbstate_t>&
+ use_facet<codecvt<wchar_t, wchar_t, mbstate_t> >(locale const &);
+ template
+ const codecvt<wchar_t, char, mbstate_t>&
+ use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const &);
+ template
+ const num_put<wchar_t, wobuf_iterator>&
+ _Use_facet_failure_handler<num_put<wchar_t, wobuf_iterator> >
+ (const locale &);
+#endif
+
+ // has_facet
+ template
+ bool
+ has_facet<numpunct<char> >(const locale &);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template
+ bool
+ has_facet<numpunct<wchar_t> >(const locale &);
+#endif
+
+ //
+ // iterator
+ //
+ typedef vector<locale::facet*> vec_pfacet;
+ template
+ void
+ vec_pfacet::
+ insert(vec_pfacet::iterator, vec_pfacet::size_type,
+ const vec_pfacet::value_type&);
+
+ typedef istreambuf_iterator<char, char_traits<char> > istreambuf_iter;
+ typedef ostreambuf_iterator<char, char_traits<char> > ostreambuf_iter;
+
+
+ template
+ istreambuf_iter
+ __match_parallel<istreambuf_iter, char>
+ (istreambuf_iter, istreambuf_iter, int, const string*, int*, int&, bool&);
+
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ typedef istreambuf_iterator<wchar_t,char_traits<wchar_t> > wistreambuf_iter;
+ typedef ostreambuf_iterator<wchar_t,char_traits<wchar_t> > wostreambuf_iter;
+
+ template
+ wistreambuf_iter
+ __match_parallel<wistreambuf_iter, wchar_t>
+ (wistreambuf_iter, wistreambuf_iter, int, const wstring*, int*, int&, bool&);
+#endif
+
+
+ //
+ // locale
+ //
+ template
+ bool
+ locale::operator()(const string&, const string&) const;
+
+ template
+ ostreambuf_iter
+ _S_fill<char, ostreambuf_iter, output_iterator_tag>
+ (ostreambuf_iter, char, int, output_iterator_tag);
+
+ template
+ ostreambuf_iter
+ _S_pad_numeric<char, ostreambuf_iter>
+ (ostreambuf_iter, ios_base::fmtflags, char, int, char const*, char const*,
+ char const*);
+
+ template
+ char*
+ _S_group_digits<char>(char*, char, char const*, char const*,
+ char const*, char const*);
+
+ template
+ ostreambuf_iter
+ _S_format<char, ostreambuf_iter, unsigned long>
+ (ostreambuf_iter, ios_base &, char, bool, unsigned long);
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ template
+ ostreambuf_iter
+ _S_format<char, ostreambuf_iter, unsigned long long>
+ (ostreambuf_iter, ios_base &, char, bool, unsigned long long);
+#endif
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template
+ bool
+ locale::operator()(const wstring&, const wstring&) const;
+
+ typedef ostreambuf_iterator<wchar_t> wostreambuf_iter;
+
+ template
+ wostreambuf_iter
+ _S_fill<wchar_t, wostreambuf_iter, output_iterator_tag>
+ (wostreambuf_iter, wchar_t, int, output_iterator_tag);
+
+ template
+ wostreambuf_iter
+ _S_pad_numeric<wchar_t, wostreambuf_iter>
+ (wostreambuf_iter, ios_base::fmtflags, wchar_t __fill, int, wchar_t const*,
+ wchar_t const*, wchar_t const*);
+
+ template
+ wchar_t*
+ _S_group_digits<wchar_t>(wchar_t*, wchar_t, char const*, char const*,
+ wchar_t const*, wchar_t const*);
+
+ template
+ wostreambuf_iter
+ _S_format<wchar_t, wostreambuf_iter, unsigned long>
+ (wostreambuf_iter, ios_base &, wchar_t, bool, unsigned long);
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ template
+ wostreambuf_iter
+ _S_format<wchar_t, wostreambuf_iter, unsigned long long>
+ (wostreambuf_iter, ios_base &, wchar_t, bool, unsigned long long);
+#endif
+#endif // _GLIBCPP_USE_WCHAR_T
+
+ template
+ locale::facet**
+ fill_n<locale::facet**, unsigned int, locale::facet*>
+ (locale::facet**, unsigned int, locale::facet* const &);
+
+} //std
+
+
+
+
+
+
diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc
new file mode 100644
index 000000000000..73112fd38451
--- /dev/null
+++ b/libstdc++-v3/src/locale.cc
@@ -0,0 +1,820 @@
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <bits/std_clocale.h>
+#include <bits/std_cstring.h>
+#include <bits/std_cassert.h>
+#include <bits/std_cctype.h>
+#include <bits/std_limits.h>
+#include <bits/std_exception.h>
+#include <bits/std_stdexcept.h>
+#include <bits/std_locale.h>
+#include <bits/std_istream.h>
+#include <bits/std_ostream.h>
+#include <bits/std_vector.h>
+#include <bits/std_memory.h> // for auto_ptr
+
+namespace std {
+
+ // locale::_Impl
+ locale::_Impl::~_Impl() throw ()
+ {
+ std::vector<facet*>::iterator it = _M_facets->begin();
+ for (; it != _M_facets->end(); ++it)
+ (*it)->_M_remove_reference();
+ delete _M_facets;
+ delete _M_category_names;
+ }
+
+ locale::_Impl::_Impl(size_t __numfacets, size_t __refs)
+ : _M_num_references(__refs - 1)
+ , _M_facets(0)
+ , _M_category_names(0)
+ , _M_has_name(false)
+ , _M_cached_name_ok(false)
+ , _M_cached_name(string ("*"))
+ {
+ typedef vector<facet*, allocator<facet*> > __vec_facet;
+ typedef vector<string, allocator<string> > __vec_string;
+
+ auto_ptr<__vec_facet> __pvf(new __vec_facet(__numfacets, (facet*)0));
+ auto_ptr<__vec_string> __pcn(new __vec_string(_S_num_categories,
+ string("*")));
+ _M_facets = __pvf.release();
+ _M_category_names = __pcn.release();
+ }
+
+ locale::_Impl::_Impl(const _Impl& __other, size_t __refs)
+ : _M_num_references(__refs)
+ , _M_facets(0)
+ , _M_category_names(0)
+ , _M_has_name(__other._M_has_name)
+ , _M_cached_name_ok(__other._M_cached_name_ok)
+ , _M_cached_name(__other._M_cached_name)
+ {
+ typedef vector<facet*, allocator<facet*> > __vec_facet;
+ typedef vector<string, allocator<string> > __vec_string;
+
+ auto_ptr<__vec_facet> __pvf(new __vec_facet(*(__other._M_facets)));
+ auto_ptr<__vec_string>
+ __pcn(new __vec_string(*(__other._M_category_names)));
+
+ std::vector<facet*>::iterator __it = __pvf->begin();
+ for (; __it != __pvf->end(); ++__it)
+ (*__it)->_M_add_reference();
+
+ // these must be last since in the presence of an exception, the
+ // destructor for 'this' won't run until AFTER execution has passed
+ // the closing brace of the constructor
+ _M_facets = __pvf.release();
+ _M_category_names = __pcn.release();
+ }
+
+ void
+ locale::_Impl::_M_replace_categories(const _Impl* __other, category __cats)
+ {
+ assert((__cats & locale::all) && !(__cats & ~locale::all));
+
+ unsigned mask = (locale::all & -(unsigned)locale::all);
+ for (unsigned ix = 0; (-mask & __cats) != 0; ++ix, (mask <<= 1))
+ {
+ if (mask & __cats)
+ {
+ _M_replace_category(__other, _S_facet_categories[ix]);
+ (*_M_category_names)[ix] = (*(__other->_M_category_names))[ix];
+ }
+ }
+ }
+
+ void
+ locale::_Impl::_M_replace_category(const _Impl* __other,
+ const locale::id* const* __idpp)
+ {
+ for (; *__idpp; ++__idpp)
+ _M_replace_facet(__other, *__idpp);
+ }
+
+ void
+ locale::_Impl::_M_replace_facet(const _Impl* __other,
+ const locale::id* __idp)
+ {
+ size_t __index = __idp->_M_index;
+ if (__index == 0
+ || __other->_M_facets->size() <= __index
+ || (*(__other->_M_facets))[__index] == 0)
+ throw runtime_error("no locale facet");
+
+ _M_install_facet(__idp, (*(__other->_M_facets))[__index]);
+ }
+
+ void
+ locale::_Impl::_M_install_facet(const locale::id* __idp, facet* __fp)
+ {
+ if (__fp == 0)
+ return;
+
+ size_t& __index = __idp->_M_index;
+ if (!__index)
+ __index = ++locale::id::_S_highwater; // XXX MT
+
+ if (__index >= _M_facets->size())
+ _M_facets->resize(__index + 1, 0); // might throw
+ facet*& __fpr = (*_M_facets)[__index];
+ // order matters, here:
+ __fp->_M_add_reference();
+ if (__fpr)
+ __fpr->_M_remove_reference();
+ __fpr = __fp;
+ }
+
+ // locale facet category descriptions
+ const locale::id* const
+ locale::_Impl::_S_id_collate[] =
+ {
+ &std::collate<char>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &std::collate<wchar_t>::id,
+#endif
+ 0
+ };
+
+ const locale::id* const
+ locale::_Impl::_S_id_ctype[] =
+ {
+ &std::ctype<char>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &std::ctype<wchar_t>::id,
+#endif
+ &std::codecvt<char, char, mbstate_t>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &std::codecvt<wchar_t, char, mbstate_t>::id,
+#endif
+ 0
+ };
+
+ const locale::id* const
+ locale::_Impl::_S_id_monetary[] =
+ {
+ &std::moneypunct<char, false>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &std::moneypunct<wchar_t, false>::id,
+#endif
+ &std::moneypunct<char,true >::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &std::moneypunct<wchar_t,true >::id,
+#endif
+ &std::money_get<char>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &std::money_get<wchar_t>::id,
+#endif
+ &std::money_put<char>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &std::money_put<wchar_t>::id,
+#endif
+ 0
+ };
+
+ const locale::id* const
+ locale::_Impl::_S_id_numeric[] =
+ {
+ &std::numpunct<char>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &std::numpunct<wchar_t>::id,
+#endif
+ &std::num_get<char>::id,
+ #ifdef _GLIBCPP_USE_WCHAR_T
+ &std::num_get<wchar_t>::id,
+#endif
+ &std::num_put<char>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &std::num_put<wchar_t>::id,
+#endif
+ 0
+ };
+
+ const locale::id* const
+ locale::_Impl::_S_id_time[] =
+ {
+ &std::time_get<char>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &std::time_get<wchar_t>::id,
+#endif
+ &std::time_put<char>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &std::time_put<wchar_t>::id,
+#endif
+ 0
+ };
+
+ const locale::id* const
+ locale::_Impl::_S_id_messages[] =
+ {
+ &std::time_get<char>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &std::time_get<wchar_t>::id,
+#endif
+ &std::time_put<char>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &std::time_put<wchar_t>::id,
+#endif
+ 0
+ };
+
+ const locale::id* const* const
+ locale::_Impl::_S_facet_categories[] =
+ {
+ // order must match the decl order in class locale.
+ locale::_Impl::_S_id_collate,
+ locale::_Impl::_S_id_ctype,
+ locale::_Impl::_S_id_monetary,
+ locale::_Impl::_S_id_numeric,
+ locale::_Impl::_S_id_time,
+ locale::_Impl::_S_id_messages,
+ 0
+ };
+
+ locale::_Impl* locale::_S_global; // init'd to 0 before static ctors run
+ locale::_Impl* locale::_S_classic; // init'd to 0 before static ctors run
+
+ locale::locale(_Impl* __ip) throw ()
+ : _M_impl(__ip)
+ { __ip->_M_add_reference(); }
+
+ locale::locale(const locale& __other, const locale& __one, category __cats)
+ {
+ __cats = _S_normalize_category(__cats); // might throw
+ _M_impl = new _Impl(*__other._M_impl, 1); // might throw
+
+ try {
+ _M_impl->_M_replace_categories(__one._M_impl, __cats);
+ }
+ catch (...) {
+ _M_impl->_M_remove_reference();
+ throw;
+ }
+
+ _M_impl->_M_cached_name_ok = false;
+ if (!__other._M_impl->_M_has_name)
+ _M_impl->_M_has_name = false;
+ }
+
+ const locale&
+ locale::operator=(const locale& __other) throw ()
+ {
+ __other._M_impl->_M_add_reference();
+ _M_impl->_M_remove_reference();
+ _M_impl = __other._M_impl;
+ return *this;
+ }
+
+ locale
+ locale::global(const locale& __other)
+ {
+ // XXX MT
+ _S_initialize();
+ locale __keep(_S_global);
+ __other._M_impl->_M_add_reference();
+ _S_global->_M_remove_reference();
+ _S_global = __other._M_impl;
+ if (_S_global->_M_has_name)
+ setlocale(LC_ALL, __other.name().c_str());
+ return __keep;
+ }
+
+ string
+ locale::name() const
+ {
+ // XXX not done
+ return "*";
+ }
+
+ locale const&
+ locale::classic()
+ {
+ static locale* __classic_locale;
+ // XXX MT
+ if (!_S_classic)
+ {
+ try {
+ _S_classic = _S_global = new _Impl(26u, 2u);
+ // one reference for _M_classic, one for _M_global
+ // (constructor for (*the_classic_locale) adds a third)
+
+ // collate category
+ _S_classic->_M_init_facet(new std::collate<char>);
+
+ // ctype category
+ _S_classic->_M_init_facet(new std::ctype<char>);
+ _S_classic->_M_init_facet(new std::codecvt<char, char, mbstate_t>);
+
+ // monetary category
+ _S_classic->_M_init_facet(new std::moneypunct<char, false>);
+ _S_classic->_M_init_facet(new std::moneypunct<char,true >);
+ _S_classic->_M_init_facet(new std::money_get<char>);
+ _S_classic->_M_init_facet(new std::money_put<char>);
+
+ // numeric category
+ _S_classic->_M_init_facet(new std::numpunct<char>);
+ _S_classic->_M_init_facet(new std::num_get<char>);
+ _S_classic->_M_init_facet(new std::num_put<char>);
+
+ // time category
+ _S_classic->_M_init_facet(new std::time_get<char>);
+ _S_classic->_M_init_facet(new std::time_put<char>);
+
+ // messages category
+ _S_classic->_M_init_facet(new std::messages<char>);
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ _S_classic->_M_init_facet(new std::collate<wchar_t>);
+ _S_classic->_M_init_facet(new std::ctype<wchar_t>);
+ _S_classic->_M_init_facet(new std::codecvt<wchar_t, char, mbstate_t>);
+ _S_classic->_M_init_facet(new std::moneypunct<wchar_t, false>);
+ _S_classic->_M_init_facet(new std::moneypunct<wchar_t,true >);
+ _S_classic->_M_init_facet(new std::money_get<wchar_t>);
+ _S_classic->_M_init_facet(new std::money_put<wchar_t>);
+ _S_classic->_M_init_facet(new std::numpunct<wchar_t>);
+ _S_classic->_M_init_facet(new std::num_get<wchar_t>);
+ _S_classic->_M_init_facet(new std::num_put<wchar_t>);
+ _S_classic->_M_init_facet(new std::time_get<wchar_t>);
+ _S_classic->_M_init_facet(new std::time_put<wchar_t>);
+ _S_classic->_M_init_facet(new std::messages<wchar_t>);
+#endif
+
+ // finesse static init order hassles
+ __classic_locale = new locale(_S_classic);
+ }
+ catch(...) {
+ delete __classic_locale;
+ if (_S_classic)
+ {
+ _S_classic->_M_remove_reference();
+ _S_global->_M_remove_reference();
+ }
+ _S_classic = _S_global = 0;
+ // XXX MT
+ throw;
+ }
+ }
+ return *__classic_locale;
+ }
+
+ int
+ locale::_S_normalize_category(int __cats)
+ {
+ if ((__cats & all) && !(__cats & ~all))
+ return __cats;
+
+ // NB: May be a C-style "LC_ALL" category; convert.
+ switch (__cats)
+ {
+ case LC_COLLATE: return collate;
+ case LC_CTYPE: return ctype;
+ case LC_MONETARY: return monetary;
+ case LC_NUMERIC: return numeric;
+ case LC_TIME: return time;
+#ifdef _GLIBCPP_HAVE_LC_MESSAGES
+ case LC_MESSAGES: return messages;
+#endif
+ case LC_ALL: return all;
+ }
+
+ // XXX should throw derived class here
+ throw runtime_error("bad locale category");
+ /* NOTREACHED */
+ }
+
+ locale::facet::facet(size_t __refs) throw ()
+ : _M_num_references(__refs - 1)
+ { }
+
+ void
+ locale::facet::_M_add_reference() throw ()
+ {
+ if (this)
+ ++_M_num_references;
+ } // XXX MT
+
+ void
+ locale::facet::_M_remove_reference() throw ()
+ {
+ if (this && _M_num_references-- == 0)
+ {
+ try {
+ delete this;
+ } // XXX MT
+ catch (...) {
+ }
+ }
+ }
+
+ char const*
+ _Bad_use_facet::what() const throw()
+ { return "bad_cast thrown from use_facet"; }
+
+ _Bad_use_facet::~_Bad_use_facet() throw() {}
+
+ size_t locale::id::_S_highwater; // init'd to 0 by linker
+
+
+ // Platform-specific initialization code for ctype tables.
+ #include <ctype.cc>
+
+ locale::id ctype<char>::id;
+
+ ctype<char>::~ctype()
+ { if (_M_del) delete[] table(); }
+
+ char
+ ctype<char>::do_widen(char __c) const
+ { return __c; }
+
+ const char*
+ ctype<char>::
+ do_widen(const char* __low, const char* __high, char* __dest) const
+ {
+ memcpy(__dest, __low, __high - __low);
+ return __high;
+ }
+
+ char
+ ctype<char>::do_narrow(char __c, char /*__dfault*/) const
+ { return __c; }
+
+ const char*
+ ctype<char>::
+ do_narrow(const char* __low, const char* __high, char /*__dfault*/,
+ char* __dest) const
+ {
+ memcpy(__dest, __low, __high - __low);
+ return __high;
+ }
+
+ ctype_byname<char>::ctype_byname(const char* /*__s*/, size_t __refs)
+ : ctype<char> (new mask[table_size], true, __refs)
+ { }
+
+ locale::id codecvt<char, char, mbstate_t>::id;
+
+ codecvt<char, char, mbstate_t>::codecvt(size_t __refs)
+ : _Codecvt<char, char, mbstate_t> (__refs)
+ { }
+
+ codecvt<char, char, mbstate_t>::~codecvt() { }
+
+ codecvt_base::result
+ codecvt<char, char, mbstate_t>::
+ do_out(state_type& /*__state*/, const intern_type* __from,
+ const intern_type* __from_end, const intern_type*& __from_next,
+ extern_type* __to, extern_type* __to_end,
+ extern_type*& __to_next) const
+ {
+ size_t __sizefrom = __from_end - __from;
+ size_t __sizeto = __to_end - __to;
+ size_t __length = __sizefrom <= __sizeto ? __sizefrom : __sizeto;
+ memcpy(__to, __from, __length);
+ __from_next = __from;
+ __to_next = __to;
+ return noconv;
+ }
+
+ codecvt_base::result
+ codecvt<char, char, mbstate_t>::
+ do_unshift(state_type& /*__state*/, extern_type* __to,
+ extern_type* /*__to_limit*/,
+ extern_type*& __to_next) const
+ {
+ __to_next = __to;
+ return noconv;
+ }
+
+ codecvt_base::result
+ codecvt<char, char, mbstate_t>::
+ do_in(state_type& /*__state*/, const extern_type* __from,
+ const extern_type* __from_end, const extern_type*& __from_next,
+ intern_type* __to, intern_type* __to_end,
+ intern_type*& __to_next) const
+ {
+ size_t __sizefrom = __from_end - __from;
+ size_t __sizeto = __to_end - __to;
+ size_t __length = __sizefrom <= __sizeto ? __sizefrom : __sizeto;
+ memcpy(__to, __from, __length);
+ __from_next = __from;
+ __to_next = __to;
+ return noconv;
+ }
+
+
+ int
+ codecvt<char, char, mbstate_t>::do_encoding() const throw ()
+ { return 1; }
+
+ bool
+ codecvt<char, char, mbstate_t>::do_always_noconv() const throw ()
+ { return true; }
+
+ int
+ codecvt<char, char, mbstate_t>::
+ do_length (const state_type& /*__state*/, const extern_type* __from,
+ const extern_type* __end, size_t __max) const
+ { return (__max < size_t(__end - __from)) ? __max : __end - __from; }
+
+ int
+ codecvt<char, char, mbstate_t>::do_max_length() const throw ()
+ { return 1; }
+
+ codecvt_byname<char, char, mbstate_t>::
+ codecvt_byname(const char* /*__s*/, size_t __refs)
+ : codecvt<char, char, mbstate_t>(__refs)
+ { }
+
+ codecvt_byname<char, char, mbstate_t>::~codecvt_byname() { }
+
+ locale::id collate<char>::id;
+
+ collate<char>::collate(size_t __refs)
+ : _Collate<char> (__refs)
+ { }
+
+ collate<char>::~collate() { }
+
+ int
+ collate<char>::do_compare(const char* __lo1, const char* __hi1,
+ const char* __lo2, const char* __hi2) const
+ {
+ for (; __lo1 < __hi1 && __lo2 < __hi2; ++__lo1, ++__lo2)
+ if (*__lo1 != *__lo2)
+ return (*__lo1 < *__lo2) ? -1 : 1;
+ if (__lo1 < __hi1)
+ return 1;
+ else if (__lo2 < __hi2)
+ return -1;
+ else
+ return 0;
+ }
+
+ string
+ collate<char>::do_transform(const char* __lo, const char* __hi) const
+ { return string(__lo, __hi - __lo); }
+
+ long
+ collate<char>::do_hash(const char* __lo, const char* __hi) const
+ {
+ unsigned long __val = 0xdeadbeef;
+ for (; __lo < __hi; ++__lo)
+ __val = *__lo ^ ((__val << 7) &
+ (__val >> (numeric_limits<unsigned long>::digits - 1)));
+ return __val;
+ }
+
+ collate_byname<char>::collate_byname(const char* /*__s*/, size_t __refs)
+ : collate<char> (__refs)
+ { }
+
+ numpunct_byname<char>::numpunct_byname(const char* /*__s*/, size_t __refs)
+ : numpunct<char> (__refs)
+ { }
+
+ moneypunct_byname<char, false>::
+ moneypunct_byname(const char* /*__s*/, size_t __refs)
+ : moneypunct<char, false> (__refs)
+ { }
+
+ moneypunct_byname<char, true>::
+ moneypunct_byname(const char* /*__s*/, size_t __refs)
+ : moneypunct<char, true> (__refs)
+ { }
+
+ messages_byname<char>::messages_byname(const char* /*__s*/, size_t __refs)
+ : messages<char> (__refs)
+ { }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ locale::id ctype<wchar_t>::id;
+
+ ctype<wchar_t>::~ctype() { }
+
+ bool
+ ctype<wchar_t>::do_is(mask __m, char_type __c) const
+ {
+ return ((static_cast<__table_type>(__c) < _S_table_size)
+ && (_M_ctable[__c] & __m));
+ }
+
+ const wchar_t*
+ ctype<wchar_t>::do_is(const wchar_t* __low, const wchar_t* __high,
+ mask* __vec) const
+ {
+ for (; __low < __high; ++__low, ++__vec)
+ *__vec = ((static_cast<__table_type>(*__low) < _S_table_size)
+ ? _M_ctable[*__low] : mask(0));
+ return __high;
+ }
+
+ const wchar_t*
+ ctype<wchar_t>::do_scan_is(mask __m, const wchar_t* __low,
+ const wchar_t* __high) const
+ {
+ while (__low < __high
+ && (_S_table_size < static_cast<__table_type>(*__low)
+ || !(_M_ctable[*__low] & __m)))
+ ++__low;
+ return __low;
+ }
+
+ const wchar_t*
+ ctype<wchar_t>::do_scan_not(mask __m, const char_type* __low,
+ const char_type* __high) const
+ {
+ while (__low < __high
+ && static_cast<__table_type>(*__low) < _S_table_size
+ && (_M_ctable[*__low] & __m))
+ ++__low;
+ return __low;
+ }
+
+ wchar_t
+ ctype<wchar_t>::do_widen(char __c) const
+ { return static_cast<wchar_t>((unsigned char)__c); }
+
+ const char*
+ ctype<wchar_t>::do_widen(const char* __low, const char* __high,
+ wchar_t* __dest) const
+ {
+ while (__low < __high)
+ *__dest++ = static_cast<wchar_t>((unsigned char)*__low++);
+ return __high;
+ }
+
+ char
+ ctype<wchar_t>::do_narrow(wchar_t __c, char __dfault) const
+ {
+ return ((static_cast<__table_type>(__c) < _S_table_size)
+ ? static_cast<char>(__c) : __dfault);
+ }
+
+ const wchar_t*
+ ctype<wchar_t>::do_narrow(const wchar_t* __low, const wchar_t* __high,
+ char __dfault, char* __dest) const
+ {
+ for (; __low < __high; ++__dest, ++__low)
+ *__dest = (static_cast<__table_type>(*__low) < _S_table_size)
+ ? static_cast<char>(*__low) : __dfault;
+ return __high;
+ }
+
+ ctype_byname<wchar_t>::ctype_byname(const char* /*__s*/, size_t __refs)
+ : ctype<wchar_t> (__refs)
+ { }
+
+ locale::id codecvt<wchar_t, char, mbstate_t>::id;
+
+ codecvt<wchar_t, char, mbstate_t>::codecvt (size_t __refs)
+ : _Codecvt<wchar_t, char, mbstate_t> (__refs)
+ { }
+
+ codecvt<wchar_t, char, mbstate_t>::~codecvt() { }
+
+ codecvt_base::result
+ codecvt<wchar_t, char, mbstate_t>::
+ do_out(state_type& /*__state*/, const intern_type* __from,
+ const intern_type* __from_end, const intern_type*& __from_next,
+ extern_type* __to, extern_type* __to_limit,
+ extern_type*& __to_next) const
+ {
+ for (; __from < __from_end && __to < __to_limit; ++__from, ++__to)
+ *__to = static_cast<char>(*__from);
+ __from_next = __from; __to_next = __to;
+ return __from == __from_end ? ok : partial;
+ }
+
+ codecvt_base::result
+ codecvt<wchar_t, char, mbstate_t>::
+ do_unshift (state_type& /*__state*/, extern_type* __to,
+ extern_type* /*__to_limit*/,
+ extern_type*& __to_next) const
+ {
+ __to_next = __to;
+ return noconv;
+ }
+
+ codecvt_base::result
+ codecvt<wchar_t, char, mbstate_t>::
+ do_in(state_type& /*__state*/, const extern_type* __from,
+ const extern_type* __from_end, const extern_type*& __from_next,
+ intern_type* __to, intern_type* __to_limit,
+ intern_type*& __to_next) const
+ {
+ for (; __from < __from_end && __to < __to_limit; ++__from, ++__to)
+ *__to = static_cast<wchar_t>(*__from);
+ __from_next = __from;
+ __to_next = __to;
+ return __from == __from_end ? ok : partial;
+ }
+
+ int codecvt<wchar_t, char, mbstate_t>::do_encoding() const throw ()
+ { return 1; }
+
+ bool
+ codecvt<wchar_t, char, mbstate_t>::do_always_noconv() const throw ()
+ { return false; }
+
+ int
+ codecvt<wchar_t, char, mbstate_t>::
+ do_length(const state_type& /*__state*/, const extern_type* __from,
+ const extern_type* __end, size_t __max) const
+ { return (__max < size_t(__end - __from)) ? __max : __end - __from; }
+
+ int
+ codecvt<wchar_t, char, mbstate_t>::do_max_length() const throw ()
+ { return 1; }
+
+ codecvt_byname<wchar_t, char, mbstate_t>::
+ codecvt_byname(const char* /*__s*/, size_t __refs)
+ : codecvt<wchar_t, char, mbstate_t> (__refs)
+ {
+ }
+
+ codecvt_byname<wchar_t, char, mbstate_t>::~codecvt_byname() {}
+
+ locale::id collate<wchar_t>::id;
+
+ collate<wchar_t>::collate(size_t __refs)
+ : _Collate<wchar_t> (__refs)
+ { }
+
+ collate<wchar_t>::~collate() { }
+
+ int collate<wchar_t>::
+ do_compare(const wchar_t* /*__lo1*/, const wchar_t* /*__hi1*/,
+ const wchar_t* /*__lo2*/, const wchar_t* /*__hi2*/) const
+ {
+ return 0; // XXX not done
+ }
+
+ wstring collate<wchar_t>::do_transform(const wchar_t* /*__lo*/,
+ const wchar_t* /*__hi*/) const
+ {
+ return wstring(); // XXX not done
+ }
+
+ long collate<wchar_t>::
+ do_hash(const wchar_t* /*__lo*/, const wchar_t* /*__hi*/) const
+ {
+ return 0; // XXX not done
+ }
+
+ numpunct_byname<wchar_t>::numpunct_byname(const char* /*__s*/, size_t __refs)
+ : numpunct<wchar_t> (__refs)
+ { }
+
+ collate_byname<wchar_t>::collate_byname(const char* /*__s*/, size_t __refs)
+ : collate<wchar_t> (__refs)
+ { }
+
+ moneypunct_byname<wchar_t, false>::
+ moneypunct_byname(const char* /*__s*/, size_t __refs)
+ : moneypunct<wchar_t, false> (__refs)
+ { }
+
+ moneypunct_byname<wchar_t, true>::
+ moneypunct_byname(const char* /*__s*/, size_t __refs)
+ : moneypunct<wchar_t, true> (__refs)
+ { }
+
+ messages_byname<wchar_t>::messages_byname(const char* /*__s*/, size_t __refs)
+ : messages<wchar_t> (__refs)
+ { }
+#endif // _GLIBCPP_USE_WCHAR_T
+
+} // namespace std
+
+
+
+
+
+
diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc
new file mode 100644
index 000000000000..0af674eea535
--- /dev/null
+++ b/libstdc++-v3/src/localename.cc
@@ -0,0 +1,250 @@
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#include <bits/std_clocale.h>
+#include <bits/std_locale.h>
+#include <bits/std_cstring.h>
+#include <bits/std_cassert.h>
+#include <bits/std_vector.h>
+
+namespace std {
+
+/////////////////////////////
+// locale::_Impl constructors
+/////////////////////////////
+
+ // construct specific categories, leaving unselected ones alone
+ //////////
+ locale::_Impl::_Impl(const _Impl& other,const string& name, category cats,
+ size_t refs)
+ : _M_num_references(refs)
+ // , _M_facets(other._M_facets)
+ // , _M_category_names(other._M_category_names)
+ , _M_has_name(other._M_has_name), _M_cached_name_ok(false)
+ {
+#if 1
+ typedef vector<facet*, allocator<facet*> > __vec_facet;
+ typedef vector<string, allocator<string> > __vec_string;
+ try {
+ _M_facets = new __vec_facet(*(other._M_facets));
+ }
+ catch (...) {
+ delete _M_facets;
+ throw;
+ }
+ try {
+ _M_category_names = new __vec_string(*(other._M_category_names));
+ }
+ catch (...) {
+ delete _M_category_names;
+ throw;
+ }
+#endif
+ // XXX Nathan what are you doing here? Is this supposed to be const?
+ // static void(_Impl::* const ctors[]) (const char*) =
+ static void(_Impl::* ctors[]) (const char*) =
+ {
+ // NB: order must match the decl order in class locale.
+ &locale::_Impl::_M_construct_collate,
+ &locale::_Impl::_M_construct_ctype,
+ &locale::_Impl::_M_construct_monetary,
+ &locale::_Impl::_M_construct_numeric,
+ &locale::_Impl::_M_construct_time,
+ &locale::_Impl::_M_construct_messages,
+ 0
+ };
+
+ _S_initialize();
+ std::vector<facet*>::iterator it = _M_facets->begin();
+ for (; it != _M_facets->end(); ++it)
+ (*it)->_M_add_reference();
+
+ try {
+ category classix = _S_normalize_category(cats); // might throw
+ _M_normalize_category_names(name, classix);
+
+ unsigned mask = (locale::all & -(unsigned)locale::all);
+ for (unsigned ix = 0; (-mask & cats) != 0; ++ix, (mask <<= 1))
+ {
+ if (!(mask & cats))
+ continue;
+
+ if (mask & classix)
+ _M_replace_category(_S_classic, _S_facet_categories[ix]);
+ else
+ (this->*ctors[ix]) (name.c_str());
+ }
+ }
+ catch (...) {
+ it = _M_facets->begin();
+ for (; it != _M_facets->end(); ++it)
+ (*it)->_M_remove_reference();
+ throw;
+ }
+ }
+
+ //////////
+ locale::category
+ locale::_Impl::_M_normalize_category_names(const string&,
+ locale::category cats)
+ {
+
+ // The problem to be solved here is that locale names
+ // generally have one of two forms: they might have
+ // only one component, such as "en_US"; or they might
+ // have six, such as "en_US fr_FR en_US C C C", where
+ // each component names a category. Each vendor has
+ // a different order of categories. Each vendor uses
+ // a different format:
+ // AIX uses "C C C C C C"
+ // Sun uses "/C/C/C/C/C/C"
+ // HP uses "/0:C;1:C;2:C;3:C;4:C;5:C;6:C;/"
+ // (where the 0th element is for LC_ALL.)
+ // Most systems (except AIX) permit the long form only for
+ // setlocale(LC_ALL,...), and require the short form for
+ // other calls. All this matters because locale names are
+ // supposed to be compatible between locale("") and
+ // setlocale(..., "") constructors.
+
+ return cats;
+#if 0 /* XXX not done */
+ unsigned mask = (locale::all & -(unsigned)locale::all);
+ for (unsigned ix = 0; (-mask & cats) != 0; ++ix, (mask <<= 1))
+ {
+
+ }
+#endif
+ }
+
+ //////////
+ void
+ locale::_Impl::_M_construct_collate(const char* /*name*/)
+ {
+#if 0
+ _M_init_facet(new std::collate_byname<char>(name));
+ _M_init_facet(new std::collate_byname<wchar_t>(name));
+#endif
+ }
+
+ void
+ locale::_Impl::_M_construct_ctype(const char* /*name*/)
+ {
+#if 0
+ _M_init_facet(new std::ctype_byname<char>(name));
+ _M_init_facet(new std::ctype_byname<wchar_t>(name));
+ _M_init_facet(new std::codecvt_byname<char,char,mbstate_t>(name));
+ _M_init_facet(new std::codecvt_byname<wchar_t,char,mbstate_t>(name));
+#endif
+ }
+
+ void
+ locale::_Impl::_M_construct_monetary(const char* /*name*/)
+ {
+#if 0
+ _M_init_facet(new std::moneypunct_byname<char,false>(name));
+ _M_init_facet(new std::moneypunct_byname<wchar_t,false>(name));
+ _M_init_facet(new std::moneypunct_byname<char,true >(name));
+ _M_init_facet(new std::moneypunct_byname<wchar_t,true >(name));
+
+ locale::_M_initialize();
+ _M_replace_facet(locale::_S_classic, &std::money_get<char>(name)::id);
+ _M_replace_facet(locale::_S_classic, &std::money_get<wchar_t>(name)::id);
+ _M_replace_facet(locale::_S_classic, &std::money_put<char>(name)::id);
+ _M_replace_facet(locale::_S_classic, &std::money_put<wchar_t>(name)::id);
+#endif
+ }
+
+ void
+ locale::_Impl::_M_construct_numeric(const char* /*name*/)
+ {
+#if 0
+ _M_init_facet(new std::numpunct_byname<char>(name));
+ _M_init_facet(new std::numpunct_byname<wchar_t>(name));
+
+ locale::_M_initialize();
+ _M_replace_facet(locale::_S_classic, &std::num_get<char>::id);
+ _M_replace_facet(locale::_S_classic, &std::num_get<wchar_t>::id);
+ _M_replace_facet(locale::_S_classic, &std::num_put<char>::id);
+ _M_replace_facet(locale::_S_classic, &std::num_put<wchar_t>::id);
+#endif
+ }
+
+ void
+ locale::_Impl::_M_construct_time(const char* /*name*/)
+ {
+#if 0
+ _M_init_facet(new std::time_get_byname<char>(name));
+ _M_init_facet(new std::time_get_byname<wchar_t>(name));
+ _M_init_facet(new std::time_put_byname<char>(name));
+ _M_init_facet(new std::time_put_byname<wchar_t>(name));
+#endif
+ }
+
+ void
+ locale::_Impl::_M_construct_messages(const char* /*name*/)
+ {
+#if 0
+ _M_init_facet(new std::messages_byname<char>(name));
+ _M_init_facet(new std::messages_byname<wchar_t>(name));
+#endif
+ }
+
+ //////////////////////
+ // locale constructors
+ //////////////////////
+
+ ////////
+ locale::locale(const char* std_name)
+ {
+ _S_initialize();
+ if (strcmp(std_name, "C") == 0 || strcmp(std_name, "POSIX"))
+ (_M_impl = _S_classic)->_M_add_reference();
+ else
+ {
+ // might throw:
+ _M_impl = new _Impl(*_S_classic, string(std_name), all, 1);
+ _M_impl->_M_has_name = true;
+ }
+ }
+
+ /////////
+ locale::locale(const locale& other, const char* std_name, category cats)
+ : _M_impl(new _Impl(*other._M_impl, string(std_name),
+ _S_normalize_category(cats), 1)) // might throw
+ { }
+
+ ///////
+ bool
+ locale::operator==(const locale& __rhs) const throw()
+ {
+ return(_M_impl == __rhs._M_impl
+ || (this->name() != "*" && this->name() == __rhs.name()));
+ }
+
+}
diff --git a/libstdc++-v3/src/misc-inst.cc b/libstdc++-v3/src/misc-inst.cc
new file mode 100644
index 000000000000..3d31c71faf7a
--- /dev/null
+++ b/libstdc++-v3/src/misc-inst.cc
@@ -0,0 +1,210 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882:
+//
+
+#include <bits/std_string.h>
+#include <bits/std_algorithm.h>
+#include <bits/std_locale.h>
+#include <bits/std_vector.h>
+#include <bits/std_iterator.h>
+#include <bits/std_streambuf.h>
+#include <bits/std_sstream.h>
+#include <bits/std_fstream.h>
+#include <bits/std_ios.h>
+#include <bits/basic_ios.tcc>
+#include <bits/std_istream.h>
+#include <bits/std_ostream.h>
+
+// NB: unnecessary if the .h headers include these
+#ifndef _GLIBCPP_FULLY_COMPLIANT_HEADERS
+#include <bits/sstream.tcc>
+#include <bits/fstream.tcc>
+#include <bits/streambuf.tcc>
+#include <bits/istream.tcc>
+#include <bits/ostream.tcc>
+#endif
+
+namespace std {
+
+ //
+ // streambuf
+ //
+ template class basic_streambuf<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class basic_streambuf<wchar_t>;
+#endif
+
+
+ //
+ // stringstream
+ //
+ template class basic_stringbuf<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class basic_stringbuf<wchar_t>;
+#endif
+
+
+ //
+ // fstream
+ //
+ template class basic_filebuf<char, char_traits<char> >;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class basic_filebuf<wchar_t, char_traits<wchar_t> >;
+#endif
+
+
+ //
+ // basic_ios
+ //
+ template class basic_ios<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class basic_ios<wchar_t>;
+#endif
+
+
+ //
+ // istream
+ //
+ template class basic_istream<char>;
+ template istream& ws(istream&);
+ template istream& operator>>(istream&, char&);
+ template istream& operator>>(istream&, unsigned char&);
+ template istream& operator>>(istream&, signed char&);
+ template istream& operator>>(istream&, char*);
+ template istream& operator>>(istream&, unsigned char*);
+ template istream& operator>>(istream&, signed char*);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class basic_istream<wchar_t>;
+ template wistream& ws(wistream&);
+ template wistream& operator>>(wistream&, wchar_t&);
+ template wistream& operator>>(wistream&, wchar_t*);
+#endif
+
+
+ //
+ // ostream
+ //
+ template class basic_ostream<char>;
+ template ostream& endl(ostream&);
+ template ostream& ends(ostream&);
+ template ostream& flush(ostream&);
+ template ostream& operator<<(ostream&, char);
+ template ostream& operator<<(ostream&, unsigned char);
+ template ostream& operator<<(ostream&, signed char);
+ template ostream& operator<<(ostream&, const char*);
+ template ostream& operator<<(ostream&, const unsigned char*);
+ template ostream& operator<<(ostream&, const signed char*);
+ // template ostream& operator<<(ostream&, _Setfill<char>);
+ // template ostream& operator<<(ostream&, _Setw);
+ // template _Setfill<char> setfill(char);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class basic_ostream<wchar_t>;
+ template wostream& endl(wostream&);
+ template wostream& ends(wostream&);
+ template wostream& flush(wostream&);
+ template wostream& operator<<(wostream&, wchar_t);
+ template wostream& operator<<(wostream&, char);
+ template wostream& operator<<(wostream&, const wchar_t*);
+ template wostream& operator<<(wostream&, const char*);
+ // template wostream& operator<<(wostream&, _Setfill<wchar_t>);
+ // template wostream& operator<<(wostream&, _Setw);
+ // template _Setfill<wchar_t> setfill(wchar_t);
+#endif
+
+
+ //
+ // iostream
+ //
+ template class basic_iostream<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class basic_iostream<wchar_t>;
+#endif
+
+
+ //
+ // istringstream
+ //
+ template class basic_istringstream<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class basic_istringstream<wchar_t>;
+#endif
+
+
+ //
+ // ostringstream
+ //
+ template class basic_ostringstream<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class basic_ostringstream<wchar_t>;
+#endif
+
+
+ //
+ // algorithm
+ //
+ typedef _Char_traits_match<char, char_traits<char> > char_match;
+
+ template
+ const char*
+ find_if<const char *, char_match>
+ (const char *, const char *, char_match, random_access_iterator_tag);
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ typedef _Char_traits_match<wchar_t, char_traits<wchar_t> > wchar_match;
+
+ template const wchar_t*
+ find_if<const wchar_t*, wchar_match>
+ (const wchar_t*, const wchar_t*, wchar_match, random_access_iterator_tag);
+#endif
+
+ template
+ string*
+ __uninitialized_fill_n_aux<string*, size_t, string>
+ (string*, size_t, string const &, _Bool<false>);
+
+ template
+ string*
+ __uninitialized_copy_aux<vector<string>::const_iterator, string *>
+ (vector<string>::const_iterator, vector<string>::const_iterator,
+ string*, _Bool<false>);
+
+} //std
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/src/stdexcept.cc b/libstdc++-v3/src/stdexcept.cc
new file mode 100644
index 000000000000..147ff11099d5
--- /dev/null
+++ b/libstdc++-v3/src/stdexcept.cc
@@ -0,0 +1,74 @@
+// Methods for Exception Support for -*- C++ -*-
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Written by Mike Stump based upon the specification in the 20 September 1994
+// C++ working paper, ANSI document X3J16/94-0158.
+
+//
+// ISO C++ 14882: 19.1 Exception classes
+//
+
+#include <bits/std_string.h>
+#include <bits/std_stdexcept.h>
+#include <bits/stl_range_errors.h>
+
+// To break the circularity with the <stdexcept> and <string> header we
+// define two functions which throw exceptions as a direct call would do.
+
+namespace std {
+
+ __Named_exception::__Named_exception(const string& __str)
+ {
+ strncpy(_M_name, __str.c_str(), _S_bufsize);
+ _M_name[_S_bufsize - 1] = '\0';
+ }
+
+ void
+ __out_of_range(const char *str)
+ { throw out_of_range(str); }
+
+ void
+ __length_error(const char *str)
+ { throw length_error(str); }
+
+ // XXX: From stl_range_errors.h, eventually these approaches need to
+ // be merged.
+ void
+ __stl_throw_range_error(const char* __msg)
+ { throw range_error(__msg); }
+
+ void
+ __stl_throw_length_error(const char* __msg)
+ { throw length_error(__msg); }
+
+} //namespace std
+
+
+
+
diff --git a/libstdc++-v3/src/stdstreams.cc b/libstdc++-v3/src/stdstreams.cc
new file mode 100644
index 000000000000..cb69541cf94d
--- /dev/null
+++ b/libstdc++-v3/src/stdstreams.cc
@@ -0,0 +1,48 @@
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <bits/std_istream.h>
+#include <bits/std_ostream.h>
+#include <bits/std_fstream.h>
+
+namespace std {
+
+ filebuf __cfileinit;
+ istream cin(&__cfileinit);
+ ostream cout(&__cfileinit);
+ ostream cerr(&__cfileinit);
+ ostream clog(&__cfileinit);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ wfilebuf __wfileinit;
+ wistream wcin(&__wfileinit);
+ wostream wcout(&__wfileinit);
+ wostream wcerr(&__wfileinit);
+ wostream wclog(&__wfileinit);
+#endif
+
+} // std
diff --git a/libstdc++-v3/src/stl-inst.cc b/libstdc++-v3/src/stl-inst.cc
new file mode 100644
index 000000000000..643c105e8044
--- /dev/null
+++ b/libstdc++-v3/src/stl-inst.cc
@@ -0,0 +1,52 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882:
+//
+
+#include <bits/c++config.h>
+#include <bits/stl_config.h>
+#include <bits/stl_alloc.h>
+#include <bits/std_vector.h>
+
+namespace std {
+
+ template class __malloc_alloc_template<0>;
+
+#ifndef __USE_MALLOC
+ template class __default_alloc_template<__NODE_ALLOCATOR_THREADS, 0>;
+#endif
+
+ template
+ void
+ vector<unsigned int>::
+ _M_insert_aux(vector<unsigned int>::iterator, unsigned int const &);
+
+} //std
diff --git a/libstdc++-v3/src/string-inst.cc b/libstdc++-v3/src/string-inst.cc
new file mode 100644
index 000000000000..451ffa50a837
--- /dev/null
+++ b/libstdc++-v3/src/string-inst.cc
@@ -0,0 +1,406 @@
+// Components for manipulating sequences of characters -*- C++ -*-
+
+// Copyright (C) 2000, 1999, 1998, 1997 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 21 Strings library
+//
+
+// Written by Jason Merrill based upon the specification by Takanori Adachi
+// in ANSI X3J16/94-0013R2. Rewritten by Nathan Myers.
+
+#include <bits/std_string.h>
+#include <bits/std_algorithm.h>
+#include <bits/std_istream.h>
+#include <bits/std_ostream.h>
+
+// NB: Unnecessary if the .h headers include these
+#ifndef _GLIBCPP_FULLY_COMPLIANT_HEADERS
+#include <bits/istream.tcc>
+#include <bits/ostream.tcc>
+#endif
+
+// Instantiation configuration.
+#ifndef C
+# define C char
+# define _GLIBCPP_INSTANTIATING_CHAR 1
+#endif
+
+namespace std
+{
+ typedef basic_string<C> S;
+
+#ifdef MAIN
+ template C S::_Rep::_S_terminal;
+ // XXX Fix me: 2000-04-18 g++ ICE.
+// template S::size_type S::_S_max_size;
+// template S::allocator_type::size_type S::S_empty_rep_storage[];
+ template S::basic_string(S const&);
+ template S::_Rep* S::_Rep::_S_create(size_t, S::allocator_type const&);
+ template void S::_Rep::_M_destroy(S::allocator_type const&) throw();
+#endif
+
+#ifdef CTORNC
+ template
+ S::basic_string(S::size_type, C, S::allocator_type const&);
+#endif
+
+#ifdef CTORAL
+ template
+ S::basic_string(S::allocator_type const&);
+#endif
+
+#ifdef CTORCPR
+ template
+ S::basic_string(S const&, S::size_type, S::size_type);
+#endif
+
+#ifdef CTORCPRAL
+ template
+ S::basic_string(
+ S const&, S::size_type, S::size_type, S::allocator_type const&);
+#endif
+
+#ifdef CTORPRAL
+ template
+ S::basic_string(
+ C const*, S::size_type, S::allocator_type const&);
+#endif
+
+#ifdef CTORPAL
+ template
+ S::basic_string(
+ C const*, S::allocator_type const&);
+#endif
+
+#ifdef CTORDUPAL
+ template
+ S::basic_string(
+ S::size_type, C, S::allocator_type const&);
+#endif
+
+#ifdef CTORPP
+ template
+ S::basic_string
+ (C*, C*, const allocator<C>&);
+#endif
+
+#ifdef CTORII
+ template
+ S::basic_string
+ (S::iterator, S::iterator, const allocator<C>&);
+#endif
+
+#ifdef MUTATE
+ template
+ void S::_M_leak_hard();
+ template
+ void S::_M_mutate(S::size_type, S::size_type, S::size_type);
+ template
+ C* S::_Rep::_M_clone(S::allocator_type const&, S::size_type);
+#endif
+
+#ifdef RESERVE
+ template
+ void S::reserve(S::size_type);
+#endif
+
+#ifdef SWAP
+ template
+ void S::swap(S&);
+#endif
+
+#ifdef SLOP
+# ifdef _GLIBCPP_ALLOC_CONTROL
+ template
+ bool (* S::_Rep::_S_excess_slop)(size_t, size_t);
+ template
+ bool S::_Rep::_S_default_excess(size_t, size_t);
+# endif
+#endif
+
+#ifdef RESIZE
+ template
+ void S::resize(S::size_type, C);
+#endif
+
+#ifdef APPCOPY
+ template
+ S& S::append(S const&);
+#endif
+
+#ifdef APPCPR
+ template
+ S& S::append(S const&, S::size_type, S::size_type);
+#endif
+
+#ifdef APPPR
+ template
+ S& S::append(C const*, S::size_type);
+#endif
+
+#ifdef APPDUP
+ template
+ S& S::append(S::size_type, C);
+#endif
+
+#ifdef APPII
+ template
+ S&
+ S::append<S::iterator>
+ (S::iterator, S::iterator);
+#endif
+
+#ifdef ASSCP
+ template
+ S&
+ S::assign(S const&);
+#endif
+
+#ifdef ASSII
+ template
+ S&
+ S::assign<S::iterator>
+ (S::iterator, S::iterator);
+#endif
+
+#ifdef INSII
+ template
+ void
+ S::insert<S::iterator> //c*
+ (S::iterator, S::iterator, S::iterator); //it, c+, c+ and temptype = char*
+#endif
+
+#ifdef REPRR
+ template
+ S& S::replace(
+ S::size_type, S::size_type, S const&, S::size_type, S::size_type);
+#endif
+
+#ifdef REPIIDUP
+ template
+ S& S::replace(S::iterator, S::iterator, S::size_type, C);
+#endif
+
+#ifdef REPII
+ template
+ S&
+ S::replace<S::iterator> // c*
+ (S::iterator, S::iterator, S::iterator, S::iterator); //it, it, c+, c+
+#endif
+
+#ifdef REPIII
+ template
+ S&
+ S::_M_replace<S::iterator>
+ (S::iterator, S::iterator, S::iterator, S::iterator, forward_iterator_tag);
+#endif
+
+#ifdef REP4I
+ template
+ template
+ S&
+ S::_M_replace<S::const_iterator>
+ (S::iterator, S::iterator,
+ S::const_iterator, S::const_iterator, forward_iterator_tag);
+#endif
+
+#ifdef REPIIPP
+ template
+ S&
+ S::_M_replace<C*>
+ (S::iterator, S::iterator, C*, C*, forward_iterator_tag);
+#endif
+
+#ifdef REPIIPP2
+ template
+ S&
+ S::_M_replace<const C*>
+ (S::iterator, S::iterator, const C*, const C*, forward_iterator_tag);
+#endif
+
+#ifdef COPY
+ template
+ S::size_type S::copy(C*, S::size_type, S::size_type) const;
+#endif
+
+#ifdef CONII
+ template
+ C*
+ S::_S_construct<S::iterator>
+ (S::iterator, S::iterator, const allocator<C>&);
+#endif
+
+#ifdef CONIIF
+ template
+ C*
+ S::_S_construct<S::iterator>
+ (S::iterator, S::iterator, const allocator<C>&, forward_iterator_tag);
+#endif
+
+#ifdef CONPPF
+ template
+ C*
+ S::_S_construct<C*>
+ (C*, C*, const allocator<C>&, forward_iterator_tag);
+#endif
+
+#ifdef CONPPF2
+ template
+ C*
+ S::_S_construct<const C*>
+ (const C*, const C*, const allocator<C>&, forward_iterator_tag);
+#endif
+
+#ifdef CONSC
+ template
+ C*
+ S::_S_construct<S::iterator>
+ (S::size_type, C, const allocator<C>&);
+#endif
+
+#ifdef FIND
+ // These members are explicitly specialized, and can only be in one
+ // translation unit or else we get multiple copies. . .
+#if _GLIBCPP_INSTANTIATING_CHAR
+ template<>
+ const char*
+ string::_S_find(const char* __beg, const char* __end, char __c)
+ {
+ char* __retval = strchr(__beg, __c);
+ return (__retval ? __retval : __end);
+ }
+#else
+ template<>
+ const wchar_t*
+ wstring::_S_find(const wchar_t* __beg, const wchar_t* __end, wchar_t __c)
+ {
+ return find_if(__beg, __end,
+ _Char_traits_match<wchar_t, traits_type>(__c));
+ }
+#endif
+#endif
+
+#ifdef FINDC
+ template
+ S::size_type S::find(C, S::size_type) const;
+#endif
+
+#ifdef RFIND
+ template
+ S::size_type S::rfind(C const*, S::size_type, S::size_type) const;
+#endif
+
+#ifdef RFINDC
+ template
+ S::size_type S::rfind(C, S::size_type) const;
+#endif
+
+#ifdef FFO
+ template
+ S::size_type S::find_first_of(C const*, S::size_type, S::size_type) const;
+#endif
+
+#ifdef FLO
+ template
+ S::size_type S::find_last_of(C const*, S::size_type, S::size_type) const;
+#endif
+
+#ifdef FFNO
+ template
+ S::size_type S::find_first_not_of(
+ C const*, S::size_type, S::size_type) const;
+#endif
+
+#ifdef FLNO
+ template
+ S::size_type S::find_last_not_of(
+ C const*, S::size_type, S::size_type) const;
+#endif
+
+#ifdef FLNOC
+ template
+ S::size_type S::find_last_not_of(C, S::size_type) const;
+#endif
+
+#ifdef COMPARE
+ template
+ int S::compare(S::size_type, S::size_type, S const&) const;
+#endif
+
+#ifdef COMPARE2
+ template
+ int S::compare(S::size_type, S::size_type, S const&, S::size_type,
+ S::size_type) const;
+#endif
+
+#ifdef COMPAREP
+ template
+ int S::compare(C const*) const;
+#endif
+
+#ifdef COMPAREP2
+ template
+ int S::compare(
+ S::size_type, S::size_type, C const*, S::size_type) const;
+#endif
+
+#ifdef ADDPS
+ template S operator+(const C*, const S&);
+#endif
+
+#ifdef ADDCS
+ template S operator+(C, const S&);
+#endif
+
+#ifdef EQ
+ template bool operator==(const S::iterator&, const S::iterator&);
+ template bool operator==(const S::const_iterator&, const S::const_iterator&);
+#endif
+
+#ifdef EXTRACT
+ template basic_istream<C>& operator>>(basic_istream<C>&, S&);
+#endif
+
+#ifdef INSERT
+ template basic_ostream<C>& operator<<(basic_ostream<C>&, const S&);
+#endif
+
+#ifdef GETLINE
+ template basic_istream<C>& getline(basic_istream<C>&, S&, C);
+ template basic_istream<C>& getline(basic_istream<C>&, S&);
+#endif
+
+#ifdef SCOPY
+ template void _S_string_copy(const S&, C*, allocator<C>::size_type);
+#endif
+
+} // std
+
+
+
diff --git a/libstdc++-v3/src/strstream.cc b/libstdc++-v3/src/strstream.cc
new file mode 100644
index 000000000000..f1fe40f532c8
--- /dev/null
+++ b/libstdc++-v3/src/strstream.cc
@@ -0,0 +1,427 @@
+/*
+ * Copyright (c) 1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+// Implementation of the classes in header <strstream>.
+// WARNING: The classes defined in <strstream> are DEPRECATED. This
+// header is defined in section D.7.1 of the C++ standard, and it
+// MAY BE REMOVED in a future standard revision. You should use the
+// header <sstream> instead.
+
+#include <std/strstream> /* HACK HACK HACK */
+#include <std/algorithm> /* DITTO */
+#include <new>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+__STL_BEGIN_NAMESPACE
+
+// strstreambuf constructor, destructor.
+
+strstreambuf::strstreambuf(streamsize initial_capacity)
+ : _Base(),
+ _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(true), _M_frozen(false), _M_constant(false)
+{
+ streamsize n = max(initial_capacity, streamsize(16));
+
+ char* buf = _M_alloc(n);
+ if (buf) {
+ setp(buf, buf + n);
+ setg(buf, buf, buf);
+ }
+}
+
+strstreambuf::strstreambuf(void* (*alloc_f)(size_t), void (*free_f)(void*))
+ : _Base(),
+ _M_alloc_fun(alloc_f), _M_free_fun(free_f),
+ _M_dynamic(true), _M_frozen(false), _M_constant(false)
+{
+ streamsize n = 16;
+
+ char* buf = _M_alloc(n);
+ if (buf) {
+ setp(buf, buf + n);
+ setg(buf, buf, buf);
+ }
+}
+
+strstreambuf::strstreambuf(char* get, streamsize n, char* put)
+ : _Base(),
+ _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(false)
+{
+ _M_setup(get, put, n);
+}
+
+strstreambuf::strstreambuf(signed char* get, streamsize n, signed char* put)
+ : _Base(),
+ _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(false)
+{
+ _M_setup(reinterpret_cast<char*>(get), reinterpret_cast<char*>(put), n);
+}
+
+strstreambuf::strstreambuf(unsigned char* get, streamsize n,
+ unsigned char* put)
+ : _Base(),
+ _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(false)
+{
+ _M_setup(reinterpret_cast<char*>(get), reinterpret_cast<char*>(put), n);
+}
+
+strstreambuf::strstreambuf(const char* get, streamsize n)
+ : _Base(),
+ _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(true)
+{
+ _M_setup(const_cast<char*>(get), 0, n);
+}
+
+strstreambuf::strstreambuf(const signed char* get, streamsize n)
+ : _Base(),
+ _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(true)
+{
+ _M_setup(reinterpret_cast<char*>(const_cast<signed char*>(get)), 0, n);
+}
+
+strstreambuf::strstreambuf(const unsigned char* get, streamsize n)
+ : _Base(),
+ _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(true)
+{
+ _M_setup(reinterpret_cast<char*>(const_cast<unsigned char*>(get)), 0, n);
+}
+
+strstreambuf::~strstreambuf()
+{
+ if (_M_dynamic && !_M_frozen)
+ _M_free(eback());
+}
+
+void strstreambuf::freeze(bool frozenflag)
+{
+ if (_M_dynamic)
+ _M_frozen = frozenflag;
+}
+
+char* strstreambuf::str()
+{
+ freeze(true);
+ return eback();
+}
+
+int strstreambuf::pcount() const
+{
+ return pptr() ? pptr() - pbase() : 0;
+}
+
+strstreambuf::int_type strstreambuf::overflow(int_type c) {
+ if (c == traits_type::eof())
+ return traits_type::not_eof(c);
+
+ // Try to expand the buffer.
+ if (pptr() == epptr() && _M_dynamic && !_M_frozen && !_M_constant) {
+ ptrdiff_t old_size = epptr() - pbase();
+ ptrdiff_t new_size = max(2 * old_size, ptrdiff_t(1));
+
+ char* buf = _M_alloc(new_size);
+ if (buf) {
+ memcpy(buf, pbase(), old_size);
+
+ char* old_buffer = pbase();
+ bool reposition_get = false;
+ ptrdiff_t old_get_offset;
+ if (gptr() != 0) {
+ reposition_get = true;
+ old_get_offset = gptr() - eback();
+ }
+
+ setp(buf, buf + new_size);
+ pbump(old_size);
+
+ if (reposition_get)
+ setg(buf, buf + old_get_offset, buf + max(old_get_offset, old_size));
+
+ _M_free(old_buffer);
+ }
+ }
+
+ if (pptr() != epptr()) {
+ *pptr() = c;
+ pbump(1);
+ return c;
+ }
+ else
+ return traits_type::eof();
+}
+
+strstreambuf::int_type strstreambuf::pbackfail(int_type c)
+{
+ if (gptr() != eback()) {
+ if (c == _Traits::eof()) {
+ gbump(-1);
+ return _Traits::not_eof(c);
+ }
+ else if (c == (unsigned int)(gptr()[-1])) { // (u int) added KLUDGE
+ gbump(-1);
+ return c;
+ }
+ else if (!_M_constant) {
+ gbump(-1);
+ *gptr() = c;
+ return c;
+ }
+ }
+
+ return _Traits::eof();
+}
+
+strstreambuf::int_type strstreambuf::underflow()
+{
+ if (gptr() == egptr() && pptr() && pptr() > egptr())
+ setg(eback(), gptr(), pptr());
+
+ if (gptr() != egptr())
+ return (unsigned char) *gptr();
+ else
+ return _Traits::eof();
+}
+
+basic_streambuf<char, char_traits<char> >*
+strstreambuf::setbuf(char*, streamsize)
+{
+ return this;
+}
+
+strstreambuf::pos_type
+strstreambuf::seekoff(off_type off,
+ ios_base::seekdir dir, ios_base::openmode mode)
+{
+ bool do_get = false;
+ bool do_put = false;
+
+ if ((mode & (ios_base::in | ios_base::out)) ==
+ (ios_base::in | ios_base::out) &&
+ (dir == ios_base::beg || dir == ios_base::end))
+ do_get = do_put = true;
+ else if (mode & ios_base::in)
+ do_get = true;
+ else if (mode & ios_base::out)
+ do_put = true;
+
+ // !gptr() is here because, according to D.7.1 paragraph 4, the seekable
+ // area is undefined if there is no get area.
+ if ((!do_get && !do_put) || (do_put && !pptr()) || !gptr())
+ return pos_type(off_type(-1));
+
+ char* seeklow = eback();
+ char* seekhigh = epptr() ? epptr() : egptr();
+
+ off_type newoff;
+ switch(dir) {
+ case ios_base::beg:
+ newoff = 0;
+ break;
+ case ios_base::end:
+ newoff = seekhigh - seeklow;
+ break;
+ case ios_base::cur:
+ newoff = do_put ? pptr() - seeklow : gptr() - seeklow;
+ break;
+ default:
+ return pos_type(off_type(-1));
+ }
+
+ off += newoff;
+ if (off < 0 || off > seekhigh - seeklow)
+ return pos_type(off_type(-1));
+
+ if (do_put) {
+ if (seeklow + off < pbase()) {
+ setp(seeklow, epptr());
+ pbump(off);
+ }
+ else {
+ setp(pbase(), epptr());
+ pbump(off - (pbase() - seeklow));
+ }
+ }
+ if (do_get) {
+ if (off <= egptr() - seeklow)
+ setg(seeklow, seeklow + off, egptr());
+ else if (off <= pptr() - seeklow)
+ setg(seeklow, seeklow + off, pptr());
+ else
+ setg(seeklow, seeklow + off, epptr());
+ }
+
+ return pos_type(newoff);
+}
+
+strstreambuf::pos_type
+strstreambuf::seekpos(pos_type pos, ios_base::openmode mode)
+{
+ return seekoff(pos - pos_type(off_type(0)), ios_base::beg, mode);
+}
+
+char* strstreambuf::_M_alloc(size_t n)
+{
+ if (_M_alloc_fun)
+ return static_cast<char*>(_M_alloc_fun(n));
+ else
+ return new char[n];
+}
+
+void strstreambuf::_M_free(char* p)
+{
+ if (p)
+ if (_M_free_fun)
+ _M_free_fun(p);
+ else
+ delete[] p;
+}
+
+void strstreambuf::_M_setup(char* get, char* put, streamsize n)
+{
+ if (get) {
+ size_t N = n > 0 ? size_t(n) : n == 0 ? strlen(get) : size_t(INT_MAX);
+
+ if (put) {
+ setg(get, get, put);
+ setp(put, put + N);
+ }
+ else {
+ setg(get, get, get + N);
+ }
+ }
+}
+
+//----------------------------------------------------------------------
+// Class istrstream
+
+istrstream::istrstream(char* s)
+ : basic_ios<char>(), basic_istream<char>(0), _M_buf(s, 0)
+{
+ basic_ios<char>::init(&_M_buf);
+}
+
+istrstream::istrstream(const char* s)
+ : basic_ios<char>(), basic_istream<char>(0), _M_buf(s, 0)
+{
+ basic_ios<char>::init(&_M_buf);
+}
+
+istrstream::istrstream(char* s, streamsize n)
+ : basic_ios<char>(), basic_istream<char>(0), _M_buf(s, n)
+{
+ basic_ios<char>::init(&_M_buf);
+}
+
+istrstream::istrstream(const char* s, streamsize n)
+ : basic_ios<char>(), basic_istream<char>(0), _M_buf(s, n)
+{
+ basic_ios<char>::init(&_M_buf);
+}
+
+istrstream::~istrstream() {}
+
+strstreambuf* istrstream::rdbuf() const {
+ return const_cast<strstreambuf*>(&_M_buf);
+}
+
+char* istrstream::str() { return _M_buf.str(); }
+
+//----------------------------------------------------------------------
+// Class ostrstream
+
+ostrstream::ostrstream()
+ : basic_ios<char>(), basic_ostream<char>(0), _M_buf()
+{
+ basic_ios<char>::init(&_M_buf);
+}
+
+ostrstream::ostrstream(char* s, int n, ios_base::openmode mode)
+ : basic_ios<char>(), basic_ostream<char>(0),
+ _M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s)
+{
+ basic_ios<char>::init(&_M_buf);
+}
+
+ostrstream::~ostrstream() {}
+
+strstreambuf* ostrstream::rdbuf() const
+{
+ return const_cast<strstreambuf*>(&_M_buf);
+}
+
+void ostrstream::freeze(bool freezeflag)
+{
+ _M_buf.freeze(freezeflag);
+}
+
+char* ostrstream::str()
+{
+ return _M_buf.str();
+}
+
+int ostrstream::pcount() const
+{
+ return _M_buf.pcount();
+}
+
+//----------------------------------------------------------------------
+// Class strstream
+
+strstream::strstream()
+ : basic_ios<char>(), basic_iostream<char>(0), _M_buf()
+{
+ basic_ios<char>::init(&_M_buf);
+}
+
+strstream::strstream(char* s, int n, ios_base::openmode mode)
+ : basic_ios<char>(), basic_iostream<char>(0),
+ _M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s)
+{
+ basic_ios<char>::init(&_M_buf);
+}
+
+strstream::~strstream() {}
+
+strstreambuf* strstream::rdbuf() const
+{
+ return const_cast<strstreambuf*>(&_M_buf);
+}
+
+void strstream::freeze(bool freezeflag)
+{
+ _M_buf.freeze(freezeflag);
+}
+
+int strstream::pcount() const
+{
+ return _M_buf.pcount();
+}
+
+char* strstream::str()
+{
+ return _M_buf.str();
+}
+
+__STL_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/libstdc++-v3/src/valarray-inst.cc b/libstdc++-v3/src/valarray-inst.cc
new file mode 100644
index 000000000000..ce0f86feeec2
--- /dev/null
+++ b/libstdc++-v3/src/valarray-inst.cc
@@ -0,0 +1,64 @@
+#include <bits/std_valarray.h>
+
+namespace std
+{
+ // Some explicit instanciations.
+ 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 size_t
+ __valarray_product(const size_t* __restrict__, const size_t* __restrict__);
+
+ template valarray<size_t>::valarray(size_t);
+ template valarray<size_t>::valarray(const valarray<size_t>&);
+ template valarray<size_t>::~valarray();
+ template size_t valarray<size_t>::size() const;
+ template size_t& valarray<size_t>::operator[](size_t);
+
+
+ inline size_t
+ __valarray_product(const valarray<size_t>& __a)
+ {
+ // XXX: This ugly cast is necessary because
+ // valarray::operator[]() const return a VALUE!
+ // Try to get the committee to correct that gross error.
+ typedef const size_t* __restrict__ _Tp;
+ size_t __n = __a.size() - 1;
+ valarray<size_t>& __t = const_cast<valarray<size_t>&>(__a);
+ return __valarray_product(static_cast<_Tp>(&__t[0]),
+ static_cast<_Tp>(&__t[__n]));
+ }
+
+ void __gslice_to_index(size_t __o, const valarray<size_t>& __l,
+ const valarray<size_t>& __s,
+ valarray<size_t>& __i)
+ {
+ size_t __n = __l.size();
+ size_t* const __t = static_cast<size_t*>
+ (__builtin_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];
+ }
+ }
+ }
+ }
+
+ gslice::_Indexer::_Indexer(size_t __o, const valarray<size_t>& __s,
+ const valarray<size_t>& __l)
+ : _M_count(1), _M_start(__o), _M_size(__s), _M_stride(__l),
+ _M_index(__l.size() ? __valarray_product(__l) : 0)
+ { __gslice_to_index(__o, __l, __s, _M_index); }
+
+}
diff --git a/libstdc++-v3/std/algorithm b/libstdc++-v3/std/algorithm
new file mode 100644
index 000000000000..eebcdf22977c
--- /dev/null
+++ b/libstdc++-v3/std/algorithm
@@ -0,0 +1,3 @@
+#ifndef _CPP_ALGORITHM
+#include <bits/std_algorithm.h>
+#endif
diff --git a/libstdc++-v3/std/bitset b/libstdc++-v3/std/bitset
new file mode 100644
index 000000000000..e334ec964516
--- /dev/null
+++ b/libstdc++-v3/std/bitset
@@ -0,0 +1,3 @@
+#ifndef _CPP_BITSET
+#include <bits/std_bitset.h>
+#endif
diff --git a/libstdc++-v3/std/cassert b/libstdc++-v3/std/cassert
new file mode 100644
index 000000000000..bee254d55f17
--- /dev/null
+++ b/libstdc++-v3/std/cassert
@@ -0,0 +1,3 @@
+// This one should not have include guards.
+#include <bits/std_cassert.h>
+
diff --git a/libstdc++-v3/std/cctype b/libstdc++-v3/std/cctype
new file mode 100644
index 000000000000..d888a3f80edd
--- /dev/null
+++ b/libstdc++-v3/std/cctype
@@ -0,0 +1,3 @@
+#ifndef _CPP_CCTYPE
+#include <bits/std_cctype.h>
+#endif
diff --git a/libstdc++-v3/std/cerrno b/libstdc++-v3/std/cerrno
new file mode 100644
index 000000000000..5d2cf1f61a49
--- /dev/null
+++ b/libstdc++-v3/std/cerrno
@@ -0,0 +1,3 @@
+#ifndef _CPP_CERRNO
+#include <bits/std_cerrno.h>
+#endif
diff --git a/libstdc++-v3/std/cfloat b/libstdc++-v3/std/cfloat
new file mode 100644
index 000000000000..c6cb35731a85
--- /dev/null
+++ b/libstdc++-v3/std/cfloat
@@ -0,0 +1,3 @@
+#ifndef _CPP_CFLOAT
+#include <bits/std_cfloat.h>
+#endif
diff --git a/libstdc++-v3/std/ciso646 b/libstdc++-v3/std/ciso646
new file mode 100644
index 000000000000..188676772bbe
--- /dev/null
+++ b/libstdc++-v3/std/ciso646
@@ -0,0 +1,3 @@
+#ifndef _CPP_ISO646
+#include <bits/std_ciso646.h>
+#endif
diff --git a/libstdc++-v3/std/climits b/libstdc++-v3/std/climits
new file mode 100644
index 000000000000..b7614847bbec
--- /dev/null
+++ b/libstdc++-v3/std/climits
@@ -0,0 +1,3 @@
+#ifndef _CPP_CLIMITS
+#include <bits/std_climits.h>
+#endif
diff --git a/libstdc++-v3/std/clocale b/libstdc++-v3/std/clocale
new file mode 100644
index 000000000000..6ac636f87861
--- /dev/null
+++ b/libstdc++-v3/std/clocale
@@ -0,0 +1,3 @@
+#ifndef _CPP_CLOCALE
+#include <bits/std_clocale.h>
+#endif
diff --git a/libstdc++-v3/std/cmath b/libstdc++-v3/std/cmath
new file mode 100644
index 000000000000..783e76af1c5a
--- /dev/null
+++ b/libstdc++-v3/std/cmath
@@ -0,0 +1,3 @@
+#ifndef _CPP_CMATH
+#include <bits/std_cmath.h>
+#endif
diff --git a/libstdc++-v3/std/complex b/libstdc++-v3/std/complex
new file mode 100644
index 000000000000..2cc52f5531d4
--- /dev/null
+++ b/libstdc++-v3/std/complex
@@ -0,0 +1,3 @@
+#ifndef _CPP_COMPLEX
+#include <bits/std_complex.h>
+#endif
diff --git a/libstdc++-v3/std/csetjmp b/libstdc++-v3/std/csetjmp
new file mode 100644
index 000000000000..79531e3607a1
--- /dev/null
+++ b/libstdc++-v3/std/csetjmp
@@ -0,0 +1,4 @@
+
+#ifndef _CPP_CSETJMP
+#include <bits/std_csetjmp.h>
+#endif
diff --git a/libstdc++-v3/std/csignal b/libstdc++-v3/std/csignal
new file mode 100644
index 000000000000..e5c1837a4a50
--- /dev/null
+++ b/libstdc++-v3/std/csignal
@@ -0,0 +1,4 @@
+
+#ifndef _CPP_CSIGNAL
+#include <bits/std_csignal.h>
+#endif
diff --git a/libstdc++-v3/std/cstdarg b/libstdc++-v3/std/cstdarg
new file mode 100644
index 000000000000..37b2459f6a56
--- /dev/null
+++ b/libstdc++-v3/std/cstdarg
@@ -0,0 +1,4 @@
+
+#ifndef _CPP_CSTDARG
+#include <bits/std_cstdarg.h>
+#endif
diff --git a/libstdc++-v3/std/cstddef b/libstdc++-v3/std/cstddef
new file mode 100644
index 000000000000..fab421423ba1
--- /dev/null
+++ b/libstdc++-v3/std/cstddef
@@ -0,0 +1,3 @@
+#ifndef _CPP_CSTDDEF
+#include <bits/std_cstddef.h>
+#endif
diff --git a/libstdc++-v3/std/cstdio b/libstdc++-v3/std/cstdio
new file mode 100644
index 000000000000..f2a0135e65a4
--- /dev/null
+++ b/libstdc++-v3/std/cstdio
@@ -0,0 +1,3 @@
+#ifndef _CPP_CSTDIO
+#include <bits/std_cstdio.h>
+#endif
diff --git a/libstdc++-v3/std/cstdlib b/libstdc++-v3/std/cstdlib
new file mode 100644
index 000000000000..98230261186b
--- /dev/null
+++ b/libstdc++-v3/std/cstdlib
@@ -0,0 +1,3 @@
+#ifndef _CPP_CSTDLIB
+#include <bits/std_cstdlib.h>
+#endif
diff --git a/libstdc++-v3/std/cstring b/libstdc++-v3/std/cstring
new file mode 100644
index 000000000000..b6a3bd9b53fc
--- /dev/null
+++ b/libstdc++-v3/std/cstring
@@ -0,0 +1,3 @@
+#ifndef _CPP_CSTRING
+#include <bits/std_cstring.h>
+#endif
diff --git a/libstdc++-v3/std/ctime b/libstdc++-v3/std/ctime
new file mode 100644
index 000000000000..838fd4360ef5
--- /dev/null
+++ b/libstdc++-v3/std/ctime
@@ -0,0 +1,3 @@
+#ifndef _CPP_CTIME
+#include <bits/std_ctime.h>
+#endif
diff --git a/libstdc++-v3/std/cwchar b/libstdc++-v3/std/cwchar
new file mode 100644
index 000000000000..2cfc330637c2
--- /dev/null
+++ b/libstdc++-v3/std/cwchar
@@ -0,0 +1,3 @@
+#ifndef _CPP_CWCHAR
+#include <bits/std_cwchar.h>
+#endif
diff --git a/libstdc++-v3/std/cwctype b/libstdc++-v3/std/cwctype
new file mode 100644
index 000000000000..ccd490869015
--- /dev/null
+++ b/libstdc++-v3/std/cwctype
@@ -0,0 +1,3 @@
+#ifndef _CPP_CWCTYPE
+#include <bits/std_cwctype.h>
+#endif
diff --git a/libstdc++-v3/std/deque b/libstdc++-v3/std/deque
new file mode 100644
index 000000000000..2215fd02de14
--- /dev/null
+++ b/libstdc++-v3/std/deque
@@ -0,0 +1,3 @@
+#ifndef _CPP_DEQUE
+#include <bits/std_deque.h>
+#endif
diff --git a/libstdc++-v3/std/exception b/libstdc++-v3/std/exception
new file mode 100644
index 000000000000..06653d17e7e8
--- /dev/null
+++ b/libstdc++-v3/std/exception
@@ -0,0 +1,3 @@
+#ifndef _CPP_EXCEPTION
+#include <bits/std_exception.h>
+#endif
diff --git a/libstdc++-v3/std/fstream b/libstdc++-v3/std/fstream
new file mode 100644
index 000000000000..afe99e98da96
--- /dev/null
+++ b/libstdc++-v3/std/fstream
@@ -0,0 +1,3 @@
+#ifndef _CPP_FSTREAM
+#include <bits/std_fstream.h>
+#endif
diff --git a/libstdc++-v3/std/functional b/libstdc++-v3/std/functional
new file mode 100644
index 000000000000..700c211ba232
--- /dev/null
+++ b/libstdc++-v3/std/functional
@@ -0,0 +1,3 @@
+#ifndef _CPP_FUNCTIONAL
+#include <bits/std_functional.h>
+#endif
diff --git a/libstdc++-v3/std/iomanip b/libstdc++-v3/std/iomanip
new file mode 100644
index 000000000000..d3c2aa84177c
--- /dev/null
+++ b/libstdc++-v3/std/iomanip
@@ -0,0 +1,3 @@
+#ifndef _CPP_IOMANIP
+#include <bits/std_iomanip.h>
+#endif
diff --git a/libstdc++-v3/std/ios b/libstdc++-v3/std/ios
new file mode 100644
index 000000000000..7132eadfa33b
--- /dev/null
+++ b/libstdc++-v3/std/ios
@@ -0,0 +1,3 @@
+#ifndef _CPP_IOS
+#include <bits/std_ios.h>
+#endif
diff --git a/libstdc++-v3/std/iosfwd b/libstdc++-v3/std/iosfwd
new file mode 100644
index 000000000000..6a97d3d2d322
--- /dev/null
+++ b/libstdc++-v3/std/iosfwd
@@ -0,0 +1,3 @@
+#ifndef _CPP_IOSFWD
+#include <bits/std_iosfwd.h>
+#endif
diff --git a/libstdc++-v3/std/iostream b/libstdc++-v3/std/iostream
new file mode 100644
index 000000000000..f94fd058a55a
--- /dev/null
+++ b/libstdc++-v3/std/iostream
@@ -0,0 +1,5 @@
+#ifndef _CPP_IOSTREAM
+#include <bits/std_iostream.h>
+#endif
+
+
diff --git a/libstdc++-v3/std/istream b/libstdc++-v3/std/istream
new file mode 100644
index 000000000000..9594261aa61a
--- /dev/null
+++ b/libstdc++-v3/std/istream
@@ -0,0 +1,3 @@
+#ifndef _CPP_ISTREAM
+#include <bits/std_istream.h>
+#endif
diff --git a/libstdc++-v3/std/iterator b/libstdc++-v3/std/iterator
new file mode 100644
index 000000000000..eb22c69746c9
--- /dev/null
+++ b/libstdc++-v3/std/iterator
@@ -0,0 +1,3 @@
+#ifndef _CPP_ITERATOR
+#include <bits/std_iterator.h>
+#endif
diff --git a/libstdc++-v3/std/limits b/libstdc++-v3/std/limits
new file mode 100644
index 000000000000..ba86fe0cba74
--- /dev/null
+++ b/libstdc++-v3/std/limits
@@ -0,0 +1,3 @@
+#ifndef _CPP_LIMITS
+#include <bits/std_limits.h>
+#endif
diff --git a/libstdc++-v3/std/list b/libstdc++-v3/std/list
new file mode 100644
index 000000000000..ea1883639faa
--- /dev/null
+++ b/libstdc++-v3/std/list
@@ -0,0 +1,3 @@
+#ifndef _CPP_LIST
+#include <bits/std_list.h>
+#endif
diff --git a/libstdc++-v3/std/locale b/libstdc++-v3/std/locale
new file mode 100644
index 000000000000..5452ae81040e
--- /dev/null
+++ b/libstdc++-v3/std/locale
@@ -0,0 +1,3 @@
+#ifndef _CPP_LOCALE
+#include <bits/std_locale.h>
+#endif
diff --git a/libstdc++-v3/std/map b/libstdc++-v3/std/map
new file mode 100644
index 000000000000..16d24f8ee61e
--- /dev/null
+++ b/libstdc++-v3/std/map
@@ -0,0 +1,3 @@
+#ifndef _CPP_MAP
+#include <bits/std_map.h>
+#endif
diff --git a/libstdc++-v3/std/memory b/libstdc++-v3/std/memory
new file mode 100644
index 000000000000..f905b4d1d519
--- /dev/null
+++ b/libstdc++-v3/std/memory
@@ -0,0 +1,3 @@
+#ifndef _CPP_MEMORY
+#include <bits/std_memory.h>
+#endif
diff --git a/libstdc++-v3/std/new b/libstdc++-v3/std/new
new file mode 100644
index 000000000000..dac53f8e7fc1
--- /dev/null
+++ b/libstdc++-v3/std/new
@@ -0,0 +1,3 @@
+#ifndef _CPP_NEW
+#include <bits/std_new.h>
+#endif
diff --git a/libstdc++-v3/std/numeric b/libstdc++-v3/std/numeric
new file mode 100644
index 000000000000..b3817a838cba
--- /dev/null
+++ b/libstdc++-v3/std/numeric
@@ -0,0 +1,3 @@
+#ifndef _CPP_NUMERIC
+#include <bits/std_numeric.h>
+#endif
diff --git a/libstdc++-v3/std/ostream b/libstdc++-v3/std/ostream
new file mode 100644
index 000000000000..beed8c58a3d4
--- /dev/null
+++ b/libstdc++-v3/std/ostream
@@ -0,0 +1,3 @@
+#ifndef _CPP_OSTREAM
+#include <bits/std_ostream.h>
+#endif
diff --git a/libstdc++-v3/std/queue b/libstdc++-v3/std/queue
new file mode 100644
index 000000000000..278270cfdff4
--- /dev/null
+++ b/libstdc++-v3/std/queue
@@ -0,0 +1,3 @@
+#ifndef _CPP_QUEUE
+#include <bits/std_queue.h>
+#endif
diff --git a/libstdc++-v3/std/set b/libstdc++-v3/std/set
new file mode 100644
index 000000000000..7aa6a388d411
--- /dev/null
+++ b/libstdc++-v3/std/set
@@ -0,0 +1,3 @@
+#ifndef _CPP_SET
+#include <bits/std_set.h>
+#endif
diff --git a/libstdc++-v3/std/sstream b/libstdc++-v3/std/sstream
new file mode 100644
index 000000000000..92c57cb46bfb
--- /dev/null
+++ b/libstdc++-v3/std/sstream
@@ -0,0 +1,3 @@
+#ifndef _CPP_SSTREAM
+#include <bits/std_sstream.h>
+#endif
diff --git a/libstdc++-v3/std/stack b/libstdc++-v3/std/stack
new file mode 100644
index 000000000000..db3771e7adb1
--- /dev/null
+++ b/libstdc++-v3/std/stack
@@ -0,0 +1,3 @@
+#ifndef _CPP_STACK
+#include <bits/std_stack.h>
+#endif
diff --git a/libstdc++-v3/std/stdexcept b/libstdc++-v3/std/stdexcept
new file mode 100644
index 000000000000..da75270e6821
--- /dev/null
+++ b/libstdc++-v3/std/stdexcept
@@ -0,0 +1,3 @@
+#ifndef _CPP_STDEXCEPT
+#include <bits/std_stdexcept.h>
+#endif
diff --git a/libstdc++-v3/std/streambuf b/libstdc++-v3/std/streambuf
new file mode 100644
index 000000000000..0a58fbdd8fff
--- /dev/null
+++ b/libstdc++-v3/std/streambuf
@@ -0,0 +1,3 @@
+#ifndef _CPP_STREAMBUF
+#include <bits/std_streambuf.h>
+#endif
diff --git a/libstdc++-v3/std/string b/libstdc++-v3/std/string
new file mode 100644
index 000000000000..8e3cd42715e3
--- /dev/null
+++ b/libstdc++-v3/std/string
@@ -0,0 +1,3 @@
+#ifndef _CPP_STRING
+#include <bits/std_string.h>
+#endif
diff --git a/libstdc++-v3/std/strstream b/libstdc++-v3/std/strstream
new file mode 100644
index 000000000000..53267144434a
--- /dev/null
+++ b/libstdc++-v3/std/strstream
@@ -0,0 +1,3 @@
+#ifndef _CPP_STRSTREAM
+#include <bits/std_strstream.h>
+#endif
diff --git a/libstdc++-v3/std/typeinfo b/libstdc++-v3/std/typeinfo
new file mode 100644
index 000000000000..26526f33693d
--- /dev/null
+++ b/libstdc++-v3/std/typeinfo
@@ -0,0 +1,3 @@
+#ifndef _CPP_TYPEINFO
+#include <bits/std_typeinfo.h>
+#endif
diff --git a/libstdc++-v3/std/utility b/libstdc++-v3/std/utility
new file mode 100644
index 000000000000..924a85398cbf
--- /dev/null
+++ b/libstdc++-v3/std/utility
@@ -0,0 +1,3 @@
+#ifndef _CPP_UTILITY
+#include <bits/std_utility.h>
+#endif
diff --git a/libstdc++-v3/std/valarray b/libstdc++-v3/std/valarray
new file mode 100644
index 000000000000..e98bbcef1682
--- /dev/null
+++ b/libstdc++-v3/std/valarray
@@ -0,0 +1,3 @@
+#ifndef _CPP_VALARRAY
+#include <bits/std_valarray.h>
+#endif
diff --git a/libstdc++-v3/std/vector b/libstdc++-v3/std/vector
new file mode 100644
index 000000000000..c074b77a886d
--- /dev/null
+++ b/libstdc++-v3/std/vector
@@ -0,0 +1,3 @@
+#ifndef _CPP_VECTOR
+#include <bits/std_vector.h>
+#endif
diff --git a/libstdc++-v3/testsuite/17_intro/header_ciso646.cc b/libstdc++-v3/testsuite/17_intro/header_ciso646.cc
new file mode 100644
index 000000000000..6677db733ad4
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_ciso646.cc
@@ -0,0 +1,131 @@
+// 1999-05-20 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, ciso646
+
+#include <ciso646>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+// 2.11 Keywords
+// alternative representations
+// and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq
+
+// C 2.2.2 Header <iso646.h>
+// The tokens (as above) are keywords and do not appear as macros in <ciso646>.
+
+// Test for macros.
+bool test01()
+{
+ bool test = true;
+
+#ifdef and
+ test = false;
+#endif
+
+#ifdef and_eq
+ test = false;
+#endif
+
+#ifdef bitand
+ test = false;
+#endif
+
+#ifdef bitor
+ test = false;
+#endif
+
+#ifdef compl
+ test = false;
+#endif
+
+#ifdef not_eq
+ test = false;
+#endif
+
+#ifdef not_or
+ test = false;
+#endif
+
+#ifdef or
+ test = false;
+#endif
+
+#ifdef or_eq
+ test = false;
+#endif
+
+#ifdef xor
+ test = false;
+#endif
+
+#ifdef xor_eq
+ test = false;
+#endif
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+// Equivalance in usage.
+bool test02()
+{
+ bool test = true;
+
+ bool arg1 = true;
+ bool arg2 = false;
+ int int1 = 45;
+ int int2 = 0;
+
+#if 0
+ // XXX g++ doesn't like this. Recognizes the keyword, but can't
+ // parse what's next.
+ test &= arg1 && int1;
+ test &= arg1 and int1;
+
+ test &= (arg1 && arg2) == (arg1 and arg2);
+ test &= (arg1 && int1) == (arg1 and int1);
+#endif
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+int main(void)
+{
+ test01();
+ test02();
+
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_fstream.cc b/libstdc++-v3/testsuite/17_intro/header_fstream.cc
new file mode 100644
index 000000000000..7b7cf7c29a95
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_fstream.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, fstream
+
+#include <fstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_iomanip.cc b/libstdc++-v3/testsuite/17_intro/header_iomanip.cc
new file mode 100644
index 000000000000..70fd77464439
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_iomanip.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, iomanip
+
+#include <iomanip>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_ios.cc b/libstdc++-v3/testsuite/17_intro/header_ios.cc
new file mode 100644
index 000000000000..e761ea61da9b
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_ios.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, ios
+
+#include <ios>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_iosfwd.cc b/libstdc++-v3/testsuite/17_intro/header_iosfwd.cc
new file mode 100644
index 000000000000..60f21f93ef97
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_iosfwd.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, iosfwd
+
+#include <iosfwd>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_iostream.cc b/libstdc++-v3/testsuite/17_intro/header_iostream.cc
new file mode 100644
index 000000000000..549969d4aeea
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_iostream.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, iostream
+
+#include <iostream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_istream.cc b/libstdc++-v3/testsuite/17_intro/header_istream.cc
new file mode 100644
index 000000000000..1e64ebf46442
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_istream.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, istream
+
+#include <istream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_ostream.cc b/libstdc++-v3/testsuite/17_intro/header_ostream.cc
new file mode 100644
index 000000000000..0bc90b5a5ab0
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_ostream.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, ostream
+
+#include <ostream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_sstream.cc b/libstdc++-v3/testsuite/17_intro/header_sstream.cc
new file mode 100644
index 000000000000..b04e5ea324b3
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_sstream.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, sstream
+
+#include <sstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/header_streambuf.cc b/libstdc++-v3/testsuite/17_intro/header_streambuf.cc
new file mode 100644
index 000000000000..0847156eceb6
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/header_streambuf.cc
@@ -0,0 +1,36 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers, streambuf
+
+#include <streambuf>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+
+int main(void)
+{
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/17_intro/headers.cc b/libstdc++-v3/testsuite/17_intro/headers.cc
new file mode 100644
index 000000000000..d95f17aee68e
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/headers.cc
@@ -0,0 +1,83 @@
+// 1999-05-12 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 17.4.1.2 Headers
+
+
+// "C++" headers
+#include <algorithm>
+#include <bitset>
+#include <complex>
+#include <deque>
+#include <exception>
+#include <fstream>
+#include <functional>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <iostream>
+#include <istream>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#include <new>
+#include <numeric>
+#include <ostream>
+#include <queue>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <streambuf>
+#include <string>
+#include <typeinfo>
+#include <utility>
+#include <valarray>
+#include <vector>
+
+// "C" headers
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cfloat>
+#include <ciso646>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+
+// "C" headers that might not work if wchar_t support is disabled.
+#include <bits/c++config.h>
+#if _GLIBCPP_USE_WCHAR_T
+ #include <cwchar>
+ #include <cwctype>
+#endif
+
+int main() { }
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits.cc b/libstdc++-v3/testsuite/18_support/numeric_limits.cc
new file mode 100644
index 000000000000..d5ae37104acf
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits.cc
@@ -0,0 +1,95 @@
+// 1999-08-23 bkoz
+
+// Copyright (C) 1999 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.
+
+// 18.2.1.1 template class numeric_limits
+
+#include <limits>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+
+template<typename T>
+ struct A
+ {
+ int key;
+ public:
+ A(int i = 0): key(i) { }
+ bool
+ operator==(int i) { return i == key; }
+ };
+
+struct B { };
+
+
+bool test01()
+{
+ bool test = true;
+ std::numeric_limits< A<B> > obj;
+
+ test &= !obj.is_specialized;
+ test &= obj.min() == 0;
+ test &= obj.max() == 0;
+ test &= obj.digits == 0;
+ test &= obj.digits10 == 0;
+ test &= !obj.is_signed;
+ test &= !obj.is_integer;
+ test &= !obj.is_exact;
+ test &= obj.radix == 0;
+ test &= obj.epsilon() == 0;
+ test &= obj.round_error() == 0;
+ test &= obj.min_exponent == 0;
+ test &= obj.min_exponent10 == 0;
+ test &= obj.max_exponent == 0;
+ test &= obj.max_exponent10 == 0;
+ test &= !obj.has_infinity;
+ test &= !obj.has_quiet_NaN;
+ test &= !obj.has_signaling_NaN;
+ test &= !obj.has_denorm;
+ test &= !obj.has_denorm_loss;
+ test &= obj.infinity() == 0;
+ test &= obj.quiet_NaN() == 0;
+ test &= obj.signaling_NaN() == 0;
+ test &= obj.denorm_min() == 0;
+ test &= !obj.is_iec559;
+ test &= !obj.is_bounded;
+ test &= !obj.is_modulo;
+ test &= !obj.traps;
+ test &= !obj.tinyness_before;
+ test &= obj.round_style == std::round_toward_zero;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+
+ return 0;
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/append.cc b/libstdc++-v3/testsuite/21_strings/append.cc
new file mode 100644
index 000000000000..4dc4aa909eab
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/append.cc
@@ -0,0 +1,170 @@
+// 1999-07-08 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.3 basic_string::assign
+
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::const_reference cref;
+ typedef std::string::reference ref;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const char str_lit01[] = "point bolivar, texas";
+ const std::string str01(str_lit01);
+ const std::string str02("corpus, ");
+ const std::string str03;
+ std::string str05;
+
+
+ // string& append(const string&)
+ str05 = str02;
+ str05.append(str05);
+ test &= str05 == "corpus, corpus, ";
+ str05.append(str01);
+ test &= str05 == "corpus, corpus, point bolivar, texas";
+ str05.append(str03);
+ test &= str05 == "corpus, corpus, point bolivar, texas";
+ std::string str06;
+ str06.append(str05);
+ test &= str06 == str05;
+
+
+ // string& append(const string&, size_type pos, size_type n)
+ str05.erase();
+ str06.erase();
+ csz01 = str03.size();
+ try {
+ str06.append(str03, csz01 + 1, 0);
+ test &= false;
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ csz01 = str01.size();
+ try {
+ str06.append(str01, csz01 + 1, 0);
+ test &= false;
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ str05 = str02;
+ str05.append(str01, 0, std::string::npos);
+ test &= str05 == "corpus, point bolivar, texas";
+ test &= str05 != str02;
+
+ str06 = str02;
+ str06.append(str01, 15, std::string::npos);
+ test &= str06 == "corpus, texas";
+ test &= str02 != str06;
+
+
+ // string& append(const char* s)
+ str05.erase();
+ str06.erase();
+ str05.append("");
+ test &= str05 == str03;
+
+ str05.append(str_lit01);
+ test &= str05 == str01;
+
+ str06 = str02;
+ str06.append("corpus, ");
+ test &= str06 == "corpus, corpus, ";
+
+
+ // string& append(const char* s, size_type n)
+ str05.erase();
+ str06.erase();
+ str05.append("", 0);
+ test &= str05.size() == 0;
+ test &= str05 == str03;
+
+ str05.append(str_lit01, sizeof(str_lit01) - 1);
+ test &= str05 == str01;
+
+ str06 = str02;
+ str06.append("corpus, ", 6);
+ test &= str06 == "corpus, corpus";
+
+ str06 = str02;
+ str06.append("corpus, ", 12);
+ test &= str06 != "corpus, corpus, ";
+
+
+ // string& append(size_type n, char c)
+ str05.erase();
+ str06.erase();
+ str05.append(0, 'a');
+ test &= str05 == str03;
+ str06.append(8, '.');
+ test &= str06 == "........";
+
+
+ // template<typename InputIter>
+ // string& append(InputIter first, InputIter last)
+ str05.erase();
+ str06.erase();
+ str05.append(str03.begin(), str03.end());
+ test &= str05 == str03;
+
+ str06 = str02;
+ str06.append(str01.begin(), str01.begin() + str01.find('r'));
+ test &= str06 == "corpus, point boliva";
+ test &= str06 != str01;
+ test &= str06 != str02;
+
+ str05 = str01;
+ str05.append(str05.begin(), str05.begin() + str05.find('r'));
+ test &= str05 == "point bolivar, texaspoint boliva";
+ test &= str05 != str01;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/capacity.cc b/libstdc++-v3/testsuite/21_strings/capacity.cc
new file mode 100644
index 000000000000..5673434db87c
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/capacity.cc
@@ -0,0 +1,181 @@
+// 1999-05-11 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.3 string capacity
+
+#include <string>
+#include <cstdio>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+template<typename T>
+ struct A { };
+
+template<typename T>
+ bool
+ operator==(const A<T>& a, const A<T>& b) { }
+
+template<typename T>
+ bool
+ operator<(const A<T>& a, const A<T>& b) { }
+
+struct B { };
+
+bool test01()
+{
+ // 1 POD types : resize, capacity, reserve
+ bool test = true;
+ std::string str01;
+ typedef std::string::size_type size_type_s;
+
+ size_type_s sz01 = str01.capacity();
+ str01.reserve(100);
+ size_type_s sz02 = str01.capacity();
+ test &= sz02 >= sz01;
+ test &= sz02 >= 100;
+ str01.reserve();
+ sz01 = str01.capacity();
+ test &= sz01 >= 0;
+
+ sz01 = str01.size() + 5;
+ str01.resize(sz01);
+ sz02 = str01.size();
+ test &= sz01 == sz02;
+
+ sz01 = str01.size() - 5;
+ str01.resize(sz01);
+ sz02 = str01.size();
+ test &= sz01 == sz02;
+
+ std::string str05(30, 'q');
+ std::string str06 = str05;
+ str05 = str06 + str05;
+ test &= str05.capacity() >= str05.size();
+ test &= str06.capacity() >= str06.size();
+
+ // 2 non POD types : resize, capacity, reserve
+ std::basic_string< A<B> > str02;
+ typedef std::basic_string< A<B> >::size_type size_type_o;
+ size_type_o sz03;
+ size_type_o sz04;
+
+ sz03 = str02.capacity();
+ str02.reserve(100);
+ sz04 = str02.capacity();
+ test &= sz04 >= sz03;
+ test &= sz04 >= 100;
+ str02.reserve();
+ sz03 = str02.capacity();
+ test &= sz03 >= 0;
+
+ sz03 = str02.size() + 5;
+ str02.resize(sz03);
+ sz04 = str02.size();
+ test &= sz03 == sz04;
+
+ sz03 = str02.size() - 5;
+ str02.resize(sz03);
+ sz04 = str02.size();
+ test &= sz03 == sz04;
+
+ A<B> inst_obj;
+ std::basic_string<A<B> > str07(30, inst_obj);
+ std::basic_string<A<B> > str08 = str07;
+ str07 = str08 + str07;
+ test &= str07.capacity() >= str07.size();
+ test &= str08.capacity() >= str08.size();
+
+ // 3 POD types: size, length, max_size, clear(), empty()
+ bool b01;
+ std::string str011;
+ b01 = str01.empty();
+ test &= b01 == true;
+ sz01 = str01.size();
+ sz02 = str01.length();
+ test &= sz01 == sz02;
+ str01.c_str();
+ sz01 = str01.size();
+ sz02 = str01.length();
+ test &= sz01 == sz02;
+
+ sz01 = str01.length();
+ str01.c_str();
+ str011 = str01 + "_addendum_";
+ str01.c_str();
+ sz02 = str01.length();
+ test &= sz01 == sz02;
+ sz02 = str011.length();
+ test &= sz02 > sz01;
+
+ // trickster allocator (__USE_MALLOC, luke) issues involved with these:
+ std::string str3 = "8-chars_8-chars_";
+ const char* p3 = str3.c_str();
+ std::string str4 = str3 + "7-chars";
+ const char* p4 = str3.c_str();
+
+ sz01 = str01.size();
+ sz02 = str01.max_size();
+ test &= sz02 >= sz01;
+
+ sz01 = str01.size();
+ str01.clear();
+ b01 = str01.empty();
+ test &= b01 == true;
+ sz02 = str01.size();
+ test &= sz01 >= sz02;
+
+
+ // 4 non-POD types: size, length, max_size, clear(), empty()
+ b01 = str02.empty();
+ test &= b01 == true;
+ sz03 = str02.size();
+ sz04 = str02.length();
+ test &= sz03 == sz04;
+ str02.c_str();
+ sz03 = str02.size();
+ sz04 = str02.length();
+ test &= sz03 == sz04;
+
+ sz03 = str02.max_size();
+ test &= sz03 >= sz04;
+
+ sz03 = str02.size();
+ str02.clear();
+ b01 = str02.empty();
+ test &= b01 == true;
+ sz04 = str02.size();
+ test &= sz03 >= sz04;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/char_traits.cc b/libstdc++-v3/testsuite/21_strings/char_traits.cc
new file mode 100644
index 000000000000..5d814bf17cc4
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/char_traits.cc
@@ -0,0 +1,122 @@
+// 1999-06-03 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.1 Characher traits
+
+#include <string>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+int test01(void)
+{
+ bool test = true;
+ const std::string str_01("zuma beach");
+ const std::string str_02("montara and ocean beach");
+
+ // 21.1.1 character traits requirements
+
+ // Key for decoding what function signatures really mean:
+ // X == char_traits<_CharT>
+ // [c,d] == _CharT
+ // [p,q] == const _CharT*
+ // s == _CharT*
+ // [n,i,j] == size_t
+ // f == X::int_type
+ // pos == X::pos_type
+ // state == X::state_type
+
+ // void X::assign(char c, char d)
+ // assigns c = d;
+ char c1 = 'z';
+ char c2 = 'u';
+ test &= c1 != c2;
+ std::char_traits<char>::assign(c1,c2);
+ test &= c1 == 'u';
+
+ // char* X::move(char* s, const char* p, size_t n)
+ // for each i in [0,n) performs X::assign(s[i], p[i]). Copies
+ // correctly even where p is in [s, s + n), and yields s.
+ char array1[] = {'z', 'u', 'm', 'a', ' ', 'b', 'e', 'a', 'c', 'h', 0};
+ const char str_lit1[] = "montara and ocean beach";
+ int len = sizeof(str_lit1) + sizeof(array1) - 1; // two terminating chars
+ char array2[len];
+
+ test &= str_lit1[0] == 'm';
+ c1 = array2[0];
+ c2 = str_lit1[0];
+ char c3 = array2[1];
+ char c4 = str_lit1[1];
+ std::char_traits<char>::move(array2, str_lit1, 0);
+ test &= array2[0] == c1;
+ test &= str_lit1[0] == c2;
+ std::char_traits<char>::move(array2, str_lit1, 1);
+ test &= array2[0] == c2;
+ test &= str_lit1[0] == c2;
+ test &= array2[1] == c3;
+ test &= str_lit1[1] == c4;
+ std::char_traits<char>::move(array2, str_lit1, 2);
+ test &= array2[0] == c2;
+ test &= str_lit1[0] == c2;
+ test &= array2[1] == c4;
+ test &= str_lit1[1] == c4;
+
+ char* pc1 = array1 + 1;
+ c1 = pc1[0];
+ c2 = array1[0];
+ test &= c1 != c2;
+ char* pc2 = std::char_traits<char>::move(array1, pc1, 0);
+ c3 = pc1[0];
+ c4 = array1[0];
+ test &= c1 == c3;
+ test &= c2 == c4;
+ test &= pc2 == array1;
+
+ c1 = pc1[0];
+ c2 = array1[0];
+ char* pc3 = pc1;
+ pc2 = std::char_traits<char>::move(array1, pc1, 10);
+ c3 = pc1[0];
+ c4 = array1[0];
+ test &= c1 != c3; // underlying char array changed.
+ test &= c4 != c3;
+ test &= pc2 == array1;
+ test &= pc3 == pc1; // but pointers o-tay
+ c1 = *(str_01.data());
+ c2 = array1[0];
+ test &= c1 != c2;
+
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/compare.cc b/libstdc++-v3/testsuite/21_strings/compare.cc
new file mode 100644
index 000000000000..b3d81a08f2bc
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/compare.cc
@@ -0,0 +1,132 @@
+// 980930 bkoz work with libstdc++v3
+
+// Copyright (C) 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.
+
+// 21.3.6.8 basic_string::compare
+// int compare(const basic_string& str) const;
+// int compare(size_type pos1, size_type n1, const basic_string& str) const;
+// int compare(size_type pos1, size_type n1, const basic_string& str,
+// size_type pos2, size_type n2) const;
+// int compare(const charT* s) const;
+// int compare(size_type pos1, size_type n1,
+// const charT* s, size_type n2 = npos) const;
+
+// NB compare should be thought of as a lexographical compare, ie how
+// things would be sorted in a dictionary.
+
+#include <string>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+enum want_value {lt=0, z=1, gt=2};
+
+void test_value(int result, want_value expected);
+void test_value(int result, want_value expected) {
+ bool pass = false;
+
+ switch (expected) {
+ case lt:
+ if (result < 0)
+ pass = true;
+ break;
+ case z:
+ if (!result)
+ pass = true;
+ break;
+ case gt:
+ if (result > 0)
+ pass = true;
+ break;
+ default:
+ pass = false; //should not get here
+ }
+
+#ifdef DEBUG_ASSERT
+ assert(pass);
+#endif
+}
+
+
+int test01(void) {
+
+ std::string str_0("costa rica");
+ std::string str_1("costa marbella");
+ std::string str_2;
+
+ //sanity check
+ test_value(strcmp("costa marbella", "costa rica"), lt);
+ test_value(strcmp("costa rica", "costa rica"), z);
+ test_value(strcmp(str_1.data(), str_0.data()), lt);
+ test_value(strcmp(str_0.data(), str_1.data()), gt);
+ test_value(strncmp(str_1.data(), str_0.data(), 6), z);
+ test_value(strncmp(str_1.data(), str_0.data(), 14), lt);
+ test_value(memcmp(str_1.data(), str_0.data(), 6), z);
+ test_value(memcmp(str_1.data(), str_0.data(), 14), lt);
+ test_value(memcmp("costa marbella", "costa rica", 14), lt);
+
+ // int compare(const basic_string& str) const;
+ test_value(str_0.compare(str_1), gt); //because r>m
+ test_value(str_1.compare(str_0), lt); //because m<r
+ str_2 = str_0;
+ test_value(str_2.compare(str_0), z);
+ str_2 = "cost";
+ test_value(str_2.compare(str_0), lt);
+ str_2 = "costa ricans";
+ test_value(str_2.compare(str_0), gt);
+
+ // int compare(size_type pos1, size_type n1, const basic_string& str) const;
+ test_value(str_1.compare(0, 6, str_0), lt);
+ str_2 = "cost";
+ test_value(str_1.compare(0, 4, str_2), z);
+ test_value(str_1.compare(0, 5, str_2), gt);
+
+ // int compare(size_type pos1, size_type n1, const basic_string& str,
+ // size_type pos2, size_type n2) const;
+ test_value(str_1.compare(0, 6, str_0, 0, 6), z);
+ test_value(str_1.compare(0, 7, str_0, 0, 7), lt);
+ test_value(str_0.compare(0, 7, str_1, 0, 7), gt);
+
+ // int compare(const charT* s) const;
+ test_value(str_0.compare("costa marbella"), gt);
+ test_value(str_1.compare("costa rica"), lt);
+ str_2 = str_0;
+ test_value(str_2.compare("costa rica"), z);
+ test_value(str_2.compare("cost"), gt);
+ test_value(str_2.compare("costa ricans"), lt);
+
+ // int compare(size_type pos, size_type n1, const charT* str,
+ // size_type n2 = npos) const;
+ test_value(str_1.compare(0, 6, "costa rica", 0, 6), z);
+ test_value(str_1.compare(0, 7, "costa rica", 0, 7), lt);
+ test_value(str_0.compare(0, 7, "costa marbella", 0, 7), gt);
+
+ return 0;
+}
+
+
+int main() {
+ test01();
+}
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc b/libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc
new file mode 100644
index 000000000000..9756b0345b48
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc
@@ -0,0 +1,189 @@
+// 1999-06-04 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.1 basic_string constructors.
+
+#include <new>
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+int test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::iterator citerator;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const char str_lit01[] = "rodeo beach, marin";
+ const std::string str01(str_lit01);
+ const std::string str02("baker beach, san francisco");
+
+ // basic_string(const string&, size_type pos = 0, siz_type n = npos, alloc)
+ csz01 = str01.size();
+ try {
+ std::string str03(str01, csz01 + 1);
+ test &= false;
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ try {
+ std::string str03(str01, csz01);
+ test &= str03.size() == 0;
+ test &= str03.size() <= str03.capacity();
+ }
+ catch(...) {
+ test &= false;
+ }
+
+
+ // basic_string(const char* s, size_type n, alloc)
+ csz01 = str01.max_size();
+ // NB: As strlen(str_lit01) != csz01, this test is undefined. It
+ // should not crash, but what gets constructed is a bit arbitrary.
+ try {
+ std::string str03(str_lit01, csz01 + 1);
+ test &= true;
+ }
+ catch(std::length_error& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ // NB: As strlen(str_lit01) != csz01, this test is undefined. It
+ // should not crash, but what gets constructed is a bit arbitrary.
+ try {
+ std::string str04(str_lit01, npos); // the "maverick's" of all string objects.
+ test &= true;
+ }
+ catch(std::length_error& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ try {
+ std::string str03(str_lit01, csz01 - 1);
+ test &= str03.size() != 0;
+ test &= str03.size() <= str03.capacity();
+ }
+ // NB: bad_alloc is regrettable but entirely kosher for
+ // out-of-memory situations.
+ catch(std::bad_alloc& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+
+ // basic_string(const char* s, const allocator& a = allocator())
+ std::string str04(str_lit01);
+ test &= str01 == str04;
+
+
+ // basic_string(size_type n, char c, const allocator& a = allocator())
+ csz01 = str01.max_size();
+ try {
+ std::string str03(csz01 + 1, 'z');
+ test &= false;
+ }
+ catch(std::length_error& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ try {
+ std::string str04(npos, 'b'); // the "maverick's" of all string objects.
+ test &= false;
+ }
+ catch(std::length_error& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ try {
+ std::string str03(csz01 - 1, 'z');
+ test &= str03.size() != 0;
+ test &= str03.size() <= str03.capacity();
+ }
+ // NB: bad_alloc is regrettable but entirely kosher for
+ // out-of-memory situations.
+ catch(std::bad_alloc& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+
+ // template<typename _InputIter>
+ // basic_string(_InputIter begin, _InputIter end, const allocator& a)
+ std::string str06(str01.begin(), str01.end());
+ test &= str06 == str01;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+void test02()
+{
+ bool test = true;
+
+ // template<typename _InputIter>
+ // basic_string(_InputIter begin, _InputIter end, const allocator& a)
+ // where _InputIter is integral [21.3.1 para 15]
+ std::string s(10,0);
+ test &= s.size() == 10;
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main()
+{
+ test01();
+ test02();
+}
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/element_access.cc b/libstdc++-v3/testsuite/21_strings/element_access.cc
new file mode 100644
index 000000000000..6f1ba0657ac0
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/element_access.cc
@@ -0,0 +1,102 @@
+// 1999-06-08 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.4 basic_string element access
+
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::const_reference cref;
+ typedef std::string::reference ref;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const std::string str01("tamarindo, costa rica");
+ std::string str02("14th street beach, capitola, california");
+ std::string str03;
+
+ // const_reference operator[] (size_type pos) const;
+ csz01 = str01.size();
+ cref cref1 = str01[csz01 - 1];
+ test &= cref1 == 'a';
+ cref cref2 = str01[csz01];
+ test &= cref2 == char();
+
+ // reference operator[] (size_type pos);
+ csz02 = str02.size();
+ ref ref1 = str02[csz02 - 1];
+ test &= ref1 == 'a';
+ ref ref2 = str02[1];
+ test &= ref2 == '4';
+
+ // const_reference at(size_type pos) const;
+ csz01 = str01.size();
+ cref cref3 = str01.at(csz01 - 1);
+ test &= cref3 == 'a';
+ try {
+ cref cref4 = str01.at(csz01);
+ test &= false; // Should not get here, as exception thrown.
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ // reference at(size_type pos);
+ csz01 = str02.size();
+ ref ref3 = str02.at(csz02 - 1);
+ test &= ref3 == 'a';
+ try {
+ ref ref4 = str02.at(csz02);
+ test &= false; // Should not get here, as exception thrown.
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+
+
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/find.cc b/libstdc++-v3/testsuite/21_strings/find.cc
new file mode 100644
index 000000000000..6459f999f09c
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/find.cc
@@ -0,0 +1,202 @@
+// 1999-06-09 bkoz
+
+// Copyright (C) 1994, 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.
+
+// 21.3.6.1 basic_string find
+
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::const_reference cref;
+ typedef std::string::reference ref;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const char str_lit01[] = "mave";
+ const std::string str01("mavericks, santa cruz");
+ std::string str02(str_lit01);
+ std::string str03("s, s");
+ std::string str04;
+
+ // size_type find(const string&, size_type pos = 0) const;
+ csz01 = str01.find(str01);
+ test &= csz01 == 0;
+ csz01 = str01.find(str01, 4);
+ test &= csz01 == npos;
+ csz01 = str01.find(str02, 0);
+ test &= csz01 == 0;
+ csz01 = str01.find(str02, 3);
+ test &= csz01 == npos;
+ csz01 = str01.find(str03, 0);
+ test &= csz01 == 8;
+ csz01 = str01.find(str03, 3);
+ test &= csz01 == 8;
+ csz01 = str01.find(str03, 12);
+ test &= csz01 == npos;
+ // It is implementation-defined if a given string contains an empty
+ // string. The only two times a char_type() (== empty string) ending
+ // element is required to be part of the string is on c_str() and
+ // operator[size()] const: the indeterminate, stored state of the
+ // string can vary, and not include a terminal char_type().
+ csz01 = str01.find(str04, 0);
+ test &= csz01 == npos || csz01 == str01.size();
+ csz01 = str01.find(str04, 5);
+ test &= csz01 == npos || csz01 == str01.size();
+
+ // size_type find(const char* s, size_type pos, size_type n) const;
+ csz01 = str01.find(str_lit01, 0, 3);
+ test &= csz01 == 0;
+ csz01 = str01.find(str_lit01, 3, 0);
+ test &= csz01 == npos;
+
+ // size_type find(const char* s, size_type pos = 0) const;
+ csz01 = str01.find(str_lit01);
+ test &= csz01 == 0;
+ csz01 = str01.find(str_lit01, 3);
+ test &= csz01 == npos;
+
+ // size_type find(char c, size_type pos = 0) const;
+ csz01 = str01.find('z');
+ csz02 = str01.size() - 1;
+ test &= csz01 == csz02;
+ csz01 = str01.find('/');
+ test &= csz01 == npos;
+
+
+ // size_type find_first_of(const string&, size_type pos = 0) const;
+ std::string str05("xena rulez");
+ csz01 = str01.find_first_of(str01);
+ test &= csz01 == 0;
+ csz01 = str01.find_first_of(str01, 4);
+ test &= csz01 == 4;
+ csz01 = str01.find_first_of(str02, 0);
+ test &= csz01 == 0;
+ csz01 = str01.find_first_of(str02, 3);
+ test &= csz01 == 3;
+ csz01 = str01.find_first_of(str03, 0);
+ test &= csz01 == 8;
+ csz01 = str01.find_first_of(str03, 3);
+ test &= csz01 == 8;
+ csz01 = str01.find_first_of(str03, 12);
+ test &= csz01 == 16;
+ csz01 = str01.find_first_of(str05, 0);
+ test &= csz01 == 1;
+ csz01 = str01.find_first_of(str05, 4);
+ test &= csz01 == 4;
+
+ // It is implementation-defined if a given string contains an empty
+ // string. The only two times a char_type() (== empty string) ending
+ // element is required to be part of the string is on c_str() and
+ // operator[size()] const: the indeterminate, stored state of the
+ // string can vary, and not include a terminal char_type().
+ csz01 = str01.find_first_of(str04, 0);
+ test &= csz01 == npos || csz01 == str01.size();
+ csz01 = str01.find_first_of(str04, 5);
+ test &= csz01 == npos || csz01 == str01.size();
+
+ // size_type find_first_of(const char* s, size_type pos, size_type n) const;
+ csz01 = str01.find_first_of(str_lit01, 0, 3);
+ test &= csz01 == 0;
+ csz01 = str01.find_first_of(str_lit01, 3, 0);
+ test &= csz01 == npos;
+
+ // size_type find_first_of(const char* s, size_type pos = 0) const;
+ csz01 = str01.find_first_of(str_lit01);
+ test &= csz01 == 0;
+ csz01 = str01.find_first_of(str_lit01, 3);
+ test &= csz01 == 3;
+
+ // size_type find_first_of(char c, size_type pos = 0) const;
+ csz01 = str01.find_first_of('z');
+ csz02 = str01.size() - 1;
+ test &= csz01 == csz02;
+
+ // size_type find_last_of(const string& str, size_type pos = 0) const;
+ // size_type find_last_of(const char* s, size_type pos, size_type n) const;
+ // size_type find_last_of(const char* s, size_type pos = 0) const;
+ // size_type find_last_of(char c, size_type pos = 0) const;
+
+#if 1
+// from tstring.cc, from jason merrill, et. al.
+ std::string x;
+ std::string::size_type pos;
+ pos = x.find_last_not_of('X');
+ test &= pos == npos;
+ pos = x.find_last_not_of("XYZ");
+ test &= pos == npos;
+
+ std::string y("a");
+ pos = y.find_last_not_of('X');
+ test &= pos == 0;
+ pos = y.find_last_not_of('a');
+ test &= pos == npos;
+ pos = y.find_last_not_of("XYZ");
+ test &= pos == 0;
+ pos = y.find_last_not_of("a");
+ test &= pos == npos;
+
+ std::string z("ab");
+ pos = z.find_last_not_of('X');
+ test &= pos == 1;
+ pos = z.find_last_not_of("XYZ");
+ test &= pos == 1;
+ pos = z.find_last_not_of('b');
+ test &= pos == 0;
+ pos = z.find_last_not_of("Xb");
+ test &= pos == 0;
+ pos = z.find_last_not_of("Xa");
+ test &= pos == 1;
+ pos = z.find_last_of("ab");
+ test &= pos == 1;
+ pos = z.find_last_of("Xa");
+ test &= pos == 0;
+ pos = z.find_last_of("Xb");
+ test &= pos == 1;
+ pos = z.find_last_of("XYZ");
+ test &= pos == std::string::npos;
+ pos = z.find_last_of('a');
+ test &= pos == 0;
+ pos = z.find_last_of('b');
+ test &= pos == 1;
+ pos = z.find_last_of('X');
+ test &= pos == std::string::npos;
+#endif
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/insert.cc b/libstdc++-v3/testsuite/21_strings/insert.cc
new file mode 100644
index 000000000000..71617d675f15
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/insert.cc
@@ -0,0 +1,200 @@
+// 1999-06-03 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.5.4 basic_string::insert
+
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+int test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::iterator citerator;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const std::string str01("rodeo beach, marin");
+ const std::string str02("baker beach, san francisco");
+ std::string str03;
+
+ // string& insert(size_type p1, const string& str, size_type p2, size_type n)
+ // requires:
+ // 1) p1 <= size()
+ // 2) p2 <= str.size()
+ // 3) rlen = min(n, str.size() - p2)
+ // throws:
+ // 1) out_of_range if p1 > size() || p2 > str.size()
+ // 2) length_error if size() >= npos - rlen
+ // effects:
+ // replaces *this with new string of length size() + rlen such that
+ // nstr[0] to nstr[p1] == thisstr[0] to thisstr[p1]
+ // nstr[p1 + 1] to nstr[p1 + rlen] == str[p2] to str[p2 + rlen]
+ // nstr[p1 + 1 + rlen] to nstr[...] == thisstr[p1 + 1] to thisstr[...]
+ str03 = str01;
+ csz01 = str03.size();
+ csz02 = str02.size();
+ try {
+ str03.insert(csz01 + 1, str02, 0, 5);
+ test &= false;
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ str03 = str01;
+ csz01 = str03.size();
+ csz02 = str02.size();
+ try {
+ str03.insert(0, str02, csz02 + 1, 5);
+ test &= false;
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ csz01 = str01.max_size();
+ try {
+ std::string str04(csz01, 'b');
+ str03 = str04;
+ csz02 = str02.size();
+ try {
+ str03.insert(0, str02, 0, 5);
+ test &= false;
+ }
+ catch(std::length_error& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+ }
+ catch(std::bad_alloc& failure){
+ test &= true;
+ }
+ catch(std::exception& failure){
+ test &= false;
+ }
+
+ str03 = str01;
+ csz01 = str03.size();
+ csz02 = str02.size();
+ str03.insert(13, str02, 0, 12);
+ test&= str03 == "rodeo beach, baker beach,marin";
+
+ str03 = str01;
+ csz01 = str03.size();
+ csz02 = str02.size();
+ str03.insert(0, str02, 0, 12);
+ test&= str03 == "baker beach,rodeo beach, marin";
+
+ str03 = str01;
+ csz01 = str03.size();
+ csz02 = str02.size();
+ str03.insert(csz01, str02, 0, csz02);
+ test&= str03 == "rodeo beach, marinbaker beach, san francisco";
+
+ // string& insert(size_type __p, const string& string);
+ // insert(p1, str, 0, npos)
+ str03 = str01;
+ csz01 = str03.size();
+ csz02 = str02.size();
+ str03.insert(csz01, str02);
+ test&= str03 == "rodeo beach, marinbaker beach, san francisco";
+
+ str03 = str01;
+ csz01 = str03.size();
+ csz02 = str02.size();
+ str03.insert(0, str02);
+ test&= str03 == "baker beach, san franciscorodeo beach, marin";
+
+ // string& insert(size_type __p, const char* s, size_type n);
+ // insert(p1, string(s,n))
+ str03 = str02;
+ csz01 = str03.size();
+ str03.insert(0, "-break at the bridge", 20);
+ test&= str03 == "-break at the bridgebaker beach, san francisco";
+
+ // string& insert(size_type __p, const char* s);
+ // insert(p1, string(s))
+ str03 = str02;
+ str03.insert(0, "-break at the bridge");
+ test&= str03 == "-break at the bridgebaker beach, san francisco";
+
+ // string& insert(size_type __p, size_type n, char c)
+ // insert(p1, string(n,c))
+ str03 = str02;
+ csz01 = str03.size();
+ str03.insert(csz01, 5, 'z');
+ test&= str03 == "baker beach, san franciscozzzzz";
+
+ // iterator insert(iterator p, char c)
+ // inserts a copy of c before the character referred to by p
+ str03 = str02;
+ citerator cit01 = str03.begin();
+ str03.insert(cit01, 'u');
+ test&= str03 == "ubaker beach, san francisco";
+
+ // iterator insert(iterator p, size_type n, char c)
+ // inserts n copies of c before the character referred to by p
+ str03 = str02;
+ cit01 = str03.begin();
+ str03.insert(cit01, 5, 'u');
+ test&= str03 == "uuuuubaker beach, san francisco";
+
+ // template<inputit>
+ // void
+ // insert(iterator p, inputit first, inputit, last)
+ // ISO-14882: defect #7 part 1 clarifies this member function to be:
+ // insert(p - begin(), string(first,last))
+ str03 = str02;
+ csz01 = str03.size();
+ str03.insert(str03.begin(), str01.begin(), str01.end());
+ test&= str03 == "rodeo beach, marinbaker beach, san francisco";
+
+ str03 = str02;
+ csz01 = str03.size();
+ str03.insert(str03.end(), str01.begin(), str01.end());
+ test&= str03 == "baker beach, san franciscorodeo beach, marin";
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/inserters_extractors.cc b/libstdc++-v3/testsuite/21_strings/inserters_extractors.cc
new file mode 100644
index 000000000000..8b476fd4e77b
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/inserters_extractors.cc
@@ -0,0 +1,315 @@
+// 1999-07-01 bkoz
+
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.7.9 inserters and extractors
+
+// NB: This file is predicated on sstreams, istreams, and ostreams
+// working, not to mention other major details like char_traits, and
+// all of the string class.
+
+#include <string>
+#include <stdexcept>
+#include <sstream>
+#include <fstream>
+#include <iostream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::const_reference cref;
+ typedef std::string::reference ref;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const char str_lit01[] = "sailing grand traverse bay
+ from Elk Rapids to the point reminds me of miles";
+ const std::string str01(str_lit01);
+ const std::string str02("sailing");
+ const std::string str03("grand");
+ const std::string str04("traverse");
+ const std::string str05;
+ std::string str10;
+
+ // istream& operator>>(istream&, string&)
+ std::istringstream istrs01(str01);
+ istrs01 >> str10;
+ test &= str10 == str02;
+ try {
+ std::istringstream::int_type i01 = istrs01.peek(); //a-boo
+ test &= std::istringstream::traits_type::to_char_type(i01) == ' ';
+ }
+ catch(std::exception& fail) {
+ test &= false; // shouldn't throw
+ }
+
+ istrs01 >> str10;
+ test &= str10 == str03;
+ istrs01 >> str10;
+ test &= str10 == str04; // sentry picks out the white spaces. .
+
+ std::istringstream istrs02(str05); // empty
+ istrs02 >> str10;
+ test &= str10 == str04;
+
+ // istream& getline(istream&, string&, char)
+ // istream& getline(istream&, string&)
+ try {
+ getline(istrs01, str10);
+ test &= !istrs01.fail();
+ test &= !istrs01.eof();
+ test &= istrs01.good();
+ test &= str10 == " bay";
+ }
+ catch(std::exception& fail) {
+ test &= false; // shouldn't throw
+ }
+
+ try {
+ istrs01.clear();
+ getline(istrs01, str10,'\t');
+ test &= !istrs01.fail();
+ test &= !istrs01.eof();
+ test &= istrs01.good();
+ test &= str10 == str05;
+ }
+ catch(std::exception& fail) {
+ test &= false; // shouldn't throw
+ }
+
+ try {
+ istrs01.clear();
+ getline(istrs01, str10,'\t');
+ test &= !istrs01.fail();
+ test &= !istrs01.eof();
+ test &= istrs01.good();
+ test &= str10 == str05;
+ }
+ catch(std::exception& fail) {
+ test &= false; // shouldn't throw
+ }
+
+ try {
+ istrs01.clear();
+ getline(istrs01, str10, '.');
+ test &= !istrs01.fail();
+ test &= istrs01.eof();
+ test &= !istrs01.good();
+ test &= str10 == "\t from Elk Rapids to the point reminds me of miles";
+ }
+ catch(std::exception& fail) {
+ test &= false; // shouldn't throw
+ }
+
+ try {
+ getline(istrs02, str10);
+ test &= istrs02.fail();
+ test &= istrs02.eof();
+ test &= str10 == "\t from Elk Rapids to the point reminds me of miles";
+ }
+ catch(std::exception& fail) {
+ test &= false; // shouldn't throw
+ }
+
+ // ostream& operator<<(ostream&, const basic_string&)
+ std::ostringstream ostrs01;
+ try {
+ ostrs01 << str01;
+ test &= ostrs01.str() == str01;
+ }
+ catch(std::exception& fail) {
+ test &= false;
+ }
+
+ std::string hello_world;
+ std::cout << hello_world;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+
+// testing basic_stringbuf::xsputn via stress testing with large strings
+// based on a bug report libstdc++ 9
+void test04(int size)
+{
+ bool test = true;
+ std::string str(size, 's');
+ int expected_size = (2 * (size + sizeof(char)));
+ std::ostringstream oss(str);
+
+ // sanity checks
+ test &= str.size() == size;
+ test &= oss.good();
+
+ // stress test
+ oss << str << std::endl;
+ if (!oss.good())
+ test = false;
+
+ oss << str << std::endl;
+ if (!oss.good())
+ test = false;
+
+ test &= str.size() == size;
+ test &= oss.good();
+ std::string str_tmp = oss.str();
+ test &= str_tmp.size() == expected_size;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+
+// testing basic_filebuf::xsputn via stress testing with large strings
+// based on a bug report libstdc++ 9
+// mode == out
+void test05(int size)
+{
+ bool test = true;
+ const char* filename = "testsuite/inserters_extractors-1.txt";
+ const char fillc = 'f';
+ std::ofstream ofs(filename);
+ std::string str(size, fillc);
+
+ // sanity checks
+ test &= str.size() == size;
+ test &= ofs.good();
+
+ // stress test
+ ofs << str << std::endl;
+ if (!ofs.good())
+ test = false;
+
+ ofs << str << std::endl;
+ if (!ofs.good())
+ test = false;
+
+ test &= str.size() == size;
+ test &= ofs.good();
+
+ ofs.close();
+
+ // sanity check on the written file
+ std::ifstream ifs(filename);
+ int count = 0;
+ char c;
+ while (count <= (2 * size) + 4)
+ {
+ ifs >> c;
+ if (ifs.good() && c == fillc)
+ {
+ ++count;
+ c = '0';
+ }
+ else
+ break;
+ }
+
+ test &= count == 2 * size;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+
+// istringstream/stringbuf extractor properly size buffer based on
+// actual, not allocated contents (string.size() vs. string.capacity()).
+// http://sourceware.cygnus.com/ml/libstdc++/1999-q4/msg00049.html
+void test06(void)
+{
+ bool test = true;
+
+ typedef std::string::size_type size_type;
+ std::string str01("@silent");
+ size_type i01 = str01.size();
+ size_type i02 = str01.capacity();
+ str01.erase(0, 1);
+ size_type i03 = str01.size();
+ size_type i04 = str01.capacity();
+ test &= i01 - 1 == i03;
+ test &= i02 >= i04;
+
+ std::istringstream is(str01);
+ std::string str02;
+ is >> str02 >> std::ws;
+ size_type i05 = str02.size();
+ size_type i06 = str02.capacity();
+ test &= i05 == i03;
+ test &= i06 <= i04;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+// http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00085.html
+// istream::operator>>(string)
+// sets failbit
+// NB: this is a defect in the standard.
+void test07(void)
+{
+ bool test = true;
+ const std::string name("z6.cc");
+ std::istringstream iss (name);
+ int i = 0;
+ std::string s;
+ while (iss >> s)
+ ++i;
+
+ test &= i < 3;
+ test &= static_cast<bool>(iss.rdstate() & std::ios_base::failbit);
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main()
+{
+ test01();
+
+ test04(1); // expected_size == 4
+ test04(1000); // expected_size == 2002
+ test04(10000); // expected_size == 20002
+
+ test05(1);
+ test05(1000);
+ test05(10000);
+
+ test06();
+ test07();
+
+ return 0;
+}
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/invariants.cc b/libstdc++-v3/testsuite/21_strings/invariants.cc
new file mode 100644
index 000000000000..1eeabd3d0263
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/invariants.cc
@@ -0,0 +1,181 @@
+// 1999-06-08 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3 template class basic_string
+
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+// Do a quick sanity check on known problems with element access and
+// ref-counted strings. These should all pass, regardless of the
+// underlying string implementation, of course.
+bool test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::iterator siterator;
+ typedef std::string::reverse_iterator sriterator;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+ siterator it1;
+ sriterator rit1;
+
+ std::string str01("montara beach, half moon bay");
+ const std::string str02("ocean beach, san francisco");
+ std::string str03;
+
+ // 21.3 p 5
+
+ // References, pointers, and iterators referring to the elements of
+ // a basic_string may be invalidated by the following uses of that
+ // basic_string object:
+
+ // ...
+
+ // Susequent to any of the above uses except the forms of insert()
+ // and erase() which return iterators, the first call to non-const
+ // member functions operator[](), at(), begin(), rbegin(), end(), or
+ // rend()
+
+ str03 = str01;
+ it1 = str01.begin();
+ *it1 = 'x';
+ test &= str01[0] == 'x';
+ test &= str03[0] == 'm';
+
+ str03 = str01;
+ csz01 = str01.size();
+ rit1 = str01.rbegin(); // NB: Pointing at one-past the end, so ...
+ *rit1 = 'z'; // ... but it's taken care of here
+ test &= str01[csz01 - 1] == 'z';
+ test &= str03[csz01 - 1] == 'y';
+
+ str03 = str01;
+ csz01 = str01.size();
+ std::string::reference r1 = str01.at(csz01 - 2);
+ test &= str03 == str01;
+ r1 = 'd';
+ test &= str01[csz01 - 2] == 'd';
+ test &= str03[csz01 - 2] == 'a';
+
+ str03 = str01;
+ csz01 = str01.size();
+ std::string::reference r2 = str01[csz01 - 3];
+ test &= str03 == str01;
+ r2 = 'w';
+ test &= str01[csz01 - 3] == 'w';
+ test &= str03[csz01 - 3] == 'b';
+
+ str03 = str01;
+ csz02 = str01.size();
+ it1 = str01.end();
+ test &= str03 == str01;
+ --it1;
+ *it1 = 'q';
+ test &= str01[csz02 - 1] == 'q';
+ test &= str03[csz02 - 1] == 'z';
+
+ str03 = str01;
+ rit1 = str01.rend();
+ test &= str03 == str01;
+ --rit1;
+ *rit1 = 'p';
+ test &= str01[0] == 'p';
+ test &= str03[0] == 'x';
+
+ // need to also test for const begin/const end
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+// Do another sanity check, this time for member functions that return
+// iterators, namely insert and erase.
+bool test02(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::iterator siterator;
+ typedef std::string::reverse_iterator sriterator;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+ siterator it1;
+ sriterator rit1;
+
+ const std::string str01("its beach, santa cruz");
+
+ std::string str02 = str01;
+ std::string str05 = str02; // optional, so that begin below causes a mutate
+ std::string::iterator p = str02.insert(str02.begin(), ' ');
+ std::string str03 = str02;
+ test &= str03 == str02;
+ *p = '!';
+ test &= *str03.c_str() == ' ';
+ str03[0] = '@';
+ test &= str02[0] == '!';
+ test &= *p == '!';
+ test &= str02 != str05;
+ test &= str02 != str03;
+
+ std::string str10 = str01;
+ std::string::iterator p2 = str10.insert(str10.begin(), 'a');
+ std::string str11 = str10;
+ *p2 = 'e';
+ test &= str11 != str10;
+
+ std::string str06 = str01;
+ std::string str07 = str06; // optional, so that begin below causes a mutate
+ p = str06.erase(str06.begin());
+ std::string str08 = str06;
+ test &= str08 == str06;
+ *p = '!';
+ test &= *str08.c_str() == 't';
+ str08[0] = '@';
+ test &= str06[0] == '!';
+ test &= *p == '!';
+ test &= str06 != str07;
+ test &= str06 != str08;
+
+ std::string str12 = str01;
+ p2 = str12.erase(str12.begin(), str12.begin() + str12.size() - 1);
+ std::string str13 = str12;
+ *p2 = 'e';
+ test &= str12 != str13;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+ test02();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/nonmember.cc b/libstdc++-v3/testsuite/21_strings/nonmember.cc
new file mode 100644
index 000000000000..2116839e7f15
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/nonmember.cc
@@ -0,0 +1,306 @@
+// 1998-10-01, 1999-06-25 bkoz
+
+// Copyright (C) 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.
+
+// 21.3.7.1 basic_string non-member functions
+
+// 21.3.7.2 operator==
+/*
+template<class charT, class traits, class Allocator>
+ bool operator==(const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator==(const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator==(const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+*/
+
+// 21.3.7.3 operator!=
+/*
+template<class charT, class traits, class Allocator>
+ bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator!=(const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+*/
+
+// 21.3.7.4 operator<
+/*
+template<class charT, class traits, class Allocator>
+ bool operator< (const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator< (const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator< (const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+*/
+
+// 21.3.7.5 operator>
+/*
+template<class charT, class traits, class Allocator>
+ bool operator> (const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator> (const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator> (const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+*/
+
+//21.3.7.6 operator<=
+/*
+template<class charT, class traits, class Allocator>
+ bool operator<=(const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator<=(const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator<=(const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+*/
+
+// 21.3.7.7 operator>=
+/*
+template<class charT, class traits, class Allocator>
+ bool operator>=(const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator>=(const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+ bool operator>=(const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+*/
+
+#include <string>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+int test01(void)
+{
+ bool test = true;
+ std::string str_0("costa rica");
+ std::string str_1("costa marbella");
+ std::string str_2("cost");
+ std::string str_3("costa ricans");
+ std::string str_4;
+
+ str_4 = str_0;
+ //comparisons between string objects
+ test &= !(str_0 == str_1);
+ test &= !(str_0 == str_2);
+ test &= !(str_0 == str_3);
+ test &= !(str_1 == str_0);
+ test &= !(str_2 == str_0);
+ test &= !(str_3 == str_0);
+ test &= str_4 == str_0;
+ test &= str_0 == str_4;
+
+ test &= str_0 != str_1;
+ test &= str_0 != str_2;
+ test &= str_0 != str_3;
+ test &= str_1 != str_0;
+ test &= str_2 != str_0;
+ test &= str_3 != str_0;
+ test &= !(str_0 != str_4);
+ test &= !(str_4 != str_0);
+
+ test &= str_0 > str_1; //true cuz r>m
+ test &= str_0 > str_2;
+ test &= !(str_0 > str_3);
+ test &= !(str_1 > str_0); //false cuz m<r
+ test &= !(str_2 > str_0);
+ test &= str_3 > str_0;
+ test &= !(str_0 > str_4);
+ test &= !(str_4 > str_0);
+
+ test &= !(str_0 < str_1); //false cuz r>m
+ test &= !(str_0 < str_2);
+ test &= str_0 < str_3;
+ test &= str_1 < str_0; //true cuz m<r
+ test &= str_2 < str_0;
+ test &= !(str_3 < str_0);
+ test &= !(str_0 < str_4);
+ test &= !(str_4 < str_0);
+
+ test &= str_0 >= str_1; //true cuz r>m
+ test &= str_0 >= str_2;
+ test &= !(str_0 >= str_3);
+ test &= !(str_1 >= str_0);//false cuz m<r
+ test &= !(str_2 >= str_0);
+ test &= str_3 >= str_0;
+ test &= str_0 >= str_4;
+ test &= str_4 >= str_0;
+
+ test &= !(str_0 <= str_1);//false cuz r>m
+ test &= !(str_0 <= str_2);
+ test &= str_0 <= str_3;
+ test &= str_1 <= str_0;//true cuz m<r
+ test &= str_2 <= str_0;
+ test &= !(str_3 <= str_0);
+ test &= str_0 <= str_4;
+ test &= str_4 <= str_0;
+
+ //comparisons between string object and string literal
+ test &= !(str_0 == "costa marbella");
+ test &= !(str_0 == "cost");
+ test &= !(str_0 == "costa ricans");
+ test &= !("costa marbella" == str_0);
+ test &= !("cost" == str_0);
+ test &= !("costa ricans" == str_0);
+ test &= "costa rica" == str_0;
+ test &= str_0 == "costa rica";
+
+ test &= str_0 != "costa marbella";
+ test &= str_0 != "cost";
+ test &= str_0 != "costa ricans";
+ test &= "costa marbella" != str_0;
+ test &= "cost" != str_0;
+ test &= "costa ricans" != str_0;
+ test &= !("costa rica" != str_0);
+ test &= !(str_0 != "costa rica");
+
+ test &= str_0 > "costa marbella"; //true cuz r>m
+ test &= str_0 > "cost";
+ test &= !(str_0 > "costa ricans");
+ test &= !("costa marbella" > str_0);//false cuz m<r
+ test &= !("cost" > str_0);
+ test &= "costa ricans" > str_0;
+ test &= !("costa rica" > str_0);
+ test &= !(str_0 > "costa rica");
+
+ test &= !(str_0 < "costa marbella");//false cuz r>m
+ test &= !(str_0 < "cost");
+ test &= str_0 < "costa ricans";
+ test &= "costa marbella" < str_0;//true cuz m<r
+ test &= "cost" < str_0;
+ test &= !("costa ricans" < str_0);
+ test &= !("costa rica" < str_0);
+ test &= !(str_0 < "costa rica");
+
+ test &= str_0 >= "costa marbella";//true cuz r>m
+ test &= str_0 >= "cost";
+ test &= !(str_0 >= "costa ricans");
+ test &= !("costa marbella" >= str_0);//false cuz m<r
+ test &= !("cost" >= str_0);
+ test &= "costa ricans" >= str_0;
+ test &= "costa rica" >= str_0;
+ test &= str_0 >= "costa rica";
+
+ test &= !(str_0 <= "costa marbella");//false cuz r>m
+ test &= !(str_0 <= "cost");
+ test &= str_0 <= "costa ricans";
+ test &= "costa marbella" <= str_0;//true cuz m<r
+ test &= "cost" <= str_0;
+ test &= !("costa ricans" <= str_0);
+ test &= "costa rica" <= str_0;
+ test &= str_0 <= "costa rica";
+
+ // 21.3.7.1 operator+
+/*
+template<class charT, class traits, class Allocator>
+ basic_string<charT,traits,Allocator>
+ operator+(const basic_string<charT,traits,Allocator>& lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ basic_string<charT,traits,Allocator>
+ operator+(const charT* lhs,
+ const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ basic_string<charT,traits,Allocator>
+ operator+(const basic_string<charT,traits,Allocator>& lhs,
+ const charT* rhs);
+
+template<class charT, class traits, class Allocator>
+ basic_string<charT,traits,Allocator>
+ operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs);
+
+template<class charT, class traits, class Allocator>
+ basic_string<charT,traits,Allocator>
+ operator+(const basic_string<charT,traits,Allocator>& lhs, charT rhs);
+*/
+
+ str_4 = str_0 + "ns";
+ test &= str_4 == str_3;
+
+ const std::string str_5(" marbella");
+ str_4 = "costa" + str_5;
+ test &= str_4 == str_1;
+
+ std::string str_6("ns");
+ str_4 = str_0 + str_6;
+ test &= str_4 == str_3;
+
+ str_4 = str_0 + 'n';
+ str_4 = str_4 + 's';
+ test &= str_4 == str_3;
+
+ str_4 = 'a' + str_6;
+ str_4 = 'c' + str_4;
+ str_4 = 'i' + str_4;
+ str_4 = 'r' + str_4;
+ str_4 = ' ' + str_4;
+ str_4 = 'a' + str_4;
+ str_4 = 't' + str_4;
+ str_4 = 's' + str_4;
+ str_4 = 'o' + str_4;
+ str_4 = 'c' + str_4;
+ test &= str_4 == str_3;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return 0;
+}
+
+int main() {
+ test01();
+}
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/operations.cc b/libstdc++-v3/testsuite/21_strings/operations.cc
new file mode 100644
index 000000000000..06e811f5ca46
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/operations.cc
@@ -0,0 +1,58 @@
+// 1999-05-07 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.6 string operations
+
+#include <string>
+#include <cstdio>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+int test01(void)
+{
+ bool test = true;
+
+ std::string str1;
+ std::string str2;
+
+ // Should get this:
+ // 1:8-chars_8-chars_
+ // 2:8-chars_8-chars_
+ str1 = std::string("8-chars_") + "8-chars_";
+ const char* p1 = str1.c_str();
+ // printf("1:%s\n", str1.c_str());
+ str2 = str1 + "7-chars";
+ // printf("2:%s\n", str1.c_str()); //str1 is gone
+ const char* p2 = str1.c_str();
+ return 0;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
diff --git a/libstdc++-v3/testsuite/21_strings/replace.cc b/libstdc++-v3/testsuite/21_strings/replace.cc
new file mode 100644
index 000000000000..b72604a24991
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/replace.cc
@@ -0,0 +1,96 @@
+// 1999-06-10 bkoz
+
+// Copyright (C) 1994, 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.
+
+// 21.3.5.6 basic_string::replace
+
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::const_reference cref;
+ typedef std::string::reference ref;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const char str_lit01[] = "ventura, california";
+ const std::string str01(str_lit01);
+ std::string str02("del mar, california");
+ std::string str03(" and ");
+ std::string str05;
+
+ // string& replace(size_type pos, size_type n, const string& string)
+ // string& replace(size_type pos1, size_type n1, const string& string,
+ // size_type pos2, size_type n2)
+ // string& replace(size_type pos, size_type n1, const char* s, size_type n2)
+ // string& replace(size_type pos, size_type n1, const char* s)
+ // string& replace(size_type pos, size_type n1, size_type n2, char c)
+ // string& replace(iterator it1, iterator it2, const string& str)
+ // string& replace(iterator it1, iterator it2, const chat* s, size_type n)
+ // string& replace(iterator it1, iterator it2, const chat* s)
+ // string& replace(iterator it1, iterator it2, size_type n, char c)
+ // template<typename InputIter>
+ // string& replace(iterator it1, iterator it2, InputIter j1, InputIter j2)
+
+#if 1
+ // with mods, from tstring.cc, from jason merrill, et. al.
+ std::string X = "Hello";
+ std::string x = X;
+
+ char ch = x[0];
+ test &= ch == 'H';
+
+ std::string z = x.substr(2, 3);
+ test &= z == "llo";
+
+ x.replace(2, 2, "r");
+ test &= x == "Hero";
+
+ x = X;
+ x.replace(0, 1, "j");
+ test &= 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]));
+ test &= x == "jeHelloo";
+#endif
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/21_strings/substr.cc b/libstdc++-v3/testsuite/21_strings/substr.cc
new file mode 100644
index 000000000000..354dbb2e7cf6
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/substr.cc
@@ -0,0 +1,86 @@
+// 1999-06-10 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 21.3.6.7 basic_string::substr
+
+#include <string>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::const_reference cref;
+ typedef std::string::reference ref;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const char str_lit01[] = "rockaway, pacifica";
+ const std::string str01(str_lit01);
+ std::string str02;
+
+ // basic_string<charT, _Traits, _Alloc>
+ // substr(size_type pos = 0, size_type n = npos) const;
+ csz01 = str01.size();
+ str02 = str01.substr(0, 1);
+ test &= str02 == "r";
+ str02 = str01.substr(10);
+ test &= str02 == "pacifica";
+
+ try {
+ str02 = str01.substr(csz01 + 1);
+ test &= false;
+ }
+ catch(std::out_of_range& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ try {
+ str02 = str01.substr(csz01);
+ test &= str02.size() == 0;
+ }
+ catch(std::out_of_range& fail) {
+ test &= false;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/22_locale/ctype.cc b/libstdc++-v3/testsuite/22_locale/ctype.cc
new file mode 100644
index 000000000000..b983c92c90f0
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype.cc
@@ -0,0 +1,34 @@
+// 1999-08-24 bkoz
+
+// Copyright (C) 2000, 1999 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.
+
+// 22.2.1 the ctype category
+
+// 1: Test that the locale headers are picking up the correct declaration
+// of the internal type `ctype_base::mask'.
+int mask ();
+
+#include <locale>
+
+// 2: Should be able to instantiate this for other types besides char, wchar_t
+class gnu_ctype: public std::ctype<unsigned char> { };
+gnu_ctype facet01;
+
+
+int main() { }
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_char_members.cc b/libstdc++-v3/testsuite/22_locale/ctype_char_members.cc
new file mode 100644
index 000000000000..06ce7c394137
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/ctype_char_members.cc
@@ -0,0 +1,105 @@
+// 2000-02-16 bkoz
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 22.2.1.3.2 ctype<char> members
+
+#include <locale>
+// NB: Don't include any other headers in this file.
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+class gnu_ctype: public std::ctype<char> {};
+
+void test01()
+{
+ bool test = true;
+ const char strlit00[] = "manilla, cebu, tandag PHILIPPINES";
+ const char strlit01[] = "MANILLA, CEBU, TANDAG PHILIPPINES";
+ const char strlit02[] = "manilla, cebu, tandag philippines";
+ const char c00 = 'S';
+ const char c10 = 's';
+ const char c20 = '9';
+ const char c30 = ' ';
+ const char c40 = '!';
+ const char c50 = 'F';
+ const char c60 = 'f';
+ const char c70 = 'X';
+ const char c80 = 'x';
+
+ gnu_ctype gctype;
+ char c100;
+ int len = std::char_traits<char>::length(strlit00);
+ char c_array[len + 1];
+
+ // bool is(mask m, char c) const;
+ test &= gctype.is(std::ctype_base::space, c30);
+ test &= gctype.is(std::ctype_base::upper, c00);
+ test &= gctype.is(std::ctype_base::lower, c10);
+ test &= gctype.is(std::ctype_base::digit, c20);
+ test &= gctype.is(std::ctype_base::punct, c40);
+ test &= gctype.is(std::ctype_base::alpha, c50);
+ test &= gctype.is(std::ctype_base::alpha, c60);
+ test &= gctype.is(std::ctype_base::xdigit, c20);
+ test &= !gctype.is(std::ctype_base::xdigit, c80);
+ test &= gctype.is(std::ctype_base::alnum, c50);
+ test &= gctype.is(std::ctype_base::alnum, c20);
+ test &= gctype.is(std::ctype_base::graph, c40);
+ test &= gctype.is(std::ctype_base::graph, c20);
+
+ // char toupper(char c) const
+ c100 = gctype.toupper(c10);
+ test &= c100 == c00;
+
+ // char tolower(char c) const
+ c100 = gctype.tolower(c00);
+ test &= c100 == c10;
+
+ // char toupper(char* low, const char* hi) const
+ std::char_traits<char>::copy(c_array, strlit02, len + 1);
+ gctype.toupper(c_array, c_array + len);
+ test &= !std::char_traits<char>::compare(c_array, strlit01, len - 1);
+
+ // char tolower(char* low, const char* hi) const
+ std::char_traits<char>::copy(c_array, strlit01, len + 1);
+ gctype.tolower(c_array, c_array + len);
+ test &= !std::char_traits<char>::compare(c_array, strlit02, len - 1);
+
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main() {
+ test01();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/23_containers/bitset_ctor.cc b/libstdc++-v3/testsuite/23_containers/bitset_ctor.cc
new file mode 100644
index 000000000000..922d47028a09
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset_ctor.cc
@@ -0,0 +1,90 @@
+// 1999-06-08 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 23.3.5.1 bitset constructors
+
+#include <string>
+#include <bitset>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+
+ // bitset()
+ const size_t n1 = 5;
+ std::bitset<n1> bit01;
+ for (int i = 0; i < n1; ++i)
+ test &= !bit01.test(i);
+
+ // bitset(unsigned long)
+ const size_t n2 = 32;
+ unsigned long ul1 = 2;
+ std::bitset<n2> bit02(ul1);
+ test &= !bit02.test(0);
+ test &= bit02.test(1);
+ test &= !bit02.test(2);
+
+ // template<_CharT, _Traits, _Alloc>
+ // explicit bitset(const basic_string<_C,_T,_A>&, size_type pos, size_type n)
+ std::string str01("stuff smith sessions");
+ const size_t n3 = 128;
+ try {
+ std::bitset<n3> bit03(str01, 5);
+ }
+ catch(std::invalid_argument& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test&= false;
+ }
+
+ std::string str02("010101000011");
+ int sz = str02.size();
+ try {
+ std::bitset<n3> bit03(str02, 0);
+ std::string str03;
+ for (int i = 0; i < sz; ++i)
+ str03 += (bit03.test(i) ? '1' : '0');
+ reverse(str03.begin(), str03.end());
+ test &= str03 == str02;
+ }
+ catch(std::invalid_argument& fail) {
+ test &= false;
+ }
+ catch(...) {
+ test&= false;
+ }
+
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset_shift.cc b/libstdc++-v3/testsuite/23_containers/bitset_shift.cc
new file mode 100644
index 000000000000..d439edba369b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset_shift.cc
@@ -0,0 +1,116 @@
+// 2000-01-15 Anders Widell <awl@hem.passagen.se>
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <string>
+#include <set>
+#include <bitset>
+
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+static char original_bits[1024];
+static char left_shifted[1024];
+static char right_shifted[1024];
+
+char
+random_bit() {
+ static long x = 1;
+ return ((x = (3432L*x + 6789L) % 9973L) & 1) + '0';
+}
+
+void
+initialise(size_t size) {
+ for (size_t i=0; i<size; i++)
+ original_bits[i] = random_bit();
+
+ original_bits[size] = '\0';
+ left_shifted[size] = '\0';
+ right_shifted[size] = '\0';
+}
+
+void
+shift_arrays(size_t shift_step, size_t size) {
+ for (size_t i=shift_step; i<size; i++) {
+ right_shifted[i] = original_bits[i-shift_step];
+ left_shifted[size-i-1] = original_bits[size+shift_step-i-1];
+ }
+ for (size_t i=0; i<shift_step && i<size; i++) {
+ right_shifted[i] = '0';
+ left_shifted[size-i-1] = '0';
+ }
+}
+
+template <size_t size>
+ bool
+ do_test() {
+ bool test = true;
+
+ std::bitset<size> shifted;
+ std::bitset<size> correct;
+
+ initialise(size);
+
+ //std::bitset<size> original = std::string(original_bits);
+ std::bitset<size> original = std::bitset<size> (std::string(original_bits));
+
+ for (size_t shift_step=0; shift_step==0 || shift_step<size; shift_step++) {
+ shift_arrays(shift_step, size);
+
+ shifted = original;
+ shifted <<= shift_step;
+ //correct = std::string(left_shifted);
+ correct = std::bitset<size> (std::string(left_shifted));
+ test &= shifted == correct;
+
+ shifted = original;
+ shifted >>= shift_step;
+ //correct = std::string(right_shifted);
+ correct = std::bitset<size> (std::string(right_shifted));
+ test &= shifted == correct;
+ }
+
+ return test;
+ }
+
+bool
+test01() {
+ bool test = true;
+
+ test &= do_test<32>();
+ test &= do_test<48>();
+ test &= do_test<64>();
+
+ test &= do_test<511>();
+ test &= do_test<513>();
+ test &= do_test<997>();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int
+main() {
+ test01();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset.cc b/libstdc++-v3/testsuite/23_containers/multiset.cc
new file mode 100644
index 000000000000..5e9c195c84cd
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset.cc
@@ -0,0 +1,73 @@
+// 1999-06-24 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 23.3.4 template class multiset
+
+#include <iostream>
+#include <set>
+#include <algorithm>
+
+namespace std {
+ std::ostream&
+ operator<<(std::ostream& os, std::pair<int, int> const& p)
+ { return os << p.first << ' ' << p.second; }
+}
+
+bool
+operator<(std::pair<int, int> const& lhs, std::pair<int, int> const& rhs)
+{ return lhs.first < rhs.first; }
+
+int main ()
+{
+ typedef std::multiset<std::pair<int, int> >::iterator iterator;
+ std::pair<int, int> p(69, 0);
+ std::multiset<std::pair<int, int> > s;
+
+ for (p.second = 0; p.second < 5; ++p.second)
+ s.insert(p);
+ for (iterator it = s.begin(); it != s.end(); ++it)
+ if (it->second < 5)
+ {
+ s.insert(it, p);
+ ++p.second;
+ }
+
+ // XXX need to use debug-assert here and get this working with an
+ // ostrinsrtream, that way we can just check the strings for
+ // equivalance.
+ std::copy(s.begin(), s.end(),
+ std::ostream_iterator<std::pair<int, int> >(std::cout, "\n"));
+
+ return 0;
+}
+
+/* output:
+69 5
+69 0
+69 6
+69 1
+69 7
+69 2
+69 8
+69 3
+69 9
+69 4
+*/
+
diff --git a/libstdc++-v3/testsuite/23_containers/vector_capacity.cc b/libstdc++-v3/testsuite/23_containers/vector_capacity.cc
new file mode 100644
index 000000000000..c5207f41361f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector_capacity.cc
@@ -0,0 +1,69 @@
+// 1999-05-07
+// bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 23.2.4.2 vector capacity
+
+#include <vector>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+template<typename T>
+ struct A { };
+
+struct B { };
+
+bool test01()
+{
+
+ // non POD types
+ bool test = true;
+ std::vector< A<B> > vec01;
+ typedef std::vector< A<B> >::size_type size_type;
+
+ size_type sz01 = vec01.capacity();
+ vec01.reserve(100);
+ size_type sz02 = vec01.capacity();
+ test &= sz02 >= sz01;
+
+ sz01 = vec01.size() + 5;
+ vec01.resize(sz01);
+ sz02 = vec01.size();
+ test &= sz01 == sz02;
+
+ sz01 = vec01.size() - 5;
+ vec01.resize(sz01);
+ sz02 = vec01.size();
+ test &= sz01 == sz02;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector_ctor.cc b/libstdc++-v3/testsuite/23_containers/vector_ctor.cc
new file mode 100644
index 000000000000..204ab55286e7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector_ctor.cc
@@ -0,0 +1,64 @@
+// 1999-06-29
+// bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 23.2.4.1 vector constructors, copy, and assignment
+
+#include <vector>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+template<typename T>
+ struct A { };
+
+struct B { };
+
+bool test01()
+{
+
+ // 1
+ bool test = true;
+ std::vector< A<B> > vec01;
+ std::vector< A<B> > vec02(5);
+ typedef std::vector< A<B> >::size_type size_type;
+
+ vec01 = vec02;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// 2
+template class std::vector<double>;
+template class std::vector< A<B> >;
+
+int main()
+{
+ test01();
+
+ return 0;
+}
+
+
+
diff --git a/libstdc++-v3/testsuite/23_containers/vector_modifiers.cc b/libstdc++-v3/testsuite/23_containers/vector_modifiers.cc
new file mode 100644
index 000000000000..b72d749c503a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector_modifiers.cc
@@ -0,0 +1,71 @@
+// 1999-11-09 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 23.2.4.3 vector modifiers
+
+#include <vector>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+template<typename T>
+ struct A { };
+
+struct B { };
+
+// vector::insert(iterator, inputiterator first, inputiterator last)
+bool test01()
+{
+ bool test = true;
+
+ // POD types
+ typedef std::vector<int> vec_POD;
+ vec_POD vec01;
+ int i01 = 5;
+ int* pi01 = &i01;
+ vec01.insert(vec01.begin(), pi01, pi01 + 1);
+
+ // non POD types
+ typedef std::vector< A<B> > vec_nonPOD;
+ vec_nonPOD vec02;
+ A<B> np01;
+ A<B>* pnp01 = &np01;
+ vec02.insert(vec02.begin(), pnp01, pnp01 + 1);
+
+ // Test that assign compiles.
+ vec01.assign (pi01, pi01 + 1);
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator.cc b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator.cc
new file mode 100644
index 000000000000..6338015d365d
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator.cc
@@ -0,0 +1,127 @@
+// 1999-06-28 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 24.5.3 template class istreambuf_iterator
+
+#include <sstream>
+#include <iterator>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+
+ typedef std::istreambuf_iterator<char> cistreambuf_iter;
+ typedef cistreambuf_iter::streambuf_type cstreambuf_type;
+ bool test = true;
+ const char slit01[] = "playa hermosa, liberia, guanacaste";
+ std::string str01(slit01);
+ std::istringstream istrs00(str01);
+ std::istringstream istrs01(str01);
+
+ // ctor sanity checks
+ cistreambuf_iter istrb_it01(istrs00);
+ cistreambuf_iter istrb_it02;
+ std::string tmp(istrb_it01, istrb_it02);
+ test &= tmp == str01;
+
+ cistreambuf_iter istrb_it03(0);
+ cistreambuf_iter istrb_it04;
+ test &= istrb_it03 == istrb_it04;
+
+ cistreambuf_iter istrb_it05(istrs01);
+ cistreambuf_iter istrb_it06(istrs01.rdbuf());
+ test &= istrb_it05 == istrb_it06;
+
+ // bool equal(istreambuf_iter& b)
+ cistreambuf_iter istrb_it07(0);
+ cistreambuf_iter istrb_it08;
+ test &= istrb_it07.equal(istrb_it08);
+ cistreambuf_iter istrb_it09(0);
+ cistreambuf_iter istrb_it10;
+ test &= istrb_it10.equal(istrb_it09);
+
+ cistreambuf_iter istrb_it11(istrs01);
+ cistreambuf_iter istrb_it12(istrs01.rdbuf());
+ test &= istrb_it11.equal(istrb_it12);
+ cistreambuf_iter istrb_it13(istrs01);
+ cistreambuf_iter istrb_it14(istrs01.rdbuf());
+ test &= istrb_it14.equal(istrb_it13);
+
+ cistreambuf_iter istrb_it15(istrs01);
+ cistreambuf_iter istrb_it16;
+ test &= !(istrb_it15.equal(istrb_it16));
+ cistreambuf_iter istrb_it17(istrs01);
+ cistreambuf_iter istrb_it18;
+ test &= !(istrb_it18.equal(istrb_it17));
+
+ // bool operator==(const istreambuf_iterator&a, const istreambuf_iterator& b)
+ // bool operator!=(const istreambuf_iterator&a, const istreambuf_iterator& b)
+ cistreambuf_iter istrb_it19(0);
+ cistreambuf_iter istrb_it20;
+ test &= istrb_it19 == istrb_it20;
+
+ cistreambuf_iter istrb_it21(istrs01);
+ cistreambuf_iter istrb_it22(istrs01.rdbuf());
+ test &= istrb_it22 == istrb_it21;
+
+ cistreambuf_iter istrb_it23(istrs01);
+ cistreambuf_iter istrb_it24;
+ test &= istrb_it23 != istrb_it24;
+
+ cistreambuf_iter istrb_it25(0);
+ cistreambuf_iter istrb_it26(istrs01.rdbuf());
+ test &= istrb_it25 != istrb_it26;
+
+ // charT operator*() const
+ // istreambuf_iterator& operator++();
+ // istreambuf_iterator& operator++(int);
+ cistreambuf_iter istrb_it27(istrs01.rdbuf());
+ char c;
+ for (int i = 0; i < sizeof(slit01) - 2; ++i)
+ {
+ c = *istrb_it27++;
+ test &= c == slit01[i];
+ }
+
+ std::istringstream istrs02(str01);
+ cistreambuf_iter istrb_it28(istrs02);
+ for (int i = 0; i < sizeof(slit01) - 3;)
+ {
+ c = *++istrb_it28;
+ test &= c == slit01[++i];
+ }
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/24_iterators/iterator.cc b/libstdc++-v3/testsuite/24_iterators/iterator.cc
new file mode 100644
index 000000000000..fe60704fd778
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/iterator.cc
@@ -0,0 +1,599 @@
+// 24.1.5 Random accesss iterators
+// 24.3.1 Iterator traits
+// (basic_string and vector implementations)
+//
+// Copyright (C) 1999 Philip Martin
+// 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
+
+
+#include <string>
+#include <vector>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+int string_stuff()
+{
+ int failures(0);
+
+ std::string s("abcde");
+
+ std::string::iterator i1(s.begin());
+ if (*i1 != 'a')
+ ++failures;
+
+ ++i1;
+ if (*i1 != 'b')
+ ++failures;
+
+ if (*i1++ != 'b')
+ ++failures;
+ if (*i1 != 'c')
+ ++failures;
+
+ ++ ++i1;
+ if (*i1 != 'e')
+ ++failures;
+
+ --i1;
+ if (*i1 != 'd')
+ ++failures;
+
+ if (*i1-- != 'd')
+ ++failures;
+ if (*i1 != 'c')
+ ++failures;
+
+ -- --i1;
+ if (*i1 != 'a')
+ ++failures;
+
+ std::string::iterator i2;
+ i2 = s.end();
+ std::iterator_traits<std::string::iterator>::difference_type d1;
+ d1 = i2 - i1;
+ if (d1 != 5)
+ ++failures;
+
+ std::iterator_traits<std::string::iterator>::value_type v1;
+ v1 = i1[0];
+ if (v1 != 'a')
+ ++failures;
+
+ std::iterator_traits<std::string::iterator>::reference r1(i1[0]);
+ if (r1 != 'a')
+ ++failures;
+ r1 = 'x';
+ if (r1 != 'x')
+ ++failures;
+ r1 = 'a';
+
+ if ((i1 != i2) != true)
+ ++failures;
+ if ((i1 == i2) != false)
+ ++failures;
+ if ((i1 < i2) != true)
+ ++failures;
+ if ((i1 > i2) != false)
+ ++failures;
+ if ((i1 <= i2) != true)
+ ++failures;
+ if ((i1 >= i2) != false)
+ ++failures;
+
+ std::string::iterator i3;
+ i3 = i1;
+ if ((i3 == i1) != true)
+ ++failures;
+
+ i3 += 5;
+ if ((i3 == i2) != true)
+ ++failures;
+
+ i3 -= 5;
+ if ((i3 == i1) != true)
+ ++failures;
+
+ if (i3 + 5 != i2)
+ ++failures;
+
+ if (5 + i3 != i2)
+ ++failures;
+
+ if (i2 - 5 != i3)
+ ++failures;
+
+ if (i1[0] != 'a')
+ ++failures;
+
+ i1[4] = 'x';
+ if (i2[-1] != 'x')
+ ++failures;
+ i1[4] = 'e';
+
+ i1[2] = 'x';
+ if (i2[-3] != 'x')
+ ++failures;
+ i1[2] = 'c';
+
+ std::string::const_iterator ci1(s.begin());
+ if (*ci1 != 'a')
+ ++failures;
+
+ ++ci1;
+ if (*ci1 != 'b')
+ ++failures;
+
+ if (*ci1++ != 'b')
+ ++failures;
+ if (*ci1 != 'c')
+ ++failures;
+
+ ++ ++ci1;
+ if (*ci1 != 'e')
+ ++failures;
+
+ --ci1;
+ if (*ci1 != 'd')
+ ++failures;
+
+ if (*ci1-- != 'd')
+ ++failures;
+ if (*ci1 != 'c')
+ ++failures;
+
+ -- --ci1;
+ if (*ci1 != 'a')
+ ++failures;
+
+ std::string::const_iterator ci2;
+ ci2 = s.end();
+ std::iterator_traits<std::string::const_iterator>::difference_type d2;
+ d2 = ci2 - ci1;
+ if (d2 != 5)
+ ++failures;
+
+ std::iterator_traits<std::string::const_iterator>::value_type v2;
+ v2 = ci1[0];
+ if (v2 != 'a')
+ ++failures;
+
+ std::iterator_traits<std::string::const_iterator>::reference r2(ci1[0]);
+ if (r2 != 'a')
+ ++failures;
+
+ if ((ci1 != ci2) != true)
+ ++failures;
+ if ((ci1 == ci2) != false)
+ ++failures;
+ if ((ci1 < ci2) != true)
+ ++failures;
+ if ((ci1 > ci2) != false)
+ ++failures;
+ if ((ci1 <= ci2) != true)
+ ++failures;
+ if ((ci1 >= ci2) != false)
+ ++failures;
+
+ std::string::const_iterator ci3;
+ ci3 = ci1;
+ if ((ci3 == ci1) != true)
+ ++failures;
+
+ ci3 += 5;
+ if ((ci3 == ci2) != true)
+ ++failures;
+
+ ci3 -= 5;
+ if ((ci3 == ci1) != true)
+ ++failures;
+
+ if (ci3 + 5 != ci2)
+ ++failures;
+
+ if (5 + ci3 != ci2)
+ ++failures;
+
+ if (ci2 - 5 != ci3)
+ ++failures;
+
+ if (ci1[2] != 'c')
+ ++failures;
+
+ if (ci2[-1] != 'e')
+ ++failures;
+
+ // iterator and const_iterator
+ std::string::const_iterator ci4(i1);
+ if ((ci4 == i1) != true)
+ ++failures;
+ if ((ci4 != i1) != false)
+ ++failures;
+ if ((ci4 < i1) != false)
+ ++failures;
+ if ((ci4 > i1) != false)
+ ++failures;
+ if ((ci4 <= i1) != true)
+ ++failures;
+ if ((ci4 >= i1) != true)
+ ++failures;
+ ci4 = i2;
+ if ((i2 == ci4) != true)
+ ++failures;
+ if ((i2 < ci4) != false)
+ ++failures;
+ if ((i2 > ci4) != false)
+ ++failures;
+ if ((i2 <= ci4) != true)
+ ++failures;
+ if ((i2 >= ci4) != true)
+ ++failures;
+
+ const std::string cs("ABCDE");
+ std::string::const_iterator ci5(cs.begin());
+ if (ci5[0] != 'A')
+ ++failures;
+
+ return failures;
+}
+
+int vector_stuff()
+{
+ int failures(0);
+
+ std::vector<int> v;
+ v.push_back(int(1));
+ v.push_back(int(2));
+ v.push_back(int(3));
+ v.push_back(int(4));
+ v.push_back(int(5));
+
+ std::vector<int>::iterator i1(v.begin());
+ if (*i1 != 1)
+ ++failures;
+
+ ++i1;
+ if (*i1 != 2)
+ ++failures;
+
+ if (*i1++ != 2)
+ ++failures;
+ if (*i1 != 3)
+ ++failures;
+
+ ++ ++i1;
+ if (*i1 != 5)
+ ++failures;
+
+ --i1;
+ if (*i1 != 4)
+ ++failures;
+
+ if (*i1-- != 4)
+ ++failures;
+ if (*i1 != 3)
+ ++failures;
+
+ -- --i1;
+ if (*i1 != 1)
+ ++failures;
+
+ std::vector<int>::iterator i2;
+ i2 = v.end();
+ std::iterator_traits<std::vector<int>::iterator>::difference_type d1;
+ d1 = i2 - i1;
+ if (d1 != 5)
+ ++failures;
+
+ std::iterator_traits<std::vector<int>::iterator>::value_type v1;
+ v1 = i1[0];
+ if (v1 != 1)
+ ++failures;
+
+ std::iterator_traits<std::vector<int>::iterator>::reference r1(i1[0]);
+ if (r1 != 1)
+ ++failures;
+ r1 = 9;
+ if (r1 != 9)
+ ++failures;
+ r1 = 1;
+
+ if ((i1 != i2) != true)
+ ++failures;
+ if ((i1 == i2) != false)
+ ++failures;
+ if ((i1 < i2) != true)
+ ++failures;
+ if ((i1 > i2) != false)
+ ++failures;
+ if ((i1 <= i2) != true)
+ ++failures;
+ if ((i1 >= i2) != false)
+ ++failures;
+
+ std::vector<int>::iterator i3;
+ i3 = i1;
+ if ((i3 == i1) != true)
+ ++failures;
+
+ i3 += 5;
+ if ((i3 == i2) != true)
+ ++failures;
+
+ i3 -= 5;
+ if ((i3 == i1) != true)
+ ++failures;
+
+ if (i3 + 5 != i2)
+ ++failures;
+
+ if (5 + i3 != i2)
+ ++failures;
+
+ if (i2 - 5 != i3)
+ ++failures;
+
+ if (i1[0] != 1)
+ ++failures;
+
+ i1[4] = 9;
+ if (i2[-1] != 9)
+ ++failures;
+ i1[4] = 5;
+
+ i1[2] = 9;
+ if (i2[-3] != 9)
+ ++failures;
+ i1[2] = 3;
+
+ std::vector<int>::const_iterator ci1(v.begin());
+ if (*ci1 != 1)
+ ++failures;
+
+ ++ci1;
+ if (*ci1 != 2)
+ ++failures;
+
+ if (*ci1++ != 2)
+ ++failures;
+ if (*ci1 != 3)
+ ++failures;
+
+ ++ ++ci1;
+ if (*ci1 != 5)
+ ++failures;
+
+ --ci1;
+ if (*ci1 != 4)
+ ++failures;
+
+ if (*ci1-- != 4)
+ ++failures;
+ if (*ci1 != 3)
+ ++failures;
+
+ -- --ci1;
+ if (*ci1 != 1)
+ ++failures;
+
+ std::vector<int>::const_iterator ci2;
+ ci2 = v.end();
+ std::iterator_traits<std::vector<int>::const_iterator>::difference_type d2;
+ d2 = ci2 - ci1;
+ if (d2 != 5)
+ ++failures;
+
+ std::iterator_traits<std::vector<int>::const_iterator>::value_type v2;
+ v2 = ci1[0];
+ if (v2 != 1)
+ ++failures;
+
+ std::iterator_traits<std::vector<int>::const_iterator>::reference
+ r2(ci1[0]);
+ if (r2 != 1)
+ ++failures;
+
+ if ((ci1 != ci2) != true)
+ ++failures;
+ if ((ci1 == ci2) != false)
+ ++failures;
+ if ((ci1 < ci2) != true)
+ ++failures;
+ if ((ci1 > ci2) != false)
+ ++failures;
+ if ((ci1 <= ci2) != true)
+ ++failures;
+ if ((ci1 >= ci2) != false)
+ ++failures;
+
+ std::vector<int>::const_iterator ci3;
+ ci3 = ci1;
+ if ((ci3 == ci1) != true)
+ ++failures;
+
+ ci3 += 5;
+ if ((ci3 == ci2) != true)
+ ++failures;
+
+ ci3 -= 5;
+ if ((ci3 == ci1) != true)
+ ++failures;
+
+ if (ci3 + 5 != ci2)
+ ++failures;
+
+ if (5 + ci3 != ci2)
+ ++failures;
+
+ if (ci2 - 5 != ci3)
+ ++failures;
+
+ if (ci1[2] != 3)
+ ++failures;
+
+ if (ci2[-1] != 5)
+ ++failures;
+
+ // iterator to const_iterator
+ std::vector<int>::const_iterator ci4(i1);
+ if ((ci4 == i1) != true)
+ ++failures;
+ if ((ci4 != i1) != false)
+ ++failures;
+ if ((ci4 < i1) != false)
+ ++failures;
+ if ((ci4 > i1) != false)
+ ++failures;
+ if ((ci4 <= i1) != true)
+ ++failures;
+ if ((ci4 >= i1) != true)
+ ++failures;
+ ci4 = i2;
+ if ((i2 == ci4) != true)
+ ++failures;
+ if ((i2 < ci4) != false)
+ ++failures;
+ if ((i2 > ci4) != false)
+ ++failures;
+ if ((i2 <= ci4) != true)
+ ++failures;
+ if ((i2 >= ci4) != true)
+ ++failures;
+
+ const std::vector<int> cv(v);
+ std::vector<int>::const_iterator ci5(cv.begin());
+ if (ci5[0] != 1)
+ ++failures;
+
+ std::vector<std::string> vs;
+ vs.push_back(std::string("abc"));
+ std::vector<std::string>::iterator ivs(vs.begin());
+ if (ivs->c_str()[1] != 'b')
+ ++failures;
+
+ return failures;
+}
+
+int reverse_stuff()
+{
+ int failures(0);
+
+ std::string s("abcde");
+
+ std::string::reverse_iterator ri(s.rbegin());
+ if (*ri != 'e')
+ ++failures;
+
+ std::iterator_traits<std::string::reverse_iterator>::difference_type d;
+ d = s.rend() - ri;
+ if (d != 5)
+ ++failures;
+
+ const std::string cs("abcde");
+ std::string::const_reverse_iterator cri(cs.rend());
+ if (cri - 5 != cs.rbegin())
+ ++failures;
+
+ return failures;
+}
+
+// the following should be compiler errors
+// flag runtime errors in case they slip through the compiler
+int wrong_stuff()
+{
+ int failures(0);
+
+#ifdef ITER24_F1
+ extern void f(std::vector<std::string*>::iterator);
+ std::vector<std::string*> vs[2];
+ f(vs); // address of array is not an iterator
+ failures++;
+#endif
+
+#ifdef ITER24_F2
+ std::string s;
+ char *i = s.begin(); // begin() doesn't return a pointer
+ failures++;
+#endif
+
+#ifdef ITER24_F3
+ std::string::const_iterator ci;
+ std::string::iterator i;
+ if (i - ci) // remove const_ is a warning
+ i++;
+ // failures++; only a warning
+#endif
+
+#ifdef ITER24_F4
+ std::vector<char>::iterator iv;
+ std::string::iterator is(iv);// vector<char> is not string
+ failures++;
+#endif
+
+#ifdef ITER24_F5
+ std::vector<char>::iterator iv;
+ std::string::iterator is;
+ if (iv == is) // vector<char> is not string
+ ++iv;
+ failures++;
+#endif
+
+#ifdef ITER24_F6
+ std::vector<char>::const_iterator ci;
+ std::vector<char>::iterator i = ci; // remove const_ is a warning
+ ++i;
+ // failures++; only a warning
+#endif
+
+#ifdef ITER24_F7
+ std::vector<int> v(1);
+ std::vector<int>::const_iterator ci(v.begin());
+ *ci = 1; // cannot assign through const_iterator
+ failures++;
+#endif
+
+#ifdef ITER24_F8
+ std::vector<const int> v(1);
+ std::vector<const int>::reference r(v.begin()[0]);
+ r = 1; // cannot assign through reference to const
+ failures++;
+#endif
+
+ return failures;
+}
+
+int main(int argc, char **argv)
+{
+ int failures(0);
+
+ failures += string_stuff();
+
+ failures += vector_stuff();
+
+ failures += reverse_stuff();
+
+ failures += wrong_stuff();
+
+#ifdef DEBUG_ASSERT
+ assert (failures == 0);
+#endif
+
+ return failures ? 1 : 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/25_algorithms/min_max.cc b/libstdc++-v3/testsuite/25_algorithms/min_max.cc
new file mode 100644
index 000000000000..a5219bf80b11
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/min_max.cc
@@ -0,0 +1,51 @@
+// 2000-03-29 sss/bkoz
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <algorithm>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+void test01()
+{
+ bool test = true;
+ const int& x = std::max(1, 2);
+ const int& y = std::max(3, 4);
+ test &= x == 2;
+ test &= y == 4;
+
+ const int& z = std::min(1, 2);
+ const int& w = std::min(3, 4);
+ test &= z == 1;
+ test &= w == 3;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
+
+
diff --git a/libstdc++-v3/testsuite/26_numerics/binary_closure.cc b/libstdc++-v3/testsuite/26_numerics/binary_closure.cc
new file mode 100644
index 000000000000..f670d4ac3c82
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/binary_closure.cc
@@ -0,0 +1,36 @@
+// 19990805 gdr
+//
+// XXX: to impove later.
+// Origin: Andreas Amann <amann@physik.tu-berlin.de>
+// CXXFLAGS: -g
+
+#include <iostream>
+#include <valarray>
+
+
+int main()
+{
+ std::valarray<double> a(10), b(10), c(10), d(10);
+
+ a = 1.2;
+ b = 3.1;
+
+ c = 4.0;
+
+ d = ( 2.0 * b + a ); // works
+ std::cout << "d[4] = " << d[4] << std::endl;
+
+ d = (a * 2.0 + b ); // works
+ std::cout << "d[4] = " << d[4] << std::endl;
+
+ d = (a + b * 2.0 ); // segfaults!
+ std::cout << "d[4] = " << d[4] << std::endl;
+ d = (a + 2.0* b );
+
+ std::cout << "d[4] = " << d[4] << std::endl;
+ d = (a + 2.0* b );
+ std::cout << "d[4] = " << d[4] << std::endl;
+ d = (a + 2.0* b );
+
+ std::cout << "d[4] = " << d[4] << std::endl;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/buggy_complex.cc b/libstdc++-v3/testsuite/26_numerics/buggy_complex.cc
new file mode 100644
index 000000000000..ebe8e98bdb89
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/buggy_complex.cc
@@ -0,0 +1,37 @@
+// 2000-02-09
+// Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+
+// Test buggy builtin GNU __complex__ support. This used to cause
+// an ICE on some 64-bits plateforms.
+// Origin: petter@matfys.lth.se
+
+#include <complex>
+
+int main()
+{
+ std::complex<double> a(9), b(0, 8), c;
+
+ c = a * b;
+
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/26_numerics/c_math.cc b/libstdc++-v3/testsuite/26_numerics/c_math.cc
new file mode 100644
index 000000000000..0ccdd3f71860
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/c_math.cc
@@ -0,0 +1,61 @@
+// 1999-06-05
+// Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+// Copyright (C) 2000, 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.
+
+#include <cmath>
+#include <cassert>
+
+// test compilation.
+void test01()
+{
+ float a = 1.f;
+ float b;
+ std::modf(a, &b);
+}
+
+// need more extravagant checks than this, of course, but this used to core...
+void test02()
+{
+ sin(static_cast<float>(0));
+}
+
+// as did this.
+void test03()
+{
+ double powtest = pow(2., 0);
+}
+
+// this used to abort.
+void test04()
+{
+ float x[2] = {1, 2};
+ float y = 3.4;
+ std::modf(y, &x[0]);
+ assert (x[1] == 2);
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc b/libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc
new file mode 100644
index 000000000000..d827e1b5f86a
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc
@@ -0,0 +1,95 @@
+// 2000-02-10
+// Petter Urkedal <petter@matfys.lth.se>
+
+// Copyright (C) 2000 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.
+
+
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <complex>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+template<typename R>
+inline bool flteq(R x, R y)
+{
+ if (x == R(0)) return y == R(0);
+ else return fabs(x-y) < 1e-6*fabs(x);
+}
+
+template<typename R>
+void test_good(std::string str, R x, R y)
+{
+ bool test = true;
+ std::complex<R> z;
+ char ch;
+ std::istringstream iss(str);
+ iss >> z >> ch;
+ test &= iss.good();
+ test &= flteq(z.real(), x);
+ test &= flteq(z.imag(), y);
+ test &= ch == '#';
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+template<typename R>
+void test_fail(std::string str)
+{
+ std::complex<R> z;
+ std::istringstream iss(str);
+ iss >> z;
+#ifdef DEBUG_ASSERT
+ assert(iss.fail() && !iss.bad());
+#endif
+}
+
+template<typename R>
+int testall()
+{
+ test_good<R>("(-1.1,3.7)#", -1.1, 3.7);
+ test_good<R>("( .7e6 , \n-3.1)#", .7e6, -3.1);
+ test_good<R>("(\t0,-1)#", 0.0, -1.0);
+ test_good<R>("(-3.14)#", -3.14, 0.0);
+ test_good<R>("-.1#", -.1, 0.0);
+ test_good<R>(" ( -2.7e3 )#", -2.7e3, 0.0);
+ test_good<R>(" -.1#", -.1, 0.0);
+ test_fail<R>("(a,1)");
+ test_fail<R>("(,1)");
+ test_fail<R>("(1,a)");
+ test_fail<R>("(1, )");
+ test_fail<R>("|1,1)");
+ test_fail<R>("(1|1)");
+ test_fail<R>("(1,1|");
+}
+
+int main()
+{
+ testall<float>();
+ testall<double>();
+ testall<long double>();
+ return 0;
+}
+
+
+
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray.cc b/libstdc++-v3/testsuite/26_numerics/valarray.cc
new file mode 100644
index 000000000000..6ee792a3d174
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray.cc
@@ -0,0 +1,8 @@
+// 19990404 gdr
+
+#include <valarray>
+
+int main()
+{
+ std::valarray<double> a(20);
+}
diff --git a/libstdc++-v3/testsuite/27_io/filebuf-1.tst b/libstdc++-v3/testsuite/27_io/filebuf-1.tst
new file mode 100644
index 000000000000..cb3c57f7dfd3
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/filebuf-1.tst
@@ -0,0 +1,158 @@
+// 990117 bkoz
+// test functionality of basic_filebuf for char_type == char
+// this is a data file for 27filebuf.cc
+
+// 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.
+
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.allofme
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.speaklow
+
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_01_the_way_i_feel
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_02_seduction_kidnap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_03_just_a_ny_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_04_butterflies_i_remem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_05_luxury_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_06_my_house
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_07_the_women_gather
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_08_the_life_i_led
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_09_when_i_die
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_10_revolutionary_dreams
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_11_winter_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_12_a_certain_peace_i_nap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_13_poem_for_a_lady_whose
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/
+/mnt/cdrom/marley-songs_of_freedom/disk_2/
+/mnt/cdrom/marley-songs_of_freedom/disk_4/
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/back out
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bend down low
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bus dem shut (pyaka)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/caution
+/mnt/cdrom/marley-songs_of_freedom/disk_1/do it twice
+/mnt/cdrom/marley-songs_of_freedom/disk_1/don't rock the boat
+/mnt/cdrom/marley-songs_of_freedom/disk_1/duppy conqueror
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hammer
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hypocrites
+/mnt/cdrom/marley-songs_of_freedom/disk_1/i'm still waiting
+/mnt/cdrom/marley-songs_of_freedom/disk_1/judge not
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mellow mood
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mr brown
+/mnt/cdrom/marley-songs_of_freedom/disk_1/nice time
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one cup of coffee
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one love_people get ready
+/mnt/cdrom/marley-songs_of_freedom/disk_1/put it on
+/mnt/cdrom/marley-songs_of_freedom/disk_1/simmer down
+/mnt/cdrom/marley-songs_of_freedom/disk_1/small axe
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul rebel
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul shake down party
+/mnt/cdrom/marley-songs_of_freedom/disk_1/stir it up (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/sun is shining
+/mnt/cdrom/marley-songs_of_freedom/disk_1/thank you lord (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_2/acoustic medley
+/mnt/cdrom/marley-songs_of_freedom/disk_2/burnin' and lootin'
+/mnt/cdrom/marley-songs_of_freedom/disk_2/concrete jungle
+/mnt/cdrom/marley-songs_of_freedom/disk_2/craven choke puppy
+/mnt/cdrom/marley-songs_of_freedom/disk_2/get up stand up
+/mnt/cdrom/marley-songs_of_freedom/disk_2/guava jelly
+/mnt/cdrom/marley-songs_of_freedom/disk_2/high tide or low tide
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i shot the sheriff
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i'm hurting inside
+/mnt/cdrom/marley-songs_of_freedom/disk_2/iron lion zion
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lick samba
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lively up yourself
+/mnt/cdrom/marley-songs_of_freedom/disk_2/natty dread
+/mnt/cdrom/marley-songs_of_freedom/disk_2/no more trouble
+/mnt/cdrom/marley-songs_of_freedom/disk_2/rastaman chant
+/mnt/cdrom/marley-songs_of_freedom/disk_2/screw face
+/mnt/cdrom/marley-songs_of_freedom/disk_2/slave driver
+/mnt/cdrom/marley-songs_of_freedom/disk_2/trenchtown rock
+/mnt/cdrom/marley-songs_of_freedom/disk_4/africa unite
+/mnt/cdrom/marley-songs_of_freedom/disk_4/babylon system
+/mnt/cdrom/marley-songs_of_freedom/disk_4/bad card
+/mnt/cdrom/marley-songs_of_freedom/disk_4/coming in from the cold (12
+/mnt/cdrom/marley-songs_of_freedom/disk_4/could you be loved (12 mix
+/mnt/cdrom/marley-songs_of_freedom/disk_4/forever loving jah
+/mnt/cdrom/marley-songs_of_freedom/disk_4/give thanks and praise
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one drop
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one dub
+/mnt/cdrom/marley-songs_of_freedom/disk_4/rastaman live up
+/mnt/cdrom/marley-songs_of_freedom/disk_4/real situation
+/mnt/cdrom/marley-songs_of_freedom/disk_4/redemption song (live in pi
+/mnt/cdrom/marley-songs_of_freedom/disk_4/ride natty ride (12 mix)
+/mnt/cdrom/marley-songs_of_freedom/disk_4/so much trouble in the worl
+/mnt/cdrom/marley-songs_of_freedom/disk_4/survival
+/mnt/cdrom/marley-songs_of_freedom/disk_4/why should i (previously un
+/mnt/cdrom/marley-songs_of_freedom/disk_4/zimbabwe
+
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_01_pandemonium
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_02_sync_disjecta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_03_object_unknown
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_04_it's_nice_not
+/mnt/cdrom/dj_spooky_rid-2dim_warefare/djspooky_05_dialectical_tra
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_06_post-human_soph
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_07_quilombo_ex
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_08_rekonstruction
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_09_scientifik
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_10_a_conversation
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_11_peace_in_zaire
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_13_degree_zero
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_14_roman_planeta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_15_bass_digitalis
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_16_polyphony_of
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_17_riddim_warfare
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_18_the_nerd
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_20_theme_of_the
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_21_twilight_fugue
+
+/mnt/cdrom/stuff_smith_mosaic/disk3/01_desert_sands
+/mnt/cdrom/stuff_smith_mosaic/disk3/02_soft_winds
+/mnt/cdrom/stuff_smith_mosaic/disk3/03_time_and_again
+/mnt/cdrom/stuff_smith_mosaic/disk3/04_it_don't_mean_a_thing
+/mnt/cdrom/stuff_smith_mosaic/disk3/05_in_a_mellotone
+/mnt/cdrom/stuff_smith_mosaic/disk3/06_i_know_that_you_know
+/mnt/cdrom/stuff_smith_mosaic/disk3/07_heat_wave
+/mnt/cdrom/stuff_smith_mosaic/disk3/08_things_ain't_what_they_used_to_be
+/mnt/cdrom/stuff_smith_mosaic/disk3/09_body_and_soul
+
+So I take a break, wander down to the park to stand, then lean into
+the concrete railing demarking the beginnings of space, oceanic
+space. I watch the waves break, and form, and ease back out to sea and
+wrap my arms around myself and hug tightly because it's early in the
+morning and windy, and the sun is late getting out of bed today, which
+is good because if there was brilliant light illuminating all the
+beauty around me I would be shocked, stunned, forced to retreat back
+into my cabana in a daze, blinded by hummingbirds and callilillies and
+un-named red, yellow, and blue flowers. Green envelopes me, waves
+sooth me. I can see the wind flip the top of the waves seaward, right
+before they break. The sea seems so calm from my perch above the fray
+that I wonder if maybe there is just some part of the deepest, most
+abstract ocean where there is a large creature who happily chews
+plankton and wags its tail in gentle, adulating waves that spread and
+move and gracefully glide thousands of miles, to crash upon a beach,
+one after the other, politely waiting for a turn to dance with the
+seashore.
+
+I know: it is what the Mexican schoolchildren call "la vibora de la
+mer," the serpent of the sea.
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/filebuf-1.txt b/libstdc++-v3/testsuite/27_io/filebuf-1.txt
new file mode 100644
index 000000000000..cb3c57f7dfd3
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/filebuf-1.txt
@@ -0,0 +1,158 @@
+// 990117 bkoz
+// test functionality of basic_filebuf for char_type == char
+// this is a data file for 27filebuf.cc
+
+// 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.
+
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.allofme
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.speaklow
+
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_01_the_way_i_feel
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_02_seduction_kidnap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_03_just_a_ny_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_04_butterflies_i_remem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_05_luxury_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_06_my_house
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_07_the_women_gather
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_08_the_life_i_led
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_09_when_i_die
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_10_revolutionary_dreams
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_11_winter_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_12_a_certain_peace_i_nap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_13_poem_for_a_lady_whose
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/
+/mnt/cdrom/marley-songs_of_freedom/disk_2/
+/mnt/cdrom/marley-songs_of_freedom/disk_4/
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/back out
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bend down low
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bus dem shut (pyaka)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/caution
+/mnt/cdrom/marley-songs_of_freedom/disk_1/do it twice
+/mnt/cdrom/marley-songs_of_freedom/disk_1/don't rock the boat
+/mnt/cdrom/marley-songs_of_freedom/disk_1/duppy conqueror
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hammer
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hypocrites
+/mnt/cdrom/marley-songs_of_freedom/disk_1/i'm still waiting
+/mnt/cdrom/marley-songs_of_freedom/disk_1/judge not
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mellow mood
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mr brown
+/mnt/cdrom/marley-songs_of_freedom/disk_1/nice time
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one cup of coffee
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one love_people get ready
+/mnt/cdrom/marley-songs_of_freedom/disk_1/put it on
+/mnt/cdrom/marley-songs_of_freedom/disk_1/simmer down
+/mnt/cdrom/marley-songs_of_freedom/disk_1/small axe
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul rebel
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul shake down party
+/mnt/cdrom/marley-songs_of_freedom/disk_1/stir it up (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/sun is shining
+/mnt/cdrom/marley-songs_of_freedom/disk_1/thank you lord (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_2/acoustic medley
+/mnt/cdrom/marley-songs_of_freedom/disk_2/burnin' and lootin'
+/mnt/cdrom/marley-songs_of_freedom/disk_2/concrete jungle
+/mnt/cdrom/marley-songs_of_freedom/disk_2/craven choke puppy
+/mnt/cdrom/marley-songs_of_freedom/disk_2/get up stand up
+/mnt/cdrom/marley-songs_of_freedom/disk_2/guava jelly
+/mnt/cdrom/marley-songs_of_freedom/disk_2/high tide or low tide
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i shot the sheriff
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i'm hurting inside
+/mnt/cdrom/marley-songs_of_freedom/disk_2/iron lion zion
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lick samba
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lively up yourself
+/mnt/cdrom/marley-songs_of_freedom/disk_2/natty dread
+/mnt/cdrom/marley-songs_of_freedom/disk_2/no more trouble
+/mnt/cdrom/marley-songs_of_freedom/disk_2/rastaman chant
+/mnt/cdrom/marley-songs_of_freedom/disk_2/screw face
+/mnt/cdrom/marley-songs_of_freedom/disk_2/slave driver
+/mnt/cdrom/marley-songs_of_freedom/disk_2/trenchtown rock
+/mnt/cdrom/marley-songs_of_freedom/disk_4/africa unite
+/mnt/cdrom/marley-songs_of_freedom/disk_4/babylon system
+/mnt/cdrom/marley-songs_of_freedom/disk_4/bad card
+/mnt/cdrom/marley-songs_of_freedom/disk_4/coming in from the cold (12
+/mnt/cdrom/marley-songs_of_freedom/disk_4/could you be loved (12 mix
+/mnt/cdrom/marley-songs_of_freedom/disk_4/forever loving jah
+/mnt/cdrom/marley-songs_of_freedom/disk_4/give thanks and praise
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one drop
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one dub
+/mnt/cdrom/marley-songs_of_freedom/disk_4/rastaman live up
+/mnt/cdrom/marley-songs_of_freedom/disk_4/real situation
+/mnt/cdrom/marley-songs_of_freedom/disk_4/redemption song (live in pi
+/mnt/cdrom/marley-songs_of_freedom/disk_4/ride natty ride (12 mix)
+/mnt/cdrom/marley-songs_of_freedom/disk_4/so much trouble in the worl
+/mnt/cdrom/marley-songs_of_freedom/disk_4/survival
+/mnt/cdrom/marley-songs_of_freedom/disk_4/why should i (previously un
+/mnt/cdrom/marley-songs_of_freedom/disk_4/zimbabwe
+
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_01_pandemonium
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_02_sync_disjecta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_03_object_unknown
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_04_it's_nice_not
+/mnt/cdrom/dj_spooky_rid-2dim_warefare/djspooky_05_dialectical_tra
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_06_post-human_soph
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_07_quilombo_ex
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_08_rekonstruction
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_09_scientifik
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_10_a_conversation
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_11_peace_in_zaire
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_13_degree_zero
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_14_roman_planeta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_15_bass_digitalis
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_16_polyphony_of
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_17_riddim_warfare
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_18_the_nerd
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_20_theme_of_the
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_21_twilight_fugue
+
+/mnt/cdrom/stuff_smith_mosaic/disk3/01_desert_sands
+/mnt/cdrom/stuff_smith_mosaic/disk3/02_soft_winds
+/mnt/cdrom/stuff_smith_mosaic/disk3/03_time_and_again
+/mnt/cdrom/stuff_smith_mosaic/disk3/04_it_don't_mean_a_thing
+/mnt/cdrom/stuff_smith_mosaic/disk3/05_in_a_mellotone
+/mnt/cdrom/stuff_smith_mosaic/disk3/06_i_know_that_you_know
+/mnt/cdrom/stuff_smith_mosaic/disk3/07_heat_wave
+/mnt/cdrom/stuff_smith_mosaic/disk3/08_things_ain't_what_they_used_to_be
+/mnt/cdrom/stuff_smith_mosaic/disk3/09_body_and_soul
+
+So I take a break, wander down to the park to stand, then lean into
+the concrete railing demarking the beginnings of space, oceanic
+space. I watch the waves break, and form, and ease back out to sea and
+wrap my arms around myself and hug tightly because it's early in the
+morning and windy, and the sun is late getting out of bed today, which
+is good because if there was brilliant light illuminating all the
+beauty around me I would be shocked, stunned, forced to retreat back
+into my cabana in a daze, blinded by hummingbirds and callilillies and
+un-named red, yellow, and blue flowers. Green envelopes me, waves
+sooth me. I can see the wind flip the top of the waves seaward, right
+before they break. The sea seems so calm from my perch above the fray
+that I wonder if maybe there is just some part of the deepest, most
+abstract ocean where there is a large creature who happily chews
+plankton and wags its tail in gentle, adulating waves that spread and
+move and gracefully glide thousands of miles, to crash upon a beach,
+one after the other, politely waiting for a turn to dance with the
+seashore.
+
+I know: it is what the Mexican schoolchildren call "la vibora de la
+mer," the serpent of the sea.
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/filebuf-2.tst b/libstdc++-v3/testsuite/27_io/filebuf-2.tst
new file mode 100644
index 000000000000..f25bba46d928
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/filebuf-2.tst
@@ -0,0 +1 @@
+ac23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras23456789:;< \ No newline at end of file
diff --git a/libstdc++-v3/testsuite/27_io/filebuf-3.tst b/libstdc++-v3/testsuite/27_io/filebuf-3.tst
new file mode 100644
index 000000000000..d998eef2330d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/filebuf-3.tst
@@ -0,0 +1,7 @@
+bd2
+456x
+9mzuva?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
+because because
+because. . .
+of the wonderful things he does!!
+ok \ No newline at end of file
diff --git a/libstdc++-v3/testsuite/27_io/filebuf.cc b/libstdc++-v3/testsuite/27_io/filebuf.cc
new file mode 100644
index 000000000000..830e0b1ee584
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/filebuf.cc
@@ -0,0 +1,528 @@
+// 990117 bkoz test functionality of basic_filebuf for char_type == char
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// NB: this test assumes that _M_buf_size == 40, and not the usual
+// buffer_size length of 8092, so that overflow/underflow can be
+// simulated a bit more readily.
+
+#include <fstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+const char carray_01[] = "santa cruz or sandiego?";
+const char carray_02[] = "memphis, new orleans, and savanah";
+const char name_01[] = "testsuite/filebuf-1.txt"; // file with data in it
+const char name_02[] = "testsuite/filebuf-2.txt"; // empty file, need to create
+const char name_03[] = "testsuite/filebuf-3.txt"; // empty file, need to create
+
+class derived_filebuf: public std::filebuf
+{
+ public:
+ void
+ set_size(int_type __size) { _M_buf_size = __size; }
+};
+
+derived_filebuf fb_01; // in
+derived_filebuf fb_02; // out
+derived_filebuf fb_03; // in | out
+
+const int buffer_size = 8192;
+
+// initialize filebufs to be the same size regardless of platform
+void test00()
+{
+ fb_01.set_size(buffer_size);
+ fb_02.set_size(buffer_size);
+ fb_03.set_size(buffer_size);
+}
+
+// test the filebuf/stringbuf locale settings
+bool test01() {
+ std::locale loc_tmp;
+ loc_tmp = fb_01.getloc();
+ fb_01.pubimbue(loc_tmp); //This should initialize _M_init to true
+ fb_01.getloc(); //This should just return _M_locale
+
+ return true;
+}
+
+
+// test member functions functions
+bool test02() {
+ bool test = true;
+
+ // bool is_open()
+ test &= !fb_01.is_open();
+ test &= !fb_02.is_open();
+ test &= !fb_03.is_open();
+
+ // filebuf_type* open(const char* __s, ios_base::openmode __mode)
+ fb_01.open(name_01, std::ios_base::in | std::ios_base::ate);
+ fb_02.open(name_02, std::ios_base::in | std::ios_base::out | std::ios_base::trunc);
+ // Try to open two different files without closing the first:
+ // Should keep the old file attached, and disregard attempt to overthrow.
+ fb_02.open(name_03, std::ios_base::in | std::ios_base::out);
+ fb_03.open(name_03, std::ios_base::out | std::ios_base::trunc);
+ test &= fb_01.is_open();
+ test &= fb_02.is_open();
+ test &= fb_03.is_open();
+
+ // filebuf_type* close()
+ fb_01.close();
+ fb_02.close();
+ fb_03.close();
+ test &= !fb_01.is_open();
+ test &= !fb_02.is_open();
+ test &= !fb_03.is_open();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+// test overloaded virtual functions
+bool test03() {
+ typedef std::filebuf::int_type int_type;
+ typedef std::filebuf::traits_type traits_type;
+ typedef std::filebuf::pos_type pos_type;
+ typedef std::filebuf::off_type off_type;
+ typedef size_t size_type;
+
+ bool test = true;
+ std::filebuf f_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1, strmof_2;
+ int i = 0, j = 0, k = 0;
+
+ // GET
+ // int showmanyc()
+ // returns an estimate of the numbers of chars in the seq, or -1.
+ // if __retval > 0, then calls to underflow won't return
+ // traits_type::eof() till at least __retval chars.
+ // if __retval == -1, then calls to underflow or uflow will fail.
+ // NB overriding def if it can determine more chars can be read from
+ // the input sequence.
+
+ // int in_avail()
+ // if a read position is available, return _M_in_end - _M_in_cur.
+ // else return showmanyc.
+ strmof_1 = fb_01.in_avail();
+ strmof_2 = fb_02.in_avail();
+ test &= strmof_1 == -1;
+ test &= strmof_1 == strmof_2; //fail because not open
+ strmof_1 = fb_03.in_avail();
+ test &= strmof_1 == strmof_2;
+ fb_01.open(name_01, std::ios_base::in);
+ fb_02.open(name_02, std::ios_base::out | std::ios_base::trunc);
+ fb_03.open(name_03, std::ios_base::out | std::ios_base::in | std::ios_base::trunc);
+ strmof_1 = fb_01.in_avail();
+ strmof_2 = fb_02.in_avail();
+ test &= strmof_1 != strmof_2;
+ test &= strmof_1 >= 0;
+ test &= strmof_2 == -1; // empty file
+ strmof_1 = fb_03.in_avail();
+ test &= strmof_1 == -1; // empty file
+
+ // int_type sbumpc()
+ // if read_cur not avail returns uflow(), else return *read_cur & increment
+ int_type c1 = fb_01.sbumpc();
+ int_type c2 = fb_02.sbumpc();
+ test &= c1 != c2;
+ test &= c1 == '/';
+ test &= c2 == -1;
+ int_type c3 = fb_01.sbumpc();
+ int_type c4 = fb_02.sbumpc();
+ test &= c3 != c4;
+ test &= c1 == c3; // fluke, both happen to be '/'
+ test &= c2 == c4;
+ int_type c5 = fb_03.sbumpc();
+ test &= c5 == traits_type::eof();
+ // XXX should do some kind of test to make sure that internal
+ // buffers point ot the same thing, to check consistancy.
+
+ // int_type sgetc()
+ // if read_cur not avail, return uflow(), else return *read_cur
+ int_type c6 = fb_01.sgetc();
+ int_type c7 = fb_02.sgetc();
+ test &= c6 != c3;
+ test &= c7 == c4; // both -1
+ int_type c8 = fb_01.sgetc();
+ int_type c9 = fb_02.sgetc();
+ test &= c6 == c8;
+ test &= c7 == c9;
+ c5 = fb_03.sgetc();
+ test &= c5 == traits_type::eof();
+
+ // int_type snextc()
+ // calls sbumpc and if sbumpc != eof, return sgetc
+ c6 = fb_01.snextc();
+ c7 = fb_02.snextc();
+ test &= c6 != c8;
+ test &= c7 == c9; // -1
+ test &= c6 == '9';
+ c6 = fb_01.snextc();
+ c7 = fb_02.snextc();
+ test &= c6 != c8;
+ test &= c7 == c9; // -1
+ test &= c6 == '9';
+ c5 = fb_03.snextc();
+ test &= c5 == traits_type::eof();
+
+ // streamsize sgetn(char_type *s, streamsize n)
+ // streamsize xsgetn(char_type *s, streamsize n)
+ // assign up to n chars to s from input sequence, indexing in_cur as
+ // approp and returning the number of chars assigned
+ strmsz_1 = fb_01.in_avail();
+ strmsz_2 = fb_02.in_avail();
+ test = strmsz_1 != strmsz_2;
+ char carray1[13] = "";
+ strmsz_1 = fb_01.sgetn(carray1, 10);
+ char carray2[buffer_size] = "";
+ strmsz_2 = fb_02.sgetn(carray2, 10);
+ test &= strmsz_1 != strmsz_2;
+ test &= strmsz_1 == 10;
+ test &= strmsz_2 == 0;
+ c1 = fb_01.sgetc();
+ c2 = fb_02.sgetc();
+ test &= c1 == '\n';
+ test &= c7 == c2; // n != i
+ strmsz_1 = fb_03.sgetn(carray1, 10);
+ test &= !strmsz_1; //zero
+ strmsz_1 = fb_01.in_avail();
+ strmsz_2 = fb_01.sgetn(carray2, strmsz_1 + 5);
+ test &= strmsz_1 == strmsz_2 - 5;
+ c4 = fb_01.sgetc(); // buffer should have underflowed from above.
+ test &= c4 == 'i';
+ strmsz_1 = fb_01.in_avail();
+ test &= strmsz_1 > 0;
+ strmsz_2 = fb_01.sgetn(carray2, strmsz_1 + 5);
+ test &= strmsz_1 == strmsz_2; //at the end of the actual file
+ strmsz_1 = fb_02.in_avail();
+ strmsz_2 = fb_02.sgetn(carray2, strmsz_1 + 5);
+ test &= strmsz_1 == -1;
+ test &= strmsz_2 == 0;
+ c4 = fb_02.sgetc(); // should be EOF
+ test &= c4 == traits_type::eof();
+
+ // PUT
+ // int_type sputc(char_type c)
+ // if out_cur not avail, return overflow(traits_type::to_int_type(c))
+ // else, stores c at out_cur,
+ // increments out_cur, and returns c as int_type
+ // strmsz_1 = fb_03.in_avail(); // XXX valid for in|out??
+ c1 = fb_02.sputc('a');
+ c2 = fb_03.sputc('b');
+ test &= c1 != c2;
+ c1 = fb_02.sputc('c');
+ c2 = fb_03.sputc('d');
+ test &= c1 != c2;
+ // strmsz_2 = fb_03.in_avail();
+ // test &= strmsz_1 != strmsz_2;
+ for (int i = 50; i <= 90; ++i)
+ c2 = fb_02.sputc(char(i));
+ // 27filebuf-2.txt == ac23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX
+ // fb_02._M_out_cur = '2'
+ strmsz_1 = fb_03.in_avail();
+ for (int i = 50; i <= 90; ++i)
+ c2 = fb_03.sputc(char(i));
+ strmsz_2 = fb_03.in_avail();
+ // test &= strmsz_1 != strmsz_2;
+ // test &= strmsz_1 > 0;
+ // test &= strmsz_2 > 0;
+ // 27filebuf-2.txt == bd23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX
+ // fb_02._M_out_cur = '2'
+ c3 = fb_01.sputc('a'); // should be EOF because this is read-only
+ test &= c3 == traits_type::eof();
+
+ // streamsize sputn(const char_typs* s, streamsize n)
+ // write up to n chars to out_cur from s, returning number assigned
+ // NB *sputn will happily put '\0' into your stream if you give it a chance*
+ strmsz_1 = fb_03.sputn("racadabras", 10);//"abracadabras or what?"
+ test &= strmsz_1 == 10;
+ strmsz_2 = fb_03.sputn(", i wanna reach out and", 10);
+ test &= strmsz_2 == 10;
+ test &= strmsz_1 == strmsz_2;
+ // fb_03._M_out_beg = "YZracadabras, i wanna FGHIJKLMNOPQRSTUVW"
+ // fb_03._M_out_cur = "FGHIJKLMNOPQRSTUVW"
+ strmsz_1 = fb_02.sputn("racadabras", 10);
+ test &= strmsz_1 == 10;
+ // fb_02._M_out_beg = "YZracadabras<=>?@ABCDEFGHIJKLMNOPQRSTUVW"
+ // fb_02._M_out_cur = "<=>?@ABCDEFGHIJKLMNOPQRSTUVW"
+ strmsz_1 = fb_01.sputn("racadabra", 10);
+ test &= strmsz_1 == 0;
+
+ // PUTBACK
+ // int_type pbfail(int_type c)
+ // called when gptr() null, gptr() == eback(), or traits::eq(*gptr, c) false
+ // "pending sequence" is:
+ // 1) everything as defined in underflow
+ // 2) + if (traits::eq_int_type(c, traits::eof()), then input
+ // sequence is backed up one char before the pending sequence is
+ // determined.
+ // 3) + if (not 2) then c is prepended. Left unspecified is
+ // whether the input sequence is backedup or modified in any way
+ // returns traits::eof() for failure, unspecified other value for success
+
+ // int_type sputbackc(char_type c)
+ // if in_cur not avail || ! traits::eq(c, gptr() [-1]), return pbfail
+ // otherwise decrements in_cur and returns *gptr()
+ c1 = fb_03.sgetc(); // -1
+ c2 = fb_03.sputbackc('z');
+ strmsz_2 = fb_03.in_avail();
+ c3 = fb_03.sgetc();
+ test &= c3 == c2;
+ test &= c1 != c3;
+ test &= 1 == strmsz_2;
+ //test for _in_cur == _in_beg
+ // fb_03._M_out_beg = "bd23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracada" etc
+ fb_03.pubseekoff(10, std::ios_base::beg,
+ std::ios_base::in | std::ios_base::out);
+ fb_03.sputc('m');
+ strmsz_1 = fb_03.in_avail();
+ c1 = fb_03.sgetc();
+ fb_03.snextc();
+ c2 = fb_03.sputbackc('z');
+ strmsz_2 = fb_03.in_avail();
+ c3 = fb_03.sgetc();
+ test &= c1 != c2;
+ test &= c3 == c2;
+ test &= c1 != c3;
+ test &= c2 == 'z';
+ test &= strmsz_1 == strmsz_2;
+ // test for replacing char with identical one
+ fb_03.snextc();
+ fb_03.sputc('u');
+ fb_03.sputc('v');
+ fb_03.sputc('a');
+ strmsz_1 = fb_03.in_avail();
+ c2 = fb_03.sputbackc('a');
+ strmsz_2 = fb_03.in_avail();
+ c3 = fb_03.sgetc();
+ test &= c3 == c2;
+ test &= strmsz_1 + 1 == strmsz_2;
+ //test for ios_base::out
+ c1 = fb_02.sgetc(); // undefined
+ c2 = fb_02.sputbackc('a');
+ test &= c1 == c2;
+ test &= c1 == -1;
+
+ // int_type sungetc()
+ // if in_cur not avail, return pbackfail(), else decrement and
+ // return to_int_type(*gptr())
+ // fb_03._M_out_beg = "uvaacadabras, i wannaZ[\\]^_`abcdefghijkl"
+ // fb_03._M_out_cur = "aacadabras, i wannaZ[\\]^_`abcdefghijkl"
+ strmsz_1 = fb_03.in_avail();
+ c2 = fb_03.sungetc(); // delete the 'a'
+ strmsz_2 = fb_03.in_avail();
+ test &= c2 == 'v';
+ test &= strmsz_1 + 1 == strmsz_2;
+ //test for _in_cur == _in_beg
+ for (int i = 50; i < 32 + 29; ++i)
+ fb_02.sputc(char(i));
+ fb_02.pubseekoff(0, std::ios_base::beg, std::ios_base::out);
+ strmsz_1 = fb_02.in_avail();
+ c1 = fb_02.sgetc();
+ c2 = fb_02.sungetc();
+ strmsz_2 = fb_02.in_avail();
+ c3 = fb_02.sgetc();
+ test &= c1 == c2;
+ test &= c3 == c2;
+ test &= c1 == c3;
+ test &= c2 == traits_type::eof();
+ test &= strmsz_1 == strmsz_2;
+ //test for _in_cur == _in_end
+ fb_03.pubseekoff(0, std::ios_base::end);
+ strmsz_1 = fb_03.in_avail(); // -1 cuz at the end
+ c1 = fb_03.sgetc();
+ c2 = fb_03.sungetc();
+ strmsz_2 = fb_03.in_avail(); // 1
+ c3 = fb_03.sgetc();
+ test &= c1 != c2;
+ // test &= c2 == c3 || c2 == traits_type::not_eof(int(c3));
+ test &= strmsz_2 != strmsz_1;
+ test &= strmsz_2 == 1;
+ //test for ios_base::out
+
+ // BUFFER MANAGEMENT & POSITIONING
+ // int sync()
+ // if a put area exists, overflow.
+ // if a get area exists, do something undefined. (like, nothing)
+ strmsz_1 = fb_01.in_avail();
+ fb_01.pubsync();
+ strmsz_2 = fb_01.in_avail();
+ test &= strmsz_2 == strmsz_1;
+ strmsz_1 = fb_02.in_avail();
+ fb_02.pubsync();
+ // 27filebuf-2.txt == 53 bytes after this.
+ strmsz_2 = fb_02.in_avail();
+ test &= strmsz_2 == -1;
+ test &= strmsz_2 == strmsz_1;
+ strmsz_1 = fb_03.in_avail();
+ fb_03.pubsync();
+ // 27filebuf-3.txt
+ // bd23456789mzuva?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
+ // 63 bytes.
+ strmsz_2 = fb_03.in_avail();
+ test &= strmsz_1 == 1;
+ test &= strmsz_2 == 1;
+
+ // setbuf
+ // pubsetbuf(char_type* s, streamsize n)
+ fb_01.pubsetbuf(0,0);
+ fb_02.pubsetbuf(0,0);
+ fb_03.pubsetbuf(0,0);
+ // Need to test unbuffered output, which means calling this on some
+ // things that have just been opened.
+
+
+ // seekoff
+ // pubseekoff(off_type off, ios_base::seekdir way, ios_base::openmode which)
+ // alters the stream position to off
+ pos_type pt_1(off_type(-1));
+ pos_type pt_2(off_type(0));
+ off_type off_1 = 0;
+ off_type off_2 = 0;
+ //IN|OUT
+ // 27filebuf-3.txt = bd23456789:;<=>?...
+ //beg
+ strmsz_1 = fb_03.in_avail();
+ pt_1 = fb_03.pubseekoff(2, std::ios_base::beg);
+ strmsz_2 = fb_03.in_avail();
+ off_1 = pt_1._M_position();
+ test &= off_1 > 0;
+ c1 = fb_03.snextc(); //current in pointer +1
+ test &= c1 == '3';
+ c2 = fb_03.sputc('\n'); //current in pointer +1
+ c3 = fb_03.sgetc();
+ test &= c2 != c3;
+ test &= c3 == '4';
+ fb_03.pubsync();
+ c1 = fb_03.sgetc();
+ test &= c1 == c3;
+ //cur
+ // 27filebuf-3.txt = bd2\n456789:;<=>?...
+ pt_2 = fb_03.pubseekoff(2, std::ios_base::cur);
+ off_2 = pt_2._M_position();
+ test &= (off_2 == (off_1 + 2 + 1 + 1));
+ c1 = fb_03.snextc(); //current in pointer +1
+ test &= c1 == '7';
+ c2 = fb_03.sputc('x'); //test current out pointer
+ c3 = fb_03.sputc('\n');
+ c1 = fb_03.sgetc();
+ fb_03.pubsync();
+ c3 = fb_03.sgetc();
+ test &= c1 == c3;
+ //end
+ // 27filebuf-3.txt = "bd2\n456x\n9"
+ pt_2 = fb_03.pubseekoff(0, std::ios_base::end,
+ std::ios_base::in|std::ios_base::out);
+ off_1 = pt_2._M_position();
+ test &= off_1 > off_2; //weak, but don't know exactly where it ends
+ c3 = fb_03.sputc('\n');
+ strmsz_1 = fb_03.sputn("because because because. . .", 28);
+ test &= strmsz_1 == 28;
+ c1 = fb_03.sungetc();
+ fb_03.pubsync();
+ c3 = fb_03.sgetc();
+ test &= c1 == c3;
+ // IN
+ // OUT
+
+
+ // seekpos
+ // pubseekpos(pos_type sp, ios_base::openmode)
+ // alters the stream position to sp
+ //IN|OUT
+ //beg
+ pt_1 = fb_03.pubseekoff(78, std::ios_base::beg);
+ off_1 = pt_1._M_position();
+ test &= off_1 > 0;
+ c1 = fb_03.snextc(); //current in pointer +1
+ test &= c1 == ' ';
+ c2 = fb_03.sputc('\n'); //test current out pointer
+ c3 = fb_03.sgetc();
+ fb_03.pubsync(); //resets pointers
+ pt_2 = fb_03.pubseekpos(pt_1);
+ off_2 = pt_2._M_position();
+ test &= off_1 == off_2;
+ c3 = fb_03.snextc(); //current in pointer +1
+ test &= c2 == c3;
+ pt_1 = fb_03.pubseekoff(0, std::ios_base::end);
+ off_1 = pt_1._M_position();
+ test &= off_1 > off_2;
+ fb_03.sputn("\nof the wonderful things he does!!\nok", 37);
+ fb_03.pubsync();
+
+ // IN
+ // OUT
+
+ // VIRTUALS (indirectly tested)
+ // underflow
+ // if read position avail, returns *gptr()
+
+ // pbackfail(int_type c)
+ // put c back into input sequence
+
+ // overflow
+ // appends c to output seq
+
+ // NB Have to close these suckers. . .
+ // filebuf_type* close()
+ fb_01.close();
+ fb_02.close();
+ fb_03.close();
+ test &= !fb_01.is_open();
+ test &= !fb_02.is_open();
+ test &= !fb_03.is_open();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+int main() {
+ test00();
+ test01();
+ test02();
+ test03();
+
+ return 0;
+}
+
+
+
+// more surf!!!
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/fpos.cc b/libstdc++-v3/testsuite/27_io/fpos.cc
new file mode 100644
index 000000000000..2e8c2759611b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/fpos.cc
@@ -0,0 +1,178 @@
+// 1999-09-20 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.4.3 template class fpos
+
+#include <ios>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+void test01()
+{
+ bool test = true;
+
+ typedef mbstate_t state_type;
+ state_type state01;
+ state_type state02;
+
+ std::streampos pos01;
+ std::streampos pos02;
+
+ std::streamoff off01;
+ std::streamoff off02;
+
+ std::streamsize size01;
+ std::streamsize size02;
+
+ // 27.4.3.1 fpos members
+ // void state(state_type s);
+ // state_type state();
+#if 0
+// XXX Need to have some sanity checking for the mbstate_t type, or
+// whatever the insantiating type for class fpos happens to be for
+// streampos, as things like equality operators and assignment
+// operators, increment and deincrement operators need to be in place.
+ pos01.state(state02);
+ state01 = pos01.state();
+ test &= state01 == state02;
+#endif
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+// 27.4.3.2 fpos requirements/invariants
+void test02()
+{
+ bool test = true;
+
+ typedef mbstate_t state_type;
+ state_type state01;
+ state_type state02;
+
+ std::streamoff off01;
+ std::streamoff off02 = 997;
+
+ int i01 = 0;
+ int i02 = 999;
+
+ // p(i), p = i
+ std::streampos pos01(i02);
+ std::streampos pos02 = i02;
+ test &= pos01 == pos02;
+
+ // p(o), p = o
+ // NB: P(o) is only required.
+ std::streampos pos03(off02);
+ std::streampos pos04 = off02;
+ test &= pos03 == pos04;
+
+ // O(p)
+ std::streamoff off03(pos04);
+ test &= off03 == off02;
+
+ // p == q, p!= q
+ test &= pos01 == pos02;
+ test &= pos02 != pos03;
+
+ // q = p + o
+ // p += o
+ pos03 = pos03 + off02;
+ pos04 += off02;
+ test &= pos03 == pos04;
+
+ // q = p - o
+ // p -= o
+ pos03 = pos03 - off02;
+ pos04 -= off02;
+ test &= pos03 == pos04;
+
+ // o = p - q
+ test &= 0 == pos03 - pos04;
+
+ // streamsize -> streamoff
+ // streamoff -> streamsize
+ off01 = off02;
+ std::streamsize size01(off02);
+ std::streamoff off04(size01);
+ test &= off01 == off04;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+void test03()
+{
+ bool test = true;
+
+ typedef mbstate_t state_type;
+ state_type state01;
+ state_type state02;
+
+ std::streamoff off01;
+ std::streamoff off02 = 997;
+
+ int i01 = 0;
+ int i02 = 999;
+
+ // casts to const streamoff
+ // (yes, I know this is weak code)
+ const std::streampos pos01 = 0;
+ off01 = pos01;
+
+ // equality/inequality with const args
+ const std::streampos pos02(54);
+ std::streampos pos03(44);
+ test &= !(pos03 == pos02);
+ test &= pos03 != pos02;
+ test &= !(pos02 == pos03);
+ test &= pos02 != pos03;
+
+ // default values
+ std::streampos pos04;
+ test &= (std::streamoff)pos04 == 0;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main() {
+ test01();
+ test02();
+ test03();
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc b/libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc
new file mode 100644
index 000000000000..5f7aeabb0547
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc
@@ -0,0 +1,74 @@
+// 1999-11-10 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.4.2.6 ios_base callbacks
+
+#include <string>
+#include <sstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+const std::string str01("the nubians of plutonia");
+std::string str02;
+
+void
+callb01(std::ios_base::event e, std::ios_base& b, int i)
+{ str02 += "the nubians"; }
+
+void
+callb02(std::ios_base::event e, std::ios_base& b, int i)
+{ str02 += " of "; }
+
+void
+callb03(std::ios_base::event e, std::ios_base& b, int i)
+{ str02 += "plutonia"; }
+
+bool test01()
+{
+ bool test = true;
+ std::locale locco("saturn_SUN*RA");
+ std::stringbuf strbuf01;
+ std::ios ios01(&strbuf01);
+
+ ios01.register_callback(callb03, 1);
+ ios01.register_callback(callb02, 1);
+ ios01.register_callback(callb01, 1);
+ ios01.imbue(locco);
+ test &= str01 == str02;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+int main(void)
+{
+ test01();
+
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ios_base_members_static.cc b/libstdc++-v3/testsuite/27_io/ios_base_members_static.cc
new file mode 100644
index 000000000000..f01372c07c36
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base_members_static.cc
@@ -0,0 +1,66 @@
+// 1999-05-21 bkoz
+// 2000-05-21 bkoz
+
+// Copyright (C) 1999, 2000 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.
+
+// 27.4.2.4 ios_base static members
+
+#include <sstream>
+#include <iostream>
+
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01()
+{
+ bool test = true;
+
+ std::stringbuf strbuf01;
+ std::ios ios01(&strbuf01);
+
+ // 1: basic invocation
+ test &= ios01.sync_with_stdio();
+ test &= ios01.sync_with_stdio(false); //returns previous state
+
+ // 2: need to test interleaving of C and C++ io on a file object.
+ test &= std::cout.good();
+ test &= !std::cout.sync_with_stdio(0);
+ test &= std::cout.good();
+ test &= !std::cout.sync_with_stdio(0);
+ test &= std::cout.good();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+int main(void)
+{
+ test01();
+
+ return 0;
+}
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ios_ctor.cc b/libstdc++-v3/testsuite/27_io/ios_ctor.cc
new file mode 100644
index 000000000000..eeaa6c910cc5
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_ctor.cc
@@ -0,0 +1,94 @@
+// 1999-07-23 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.4.4.1 basic_ios constructors
+
+#include <ios>
+#include <sstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+void test01()
+{
+ bool test = true;
+ std::string str_01("jade cove, big sur");
+ std::string str_05;
+ std::stringbuf strb_01;
+ std::stringbuf strb_02(str_01, std::ios_base::in);
+ std::stringbuf strb_03(str_01, std::ios_base::out);
+ const std::ios_base::fmtflags flag01 = std::ios_base::skipws |
+ std::ios_base::dec;
+ std::ios_base::fmtflags flag02, flag03;
+ const std::locale glocale = std::locale();
+
+ // explicit basic_ios(streambuf* sb)
+ std::ios ios_00(0);
+ std::ios ios_01(&strb_01);
+ std::ios ios_02(&strb_02);
+ std::ios ios_03(&strb_03);
+
+ // basic_ios()
+ // NB: This is protected so need to go through fstream
+
+ // void init(sreambuf* sb)
+ // NB: This is protected so need to go through fstream/stringstream
+ // Can double-check the accuracy of the above initializations though.
+ test &= ios_00.rdbuf() == 0;
+ test &= ios_00.tie() == 0;
+ test &= ios_00.rdstate() == std::ios_base::badbit;
+ test &= ios_00.exceptions() == std::ios_base::goodbit;
+ flag02 = ios_00.flags();
+ test &= flag02 == flag01;
+ test &= ios_00.width() == 0;
+ test &= ios_00.precision() == 6;
+ test &= ios_00.fill() == ios_00.widen(' ');
+ test &= ios_00.getloc() == glocale;
+
+ test &= ios_01.rdbuf() == &strb_01;
+ test &= ios_01.tie() == 0;
+ test &= ios_01.rdstate() == std::ios_base::goodbit;
+ test &= ios_01.exceptions() == std::ios_base::goodbit;
+ flag02 = ios_01.flags();
+ test &= flag02 == flag01;
+ test &= ios_01.width() == 0;
+ test &= ios_01.precision() == 6;
+ test &= ios_01.fill() == ios_01.widen(' ');
+ test &= ios_01.getloc() == glocale;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main() {
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc b/libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc
new file mode 100644
index 000000000000..ebe1472cc35c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc
@@ -0,0 +1,114 @@
+// 981027 ncm work with libstdc++v3
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <iostream>
+#include <sstream>
+#include <locale>
+#include <iomanip>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+struct MyNP : std::numpunct<char>
+{
+ std::string do_grouping() const;
+ char do_thousands_sep() const;
+};
+
+std::string MyNP::do_grouping() const { static std::string s("\3"); return s; }
+char MyNP::do_thousands_sep() const { return ' '; }
+
+void test01()
+{
+ std::cout.imbue(std::locale(std::locale(), new MyNP));
+ std::cout << std::oct << std::showbase;
+ std::cout << -0123456l << std::endl;
+
+ std::cout << ":" << std::setw(11);
+ std::cout << -01234567l << ":" << std::endl;
+
+ std::cout << ":" << std::setw(11) << std::left;
+ std::cout << -0123456l << ":" << std::endl;
+
+ std::cout << ":" << std::setw(11) << std::right;
+ std::cout << -012345l << ":" << std::endl;
+
+ std::cout << ":" << std::setw(11) << std::internal;
+ std::cout << -01234l << ":" << std::endl;
+
+ std::cout << std::hex;
+ std::cout << std::setfill('0');
+ std::cout << std::internal;
+ std::cout << std::showbase;
+ std::cout << std::setw(16);
+ std::cout << 0x12345678l << std::endl;
+#ifdef DEBUG_ASSERT
+ assert (std::cout.good());
+#endif
+}
+
+void test02()
+{
+ bool test = true;
+ const std::string str_blank;
+ std::string str_tmp;
+ std::stringbuf strbuf;
+ std::ostream o(&strbuf);
+
+ o << std::setw(6) << std::right << "san";
+ test &= strbuf.str() == " san";
+ strbuf.str(str_blank);
+
+ o << std::setw(6) << std::internal << "fran";
+ test &= strbuf.str() == " fran";
+ strbuf.str(str_blank);
+
+ o << std::setw(6) << std::left << "cisco";
+ test &= strbuf.str() == "cisco ";
+ strbuf.str(str_blank);
+
+#ifdef DEBUG_ASSERT
+ assert (test);
+#endif
+}
+
+int main() {
+ test01();
+ return 0;
+}
+
+// Projected output:
+/*
+-0 123 456
+:-01 234 567:
+:-0 123 456 :
+: -012 345:
+:- 01 234:
+0x000012 345 678
+*/
diff --git a/libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc b/libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc
new file mode 100644
index 000000000000..d0030ff9906d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc
@@ -0,0 +1,123 @@
+// 981027 ncm work with libstdc++v3
+
+// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <iostream>
+#include <sstream>
+#include <locale>
+#include <iomanip>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+struct MyNP : std::numpunct<char>
+{
+ std::string do_truename() const;
+ std::string do_falsename() const;
+};
+
+std::string MyNP::do_truename() const { static std::string s("yea"); return s; }
+std::string MyNP::do_falsename() const { static std::string s("nay"); return s; }
+
+void test01()
+{
+ std::cout << true << " " << false << std::endl;
+ std::cout << std::boolalpha;
+ std::cout << true << " " << false << std::endl;
+
+ std::cout << ":" << std::setw(6) << std::internal << true << ":" << std::endl;
+ std::cout << ":" << std::setw(6) << std::left << true << ":" << std::endl;
+ std::cout << ":" << std::setw(6) << std::right << false << ":" << std::endl;
+ std::cout << std::noboolalpha;
+ std::cout << ":" << std::setw(3) << std::internal << true << ":" << std::endl;
+ std::cout << ":" << std::setw(3) << std::left << true << ":" << std::endl;
+ std::cout << ":" << std::setw(3) << std::right << false << ":" << std::endl;
+
+ std::locale loc = std::locale (std::locale(), new MyNP);
+ std::cout.imbue(loc);
+
+ std::cout << std::boolalpha;
+ std::cout << true << " " << false << std::endl;
+
+ std::cout << ":" << std::setw(6) << std::internal << true << ":" << std::endl;
+ std::cout << ":" << std::setw(6) << std::left << true << ":" << std::endl;
+ std::cout << ":" << std::setw(6) << std::right << false << ":" << std::endl;
+
+#ifdef DEBUG_ASSERT
+ assert (std::cout.good());
+#endif
+}
+
+void test02()
+{
+ bool test = true;
+ const std::string strue("true");
+ const std::string sfalse("false");
+ std::string str01;
+ std::string str02;
+
+ std::locale loc("");
+ std::ostringstream ostr01;
+ ostr01.imbue(loc);
+ std::ios_base::fmtflags ff = ostr01.flags(std::ios_base::boolalpha);
+
+ ostr01 << true;
+ str02 = ostr01.str();
+ test &= str02 == strue;
+
+ ostr01.str(str01);
+ ostr01 << false;
+ str02 = ostr01.str();
+ test &= str02 == sfalse;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main() {
+ test01();
+ test02();
+ return 0;
+}
+
+// Projected output:
+/*
+1 0
+true false
+: true:
+:true :
+: false:
+: 1:
+:1 :
+: 0:
+yea nay
+: yea:
+:yea :
+: nay:
+*/
diff --git a/libstdc++-v3/testsuite/27_io/ios_members.cc b/libstdc++-v3/testsuite/27_io/ios_members.cc
new file mode 100644
index 000000000000..0f36967f03b1
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_members.cc
@@ -0,0 +1,152 @@
+// 1999-09-20 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.4.4.2 basic_ios member functions
+
+#include <ios>
+// NB: Don't include any other headers in this file.
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+void test01()
+{
+ bool test = true;
+
+ std::ios_base::fmtflags flag02, flag03;
+ const std::ios_base::fmtflags flag01 = std::ios_base::skipws
+ | std::ios_base::dec;
+
+ const std::locale glocale = std::locale();
+
+ std::ios ios_01(NULL);
+ std::ios::char_type ct01;
+ std::ios::char_type ct02('x');;
+
+ // 27.4.2.3 locales
+ ios_01.imbue(glocale);
+
+ // char narrow(char_type c, char dfault) const;
+ char c1 = ios_01.narrow(ct02, 0);
+ test &= c1 == 'x';
+
+ // char_type widen(char c) const;
+ ct01 = ios_01.widen('c');
+ test &= ct01 == 'c';
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+// 27.4.4.3 basic_ios iostate flags function
+void test02()
+{
+ bool test = true;
+
+ typedef std::ios_base::fmtflags fmtflags;
+ typedef std::ios_base::iostate iostate;
+ using std::ios_base;
+
+ iostate iostate02, iostate03;
+ const iostate iostate01 = std::ios_base::badbit | std::ios_base::eofbit;
+ const iostate iostate04 = std::ios_base::badbit;
+
+ const std::locale glocale = std::locale();
+
+ std::ios ios_01(NULL);
+ std::ios::char_type ct01;
+ std::ios::char_type ct02('x');;
+
+ // bool fail() const
+ test &= ios_01.fail();
+
+ // bool operator!() const
+ test &= !ios_01;
+
+ // iostate rdstate() const
+ iostate03 = ios_01.rdstate();
+ test &= static_cast<bool>(iostate03 & std::ios_base::badbit);
+
+ // void clear(iostate state = goodbit)
+ try {
+ ios_01.clear(std::ios_base::eofbit);
+ iostate02 = ios_01.rdstate();
+ test &= static_cast<bool>(iostate02 & iostate01);
+ }
+ catch(std::ios_base::failure& fail) {
+ test &= false;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ // iostate exceptions() const
+ test &= ios_01.exceptions() == std::ios_base::goodbit;
+
+ // void exceptions(iostate except)
+ try {
+ ios_01.exceptions(std::ios_base::eofbit);
+ test &= false;
+ }
+ catch(std::ios_base::failure& fail) {
+ iostate02 = ios_01.exceptions();
+ test &= static_cast<bool>(iostate02 & std::ios_base::eofbit);
+ }
+ catch(...) {
+ test &= false;
+ }
+
+ // basic_ios& copyfmt(const basic_ios& rhs)
+ std::ios ios_02(NULL);
+ ios_02.exceptions(std::ios_base::eofbit);
+ test &= static_cast<bool>(ios_02.exceptions() & std::ios_base::eofbit);
+ try {
+ ios_01.copyfmt(ios_02);
+ test &= false;
+ }
+ catch(std::ios_base::failure& fail) {
+ test &= true;
+ }
+ catch(...) {
+ test &= false;
+ }
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main() {
+ test01();
+ test02();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/27_io/iostream_objects.cc b/libstdc++-v3/testsuite/27_io/iostream_objects.cc
new file mode 100644
index 000000000000..4151ceada981
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/iostream_objects.cc
@@ -0,0 +1,117 @@
+// 990519 bkoz
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// Include all the headers except for iostream.
+#include <algorithm>
+#include <bitset>
+#include <complex>
+#include <deque>
+#include <exception>
+#include <fstream>
+#include <functional>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <istream>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#include <new>
+#include <numeric>
+#include <ostream>
+#include <queue>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <streambuf>
+#include <string>
+#include <typeinfo>
+#include <utility>
+#include <valarray>
+#include <vector>
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cfloat>
+#include <ciso646>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#if _GLIBCPP_USE_WCHAR_T
+ #include <bits/c++config.h>
+ #include <cwchar>
+ #include <cwctype>
+#endif
+
+// Include iostream last, just to make is as difficult as possible to
+// properly initialize the standard iostream objects.
+#include <iostream>
+
+// Make sure all the standard streams are defined.
+bool test01()
+{
+ bool test = true;
+
+ char array1[20];
+ typedef std::ios::traits_type ctraits_type;
+ ctraits_type::int_type i = 15;
+ ctraits_type::copy(array1, "testing istream", i);
+ array1[i] = '\0';
+ std::cout << "testing cout" << std::endl;
+ std::cerr << "testing cerr" << std::endl;
+ test &= std::cerr.flags() & std::ios_base::unitbuf;
+ std::clog << "testing clog" << std::endl;
+ // std::cin >> array1; // requires somebody to type something in.
+ test &= std::cin.tie() == &std::cout;
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ wchar_t array2[20];
+ typedef std::wios::traits_type wtraits_type;
+ wtraits_type::int_type wi = 15;
+ wtraits_type::copy(array2, L"testing istream", wi);
+ std::wcout << L"testing wcout" << std::endl;
+ std::wcerr << L"testing wcerr" << std::endl;
+ test &= std::wcerr.flags() & std::ios_base::unitbuf;
+ std::wclog << L"testing wclog" << std::endl;
+ // std::wcin >> array2; // requires somebody to type something in.
+ test &= std::wcin.tie() == &std::wcout;
+#endif
+
+ return true;
+}
+
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/istream.cc b/libstdc++-v3/testsuite/27_io/istream.cc
new file mode 100644
index 000000000000..ea07f2e502cf
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream.cc
@@ -0,0 +1,64 @@
+// 1999-09-20 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.6.1.1 basic_istream
+// NB: This file is for testing istream with NO OTHER INCLUDES.
+
+// XXX only if using namespaces, as without leads to duplicate symbols
+#if _GLIBCPP_USE_NAMESPACES
+#include <istream>
+#include <bits/basic_ios.tcc> // XXX Hack, in a perfect world this not needed.
+#include <locale> // XXX As above, needed for ctype/num_get use_facets(...)
+#include <bits/locale_facets.tcc> // XXX
+
+namespace test {
+
+ using namespace std;
+ typedef short type_t;
+ template class basic_istream<type_t, char_traits<type_t> >;
+
+#if 0
+ template
+ const ctype<type_t>&
+ use_facet<ctype<type_t> >(const locale&);
+
+ typedef istreambuf_iterator<type_t, char_traits<type_t> > traits_t;
+ template
+ const num_get<type_t, traits_t>&
+ use_facet<num_get<type_t, traits_t> >(const locale&);
+#endif
+
+} // test
+#endif
+
+int main() {
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc
new file mode 100644
index 000000000000..f6250b1010a4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc
@@ -0,0 +1,387 @@
+// 1999-04-12 bkoz
+
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.2 arithmetic extractors
+
+#include <istream>
+#include <ostream>
+#include <sstream>
+#include <locale>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+std::string str_01;
+std::string str_02("true false 0 1 110001");
+std::string str_03("-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5");
+
+std::stringbuf isbuf_01(std::ios_base::in);
+std::stringbuf isbuf_02(str_02, std::ios_base::in);
+std::stringbuf isbuf_03(str_03, std::ios_base::in);
+
+std::istream is_01(NULL);
+std::istream is_02(&isbuf_02);
+std::istream is_03(&isbuf_03);
+std::stringstream ss_01(str_01);
+
+// minimal sanity check
+bool test01() {
+
+ bool test = true;
+
+ // Integral Types:
+ bool b1 = false;
+ bool b2 = false;
+ short s1 = 0;
+ int i1 = 0;
+ long l1 = 0;
+ unsigned short us1 = 0;
+ unsigned int ui1 = 0;
+ unsigned long ul1 = 0;
+
+ // Floating-point Types:
+ float f1 = 0;
+ double d1 = 0;
+ long double ld1 = 0;
+
+ // process alphanumeric versions of bool values
+ std::ios_base::fmtflags fmt = is_02.flags();
+ bool testfmt = fmt & std::ios_base::boolalpha;
+ is_02.setf(std::ios_base::boolalpha);
+ fmt = is_02.flags();
+ testfmt = fmt & std::ios_base::boolalpha;
+ is_02 >> b1;
+ test &= b1 == 1;
+ is_02 >> b1;
+ test &= b1 == 0;
+
+ // process numeric versions of of bool values
+ is_02.unsetf(std::ios_base::boolalpha);
+ fmt = is_02.flags();
+ testfmt = fmt & std::ios_base::boolalpha;
+ is_02 >> b1;
+ test &= b1 == 0;
+ is_02 >> b1;
+ test &= b1 == 1;
+
+ // is_03 == "-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"
+ is_03 >> l1;
+ test &= l1 == -19999999;
+ is_03 >> ul1;
+ test &= ul1 == 777777;
+ is_03 >> i1;
+ test &= i1 == -234234;
+ is_03 >> ui1;
+ test &= ui1 == 233;
+ is_03 >> s1;
+ test &= s1 == -234;
+ is_03 >> us1;
+ test &= us1 == 33;
+ is_03 >> b1;
+ test &= b1 == 1;
+ is_03 >> ld1;
+ test &= ld1 == 66300.25;
+ is_03 >> d1;
+ test &= d1 == .315;
+ is_03 >> f1;
+ test &= f1 == 1.5;
+
+ // test void pointers
+ int i = 55;
+ void* po = &i;
+ void* pi;
+
+ ss_01 << po;
+ ss_01 >> pi;
+ test &= po == pi;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// elaborated test for ints
+bool test02() {
+
+ bool test = true;
+ const std::string str_01("20000AB");
+ std::stringbuf strb_01(str_01, std::ios_base::in);
+ std::istream is(&strb_01);
+
+ int n = 15;
+ is >> n;
+ test &= n == 20000;
+ char c = is.peek();
+ test &= c == 65;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+bool test03()
+{
+ std::stringbuf sbuf;
+ std::istream istr(&sbuf);
+ std::ostream ostr(&sbuf);
+
+ bool test = true;
+ long l01;
+ ostr << "12220101";
+ istr >> l01; // _M_in_end set completely incorrectly here.
+ test &= l01 == 12220101;
+ test &= istr.rdstate() == std::ios_base::eofbit;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00081.html
+// Jim Parsons
+void test06()
+{
+ // default locale, grouping is turned off
+ bool test = true;
+ unsigned int h4, h3, h2;
+ char c;
+ std::string s("205,199,144");
+ std::istringstream is(s);
+
+ is >> h4; // 205
+ test &= h4 == 205;
+ is >> c; // ','
+ test &= c == ',';
+
+ is >> h4; // 199
+ test &= h4 == 199;
+ is >> c; // ','
+ test &= c == ',';
+
+ is >> h4; // 144
+ test &= is.rdstate() == std::ios_base::eofbit;
+ test &= h4 == 144;
+ is >> c; // EOF
+ test &= c == ',';
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+namespace std {
+ class test_numpunct1 : public numpunct<char>
+ {
+ protected:
+ string
+ do_grouping() const
+ { return string(1, '\003'); }
+ };
+} // namespace std
+
+void test07()
+{
+ // manufactured locale, grouping is turned on
+ bool test = true;
+ unsigned int h4 = 0, h3 = 0, h2 = 0;
+ float f1 = 0.0;
+ const std::string s1("205,199 23,445.25 1,024,365 123,22,24");
+ std::istringstream is(s1);
+ is.imbue(std::locale(std::locale(), new std::test_numpunct1));
+
+ // Basic operation.
+ is >> h4;
+ test &= h4 == 205199;
+ test &= is.good();
+
+ is.clear();
+ is >> f1;
+ test &= f1 == 23445.25;
+ test &= is.good();
+
+ is.clear();
+ is >> h3;
+ test &= h3 == 1024365;
+ test &= is.good();
+
+ is.clear();
+ is >> h2;
+ test &= h2 == 0;
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::eofbit);
+
+ // Stress tests for explicit errors in grouping corner cases. The
+ // validity of these tests and results have been hammered out in
+ // private email between bkoz and ncm between Jan 25 and Jan 27, 2000.
+ // Thanks nate -- benjamin
+ const std::string s2(",111 4,,4 0.25,345 5..25 156,, 1,000000 1000000 1234,567");
+ h3 = h4 = h2 = 0;
+ f1 = 0.0;
+ const char c_control = '?';
+ char c = c_control;
+ is.clear();
+ is.str(s2);
+
+ is >> h4;
+ test &= h4 == 0;
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ is.clear();
+ is >> c;
+ test &= c == ',';
+ test &= is.good();
+
+ is.ignore(3);
+ is >> f1;
+ test &= f1 == 0.0;
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ is.clear();
+ is >> c;
+ test &= c == ',';
+ is >> c;
+ test &= c == '4';
+ test &= is.good();
+
+ is >> f1;
+ test &= f1 == 0.25;
+ test &= is.good();
+ is >> c;
+ test &= c == ',';
+ is >> h2;
+ test &= h2 == 345;
+ test &= is.good();
+ f1 = 0.0;
+ h2 = 0;
+
+ is >> f1;
+ test &= f1 == 5.0;
+ test &= is.good();
+ is >> f1;
+ test &= f1 == .25;
+ test &= is.good();
+
+ is >> h3;
+ test &= h3 == 0;
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ is.clear();
+ is >> c;
+ test &= c == ','; // second one
+ test &= is.good();
+
+ is >> h2;
+ test &= h2 == 0;
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ is.clear();
+
+ is >> h2;
+ test &= h2 == 1000000;
+ test &= is.good();
+ h2 = 0;
+
+ is >> h2;
+ test &= h2 == 0;
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::eofbit);
+ is.clear();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+namespace std {
+ class test_numpunct2 : public numpunct<char>
+ {
+ protected:
+ string
+ do_grouping() const
+ { return string("\002\003"); }
+ };
+} // namespace std
+
+void test08()
+{
+ // manufactured locale, grouping is turned on
+ bool test = true;
+ unsigned int h4 = 0, h3 = 0, h2 = 0;
+ float f1 = 0.0;
+ const std::string s1("1,22 205,19 22,123,22");
+ const std::string s2("1,220 2050,19 202,123,22");
+
+ std::istringstream is(s1);
+ is.imbue(std::locale(std::locale(), new std::test_numpunct2));
+
+ // Basic operation.
+ is >> h4;
+ test &= h4 == 122;
+ test &= is.good();
+
+ is.clear();
+ is >> h3;
+ test &= h3 == 20519;
+ test &= is.good();
+
+ is.clear();
+ is >> h2;
+ test &= h2 == 2212322;
+ test &= static_cast<bool>(is.rdstate() & std::ios_base::eofbit);
+
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+
+ test06();
+ test07();
+ test08();
+ return 0;
+}
+
+
+
+
+
+// paul miller was right on with riddim warfare!
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_char.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_char.cc
new file mode 100644
index 000000000000..6a6312855f46
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_extractor_char.cc
@@ -0,0 +1,232 @@
+// 1999-07-26 bkoz
+
+// Copyright (C) 1999 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.
+
+// 27.6.1.2.3 character extractors
+
+#include <istream>
+#include <sstream>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+bool test01() {
+
+ bool test = true;
+ std::string str_01;
+ const std::string str_02("coltrane playing 'softly as a morning sunrise'");
+ const std::string str_03("coltrane");
+
+ std::stringbuf isbuf_01(std::ios_base::in);
+ std::stringbuf isbuf_02(str_02, std::ios_base::in);
+ std::istream is_01(NULL);
+ std::istream is_02(&isbuf_02);
+
+ std::ios_base::iostate state1, state2, statefail;
+ statefail = std::ios_base::failbit;
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(istream&, _CharT*)
+ int n = 20;
+ char array1[n];
+ typedef std::ios::traits_type ctraits_type;
+ ctraits_type::int_type i1, i2;
+
+ state1 = is_01.rdstate();
+ i1 = ctraits_type::length(array1);
+ is_01 >> array1; // should snake 0 characters, not alter stream state
+ i2 = ctraits_type::length(array1);
+ state2 = is_01.rdstate();
+ test &= i1 == i2;
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+
+ state1 = is_02.rdstate();
+ is_02 >> array1; // should snake "coltrane"
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= !static_cast<bool>(state2 & statefail);
+ test &= array1[str_03.size() - 1] == 'e';
+ array1[str_03.size()] = '\0';
+ test &= !str_03.compare(0, str_03.size(), array1);
+ std::istream::int_type int1 = is_02.peek(); // should be ' '
+ test &= int1 == ' ';
+
+ state1 = is_02.rdstate();
+ is_02 >> array1; // should snake "playing" as sentry "eats" ws
+ state2 = is_02.rdstate();
+ int1 = is_02.peek(); // should be ' '
+ test &= int1 == ' ';
+ test &= state1 == state2;
+ test &= !static_cast<bool>(state2 & statefail);
+
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(istream&, unsigned char*)
+ unsigned char array2[n];
+ state1 = is_02.rdstate();
+ is_02 >> array2; // should snake 'softly
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= !static_cast<bool>(state2 & statefail);
+ test &= array2[0] == '\'';
+ test &= array2[1] == 's';
+ test &= array2[6] == 'y';
+ int1 = is_02.peek(); // should be ' '
+ test &= int1 == ' ';
+
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(istream&, signed char*)
+ signed char array3[n];
+ state1 = is_02.rdstate();
+ is_02 >> array3; // should snake "as"
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= !static_cast<bool>(state2 & statefail);
+ test &= array3[0] == 'a';
+ test &= array3[1] == 's';
+ int1 = is_02.peek(); // should be ' '
+ test &= int1 == ' ';
+
+
+ // testing with width() control enabled.
+ is_02.width(8);
+ state1 = is_02.rdstate();
+ is_02 >> array1; // should snake a
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= !ctraits_type::compare(array1, "a", 2);
+
+ is_02.width(1);
+ state1 = is_02.rdstate();
+ is_02 >> array1; // should snake nothing, set failbit
+ state2 = is_02.rdstate();
+ test &= state1 != state2;
+ test &= state2 == statefail;
+ test &= array1[0] == '\0';
+
+ is_02.width(8);
+ is_02.clear();
+ state1 = is_02.rdstate();
+ test &= !state1;
+ is_02 >> array1; // should snake "morning"
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= !ctraits_type::compare(array1, "morning", 8);
+
+ // testing for correct exception setting
+ const std::string str_04(" impulse!!");
+ std::stringbuf isbuf_03(str_04, std::ios_base::in);
+ std::stringbuf isbuf_04(str_04, std::ios_base::in);
+ std::istream is_03(&isbuf_03);
+ std::istream is_04(&isbuf_04);
+
+ is_03 >> array1;
+ test &= !ctraits_type::compare(array1,"impulse!!", 10);
+ test &= is_03.rdstate() == std::ios_base::eofbit;
+
+ is_04.width(9);
+ is_04 >> array1;
+ test &= ! std::ios::traits_type::compare(array1,"impulse!", 9);
+ test &= !is_04.rdstate();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+bool test02() {
+
+ typedef std::ios::traits_type ctraits_type;
+
+ bool test = true;
+ std::string str_01;
+ const std::string str_02("or coltrane playing tunji with jimmy garrison");
+ const std::string str_03("coltrane");
+
+ std::stringbuf isbuf_01(std::ios_base::in);
+ std::stringbuf isbuf_02(str_02, std::ios_base::in);
+ std::istream is_01(NULL);
+ std::istream is_02(&isbuf_02);
+ std::ios_base::iostate state1, state2, statefail;
+ statefail = std::ios_base::failbit;
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(istream&, _CharT&)
+ char c1 = 'c', c2 = 'c';
+ state1 = is_01.rdstate();
+ is_01 >> c1;
+ state2 = is_01.rdstate();
+ test &= state1 != state2;
+ test &= c1 == c2;
+ test &= static_cast<bool>(state2 & statefail);
+
+ state1 = is_02.rdstate();
+ is_02 >> c1;
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= c1 == 'o';
+ is_02 >> c1;
+ is_02 >> c1;
+ test &= c1 == 'c';
+ test &= !static_cast<bool>(state2 & statefail);
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(istream&, unsigned char&)
+ unsigned char uc1 = 'c';
+ state1 = is_02.rdstate();
+ is_02 >> uc1;
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= uc1 == 'o';
+ is_02 >> uc1;
+ is_02 >> uc1;
+ test &= uc1 == 't';
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(istream&, signed char&)
+ signed char sc1 = 'c';
+ state1 = is_02.rdstate();
+ is_02 >> sc1;
+ state2 = is_02.rdstate();
+ test &= state1 == state2;
+ test &= sc1 == 'r';
+ is_02 >> sc1;
+ is_02 >> sc1;
+ test &= sc1 == 'n';
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+int main()
+{
+ test01();
+ test02();
+
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.tst b/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.tst
new file mode 100644
index 000000000000..717a04c5f4d2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.tst
@@ -0,0 +1,65 @@
+// 990811 bkoz
+
+// Copyright (C) 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.
+
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Repatriation
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/Vivian Jackson and the Prop
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/Michael Rose - Born Free (d
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Love Thy Nei
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Defe
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Ralp
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Tommy McCook and Don D. Jnr
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Big Youth and Vivian Jackso
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Big Youth Fi
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Upsetter Mix - Rally Dub
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Dicky Burton - God Is Watch
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Pablo and Vivian Jackson -
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Rock King Tu
+/mnt/cdrom/TORTOISE_millions_now_living/tortoise_5
+/mnt/cdrom/TORTOISE_millions_now_living/tortoise_6
+/mnt/cdrom/bettycarter_i'myours,you'remine/This time
+/mnt/cdrom/bettycarter_i'myours,you'remine/I'm Yours, You're Mine
+/mnt/cdrom/bettycarter_i'myours,you'remine/Lonely House
+/mnt/cdrom/bettycarter_i'myours,you'remine/Close Your Eyes
+/mnt/cdrom/bettycarter_i'myours,you'remine/Useless Landscape
+/mnt/cdrom/bettycarter_i'myours,you'remine/East of the Sun
+/mnt/cdrom/bettycarter_i'myours,you'remine/September Song
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Naima's Love Song
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Stay As Sweet As You Are
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Make Him Believe
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/I Should Care
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Once Upon a Summertime
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/You Go To My Head
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/In the Still Of the Night
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/When It's Sleepy Time Down
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/The Love We Had Yesterday
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Dip Bag
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/You're Mine, Too
+/mnt/cdrom/c_adderly_somethin'_else/Autumn Leaves
+/mnt/cdrom/c_adderly_somethin'_else/Love For Sale
+/mnt/cdrom/c_adderly_somethin'_else/Somethin' Else
+/mnt/cdrom/c_adderly_somethin'_else/One For Daddy-O
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.txt b/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.txt
new file mode 100644
index 000000000000..717a04c5f4d2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_extractor_other-1.txt
@@ -0,0 +1,65 @@
+// 990811 bkoz
+
+// Copyright (C) 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.
+
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Repatriation
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/Vivian Jackson and the Prop
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/Michael Rose - Born Free (d
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Love Thy Nei
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Defe
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Ralp
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Tommy McCook and Don D. Jnr
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Big Youth and Vivian Jackso
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Big Youth Fi
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Upsetter Mix - Rally Dub
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Dicky Burton - God Is Watch
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Pablo and Vivian Jackson -
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Rock King Tu
+/mnt/cdrom/TORTOISE_millions_now_living/tortoise_5
+/mnt/cdrom/TORTOISE_millions_now_living/tortoise_6
+/mnt/cdrom/bettycarter_i'myours,you'remine/This time
+/mnt/cdrom/bettycarter_i'myours,you'remine/I'm Yours, You're Mine
+/mnt/cdrom/bettycarter_i'myours,you'remine/Lonely House
+/mnt/cdrom/bettycarter_i'myours,you'remine/Close Your Eyes
+/mnt/cdrom/bettycarter_i'myours,you'remine/Useless Landscape
+/mnt/cdrom/bettycarter_i'myours,you'remine/East of the Sun
+/mnt/cdrom/bettycarter_i'myours,you'remine/September Song
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Naima's Love Song
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Stay As Sweet As You Are
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Make Him Believe
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/I Should Care
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Once Upon a Summertime
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/You Go To My Head
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/In the Still Of the Night
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/When It's Sleepy Time Down
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/The Love We Had Yesterday
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Dip Bag
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/You're Mine, Too
+/mnt/cdrom/c_adderly_somethin'_else/Autumn Leaves
+/mnt/cdrom/c_adderly_somethin'_else/Love For Sale
+/mnt/cdrom/c_adderly_somethin'_else/Somethin' Else
+/mnt/cdrom/c_adderly_somethin'_else/One For Daddy-O
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_other-2.tst b/libstdc++-v3/testsuite/27_io/istream_extractor_other-2.tst
new file mode 100644
index 000000000000..717a04c5f4d2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_extractor_other-2.tst
@@ -0,0 +1,65 @@
+// 990811 bkoz
+
+// Copyright (C) 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.
+
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Repatriation
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/Vivian Jackson and the Prop
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/Michael Rose - Born Free (d
+/mnt/cdrom/yabbyyou_jesusdread/disk_2/King Tubby's - Love Thy Nei
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Defe
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Vivian Jackson and the Ralp
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Tommy McCook and Don D. Jnr
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Big Youth and Vivian Jackso
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Big Youth Fi
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Upsetter Mix - Rally Dub
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Dicky Burton - God Is Watch
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/Pablo and Vivian Jackson -
+/mnt/cdrom/yabbyyou_jesusdread/disk_1/King Tubby's - Rock King Tu
+/mnt/cdrom/TORTOISE_millions_now_living/tortoise_5
+/mnt/cdrom/TORTOISE_millions_now_living/tortoise_6
+/mnt/cdrom/bettycarter_i'myours,you'remine/This time
+/mnt/cdrom/bettycarter_i'myours,you'remine/I'm Yours, You're Mine
+/mnt/cdrom/bettycarter_i'myours,you'remine/Lonely House
+/mnt/cdrom/bettycarter_i'myours,you'remine/Close Your Eyes
+/mnt/cdrom/bettycarter_i'myours,you'remine/Useless Landscape
+/mnt/cdrom/bettycarter_i'myours,you'remine/East of the Sun
+/mnt/cdrom/bettycarter_i'myours,you'remine/September Song
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Naima's Love Song
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Stay As Sweet As You Are
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Make Him Believe
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/I Should Care
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Once Upon a Summertime
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/You Go To My Head
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/In the Still Of the Night
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/When It's Sleepy Time Down
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/The Love We Had Yesterday
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/Dip Bag
+/mnt/cdrom/bettycarter_it'snotaboutthemelo/You're Mine, Too
+/mnt/cdrom/c_adderly_somethin'_else/Autumn Leaves
+/mnt/cdrom/c_adderly_somethin'_else/Love For Sale
+/mnt/cdrom/c_adderly_somethin'_else/Somethin' Else
+/mnt/cdrom/c_adderly_somethin'_else/One For Daddy-O
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc
new file mode 100644
index 000000000000..09b1ac275762
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc
@@ -0,0 +1,197 @@
+// 1999-07-28 bkoz
+
+// Copyright (C) 1999 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.
+
+// 27.6.1.2.3 basic_istream::operator>>
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+
+// stringbufs.
+bool test01() {
+
+ typedef std::ios::traits_type ctraits_type;
+
+ bool test = true;
+ const std::string str_01;
+ const std::string str_02("art taylor kickin it on DAKAR");
+ std::string strtmp;
+
+ std::stringbuf isbuf_00(std::ios_base::in);
+ std::stringbuf isbuf_01(std::ios_base::in | std::ios_base::out);
+ std::stringbuf isbuf_02(str_01, std::ios_base::in);
+ std::stringbuf isbuf_03(str_01, std::ios_base::in | std::ios_base::out);
+ std::stringbuf isbuf_04(str_02, std::ios_base::in);
+ std::stringbuf isbuf_05(str_02, std::ios_base::in | std::ios_base::out);
+
+ std::istream is_00(NULL);
+ std::istream is_01(&isbuf_01);
+ std::istream is_02(&isbuf_02);
+ std::istream is_03(&isbuf_03);
+ std::istream is_04(&isbuf_04);
+ std::istream is_05(&isbuf_05);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(basic_istream& (*pf) (basic_istream&))
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(basic_ios& (*pf) (basic_ios&))
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(ios_base& (*pf) (ios_base&))
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(basic_streambuf*)
+
+ // null istream to empty in_buf
+ state1 = is_00.rdstate();
+ is_00 >> &isbuf_00;
+ state2 = is_00.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+ test &= isbuf_00.str() == str_01;
+
+ // null istream to empty in_out_buf
+ is_00.clear(std::ios_base::goodbit);
+ state1 = is_00.rdstate();
+ is_00 >> &isbuf_01;
+ state2 = is_00.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+ test &= isbuf_01.str() == str_01;
+
+ // null istream to full in_buf
+ is_00.clear(std::ios_base::goodbit);
+ state1 = is_00.rdstate();
+ is_00 >> &isbuf_04;
+ state2 = is_00.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+ test &= isbuf_04.str() == str_02;
+
+ // null istream to full in_out_buf
+ is_00.clear(std::ios_base::goodbit);
+ state1 = is_00.rdstate();
+ is_00 >> &isbuf_05;
+ state2 = is_00.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+ test &= isbuf_05.str() == str_02;
+
+ // empty but non-null istream to full in_buf
+ state1 = is_02.rdstate();
+ is_02 >> &isbuf_04;
+ state2 = is_02.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+ test &= isbuf_04.str() == str_02; // as only an "in" buffer
+ test &= isbuf_04.sgetc() == 'a';
+
+ // empty but non-null istream to full in_out_buf
+ is_02.clear(std::ios_base::goodbit);
+ state1 = is_02.rdstate();
+ is_02 >> &isbuf_05;
+ state2 = is_02.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+ test &= isbuf_05.str() == str_02; // as only an "in" buffer
+ test &= isbuf_05.sgetc() == 'a';
+
+ // full istream to empty in_buf (need out_buf, you know?)
+ state1 = is_04.rdstate();
+ is_04 >> &isbuf_02;
+ state2 = is_04.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & statefail);
+ test &= isbuf_02.str() == str_01; // as only an "in" buffer
+ test &= isbuf_02.sgetc() == ctraits_type::eof();
+ test &= is_04.peek() == ctraits_type::eof(); // as failed
+
+ // full istream to empty in_out_buf
+ is_04.clear(std::ios_base::goodbit);
+ state1 = is_04.rdstate();
+ is_04 >> &isbuf_03;
+ state2 = is_04.rdstate();
+ test &= state1 != state2;
+ test &= !static_cast<bool>(state2 & statefail);
+ test &= state2 == stateeof;
+ strtmp = isbuf_03.str();
+ test &= strtmp == str_02; // as only an "in" buffer
+ test &= isbuf_03.sgetc() == 'a';
+ test &= is_04.peek() == ctraits_type::eof();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// filebufs.
+bool test02() {
+
+ bool test = true;
+ typedef std::ios::traits_type ctraits_type;
+ const char name_01[] = "testsuite/istream_extractor_other-1.txt"; //read
+ const char name_02[] = "testsuite/istream_extractor_other-2.txt"; //write
+
+ std::filebuf fbin, fbout;
+ fbin.open(name_01, std::ios_base::in);
+ fbout.open(name_02, std::ios_base::out | std::ios_base::trunc);
+ test &= fbin.is_open();
+ test &= fbout.is_open();
+
+ if (test)
+ {
+ std::istream is(&fbin);
+ is.unsetf(std::ios_base::skipws);
+ is >> &fbout;
+ }
+
+ fbout.close();
+ fbin.close();
+ test &= !fbin.is_open();
+ test &= !fbout.is_open();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_manip.cc b/libstdc++-v3/testsuite/27_io/istream_manip.cc
new file mode 100644
index 000000000000..206e4068d6ce
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_manip.cc
@@ -0,0 +1,93 @@
+// 1999-07-22 bkoz
+
+// Copyright (C) 1994, 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.
+
+// 27.6.1.4 standard basic_istream manipulators
+
+#include <istream>
+#include <sstream>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+
+ const char str_lit01[] = " venice ";
+ const std::string str01(" santa barbara ");
+ std::string str02(str_lit01);
+ std::string str04;
+ std::string str05;
+ std::ios_base::iostate flag1, flag2, flag3, flag4, flag5;
+
+ // template<_CharT, _Traits>
+ // basic_istream<_CharT, _Traits>& ws(basic_istream<_Char, _Traits>& is)
+ std::istringstream iss01(str01);
+ std::istringstream iss02(str01);
+
+ iss01 >> str04;
+ test &= str04.size() != str01.size();
+ test &= str04 == "santa";
+
+ iss02 >> std::ws;
+ iss02 >> str05;
+ test &= str05.size() != str01.size();
+ test &= str05 == "santa";
+ test &= str05 == str04;
+
+ iss01 >> str04;
+ test &= str04.size() != str01.size();
+ test &= str04 == "barbara";
+
+ iss02 >> std::ws;
+ iss02 >> str05;
+ test &= str05.size() != str01.size();
+ test &= str05 == "barbara";
+ test &= str05 == str04;
+
+ flag3 = std::ios_base::eofbit;
+ flag4 = std::ios_base::badbit;
+ flag5 = std::ios_base::failbit;
+ test &= !iss01.fail();
+ test &= !iss02.fail();
+ test &= !iss01.eof();
+ test &= !iss02.eof();
+
+ iss01 >> std::ws;
+ test &= !iss01.fail();
+ test &= iss01.eof();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_sentry.cc b/libstdc++-v3/testsuite/27_io/istream_sentry.cc
new file mode 100644
index 000000000000..ba4f7cb1bd8b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_sentry.cc
@@ -0,0 +1,86 @@
+// 1999-10-14 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.6.1.1.2 class basic_istream::sentry
+
+#include <istream>
+#include <sstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+void test01()
+{
+ bool test = true;
+ const char* lit01 = "stereolab on the bolsinga tip";
+ const std::string str01(lit01);
+
+ std::stringbuf strbuf01;
+ std::stringbuf strbuf02(str01);
+ std::istream istr01(&strbuf01);
+ std::istream istr02(&strbuf02);
+
+ // test negatives
+ std::istream::sentry sentry01(istr01);
+ test &= bool(sentry01) == false;
+
+ std::istream::sentry sentry02(istr01, true);
+ test &= bool(sentry02) == false;
+
+ // positive tests
+ std::istream::sentry sentry03(istr02);
+ test &= bool(sentry03) == true;
+
+ std::istream::sentry sentry04(istr02, true);
+ test &= bool(sentry04) == true;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+
+int main() {
+
+ test01();
+ return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istream_unformatted-1.tst b/libstdc++-v3/testsuite/27_io/istream_unformatted-1.tst
new file mode 100644
index 000000000000..5d9eafa2a361
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_unformatted-1.tst
@@ -0,0 +1,7 @@
+bd2
+456x
+9mzuv>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
+because because
+because. .
+of the wonderful things he does!!
+ok \ No newline at end of file
diff --git a/libstdc++-v3/testsuite/27_io/istream_unformatted-1.txt b/libstdc++-v3/testsuite/27_io/istream_unformatted-1.txt
new file mode 100644
index 000000000000..5d9eafa2a361
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_unformatted-1.txt
@@ -0,0 +1,7 @@
+bd2
+456x
+9mzuv>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
+because because
+because. .
+of the wonderful things he does!!
+ok \ No newline at end of file
diff --git a/libstdc++-v3/testsuite/27_io/istream_unformatted-2.tst b/libstdc++-v3/testsuite/27_io/istream_unformatted-2.tst
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_unformatted-2.tst
diff --git a/libstdc++-v3/testsuite/27_io/istream_unformatted.cc b/libstdc++-v3/testsuite/27_io/istream_unformatted.cc
new file mode 100644
index 000000000000..df2245791d21
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istream_unformatted.cc
@@ -0,0 +1,582 @@
+// 1999-08-11 bkoz
+
+// Copyright (C) 1999 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.
+
+// 27.6.1.3 unformatted input functions
+
+#include <istream>
+#include <sstream>
+#include <fstream>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+
+bool test01() {
+
+ typedef std::ios::traits_type traits_type;
+
+ bool test = true;
+ const std::string str_01;
+ const std::string str_02("soul eyes: john coltrane quartet");
+ std::string strtmp;
+
+ std::stringbuf isbuf_03(str_02, std::ios_base::in);
+ std::stringbuf isbuf_04(str_02, std::ios_base::in);
+
+ std::istream is_00(NULL);
+ std::istream is_03(&isbuf_03);
+ std::istream is_04(&isbuf_04);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ // istream& read(char_type* s, streamsize n)
+ char carray[60] = "";
+ state1 = is_04.rdstate();
+ is_04.read(carray, 0);
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+
+ state1 = is_04.rdstate();
+ is_04.read(carray, 9);
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+ test &= !strncmp(carray, "soul eyes", 9);
+ test &= is_04.peek() == ':';
+
+ state1 = is_03.rdstate();
+ is_03.read(carray, 60);
+ state2 = is_03.rdstate();
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & stateeof);
+ test &= static_cast<bool>(state2 & statefail);
+ test &= !strncmp(carray, "soul eyes: john coltrane quartet", 35);
+
+
+ // istream& ignore(streamsize n = 1, int_type delim = traits::eof())
+ state1 = is_04.rdstate();
+ is_04.ignore();
+ test &= is_04.gcount() == 1;
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+ test &= is_04.peek() == ' ';
+
+ state1 = is_04.rdstate();
+ is_04.ignore(0);
+ test &= is_04.gcount() == 0;
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+ test &= is_04.peek() == ' ';
+
+ state1 = is_04.rdstate();
+ is_04.ignore(5, traits_type::to_int_type(' '));
+ test &= is_04.gcount() == 1;
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+ test &= is_04.peek() == 'j';
+
+ // int_type peek()
+ state1 = is_04.rdstate();
+ test &= is_04.peek() == 'j';
+ test &= is_04.gcount() == 0;
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+
+ is_04.ignore(30);
+ state1 = is_04.rdstate();
+ test &= is_04.peek() == traits_type::eof();
+ test &= is_04.gcount() == 0;
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+
+
+ // istream& putback(char c)
+ is_04.clear();
+ state1 = is_04.rdstate();
+ is_04.putback('|');
+ test &= is_04.gcount() == 0;
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+ test &= is_04.peek() == '|';
+
+ // istream& unget()
+ is_04.clear();
+ state1 = is_04.rdstate();
+ is_04.unget();
+ test &= is_04.gcount() == 0;
+ state2 = is_04.rdstate();
+ test &= state1 == state2;
+ test &= is_04.peek() == 'e';
+
+ // int sync()
+ int i = is_00.sync();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+bool test02(void)
+{
+ typedef std::char_traits<char> traits_type;
+
+ bool test = true;
+ const char str_lit01[] = " sun*ra
+ and his myth science arkestra present
+ angles and demons @ play
+ the nubians of plutonia";
+ std::string str01(str_lit01);
+ std::string strtmp;
+
+ std::stringbuf sbuf_04(str01, std::ios_base::in);
+
+ std::istream is_00(NULL);
+ std::istream is_04(&sbuf_04);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+ std::streamsize count1, count2;
+ char carray1[400] = "";
+
+ // istream& getline(char* s, streamsize n, char delim)
+ // istream& getline(char* s, streamsize n)
+ state1 = is_00.rdstate();
+ is_00.getline(carray1, 20, '*');
+ state2 = is_00.rdstate();
+ test &= is_04.gcount() == 0;
+ test &= state1 != state2;
+ test &= bool(state2 & statefail);
+
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 1, '\t'); // extracts, throws away
+ state2 = is_04.rdstate();
+ test &= is_04.gcount() == 1;
+ test &= state1 == state2;
+ test &= state1 == 0;
+ test &= !traits_type::compare("", carray1, 1);
+
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 20, '*');
+ state2 = is_04.rdstate();
+ test &= is_04.gcount() == 10;
+ test &= state1 == state2;
+ test &= state1 == 0;
+ test &= !traits_type::compare("\t\t sun", carray1, 10);
+
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 20);
+ state2 = is_04.rdstate();
+ test &= is_04.gcount() == 4;
+ test &= state1 == state2;
+ test &= state1 == 0;
+ test &= !traits_type::compare("ra ", carray1, 4);
+
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 65);
+ state2 = is_04.rdstate();
+ test &= is_04.gcount() == 64;
+ test &= state1 != state2;
+ test &= state2 == statefail;
+ test &= !traits_type::compare(" and his myth science arkestra presen", carray1, 65);
+
+ is_04.clear();
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 120, '|');
+ state2 = is_04.rdstate();
+ test &= is_04.gcount() == 106;
+ test &= state1 != state2;
+ test &= state2 == stateeof;
+
+ is_04.clear();
+ state1 = is_04.rdstate();
+ is_04.getline(carray1, 100, '|');
+ state2 = is_04.rdstate();
+ test &= is_04.gcount() == 0;
+ test &= state1 != state2;
+ test &= static_cast<bool>(state2 & stateeof);
+ test &= static_cast<bool>(state2 & statefail);
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+bool test03(void)
+{
+ typedef std::char_traits<char> traits_type;
+
+ bool test = true;
+ const char str_lit01[] = " sun*ra
+ & his arkestra, featuring john gilmore:
+ jazz in silhouette: images and forecasts of tomorrow";
+ std::string str01(str_lit01);
+ std::string strtmp;
+
+ std::stringbuf sbuf_03;
+ std::stringbuf sbuf_04(str01, std::ios_base::in);
+ std::stringbuf sbuf_05(str01, std::ios_base::in);
+
+ std::istream is_00(NULL);
+ std::istream is_04(&sbuf_04);
+ std::istream is_05(&sbuf_05);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+ std::streamsize count1, count2;
+ char carray1[400] = "";
+
+ // int_type get()
+ // istream& get(char*, streamsize, char delim)
+ // istream& get(char*, streamsize)
+ // istream& get(streambuf&, char delim)
+ // istream& get(streambuf&)
+ is_00.get(carray1, 2);
+ test &= static_cast<bool>(is_00.rdstate() & statefail);
+ test &= is_00.gcount() == 0;
+
+ is_04.get(carray1, 4);
+ test &= !(is_04.rdstate() & statefail);
+ test &= !traits_type::compare(carray1, " ", 4);
+ test &= is_04.gcount() == 3;
+
+ is_04.clear();
+ is_04.get(carray1 + 3, 200);
+ test &= !(is_04.rdstate() & statefail);
+ test &= !(is_04.rdstate() & stateeof);
+ test &= !traits_type::compare(carray1, str_lit01, 10);
+ test &= is_04.gcount() == 7;
+
+ is_04.clear();
+ is_04.get(carray1, 200);
+ test &= !(is_04.rdstate() & stateeof);
+ test &= static_cast<bool>(is_04.rdstate() & statefail); // delimiter
+ test &= is_04.gcount() == 0;
+ is_04.clear();
+ is_04.get(carray1, 200, '[');
+ test &= static_cast<bool>(is_04.rdstate() & stateeof);
+ test &= !(is_04.rdstate() & statefail);
+ test &= is_04.gcount() == 125;
+ is_04.clear();
+ is_04.get(carray1, 200);
+ test &= static_cast<bool>(is_04.rdstate() & stateeof);
+ test &= static_cast<bool>(is_04.rdstate() & statefail);
+ test &= is_04.gcount() == 0;
+
+ std::stringbuf sbuf_02(std::ios_base::in);
+ is_05.clear();
+ is_05.get(sbuf_02);
+ test &= is_05.gcount() == 0;
+ test &= static_cast<bool>(is_05.rdstate() & statefail);
+ test &= !(is_05.rdstate() & stateeof);
+
+ is_05.clear();
+ is_05.get(sbuf_03);
+ test &= is_05.gcount() == 10;
+ test &= sbuf_03.str() == " sun*ra ";
+ test &= !(is_05.rdstate() & statefail);
+ test &= !(is_05.rdstate() & stateeof);
+
+ is_05.clear();
+ is_05.get(sbuf_03, '|');
+ test &= is_05.gcount() == 125;
+ test &= sbuf_03.str() == str_lit01;
+ test &= !(is_05.rdstate() & statefail);
+ test &= static_cast<bool>(is_05.rdstate() & stateeof);
+
+ is_05.clear();
+ is_05.get(sbuf_03, '|');
+ test &= is_05.gcount() == 0;
+ test &= static_cast<bool>(is_05.rdstate() & stateeof);
+ test &= static_cast<bool>(is_05.rdstate() & statefail);
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// fstreams
+void test04(void)
+{
+ bool test = true;
+ std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
+ std::ios_base::iostate state01, state02;
+ const char str_lit01[] = "testsuite/istream_unformatted-1.txt";
+ const char str_lit02[] = "testsuite/istream_unformatted-2.txt";
+ std::ifstream if01(str_lit01, std::ios_base::in | std::ios_base::out);
+ std::ifstream if02(str_lit01, std::ios_base::in);
+ std::ifstream if03(str_lit02, std::ios_base::out | std::ios_base::trunc);
+ test &= if01.good();
+ test &= if02.good();
+ test &= if03.good();
+
+ std::istream is01(if01.rdbuf());
+ std::istream is02(if02.rdbuf());
+ std::istream is03(if03.rdbuf());
+
+ // pos_type tellg()
+ // in | out
+ pos01 = is01.tellg();
+ pos02 = is01.tellg();
+ test &= pos01 == pos02;
+ // test &= istream::pos_type(0) != pos01; //depricated
+
+ // in
+ pos03 = is02.tellg();
+ pos04 = is02.tellg();
+ test &= pos03 == pos04;
+ // test &= istream::pos_type(0) != pos03; //depricated
+
+ // out
+ pos05 = is03.tellg();
+ pos06 = is03.tellg();
+ test &= pos05 == pos06;
+ // test &= istream::pos_type(0) != pos01; //depricated
+
+ // istream& seekg(pos_type)
+ // istream& seekg(off_type, ios_base::seekdir)
+
+ // cur
+ // NB: see library issues list 136. It's the v-3 interp that seekg
+ // only sets the input buffer, or else istreams with buffers that
+ // have _M_mode == ios_base::out will fail to have consistency
+ // between seekg and tellg.
+ state01 = is01.rdstate();
+ is01.seekg(10, std::ios_base::cur);
+ state02 = is01.rdstate();
+ pos01 = is01.tellg();
+ test &= pos01 == pos02 + 10;
+ test &= state01 == state02;
+ pos02 = is01.tellg();
+ test &= pos02 == pos01;
+
+ state01 = is02.rdstate();
+ is02.seekg(10, std::ios_base::cur);
+ state02 = is02.rdstate();
+ pos03 = is02.tellg();
+ test &= pos03 == pos04 + 10;
+ test &= state01 == state02;
+ pos04 = is02.tellg();
+ test &= pos03 == pos04;
+
+ state01 = is03.rdstate();
+ is03.seekg(10, std::ios_base::cur);
+ state02 = is03.rdstate();
+ pos05 = is03.tellg();
+ test &= pos05 == pos06 + 10;
+ test &= state01 == state02;
+ pos06 = is03.tellg();
+ test &= pos05 == pos06;
+
+ // beg
+ state01 = is01.rdstate();
+ is01.seekg(20, std::ios_base::beg);
+ state02 = is01.rdstate();
+ pos01 = is01.tellg();
+ test &= pos01 == pos02 + 10;
+ test &= state01 == state02;
+ pos02 = is01.tellg();
+ test &= pos02 == pos01;
+
+ state01 = is02.rdstate();
+ is02.seekg(20, std::ios_base::beg);
+ state02 = is02.rdstate();
+ pos03 = is02.tellg();
+ test &= pos03 == pos04 + 10;
+ test &= state01 == state02;
+ pos04 = is02.tellg();
+ test &= pos03 == pos04;
+
+ state01 = is03.rdstate();
+ is03.seekg(20, std::ios_base::beg);
+ state02 = is03.rdstate();
+ pos05 = is03.tellg();
+ test &= pos05 == pos06 + 10;
+ test &= state01 == state02;
+ pos06 = is03.tellg();
+ test &= pos05 == pos06;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+// stringstreams
+void test05(void)
+{
+ bool test = true;
+ std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
+ std::ios_base::iostate state01, state02;
+ const char str_lit01[] = "testsuite/istream_unformatted-1.tst";
+ std::ifstream if01(str_lit01);
+ std::ifstream if02(str_lit01);
+ std::ifstream if03(str_lit01);
+ test &= if01.good();
+ test &= if02.good();
+ test &= if03.good();
+
+ std::stringbuf strbuf01(std::ios_base::in | std::ios_base::out);
+ if01 >> &strbuf01;
+ // initialize stringbufs that are ios_base::out
+ std::stringbuf strbuf03(strbuf01.str(), std::ios_base::out);
+ // initialize stringbufs that are ios_base::in
+ std::stringbuf strbuf02(strbuf01.str(), std::ios_base::in);
+
+ std::istream is01(&strbuf01);
+ std::istream is02(&strbuf02);
+ std::istream is03(&strbuf03);
+
+ // pos_type tellg()
+ // in | out
+ pos01 = is01.tellg();
+ pos02 = is01.tellg();
+ test &= pos01 == pos02;
+ // test &= istream::pos_type(0) != pos01; // deprecated
+
+ // in
+ pos03 = is02.tellg();
+ pos04 = is02.tellg();
+ test &= pos03 == pos04;
+ // test &= istream::pos_type(0) != pos03; // deprecated
+
+ // out
+ pos05 = is03.tellg();
+ pos06 = is03.tellg();
+ test &= pos05 == pos06;
+ // test &= istream::pos_type(0) != pos01; //deprecated
+
+ // istream& seekg(pos_type)
+ // istream& seekg(off_type, ios_base::seekdir)
+
+ // cur
+ // NB: see library issues list 136. It's the v-3 interp that seekg
+ // only sets the input buffer, or else istreams with buffers that
+ // have _M_mode == ios_base::out will fail to have consistency
+ // between seekg and tellg.
+ state01 = is01.rdstate();
+ is01.seekg(10, std::ios_base::cur);
+ state02 = is01.rdstate();
+ pos01 = is01.tellg();
+ test &= pos01 == pos02 + 10;
+ test &= state01 == state02;
+ pos02 = is01.tellg();
+ test &= pos02 == pos01;
+
+ state01 = is02.rdstate();
+ is02.seekg(10, std::ios_base::cur);
+ state02 = is02.rdstate();
+ pos03 = is02.tellg();
+ test &= pos03 == pos04 + 10;
+ test &= state01 == state02;
+ pos04 = is02.tellg();
+ test &= pos03 == pos04;
+
+ state01 = is03.rdstate();
+ is03.seekg(10, std::ios_base::cur);
+ state02 = is03.rdstate();
+ pos05 = is03.tellg();
+ test &= pos05 == pos06; // as only out buffer
+ test &= state01 == state02;
+ pos06 = is03.tellg();
+ test &= pos05 == pos06;
+
+ // beg
+ state01 = is01.rdstate();
+ is01.seekg(20, std::ios_base::beg);
+ state02 = is01.rdstate();
+ pos01 = is01.tellg();
+ test &= pos01 == pos02 + 10;
+ test &= state01 == state02;
+ pos02 = is01.tellg();
+ test &= pos02 == pos01;
+
+ state01 = is02.rdstate();
+ is02.seekg(20, std::ios_base::beg);
+ state02 = is02.rdstate();
+ pos03 = is02.tellg();
+ test &= pos03 == pos04 + 10;
+ test &= state01 == state02;
+ pos04 = is02.tellg();
+ test &= pos03 == pos04;
+
+ state01 = is03.rdstate();
+ is03.seekg(20, std::ios_base::beg);
+ state02 = is03.rdstate();
+ pos05 = is03.tellg();
+ test &= pos05 == pos06; // as only out buffer
+ test &= state01 == state02;
+ pos06 = is03.tellg();
+ test &= pos05 == pos06;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+// http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00177.html
+void test06()
+{
+ bool test = true;
+
+ const std::string str_00("Red_Garland_Qunitet-Soul_Junction");
+ std::string strtmp;
+ char c_array[str_00.size() + 4];
+
+ std::stringbuf isbuf_00(str_00, std::ios_base::in);
+ std::istream is_00(&isbuf_00);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ state1 = stateeof | statefail;
+ test &= is_00.gcount() == 0;
+ is_00.read(c_array, str_00.size() + 1);
+ test &= is_00.gcount() == str_00.size();
+ test &= is_00.rdstate() == state1;
+
+ is_00.read(c_array, str_00.size());
+ test &= is_00.rdstate() == state1;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+ test05();
+ test06();
+ return 0;
+}
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/istringstream_members.cc b/libstdc++-v3/testsuite/27_io/istringstream_members.cc
new file mode 100644
index 000000000000..6047b650fc58
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/istringstream_members.cc
@@ -0,0 +1,86 @@
+// 2000-01-10 bkoz
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.7.2 template class basic_istringstream
+// 27.7.2.2 member functions (istringstream_members)
+
+// stringbuf* rdbuf() const
+
+#include <sstream>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+
+void test01()
+{
+ bool test = true;
+ std::istringstream is01;
+ const std::string str01 = "123";
+ std::string str02;
+ const int i01 = 123;
+ int a,b;
+
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+ // void str(const basic_string&)
+ is01.str(str01);
+ state1 = is01.rdstate();
+ is01 >> a;
+ state2 = is01.rdstate();
+ test &= a = i01;
+ // 22.2.2.1.2 num_get virtual functions
+ // p 13
+ // in any case, if stage 2 processing was terminated by the test for
+ // in == end then err != ios_base::eofbit is performed.
+ test &= state1 != state2;
+ test &= state2 == stateeof;
+
+ is01.str(str01);
+ is01 >> b;
+ test &= b != a;
+ // as is01.good() is false, istream::sentry blocks extraction.
+
+ is01.clear();
+ state1 = is01.rdstate();
+ is01 >> b;
+ state2 = is01.rdstate();
+ test &= b == a;
+ test &= state1 != state2;
+ test &= state2 == stateeof;
+
+ // string str() const
+ str02 = is01.str();
+ test &= str01 == str02;
+
+ #ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream.cc b/libstdc++-v3/testsuite/27_io/ostream.cc
new file mode 100644
index 000000000000..326992542571
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream.cc
@@ -0,0 +1,52 @@
+// 1999-09-20 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.6.2.1 basic_ostream
+// NB: This file is for testing ostream with NO OTHER INCLUDES.
+
+// XXX only if using namespaces, as without leads to duplicate symbols
+#if _GLIBCPP_USE_NAMESPACES
+#include <ostream>
+#include <bits/basic_ios.tcc> // XXX Hack, in a perfect world this not needed.
+#include <locale> // XXX As above, needed for ctype/num_get use_facets(...)
+#include <bits/locale_facets.tcc>
+
+namespace test {
+
+ using namespace std;
+ typedef short type_t;
+ template class basic_ostream<type_t, char_traits<type_t> >;
+
+} // test
+#endif
+
+int main() {
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc b/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc
new file mode 100644
index 000000000000..fd31614774e5
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc
@@ -0,0 +1,303 @@
+// 1999-11-15 Kevin Ediger <kediger@licor.com>
+// test the floating point inserters (facet num_put)
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <iostream>
+#include <iomanip>
+#include <locale>
+#include <sstream>
+#include <limits>
+#include <assert.h>
+
+using namespace std;
+
+#define __TEST_NUMPUT_VERBOSE 1
+
+struct _TestCase
+{
+ double val;
+
+ int precision;
+ int width;
+ char decimal;
+ char fill;
+
+ bool fixed;
+ bool scientific;
+ bool showpos;
+ bool showpoint;
+ bool uppercase;
+ bool internal;
+ bool left;
+ bool right;
+
+ const char* result;
+#if _GLIBCPP_USE_WCHAR_T
+ const wchar_t* wresult;
+#endif
+};
+
+static bool T=true;
+static bool F=false;
+
+static _TestCase testcases[] =
+{
+#if _GLIBCPP_USE_WCHAR_T
+ // standard output (no formatting applied)
+ { 1.2, 6,0,'.',' ', F,F,F,F,F,F,F,F, "1.2",L"1.2" },
+ { 54, 6,0,'.',' ', F,F,F,F,F,F,F,F, "54",L"54" },
+ { -.012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-0.012",L"-0.012" },
+ { -.00000012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-1.2e-07",L"-1.2e-07" },
+
+ // fixed formatting
+ { 10.2345, 0,0,'.',' ', T,F,F,F,F,F,F,F, "10",L"10" },
+ { 10.2345, 0,0,'.',' ', T,F,F,T,F,F,F,F, "10.",L"10." },
+ { 10.2345, 1,0,'.',' ', T,F,F,F,F,F,F,F, "10.2",L"10.2" },
+ { 10.2345, 4,0,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
+ { 10.2345, 6,0,'.',' ', T,F,T,F,F,F,F,F, "+10.234500",L"+10.234500" },
+ { -10.2345, 6,0,'.',' ', T,F,F,F,F,F,F,F, "-10.234500",L"-10.234500" },
+ { -10.2345, 6,0,',',' ', T,F,F,F,F,F,F,F, "-10,234500",L"-10,234500" },
+
+ // fixed formatting with width
+ { 10.2345, 4,5,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
+ { 10.2345, 4,6,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
+ { 10.2345, 4,7,'.',' ', T,F,F,F,F,F,F,F, "10.2345",L"10.2345" },
+ { 10.2345, 4,8,'.',' ', T,F,F,F,F,F,F,F, " 10.2345",L" 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,F, " 10.2345",L" 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,T,F, "10.2345 ",L"10.2345 " },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,T, " 10.2345",L" 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, " 10.2345",L" 10.2345" },
+ { -10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, "- 10.2345",L"- 10.2345" },
+ { -10.2345, 4,10,'.','A', T,F,F,F,F,T,F,F, "-AA10.2345",L"-AA10.2345" },
+ { 10.2345, 4,10,'.','#', T,F,T,F,F,T,F,F, "+##10.2345",L"+##10.2345" },
+
+ // scientific formatting
+ { 1.23e+12, 1,0,'.',' ', F,T,F,F,F,F,F,F, "1.2e+12",L"1.2e+12" },
+ { 1.23e+12, 1,0,'.',' ', F,T,F,F,T,F,F,F, "1.2E+12",L"1.2E+12" },
+ { 1.23e+12, 2,0,'.',' ', F,T,F,F,F,F,F,F, "1.23e+12",L"1.23e+12" },
+ { 1.23e+12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "1.230e+12",L"1.230e+12" },
+ { 1.23e+12, 3,0,'.',' ', F,T,T,F,F,F,F,F, "+1.230e+12",L"+1.230e+12" },
+ { -1.23e-12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "-1.230e-12",L"-1.230e-12" },
+ { 1.23e+12, 3,0,',',' ', F,T,F,F,F,F,F,F, "1,230e+12",L"1,230e+12" },
+#else
+ // standard output (no formatting applied)
+ { 1.2, 6,0,'.',' ', F,F,F,F,F,F,F,F, "1.2" },
+ { 54, 6,0,'.',' ', F,F,F,F,F,F,F,F, "54" },
+ { -.012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-0.012" },
+ { -.00000012, 6,0,'.',' ', F,F,F,F,F,F,F,F, "-1.2e-07" },
+
+ // fixed formatting
+ { 10.2345, 0,0,'.',' ', T,F,F,F,F,F,F,F, "10" },
+ { 10.2345, 0,0,'.',' ', T,F,F,T,F,F,F,F, "10." },
+ { 10.2345, 1,0,'.',' ', T,F,F,F,F,F,F,F, "10.2" },
+ { 10.2345, 4,0,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
+ { 10.2345, 6,0,'.',' ', T,F,T,F,F,F,F,F, "+10.234500" },
+ { -10.2345, 6,0,'.',' ', T,F,F,F,F,F,F,F, "-10.234500" },
+ { -10.2345, 6,0,',',' ', T,F,F,F,F,F,F,F, "-10,234500" },
+
+ // fixed formatting with width
+ { 10.2345, 4,5,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
+ { 10.2345, 4,6,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
+ { 10.2345, 4,7,'.',' ', T,F,F,F,F,F,F,F, "10.2345" },
+ { 10.2345, 4,8,'.',' ', T,F,F,F,F,F,F,F, " 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,F, " 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,T,F, "10.2345 " },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,F,F,T, " 10.2345" },
+ { 10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, " 10.2345" },
+ { -10.2345, 4,10,'.',' ', T,F,F,F,F,T,F,F, "- 10.2345" },
+ { -10.2345, 4,10,'.','A', T,F,F,F,F,T,F,F, "-AA10.2345" },
+ { 10.2345, 4,10,'.','#', T,F,T,F,F,T,F,F, "+##10.2345" },
+
+ // scientific formatting
+ { 1.23e+12, 1,0,'.',' ', F,T,F,F,F,F,F,F, "1.2e+12" },
+ { 1.23e+12, 1,0,'.',' ', F,T,F,F,T,F,F,F, "1.2E+12" },
+ { 1.23e+12, 2,0,'.',' ', F,T,F,F,F,F,F,F, "1.23e+12" },
+ { 1.23e+12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "1.230e+12" },
+ { 1.23e+12, 3,0,'.',' ', F,T,T,F,F,F,F,F, "+1.230e+12" },
+ { -1.23e-12, 3,0,'.',' ', F,T,F,F,F,F,F,F, "-1.230e-12" },
+ { 1.23e+12, 3,0,',',' ', F,T,F,F,F,F,F,F, "1,230e+12" },
+#endif
+};
+
+template<typename _CharT>
+class testpunct : public numpunct<_CharT>
+{
+public:
+ typedef _CharT char_type;
+
+ explicit
+ testpunct(char_type decimal_char) : numpunct<_CharT>()
+ {
+ _M_init(decimal_char, ',', "");
+ }
+};
+
+template<typename _CharT>
+void apply_formatting(const _TestCase & tc, basic_ostream<_CharT> & os)
+{
+ os.precision(tc.precision);
+ os.width(tc.width);
+ os.fill(static_cast<_CharT>(tc.fill));
+ if (tc.fixed)
+ os.setf(ios::fixed);
+ if (tc.scientific)
+ os.setf(ios::scientific);
+ if (tc.showpos)
+ os.setf(ios::showpos);
+ if (tc.showpoint)
+ os.setf(ios::showpoint);
+ if (tc.uppercase)
+ os.setf(ios::uppercase);
+ if (tc.internal)
+ os.setf(ios::internal);
+ if (tc.left)
+ os.setf(ios::left);
+ if (tc.right)
+ os.setf(ios::right);
+}
+
+void test01()
+{
+ for (int j=0; j<sizeof(testcases)/sizeof(testcases[0]); j++)
+ {
+ _TestCase & tc = testcases[j];
+#ifdef __TEST_NUMPUT_VERBOSE
+ cout << "expect: " << tc.result << endl;
+#endif
+ // test double with char type
+ {
+ testpunct<char>* __tp = new testpunct<char>(tc.decimal);
+ ostringstream os;
+ locale __loc(os.getloc(), __tp);
+ os.imbue(__loc);
+ apply_formatting(tc, os);
+ os << tc.val;
+#ifdef __TEST_NUMPUT_VERBOSE
+ cout << "result: " << os.str() << endl;
+#endif
+ assert(os && os.str() == tc.result);
+ }
+ // test long double with char type
+ {
+ testpunct<char>* __tp = new testpunct<char>(tc.decimal);
+ ostringstream os;
+ locale __loc(os.getloc(), __tp);
+ os.imbue(__loc);
+ apply_formatting(tc, os);
+ os << (long double)tc.val;
+#ifdef __TEST_NUMPUT_VERBOSE
+ cout << "result: " << os.str() << endl;
+#endif
+ assert(os && os.str() == tc.result);
+ }
+#if _GLIBCPP_USE_WCHAR_T
+ // test double with wchar_t type
+ {
+ testpunct<wchar_t>* __tp = new testpunct<wchar_t>(tc.decimal);
+ wostringstream os;
+ locale __loc(os.getloc(), __tp);
+ os.imbue(__loc);
+ apply_formatting(tc, os);
+ os << tc.val;
+ assert(os && os.str() == tc.wresult);
+ }
+ // test long double with wchar_t type
+ {
+ testpunct<wchar_t>* __tp = new testpunct<wchar_t>(tc.decimal);
+ wostringstream os;
+ locale __loc(os.getloc(), __tp);
+ os.imbue(__loc);
+ apply_formatting(tc, os);
+ os << (long double)tc.val;
+ assert(os && os.str() == tc.wresult);
+ }
+#endif
+ }
+}
+
+void test02()
+{
+ // make sure we can output a very long float
+ long double val = 1.2345678901234567890123456789e+1000L;
+ int prec = numeric_limits<long double>::digits10;
+
+ ostringstream os;
+ os.precision(prec);
+ os.setf(ios::scientific);
+ os << val;
+
+ char largebuf[512];
+ sprintf(largebuf, "%.*Le", prec, val);
+#ifdef __TEST_NUMPUT_VERBOSE
+ cout << "expect: " << largebuf << endl;
+ cout << "result: " << os.str() << endl;
+#endif
+ assert(os && os.str() == largebuf);
+}
+
+void test03()
+{
+ short s = -1;
+ int i = -1;
+ long l = -1;
+ bool test = true;
+
+ const string str_blank;
+ string str_tmp;
+ stringbuf strbuf;
+ ostream o(&strbuf);
+
+ o << oct << s << ' ' << hex << s;
+ test &= strbuf.str() == "177777 ffff"; // Assuming 2byte-shorts
+ strbuf.str(str_blank);
+
+ o << oct << i << ' ' << hex << i;
+ test &= strbuf.str() == "37777777777 ffffffff";
+ strbuf.str(str_blank);
+
+ o << oct << l << ' ' << hex << l;
+ test &= strbuf.str() == "37777777777 ffffffff";
+ strbuf.str(str_blank);
+
+ o << showpos << hex << showbase << 11;
+ test &= strbuf.str() == "0xb";
+
+ assert(test);
+}
+
+int main()
+{
+ test01();
+ test02();
+#ifdef __TEST_NUMPUT_VERBOSE
+ cout << "Test passed!" << endl;
+#endif
+ return 0;
+}
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.tst b/libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.tst
new file mode 100644
index 000000000000..0b0acc85640f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_char-1.tst
@@ -0,0 +1,1000 @@
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
+123456789
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc b/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc
new file mode 100644
index 000000000000..893631e0ceb7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc
@@ -0,0 +1,271 @@
+// 1999-08-16 bkoz
+
+// Copyright (C) 2000, 1999 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.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <string>
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+// ofstream
+bool test01()
+{
+ bool test = true;
+ std::string str01;
+ const int size = 1000;
+ const char name_02[] = "testsuite/ostream_inserter_char-1.txt";
+
+ // initialize string
+ for(int i=0 ; i < size; i++) {
+ str01 += '1';
+ str01 += '2';
+ str01 += '3';
+ str01 += '4';
+ str01 += '5';
+ str01 += '6';
+ str01 += '7';
+ str01 += '8';
+ str01 += '9';
+ str01 += '\n';
+ }
+ std::ofstream f(name_02);
+
+ f << str01;
+ f.close();
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// ostringstream width() != zero
+// left
+bool test02(void)
+{
+ bool test = true;
+ std::string tmp;
+
+ std::string str01 = "";
+ std::ostringstream oss01;
+ oss01.width(5);
+ oss01.fill('0');
+ oss01.flags(std::ios_base::left);
+ oss01 << str01;
+ tmp = oss01.str();
+ test &= tmp == "00000";
+
+ std::string str02 = "1";
+ std::ostringstream oss02;
+ oss02.width(5);
+ oss02.fill('0');
+ oss02.flags(std::ios_base::left);
+ oss02 << str02;
+ tmp = oss02.str();
+ test &= tmp == "10000";
+
+ std::string str03 = "909909";
+ std::ostringstream oss03;
+ oss03.width(5);
+ oss03.fill('0');
+ oss03.flags(std::ios_base::left);
+ oss03 << str03;
+ tmp = oss03.str();
+ test &= tmp == "909909";
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// width() != zero
+// right
+bool test03(void)
+{
+ bool test = true;
+ std::string tmp;
+
+ std::string str01 = "";
+ std::ostringstream oss01;
+ oss01.width(5);
+ oss01.fill('0');
+ oss01.flags(std::ios_base::right);
+ oss01 << str01;
+ tmp = oss01.str();
+ test &= tmp == "00000";
+
+ std::string str02 = "1";
+ std::ostringstream oss02;
+ oss02.width(5);
+ oss02.fill('0');
+ oss02.flags(std::ios_base::right);
+ oss02 << str02;
+ tmp = oss02.str();
+ test &= tmp == "00001";
+
+ std::string str03 = "909909";
+ std::ostringstream oss03;
+ oss03.width(5);
+ oss03.fill('0');
+ oss03.flags(std::ios_base::right);
+ oss03 << str03;
+ tmp = oss03.str();
+ test &= tmp == "909909";
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// stringstream and large strings
+bool test04() {
+
+ bool test = true;
+ std::string str_01;
+ const std::string str_02("coltrane playing 'softly as a morning sunrise'");
+ const std::string str_03("coltrane");
+ std::string str_tmp;
+ const int i_max=250;
+
+ std::ostringstream oss_01(std::ios_base::out);
+ std::ostringstream oss_02(str_01, std::ios_base::out);
+
+ std::ios_base::iostate state1, state2, statefail;
+ statefail = std::ios_base::failbit;
+
+ // template<_CharT, _Traits>
+ // basic_ostream& operator<<(ostream&, const char*)
+ for (int i = 0; i < i_max; ++i)
+ oss_02 << "Test: " << i << std::endl;
+ str_tmp = oss_02.str();
+ test &= !oss_02.bad();
+ test &= oss_02.good();
+ test &= str_tmp != str_01;
+ test &= str_tmp.size() == 2390;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+// ostringstream and large strings number 2
+bool test05()
+{
+ bool test = true;
+ std::string str05, str10;
+
+ typedef std::ostream::pos_type pos_type;
+ typedef std::ostream::off_type off_type;
+ std::string str01;
+ const int size = 1000;
+
+ // initialize string
+ for(int i=0 ; i < size; i++) {
+ str01 += '1';
+ str01 += '2';
+ str01 += '3';
+ str01 += '4';
+ str01 += '5';
+ str01 += '6';
+ str01 += '7';
+ str01 += '8';
+ str01 += '9';
+ str01 += '\n';
+ }
+
+ // test 1: out
+ std::ostringstream sstr01(str01, std::ios_base::out);
+ std::ostringstream sstr02;
+ sstr02 << str01;
+ str05 = sstr01.str();
+ str10 = sstr02.str();
+ test &= str05 == str01;
+ test &= str10 == str01;
+
+ // test 2: in | out
+ std::ostringstream sstr04(str01, std::ios_base::out | std::ios_base::in);
+ std::ostringstream sstr05(std::ios_base::in | std::ios_base::out);
+ sstr05 << str01;
+ str05 = sstr04.str();
+ str10 = sstr05.str();
+ test &= str05 == str01;
+ test &= str10 == str01;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+// ostringstream and positioning, multiple writes
+// http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00326.html
+void test06()
+{
+ bool test = true;
+ const char carray01[] = "mos def & talib kweli are black star";
+
+ // normal
+ std::ostringstream ostr1("mos def");
+ test &= ostr1.str() == "mos def";
+ ostr1 << " & talib kweli"; // should overwrite first part of buffer
+ test &= ostr1.str() == " & talib kweli";
+ ostr1 << " are black star"; // should append to string from above
+ test &= ostr1.str() != carray01;
+ test &= ostr1.str() == " & talib kweli are black star";
+
+ // appending
+ std::ostringstream ostr2("blackalicious",
+ std::ios_base::out | std::ios_base::ate);
+ test &= ostr2.str() == "blackalicious";
+ ostr2 << " NIA "; // should not overwrite first part of buffer
+ test &= ostr2.str() == "blackalicious NIA ";
+ ostr2 << "4: deception (5:19)"; // should append to full string from above
+ test &= ostr2.str() == "blackalicious NIA 4: deception (5:19)";
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+
+int main()
+{
+
+ test02();
+ test03();
+ test04();
+ test05();
+ test06();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_other-1.tst b/libstdc++-v3/testsuite/27_io/ostream_inserter_other-1.tst
new file mode 100644
index 000000000000..cb3c57f7dfd3
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_other-1.tst
@@ -0,0 +1,158 @@
+// 990117 bkoz
+// test functionality of basic_filebuf for char_type == char
+// this is a data file for 27filebuf.cc
+
+// 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.
+
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.allofme
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.speaklow
+
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_01_the_way_i_feel
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_02_seduction_kidnap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_03_just_a_ny_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_04_butterflies_i_remem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_05_luxury_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_06_my_house
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_07_the_women_gather
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_08_the_life_i_led
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_09_when_i_die
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_10_revolutionary_dreams
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_11_winter_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_12_a_certain_peace_i_nap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_13_poem_for_a_lady_whose
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/
+/mnt/cdrom/marley-songs_of_freedom/disk_2/
+/mnt/cdrom/marley-songs_of_freedom/disk_4/
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/back out
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bend down low
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bus dem shut (pyaka)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/caution
+/mnt/cdrom/marley-songs_of_freedom/disk_1/do it twice
+/mnt/cdrom/marley-songs_of_freedom/disk_1/don't rock the boat
+/mnt/cdrom/marley-songs_of_freedom/disk_1/duppy conqueror
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hammer
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hypocrites
+/mnt/cdrom/marley-songs_of_freedom/disk_1/i'm still waiting
+/mnt/cdrom/marley-songs_of_freedom/disk_1/judge not
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mellow mood
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mr brown
+/mnt/cdrom/marley-songs_of_freedom/disk_1/nice time
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one cup of coffee
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one love_people get ready
+/mnt/cdrom/marley-songs_of_freedom/disk_1/put it on
+/mnt/cdrom/marley-songs_of_freedom/disk_1/simmer down
+/mnt/cdrom/marley-songs_of_freedom/disk_1/small axe
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul rebel
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul shake down party
+/mnt/cdrom/marley-songs_of_freedom/disk_1/stir it up (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/sun is shining
+/mnt/cdrom/marley-songs_of_freedom/disk_1/thank you lord (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_2/acoustic medley
+/mnt/cdrom/marley-songs_of_freedom/disk_2/burnin' and lootin'
+/mnt/cdrom/marley-songs_of_freedom/disk_2/concrete jungle
+/mnt/cdrom/marley-songs_of_freedom/disk_2/craven choke puppy
+/mnt/cdrom/marley-songs_of_freedom/disk_2/get up stand up
+/mnt/cdrom/marley-songs_of_freedom/disk_2/guava jelly
+/mnt/cdrom/marley-songs_of_freedom/disk_2/high tide or low tide
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i shot the sheriff
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i'm hurting inside
+/mnt/cdrom/marley-songs_of_freedom/disk_2/iron lion zion
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lick samba
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lively up yourself
+/mnt/cdrom/marley-songs_of_freedom/disk_2/natty dread
+/mnt/cdrom/marley-songs_of_freedom/disk_2/no more trouble
+/mnt/cdrom/marley-songs_of_freedom/disk_2/rastaman chant
+/mnt/cdrom/marley-songs_of_freedom/disk_2/screw face
+/mnt/cdrom/marley-songs_of_freedom/disk_2/slave driver
+/mnt/cdrom/marley-songs_of_freedom/disk_2/trenchtown rock
+/mnt/cdrom/marley-songs_of_freedom/disk_4/africa unite
+/mnt/cdrom/marley-songs_of_freedom/disk_4/babylon system
+/mnt/cdrom/marley-songs_of_freedom/disk_4/bad card
+/mnt/cdrom/marley-songs_of_freedom/disk_4/coming in from the cold (12
+/mnt/cdrom/marley-songs_of_freedom/disk_4/could you be loved (12 mix
+/mnt/cdrom/marley-songs_of_freedom/disk_4/forever loving jah
+/mnt/cdrom/marley-songs_of_freedom/disk_4/give thanks and praise
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one drop
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one dub
+/mnt/cdrom/marley-songs_of_freedom/disk_4/rastaman live up
+/mnt/cdrom/marley-songs_of_freedom/disk_4/real situation
+/mnt/cdrom/marley-songs_of_freedom/disk_4/redemption song (live in pi
+/mnt/cdrom/marley-songs_of_freedom/disk_4/ride natty ride (12 mix)
+/mnt/cdrom/marley-songs_of_freedom/disk_4/so much trouble in the worl
+/mnt/cdrom/marley-songs_of_freedom/disk_4/survival
+/mnt/cdrom/marley-songs_of_freedom/disk_4/why should i (previously un
+/mnt/cdrom/marley-songs_of_freedom/disk_4/zimbabwe
+
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_01_pandemonium
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_02_sync_disjecta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_03_object_unknown
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_04_it's_nice_not
+/mnt/cdrom/dj_spooky_rid-2dim_warefare/djspooky_05_dialectical_tra
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_06_post-human_soph
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_07_quilombo_ex
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_08_rekonstruction
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_09_scientifik
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_10_a_conversation
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_11_peace_in_zaire
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_13_degree_zero
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_14_roman_planeta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_15_bass_digitalis
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_16_polyphony_of
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_17_riddim_warfare
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_18_the_nerd
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_20_theme_of_the
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_21_twilight_fugue
+
+/mnt/cdrom/stuff_smith_mosaic/disk3/01_desert_sands
+/mnt/cdrom/stuff_smith_mosaic/disk3/02_soft_winds
+/mnt/cdrom/stuff_smith_mosaic/disk3/03_time_and_again
+/mnt/cdrom/stuff_smith_mosaic/disk3/04_it_don't_mean_a_thing
+/mnt/cdrom/stuff_smith_mosaic/disk3/05_in_a_mellotone
+/mnt/cdrom/stuff_smith_mosaic/disk3/06_i_know_that_you_know
+/mnt/cdrom/stuff_smith_mosaic/disk3/07_heat_wave
+/mnt/cdrom/stuff_smith_mosaic/disk3/08_things_ain't_what_they_used_to_be
+/mnt/cdrom/stuff_smith_mosaic/disk3/09_body_and_soul
+
+So I take a break, wander down to the park to stand, then lean into
+the concrete railing demarking the beginnings of space, oceanic
+space. I watch the waves break, and form, and ease back out to sea and
+wrap my arms around myself and hug tightly because it's early in the
+morning and windy, and the sun is late getting out of bed today, which
+is good because if there was brilliant light illuminating all the
+beauty around me I would be shocked, stunned, forced to retreat back
+into my cabana in a daze, blinded by hummingbirds and callilillies and
+un-named red, yellow, and blue flowers. Green envelopes me, waves
+sooth me. I can see the wind flip the top of the waves seaward, right
+before they break. The sea seems so calm from my perch above the fray
+that I wonder if maybe there is just some part of the deepest, most
+abstract ocean where there is a large creature who happily chews
+plankton and wags its tail in gentle, adulating waves that spread and
+move and gracefully glide thousands of miles, to crash upon a beach,
+one after the other, politely waiting for a turn to dance with the
+seashore.
+
+I know: it is what the Mexican schoolchildren call "la vibora de la
+mer," the serpent of the sea.
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_other-2.tst b/libstdc++-v3/testsuite/27_io/ostream_inserter_other-2.tst
new file mode 100644
index 000000000000..cb3c57f7dfd3
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_other-2.tst
@@ -0,0 +1,158 @@
+// 990117 bkoz
+// test functionality of basic_filebuf for char_type == char
+// this is a data file for 27filebuf.cc
+
+// 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.
+
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.allofme
+/mnt/cdrom/sarah_vaughan/sarah_vaughan.speaklow
+
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_01_the_way_i_feel
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_02_seduction_kidnap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_03_just_a_ny_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_04_butterflies_i_remem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_05_luxury_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_06_my_house
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_07_the_women_gather
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_08_the_life_i_led
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_09_when_i_die
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_10_revolutionary_dreams
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_11_winter_poem
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_12_a_certain_peace_i_nap
+/mnt/cdrom/nikkigiovanni_thewayifeel/ng_13_poem_for_a_lady_whose
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/
+/mnt/cdrom/marley-songs_of_freedom/disk_2/
+/mnt/cdrom/marley-songs_of_freedom/disk_4/
+
+/mnt/cdrom/marley-songs_of_freedom/disk_1/back out
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bend down low
+/mnt/cdrom/marley-songs_of_freedom/disk_1/bus dem shut (pyaka)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/caution
+/mnt/cdrom/marley-songs_of_freedom/disk_1/do it twice
+/mnt/cdrom/marley-songs_of_freedom/disk_1/don't rock the boat
+/mnt/cdrom/marley-songs_of_freedom/disk_1/duppy conqueror
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hammer
+/mnt/cdrom/marley-songs_of_freedom/disk_1/hypocrites
+/mnt/cdrom/marley-songs_of_freedom/disk_1/i'm still waiting
+/mnt/cdrom/marley-songs_of_freedom/disk_1/judge not
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mellow mood
+/mnt/cdrom/marley-songs_of_freedom/disk_1/mr brown
+/mnt/cdrom/marley-songs_of_freedom/disk_1/nice time
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one cup of coffee
+/mnt/cdrom/marley-songs_of_freedom/disk_1/one love_people get ready
+/mnt/cdrom/marley-songs_of_freedom/disk_1/put it on
+/mnt/cdrom/marley-songs_of_freedom/disk_1/simmer down
+/mnt/cdrom/marley-songs_of_freedom/disk_1/small axe
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul rebel
+/mnt/cdrom/marley-songs_of_freedom/disk_1/soul shake down party
+/mnt/cdrom/marley-songs_of_freedom/disk_1/stir it up (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_1/sun is shining
+/mnt/cdrom/marley-songs_of_freedom/disk_1/thank you lord (original)
+/mnt/cdrom/marley-songs_of_freedom/disk_2/acoustic medley
+/mnt/cdrom/marley-songs_of_freedom/disk_2/burnin' and lootin'
+/mnt/cdrom/marley-songs_of_freedom/disk_2/concrete jungle
+/mnt/cdrom/marley-songs_of_freedom/disk_2/craven choke puppy
+/mnt/cdrom/marley-songs_of_freedom/disk_2/get up stand up
+/mnt/cdrom/marley-songs_of_freedom/disk_2/guava jelly
+/mnt/cdrom/marley-songs_of_freedom/disk_2/high tide or low tide
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i shot the sheriff
+/mnt/cdrom/marley-songs_of_freedom/disk_2/i'm hurting inside
+/mnt/cdrom/marley-songs_of_freedom/disk_2/iron lion zion
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lick samba
+/mnt/cdrom/marley-songs_of_freedom/disk_2/lively up yourself
+/mnt/cdrom/marley-songs_of_freedom/disk_2/natty dread
+/mnt/cdrom/marley-songs_of_freedom/disk_2/no more trouble
+/mnt/cdrom/marley-songs_of_freedom/disk_2/rastaman chant
+/mnt/cdrom/marley-songs_of_freedom/disk_2/screw face
+/mnt/cdrom/marley-songs_of_freedom/disk_2/slave driver
+/mnt/cdrom/marley-songs_of_freedom/disk_2/trenchtown rock
+/mnt/cdrom/marley-songs_of_freedom/disk_4/africa unite
+/mnt/cdrom/marley-songs_of_freedom/disk_4/babylon system
+/mnt/cdrom/marley-songs_of_freedom/disk_4/bad card
+/mnt/cdrom/marley-songs_of_freedom/disk_4/coming in from the cold (12
+/mnt/cdrom/marley-songs_of_freedom/disk_4/could you be loved (12 mix
+/mnt/cdrom/marley-songs_of_freedom/disk_4/forever loving jah
+/mnt/cdrom/marley-songs_of_freedom/disk_4/give thanks and praise
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one drop
+/mnt/cdrom/marley-songs_of_freedom/disk_4/one dub
+/mnt/cdrom/marley-songs_of_freedom/disk_4/rastaman live up
+/mnt/cdrom/marley-songs_of_freedom/disk_4/real situation
+/mnt/cdrom/marley-songs_of_freedom/disk_4/redemption song (live in pi
+/mnt/cdrom/marley-songs_of_freedom/disk_4/ride natty ride (12 mix)
+/mnt/cdrom/marley-songs_of_freedom/disk_4/so much trouble in the worl
+/mnt/cdrom/marley-songs_of_freedom/disk_4/survival
+/mnt/cdrom/marley-songs_of_freedom/disk_4/why should i (previously un
+/mnt/cdrom/marley-songs_of_freedom/disk_4/zimbabwe
+
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_01_pandemonium
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_02_sync_disjecta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_03_object_unknown
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_04_it's_nice_not
+/mnt/cdrom/dj_spooky_rid-2dim_warefare/djspooky_05_dialectical_tra
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_06_post-human_soph
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_07_quilombo_ex
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_08_rekonstruction
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_09_scientifik
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_10_a_conversation
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_11_peace_in_zaire
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_13_degree_zero
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_14_roman_planeta
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_15_bass_digitalis
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_16_polyphony_of
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_17_riddim_warfare
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_18_the_nerd
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_20_theme_of_the
+/mnt/cdrom/dj_spooky_riddim_warefare/djspooky_21_twilight_fugue
+
+/mnt/cdrom/stuff_smith_mosaic/disk3/01_desert_sands
+/mnt/cdrom/stuff_smith_mosaic/disk3/02_soft_winds
+/mnt/cdrom/stuff_smith_mosaic/disk3/03_time_and_again
+/mnt/cdrom/stuff_smith_mosaic/disk3/04_it_don't_mean_a_thing
+/mnt/cdrom/stuff_smith_mosaic/disk3/05_in_a_mellotone
+/mnt/cdrom/stuff_smith_mosaic/disk3/06_i_know_that_you_know
+/mnt/cdrom/stuff_smith_mosaic/disk3/07_heat_wave
+/mnt/cdrom/stuff_smith_mosaic/disk3/08_things_ain't_what_they_used_to_be
+/mnt/cdrom/stuff_smith_mosaic/disk3/09_body_and_soul
+
+So I take a break, wander down to the park to stand, then lean into
+the concrete railing demarking the beginnings of space, oceanic
+space. I watch the waves break, and form, and ease back out to sea and
+wrap my arms around myself and hug tightly because it's early in the
+morning and windy, and the sun is late getting out of bed today, which
+is good because if there was brilliant light illuminating all the
+beauty around me I would be shocked, stunned, forced to retreat back
+into my cabana in a daze, blinded by hummingbirds and callilillies and
+un-named red, yellow, and blue flowers. Green envelopes me, waves
+sooth me. I can see the wind flip the top of the waves seaward, right
+before they break. The sea seems so calm from my perch above the fray
+that I wonder if maybe there is just some part of the deepest, most
+abstract ocean where there is a large creature who happily chews
+plankton and wags its tail in gentle, adulating waves that spread and
+move and gracefully glide thousands of miles, to crash upon a beach,
+one after the other, politely waiting for a turn to dance with the
+seashore.
+
+I know: it is what the Mexican schoolchildren call "la vibora de la
+mer," the serpent of the sea.
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc b/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc
new file mode 100644
index 000000000000..cbe99ede2cc9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc
@@ -0,0 +1,100 @@
+// 1999-08-16 bkoz
+// 1999-11-01 bkoz
+
+// Copyright (C) 1999 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.
+
+// 27.6.2.5.4 basic_ostream character inserters
+
+#include <ostream>
+#include <sstream>
+#include <fstream>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+const int size = 1000;
+const char name_01[] = "testsuite/ostream_inserter_other-1.tst";
+const char name_02[] = "testsuite/ostream_inserter_other-1.txt";
+const char name_03[] = "testsuite/ostream_inserter_other-2.tst";
+const char name_04[] = "testsuite/ostream_inserter_other-2.txt";
+
+
+// stringstream
+bool test01() {
+ bool test = true;
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+// fstream
+bool test02() {
+ typedef std::ios_base::iostate iostate;
+ bool test = true;
+
+ // basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type* __sb)
+ // filebuf-> NULL
+ std::ifstream f_in1(name_01);
+ std::ofstream f_out1(name_02);
+ std::stringbuf* strbuf01 = NULL;
+ iostate state01 = f_in1.rdstate();
+ f_in1 >> strbuf01;
+ iostate state02 = f_in1.rdstate();
+ test &= state01 != state02;
+ test &= (state02 & std::ios_base::failbit) != 0;
+ state01 = f_out1.rdstate();
+ f_out1 << strbuf01;
+ state02 = f_out1.rdstate();
+ test &= state01 != state02;
+ test &= (state02 & std::ios_base::failbit) != 0;
+
+ // filebuf->filebuf
+ std::ifstream f_in(name_01);
+ std::ofstream f_out(name_02);
+ f_out << f_in.rdbuf();
+ f_in.close();
+ f_out.close();
+
+ // filebuf->stringbuf->filebuf
+ std::ifstream f_in2(name_03);
+ std::ofstream f_out2(name_04); // should be different name
+ std::stringbuf strbuf02;
+ f_in2 >> &strbuf02;
+ f_out2 << &strbuf02;
+ f_in2.close();
+ f_out2.close();
+
+ // no characters inserted
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+ test02();
+
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream_manip.cc b/libstdc++-v3/testsuite/27_io/ostream_manip.cc
new file mode 100644
index 000000000000..c8b9f941a44f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_manip.cc
@@ -0,0 +1,92 @@
+// 1999-07-22 bkoz
+
+// Copyright (C) 1994, 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.
+
+// 27.6.2.7 standard basic_ostream manipulators
+
+#include <istream>
+#include <sstream>
+#include <stdexcept>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+bool test01(void)
+{
+ bool test = true;
+
+ const char str_lit01[] = " venice ";
+ const std::string str01(" santa barbara ");
+ std::string str02(str_lit01);
+ std::string str04;
+ std::string str05;
+ std::ios_base::iostate flag1, flag2, flag3, flag4, flag5;
+
+ // template<_CharT, _Traits>
+ // basic_ostream<_CharT, _Traits>& endl(basic_ostream<_Char, _Traits>& os)
+ std::ostringstream oss01(str01);
+ std::ostringstream oss02;
+ std::ostringstream::int_type i01, i02;
+ typedef std::ostringstream::traits_type traits_type;
+
+ oss01 << std::endl;
+ str04 = oss01.str();
+ test &= str04.size() == str01.size();
+
+ oss02 << std::endl;
+ str05 = oss02.str();
+ test &= str05.size() == 1;
+
+ // template<_CharT, _Traits>
+ // basic_ostream<_CharT, _Traits>& ends(basic_ostream<_Char, _Traits>& os)
+ oss01 << std::ends;
+ str04 = oss01.str();
+ test &= str04.size() == str01.size();
+ test &= str04[1] == char();
+
+ oss02 << std::ends;
+ str05 = oss02.str();
+ test &= str05.size() == 2;
+ test &= str05[1] == char();
+
+ // template<_CharT, _Traits>
+ // basic_ostream<_CharT, _Traits>& flush(basic_ostream<_Char, _Traits>& os)
+ oss01.flush();
+ str04 = oss01.str();
+ test &= str04.size() == str01.size();
+
+ oss02.flush();
+ str05 = oss02.str();
+ test &= str05.size() == 2;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
+ test01();
+}
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/ostream_unformatted.cc b/libstdc++-v3/testsuite/27_io/ostream_unformatted.cc
new file mode 100644
index 000000000000..e3d1693cc16b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ostream_unformatted.cc
@@ -0,0 +1,55 @@
+// 2000-03-23 bkoz
+
+// Copyright (C) 2000 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,
+//
+
+#include <sstream>
+#include <ostream>
+#ifdef DEBUG_ASSERT
+ #include <assert.h>
+#endif
+
+
+void test01()
+{
+ using namespace std;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+ bool test = true;
+
+ // tellp
+ ostringstream ost;
+ pos_type pos1;
+ pos1 = ost.tellp();
+ test &= pos1 == pos_type(-1);
+ ost << "RZA ";
+ pos1 = ost.tellp();
+ test &= pos1 == pos_type(4);
+ ost << "ghost dog: way of the samurai";
+ pos1 = ost.tellp();
+ test &= pos1 == pos_type(33);
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+int main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/27_io/streambuf.cc b/libstdc++-v3/testsuite/27_io/streambuf.cc
new file mode 100644
index 000000000000..bdd4f16b0588
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/streambuf.cc
@@ -0,0 +1,257 @@
+// 1999-10-11 bkoz
+
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.5.2 template class basic_streambuf
+
+#include <streambuf>
+#include <ostream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+class testbuf : public std::streambuf
+{
+public:
+
+ // Typedefs:
+ typedef std::streambuf::traits_type traits_type;
+ typedef std::streambuf::char_type char_type;
+
+ testbuf(): std::streambuf()
+ { _M_mode = (std::ios_base::in | std::ios_base::out); }
+
+ bool
+ check_pointers()
+ {
+ bool test = true;
+ test &= this->eback() == NULL;
+ test &= this->gptr() == NULL;
+ test &= this->egptr() == NULL;
+ test &= this->pbase() == NULL;
+ test &= this->pptr() == NULL;
+ test &= this->epptr() == NULL;
+ return test;
+ }
+
+ int_type
+ pub_uflow()
+ { return (this->uflow()); }
+
+ int_type
+ pub_overflow(int_type __c = traits_type::eof())
+ { return (this->overflow(__c)); }
+
+ int_type
+ pub_pbackfail(int_type __c)
+ { return (this->pbackfail(__c)); }
+
+ void
+ pub_setg(char* beg, char* cur, char *end)
+ { this->setg(beg, cur, end); }
+
+ void
+ pub_setp(char* beg, char* end)
+ { this->setp(beg, end); }
+
+protected:
+ int_type
+ underflow()
+ {
+ int_type __retval = traits_type::eof();
+ if (this->gptr() < this->egptr())
+ __retval = traits_type::not_eof(0);
+ return __retval;
+ }
+};
+
+void test01()
+{
+ typedef testbuf::traits_type traits_type;
+ typedef testbuf::int_type int_type;
+
+ bool test = true;
+ char* lit01 = "chicago underground trio/possible cube on delmark";
+ testbuf buf01;
+
+ // 27.5.2.1 basic_streambuf ctors
+ // default ctor initializes
+ // - all pointer members to null pointers
+ // - locale to current global locale
+ test &= buf01.check_pointers();
+ test &= buf01.getloc() == std::locale();
+
+ // 27.5.2.3.1 get area
+ // 27.5.2.2.3 get area
+ // 27.5.2.4.3 get area
+ int i01 = 3;
+ buf01.pub_setg(lit01, lit01, (lit01 + i01));
+ test &= i01 == buf01.in_avail();
+
+ test &= buf01.pub_uflow() == lit01[0];
+ test &= buf01.sgetc() == traits_type::to_int_type(lit01[1]);
+ test &= buf01.pub_uflow() == lit01[1];
+ test &= buf01.sgetc() == traits_type::to_int_type(lit01[2]);
+ test &= buf01.pub_uflow() == lit01[2];
+ test &= buf01.sgetc() == traits_type::eof();
+
+ // pbackfail
+ buf01.pub_setg(lit01, lit01, (lit01 + i01));
+ test &= i01 == buf01.in_avail();
+ int_type intt01 = traits_type::to_int_type('b');
+ test &= traits_type::eof() == buf01.pub_pbackfail(intt01);
+
+ // overflow
+ test &= traits_type::eof() == buf01.pub_overflow(intt01);
+ test &= traits_type::eof() == buf01.pub_overflow();
+ test &= buf01.sgetc() == traits_type::to_int_type(lit01[0]);
+
+ // sputn/xsputn
+ char* lit02 = "isotope 217: the unstable molecule on thrill jockey";
+ int i02 = strlen(lit02);
+ char carray[i02 + 1];
+ memset(carray, 0, i02 + 1);
+
+ buf01.pub_setp(carray, (carray + i02));
+ buf01.sputn(lit02, 0);
+ test &= carray[0] == 0;
+ test &= lit02[0] == 'i';
+ buf01.sputn(lit02, 1);
+ test &= lit02[0] == carray[0];
+ test &= lit02[1] == 's';
+ test &= carray[1] == 0;
+ buf01.sputn(lit02 + 1, 10);
+ test &= memcmp(lit02, carray, 10) == 0;
+ buf01.sputn(lit02 + 11, 20);
+ test &= memcmp(lit02, carray, 30) == 0;
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+void test02()
+{
+ typedef testbuf::traits_type traits_type;
+ typedef testbuf::int_type int_type;
+
+ bool test = true;
+ char* lit01 = "chicago underground trio/possible cube on delmark";
+ testbuf buf01;
+
+ // 27.5.2.1 basic_streambuf ctors
+ // default ctor initializes
+ // - all pointer members to null pointers
+ // - locale to current global locale
+ test &= buf01.check_pointers();
+ test &= buf01.getloc() == std::locale();
+
+ // 27.5.2.2.5 Put area
+ size_t i01 = traits_type::length(lit01);
+ char carray01[i01];
+ memset(carray01, 0, i01);
+
+ buf01.pub_setg(lit01, lit01, lit01 + i01);
+ buf01.sgetn(carray01, 0);
+ test &= carray01[0] == 0;
+ buf01.sgetn(carray01, 1);
+ test &= carray01[0] == 'c';
+ buf01.sgetn(carray01 + 1, i01 - 1);
+ test &= carray01[0] == 'c';
+ test &= carray01[1] == 'h';
+ test &= carray01[i01 - 1] == 'k';
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+// test03
+// http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00151.html
+template<typename charT, typename traits = std::char_traits<charT> >
+ class basic_nullbuf : public std::basic_streambuf<charT, traits>
+ {
+ protected:
+ virtual int_type
+ overflow(int_type c)
+ { return traits::not_eof(c); }
+ };
+
+typedef basic_nullbuf<char> nullbuf;
+typedef basic_nullbuf<wchar_t> wnullbuf;
+
+template<typename T>
+ char
+ print(const T& x)
+ {
+ nullbuf ob;
+ std::ostream out(&ob);
+ out << x << std::endl;
+ return (!out ? '0' : '1');
+ }
+
+void test03()
+{
+ bool test = true;
+ const std::string control01("11111");
+ std::string test01;
+
+ test01 += print(true);
+ test01 += print(3.14159);
+ test01 += print(10);
+ test01 += print('x');
+ test01 += print("pipo");
+
+ test &= test01 == control01;
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+
+ return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/stringbuf.cc b/libstdc++-v3/testsuite/27_io/stringbuf.cc
new file mode 100644
index 000000000000..5660677b82d2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/stringbuf.cc
@@ -0,0 +1,452 @@
+// 981208 bkoz test functionality of basic_stringbuf for char_type == char
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <sstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+std::string str_01("mykonos. . . or what?");
+std::string str_02("paris, or sainte-maxime?");
+std::string str_03;
+std::stringbuf strb_01(str_01);
+std::stringbuf strb_02(str_02, std::ios_base::in);
+std::stringbuf strb_03(str_03, std::ios_base::out);
+
+
+// test the underlying allocator
+bool test01() {
+ bool test = false;
+ std::allocator<char> alloc_01;
+ std::allocator<char>::size_type size_01 = alloc_01.max_size();
+ std::allocator<char>::pointer p_01 = alloc_01.allocate(32);
+
+ return true;
+}
+
+
+// test the streambuf/stringbuf locale settings
+bool test02() {
+ std::locale loc_tmp;
+ loc_tmp = strb_01.getloc();
+ strb_01.pubimbue(loc_tmp); //This should initialize _M_init to true
+ strb_01.getloc(); //This should just return _M_locale
+
+ return true;
+}
+
+
+// test member functions
+bool test03() {
+ bool test = true;
+ std::string str_tmp;
+
+ //stringbuf::str()
+ test &= strb_01.str() == str_01;
+ test &= strb_02.str() == str_02;
+ test &= strb_03.str() == str_03;
+
+ //stringbuf::str(string&)
+ strb_03.str("none of the above, go to the oberoi in cairo, egypt.");
+ strb_03.str(str_01);
+ std::streamsize d1 = strb_01.in_avail();
+ std::streamsize d2 = strb_03.in_avail();
+ test &= d1; // non-zero
+ test &= !d2; // zero, cuz ios_base::out
+ test &= d1 != d2; //these should be the same
+ test &= str_01.length() == d1;
+ test &= strb_01.str() == strb_03.str(); //ditto
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+// test overloaded virtual functions
+bool test04() {
+ bool test = true;
+ std::string str_tmp;
+ std::stringbuf strb_tmp;
+ std::streamsize strmsz_1, strmsz_2;
+ std::streamoff strmof_1(-1), strmof_2;
+ typedef std::stringbuf::int_type int_type;
+ typedef std::stringbuf::traits_type traits_type;
+ typedef std::stringbuf::pos_type pos_type;
+ typedef std::stringbuf::off_type off_type;
+
+ // GET
+ // int in_avail()
+ strmof_1 = strb_01.in_avail();
+ strmof_2 = strb_02.in_avail();
+ test &= strmof_1 != strmof_2;
+ test &= strmof_1 == str_01.length();
+ test &= strmof_2 == str_02.length();
+ strmof_1 = strb_03.in_avail();
+ test &= strmof_1 == 0; // zero cuz write-only, or eof()? zero, from showmany
+
+ // int_type sbumpc()
+ // if read_cur not avail, return uflow(), else return *read_cur & increment
+ int_type c1 = strb_01.sbumpc();
+ int_type c2 = strb_02.sbumpc();
+ test &= c1 != c2;
+ test &= c1 == str_01[0];
+ test &= c2 == str_02[0]; //should equal first letter at this point
+ int_type c3 = strb_01.sbumpc();
+ int_type c4 = strb_02.sbumpc();
+ test &= c1 != c2;
+ test &= c1 != c3;
+ test &= c2 != c4;
+ int_type c5 = strb_03.sbumpc();
+ test &= c5 == traits_type::eof();
+
+ // int_type sgetc()
+ // if read_cur not avail, return uflow(), else return *read_cur
+ int_type c6 = strb_01.sgetc();
+ int_type c7 = strb_02.sgetc();
+ test &= c6 != c3;
+ test &= c7 != c4;
+ int_type c8 = strb_01.sgetc();
+ int_type c9 = strb_02.sgetc();
+ test &= c6 == c8;
+ test &= c7 == c9;
+ c5 = strb_03.sgetc();
+ test &= c5 == traits_type::eof();
+
+ // int_type snextc()
+ // calls sbumpc and if sbumpc != eof, return sgetc
+ c6 = strb_01.snextc();
+ c7 = strb_02.snextc();
+ test &= c6 != c8;
+ test &= c7 != c9;
+ test &= c6 == str_01[3];
+ test &= c7 == str_02[3]; //should equal fourth letter at this point
+ c5 = strb_03.snextc();
+ test &= c5 == traits_type::eof();
+
+ // int showmanyc
+ // streamsize sgetn(char_type *s, streamsize n)
+ // streamsize xsgetn(char_type *s, streamsize n)
+ // assign up to n chars to s from input sequence, indexing in_cur as
+ // approp and returning the number of chars assigned
+ strmsz_1 = strb_01.in_avail();
+ strmsz_2 = strb_02.in_avail();
+ test = strmsz_1 != strmsz_2;
+ test &= strmsz_1 != str_01.length();
+ test &= strmsz_2 != str_02.length(); //because now we've moved into string
+ char carray1[11] = "";
+ strmsz_1 = strb_01.sgetn(carray1, 10);
+ char carray2[20] = "";
+ strmsz_2 = strb_02.sgetn(carray2, 10);
+ test &= strmsz_1 == strmsz_2;
+ test &= strmsz_1 == 10;
+ c1 = strb_01.sgetc();
+ c2 = strb_02.sgetc();
+ test &= c6 == c1; //just by co-incidence both o's
+ test &= c7 != c2; // n != i
+ test &= c1 == str_01[13];
+ test &= c2 == str_02[13]; //should equal fourteenth letter at this point
+ strmsz_1 = strb_03.sgetn(carray1, 10);
+ test &= !strmsz_1; //zero
+ strmsz_1 = strb_02.in_avail();
+ strmsz_2 = strb_02.sgetn(carray2, strmsz_1 + 5);
+ test &= strmsz_1 == strmsz_2; //write off the end
+ c4 = strb_02.sgetc(); // should be EOF
+ test &= c4 == traits_type::eof();
+
+ // PUT
+ // int_type sputc(char_type c)
+ // if out_cur not avail, return overflow. Else, stores c at out_cur,
+ // increments out_cur, and returns c as int_type
+ strb_03.str(str_01); //reset
+ std::string::size_type sz1 = strb_03.str().length();
+ c1 = strb_03.sputc('a');
+ std::string::size_type sz2 = strb_03.str().length();
+ test &= sz1 == sz2; //cuz inserting at out_cur, which is at beg to start
+ c2 = strb_03.sputc('b');
+ test &= c1 != c2;
+ test &= strb_03.str() != str_01;
+ c3 = strb_02.sputc('a'); // should be EOF because this is read-only
+ test &= c3 == traits_type::eof();
+
+ // streamsize sputn(const char_typs* s, streamsize n)
+ // write up to n chars to out_cur from s, returning number assigned
+ // NB *sputn will happily put '\0' into your stream if you give it a chance*
+ str_tmp = strb_03.str();
+ sz1 = str_tmp.length();
+ strmsz_1 = strb_03.sputn("racadabras", 10);//"abracadabras or what?"
+ sz2 = strb_03.str().length();
+ test &= sz1 == sz2; //shouldn't have changed length
+ test &= strmsz_1 == 10;
+ test &= str_tmp != strb_03.str();
+ strmsz_2 = strb_03.sputn(", i wanna reach out and", 10);
+ test &= strmsz_1 == strmsz_2; // should re-allocate, copy 10 chars.
+ test &= strmsz_1 == 10;
+ test &= strmsz_2 == 10;
+ sz2 = strb_03.str().length();
+ test &= sz1 != sz2; // need to change length
+ test &= str_tmp != strb_03.str();
+ str_tmp = strb_02.str();
+ strmsz_1 = strb_02.sputn("racadabra", 10);
+ test &= strmsz_1 == 0;
+ test &= str_tmp == strb_02.str();
+
+ // PUTBACK
+ // int_type pbfail(int_type c)
+ // called when gptr() null, gptr() == eback(), or traits::eq(*gptr, c) false
+ // "pending sequence" is:
+ // 1) everything as defined in underflow
+ // 2) + if (traits::eq_int_type(c, traits::eof()), then input
+ // sequence is backed up one char before the pending sequence is
+ // determined.
+ // 3) + if (not 2) then c is prepended. Left unspecified is
+ // whether the input sequence is backedup or modified in any way
+ // returns traits::eof() for failure, unspecified other value for success
+
+ // int_type sputbackc(char_type c)
+ // if in_cur not avail || ! traits::eq(c, gptr() [-1]), return pbfail
+ // otherwise decrements in_cur and returns *gptr()
+ strmsz_1 = strb_01.in_avail();
+ str_tmp = strb_01.str();
+ c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
+ c2 = strb_01.sputbackc('z');//"mykonos. . .zor what?"
+ c3 = strb_01.sgetc();
+ test &= c1 != c2;
+ test &= c3 == c2;
+ test &= strb_01.str() == std::string("mykonos. . .zor what?");
+ test &= str_tmp.size() == strb_01.str().size();
+ //test for _in_cur == _in_beg
+ strb_01.str(str_tmp);
+ strmsz_1 = strb_01.in_avail();
+ c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
+ c2 = strb_01.sputbackc('z');//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ test &= c1 != c2;
+ test &= c3 != c2;
+ test &= c1 == c3;
+ test &= c2 == traits_type::eof();
+ test &= strb_01.str() == str_tmp;
+ test &= str_tmp.size() == strb_01.str().size();
+ // test for replacing char with identical one
+ strb_01.str(str_01); //reset
+ strmsz_1 = strb_01.in_avail();
+ strb_01.sbumpc();
+ strb_01.sbumpc();
+ c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
+ c2 = strb_01.sputbackc('y');//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ test &= c1 != c2;
+ test &= c3 == c2;
+ test &= c1 != c3;
+ test &= strb_01.str() == str_01;
+ test &= str_01.size() == strb_01.str().size();
+ //test for ios_base::out
+ strmsz_2 = strb_03.in_avail();
+ c4 = strb_03.sputbackc('x');
+ test &= c4 == traits_type::eof();
+
+ // int_type sungetc()
+ // if in_cur not avail, return pbackfail(), else decrement and
+ // return to_int_type(*gptr())
+ for (int i = 0; i<12; ++i)
+ strb_01.sbumpc();
+ strmsz_1 = strb_01.in_avail();
+ str_tmp = strb_01.str();
+ c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
+ c2 = strb_01.sungetc();//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ test &= c1 != c2;
+ test &= c3 == c2;
+ test &= c1 != c3;
+ test &= c2 == ' ';
+ test &= strb_01.str() == str_01;
+ test &= str_01.size() == strb_01.str().size();
+ //test for _in_cur == _in_beg
+ strb_01.str(str_tmp);
+ strmsz_1 = strb_01.in_avail();
+ c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
+ c2 = strb_01.sungetc();//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ test &= c1 != c2;
+ test &= c3 != c2;
+ test &= c1 == c3;
+ test &= c2 == traits_type::eof();
+ test &= strb_01.str() == str_01;
+ test &= str_01.size() == strb_01.str().size();
+ // test for replacing char with identical one
+ strb_01.str(str_01); //reset
+ strmsz_1 = strb_01.in_avail();
+ strb_01.sbumpc();
+ strb_01.sbumpc();
+ c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
+ c2 = strb_01.sungetc();//"mykonos. . . or what?"
+ c3 = strb_01.sgetc();
+ test &= c1 != c2;
+ test &= c3 == c2;
+ test &= c1 != c3;
+ test &= strb_01.str() == str_01;
+ test &= str_01.size() == strb_01.str().size();
+ //test for ios_base::out
+ strmsz_2 = strb_03.in_avail();
+ c4 = strb_03.sungetc();
+ test &= c4 == traits_type::eof();
+
+ // BUFFER MANAGEMENT & POSITIONING
+ // sync
+ // pubsync
+ strb_01.pubsync();
+ strb_02.pubsync();
+ strb_03.pubsync();
+
+ // setbuf
+ // pubsetbuf(char_type* s, streamsize n)
+ str_tmp = std::string("naaaah, go to cebu");
+ strb_01.pubsetbuf(const_cast<char*> (str_tmp.c_str()), str_tmp.size());
+ test &= strb_01.str() == str_tmp;
+ strb_01.pubsetbuf(0,0);
+ test &= strb_01.str() == str_tmp;
+
+ // seekoff
+ // pubseekoff(off_type off, ios_base::seekdir way, ios_base::openmode which)
+ // alters the stream position to off
+ pos_type pt_1(off_type(-1));
+ pos_type pt_2(off_type(0));
+ off_type off_1 = 0;
+ off_type off_2 = 0;
+ strb_01.str(str_01); //in|out ("mykonos. . . or what?");
+ strb_02.str(str_02); //in ("paris, or sainte-maxime?");
+ strb_03.str(str_03); //out ("")
+ //IN|OUT
+ //beg
+ pt_1 = strb_01.pubseekoff(2, std::ios_base::beg);
+ off_1 = pt_1._M_position();
+ test &= off_1 >= 0;
+ c1 = strb_01.snextc(); //current in pointer +1
+ test &= c1 == 'o';
+ c2 = strb_01.sputc('x'); //test current out pointer
+ str_tmp = std::string("myxonos. . . or what?");
+ test &= strb_01.str() == str_tmp;
+ //cur
+ pt_1 = strb_01.pubseekoff(2, std::ios_base::cur);
+ off_1 = pt_1._M_position();
+ test &= off_1 == -1; // can't seekoff for in and out + cur in sstreams
+ pt_1 = strb_01.pubseekoff(2, std::ios_base::cur, std::ios_base::in);
+ off_1 = pt_1._M_position();
+ pt_2 = strb_01.pubseekoff(2, std::ios_base::cur, std::ios_base::in);
+ off_2 = pt_2._M_position();
+ test &= off_2 == off_1 + 2;
+ c1 = strb_01.snextc(); //current in pointer + 1
+ test &= c1 == ' ';
+ c2 = strb_01.sputc('x'); //test current out pointer
+ str_tmp = std::string("myxxnos. . . or what?");
+ test &= strb_01.str() == str_tmp;
+ //end
+ pt_2 = strb_01.pubseekoff(2, std::ios_base::end);
+ off_1 = pt_2._M_position();
+ test &= off_1 == -1; // not a valid position
+ test &= strb_01.str() == str_tmp;
+ // end part two (from the filebuf tests)
+ strb_01.pubseekoff(0, std::ios_base::end);
+ strmsz_1 = strb_01.in_avail(); // 0 cuz at the end
+ c1 = strb_01.sgetc();
+ c2 = strb_01.sungetc();
+ strmsz_2 = strb_01.in_avail(); // 1
+ c3 = strb_01.sgetc();
+ test &= c1 != c2;
+ test &= strmsz_2 != strmsz_1;
+ test &= strmsz_2 == 1;
+ // end part three
+ strmsz_1 = strb_01.str().size();
+ strmsz_2 = strb_01.sputn(" ravi shankar meets carlos santana in LoHa", 90);
+ strb_01.pubseekoff(0, std::ios_base::end);
+ strb_01.sputc('<');
+ str_tmp = strb_01.str();
+ test &= str_tmp.size() == strmsz_1 + strmsz_2 + 1;
+ // IN
+ // OUT
+
+ // seekpos
+ // pubseekpos(pos_type sp, ios_base::openmode)
+ // alters the stream position to sp
+ strb_01.str(str_01); //in|out ("mykonos. . . or what?");
+ strb_02.str(str_02); //in ("paris, or sainte-maxime?");
+ strb_03.str(str_03); //out ("")
+ //IN|OUT
+ //beg
+ pt_1 = strb_01.pubseekoff(2, std::ios_base::beg);
+ off_1 = pt_1._M_position();
+ test &= off_1 >= 0;
+ pt_1 = strb_01.pubseekoff(0, std::ios_base::cur, std::ios_base::out);
+ off_1 = pt_1._M_position();
+ c1 = strb_01.snextc(); //current in pointer +1
+ test &= c1 == 'o';
+ c2 = strb_01.sputc('x'); //test current out pointer
+ str_tmp = std::string("myxonos. . . or what?");
+ test &= strb_01.str() == str_tmp;
+ strb_01.pubsync(); //resets pointers
+ pt_2 = strb_01.pubseekpos(pt_1, std::ios_base::in|std::ios_base::out);
+ off_2 = pt_2._M_position();
+ test &= off_1 == off_2;
+ c3 = strb_01.snextc(); //current in pointer +1
+ test &= c1 == c3;
+ c2 = strb_01.sputc('x'); //test current out pointer
+ str_tmp = std::string("myxonos. . . or what?");
+ test &= strb_01.str() == str_tmp;
+
+ // VIRTUALS (indirectly tested)
+ // underflow
+ // if read position avail, returns *gptr()
+
+ // pbackfail(int_type c)
+ // put c back into input sequence
+
+ // overflow
+ // appends c to output seq
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
+int main() {
+
+ test01();
+ test02();
+ test03();
+ test04();
+
+ return 0;
+}
+
+
+
+// more candy!!!
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/stringstream.cc b/libstdc++-v3/testsuite/27_io/stringstream.cc
new file mode 100644
index 000000000000..5b77c6605029
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/stringstream.cc
@@ -0,0 +1,174 @@
+// 981015 bkoz
+// i,o,stringstream usage
+
+// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#include <vector>
+#include <string>
+#include <sstream>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+// 01: sanity checks for strings, stringbufs
+std::string test01()
+{
+ bool test = false;
+
+ // Empty string sanity check.
+ std::string str01;
+ std::string::iterator __i_start = str01.begin();
+ char* __p_start = __i_start.base();
+ std::string::iterator __i_end = str01.end();
+ char* __p_end = __i_end.base();
+ std::string::size_type len = str01.size();
+ test = __p_start == __p_end;
+ test &= len == 0;
+
+ // Full string sanity check.
+ std::string str02("these golden days, i spend waiting for you:\n
+ Betty Carter on Verve with I'm Yours and You're Mine.");
+ __i_start = str02.begin();
+ __p_start = __i_start.base();
+ __i_end = str02.end();
+ __p_end = __i_end.base();
+ len = str02.size();
+ test &= __p_start != __p_end;
+ test &= len != 0;
+
+ // Test an empty ostring stream for sanity.
+ std::ostringstream ostrstream0;
+ std::string str03 = ostrstream0.str();
+ __i_start = str03.begin();
+ __p_start = __i_start.base();
+ __i_end = str03.end();
+ __p_end = __i_end.base();
+ len = str03.size();
+ test &= __p_start == __p_end;
+ test &= len == 0;
+ test &= str01 == str03;
+
+ return str02;
+}
+
+
+bool test02(void) {
+
+ bool test = true;
+
+ //
+ // 1: Automatic formatting of a compound string
+ //
+ int i = 1024;
+ int *pi = &i;
+ double d = 3.14159;
+ double *pd = &d;
+ std::string blank;
+ std::ostringstream ostrst01;
+ std::ostringstream ostrst02(blank);
+
+ // No buffer, so nothing should be added.
+ ostrst01 << "i: " << i << " i's address: " << pi << "\n"
+ << "d: " << d << " d's address: " << pd << std::endl;
+ // Buffer, so this should be ok.
+ ostrst02 << "i: " << i << " i's address: " << pi << "\n"
+ << "d: " << d << " d's address: " << pd << std::endl;
+
+ std::string msg01 = ostrst01.str();
+ std::string msg02 = ostrst02.str();
+ test &= msg01 != msg02;
+ test &= msg02 != blank;
+
+ //
+ // 2: istringstream
+ //
+ // extracts the stored ascii values, placing them in turn in the four vars
+#if 0
+ int i2 = 0;
+ int *pi2 = &i2;
+ double d2 = 0.0;
+ double *pd2 = &d2;
+ std::istringstream istrst01(ostrst02.str());
+
+ istrst01 >> i2 >> pi2 >> d2 >> pd2;
+ //istrst01 >> i2;
+ //istrst01 >> pi2;
+ test &= i2 == i;
+ test &= d2 == d;
+ test &= pd2 == pd;
+ test &= pi2 == pi;
+#endif
+
+ // stringstream
+ std::string str1("");
+ std::string str3("this is a somewhat string");
+ std::stringstream ss1(str1, std::ios_base::in|std::ios_base::out);
+ std::stringstream ss2(str3, std::ios_base::in|std::ios_base::out);
+
+ return test;
+}
+
+// user-reported error
+class derived_oss: public std::ostringstream
+{
+public:
+ derived_oss() : std::ostringstream() {}
+};
+
+bool test03()
+{
+ bool test = true;
+ derived_oss yy;
+ yy << "buena vista social club\n";
+ test &= yy.str() == std::string("buena vista social club\n");
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/ext/headers.cc b/libstdc++-v3/testsuite/ext/headers.cc
new file mode 100644
index 000000000000..d596bf98b962
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/headers.cc
@@ -0,0 +1,33 @@
+// 1999-06-23 bkoz
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// extension headers
+
+// This should include a list of all headers in the extension
+// subdirectory that are meant to be directly included.
+
+#include <ext/bvector>
+#include <ext/hash_map>
+#include <ext/hash_set>
+#include <ext/rope>
+#include <ext/slist>
+#include <ext/tree>
+
+int main() { }
diff --git a/libstdc++-v3/testsuite/printnow.c b/libstdc++-v3/testsuite/printnow.c
new file mode 100644
index 000000000000..457605f3a518
--- /dev/null
+++ b/libstdc++-v3/testsuite/printnow.c
@@ -0,0 +1,13 @@
+/* Prints the current time_t to stdout. Equivalent to the
+ * nonstandard %s format option to GNU date(1).
+*/
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <time.h>
+
+int main ()
+{
+ printf ("%lu\n", time(NULL));
+ exit(0);
+}