From b91fc6da631b092e287e6918988a5fae5aa3e9af Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Tue, 3 May 2005 08:48:55 +0000 Subject: [PATCH] More spring-cleaning. --- contrib/libio/ChangeLog | 2807 ----------- contrib/libio/FREEBSD-upgrade | 22 - contrib/libio/Makefile.in | 137 - contrib/libio/NEWS | 57 - contrib/libio/PlotFile.cc | 157 - contrib/libio/PlotFile.h | 89 - contrib/libio/README | 30 - contrib/libio/SFile.cc | 82 - contrib/libio/SFile.h | 55 - contrib/libio/builtinbuf.cc | 78 - contrib/libio/builtinbuf.h | 68 - contrib/libio/cleanup.c | 17 - contrib/libio/config.shared | 499 -- contrib/libio/config/hpux.mt | 3 - contrib/libio/config/isc.mt | 4 - contrib/libio/config/linux.mt | 25 - contrib/libio/config/linuxaxp1-libc-lock.h | 112 - contrib/libio/config/linuxaxp1-stdio-lock.h | 36 - contrib/libio/config/linuxaxp1.mt | 10 - contrib/libio/config/linuxlibc1.mt | 26 - contrib/libio/config/mn10200.mt | 3 - contrib/libio/config/mtsafe.mt | 2 - contrib/libio/config/netware.mt | 16 - contrib/libio/config/sco4.mt | 3 - contrib/libio/configure.in | 199 - contrib/libio/dbz/Makefile.in | 218 - contrib/libio/dbz/README | 25 - contrib/libio/dbz/altbytes | 7 - contrib/libio/dbz/byteflip.c | 38 - contrib/libio/dbz/case.c | 129 - contrib/libio/dbz/case.h | 12 - contrib/libio/dbz/configure.in | 17 - contrib/libio/dbz/dbz.1 | 221 - contrib/libio/dbz/dbz.3z | 547 --- contrib/libio/dbz/dbz.c | 1768 ------- contrib/libio/dbz/dbz.h | 32 - contrib/libio/dbz/dbzmain.c | 519 -- contrib/libio/dbz/fake.c | 144 - contrib/libio/dbz/firstlast25 | 50 - contrib/libio/dbz/getmap | 6 - contrib/libio/dbz/random.c | 31 - contrib/libio/dbz/revbytes | 7 - contrib/libio/dbz/stdio.h | 1 - contrib/libio/depend | 379 -- contrib/libio/editbuf.cc | 717 --- contrib/libio/editbuf.h | 185 - contrib/libio/filebuf.cc | 223 - contrib/libio/filedoalloc.c | 107 - contrib/libio/fileops.c | 811 ---- contrib/libio/floatconv.c | 2375 --------- contrib/libio/floatio.h | 51 - contrib/libio/fstream.cc | 110 - contrib/libio/fstream.h | 92 - contrib/libio/gen-params | 739 --- contrib/libio/genops.c | 946 ---- contrib/libio/include/empty.h | 37 - contrib/libio/indstream.cc | 121 - contrib/libio/indstream.h | 77 - contrib/libio/ioassign.cc | 49 - contrib/libio/ioextend.cc | 132 - contrib/libio/iofclose.c | 60 - contrib/libio/iofdopen.c | 134 - contrib/libio/iofeof.c | 45 - contrib/libio/ioferror.c | 45 - contrib/libio/iofflush.c | 49 - contrib/libio/iofflush_u.c | 40 - contrib/libio/iofgetpos.c | 55 - contrib/libio/iofgets.c | 56 - contrib/libio/iofopen.c | 64 - contrib/libio/iofprintf.c | 51 - contrib/libio/iofputs.c | 49 - contrib/libio/iofread.c | 49 - contrib/libio/iofscanf.c | 48 - contrib/libio/iofsetpos.c | 56 - contrib/libio/ioftell.c | 53 - contrib/libio/iofwrite.c | 54 - contrib/libio/iogetc.c | 50 - contrib/libio/iogetdelim.c | 125 - contrib/libio/iogetline.c | 112 - contrib/libio/iogets.c | 71 - contrib/libio/ioignore.c | 47 - contrib/libio/iolibio.h | 67 - contrib/libio/iomanip.cc | 90 - contrib/libio/iomanip.h | 180 - contrib/libio/iopadn.c | 70 - contrib/libio/ioperror.c | 22 - contrib/libio/iopopen.c | 248 - contrib/libio/ioprims.c | 80 - contrib/libio/ioprintf.c | 47 - contrib/libio/ioputc.c | 44 - contrib/libio/ioputs.c | 49 - contrib/libio/ioscanf.c | 47 - contrib/libio/ioseekoff.c | 54 - contrib/libio/ioseekpos.c | 48 - contrib/libio/iosetbuffer.c | 46 - contrib/libio/iosetvbuf.c | 100 - contrib/libio/iosprintf.c | 50 - contrib/libio/iosscanf.c | 47 - contrib/libio/iostdio.h | 114 - contrib/libio/iostream.cc | 1049 ---- contrib/libio/iostream.h | 273 -- contrib/libio/iostream.texi | 1971 -------- contrib/libio/iostreamP.h | 26 - contrib/libio/iostrerror.c | 12 - contrib/libio/ioungetc.c | 46 - contrib/libio/iovfprintf.c | 890 ---- contrib/libio/iovfscanf.c | 790 --- contrib/libio/iovsprintf.c | 60 - contrib/libio/iovsscanf.c | 59 - contrib/libio/isgetline.cc | 153 - contrib/libio/isgetsb.cc | 63 - contrib/libio/isscan.cc | 55 - contrib/libio/istream.h | 25 - contrib/libio/libio.h | 365 -- contrib/libio/libioP.h | 648 --- contrib/libio/osform.cc | 66 - contrib/libio/ostream.h | 25 - contrib/libio/outfloat.c | 211 - contrib/libio/parsestream.cc | 317 -- contrib/libio/parsestream.h | 156 - contrib/libio/peekc.c | 42 - contrib/libio/pfstream.cc | 92 - contrib/libio/pfstream.h | 59 - contrib/libio/procbuf.cc | 54 - contrib/libio/procbuf.h | 50 - contrib/libio/sbform.cc | 40 - contrib/libio/sbgetline.cc | 31 - contrib/libio/sbscan.cc | 45 - contrib/libio/stdfiles.c | 51 - contrib/libio/stdio/ChangeLog | 153 - contrib/libio/stdio/Makefile.in | 35 - contrib/libio/stdio/clearerr.c | 30 - contrib/libio/stdio/clearerr_u.c | 28 - contrib/libio/stdio/configure.in | 49 - contrib/libio/stdio/fdopen.c | 9 - contrib/libio/stdio/feof.c | 43 - contrib/libio/stdio/feof_u.c | 37 - contrib/libio/stdio/ferror.c | 43 - contrib/libio/stdio/ferror_u.c | 37 - contrib/libio/stdio/fgetc.c | 40 - contrib/libio/stdio/fileno.c | 49 - contrib/libio/stdio/fputc.c | 41 - contrib/libio/stdio/fputc_u.c | 38 - contrib/libio/stdio/freopen.c | 44 - contrib/libio/stdio/fseek.c | 42 - contrib/libio/stdio/getc.c | 48 - contrib/libio/stdio/getc_u.c | 37 - contrib/libio/stdio/getchar.c | 40 - contrib/libio/stdio/getchar_u.c | 35 - contrib/libio/stdio/getline.c | 13 - contrib/libio/stdio/getw.c | 13 - contrib/libio/stdio/obprintf.c | 168 - contrib/libio/stdio/popen.c | 23 - contrib/libio/stdio/putc.c | 42 - contrib/libio/stdio/putc_u.c | 31 - contrib/libio/stdio/putchar.c | 35 - contrib/libio/stdio/putchar_u.c | 30 - contrib/libio/stdio/putw.c | 15 - contrib/libio/stdio/rewind.c | 38 - contrib/libio/stdio/setbuf.c | 35 - contrib/libio/stdio/setfileno.c | 17 - contrib/libio/stdio/setlinebuf.c | 36 - contrib/libio/stdio/snprintf.c | 51 - contrib/libio/stdio/stdio.h | 219 - contrib/libio/stdio/vasprintf.c | 72 - contrib/libio/stdio/vfprintf.c | 35 - contrib/libio/stdio/vfscanf.c | 36 - contrib/libio/stdio/vprintf.c | 33 - contrib/libio/stdio/vscanf.c | 41 - contrib/libio/stdio/vsnprintf.c | 136 - contrib/libio/stdiostream.cc | 159 - contrib/libio/stdiostream.h | 79 - contrib/libio/stdstrbufs.cc | 126 - contrib/libio/stdstreams.cc | 153 - contrib/libio/stream.cc | 170 - contrib/libio/stream.h | 59 - contrib/libio/streambuf.cc | 364 -- contrib/libio/streambuf.h | 490 -- contrib/libio/strfile.h | 71 - contrib/libio/strops.c | 303 -- contrib/libio/strstream.cc | 116 - contrib/libio/strstream.h | 113 - contrib/libio/tests/ChangeLog | 166 - contrib/libio/tests/Makefile.in | 196 - contrib/libio/tests/configure.in | 36 - contrib/libio/tests/hounddog.cc | 85 - contrib/libio/tests/hounddog.exp | 7 - contrib/libio/tests/hounddog.inp | 7 - contrib/libio/tests/putbackdog.cc | 97 - contrib/libio/tests/tFile.cc | 558 --- contrib/libio/tests/tFile.exp | 75 - contrib/libio/tests/tFile.inp | 5 - contrib/libio/tests/tfformat.c | 4181 ---------------- contrib/libio/tests/tiformat.c | 5112 -------------------- contrib/libio/tests/tiomanip.cc | 35 - contrib/libio/tests/tiomanip.exp | 4 - contrib/libio/tests/tiomisc.cc | 236 - contrib/libio/tests/tiomisc.exp | 11 - contrib/libio/tests/tstdiomisc.c | 43 - contrib/libio/tests/tstdiomisc.exp | 8 - contrib/libio/testsuite/ChangeLog | 99 - contrib/libio/testsuite/Makefile.in | 90 - contrib/libio/testsuite/config/default.exp | 1 - contrib/libio/testsuite/configure.in | 22 - contrib/libio/testsuite/lib/libio.exp | 167 - contrib/libio/testsuite/libio.tests/hounddog.exp | 3 - contrib/libio/testsuite/libio.tests/putbackdog.exp | 3 - contrib/libio/testsuite/libio.tests/tFile.exp | 3 - contrib/libio/testsuite/libio.tests/tfformat.exp | 1 - contrib/libio/testsuite/libio.tests/tiformat.exp | 1 - contrib/libio/testsuite/libio.tests/tiomanip.exp | 1 - contrib/libio/testsuite/libio.tests/tiomisc.exp | 1 - contrib/libio/testsuite/libio.tests/tstdiomisc.exp | 1 - contrib/libobjc/ChangeLog | 174 - contrib/libobjc/Makefile.in | 322 -- contrib/libobjc/NXConstStr.m | 42 - contrib/libobjc/Object.m | 387 -- contrib/libobjc/Protocol.m | 128 - contrib/libobjc/README | 97 - contrib/libobjc/README.threads | 50 - contrib/libobjc/THREADS | 374 -- contrib/libobjc/THREADS.MACH | 23 - contrib/libobjc/archive.c | 1651 ------- contrib/libobjc/class.c | 358 -- contrib/libobjc/configure | 1459 ------ contrib/libobjc/configure.in | 142 - contrib/libobjc/encoding.c | 918 ---- contrib/libobjc/gc.c | 458 -- contrib/libobjc/hash.c | 283 -- contrib/libobjc/init.c | 834 ---- contrib/libobjc/libobjc.def | 161 - contrib/libobjc/libobjc_entry.c | 55 - contrib/libobjc/linking.m | 40 - contrib/libobjc/makefile.dos | 56 - contrib/libobjc/misc.c | 180 - contrib/libobjc/nil_method.c | 40 - contrib/libobjc/objc-features.texi | 392 -- contrib/libobjc/objc/NXConstStr.h | 44 - contrib/libobjc/objc/Object.h | 124 - contrib/libobjc/objc/Protocol.h | 58 - contrib/libobjc/objc/encoding.h | 99 - contrib/libobjc/objc/hash.h | 206 - contrib/libobjc/objc/objc-api.h | 597 --- contrib/libobjc/objc/objc-list.h | 147 - contrib/libobjc/objc/objc.h | 158 - contrib/libobjc/objc/runtime.h | 88 - contrib/libobjc/objc/sarray.h | 237 - contrib/libobjc/objc/thr.h | 143 - contrib/libobjc/objc/typedstream.h | 132 - contrib/libobjc/objects.c | 105 - contrib/libobjc/sarray.c | 522 -- contrib/libobjc/selector.c | 458 -- contrib/libobjc/sendmsg.c | 646 --- contrib/libobjc/thr-dce.c | 281 -- contrib/libobjc/thr-decosf1.c | 281 -- contrib/libobjc/thr-irix.c | 235 - contrib/libobjc/thr-mach.c | 312 -- contrib/libobjc/thr-os2.c | 267 - contrib/libobjc/thr-posix.c | 229 - contrib/libobjc/thr-pthreads.c | 218 - contrib/libobjc/thr-single.c | 192 - contrib/libobjc/thr-solaris.c | 259 - contrib/libobjc/thr-vxworks.c | 192 - contrib/libobjc/thr-win32.c | 272 -- contrib/libobjc/thr.c | 534 -- contrib/libstdc++/ChangeLog | 1421 ------ contrib/libstdc++/FREEBSD-upgrade | 19 - contrib/libstdc++/Makefile.in | 385 -- contrib/libstdc++/NEWS | 9 - contrib/libstdc++/cassert | 7 - contrib/libstdc++/cctype | 7 - contrib/libstdc++/cerrno | 7 - contrib/libstdc++/cfloat | 7 - contrib/libstdc++/cinst.cc | 154 - contrib/libstdc++/ciso646 | 7 - contrib/libstdc++/climits | 7 - contrib/libstdc++/clocale | 7 - contrib/libstdc++/cmath | 76 - contrib/libstdc++/cmathi.cc | 7 - contrib/libstdc++/complex | 18 - contrib/libstdc++/complex.h | 6 - contrib/libstdc++/config/aix.ml | 9 - contrib/libstdc++/config/dec-osf.ml | 6 - contrib/libstdc++/config/delta.mt | 2 - contrib/libstdc++/config/elf.ml | 8 - contrib/libstdc++/config/elfshlibm.ml | 6 - contrib/libstdc++/config/freebsd.ml | 6 - contrib/libstdc++/config/gnu.ml | 6 - contrib/libstdc++/config/hpux.ml | 6 - contrib/libstdc++/config/irix5.ml | 6 - contrib/libstdc++/config/linux.ml | 11 - contrib/libstdc++/config/linux.mt | 2 - contrib/libstdc++/config/openbsd.ml | 7 - contrib/libstdc++/config/openbsd.mt | 3 - contrib/libstdc++/config/posix.mt | 1 - contrib/libstdc++/config/sol2pth.mt | 1 - contrib/libstdc++/config/sol2shm.ml | 6 - contrib/libstdc++/config/sol2solth.mt | 1 - contrib/libstdc++/config/sunos4.ml | 9 - contrib/libstdc++/config/x86-interix.ml | 9 - contrib/libstdc++/configure.in | 203 - contrib/libstdc++/csetjmp | 8 - contrib/libstdc++/csignal | 7 - contrib/libstdc++/cstdarg | 7 - contrib/libstdc++/cstddef | 7 - contrib/libstdc++/cstdio | 7 - contrib/libstdc++/cstdlib | 23 - contrib/libstdc++/cstdlibi.cc | 7 - contrib/libstdc++/cstring | 96 - contrib/libstdc++/cstringi.cc | 7 - contrib/libstdc++/ctime | 7 - contrib/libstdc++/cwchar | 7 - contrib/libstdc++/cwctype | 7 - contrib/libstdc++/fstream | 7 - contrib/libstdc++/iomanip | 7 - contrib/libstdc++/iosfwd | 15 - contrib/libstdc++/iostream | 7 - contrib/libstdc++/sinst.cc | 135 - contrib/libstdc++/sstream | 343 -- contrib/libstdc++/std/bastring.cc | 524 -- contrib/libstdc++/std/bastring.h | 657 --- contrib/libstdc++/std/complext.cc | 273 -- contrib/libstdc++/std/complext.h | 400 -- contrib/libstdc++/std/dcomplex.h | 91 - contrib/libstdc++/std/fcomplex.h | 87 - contrib/libstdc++/std/gslice.h | 111 - contrib/libstdc++/std/gslice_array.h | 170 - contrib/libstdc++/std/indirect_array.h | 157 - contrib/libstdc++/std/ldcomplex.h | 95 - contrib/libstdc++/std/mask_array.h | 154 - contrib/libstdc++/std/slice.h | 76 - contrib/libstdc++/std/slice_array.h | 156 - contrib/libstdc++/std/std_valarray.h | 728 --- contrib/libstdc++/std/straits.h | 161 - contrib/libstdc++/std/valarray_array.h | 346 -- contrib/libstdc++/std/valarray_array.tcc | 130 - contrib/libstdc++/std/valarray_meta.h | 1046 ---- contrib/libstdc++/stdexcept | 97 - contrib/libstdc++/stdexcepti.cc | 21 - contrib/libstdc++/stl.h | 15 - contrib/libstdc++/stl/ChangeLog | 381 -- contrib/libstdc++/stl/README | 13 - contrib/libstdc++/stl/algo.h | 114 - contrib/libstdc++/stl/algobase.h | 71 - contrib/libstdc++/stl/algorithm | 40 - contrib/libstdc++/stl/alloc.h | 46 - contrib/libstdc++/stl/bitset | 1066 ---- contrib/libstdc++/stl/bvector.h | 51 - contrib/libstdc++/stl/defalloc.h | 87 - contrib/libstdc++/stl/deque | 40 - contrib/libstdc++/stl/deque.h | 42 - contrib/libstdc++/stl/function.h | 118 - contrib/libstdc++/stl/functional | 26 - contrib/libstdc++/stl/hash_map | 40 - contrib/libstdc++/stl/hash_map.h | 49 - contrib/libstdc++/stl/hash_set | 40 - contrib/libstdc++/stl/hash_set.h | 44 - contrib/libstdc++/stl/hashtable.h | 48 - contrib/libstdc++/stl/heap.h | 46 - contrib/libstdc++/stl/iterator | 44 - contrib/libstdc++/stl/iterator.h | 104 - contrib/libstdc++/stl/list | 40 - contrib/libstdc++/stl/list.h | 42 - contrib/libstdc++/stl/map | 40 - contrib/libstdc++/stl/map.h | 41 - contrib/libstdc++/stl/memory | 108 - contrib/libstdc++/stl/multimap.h | 41 - contrib/libstdc++/stl/multiset.h | 41 - contrib/libstdc++/stl/numeric | 42 - contrib/libstdc++/stl/pair.h | 51 - contrib/libstdc++/stl/pthread_alloc | 479 -- contrib/libstdc++/stl/pthread_alloc.h | 31 - contrib/libstdc++/stl/queue | 45 - contrib/libstdc++/stl/rope | 32 - contrib/libstdc++/stl/rope.h | 34 - contrib/libstdc++/stl/ropeimpl.h | 1550 ------ contrib/libstdc++/stl/set | 40 - contrib/libstdc++/stl/set.h | 41 - contrib/libstdc++/stl/slist | 28 - contrib/libstdc++/stl/slist.h | 30 - contrib/libstdc++/stl/stack | 41 - contrib/libstdc++/stl/stack.h | 46 - contrib/libstdc++/stl/stl_algo.h | 2894 ----------- contrib/libstdc++/stl/stl_algobase.h | 526 -- contrib/libstdc++/stl/stl_alloc.h | 1057 ---- contrib/libstdc++/stl/stl_bvector.h | 838 ---- contrib/libstdc++/stl/stl_config.h | 356 -- contrib/libstdc++/stl/stl_construct.h | 90 - contrib/libstdc++/stl/stl_deque.h | 1698 ------- contrib/libstdc++/stl/stl_function.h | 700 --- contrib/libstdc++/stl/stl_hash_fun.h | 93 - contrib/libstdc++/stl/stl_hash_map.h | 416 -- contrib/libstdc++/stl/stl_hash_set.h | 401 -- contrib/libstdc++/stl/stl_hashtable.h | 1039 ---- contrib/libstdc++/stl/stl_heap.h | 281 -- contrib/libstdc++/stl/stl_iterator.h | 915 ---- contrib/libstdc++/stl/stl_list.h | 840 ---- contrib/libstdc++/stl/stl_map.h | 242 - contrib/libstdc++/stl/stl_multimap.h | 232 - contrib/libstdc++/stl/stl_multiset.h | 224 - contrib/libstdc++/stl/stl_numeric.h | 239 - contrib/libstdc++/stl/stl_pair.h | 77 - contrib/libstdc++/stl/stl_queue.h | 202 - contrib/libstdc++/stl/stl_raw_storage_iter.h | 81 - contrib/libstdc++/stl/stl_relops.h | 62 - contrib/libstdc++/stl/stl_rope.h | 2541 ---------- contrib/libstdc++/stl/stl_set.h | 216 - contrib/libstdc++/stl/stl_slist.h | 945 ---- contrib/libstdc++/stl/stl_stack.h | 111 - contrib/libstdc++/stl/stl_tempbuf.h | 156 - contrib/libstdc++/stl/stl_tree.h | 1333 ----- contrib/libstdc++/stl/stl_uninitialized.h | 279 -- contrib/libstdc++/stl/stl_vector.h | 823 ---- contrib/libstdc++/stl/tempbuf.h | 61 - contrib/libstdc++/stl/tree.h | 46 - contrib/libstdc++/stl/type_traits.h | 373 -- contrib/libstdc++/stl/utility | 38 - contrib/libstdc++/stl/vector | 41 - contrib/libstdc++/stl/vector.h | 42 - contrib/libstdc++/stlinst.cc | 10 - contrib/libstdc++/string | 13 - contrib/libstdc++/strstream | 7 - contrib/libstdc++/tests/ChangeLog | 132 - contrib/libstdc++/tests/Makefile.in | 35 - contrib/libstdc++/tests/configure.in | 65 - contrib/libstdc++/tests/tcomplex.cc | 151 - contrib/libstdc++/tests/tcomplex.exp | 37 - contrib/libstdc++/tests/tcomplex.inp | 1 - contrib/libstdc++/tests/tlist.cc | 151 - contrib/libstdc++/tests/tlist.exp | 44 - contrib/libstdc++/tests/tmap.cc | 59 - contrib/libstdc++/tests/tmap.exp | 7 - contrib/libstdc++/tests/tstring.cc | 249 - contrib/libstdc++/tests/tstring.exp | 22 - contrib/libstdc++/tests/tstring.inp | 1 - contrib/libstdc++/tests/tvector.cc | 20 - contrib/libstdc++/tests/tvector.exp | 4 - contrib/libstdc++/testsuite/ChangeLog | 94 - contrib/libstdc++/testsuite/Makefile.in | 67 - contrib/libstdc++/testsuite/config/default.exp | 1 - contrib/libstdc++/testsuite/configure.in | 24 - contrib/libstdc++/testsuite/lib/libstdc++.exp | 179 - .../libstdc++/testsuite/libstdc++.tests/test.exp | 34 - contrib/libstdc++/valarray | 8 - contrib/libstdc++/valarray.cc | 50 - 445 files changed, 92992 deletions(-) delete mode 100644 contrib/libio/ChangeLog delete mode 100644 contrib/libio/FREEBSD-upgrade delete mode 100644 contrib/libio/Makefile.in delete mode 100644 contrib/libio/NEWS delete mode 100644 contrib/libio/PlotFile.cc delete mode 100644 contrib/libio/PlotFile.h delete mode 100644 contrib/libio/README delete mode 100644 contrib/libio/SFile.cc delete mode 100644 contrib/libio/SFile.h delete mode 100644 contrib/libio/builtinbuf.cc delete mode 100644 contrib/libio/builtinbuf.h delete mode 100644 contrib/libio/cleanup.c delete mode 100644 contrib/libio/config.shared delete mode 100644 contrib/libio/config/hpux.mt delete mode 100644 contrib/libio/config/isc.mt delete mode 100644 contrib/libio/config/linux.mt delete mode 100644 contrib/libio/config/linuxaxp1-libc-lock.h delete mode 100644 contrib/libio/config/linuxaxp1-stdio-lock.h delete mode 100644 contrib/libio/config/linuxaxp1.mt delete mode 100644 contrib/libio/config/linuxlibc1.mt delete mode 100644 contrib/libio/config/mn10200.mt delete mode 100644 contrib/libio/config/mtsafe.mt delete mode 100644 contrib/libio/config/netware.mt delete mode 100644 contrib/libio/config/sco4.mt delete mode 100644 contrib/libio/configure.in delete mode 100644 contrib/libio/dbz/Makefile.in delete mode 100644 contrib/libio/dbz/README delete mode 100644 contrib/libio/dbz/altbytes delete mode 100644 contrib/libio/dbz/byteflip.c delete mode 100644 contrib/libio/dbz/case.c delete mode 100644 contrib/libio/dbz/case.h delete mode 100644 contrib/libio/dbz/configure.in delete mode 100644 contrib/libio/dbz/dbz.1 delete mode 100644 contrib/libio/dbz/dbz.3z delete mode 100644 contrib/libio/dbz/dbz.c delete mode 100644 contrib/libio/dbz/dbz.h delete mode 100644 contrib/libio/dbz/dbzmain.c delete mode 100644 contrib/libio/dbz/fake.c delete mode 100644 contrib/libio/dbz/firstlast25 delete mode 100755 contrib/libio/dbz/getmap delete mode 100644 contrib/libio/dbz/random.c delete mode 100644 contrib/libio/dbz/revbytes delete mode 100644 contrib/libio/dbz/stdio.h delete mode 100644 contrib/libio/depend delete mode 100644 contrib/libio/editbuf.cc delete mode 100644 contrib/libio/editbuf.h delete mode 100644 contrib/libio/filebuf.cc delete mode 100644 contrib/libio/filedoalloc.c delete mode 100644 contrib/libio/fileops.c delete mode 100644 contrib/libio/floatconv.c delete mode 100644 contrib/libio/floatio.h delete mode 100644 contrib/libio/fstream.cc delete mode 100644 contrib/libio/fstream.h delete mode 100755 contrib/libio/gen-params delete mode 100644 contrib/libio/genops.c delete mode 100644 contrib/libio/include/empty.h delete mode 100644 contrib/libio/indstream.cc delete mode 100644 contrib/libio/indstream.h delete mode 100644 contrib/libio/ioassign.cc delete mode 100644 contrib/libio/ioextend.cc delete mode 100644 contrib/libio/iofclose.c delete mode 100644 contrib/libio/iofdopen.c delete mode 100644 contrib/libio/iofeof.c delete mode 100644 contrib/libio/ioferror.c delete mode 100644 contrib/libio/iofflush.c delete mode 100644 contrib/libio/iofflush_u.c delete mode 100644 contrib/libio/iofgetpos.c delete mode 100644 contrib/libio/iofgets.c delete mode 100644 contrib/libio/iofopen.c delete mode 100644 contrib/libio/iofprintf.c delete mode 100644 contrib/libio/iofputs.c delete mode 100644 contrib/libio/iofread.c delete mode 100644 contrib/libio/iofscanf.c delete mode 100644 contrib/libio/iofsetpos.c delete mode 100644 contrib/libio/ioftell.c delete mode 100644 contrib/libio/iofwrite.c delete mode 100644 contrib/libio/iogetc.c delete mode 100644 contrib/libio/iogetdelim.c delete mode 100644 contrib/libio/iogetline.c delete mode 100644 contrib/libio/iogets.c delete mode 100644 contrib/libio/ioignore.c delete mode 100644 contrib/libio/iolibio.h delete mode 100644 contrib/libio/iomanip.cc delete mode 100644 contrib/libio/iomanip.h delete mode 100644 contrib/libio/iopadn.c delete mode 100644 contrib/libio/ioperror.c delete mode 100644 contrib/libio/iopopen.c delete mode 100644 contrib/libio/ioprims.c delete mode 100644 contrib/libio/ioprintf.c delete mode 100644 contrib/libio/ioputc.c delete mode 100644 contrib/libio/ioputs.c delete mode 100644 contrib/libio/ioscanf.c delete mode 100644 contrib/libio/ioseekoff.c delete mode 100644 contrib/libio/ioseekpos.c delete mode 100644 contrib/libio/iosetbuffer.c delete mode 100644 contrib/libio/iosetvbuf.c delete mode 100644 contrib/libio/iosprintf.c delete mode 100644 contrib/libio/iosscanf.c delete mode 100644 contrib/libio/iostdio.h delete mode 100644 contrib/libio/iostream.cc delete mode 100644 contrib/libio/iostream.h delete mode 100644 contrib/libio/iostream.texi delete mode 100644 contrib/libio/iostreamP.h delete mode 100644 contrib/libio/iostrerror.c delete mode 100644 contrib/libio/ioungetc.c delete mode 100644 contrib/libio/iovfprintf.c delete mode 100644 contrib/libio/iovfscanf.c delete mode 100644 contrib/libio/iovsprintf.c delete mode 100644 contrib/libio/iovsscanf.c delete mode 100644 contrib/libio/isgetline.cc delete mode 100644 contrib/libio/isgetsb.cc delete mode 100644 contrib/libio/isscan.cc delete mode 100644 contrib/libio/istream.h delete mode 100644 contrib/libio/libio.h delete mode 100644 contrib/libio/libioP.h delete mode 100644 contrib/libio/osform.cc delete mode 100644 contrib/libio/ostream.h delete mode 100644 contrib/libio/outfloat.c delete mode 100644 contrib/libio/parsestream.cc delete mode 100644 contrib/libio/parsestream.h delete mode 100644 contrib/libio/peekc.c delete mode 100644 contrib/libio/pfstream.cc delete mode 100644 contrib/libio/pfstream.h delete mode 100644 contrib/libio/procbuf.cc delete mode 100644 contrib/libio/procbuf.h delete mode 100644 contrib/libio/sbform.cc delete mode 100644 contrib/libio/sbgetline.cc delete mode 100644 contrib/libio/sbscan.cc delete mode 100644 contrib/libio/stdfiles.c delete mode 100644 contrib/libio/stdio/ChangeLog delete mode 100644 contrib/libio/stdio/Makefile.in delete mode 100644 contrib/libio/stdio/clearerr.c delete mode 100644 contrib/libio/stdio/clearerr_u.c delete mode 100644 contrib/libio/stdio/configure.in delete mode 100644 contrib/libio/stdio/fdopen.c delete mode 100644 contrib/libio/stdio/feof.c delete mode 100644 contrib/libio/stdio/feof_u.c delete mode 100644 contrib/libio/stdio/ferror.c delete mode 100644 contrib/libio/stdio/ferror_u.c delete mode 100644 contrib/libio/stdio/fgetc.c delete mode 100644 contrib/libio/stdio/fileno.c delete mode 100644 contrib/libio/stdio/fputc.c delete mode 100644 contrib/libio/stdio/fputc_u.c delete mode 100644 contrib/libio/stdio/freopen.c delete mode 100644 contrib/libio/stdio/fseek.c delete mode 100644 contrib/libio/stdio/getc.c delete mode 100644 contrib/libio/stdio/getc_u.c delete mode 100644 contrib/libio/stdio/getchar.c delete mode 100644 contrib/libio/stdio/getchar_u.c delete mode 100644 contrib/libio/stdio/getline.c delete mode 100644 contrib/libio/stdio/getw.c delete mode 100644 contrib/libio/stdio/obprintf.c delete mode 100644 contrib/libio/stdio/popen.c delete mode 100644 contrib/libio/stdio/putc.c delete mode 100644 contrib/libio/stdio/putc_u.c delete mode 100644 contrib/libio/stdio/putchar.c delete mode 100644 contrib/libio/stdio/putchar_u.c delete mode 100644 contrib/libio/stdio/putw.c delete mode 100644 contrib/libio/stdio/rewind.c delete mode 100644 contrib/libio/stdio/setbuf.c delete mode 100644 contrib/libio/stdio/setfileno.c delete mode 100644 contrib/libio/stdio/setlinebuf.c delete mode 100644 contrib/libio/stdio/snprintf.c delete mode 100644 contrib/libio/stdio/stdio.h delete mode 100644 contrib/libio/stdio/vasprintf.c delete mode 100644 contrib/libio/stdio/vfprintf.c delete mode 100644 contrib/libio/stdio/vfscanf.c delete mode 100644 contrib/libio/stdio/vprintf.c delete mode 100644 contrib/libio/stdio/vscanf.c delete mode 100644 contrib/libio/stdio/vsnprintf.c delete mode 100644 contrib/libio/stdiostream.cc delete mode 100644 contrib/libio/stdiostream.h delete mode 100644 contrib/libio/stdstrbufs.cc delete mode 100644 contrib/libio/stdstreams.cc delete mode 100644 contrib/libio/stream.cc delete mode 100644 contrib/libio/stream.h delete mode 100644 contrib/libio/streambuf.cc delete mode 100644 contrib/libio/streambuf.h delete mode 100644 contrib/libio/strfile.h delete mode 100644 contrib/libio/strops.c delete mode 100644 contrib/libio/strstream.cc delete mode 100644 contrib/libio/strstream.h delete mode 100644 contrib/libio/tests/ChangeLog delete mode 100644 contrib/libio/tests/Makefile.in delete mode 100644 contrib/libio/tests/configure.in delete mode 100644 contrib/libio/tests/hounddog.cc delete mode 100644 contrib/libio/tests/hounddog.exp delete mode 100644 contrib/libio/tests/hounddog.inp delete mode 100644 contrib/libio/tests/putbackdog.cc delete mode 100644 contrib/libio/tests/tFile.cc delete mode 100644 contrib/libio/tests/tFile.exp delete mode 100644 contrib/libio/tests/tFile.inp delete mode 100644 contrib/libio/tests/tfformat.c delete mode 100644 contrib/libio/tests/tiformat.c delete mode 100644 contrib/libio/tests/tiomanip.cc delete mode 100644 contrib/libio/tests/tiomanip.exp delete mode 100644 contrib/libio/tests/tiomisc.cc delete mode 100644 contrib/libio/tests/tiomisc.exp delete mode 100644 contrib/libio/tests/tstdiomisc.c delete mode 100644 contrib/libio/tests/tstdiomisc.exp delete mode 100644 contrib/libio/testsuite/ChangeLog delete mode 100644 contrib/libio/testsuite/Makefile.in delete mode 100644 contrib/libio/testsuite/config/default.exp delete mode 100644 contrib/libio/testsuite/configure.in delete mode 100644 contrib/libio/testsuite/lib/libio.exp delete mode 100644 contrib/libio/testsuite/libio.tests/hounddog.exp delete mode 100644 contrib/libio/testsuite/libio.tests/putbackdog.exp delete mode 100644 contrib/libio/testsuite/libio.tests/tFile.exp delete mode 100644 contrib/libio/testsuite/libio.tests/tfformat.exp delete mode 100644 contrib/libio/testsuite/libio.tests/tiformat.exp delete mode 100644 contrib/libio/testsuite/libio.tests/tiomanip.exp delete mode 100644 contrib/libio/testsuite/libio.tests/tiomisc.exp delete mode 100644 contrib/libio/testsuite/libio.tests/tstdiomisc.exp delete mode 100644 contrib/libobjc/ChangeLog delete mode 100644 contrib/libobjc/Makefile.in delete mode 100644 contrib/libobjc/NXConstStr.m delete mode 100644 contrib/libobjc/Object.m delete mode 100644 contrib/libobjc/Protocol.m delete mode 100644 contrib/libobjc/README delete mode 100644 contrib/libobjc/README.threads delete mode 100644 contrib/libobjc/THREADS delete mode 100644 contrib/libobjc/THREADS.MACH delete mode 100644 contrib/libobjc/archive.c delete mode 100644 contrib/libobjc/class.c delete mode 100755 contrib/libobjc/configure delete mode 100644 contrib/libobjc/configure.in delete mode 100644 contrib/libobjc/encoding.c delete mode 100644 contrib/libobjc/gc.c delete mode 100644 contrib/libobjc/hash.c delete mode 100644 contrib/libobjc/init.c delete mode 100644 contrib/libobjc/libobjc.def delete mode 100644 contrib/libobjc/libobjc_entry.c delete mode 100644 contrib/libobjc/linking.m delete mode 100644 contrib/libobjc/makefile.dos delete mode 100644 contrib/libobjc/misc.c delete mode 100644 contrib/libobjc/nil_method.c delete mode 100644 contrib/libobjc/objc-features.texi delete mode 100644 contrib/libobjc/objc/NXConstStr.h delete mode 100644 contrib/libobjc/objc/Object.h delete mode 100644 contrib/libobjc/objc/Protocol.h delete mode 100644 contrib/libobjc/objc/encoding.h delete mode 100644 contrib/libobjc/objc/hash.h delete mode 100644 contrib/libobjc/objc/objc-api.h delete mode 100644 contrib/libobjc/objc/objc-list.h delete mode 100644 contrib/libobjc/objc/objc.h delete mode 100644 contrib/libobjc/objc/runtime.h delete mode 100644 contrib/libobjc/objc/sarray.h delete mode 100644 contrib/libobjc/objc/thr.h delete mode 100644 contrib/libobjc/objc/typedstream.h delete mode 100644 contrib/libobjc/objects.c delete mode 100644 contrib/libobjc/sarray.c delete mode 100644 contrib/libobjc/selector.c delete mode 100644 contrib/libobjc/sendmsg.c delete mode 100644 contrib/libobjc/thr-dce.c delete mode 100644 contrib/libobjc/thr-decosf1.c delete mode 100644 contrib/libobjc/thr-irix.c delete mode 100644 contrib/libobjc/thr-mach.c delete mode 100644 contrib/libobjc/thr-os2.c delete mode 100644 contrib/libobjc/thr-posix.c delete mode 100644 contrib/libobjc/thr-pthreads.c delete mode 100644 contrib/libobjc/thr-single.c delete mode 100644 contrib/libobjc/thr-solaris.c delete mode 100644 contrib/libobjc/thr-vxworks.c delete mode 100644 contrib/libobjc/thr-win32.c delete mode 100644 contrib/libobjc/thr.c delete mode 100644 contrib/libstdc++/ChangeLog delete mode 100644 contrib/libstdc++/FREEBSD-upgrade delete mode 100644 contrib/libstdc++/Makefile.in delete mode 100644 contrib/libstdc++/NEWS delete mode 100644 contrib/libstdc++/cassert delete mode 100644 contrib/libstdc++/cctype delete mode 100644 contrib/libstdc++/cerrno delete mode 100644 contrib/libstdc++/cfloat delete mode 100644 contrib/libstdc++/cinst.cc delete mode 100644 contrib/libstdc++/ciso646 delete mode 100644 contrib/libstdc++/climits delete mode 100644 contrib/libstdc++/clocale delete mode 100644 contrib/libstdc++/cmath delete mode 100644 contrib/libstdc++/cmathi.cc delete mode 100644 contrib/libstdc++/complex delete mode 100644 contrib/libstdc++/complex.h delete mode 100644 contrib/libstdc++/config/aix.ml delete mode 100644 contrib/libstdc++/config/dec-osf.ml delete mode 100644 contrib/libstdc++/config/delta.mt delete mode 100644 contrib/libstdc++/config/elf.ml delete mode 100644 contrib/libstdc++/config/elfshlibm.ml delete mode 100644 contrib/libstdc++/config/freebsd.ml delete mode 100644 contrib/libstdc++/config/gnu.ml delete mode 100644 contrib/libstdc++/config/hpux.ml delete mode 100644 contrib/libstdc++/config/irix5.ml delete mode 100644 contrib/libstdc++/config/linux.ml delete mode 100644 contrib/libstdc++/config/linux.mt delete mode 100644 contrib/libstdc++/config/openbsd.ml delete mode 100644 contrib/libstdc++/config/openbsd.mt delete mode 100644 contrib/libstdc++/config/posix.mt delete mode 100644 contrib/libstdc++/config/sol2pth.mt delete mode 100644 contrib/libstdc++/config/sol2shm.ml delete mode 100644 contrib/libstdc++/config/sol2solth.mt delete mode 100644 contrib/libstdc++/config/sunos4.ml delete mode 100644 contrib/libstdc++/config/x86-interix.ml delete mode 100644 contrib/libstdc++/configure.in delete mode 100644 contrib/libstdc++/csetjmp delete mode 100644 contrib/libstdc++/csignal delete mode 100644 contrib/libstdc++/cstdarg delete mode 100644 contrib/libstdc++/cstddef delete mode 100644 contrib/libstdc++/cstdio delete mode 100644 contrib/libstdc++/cstdlib delete mode 100644 contrib/libstdc++/cstdlibi.cc delete mode 100644 contrib/libstdc++/cstring delete mode 100644 contrib/libstdc++/cstringi.cc delete mode 100644 contrib/libstdc++/ctime delete mode 100644 contrib/libstdc++/cwchar delete mode 100644 contrib/libstdc++/cwctype delete mode 100644 contrib/libstdc++/fstream delete mode 100644 contrib/libstdc++/iomanip delete mode 100644 contrib/libstdc++/iosfwd delete mode 100644 contrib/libstdc++/iostream delete mode 100644 contrib/libstdc++/sinst.cc delete mode 100644 contrib/libstdc++/sstream delete mode 100644 contrib/libstdc++/std/bastring.cc delete mode 100644 contrib/libstdc++/std/bastring.h delete mode 100644 contrib/libstdc++/std/complext.cc delete mode 100644 contrib/libstdc++/std/complext.h delete mode 100644 contrib/libstdc++/std/dcomplex.h delete mode 100644 contrib/libstdc++/std/fcomplex.h delete mode 100644 contrib/libstdc++/std/gslice.h delete mode 100644 contrib/libstdc++/std/gslice_array.h delete mode 100644 contrib/libstdc++/std/indirect_array.h delete mode 100644 contrib/libstdc++/std/ldcomplex.h delete mode 100644 contrib/libstdc++/std/mask_array.h delete mode 100644 contrib/libstdc++/std/slice.h delete mode 100644 contrib/libstdc++/std/slice_array.h delete mode 100644 contrib/libstdc++/std/std_valarray.h delete mode 100644 contrib/libstdc++/std/straits.h delete mode 100644 contrib/libstdc++/std/valarray_array.h delete mode 100644 contrib/libstdc++/std/valarray_array.tcc delete mode 100644 contrib/libstdc++/std/valarray_meta.h delete mode 100644 contrib/libstdc++/stdexcept delete mode 100644 contrib/libstdc++/stdexcepti.cc delete mode 100644 contrib/libstdc++/stl.h delete mode 100644 contrib/libstdc++/stl/ChangeLog delete mode 100644 contrib/libstdc++/stl/README delete mode 100644 contrib/libstdc++/stl/algo.h delete mode 100644 contrib/libstdc++/stl/algobase.h delete mode 100644 contrib/libstdc++/stl/algorithm delete mode 100644 contrib/libstdc++/stl/alloc.h delete mode 100644 contrib/libstdc++/stl/bitset delete mode 100644 contrib/libstdc++/stl/bvector.h delete mode 100644 contrib/libstdc++/stl/defalloc.h delete mode 100644 contrib/libstdc++/stl/deque delete mode 100644 contrib/libstdc++/stl/deque.h delete mode 100644 contrib/libstdc++/stl/function.h delete mode 100644 contrib/libstdc++/stl/functional delete mode 100644 contrib/libstdc++/stl/hash_map delete mode 100644 contrib/libstdc++/stl/hash_map.h delete mode 100644 contrib/libstdc++/stl/hash_set delete mode 100644 contrib/libstdc++/stl/hash_set.h delete mode 100644 contrib/libstdc++/stl/hashtable.h delete mode 100644 contrib/libstdc++/stl/heap.h delete mode 100644 contrib/libstdc++/stl/iterator delete mode 100644 contrib/libstdc++/stl/iterator.h delete mode 100644 contrib/libstdc++/stl/list delete mode 100644 contrib/libstdc++/stl/list.h delete mode 100644 contrib/libstdc++/stl/map delete mode 100644 contrib/libstdc++/stl/map.h delete mode 100644 contrib/libstdc++/stl/memory delete mode 100644 contrib/libstdc++/stl/multimap.h delete mode 100644 contrib/libstdc++/stl/multiset.h delete mode 100644 contrib/libstdc++/stl/numeric delete mode 100644 contrib/libstdc++/stl/pair.h delete mode 100644 contrib/libstdc++/stl/pthread_alloc delete mode 100644 contrib/libstdc++/stl/pthread_alloc.h delete mode 100644 contrib/libstdc++/stl/queue delete mode 100644 contrib/libstdc++/stl/rope delete mode 100644 contrib/libstdc++/stl/rope.h delete mode 100644 contrib/libstdc++/stl/ropeimpl.h delete mode 100644 contrib/libstdc++/stl/set delete mode 100644 contrib/libstdc++/stl/set.h delete mode 100644 contrib/libstdc++/stl/slist delete mode 100644 contrib/libstdc++/stl/slist.h delete mode 100644 contrib/libstdc++/stl/stack delete mode 100644 contrib/libstdc++/stl/stack.h delete mode 100644 contrib/libstdc++/stl/stl_algo.h delete mode 100644 contrib/libstdc++/stl/stl_algobase.h delete mode 100644 contrib/libstdc++/stl/stl_alloc.h delete mode 100644 contrib/libstdc++/stl/stl_bvector.h delete mode 100644 contrib/libstdc++/stl/stl_config.h delete mode 100644 contrib/libstdc++/stl/stl_construct.h delete mode 100644 contrib/libstdc++/stl/stl_deque.h delete mode 100644 contrib/libstdc++/stl/stl_function.h delete mode 100644 contrib/libstdc++/stl/stl_hash_fun.h delete mode 100644 contrib/libstdc++/stl/stl_hash_map.h delete mode 100644 contrib/libstdc++/stl/stl_hash_set.h delete mode 100644 contrib/libstdc++/stl/stl_hashtable.h delete mode 100644 contrib/libstdc++/stl/stl_heap.h delete mode 100644 contrib/libstdc++/stl/stl_iterator.h delete mode 100644 contrib/libstdc++/stl/stl_list.h delete mode 100644 contrib/libstdc++/stl/stl_map.h delete mode 100644 contrib/libstdc++/stl/stl_multimap.h delete mode 100644 contrib/libstdc++/stl/stl_multiset.h delete mode 100644 contrib/libstdc++/stl/stl_numeric.h delete mode 100644 contrib/libstdc++/stl/stl_pair.h delete mode 100644 contrib/libstdc++/stl/stl_queue.h delete mode 100644 contrib/libstdc++/stl/stl_raw_storage_iter.h delete mode 100644 contrib/libstdc++/stl/stl_relops.h delete mode 100644 contrib/libstdc++/stl/stl_rope.h delete mode 100644 contrib/libstdc++/stl/stl_set.h delete mode 100644 contrib/libstdc++/stl/stl_slist.h delete mode 100644 contrib/libstdc++/stl/stl_stack.h delete mode 100644 contrib/libstdc++/stl/stl_tempbuf.h delete mode 100644 contrib/libstdc++/stl/stl_tree.h delete mode 100644 contrib/libstdc++/stl/stl_uninitialized.h delete mode 100644 contrib/libstdc++/stl/stl_vector.h delete mode 100644 contrib/libstdc++/stl/tempbuf.h delete mode 100644 contrib/libstdc++/stl/tree.h delete mode 100644 contrib/libstdc++/stl/type_traits.h delete mode 100644 contrib/libstdc++/stl/utility delete mode 100644 contrib/libstdc++/stl/vector delete mode 100644 contrib/libstdc++/stl/vector.h delete mode 100644 contrib/libstdc++/stlinst.cc delete mode 100644 contrib/libstdc++/string delete mode 100644 contrib/libstdc++/strstream delete mode 100644 contrib/libstdc++/tests/ChangeLog delete mode 100644 contrib/libstdc++/tests/Makefile.in delete mode 100644 contrib/libstdc++/tests/configure.in delete mode 100644 contrib/libstdc++/tests/tcomplex.cc delete mode 100644 contrib/libstdc++/tests/tcomplex.exp delete mode 100644 contrib/libstdc++/tests/tcomplex.inp delete mode 100644 contrib/libstdc++/tests/tlist.cc delete mode 100644 contrib/libstdc++/tests/tlist.exp delete mode 100644 contrib/libstdc++/tests/tmap.cc delete mode 100644 contrib/libstdc++/tests/tmap.exp delete mode 100644 contrib/libstdc++/tests/tstring.cc delete mode 100644 contrib/libstdc++/tests/tstring.exp delete mode 100644 contrib/libstdc++/tests/tstring.inp delete mode 100644 contrib/libstdc++/tests/tvector.cc delete mode 100644 contrib/libstdc++/tests/tvector.exp delete mode 100644 contrib/libstdc++/testsuite/ChangeLog delete mode 100644 contrib/libstdc++/testsuite/Makefile.in delete mode 100644 contrib/libstdc++/testsuite/config/default.exp delete mode 100644 contrib/libstdc++/testsuite/configure.in delete mode 100644 contrib/libstdc++/testsuite/lib/libstdc++.exp delete mode 100644 contrib/libstdc++/testsuite/libstdc++.tests/test.exp delete mode 100644 contrib/libstdc++/valarray delete mode 100644 contrib/libstdc++/valarray.cc diff --git a/contrib/libio/ChangeLog b/contrib/libio/ChangeLog deleted file mode 100644 index b4564ded47..0000000000 --- a/contrib/libio/ChangeLog +++ /dev/null @@ -1,2807 +0,0 @@ -Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com) - - * gcc-2.95.3 Released. - -2000-12-10 Bernd Schmidt - - 2000-10-16 Jakub Jelinek - * iostream.cc (ostream::operator<<(double n)) [__GLIBC_MINOR__ >= 2]: - Initialize new fields wide and i18n of struct printf_info. - (ostream::operator<<(long double n)) [__GLIBC_MINOR__ >= 2]: - Likewise. - - 2000-09-23 Franz Sirl - * stdstreams.cc: Include , not "libio.h". - * iolibio.h: Likewise. - (_IO_pos_BAD): Use _IO_off_t instead of _IO_fpos_t. - * libio.h (_IO_USER_LOCK): Define. - - 1999-12-22 Jakub Jelinek - * libio.h (_IO_cookie_io_functions_t): Use _IO_off_t instead of - _IO_fpos_t. - (_IO_seekoff, _IO_seekpos): Likewise. Use _IO_off64_t instead of - _IO_fpos64_t. - * libioP.h (_IO_seekoff_t, _IO_seekpos_t, _IO_seek_t): Likewise. - (_IO_seekoff, _IO_seekpos): Likewise. - (_IO_default_seekoff, _IO_default_seekpos): Likewise. - (_IO_default_seek): Likewise. - (_IO_file_seekoff, _IO_file_seek, _IO_str_seekoff): Likewise. - * streambuf.h (streampos): Typedef to _IO_off_t resp. _IO_off64_t. - * parsestream.h (class parsebuf::pos_at_line_start): Change type - to _IO_off_t. - -2000-01-28 Martin v. Löwis - - * fstream.h (ifstream::ifstream): Add ios::in to mode. - (ifstream::open): Likewise. - (ofstream::ofstream): Add ios::out to mode. - (ofstream::open): Likewise. - -1999-12-21 Martin v. Löwis - - * filebuf.cc (open): Support ios::ate if _G_HAVE_IO_FILE_OPEN. - Remove seek for ios::app if not. - -1999-12-14 Martin v. Löwis - - * strstream.h (strstreambuf::streambuf): Rename parameters to - avoid shadow warning. - * stream.h (WS): Likewise. - -Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.2 Released. - -Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.1 Released. - -1999-08-08 Alexandre Oliva - - * streambuf.h (ios::streamsize): Declare as _IO_ssize_t, as in the - global scope. - -1999-08-07 Andreas Schwab - - * iostream.cc: Add missing calls to isfx and setup a cleanup - region for the locked stream. - * iostream.h: Likewise. - * isgetline.cc: Likewise. - * isgetsb.cc: Likewise. - * isscan.cc: Likewise. - -Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -Mon Jun 28 09:25:23 1999 Hans-Peter Nilsson - - * configure.in (post-target): Use "$(topsrcdir)", not "$(srcdir)/..". - -1999-05-20 Angela Marie Thomas - - * configure.in: Test for ${compiler_name}.exe as well. - -1999-05-17 Mark Kettenis - - * libioP.h: Only include libc-lock.h if _IO_MTSAFE_IO is defined. - -1999-05-12 Jason Merrill - - * configure.in (compiler_name): Don't do the skip-this-dir thing - if we're reconfiguring. - -1999-04-29 Nathan Sidwell - - * streambuf.h (ios::~ios): Use operator delete[] to remove _arrays. - -Mon Apr 12 19:22:44 1999 Mumit Khan - - * filedoalloc.c (_POSIX_SOURCE): Remove definition. - * fileops.c (_POSIX_SOURCE): Likewise. - * iopopen.c (_POSIX_SOURCE): Likewise. - * procbuf.cc (_POSIX_SOURCE): Likewise. - * libioP.h (_POSIX_SOURCE): And define it here. - * stdiostream.cc: Include libioP.h before others. - -Fri Apr 2 15:11:58 1999 H.J. Lu (hjl@gnu.org) - - * libio/configure.in (gxx_include_dir): Handle it. - * libio/Makefile.in: Likewise. - -Wed Mar 24 22:36:45 1999 Mumit Khan - - * configure.in (EXEEXT): Define. - (compiler_name): Use. - -1999-03-24 Alexandre Oliva - - * gen-params (CONFIG_NM): `test ... -o ...' is not portable. - -Thu Mar 11 01:07:55 1999 Franz Sirl - - * configure.in: Cleanup and add mh-*pic handling for arm, powerpc - -Fri Mar 5 01:15:15 1999 H.J. Lu (hjl@gnu.org) - - * config/linuxlibc1.mt (MT_CFLAGS): Add -D_G_STDIO_USES_LIBIO - -D_G_HAVE_WEAK_SYMBOL. - - * genops.c: Add the proper weak alias if _G_STDIO_USES_LIBIO - and _G_HAVE_WEAK_SYMBOL are defined. - * iofclose.c: Likewise. - * iofeof.c: Likewise. - * ioferror.c: Likewise. - * iogetc.c: Likewise. - * ioputc.c: Likewise. - * iovsprintf.c: Likewise. - * iovsscanf.c: Likewise. - -Sun Feb 28 22:39:17 1999 Geoffrey Noer - - * configure.in: Check cygwin*, not cygwin32*. - -Wed Feb 10 09:25:48 1999 Mumit Khan - - * gen-params (VTABLE_LABEL_PREFIX): Handle windows32. - -Wed Feb 3 22:05:41 1999 H.J. Lu (hjl@gnu.org) - Jeffrey A Law (law@cygnus.com) - - * Makefile.in (iostream.list): Remove dependency on - stamp-picdir. - ($(LIBIOSTREAM_DEP)): Depend on stamp-picdir. - ($(LIBIO_FILES)): Similarly. - - * config.shared (all): Make $(PICDIR) concurrent. - -1998-11-26 Manfred Hollstein - - * configure.in (compiler_name): Add check to detect if this - language's compiler has been built. - -1998-10-12 Alexandre Oliva - - * 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 - - * 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 - - * 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 - - * libio/iogetline.c (_IO_getline_info): Don't read anything for - N == 0. Patch by HJ Lu. - -1998-08-23 Mark Mitchell - - * iomanip.h: Use __extension__ for `extern' explicit template - instantiations. - -1998-08-17 Ulrich Drepper - - * strfile.h: Define __PMT if not already defined. - -1998-08-03 Andreas Jaeger - - * libioP.h: Use __PMT in typedefs. - * strfile.h: Likewise. - -1998-06-29 Ulrich Drepper - - * 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 - - * Makefile.in (install): Remove superfluous /include. - -1998-06-26 Manfred Hollstein - - * config.shared (FLAGS_TO_PASS): Add gcc_version_trigger. - (Makefile): Add dependency upon $(gcc_version_trigger). - -1998-06-24 Manfred Hollstein - - * 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 - - * config.shared (FLAGS_TO_PASS): Add gcc_version. - -1998-06-19 Manfred Hollstein - - * config.shared (FLAGS_TO_PASS): Add libsubdir. - -1998-06-07 Andreas Schwab - - * genops.c (__underflow): Read character from read pointer as unsigned. - (__uflow): Likewise. - -1998-05-22 Ulrich Drepper - - * 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 - - * configure.in: Make locating frag files failsafe even for the - special case if configuring and building in srcdir. - -1998-02-24 Andreas Schwab - - 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 . - * ioprims.c: Likewise. - -1998-02-10 Mark Mitchell - - * iostream.cc (ostream::operator<<(long double)): Don't use - labeled initializers. - -Fri Feb 6 01:35:56 1998 Manfred Hollstein - - * 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 - - * 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 - - * 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 - - * 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 - - * config.shared (FLAGS_TO_PASS): Add SHELL. - -Thu Jan 15 00:21:58 1998 Ian Lance Taylor - - * 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 - - * 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 - - 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 - - * 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 - - * iomanip.h: Fix guiding decls. - -1997-11-05 Brendan Kehoe - - * 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 - - * gen-params: Override NULL. - -1997-10-27 03:53 Ulrich Drepper - - * 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 - - * 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 - - * iostream.cc, libio.h: Convert other uses of #ifdef - _G_HAVE_PRINTF_FP to #if. - -1997-10-02 Brendan Kehoe - - * iostream.cc (operator<<): Use `#if _G_HAVE_PRINTF_FP', not ifdef. - -Thu Oct 2 10:36:49 1997 Jason Merrill - - * gen-params: Fix __printf_fp test. - * config/linuxlibc1.mt (gxx_includedir): Don't define. - -Thu Oct 2 10:36:26 1997 Ulrich Drepper - - * 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 - - * iomanip.h: Use new friend <> syntax. - -Sun Sep 28 12:04:21 1997 Jason Merrill - - * 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 - - * Makefile.in (LIBIO_OBJECTS): Depend on _G_CONFIG_H. - -1997-09-17 04:08 Ulrich Drepper - - * 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 - - * libioP.h: Define __set_errno if not already defined. - -1997-09-15 02:37 Ulrich Drepper - - * 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 - - * Makefile.in (iostream.list): Remove STDIO_WRAP_OBJECTS. - -Mon Sep 8 01:30:27 1997 Weiwen Liu - - * 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 - - * 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 - - * parsestream.cc (general_parsebuf): Cast return of malloc to char*. - -1997-09-04 16:11 Ulrich Drepper - - 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 - - * iostream.h: Add copy assignment ops for _IO_?stream_withassign. - -Tue Jul 22 10:31:41 1997 Brendan Kehoe - - * config.shared (CHECK_SUBDIRS): Use install-sh, not install.sh. - -Wed Jun 25 12:20:55 1997 Brendan Kehoe - - * config.shared (DOING_GPERF): Look for this, defining TOLIBGXX - and LIBS for it. - -Wed Jun 18 11:03:34 1997 Bob Manson - - * config.shared (FLAGS_TO_PASS): Don't include RUNTEST. - -Tue Jun 17 22:23:48 1997 Bob Manson - - * config.shared (FLAGS_TO_PASS): Pass RUNTEST and RUNTESTFLAGS. - -Fri May 16 21:08:53 1997 Bob Manson - - * 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 - - * 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 - - * Makefile.in (test, tpipe): Add $(CFLAGS). - -Wed Apr 30 12:16:29 1997 Jason Merrill - - * configure.in: Don't turn on multilib here. - -Sat Apr 26 13:38:21 1997 Bob Manson - - * 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 - - * 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 - - * libioP.h (_IO_file_attach): Delete redundant decl. - -Tue Jan 21 22:13:45 1997 Brendan Kehoe - - * 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 - - * 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 - - * dbz/dbz.c: Use off_t. - -Sat Nov 23 15:44:37 1996 Jason Merrill - - * Makefile.in (install): Don't install _G_config.h with other headers. - -Mon Nov 18 17:12:41 1996 Jason Merrill - - * config.shared (SUBDIRS): Use -O instead of -O3 for debugging. - -Sun Nov 3 12:43:34 1996 Jason Merrill - - * iostream.cc (write_int): Treat string literals as const. - -Thu Sep 26 10:09:18 1996 Michael Meissner - - * depend: Regenerate. - -Wed Sep 25 22:54:45 1996 Jason Merrill - - * config.shared (depend.new): Deal with headers that don't end in .h. - -Thu Aug 29 17:05:53 1996 Michael Meissner - - * configure.in (i[345]86-*-*): Recognize i686 for pentium pro. - -Mon Aug 5 01:26:32 1996 Jason Merrill - - * config{ure.in,.shared} (DISTCLEAN): Add multilib.out. - -Fri Aug 2 17:39:35 1996 Jason Merrill - - * 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 - - * strfile.h (struct _IO_streambuf): New struct type. - (struct _IO_strfile): Use it. - -Tue Jun 18 18:24:21 1996 Jason Merrill - - * fstream.h (fstreambase): Make __my_fb mutable. - From Joe Buck. - -Tue Jun 18 11:03:53 1996 Brendan Kehoe - - * 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 - - * 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 - - * 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 - - * 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 - - 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 - - * 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 - - * 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 - - * libioP.h (JUMP*): Implement for thunks. - (_IO_jump_t): Add second dummy field for thunks. - -Thu Apr 25 13:20:00 1996 Jason Merrill - - * config.shared (CXX): Use gcc, not g++. - -Wed Apr 24 10:29:50 1996 Doug Evans - - * config.shared (depend.new): Delete $(srcdir)/ from foo.{c,cc} - for SunOS VPATH. - * depend: Regenerated. - -Fri Apr 19 17:24:51 1996 Jason Merrill - - * Version 2.8.0b3. - -Wed Apr 10 17:16:01 1996 Jason Merrill - - * configure.in (ALL): Don't build iostream.a. - -Mon Apr 8 14:44:11 1996 Per Bothner - - * iosetvbuf.c (_IO_setvbuf): Clear _IO_UNBUFFERED unless _IONBF. - -Mon Apr 8 15:08:23 1996 Ian Lance Taylor - - * configure.in: Permit --enable-shared to specify a list of - directories. - -Fri Apr 5 17:48:56 1996 Per Bothner - - * config.shared (MOSTLYCLEAN): Also remove ${EXTRA_MOSTLYCLEAN}. - -Fri Mar 22 23:25:00 1996 Ulrich Drepper - - * genops.c (_IO_sputbackc, _IO_sungetc): Clear EOF flag if putsh - back was successful. - -Wed Mar 27 11:54:08 1996 Jason Merrill - - * Version 2.8.0b2. - -Fri Mar 22 15:39:36 1996 Per Bothner - - * 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 - - * fileops.c (_IO_do_write): Even if to_do==0, must re-set buffer - pointers. Bug and solution from Luke Blanshard . - -Wed Feb 28 10:00:24 1996 Jason Merrill - - * Version 2.8.0b1. - -Tue Feb 27 18:08:16 1996 Per Bothner - - * 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 - - * 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 - - * 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 - - * filedoalloc.c (_IO_cleanup_registration_needed): Declare as extern. - -Tue Dec 12 17:21:13 1995 Per Bothner - - * indstream.h, instream.cc (indirectbuf::uflow): New method. - * indstream.cc (indirectbuf::underflow): Fix to use sgetc, not sbumpc. - Fixes bug reported by Kevin Beyer . - - * indstream.cc (indirectbuf::seekpos): Add paranoia test. - -Fri Dec 8 14:55:34 1995 Per Bothner - - * 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 - - * config.shared: Use test instead of [ to avoid DEC Unix lossage. - -Thu Nov 23 14:51:43 1995 Per Bothner - - * iopopen.c: Move #include ahead of #include - to deal with BSDI's literal implementation of Posix. - -Sat Nov 25 11:21:55 1995 Doug Evans - - * 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 - - * configure.in: Check ${with_cross_host} rather than comparing - ${host} and ${target}. - -Mon Nov 20 13:55:29 1995 Brendan Kehoe - - * configure.in: Match *-sco3.2v[45]*. - -Wed Nov 15 20:19:31 1995 Brendan Kehoe - - * config.shared (FLAGS_TO_PASS): Also pass SHLIB and SHCURSES. - -Tue Nov 14 01:41:08 1995 Doug Evans - - * 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 - - * 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 - - * config.shared (check): Add missing semicolon. - -Thu Nov 9 17:27:22 1995 Jason Merrill - - * 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 - - * streambuf.cc, editbuf.cc, isgetline.cc, parsestream.cc: - Fixes to avoid -Wall warnings. - -Fri Nov 3 16:41:41 1995 Brendan Kehoe - - * gen-params [!__STDC__]: Include varargs.h instead of stdarg.h. - -Thu Nov 2 15:04:03 1995 Per Bothner - - * config.shared: Re-write if X then Y else true fi to (not X) || Y. - -Wed Nov 1 13:26:44 1995 Per Bothner - - * iostream.h (istream::ipfx): Add default argument value. - Reported by Yotam Medini . - - * libioP.h (_IO_blen): Fix typo. - Reported by Bryan T. Vold . - -Fri Oct 27 19:26:20 1995 Per Bothner - - * 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 - - * iostdio.h: Wrap including the file with #ifndef _IOSTDIO_H. - -Wed Oct 25 11:14:25 1995 Per Bothner - - * 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 . - - * 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 . - -Mon Oct 9 18:09:54 1995 Jason Molenda - - * config.shared (SUFFIXES): add .c. - -Tue Sep 26 16:08:01 1995 Per Bothner - - * procbuf.cc: Move #pragma implementation to beginning. - -Wed Sep 20 17:53:33 1995 Per Bothner - - * procbuf.h, procbuf.cc: Add #pragma interface/implementation stuff. - -Wed Sep 20 18:59:00 1995 John Eaton - - * procbuf.h: Protect from being included multiple times. - -Wed Sep 20 15:47:14 1995 John Eaton - - * procbuf.h (procbuf): Add '_next' pointer field for compatibility - with _IO_proc_file. - -Wed Sep 20 13:54:02 1995 Ian Lance Taylor - - * 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 - - * iopopen.c: #include before . - This is in accordance with Posix, and needed for ISC. - -Fri Sep 8 00:11:55 1995 Brendan Kehoe - - * 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 - - * 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 - - * gen-params: Generate new macro _G_HAVE_SYS_CDEFS. - * libio.h: If _G_HAVE_SYS_CDEFS, get __P from . - -Fri Aug 4 23:21:17 1995 Paul Eggert - - * 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 - - * iostream.h, iostream.cc (istream::sync): Added missing method. - -Thu Aug 3 17:49:34 1995 Per Bothner - - * configure.in: Remove netbsd special case. - * config/netbsd.mt: Removed; no longer used. - -Tue Jun 20 16:07:12 1995 Paul Eggert - - * 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 - - * config.shared (TOPDIR): Delete extra '/', $rootme may be empty. - -Sat Jul 22 13:27:45 1995 Doug Evans - - * 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 - - * 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 - - * gen-params: Surround attributes with __. - -Mon Jun 19 00:33:22 1995 Jason Merrill - - * config.shared (SUBDIRS): Massage broken shells that require - 'else true'. - -Sat Jun 17 11:25:38 1995 Jason Merrill - - * streambuf.h: Declare inline members inline in class. - -Thu Jun 15 20:45:13 1995 Per Bothner - - * Makefile.in (VERSION): Update to version 2.7.0. - -Wed Jun 14 21:41:11 1995 Jason Merrill - - * Makefile.in (STDIO_WRAP_OBJECTS): Remove stdfiles.o. - (LIBIO_OBJECTS): Add stdfiles.o. - -Wed Jun 7 16:11:36 1995 Jason Merrill - - * config.shared (all): Appease bash. - -Wed Jun 7 11:16:38 1995 Jason Merrill - - * configure.in (MOSTLYCLEAN): Remove stamp-picdir. - - * config.shared (MOSTLYCLEAN): Ditto. - (CLEAN): Don't. - -Mon Jun 5 18:29:39 1995 Jason Merrill - - * 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 - - * 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 - - * 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 - - * 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 - - * libioP.h (_IO_jump_t): Change TYPE for __dummy from int to - _G_size_t. - -Sat May 6 13:50:37 1995 Per Bothner - - * 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 - - * 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 . - Add missing quote in 'eval'. - Do add #include in test for . - * 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 - - * 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 - - * gen-params: #include . 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 - - * 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 - - * 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 - - * streambuf.h (__adjust_column): Remove redundant declaration. - -Sat Apr 15 11:39:25 1995 Per Bothner - - * 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 - - * 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 - - * indstream.*: Fix prototypes of xsputn and xsgetn. - - * fileops.c: Avoid ??? trigraph. - -Mon Mar 27 16:16:38 1995 Jason Merrill - - * iomanip.h (operator<< (ostream&, const omanip&): Define - separately. - (operator>> (istream&, const imanip&): 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 - - * configure.in (DISTCLEAN): Add, with target-mkfrag. - -Fri Feb 24 01:01:08 1995 Jason Merrill - - * configure.in (frags): Don't require so many dashes in the - canonical target name. - -Sat Feb 18 13:18:30 1995 Per Bothner - - * 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 - - * 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 - - * gen-params: Check for struct tms in , defining - HAVE_SYS_TIMES accordingly. - -Wed Feb 15 21:05:11 1995 Per Bothner - - * strops.c (_IO_str_count): Use LEN macro. - (_IO_str_seekoff): Update _len field. - -Mon Feb 6 19:29:00 1995 Jason Merrill - - * 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 - - * gen-params (_G_wint_t): Allow for broken promotions. - -Tue Jan 24 16:15:40 1995 Per Bothner - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 . - - * 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 - - * 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 - - * 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 - - * 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 - - * README: Fix typos. - * libio.h: Add comment. Update Copyright notice. - -Fri Nov 4 21:46:30 1994 Paul Eggert - - * 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 - - * 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 . - -Thu Oct 20 17:09:52 1994 Per Bothner - - * 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 - - * 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 . - * 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 . - - * 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 . - - * 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 and 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 . - -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 . - -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 . 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 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 . - -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 . - - * 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 . - - * ioputs.c: Add #include , to avoid warning on alpha. - - * iofdopen.c: Add #include , 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 and - smanip. - -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 (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 .) - * 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 . - -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 . - -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 .) - * 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 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 . - -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 . - -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 . - -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 . - * floatconv.h: Fix typo (reported by H.J.Lu). - -Wed Aug 18 19:34:04 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * configure.in (INSTALLDIR): handle native vs. cross case - - * Makefile.in (install): don't use $TARGETLIB, set INSTALLDIR to - $(libdir) - -Wed Aug 18 12:10:03 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * Makefile.in: Rename iostream-files to iostream.list. - * configure.in: Add iostream.list to MOSTLYCLEAN. - -Tue Aug 17 18:56:59 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * Makefile.in: Depend on _G_config.h where appropriate. - * config.shared (CXXINCLUDES): If doing libg++, search ../libio. - -Tue Aug 17 17:34:24 1993 Per Bothner (bothner@kalessin.cygnus.com) - - New directory. Based on old libg++/iostream code, - but extensively re-written. diff --git a/contrib/libio/FREEBSD-upgrade b/contrib/libio/FREEBSD-upgrade deleted file mode 100644 index 2501afd23b..0000000000 --- a/contrib/libio/FREEBSD-upgrade +++ /dev/null @@ -1,22 +0,0 @@ -# ex:ts=8 -$FreeBSD: src/contrib/libio/FREEBSD-upgrade,v 1.2 1999/11/01 07:35:24 obrien Exp $ -$DragonFly: src/contrib/libio/Attic/FREEBSD-upgrade,v 1.2 2003/06/17 04:24:02 dillon Exp $ - -For the import of libio, files were pruned by: - - tar xvypf gcc-2.95.2.tar.bz2 '*/libio' - -Then imported by: - - cvs import -m \ - "Virgin import of GCC 2.95.2's libio -- the C++ iostream facility." \ - src/contrib/libio FSF gcc_2_95_2 - - -To make local changes to libio, simply patch and commit to the main -branch (aka HEAD). Never make local changes on the vendor (FSF) branch. - -All local changes should be submitted to "gcc-patches@gcc.gnu.org". - -obrien@NUXI.com -31-October-1999 diff --git a/contrib/libio/Makefile.in b/contrib/libio/Makefile.in deleted file mode 100644 index 1d4123b523..0000000000 --- a/contrib/libio/Makefile.in +++ /dev/null @@ -1,137 +0,0 @@ -# Copyright (C) 1993, 1995, 1996, 1997, 1998 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. - -srcdir = . - -VERSION = 2.8.0 -# The config file (overriden by Linux). -_G_CONFIG_H=_G_config.h -tooldir = $(exec_prefix)/$(target) -INSTALLDIR = $(libdir) -gxx_include_dir=${includedir}/g++ - -IO_OBJECTS = filedoalloc.o floatconv.o genops.o fileops.o \ - iovfprintf.o \ - iovfscanf.o ioignore.o iopadn.o \ - iofgetpos.o iofread.o iofscanf.o \ - iofsetpos.o iogetdelim.o iogetline.o \ - ioprintf.o ioseekoff.o ioseekpos.o \ - outfloat.o strops.o iofclose.o iopopen.o ioungetc.o peekc.o iogetc.o \ - ioputc.o iofeof.o ioferror.o - -STDIO_OBJECTS = stdfiles.o - -# These emulate stdio functionality, but with a different name (_IO_ungetc -# instead of ungetc), and using _IO_FILE instead of FILE. -# They are not needed for C++ iostream, nor stdio, though some stdio -# files are build using the same source files (see stdio/configure.in). -# They are needed for iostdio.h. They are needed under Linux to avoid -# version incompatibility problems with the C library. -# iofclose.o is not here, because it is needed for stdio (by pclose). -STDIO_WRAP_OBJECTS = iofdopen.o iofflush.o iofgets.o iofopen.o iofprintf.o iofputs.o iofwrite.o \ - iogets.o ioperror.o ioputs.o ioscanf.o iosetbuffer.o iosetvbuf.o \ - iosprintf.o iosscanf.o ioftell.o iovsscanf.o iovsprintf.o - -IOSTREAM_OBJECTS = builtinbuf.o filebuf.o fstream.o \ - indstream.o ioassign.o ioextend.o iomanip.o iostream.o \ - isgetline.o isgetsb.o isscan.o \ - osform.o procbuf.o sbform.o sbgetline.o sbscan.o \ - stdiostream.o stdstrbufs.o stdstreams.o stream.o streambuf.o strstream.o \ - PlotFile.o SFile.o parsestream.o pfstream.o editbuf.o - -# These files define _IO_read etc, which are just wrappers for read(2) etc. -# They need to be changed to use name-space-clean (e.g. __read) versions -# for each specific libc. -OSPRIM_OBJECTS = ioprims.o iostrerror.o cleanup.o - -LIBIOSTREAM_OBJECTS = $(IO_OBJECTS) $(IOSTREAM_OBJECTS) $(OSPRIM_OBJECTS) -LIBIO_OBJECTS = $(IO_OBJECTS) $(STDIO_WRAP_OBJECTS) $(OSPRIM_OBJECTS) \ - $(STDIO_OBJECTS) - -LIBIOSTREAM_DEP = $(LIBIOSTREAM_OBJECTS) -LIBIOSTREAM_USE = $(LIBIOSTREAM_OBJECTS) - -USER_INCLUDES = *.h - -PICFLAG = - -#### package, host, target, and site dependent Makefile fragments come in here. -## - -$(LIBIO_OBJECTS): $(_G_CONFIG_H) - -libio.a: $(_G_CONFIG_H) $(LIBIO_OBJECTS) - -rm -rf libio.a - $(AR) $(AR_FLAGS) libio.a $(LIBIO_OBJECTS) - $(RANLIB) libio.a - -libiostream.a: $(_G_CONFIG_H) $(LIBIOSTREAM_DEP) - -rm -rf libiostream.a - $(AR) $(AR_FLAGS) libiostream.a $(LIBIOSTREAM_USE) - $(RANLIB) libiostream.a - -test: test.o libio.a - $(CC) $(CFLAGS) -o test test.o libio.a -tpipe: tpipe.o libio.a - $(CC) $(CFLAGS) -o tpipe tpipe.o libio.a - -iostream.list: $(_G_CONFIG_H) $(LIBIOSTREAM_DEP) - @echo "$(LIBIOSTREAM_USE)"> iostream.list - -# The "pic" subdir must be created before we can put any object -# files into it. -$(LIBIOSTREAM_DEP) $(LIBIO_OBJECTS): stamp-picdir - -stmp-stdio: - @rootme=`pwd`/ ; export rootme; cd stdio ; \ - $(MAKE) $(FLAGS_TO_PASS) stdio.list - -_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 - -install: - rootme=`pwd`/ ; export rootme ; \ - if [ -z "$(MULTISUBDIR)" ]; then \ - if [ "$(_G_CONFIG_H)" != "" ]; then \ - if [ x$(enable_version_specific_runtime_libs) = xyes ]; then \ - rm -f $(gxx_include_dir)/_G_config.h ; \ - $(INSTALL_DATA) _G_config.h $(gxx_include_dir)/_G_config.h || exit 1; \ - else \ - rm -f $(tooldir)/include/_G_config.h ; \ - $(INSTALL_DATA) _G_config.h $(tooldir)/include/_G_config.h || exit 1; \ - fi; \ - else true; \ - fi ; \ - cd $(srcdir); \ - for FILE in $(USER_INCLUDES); do if [ $$FILE != _G_config.h ]; then \ - rm -f $(gxx_include_dir)/$$FILE ; \ - $(INSTALL_DATA) $$FILE $(gxx_include_dir)/$$FILE ; \ - chmod a-x $(gxx_include_dir)/$$FILE ; \ - else true; fi; done ; \ - else true; \ - fi - @rootme=`pwd`/ ; export rootme ; \ - $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install - -c++clean: - rm -rf $(IOSTREAM_OBJECTS) - @$(MAKE) $(FLAGS_TO_PASS) "DODIRS=tests" DO=clean subdir_do diff --git a/contrib/libio/NEWS b/contrib/libio/NEWS deleted file mode 100644 index 1f3b7781e2..0000000000 --- a/contrib/libio/NEWS +++ /dev/null @@ -1,57 +0,0 @@ -*** Major changes in libio for egcs: - -* Better support for Linux. - -* Dejagnu testsuite. - -*** Major changes in libio version 2.7.0: - -* The data representations of _IO_FILE and streambufs have been modified. - The layout of the jump-table table _IO_jumps_t has been re-arranged - to match that of a virtual function table of a streambuf. Therefore, - we no longer need a separate _IO_FILE::_jumps pointer; instead it can - be shared with the virtual function table pointer. In addition to - saving space, this also removes the overhead when double indirection - was needed, and there are many simplificatons (e.g. we no longer need - the builtinbuf class. - -* The streambuf::uflow virtual has been added, to match the standard. - -* The ifstream, ofstream, and fstream classes now include the filebuf - as a member, rather than being pointed to it. Various related changes. - -* Version number changed to generally follow libg++ (and gcc). - -*** Major changes in libio version 0.66 (released with libg++ 2.6.1): - -* Some documentation and an example in iostream.texi on how to derive - your own class from streambuf. - -* New functions added to stdio: getline, detdelim, snprintf, vsnprintf. - This is for compatibility with the GNU C library. - -*** Major changes in libio version 0.65 (released with libg++ 2.6): - -* _IO_getline and streambuf::sgetline no longer write a '\0' at the end. - -* A number of improvements to get closer to the ANSI/ISO C++ working -paper, such as: -- Added (preliminary support for) new ANSI streambuf::uflow virtual. -- Added istdiostream and ostdiostream classes. -- Added ostream::operator<<(bool) and istream::operator>>(bool&). - -* More robust (and faster) initialization and cleanup of standard streambufs. - -* Many small bug fixes, portability improvements, and random enhancements. - -*** Major changes in libio version 0.63 (released with libg++ 2.5.3): - -* There is a g++ bug that causes inconsistent name mangling for the -assembler name of the virtual function table for the istream class. -A work-around has been put into streambuf.h, which will make g++ -always do the right thing. Note that this may require you to -recompile programs that were incorrectly compiled by g++. - -* Functions that do printf-style formatting to the unbuffered -streams have been optimized to write to a temporary buffer. - diff --git a/contrib/libio/PlotFile.cc b/contrib/libio/PlotFile.cc deleted file mode 100644 index 98b2d83955..0000000000 --- a/contrib/libio/PlotFile.cc +++ /dev/null @@ -1,157 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -// This may look like C code, but it is really -*- C++ -*- -/* -Copyright (C) 1988, 1992, 1993 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - converted to use iostream library by Per Bothner (bothner@cygnus.com) - -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 GCC 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. */ - -#ifdef __GNUG__ -#pragma implementation -#endif -#include - -/* - PlotFile implementation module -*/ - - -PlotFile& PlotFile:: cmd(char c) -{ - ofstream::put(c); - return *this; -} - -PlotFile& PlotFile:: operator<<(const int x) -{ -#if defined(convex) - ofstream::put((char)(x>>8)); - ofstream::put((char)(x&0377)); -#else - ofstream::put((char)(x&0377)); - ofstream::put((char)(x>>8)); -#endif - return *this; -} - -PlotFile& PlotFile:: operator<<(const char *s) -{ - *(ofstream*)this << s; - return *this; -} - - -PlotFile& PlotFile:: arc(const int xi, const int yi, - const int x0, const int y0, - const int x1, const int y1) -{ - return cmd('a') << xi << yi << x0 << y0 << x1 << y1; -} - - -PlotFile& PlotFile:: box(const int x0, const int y0, - const int x1, const int y1) -{ - line(x0, y0, x0, y1); - line(x0, y1, x1, y1); - line(x1, y1, x1, y0); - return line(x1, y0, x0, y0); -} - -PlotFile& PlotFile:: circle(const int x, const int y, const int r) -{ - return cmd('c') << x << y << r; -} - -PlotFile& PlotFile:: cont(const int xi, const int yi) -{ - return cmd('n') << xi << yi; -} - -PlotFile& PlotFile:: dot(const int xi, const int yi, const int dx, - int n, const int* pat) -{ - cmd('d') << xi << yi << dx << n; - while (n-- > 0) *this << *pat++; - return *this; -} - -PlotFile& PlotFile:: erase() -{ - return cmd('e'); -} - -PlotFile& PlotFile:: label(const char* s) -{ - return cmd('t') << s << "\n"; -} - -PlotFile& PlotFile:: line(const int x0, const int y0, - const int x1, const int y1) -{ - return cmd('l') << x0 << y0 << x1 << y1; -} - -PlotFile& PlotFile:: linemod(const char* s) -{ - return cmd('f') << s << "\n"; -} - -PlotFile& PlotFile:: move(const int xi, const int yi) -{ - return cmd('m') << xi << yi; -} - -PlotFile& PlotFile:: point(const int xi, const int yi) -{ - return cmd('p') << xi << yi; -} - -PlotFile& PlotFile:: space(const int x0, const int y0, - const int x1, const int y1) -{ - return cmd('s') << x0 << y0 << x1 << y1; -} diff --git a/contrib/libio/PlotFile.h b/contrib/libio/PlotFile.h deleted file mode 100644 index 82b08bc468..0000000000 --- a/contrib/libio/PlotFile.h +++ /dev/null @@ -1,89 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* - a very simple implementation of a class to output unix "plot" - format plotter files. See corresponding unix man pages for - more details. - - written by Doug Lea (dl@rocky.oswego.edu) - converted to use iostream library by Per Bothner (bothner@cygnus.com) -*/ - -#ifndef _PlotFile_h -#ifdef __GNUG__ -#pragma interface -#endif -#define _PlotFile_h - -#include - -/* - Some plot libraries have the `box' command to draw boxes. Some don't. - `box' is included here via moves & lines to allow both possiblilties. -*/ - -extern "C++" { -class PlotFile : public ofstream -{ -protected: - PlotFile& cmd(char c); - PlotFile& operator << (const int x); - PlotFile& operator << (const char *s); - -public: - - PlotFile() : ofstream() { } - PlotFile(int fd) : ofstream(fd) { } - PlotFile(const char *name, int mode=ios::out, int prot=0664) - : ofstream(name, mode, prot) { } - -// PlotFile& remove() { ofstream::remove(); return *this; } - -// int filedesc() { return ofstream::filedesc(); } -// const char* name() { return File::name(); } -// void setname(const char* newname) { File::setname(newname); } -// int iocount() { return File::iocount(); } - - PlotFile& arc(const int xi, const int yi, - const int x0, const int y0, - const int x1, const int y1); - PlotFile& box(const int x0, const int y0, - const int x1, const int y1); - PlotFile& circle(const int x, const int y, const int r); - PlotFile& cont(const int xi, const int yi); - PlotFile& dot(const int xi, const int yi, const int dx, - int n, const int* pat); - PlotFile& erase(); - PlotFile& label(const char* s); - PlotFile& line(const int x0, const int y0, - const int x1, const int y1); - PlotFile& linemod(const char* s); - PlotFile& move(const int xi, const int yi); - PlotFile& point(const int xi, const int yi); - PlotFile& space(const int x0, const int y0, - const int x1, const int y1); -}; -} // extern "C++" -#endif diff --git a/contrib/libio/README b/contrib/libio/README deleted file mode 100644 index c2d564965c..0000000000 --- a/contrib/libio/README +++ /dev/null @@ -1,30 +0,0 @@ -This is libio, the GNU C/C++ input/output library. - -By default, the library is configured to build the C++ iostream -facility (in $libdir/libiostream.a). - -The library can be configured to build the C stdio facility -that is part of a C run-time library. - -This library is distributed with libg++; see ../libg++/README -for installation instructions, and where to send bug reports -and questions. - -* Copyright restrictions - -The files in this directory are generally covered by the GNU Public -License (which is in the file ../COPYING), but modified with the -following: - - 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. - -A few source files and subroutines are covered by other (but -less restrictive) copyright conditions. E.g. some code (such -as iovfprintf.c) is based on software that was developed by the -University of California, Berkeley, for the Berkeley Software -Distribution (BSD-4.4), and bears their copyright; and one -file (floatconv.c) is derived from ("free") code copyrighted AT&T. diff --git a/contrib/libio/SFile.cc b/contrib/libio/SFile.cc deleted file mode 100644 index e5daa64569..0000000000 --- a/contrib/libio/SFile.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* -Copyright (C) 1988 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of the GNU C++ Library. This 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. This library is distributed in the hope -that 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 this library; if not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifdef __GNUG__ -#pragma implementation -#endif -#include - -SFile::SFile(const char *filename, int size, int mode, int prot) -: fstream(filename, mode, prot) -{ - sz = size; -} - -SFile::SFile(int fd, int size) -: fstream(fd) -{ - sz = size; -} - -void SFile::open(const char *name, int size, int mode, int prot) -{ - fstream::open(name, mode, prot); - sz = size; -} - -SFile& SFile::get(void* x) -{ - read(x, sz); - return *this; -} - -SFile& SFile::put(void* x) -{ - write(x, sz); - return *this; -} - -SFile& SFile::operator[](long i) -{ - if (rdbuf()->pubseekoff(i * sz, ios::beg) == EOF) - set(ios::badbit); - return *this; -} diff --git a/contrib/libio/SFile.h b/contrib/libio/SFile.h deleted file mode 100644 index f07277cee4..0000000000 --- a/contrib/libio/SFile.h +++ /dev/null @@ -1,55 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1988, 1992, 1993 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) - -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 _SFile_h -#ifdef __GNUG__ -#pragma interface -#endif -#define _SFile_h 1 - -#include - -extern "C++" { -class SFile: public fstream -{ - protected: - int sz; // unit size for structured binary IO - -public: - SFile() : fstream() { } - SFile(int fd, int size); - SFile(const char *name, int size, int mode, int prot=0664); - void open(const char *name, int size, int mode, int prot=0664); - - int size() { return sz; } - int setsize(int s) { int old = sz; sz = s; return old; } - - SFile& get(void* x); - SFile& put(void* x); - SFile& operator[](long i); -}; -} // extern "C++" - -#endif diff --git a/contrib/libio/builtinbuf.cc b/contrib/libio/builtinbuf.cc deleted file mode 100644 index 05e65a5c37..0000000000 --- a/contrib/libio/builtinbuf.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#ifdef __GNUC__ -#pragma implementation -#endif -#define _STREAM_COMPAT -#include "builtinbuf.h" -#include "iostreamP.h" -#if !_IO_UNIFIED_JUMPTABLES -int builtinbuf::overflow(int ch) { return _IO_OVERFLOW (this, ch); } - -int builtinbuf::underflow() { return _IO_UNDERFLOW (this); } - -streamsize builtinbuf::xsgetn(char* buf, streamsize n) -{ return _IO_XSGETN (this, buf, n); } - -streamsize builtinbuf::xsputn(const char* buf, streamsize n) -{ return _IO_XSPUTN (this, buf, n); } - -int builtinbuf::doallocate() { return _IO_DOALLOCATE (this); } - -builtinbuf::~builtinbuf() { _IO_FINISH (this); } - -int builtinbuf::sync() { return _IO_SYNC (this); } - -streambuf* builtinbuf::setbuf(char *buf, int n) -{ return (streambuf*)_IO_SETBUF (this, buf, n); } - -streampos builtinbuf::seekoff(streamoff off, _seek_dir dir, int mode) -{ - return _IO_SEEKOFF (this, off, dir, mode); -} - -streampos builtinbuf::seekpos(streampos pos, int mode) -{ - return _IO_SEEKPOS (this, pos, mode); -} - -int builtinbuf::pbackfail(int c) -{ return _IO_PBACKFAIL (this, c); } - -streamsize builtinbuf::sys_read(char* buf, streamsize size) -{ return _IO_SYSREAD (this, buf, size); } - -streampos builtinbuf::sys_seek(streamoff off, _seek_dir dir) -{ return _IO_SYSSEEK (this, off, dir); } - -streamsize builtinbuf::sys_write(const char* buf, streamsize size) -{ return _IO_SYSWRITE (this, buf, size); } - -int builtinbuf::sys_stat(void* buf) // Actually, a (struct stat*) -{ return _IO_SYSSTAT (this, buf); } - -int builtinbuf::sys_close() -{ return _IO_SYSCLOSE (this); } -#endif diff --git a/contrib/libio/builtinbuf.h b/contrib/libio/builtinbuf.h deleted file mode 100644 index 3aa4c37a65..0000000000 --- a/contrib/libio/builtinbuf.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#ifndef _BUILTINBUF_H -#define _BUILTINBUF_H - -#ifdef __GNUC__ -#pragma interface -#endif - -#include - -#if !_IO_UNIFIED_JUMPTABLES -// A builtinbuf is a streambuf where all the virtual operations -// call the _IO_jump_t table. - -extern "C++" { -class builtinbuf : public streambuf { - friend ios; - virtual int overflow(int); - virtual int underflow(); - virtual streamsize xsgetn(char *, streamsize); - virtual streamsize xsputn(const char *, streamsize); - virtual streambuf* setbuf(char*, int); - virtual int doallocate(); - virtual ~builtinbuf(); - virtual int sync(); - - virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); - virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out); - virtual int pbackfail(int c); - virtual streamsize sys_read(char* buf, streamsize size); - virtual streampos sys_seek(streamoff, _seek_dir); - virtual streamsize sys_write(const char*, streamsize); - virtual int sys_stat(void*); // Actually, a (struct stat*) - virtual int sys_close(); -#if 0 - virtual int get_column(); - virtual int set_column(int); -#endif - private: - builtinbuf() { } -}; -} // extern "C++" -#endif - -#endif /* _BUILTINBUF_H */ diff --git a/contrib/libio/cleanup.c b/contrib/libio/cleanup.c deleted file mode 100644 index 691fa838b2..0000000000 --- a/contrib/libio/cleanup.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "libioP.h" -#if _G_HAVE_ATEXIT -#include - -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/contrib/libio/config.shared b/contrib/libio/config.shared deleted file mode 100644 index 6cda566eb7..0000000000 --- a/contrib/libio/config.shared +++ /dev/null @@ -1,499 +0,0 @@ -# Copyright (C) 1993, 1995, 1997, 1998 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 GNU CC; see the file COPYING. If not, write to -# the Free Software Foundation, 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. */ - -# File descriptor usage: -# 1: All macros which need to be re-definable by any target fragments -# 2: All generic rules; especially those which use re-defined macros, e.g. _G_CONFIG_H! - -# Significant variables: - -# Note that TO_TOPDIR does *not* include multilib. -test -z "${TO_TOPDIR}" && TO_TOPDIR=${TOLIBGXX}../ -# Native configurations build target libraries in directories at the same -# level as the rest of the tree. Cross configurations build target libraries -# one level deeper. TO_REAL_TOPDIR accounts for this. -# Obviously, TO_REAL_TOPDIR can only be used in the build tree. -if [ "${with_target_subdir}" != "." ] ; then - TO_REAL_TOPDIR="${TO_TOPDIR}../" -else - TO_REAL_TOPDIR="${TO_TOPDIR}" -fi -DOING_LIBGXX=${DOING_LIBGXX-false} -THIS_FILE="${srcdir}/${TOLIBIO}config.shared" - -echo "# Start of package fragment generated by ${THIS_FILE}." -echo "" -echo >&2 "# Start of package rules fragment generated by ${THIS_FILE}." -echo >&2 "" - -# Multilib support. -echo 'MULTISRCTOP =' -echo 'MULTIBUILDTOP =' -echo 'MULTIDIRS =' -echo 'MULTISUBDIR =' -echo 'MULTIDO = true' -echo 'MULTICLEAN = true' -echo '' - -# TOLIBGXX -# MOSTLYCLEAN -# CLEAN -# DISTCLEAN -# REALCLEAN -# SUBDIRS [defaults to (configdirs)] -# INFO_FILES List of (basenames of) texinfo files -# INFO_SUBDIRS [default: empty] sub-directories containing documentation - -# ??? This doesn't appear to be used by us or any of our callers. -# Note that all uses in this file are single-quoted. -rootme=${rootme-`pwd`} - -# libg++ uses the convention that $rootme includes a trailing '/'. -# We use that in the definition of TOPDIR. $rootme is either empty -# or an absolute pathname to the current directory (with trailing '/'). -TOPDIR=${TOPDIR-'$${rootme}$(MULTIBUILDTOP)'${TO_REAL_TOPDIR}} -echo '#' TOPDIR="${TOPDIR} invsubdir=${invsubdir} subdir=${subdir}" -SUBDIRS=${SUBDIRS-${configdirs}} -CHECK_SUBDIRS=${CHECK_SUBDIRS-${SUBDIRS}} - -echo "srcdir = ${srcdir}" -echo "SUBDIRS = ${SUBDIRS}" -echo "CHECK_SUBDIRS = ${CHECK_SUBDIRS}" - -echo "prefix = ${prefix-/usr/local}" -echo "exec_prefix = ${exec_prefix-'${prefix}'}" - -echo 'bindir = $(exec_prefix)/bin' -echo 'libdir = $(exec_prefix)/lib' -echo 'libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)' - -echo 'datadir = $(prefix)/lib' -echo 'mandir = $(prefix)/man' -echo 'man1dir = $(mandir)/man1' -echo 'man2dir = $(mandir)/man2' -echo 'man3dir = $(mandir)/man3' -echo 'man4dir = $(mandir)/man4' -echo 'man5dir = $(mandir)/man5' -echo 'man6dir = $(mandir)/man6' -echo 'man7dir = $(mandir)/man7' -echo 'man8dir = $(mandir)/man8' -echo 'man9dir = $(mandir)/man9' - -echo 'infodir = $(prefix)/info' -echo 'includedir = $(prefix)/include' -echo 'docdir = $(datadir)/doc' -echo '' -echo 'SHELL = /bin/sh' -echo '' -case "$srcdir" in - /*) echo 'INSTALL = $(srcdir)'/"${TO_TOPDIR}install-sh -c" ;; - .) echo 'INSTALL = $${rootme}'"${with_multisrctop}${TO_REAL_TOPDIR}install-sh -c" ;; - *) echo 'INSTALL = $${rootme}$(srcdir)'/"${TO_TOPDIR}install-sh -c" ;; -esac -echo 'INSTALL_PROGRAM = $(INSTALL)' -echo 'INSTALL_DATA = $(INSTALL)' -echo '' -echo 'AR = `if [ -f' ${TOPDIR}'binutils/ar ] ; \' -echo " then echo ${TOPDIR}binutils/ar ; "'\' -echo ' else echo ar ; fi`' -echo 'AR_FLAGS = rc' -echo 'RANLIB = `if [ -f' ${TOPDIR}'binutils/ranlib ] ; \' -echo ' then echo '${TOPDIR}'binutils/ranlib ; \' -echo ' else echo ranlib ; fi`' -echo 'NM = `if [ -f' ${TOPDIR}'binutils/nm.new ] ; \' -echo ' then echo '${TOPDIR}'binutils/nm.new ; \' -echo ' else echo nm ; fi`' -echo 'NLMCONV = `if [ -f' ${TOPDIR}'binutils/nlmconv ] ; \' -echo ' then echo '${TOPDIR}'binutils/nlmconv ; \' -echo ' else echo nlmconv ; fi`' -echo 'LD = `if [ -f' ${TOPDIR}'ld/ld.new ] ; \' -echo ' then echo '${TOPDIR}'ld/ld.new ; \' -echo ' else echo ld ; fi`' -echo '' -echo 'MAKEINFO = `if [ -f '${TOPDIR}'texinfo/C/makeinfo ] ; \' -echo ' then echo '${TOPDIR}'texinfo/C/makeinfo ; \' -echo ' else echo makeinfo ; fi`' -case "$srcdir" in - .) echo 'TEXIDIR = '"${with_multisrctop}${TO_REAL_TOPDIR}texinfo" ;; - *) echo 'TEXIDIR = $(srcdir)'/"${TO_TOPDIR}texinfo" ;; -esac -echo 'TEXI2DVI = TEXINPUTS=${TEXIDIR}:$$TEXINPUTS texi2dvi' -echo '' -echo 'CC = cc' -echo 'CXX = gcc' -echo '' -# FIXME!!! -if true ; then - echo 'WRAP_C_INCLUDES =' -else - echo 'WRAP_C_INCLUDES = -I$(srcdir)'/${TOLIBGXX}g++-include -fi -echo 'CFLAGS = -g' -echo 'CXXFLAGS = -g -O' -echo 'LIBCFLAGS = $(CFLAGS)' -echo 'LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates' -if [ "${LIBDIR}" = "yes" ]; then - echo 'PICDIR = stamp-picdir' -else - echo 'PICDIR = ' -fi - -if test "${DOING_LIBGXX}" = "true" ; then - echo "TOLIBGXX = ${TOLIBGXX}" - echo 'PROTODIR = $(srcdir)'/${TOLIBGXX}src/gen - echo "LIBS = -L./${TOLIBGXX} -L./${TOLIBGXX}../libstdc++ -lg++ -lstdc++" - - # You can override iostream (e.g. in a site- or host-Makefile fragment) to: - # iostream (Normal iostream library) - # old-stream (Old stream library; no longer supported) - # no-stream (If you don't want iostream to be part of libg++) - echo 'IO_DIR = ../libio' - echo '# IO_DIR = no-stream' -elif test "${DOING_GPERF}" = "true" ; then - echo "IO_DIR = libio" - echo "LIBS = -L${TO_TOPDIR}libstdc++ -lstdc++" -fi - -if [ -z "${ALL}" ] ; then - if [ -n "${TARGETLIB}" ] ; then - ALL='$(TARGETLIB)' - echo "TARGETLIB = ${TARGETLIB}" - elif [ -n "${TARGETPROG}" ] ; then - ALL='${TARGETPROG}' - echo "TARGETPROG = ${TARGETPROG}" - else - echo "config error: neither ALL, TARGETLIB or TARGETPROG is defined" 1>&2 - fi -fi - -echo >&2 "all: ${ALL} multi-all" -if [ "${SUBDIRS}" != "" ] ; then - echo >&2 ' @rootme=`pwd`/; export rootme; \' - echo >&2 ' $(MAKE) "DODIRS=$(SUBDIRS)" DO=all $(FLAGS_TO_PASS) subdir_do' -fi -if [ "${LIBDIR}" = "yes" ]; then - echo >&2 "${ALL} "'multi-all: $(PICDIR)' -fi -echo >&2 '.PHONY: all' -echo >&2 '' - -echo >&2 '.PHONY: multi-all' -echo >&2 'multi-all:' -echo >&2 ' @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all' -echo >&2 '' - -echo >&2 -if [ "${SUBDIRS}" != "" ] ; then - echo >&2 '.PHONY: subdir_do' - echo >&2 'subdir_do: force' - echo >&2 ' @rootme=`pwd`/; export rootme; \' - echo >&2 ' for i in $(DODIRS); do \' - echo >&2 ' if [ -f ./$$i/Makefile ] ; then \' - echo >&2 ' echo "cd $$i; make $(DO) ..." ; \' - echo >&2 ' (cd $$i ; $(MAKE) $(FLAGS_TO_PASS) $(DO)) || exit 1 ; \' - echo >&2 ' else true ; fi ; \' - echo >&2 ' done' - echo >&2 '' - echo >&2 '# List of variables to pass to sub-makes. This should not be needed' - echo >&2 '# by GNU make or Sun make (both of which pass command-line variable' - echo >&2 '# overrides thouh $(MAKE)) but may be needed by older versions.' - echo >&2 '' - echo >&2 'FLAGS_TO_PASS= \' - echo >&2 ' "SHELL=$(SHELL)" \' - echo >&2 ' "INSTALL=$(INSTALL)" \' - echo >&2 ' "INSTALL_DATA=$(INSTALL_DATA)" \' - echo >&2 ' "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \' - echo >&2 ' "prefix=$(prefix)" \' - echo >&2 ' "exec_prefix=$(exec_prefix)" \' - echo >&2 ' "tooldir=$(tooldir)" \' - echo >&2 ' "gxx_include_dir=$(gxx_include_dir)" \' - echo >&2 ' "libsubdir=$(libsubdir)" \' - echo >&2 ' "gcc_version=$(gcc_version)" \' - echo >&2 ' "gcc_version_trigger=$(gcc_version_trigger)" \' - echo >&2 ' "AR=$(AR)" \' - echo >&2 ' "AR_FLAGS=$(AR_FLAGS)" \' - echo >&2 ' "CC=$(CC)" \' - echo >&2 ' "CXX=$(CXX)" \' - echo >&2 ' "CFLAGS=$(CFLAGS)" \' - echo >&2 ' "CXXFLAGS=$(CXXFLAGS)" \' - echo >&2 ' "NM=$(NM)" \' - echo >&2 ' "RANLIB=$(RANLIB)" \' - echo >&2 ' "LIBCFLAGS=$(LIBCFLAGS)" \' - echo >&2 ' "LIBCXXFLAGS=$(LIBCXXFLAGS)" \' - echo >&2 ' "LOADLIBES=$(LOADLIBES)" \' - echo >&2 ' "LDFLAGS=$(LDFLAGS)" \' - echo >&2 ' "MAKEINFO=$(MAKEINFO)" \' - echo >&2 ' "SHLIB=$(SHLIB)" \' - echo >&2 ' "SHCURSES=$(SHCURSES)" \' - echo >&2 ' "RUNTESTFLAGS=$(RUNTESTFLAGS)"' -fi - -echo >&2 'NOSTDINC = -nostdinc++' -if test -n "${XCXXINCLUDES}" ; then - echo >&2 "CXXINCLUDES = ${XCXXINCLUDES} "'$(NOSTDINC)' -elif test "${DOING_LIBGXX}" = "true" ; then - echo >&2 'CXXINCLUDES = $(NOSTDINC) -I. -I'"${TO_TOPDIR}libio"' -I$(srcdir) -I$(srcdir)/'"${TOLIBGXX}"'$(IO_DIR) -I$(srcdir)/'"${TOLIBGXX}"'../libstdc++ -I$(srcdir)/'"${TOLIBGXX}src"' '"${host_includes}"' $(WRAP_C_INCLUDES)' -fi -if test -n "${XCINCLUDES}" ; then - echo >&2 "CINCLUDES = ${XCINCLUDES}" -elif test "${DOING_LIBGXX}" = "true" ; then - echo >&2 'CINCLUDES =' -fi - -if [ "${LIBDIR}" = "yes" ]; then - echo >&2 'XCFLAGS = $(LIBCFLAGS)' - echo >&2 'XCXXFLAGS = $(LIBCXXFLAGS)' -else - echo >&2 'XCFLAGS = $(CFLAGS)' - echo >&2 'XCXXFLAGS = $(CXXFLAGS)' -fi - -echo >&2 '.SUFFIXES: .o .C .cc .c' -echo >&2 'COMPILE.c = $(CC) -c $(XCFLAGS) $(CINCLUDES) $(MT_CFLAGS)' -echo >&2 '.c.o:' -if [ "${LIBDIR}" = "yes" ]; then -echo >&2 ' test x"$(enable_shared)" != xyes ||\' -echo >&2 ' $(COMPILE.c) $(PICFLAG) $< -o pic/$@' -fi -echo >&2 ' $(COMPILE.c) $<' -[ "${TOUCH_ON_COMPILE}" = "yes" ] && echo >&2 ' @touch stamp' -echo >&2 'COMPILE.cc = $(CXX) -c $(XCXXFLAGS) $(CXXINCLUDES) $(MT_CFLAGS)' -echo >&2 '.C.o:' -if [ "${LIBDIR}" = "yes" ]; then -echo >&2 ' test x"$(enable_shared)" != xyes ||\' -echo >&2 ' $(COMPILE.cc) $(PICFLAG) $< -o pic/$@' -fi -echo >&2 ' $(COMPILE.cc) $<' -[ "${TOUCH_ON_COMPILE}" = "yes" ] && echo >&2 ' @touch stamp' -echo >&2 '.cc.o:' -if [ "${LIBDIR}" = "yes" ]; then -echo >&2 ' test x"$(enable_shared)" != xyes || \' -echo >&2 ' $(COMPILE.cc) $(PICFLAG) $< -o pic/$@' -fi -echo >&2 ' $(COMPILE.cc) $<' -[ "${TOUCH_ON_COMPILE}" = "yes" ] && echo >&2 ' @touch stamp' -echo >&2 '' - -if [ -n "${TARGETLIB}" ] ; then - echo TARGETLIB = ${TARGETLIB} -fi -if [ -n "${TARGETPROG}" ] ; then - echo TARGETPROG = ${TARGETPROG} -fi - -if [ "${LIBDIR}" = "yes" ]; then - echo >&2 '' - echo >&2 'stamp-picdir:' - echo >&2 ' if [ x"$(enable_shared)" = xyes ] && [ ! -d pic ]; then \' - echo >&2 ' mkdir pic; \' - echo >&2 ' else true; fi' - echo >&2 ' touch stamp-picdir' -fi - -echo >&2 '' -echo >&2 '.PHONY: install' -echo >&2 'install:' -echo >&2 '.PHONY: check' -if [ "${CHECK}" != "check" ] ; then - echo >&2 "check: ${ALL} ${CHECK}" - if [ "${CHECK_SUBDIRS}" != "" ] ; then - echo >&2 ' rootme=`pwd`/; export rootme; \' - echo >&2 ' SAVE_LLPATH="$${SAVE_LLPATH-$$LD_LIBRARY_PATH}"; export SAVE_LLPATH; \' - echo >&2 ' LD_LIBRARY_PATH="$${rootme}${TOLIBGXX}../libstdc++:$${rootme}${TOLIBGXX}../libg++:$$SAVE_LLPATH"; \' - echo >&2 ' export LD_LIBRARY_PATH; \' - echo >&2 ' $(MAKE) "DODIRS=$(CHECK_SUBDIRS)" DO=check $(FLAGS_TO_PASS) subdir_do' - fi -fi - -# Generate rules for documentation (depending on INFO_FILES and INFO_SUBDIRS). - -echo >&2 '.PHONY: info dvi install-info clean-info' - -# emit the rule for 'info' -# (Note that the top-level ../Makefile.in greps for '^info:' when making -# a release (in "make taz"), so don't break that!) -if [ -z "${INFO_FILES}" ] ; then - echo >&2 'info:' -else - echo >&2 info: `for file in ${INFO_FILES} ; do echo $file.info ; done` -fi -if [ "${INFO_SUBDIRS}" != "" ] ; then - echo >&2 ' @rootme=`pwd`/; export rootme; \ - $(MAKE) "DODIRS='${INFO_SUBDIRS}'" DO=info $(FLAGS_TO_PASS) subdir_do' -fi - -# emit the rule for 'dvi' -if [ -z "${INFO_FILES}" ] ; then - echo >&2 'dvi:' -else - echo >&2 dvi: `for file in ${INFO_FILES} ; do echo $file.dvi ; done` -fi -if [ "${INFO_SUBDIRS}" != "" ] ; then - echo >&2 ' @rootme=`pwd`/; export rootme; \ - $(MAKE) "DODIRS='${INFO_SUBDIRS}'" DO=dvi $(FLAGS_TO_PASS) subdir_do' -fi - -# Emit rules for each *.info and *.dvi file -for file in ${INFO_FILES} ; do - echo >&2 ${file}.info: '$(srcdir)'/${file}.texi - echo >&2 ' $(MAKEINFO) -I$(srcdir) -I$(TEXIDIR) $(srcdir)/'${file}.texi -o ${file}.info - echo >&2 ${file}.dvi: '$(srcdir)'/${file}.texi - echo >&2 ' $(TEXI2DVI) $(srcdir)'/${file}.texi - echo >&2 "${file}.ps: ${file}.dvi" - echo >&2 " dvips ${file} -o" -done - -# emit the rule for install-info -echo >&2 'install-info:' -if [ -n "${INFO_FILES}" ] ; then - echo >&2 ' -parent=`echo $(infodir)|sed -e' "'"'s@/[^/]*$$@@'"'"'`; \' - echo >&2 ' if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi' - echo >&2 ' -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; fi' - echo >&2 ' for i in *.info* ; do \' - echo >&2 ' $(INSTALL_DATA) $$i $(infodir)/$$i ; \' - echo >&2 ' done' -fi -if [ "${INFO_SUBDIRS}" != "" ] ; then - echo >&2 ' @rootme=`pwd`/; export rootme; \ - $(MAKE) "DODIRS='${INFO_SUBDIRS}'" DO=install-info $(FLAGS_TO_PASS) subdir_do' -fi - -# emit clean-info and clean-dvi rules -echo >&2 '.PHONY: do-clean-info clean-info do-clean-dvi clean-dvi' -echo >&2 do-clean-info: -if [ -n "${INFO_FILES}" ] ; then - echo >&2 ' rm -f *.info*' -fi -echo >&2 'do-clean-dvi:' -if [ -n "${INFO_FILES}" ] ; then - echo >&2 ' rm -f *.dvi *.aux *.cp *.cps *.fn* *.ky *.log *.pg *.toc *.tp *.vr' -fi -for type in info dvi ; do - echo >&2 clean-${type}: do-clean-${type} - if [ "${INFO_SUBDIRS}" != "" ] ; then - echo >&2 ' @rootme=`pwd`/; export rootme; \ - $(MAKE) "DODIRS='${NFO_SUBDIRS}'" DO=clean-'${type} '$(FLAGS_TO_PASS) subdir_do' - fi -done - -echo >&2 '' - -echo >&2 '.PHONY: boltcc' -echo >&2 'boltcc:' -echo >&2 ' rootme=`pwd`/ ; export rootme ; $(MAKE) $(FLAGS_TO_PASS)' -echo >&2 '' - -# Emit clean rules - -echo >&2 '' -echo >&2 '# clean rules' - -MOSTLYCLEAN="${MOSTLYCLEAN-*.o pic stamp-picdir core ${EXTRA_MOSTLYCLEAN}} `if test -n "${TOUCH_ON_COMPILE}"; then echo stamp; else true; fi`" -CLEAN="${CLEAN-${TARGETPROG} ${TARGETLIB}}" -DISTCLEAN="${DISTCLEAN-config.status Makefile *~ Make.pack target-mkfrag multilib.out ${EXTRA_DISTCLEAN-}}" -REALCLEAN="${REALCLEAN-depend *.info*}" - - -echo >&2 '.PHONY: mostlyclean clean distclean maintainer-clean realclean' -if test -z "${SUBDIRS}" ; then - echo >&2 "mostlyclean: clean-dvi" - echo >&2 " rm -rf ${MOSTLYCLEAN}" - echo >&2 ' @$(MULTICLEAN) multi-clean DO=mostlyclean' - echo >&2 "clean: clean-dvi" - echo >&2 " rm -rf ${MOSTLYCLEAN} ${CLEAN}" - echo >&2 ' @$(MULTICLEAN) multi-clean DO=clean' - echo >&2 "distclean: clean" - echo >&2 ' @$(MULTICLEAN) multi-clean DO=distclean' - echo >&2 " rm -rf ${DISTCLEAN}" - echo >&2 "maintainer-clean realclean: clean clean-info" - echo >&2 ' @$(MULTICLEAN) multi-clean DO=maintainer-clean' - echo >&2 " rm -rf ${DISTCLEAN} ${REALCLEAN}" -else - echo >&2 '.PHONY: do-clean subdir_distclean subdir_maintainer_clean' - echo >&2 "mostlyclean: do-clean-dvi" - echo >&2 " rm -rf ${MOSTLYCLEAN}" - echo >&2 ' @$(MAKE) $(FLAGS_TO_PASS) "DODIRS=$(SUBDIRS)" DO=mostlyclean subdir_do' - echo >&2 ' @$(MULTICLEAN) multi-clean DO=mostlyclean' - echo >&2 "do-clean: do-clean-dvi" - echo >&2 " rm -rf ${MOSTLYCLEAN} ${CLEAN}" - echo >&2 "clean: do-clean" - echo >&2 ' @$(MAKE) $(FLAGS_TO_PASS) "DODIRS=$(SUBDIRS)" DO=clean subdir_do' - echo >&2 ' @$(MULTICLEAN) multi-clean DO=clean' - # distclean and maintainer-clean are tricky because they remove the Makefile. - echo >&2 "subdir_distclean:" - echo >&2 ' @$(MAKE) $(FLAGS_TO_PASS) "DODIRS=$(SUBDIRS)" DO=distclean subdir_do' - echo >&2 "distclean: do-clean subdir_distclean" - echo >&2 ' @$(MULTICLEAN) multi-clean DO=distclean' - echo >&2 " rm -rf ${DISTCLEAN}" - echo >&2 "subdir_maintainer_clean:" - echo >&2 ' @$(MAKE) $(FLAGS_TO_PASS) "DODIRS=$(SUBDIRS)" DO=maintainer-clean subdir_do' - echo >&2 "maintainer-clean realclean: do-clean subdir_maintainer_clean do-clean-info" - echo >&2 ' @$(MULTICLEAN) multi-clean DO=maintainer-clean' - echo >&2 " rm -rf ${DISTCLEAN} ${REALCLEAN}" -fi - -echo >&2 '' -echo >&2 '.PHONY: force' -echo >&2 'force:' -echo >&2 '' -echo >&2 '# with the gnu make, this is done automatically.' -echo >&2 '' -echo >&2 'Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) $(gcc_version_trigger)' -echo >&2 ' $(SHELL) ./config.status' -echo >&2 '' -echo >&2 '.NOEXPORT:' -echo >&2 'MAKEOVERRIDES=' - -cat >&2 <<"EOF" -DEPEND_SOURCES = ${srcdir}/*.cc ${srcdir}/*.c -depend.new: -# The sed script below attempts to make the depend output portable. -# It cleans up the depenency information generated by cpp. -# It replaces instances of $(srcdir)/ by the string '$(srcdir)/'. -# It removes remaining absolute files names (such as /usr/include/stdio.h). -# It removes lines containing only "\\". -# It inserts '$(MULTISRCTOP)' in '$(srcdir)/..'. -# In order to support SunOS VPATH, $(srcdir)/[a-z]*.{c,cc} is replaced with -# [a-z]*.{c,cc} (the directory part is removed). -# The awk script removes a continuation marker that is followed by -# a blank line, since that may confuse make. - echo "# AUTOMATICALLY GENERATED BY 'make depend' - DO NOT EDIT" \ - >depend.new - $(CXX) -M $(CXXINCLUDES) $(DEPEND_SOURCES) \ - | sed -e 's|$(srcdir)/|$$(srcdir)/|g' \ - -e 's| [^ ]*_G_config.h| $$(_G_CONFIG_H)|g' \ - -e 's| /[^ ]*||g' -e 's| libc-lock\.h||' \ - -e '/^[ ]*\\$$/d' -e 's/^[ ]*$$//' \ - | sed -e 's|$$(srcdir)/[.][.]|$$(srcdir)/$$(MULTISRCTOP)..|g' \ - -e 's|$$(srcdir)/\([^/]*[.]c\)|\1|' \ - | awk 'BEGIN { prev = "" } \ - /^( )*$$/ { if (prev ~ /\\$$/) \ - { prev = substr(prev,1,length(prev)-1); next } } \ - { print prev; prev = $$0 } \ - END { if (prev !~ /^( )*$$/) print prev }' \ - >> depend.new -$(srcdir)/depend: depend.new - mv depend.new $(srcdir)/depend -EOF - -if [ -f ${srcdir}/${subdir}/depend ] ; then - cat ${srcdir}/${subdir}/depend >&2 -fi - -echo "# End of package fragment generated by ${THIS_FILE}." -echo >&2 "# End of package rules fragment generated by ${THIS_FILE}." diff --git a/contrib/libio/config/hpux.mt b/contrib/libio/config/hpux.mt deleted file mode 100644 index fc95afa64f..0000000000 --- a/contrib/libio/config/hpux.mt +++ /dev/null @@ -1,3 +0,0 @@ -# Flags to pass to gen-params when building _G_config.h. -# For example: G_CONFIG_ARGS = size_t="unsigned long" -G_CONFIG_ARGS = DOLLAR_IN_LABEL=1 diff --git a/contrib/libio/config/isc.mt b/contrib/libio/config/isc.mt deleted file mode 100644 index 15cbb8c36c..0000000000 --- a/contrib/libio/config/isc.mt +++ /dev/null @@ -1,4 +0,0 @@ -# Flags to pass to gen-params when building _G_config.h. -# For example: G_CONFIG_ARGS = size_t="unsigned long" -G_CONFIG_ARGS = pid_t="unsigned short" \ - gid_t="unsigned short" uid_t="unsigned short" diff --git a/contrib/libio/config/linux.mt b/contrib/libio/config/linux.mt deleted file mode 100644 index 9e3c519ed1..0000000000 --- a/contrib/libio/config/linux.mt +++ /dev/null @@ -1,25 +0,0 @@ -# Use the libio which comes with the local libc. - -# Comment this out to avoid including the stdio functions in libiostream.a: -# LIBIOSTREAM_OBJECTS = $(IO_OBJECTS) $(IOSTREAM_OBJECTS) $(STDIO_WRAP_OBJECTS) $(OSPRIM_OBJECTS) -# LIBIOSTREAM_DEP = $(LIBIOSTREAM_OBJECTS) stdio.list -# LIBIOSTREAM_USE = $(LIBIOSTREAM_OBJECTS) `cat stdio.list` - -# Comment the above and uncomment the below to use the code in the Linux libc: -# We have _G_config.h in /usr/include. -_G_CONFIG_H= - -# We must not see the libio.h file from this library. -LIBIO_INCLUDE= - -# We have those in libc.a. -IO_OBJECTS= iogetline.o -STDIO_WRAP_OBJECTS= -OSPRIM_OBJECTS= -STDIO_OBJECTS= - -# We have the rest in /usr/include. -USER_INCLUDES=PlotFile.h SFile.h builtinbuf.h editbuf.h fstream.h \ - indstream.h iomanip.h iostream.h istream.h ostream.h \ - parsestream.h pfstream.h procbuf.h stdiostream.h stream.h \ - streambuf.h strfile.h strstream.h diff --git a/contrib/libio/config/linuxaxp1-libc-lock.h b/contrib/libio/config/linuxaxp1-libc-lock.h deleted file mode 100644 index 2523a0d515..0000000000 --- a/contrib/libio/config/linuxaxp1-libc-lock.h +++ /dev/null @@ -1,112 +0,0 @@ -/* libc-internal interface for mutex locks. LinuxThreads version. - Copyright (C) 1996 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 _LIBC_LOCK_H -#define _LIBC_LOCK_H 1 - -#include -#define __libc_lock_t pthread_mutex_t - -/* Define a lock variable NAME with storage class CLASS. The lock must be - initialized with __libc_lock_init before it can be used (or define it - with __libc_lock_define_initialized, below). Use `extern' for CLASS to - declare a lock defined in another module. In public structure - definitions you must use a pointer to the lock structure (i.e., NAME - begins with a `*'), because its storage size will not be known outside - of libc. */ -#define __libc_lock_define(CLASS,NAME) \ - CLASS __libc_lock_t NAME; - -/* Define an initialized lock variable NAME with storage class CLASS. */ -#define __libc_lock_define_initialized(CLASS,NAME) \ - CLASS __libc_lock_t NAME = PTHREAD_MUTEX_INITIALIZER; - -/* Initialize the named lock variable, leaving it in a consistent, unlocked - state. */ -#define __libc_lock_init(NAME) \ - (__pthread_mutex_init != NULL ? __pthread_mutex_init (&(NAME), NULL) : 0); - -/* Same as last but this time we initialize a recursive mutex. */ -#define __libc_lock_init_recursive(NAME) \ - do { \ - if (__pthread_mutex_init != NULL) \ - { \ - pthread_mutexattr_t __attr; \ - __pthread_mutexattr_init (&__attr); \ - __pthread_mutexattr_setkind_np (&__attr, PTHREAD_MUTEX_RECURSIVE_NP); \ - __pthread_mutex_init (&(NAME), &__attr); \ - __pthread_mutexattr_destroy (&__attr); \ - } \ - } while (0); - -/* Finalize the named lock variable, which must be locked. It cannot be - used again until __libc_lock_init is called again on it. This must be - called on a lock variable before the containing storage is reused. */ -#define __libc_lock_fini(NAME) \ - (__pthread_mutex_destroy != NULL ? __pthread_mutex_destroy (&(NAME)) : 0); - -/* Lock the named lock variable. */ -#define __libc_lock_lock(NAME) \ - (__pthread_mutex_lock != NULL ? __pthread_mutex_lock (&(NAME)) : 0); - -/* Try to lock the named lock variable. */ -#define __libc_lock_trylock(NAME) \ - (__pthread_mutex_trylock != NULL ? __pthread_mutex_trylock (&(NAME)) : 0); - -/* Unlock the named lock variable. */ -#define __libc_lock_unlock(NAME) \ - (__pthread_mutex_unlock != NULL ? __pthread_mutex_unlock (&(NAME)) : 0); - -/* Start critical region with cleanup. */ -#define __libc_cleanup_region_start(FCT, ARG) \ - { struct _pthread_cleanup_buffer _buffer; \ - if (_pthread_cleanup_push_defer != NULL) { \ - _pthread_cleanup_push_defer (&_buffer, (FCT), (ARG)); \ - } - -/* End critical region with cleanup. */ -#define __libc_cleanup_region_end(DOIT) \ - if (_pthread_cleanup_push_defer != NULL) { \ - _pthread_cleanup_pop_restore (&_buffer, (DOIT)); \ - } \ - } - -/* Make the pthread functions weak so that we can elide them from - single-threaded processes. */ -#pragma weak __pthread_mutex_init -#pragma weak __pthread_mutex_destroy -#pragma weak __pthread_mutex_lock -#pragma weak __pthread_mutex_trylock -#pragma weak __pthread_mutex_unlock -#pragma weak __pthread_mutexattr_init -#pragma weak __pthread_mutexattr_destroy -#pragma weak __pthread_mutexattr_setkind_np -#pragma weak __pthread_key_create -#pragma weak __pthread_setspecific -#pragma weak __pthread_getspecific -#pragma weak __pthread_initialize -#pragma weak _pthread_cleanup_push_defer -#pragma weak _pthread_cleanup_pop_restore - -/* We need portable names for some functions. E.g., when they are - used as argument to __libc_cleanup_region_start. */ -#define __libc_mutex_unlock __pthread_mutex_unlock - -#endif /* libc-lock.h */ - diff --git a/contrib/libio/config/linuxaxp1-stdio-lock.h b/contrib/libio/config/linuxaxp1-stdio-lock.h deleted file mode 100644 index cbee76867d..0000000000 --- a/contrib/libio/config/linuxaxp1-stdio-lock.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Thread package specific definitions of stream lock type. - Copyright (C) 1996, 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. */ - -#include - -typedef pthread_mutex_t _IO_lock_t; - -/* We need recursive (counting) mutexes. */ -#define _IO_lock_initializer PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP - - -#define _IO_cleanup_region_start(_fct, _fp) \ - __libc_cleanup_region_start (_fct, _fp) -#define _IO_cleanup_region_end(_doit) \ - __libc_cleanup_region_end (_doit) -#define _IO_lock_init(_name) \ - __libc_lock_init_recursive (_name) -#define _IO_lock_fini(_name) \ - __libc_lock_fini_recursive (_name) - diff --git a/contrib/libio/config/linuxaxp1.mt b/contrib/libio/config/linuxaxp1.mt deleted file mode 100644 index d9b7e8c7e9..0000000000 --- a/contrib/libio/config/linuxaxp1.mt +++ /dev/null @@ -1,10 +0,0 @@ -# We _do_ need a new _G_config.h -_G_CONFIG_H=_G_config.h - -# And the two bits files. -all: -install: install-axp-mt-headers - -install-axp-mt-headers: - $(INSTALL_DATA) libc-lock.h $(gxx_include_dir)/libc-lock.h - $(INSTALL_DATA) stdio-lock.h $(gxx_include_dir)/stdio-lock.h diff --git a/contrib/libio/config/linuxlibc1.mt b/contrib/libio/config/linuxlibc1.mt deleted file mode 100644 index 742cbf1853..0000000000 --- a/contrib/libio/config/linuxlibc1.mt +++ /dev/null @@ -1,26 +0,0 @@ -# Use the libio which comes with the local libc. - -# Comment this out to avoid including the stdio functions in libiostream.a: -# LIBIOSTREAM_OBJECTS = $(IO_OBJECTS) $(IOSTREAM_OBJECTS) $(STDIO_WRAP_OBJECTS) $(OSPRIM_OBJECTS) -# LIBIOSTREAM_DEP = $(LIBIOSTREAM_OBJECTS) stdio.list -# LIBIOSTREAM_USE = $(LIBIOSTREAM_OBJECTS) `cat stdio.list` - -# We must not see the libio.h file from this library. -LIBIO_INCLUDE= - -# We have those in libc.a. -IO_OBJECTS=iogetc.o ioputc.o iofeof.o ioferror.o \ - filedoalloc.o fileops.o genops.o iofclose.o \ - iovsprintf.o iovsscanf.o strops.o iogetline.o -STDIO_WRAP_OBJECTS= -OSPRIM_OBJECTS= -STDIO_OBJECTS= - -# We have the rest in /usr/include. -USER_INCLUDES=PlotFile.h SFile.h builtinbuf.h editbuf.h fstream.h \ - indstream.h iomanip.h iostream.h istream.h ostream.h \ - parsestream.h pfstream.h procbuf.h stdiostream.h stream.h \ - streambuf.h strfile.h strstream.h libio.h - -# A bad kludge -MT_CFLAGS=-D_G_HAVE_MMAP -D_G_STDIO_USES_LIBIO -D_G_HAVE_WEAK_SYMBOL diff --git a/contrib/libio/config/mn10200.mt b/contrib/libio/config/mn10200.mt deleted file mode 100644 index 71e7916765..0000000000 --- a/contrib/libio/config/mn10200.mt +++ /dev/null @@ -1,3 +0,0 @@ -# Flags to pass to gen-params when building _G_config.h. -# For example: G_CONFIG_ARGS = size_t="unsigned long" -G_CONFIG_ARGS = NO_USE_DTOA=1 USE_INT32_FLAGS=1 diff --git a/contrib/libio/config/mtsafe.mt b/contrib/libio/config/mtsafe.mt deleted file mode 100644 index 5848851be8..0000000000 --- a/contrib/libio/config/mtsafe.mt +++ /dev/null @@ -1,2 +0,0 @@ -# tell we want the mt-safe version -MT_CFLAGS = -D_IO_MTSAFE_IO diff --git a/contrib/libio/config/netware.mt b/contrib/libio/config/netware.mt deleted file mode 100644 index 339a865717..0000000000 --- a/contrib/libio/config/netware.mt +++ /dev/null @@ -1,16 +0,0 @@ -IMPDIR= $(srcdir)/config/netware - -PRELUDE= prelude.o - -iostream.def: Makefile - -rm -f iostream.def - echo "description \"libiostream\"" >> iostream.def - echo "screenname \"NONE\"" >> iostream.def - echo "version `echo $(VERSION) | sed 's|\.|,|g'`" >> iostream.def - echo "export @$(IMPDIR)/iostream.imp" >> iostream.def - -iostream.O: $(PRELUDE) $(LIBIOSTREAM_OBJECTS) - $(CC) -Xlinker -Ur -o $@ $(PRELUDE) $(LIBIOSTREAM_OBJECTS) - -iostream.nlm: iostream.def iostream.O $(IMPDIR)/iostream.imp - $(NLMCONV) -l $(LD) -T iostream.def iostream.O iostream.nlm diff --git a/contrib/libio/config/sco4.mt b/contrib/libio/config/sco4.mt deleted file mode 100644 index 1d8f6f189c..0000000000 --- a/contrib/libio/config/sco4.mt +++ /dev/null @@ -1,3 +0,0 @@ -# Flags to pass to gen-params when building _G_config.h. -# For example: G_CONFIG_ARGS = size_t="unsigned long" -G_CONFIG_ARGS = MATH_H_INLINES=1 diff --git a/contrib/libio/configure.in b/contrib/libio/configure.in deleted file mode 100644 index ac494296fe..0000000000 --- a/contrib/libio/configure.in +++ /dev/null @@ -1,199 +0,0 @@ -# This file is a shell script fragment that supplies the information -# necessary for a configure script to process the program in -# this directory. For more information, look at ../configure. - -# If the language specific compiler does not exist, but the "gcc" directory -# does, we do not build anything. Note, $r is set by the top-level Makefile. -# Note that when we look for the compiler, we search both with and without -# extension to handle cross and canadian cross builds. -# Note that if $norecursion is set we're being called from config.status, -# so don't check for the compiler; we might be doing a make clean. -compiler_name=cc1plus -rm -f skip-this-dir -if test -n "$r" && [ -z "$norecursion" ] ; then - if test -d "$r"/gcc; then - if test -f "$r"/gcc/$compiler_name \ - || test -f "$r"/gcc/$compiler_name.exe; then - true - else - echo "rm -f multilib.out" > skip-this-dir - fi - fi -fi - -if [ "${srcdir}" = "." ] ; then - if [ "${with_target_subdir}" != "." ] ; then - topsrcdir=${with_multisrctop}../.. - else - topsrcdir=${with_multisrctop}.. - fi -else - topsrcdir=${srcdir}/.. -fi - -if [ -d ${topsrcdir}/gcc ] ; then - configdirs="tests dbz stdio testsuite" -else - configdirs="tests dbz stdio" -fi -srctrigger=libioP.h -srcname="input/output library" -package_makefile_frag=Make.pack -package_makefile_rules_frag=Make.pack.r - -# per-host: - -# per-target: - -echo "# Warning: this fragment is automatically generated" > temp.mt -frags= - -case "${target}" in - *-hpux*) frags=hpux.mt ;; - alpha*-*-linux-gnulibc1) - frags="linux.mt linuxaxp1.mt mtsafe.mt" ;; - powerpc*-*-linux-gnulibc1) - frags="linux.mt linuxaxp1.mt mtsafe.mt" ;; - *-linux-gnulibc1) - frags=linuxlibc1.mt ;; - *-linux-gnu) frags="linux.mt mtsafe.mt" ;; - *-sco3.2v[45]*) frags=sco4.mt ;; - *-isc*) frags=isc.mt ;; - *-netware*) frags=netware.mt ;; - *) frags=${target_cpu}.mt ;; -esac - -case "${enable_shared}" in - yes) shared=yes ;; - no) shared=no ;; - *libio*) shared=yes ;; - *) shared=no ;; -esac - -if [ "${shared}" = "yes" ]; then - case "${target}" in - alpha*-*-linux*) frags="${frags} ../../config/mh-elfalphapic" ;; - arm*-*-*) frags="${frags} ../../config/mh-armpic" ;; - hppa*-*-*) frags="${frags} ../../config/mh-papic" ;; - i[3456]86-*-*) frags="${frags} ../../config/mh-x86pic" ;; - powerpc*-*-aix*) ;; - powerpc*-*-*) frags="${frags} ../../config/mh-ppcpic" ;; - *-*-*) frags="${frags} ../../config/mh-${target_cpu}pic" ;; - esac -fi - -# Take care of header file lossage. -case "${target}" in - alpha*-*-linux-gnulibc1) - # For some reason stdio-lock.h is not installed on Red Hat systems. - # Further, libc-lock.h needs to define the pthreads stuff weak, and - # fails to do this for other than _LIBC. Install our own versions - # of these files. - cp ${srcdir}/config/linuxaxp1-libc-lock.h libc-lock.h - cp ${srcdir}/config/linuxaxp1-stdio-lock.h stdio-lock.h - ;; - powerpc*-*-linux-gnulibc1) - # For some reason stdio-lock.h is not installed on Red Hat systems. - # Further, libc-lock.h needs to define the pthreads stuff weak, and - # fails to do this for other than _LIBC. Install our own versions - # of these files. - cp ${srcdir}/config/linuxaxp1-libc-lock.h libc-lock.h - cp ${srcdir}/config/linuxaxp1-stdio-lock.h stdio-lock.h - ;; - *-linux-gnu) - # We have a correct libc-lock.h in glibc 2.1 but not all glibc 2.0. - # Create a wrapper if necessary. - (echo "#include " | ${CC-cc} -E -) >/dev/null 2>&1 || - { - echo "#include_next " > libc-lock.h - echo 'asm (".weak _pthread_cleanup_pop_restore");' >> libc-lock.h - echo 'asm (".weak _pthread_cleanup_push_defer");' >> libc-lock.h - - } - ;; -esac - -for frag in ${frags}; do - case ${frag} in - ../* ) - if [ ${srcdir} = . ]; then - [ -n "${with_target_subdir}" ] && frag=../${frag} - [ -n "${with_multisrctop}" ] && frag=${with_multisrctop}${frag} - fi - ;; - esac - frag=${srcdir}/config/$frag - if [ -f ${frag} ]; then - echo "Appending ${frag} to target-mkfrag" - echo "# Following fragment copied from ${frag}" >> temp.mt - cat ${frag} >> temp.mt - fi -done - -target_makefile_frag=target-mkfrag -${moveifchange} temp.mt target-mkfrag - -LIBDIR=yes -TO_TOPDIR=../ -ALL='$(_G_CONFIG_H) libio.a libiostream.a iostream.list' -case "${target}" in - *-*-cygwin*) - XCINCLUDES='-I. -I$(srcdir) -I$(srcdir)/../winsup/include' - XCXXINCLUDES='-I. -I$(srcdir) -I$(srcdir)/../winsup/include' - ;; - *) - XCINCLUDES='-I. -I$(srcdir)' - XCXXINCLUDES='-I. -I$(srcdir)' - ;; -esac -MOSTLYCLEAN='*.o pic stamp-picdir core iostream.list' -DISTCLEAN='config.status Makefile *~ Make.pack target-mkfrag multilib.out' -CLEAN='_G_config.h *.a' -INFO_FILES=iostream -if [ -n "${with_cross_host}" -a -d ${topsrcdir}/gcc ]; then - CHECK_SUBDIRS=testsuite -fi -(. ${srcdir}/config.shared) >${package_makefile_frag} 2>${package_makefile_rules_frag} - -# post-target: - -# If cross-compiling, we install in $(tooldir)/lib or in $(libsubdir) -# depending on --enable-version-specific-runtime-libs. -if [ -n "${with_cross_host}" ] ; then - rm -f Makefile.tem - sed \ - -e 's|\(^[ ]*INSTALLDIR[ ]*=[ ]*\)\$(libdir)|\1$(tooldir)/lib|' \ - Makefile >Makefile.tem - mv -f Makefile.tem Makefile -fi - -. ${topsrcdir}/config-ml.in - -gxx_include_dir= -# Specify the g++ header file directory -# Check whether --with-gxx-include-dir or --without-gxx-include-dir was given. -if test "${with_gxx_include_dir+set}" = set; then - withval="$with_gxx_include_dir" - case "${withval}" in - yes) - echo "configure.in: error: bad value ${withval} given for g++ include directory" 1>&2 - exit 1 - ;; - no) ;; - *) gxx_include_dir=$with_gxx_include_dir ;; - esac -fi - -if test x${gxx_include_dir} = x; then - if test x${enable_version_specific_runtime_libs} = xyes; then - gxx_include_dir='${libsubdir}/include/g++' - else - . ${topsrcdir}/config.if - gxx_include_dir='${prefix}/include/g++'-${libstdcxx_interface} - fi -fi - -rm -f Makefile.tem -sed -e "s%^gxx_include_dir[ ]*=.*$%gxx_include_dir=${gxx_include_dir}%" \ - Makefile >Makefile.tem -mv -f Makefile.tem Makefile diff --git a/contrib/libio/dbz/Makefile.in b/contrib/libio/dbz/Makefile.in deleted file mode 100644 index 0fd9564141..0000000000 --- a/contrib/libio/dbz/Makefile.in +++ /dev/null @@ -1,218 +0,0 @@ -srcdir = . -CFLAGS = -g -C_FLAGS = $(CFLAGS) -I$(srcdir) -I.. -I$(srcdir)/.. -DDBZ_FINISH='_IO_flush_all()' -CC = `if [ -f ../../../gcc/gcc ] ; \ - then echo ../../../gcc/gcc -B../../../gcc/ ; \ - else echo gcc ; fi` -LIBIO = ../libio.a ../../libiberty/libiberty.a -LIBS = $(LIBIO) -# LIBS = ../libcnews.a -DBM = -RFC = -DHAVERFCIZE -CASE = case.o -DEBUG = -DDBZDEBUG -LINTFLAGS = -h $(DEBUG) $(RFC) -I$(srcdir) -LDFLAGS = -# =()@>()= -NEWSBIN = /usr/lib/newsbin -# workaround for System V make bug -SHELL = /bin/sh - -# database sizes for performance tests, regression, and regression prime-find -TSIZE=12007 -RSIZE=4019 -RPSIZE=2679 - -#### host and target dependent Makefile fragments come in here. -## - -# history files for regression and performance tests -RHIST=hist3.3 -R2HIST=hist10 -THIST=hist13 - -#all: dbz -all: -install: -install-info: -info: - -check: r - $(MAKE) rclean - -bininstall: dbz - cp dbz $(NEWSBIN) - -cmp: dbz - cmp dbz $(NEWSBIN)/dbz - -newsinstall: - : nothing - -u: dbz.o - ar ruv ../libcnews.a dbz.o - cmp dbz.h ../h/dbz.h - -t: tdbz fake - -lint: - lint $(LINTFLAGS) dbzmain.c dbz.c - -.c.o: - $(CC) $(C_FLAGS) -c $< - -rdbz.o: rdbz.c - $(CC) $(C_FLAGS) $(DEBUG) -DDEFSIZE=$(RSIZE) -c rdbz.c - -rdbzmain.o: rdbzmain.c - $(CC) $(C_FLAGS) $(RFC) -c rdbzmain.c - -tdbz.o: $(srcdir)/dbz.c - cp $(srcdir)/dbz.c tdbz.c - $(CC) $(C_FLAGS) -DDEFSIZE=$(TSIZE) -c tdbz.c - rm tdbz.c - -dbz: dbzmain.o $(CASE) - $(CC) $(LDFLAGS) dbzmain.o $(CASE) $(PRE) $(DBM) $(LIBS) $(POST) -o $@ - -tdbz: dbzmain.o tdbz.o $(CASE) - $(CC) $(LDFLAGS) dbzmain.o tdbz.o $(CASE) $(PRE) $(LIBS) $(POST) -o $@ - -rdbz: rdbzmain.o rdbz.o $(CASE) - $(CC) $(LDFLAGS) rdbzmain.o rdbz.o $(CASE) $(PRE) $(LIBS) $(POST) -o $@ - -fake: fake.o random.o - $(CC) $(LDFLAGS) fake.o random.o $(PRE) $(LIBS) $(POST) -o $@ - -byteflip: byteflip.o - $(CC) $(LDFLAGS) byteflip.o $(PRE) $(LIBS) $(POST) -o $@ - -hist10: fake - ./fake -t -e 75 10000 >$@ - -hist3.3: fake - ./fake -t -e 75 3300 >$@ - -hist13: fake - ./fake -t -e 75 13000 >$@ - -r: $(srcdir)/getmap $(srcdir)/revbytes $(srcdir)/altbytes stamp-r8 - : success! - -stamp-r0: - : 'WARNING: creates about 2MB of debris; do "make rclean" afterward' - rm -f dbase dbase[23] dbase.* dbase[23].* - test ! -d xx || rmdir xx - @touch stamp-r0 - -stamp-r1: $(RHIST) $(R2HIST) stamp-r0 - : crude check of synthetic history file - ( sed 25q $(RHIST) ; tail -25 $(RHIST) ) >histjunk - cmp histjunk $(srcdir)/firstlast25 - rm histjunk - @touch stamp-r1 - -r2a: rdbz stamp-r1 - : basic tests, exercising as many options as possible - cp $(RHIST) dbase - mkdir xx - chmod -w xx - ./rdbz -E 1000 -0 -M -i -S -u -U -C xx dbase - rmdir xx - sed '/> 0/d' $(RHIST) >dbase.used - test "`cat dbase.used | wc -l`" -eq "`sed -n '2s/ .*//p' dbase.dir`" ; - -stamp-r2: r2a - cp $(RHIST) dbase2 - ./rdbz -E 1000 -0 -p $(RPSIZE) -t ' ' dbase2 - cmp $(RHIST) dbase - cmp dbase dbase2 - cmp dbase.dir dbase2.dir - cmp dbase.pag dbase2.pag - ./rdbz -E 1000 -0 -c dbase - ./rdbz -E 1000 -0 -c -i -q -M -U dbase - @touch stamp-r2 - -stamp-r3: stamp-r2 - : build a database and then add to it - sed 1000q $(RHIST) >dbase2 - sed 1,1000d $(RHIST) >dbase2.add - ./rdbz -E 1000 -0 dbase2 - ./rdbz -E 1000 -0 -a dbase2 dbase2.add - cmp dbase dbase2 - cmp dbase.dir dbase2.dir - cmp dbase.pag dbase2.pag - @touch stamp-r3 - -stamp-r4: stamp-r3 - : build based on existing one, test extraction and readonly files - ./rdbz -E 1000 -0 -f dbase dbase2 - test "`cat dbase.used | wc -l`" -eq "`awk 'NR==2{print $$1}' dbase2.dir`" ; - test "`cat dbase.used | wc -l`" -eq "`awk 'NR==2{print $$2}' dbase2.dir`" ; - chmod -w dbase2.dir dbase2.pag - ./rdbz -E 1000 -x dbase2 dbase >dbase.temp - cmp dbase.used dbase.temp - @touch stamp-r4 - -stamp-r5: stamp-r4 - : try some small case perversions - sed 's/\(@[^ ]*\)A/\1a/' dbase >dbase.ick - ./rdbz -E 1000 -x dbase2 dbase.ick >dbase.temp - cmp dbase.used dbase.temp - sed -n 's/A\([^ ]*@\)/a\1/p' dbase >dbase.ick - ./rdbz -x dbase2 dbase.ick >dbase.temp - test ! -s dbase.temp ; - rm -f dbase2.dir dbase2.pag - @touch stamp-r5 - -stamp-r6: stamp-r5 - : try it without tags, case-insensitive, with case perversions - ./rdbz -E 1000 -0 -p '0 b 1' dbase2 - tr 'ABCDEFGHIJKLMnopqrstuvwxyz' 'abcdefghijklmNOPQRSTUVWXYZ' dbase.ick - ./rdbz -E 1000 -x dbase2 dbase.ick >dbase.temp - cmp dbase.used dbase.temp - rm -f dbase.temp dbase.ick - @touch stamp-r6 - -stamp-r7: byteflip stamp-r6 - : test various perversions of byte ordering - awk -f $(srcdir)/revbytes dbase.dir >dbase2.dir - ./byteflip `$(srcdir)/getmap dbase.dir` `$(srcdir)/getmap dbase2.dir` dbase2.pag - cp dbase dbase2 - ./rdbz -E 1000 -0 -c dbase2 - awk -f $(srcdir)/altbytes dbase.dir >dbase2.dir - dd conv=swab dbase2.pag - ./rdbz -E 1000 -0 -c dbase2 - cp dbase2 dbase3 - ./rdbz -E 1000 -0 -f dbase2 dbase3 - ./rdbz -E 1000 -0 -c dbase3 - test " `$(srcdir)/getmap dbase2.dir`" = " `$(srcdir)/getmap dbase3.dir`" ; - @touch stamp-r7 - -stamp-r8: stamp-r7 - : test massive overflow, throw in case sensitivity and tag mask - cp $(R2HIST) dbase - ./rdbz -E 1000 -0 -p '0 0 7ffc0000' dbase - ./rdbz -E 1000 -0 -cq dbase - sed 100q dbase | egrep '[aA].* ' | tr aA Aa >dbase.ick - ./rdbz -x dbase dbase.ick >dbase.temp - test ! -s dbase.temp ; - @touch stamp-r8 - -rclean: - rm -f dbase dbase[23] dbase.* dbase[23].* fake fake.o random.o - rm -f rdbz rdbz.o rdbzmain.o $(RHIST) $(R2HIST) byteflip byteflip.o - rm -f histjunk core stamp-r? *~ - test ! -d xx || rmdir xx - -mostlyclean: rclean - rm -f *.o [a-z]dbz [a-z][a-z]dbz junk* PostScript.out - rm -f hist* dbase* *.bak mon.out gmon.out core dbm.h - -clean: mostlyclean - rm -f dbz - -distclean: clean - rm -rf Makefile config.status rdbz.c rdbzmain.c - -maintainer-clean realclean: distclean diff --git a/contrib/libio/dbz/README b/contrib/libio/dbz/README deleted file mode 100644 index e7fa8765ad..0000000000 --- a/contrib/libio/dbz/README +++ /dev/null @@ -1,25 +0,0 @@ -The dbz package was "liberated" from C News. -It is included with the GNU libio because it provides -a fairly good work-out for a stdio implementation. -The Makefile.in, configure.in, and stdio.h have been -set up to test libio. - ------- - -This is the new, improved, lemon-freshened :-) dbz. - -Just "make" will get you dbz.o and the dbz program. "make r" runs an -extensive set of regression tests; most of the mysterious oddments lying -around here are to do with that. "make rclean" cleans up after "make r". - -You probably want to inspect the #ifdef list early in dbz.c before -compiling, although the defaults should work all right on most systems. - -If you are not building this as part of C News, you will need to change -the -I option in FLAGS in the Makefile to "-I.", and delete the DBMLIBS -and RFC lines entirely. That will break some of the regression tests; -at some point I'll fix this. - -If you are using this independently from C News, you probably still want -to look through ../notebook/problems, as some of the portability problems -described in there can affect dbz. diff --git a/contrib/libio/dbz/altbytes b/contrib/libio/dbz/altbytes deleted file mode 100644 index 26cc9fb9e0..0000000000 --- a/contrib/libio/dbz/altbytes +++ /dev/null @@ -1,7 +0,0 @@ -NR == 1 { - printf "%s %s %s %s %s %s %s %s %s", $1, $2, $3, $4, $5, $6, $7, $8, $9 - for (i = 10; i <= NF; i += 2) - printf " %s %s", $(i+1), $i - printf "\n" -} -NR > 1 { print } diff --git a/contrib/libio/dbz/byteflip.c b/contrib/libio/dbz/byteflip.c deleted file mode 100644 index d54c6591fa..0000000000 --- a/contrib/libio/dbz/byteflip.c +++ /dev/null @@ -1,38 +0,0 @@ -#include - -#define MAXWORD 32 - -int -main(argc, argv) -int argc; -char *argv[]; -{ - register int len; - int inmap[MAXWORD]; - int outmap[MAXWORD]; - char in[MAXWORD]; - char out[MAXWORD]; - register int i; - register int a; - - a = 1; - len = atoi(argv[a++]); - if (len > MAXWORD) - abort(); /* kind of drastic... */ - for (i = 0; i < len; i++) - inmap[i] = atoi(argv[a++]); - if (atoi(argv[a++]) != len) - abort(); - for (i = 0; i < len; i++) - outmap[i] = atoi(argv[a++]); - - while (fread(in, 1, len, stdin) == len) { - for (i = 0; i < len; i++) - out[outmap[i]] = in[inmap[i]]; - fwrite(out, 1, len, stdout); - } -#ifdef DBZ_FINISH - DBZ_FINISH; -#endif - exit(0); -} diff --git a/contrib/libio/dbz/case.c b/contrib/libio/dbz/case.c deleted file mode 100644 index 87b741ff54..0000000000 --- a/contrib/libio/dbz/case.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * case-mapping stuff - * - * We exploit the fact that we are dealing only with headers here, and - * headers are limited to the ASCII characters by RFC822. It is barely - * possible that we might be dealing with a translation into another - * character set, but in particular it's very unlikely for a header - * character to be outside -128..255. - * - * Life would be a whole lot simpler if tolower() could safely and portably - * be applied to any char. - */ -#include -#include "string.h" -#include "case.h" - -/* note that case.h knows the value of OFFSET */ -#define OFFSET 128 /* avoid trouble with negative chars */ -#define MAPSIZE (256+OFFSET) -char casemap[MAPSIZE]; /* relies on init to '\0' */ -static int primed = 0; /* has casemap been set up? */ - -/* - - prime - set up case-mapping stuff - */ -static void -prime() -{ - register char *lp; - register char *up; - register int c; - register int i; - static char lower[] = "abcdefghijklmnopqrstuvwxyz"; - static char upper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - - for (lp = lower, up = upper; *lp != '\0'; lp++, up++) { - c = *lp; - casemap[c+OFFSET] = c; - casemap[*up+OFFSET] = c; - } - for (i = 0; i < MAPSIZE; i++) - if (casemap[i] == '\0') - casemap[i] = (char)(i-OFFSET); - primed = 1; -} - -/* - - cistrncmp - case-independent strncmp - */ -int /* < == > 0 */ -cistrncmp(s1, s2, len) -char *s1; -char *s2; -int len; -{ - register char *p1; - register char *p2; - register int n; - - if (!primed) - prime(); - - p1 = s1; - p2 = s2; - n = len; - while (--n >= 0 && *p1 != '\0' && TOLOW(*p1) == TOLOW(*p2)) { - p1++; - p2++; - } - if (n < 0) - return(0); - - /* - * The following case analysis is necessary so that characters - * which look negative collate low against normal characters but - * high against the end-of-string NUL. - */ - if (*p1 == '\0' && *p2 == '\0') - return(0); - else if (*p1 == '\0') - return(-1); - else if (*p2 == '\0') - return(1); - else - return(TOLOW(*p1) - TOLOW(*p2)); -} - -/* - - rfc822ize - do the bizarre case conversion needed for rfc822 message-ids - * - * Actually, this is not quite complete. Absolute, total, full RFC822 - * compliance requires a horrible parsing job, because of the arcane - * quoting conventions -- abc"def"ghi is not equivalent to abc"DEF"ghi, - * for example. There are three or four things that might occur in the - * domain part of a message-id that are case-sensitive. They don't seem - * to ever occur in real news, thank Cthulhu. (What? You were expecting - * a merciful and forgiving deity to be invoked in connection with RFC822? - * Forget it; none of them would come near it.) - */ -char * /* returns the argument */ -rfc822ize(s) -char *s; -{ - register char *p; - static char post[] = "postmaster"; - static int postlen = sizeof(post)-1; - - if (!primed) - prime(); - - p = strrchr(s, '@'); - if (p == NULL) /* no local/domain split */ - p = ""; /* assume all local */ - else if (p - (s+1) == postlen && CISTREQN(s+1, post, postlen)) { - /* crazy special case -- "postmaster" is case-insensitive */ - p = s; - } -#ifdef NONSTANDARD -#ifdef RFCVIOLATION -#ifdef B_2_11_MISTAKE - p = s; /* all case-insensitive */ -#endif -#endif -#endif - for (; *p != '\0'; p++) - *p = TOLOW(*p); - - return(s); -} diff --git a/contrib/libio/dbz/case.h b/contrib/libio/dbz/case.h deleted file mode 100644 index d5ef696155..0000000000 --- a/contrib/libio/dbz/case.h +++ /dev/null @@ -1,12 +0,0 @@ -extern int cistrncmp(); -extern char *rfc822ize(); - -extern char casemap[]; - -/* must call cistrncmp before invoking TOLOW... */ -#define TOLOW(c) (casemap[(c)+128]) /* see case.c for why 128 */ - -/* ...but the use of it in CISTREQN is safe without the preliminary call (!) */ -/* CISTREQN is an optimised case-insensitive strncmp(a,b,n)==0; n > 0 */ -#define CISTREQN(a, b, n) \ - (TOLOW((a)[0]) == TOLOW((b)[0]) && cistrncmp(a, b, n) == 0) diff --git a/contrib/libio/dbz/configure.in b/contrib/libio/dbz/configure.in deleted file mode 100644 index 4cb9b57ce0..0000000000 --- a/contrib/libio/dbz/configure.in +++ /dev/null @@ -1,17 +0,0 @@ -# This file is a shell script fragment that supplies the information -# necessary for a configure script to process the program in -# this directory. For more information, look at ../configure. - -configdirs= -srctrigger=dbzmain.c -srcname="libio dbz test" - -# per-host: - -# per-target: - -files="dbz.c dbzmain.c" -links="rdbz.c rdbzmain.c" - -# post-target: - diff --git a/contrib/libio/dbz/dbz.1 b/contrib/libio/dbz/dbz.1 deleted file mode 100644 index d2fff17af9..0000000000 --- a/contrib/libio/dbz/dbz.1 +++ /dev/null @@ -1,221 +0,0 @@ -.TH DBZ 1 "11 Feb 1992" -.BY "C News" -.SH NAME -dbz \- operate on dbz databases of text -.SH SYNOPSIS -.B dbz -[ -.BR \- { axmc } -] [ -.B \-t -c -] [ -.B \-l -length -] [ -.BR \- { qiue } -] [ -.B \-f -old -] [ -.B \-p -parms -] database file ... -.SH DESCRIPTION -.I Dbz -is a shell-level interface to the -.IR dbz (3z) -database routines for indexed access to a text file. -.PP -The -.I database -file must be a text file, -one line per database record, -with the key the first field on the line. -The -.B \-t -option sets the field-separator character; the default is tab. -Setting the separator character to NUL (with -.BR "\-t\ ''" ) -makes the whole line the key. -Lines must not exceed 1023 bytes in length including the newline; -this limit can be increased with the -.B \-l -option. -The limitations and restrictions of -.IR dbz (3z) -must also be observed; -in particular, it remains the user's responsibility to ensure that -no attempt is made to store two entries (whether identical or not) -with the same key. -.PP -In the absence of options, -.I dbz -creates a -.IR dbz (3z) -index for the database; -the index comprises files -.IB database .pag -and -.IB database .dir -in the same directory. -Any previous index is silently overwritten. -The -.BR \-a , -.BR \-x , -.BR \-m , -and -.B \-c -options specify other operations. -.PP -With -.BR \-a , -.I dbz -appends lines from the -.IR file (s) -(standard input if none) -to the database, updating both the -text file and the indexes. -.PP -With -.BR \-x , -.I dbz -reads keys from the -.IR file (s) -(standard input if none) -and prints (on standard output) the corresponding lines, if any, -from the database. -The input is in the form of database lines, although only the keys are -significant. -The -.B \-q -option makes -.B \-x -print the input lines whose keys are found instead of the database -lines; this is somewhat faster. -.PP -With -.BR \-m , -operation is the same as for -.B \-x -except that the keys which are \fInot\fR present in the database are printed. -.PP -With -.BR \-c , -.I dbz -checks the database for internal consistency. -The -.B \-q -option causes this check to be done more quickly but less thoroughly -(each key is looked up in the index, but no check is made to be sure -that the index entry points to the right place). -.PP -The -.B \-i -option suppresses the use of -.IR dbz (3z)'s -.I incore -facility. -This makes accesses slower, but keeps the files current -during updating -and reduces -startup/shutdown overhead. -.PP -Normally, -.I dbz -checks whether a key is already in the database before adding it. -The -.B \-u -option suppresses this check, speeding things up at the expense of safety. -.PP -A new index is normally created with default size, -case mapping, and tagging. -The default size is right for 90-100,000 records. -The default case mapping is right for RFC822 message-ids. -See -.IR dbz (3z) -for what tagging is about. -(Note, these defaults can be changed when -.IR dbz (3z) -is installed.) -.PP -If the -.B \-f -option is given, -size, case mapping, and tagging -are instead initialized based on the -database -.IR old . -This is mostly useful when -creating a new generation of an existing database. -(See the description of -.I dbzagain -in -.IR dbz (3z) -for details.) -.PP -If the -.B \-p -option is given, the -.I parms -string specifies the size, case mapping, and tagging. -If -.I parms -is a single decimal number, -that is taken as the expected number of records -in the index, with case mapping and tagging defaulted. -Alternatively, -.I parms -can be three fields\(ema decimal number, a case-mapping code character, and a -hexadecimal tag mask\(emseparated by white space. -The decimal number is, again, the expected number of records; -0 means ``use the default''. -See -.IR dbz (3z) -for possible choices of case-mapping code, -but in particular, -.B 0 -means ``no case mapping''. -See -.IR dbz (3z) -for details on tag masks; -0 means ``use the default''. -.PP -If the -.B \-e -option is given, the decimal number in -.B \-p -is taken to be the exact table size, not the expected number of records, -and invocation of -.I dbzsize -(see -.IR dbz (3z)) -to predict a good size for that number of records is suppressed. -.PP -The -.B \&.pag -file is normally about 6 bytes per record (based on the estimate given to -.B \-p -or the previous history of the -.B \-f -database). -The -.B \&.dir -file is tiny. -.SH SEE ALSO -dbz(3z) -.SH HISTORY -Written at U of Toronto by Henry Spencer, for the C News project. -See -.IR dbz (3z) -for the history of the underlying database routines. -.SH BUGS -There are a number of undocumented options with obscure effects, -meant for debugging and regression testing of -.IR dbz (3z). -.PP -Permissions for the index files probably ought to be taken from those -of the base file. -.PP -The line-length limit is a blemish, alleviated only slightly by -.BR \-l . diff --git a/contrib/libio/dbz/dbz.3z b/contrib/libio/dbz/dbz.3z deleted file mode 100644 index 6df25311c7..0000000000 --- a/contrib/libio/dbz/dbz.3z +++ /dev/null @@ -1,547 +0,0 @@ -.TH DBZ 3Z "3 Feb 1991" -.BY "C News" -.SH NAME -dbminit, fetch, store, dbmclose \- somewhat dbm-compatible database routines -.br -dbzfresh, dbzagain, dbzfetch, dbzstore \- database routines -.br -dbzsync, dbzsize, dbzincore, dbzcancel, dbzdebug \- database routines -.SH SYNOPSIS -.nf -.B #include -.PP -.B dbminit(base) -.B char *base; -.PP -.B datum -.B fetch(key) -.B datum key; -.PP -.B store(key, value) -.B datum key; -.B datum value; -.PP -.B dbmclose() -.PP -.B dbzfresh(base, size, fieldsep, cmap, tagmask) -.B char *base; -.B long size; -.B int fieldsep; -.B int cmap; -.B long tagmask; -.PP -.B dbzagain(base, oldbase) -.B char *base; -.B char *oldbase; -.PP -.B datum -.B dbzfetch(key) -.B datum key; -.PP -.B dbzstore(key, value) -.B datum key; -.B datum value; -.PP -.B dbzsync() -.PP -.B long -.B dbzsize(nentries) -.B long nentries; -.PP -.B dbzincore(newvalue) -.PP -.B dbzcancel() -.PP -.B dbzdebug(newvalue) -.SH DESCRIPTION -These functions provide an indexing system for rapid random access to a -text file (the -.I base -.IR file ). -Subject to certain constraints, they are call-compatible with -.IR dbm (3), -although they also provide some extensions. -(Note that they are -.I not -file-compatible with -.I dbm -or any variant thereof.) -.PP -In principle, -.I dbz -stores key-value pairs, where both key and value are arbitrary sequences -of bytes, specified to the functions by -values of type -.IR datum , -typedefed in the header file to be a structure with members -.I dptr -(a value of type -.I char * -pointing to the bytes) -and -.I dsize -(a value of type -.I int -indicating how long the byte sequence is). -.PP -In practice, -.I dbz -is more restricted than -.IR dbm . -A -.I dbz -database -must be an index into a base file, -with the database -.IR value s -being -.IR fseek (3) -offsets into the base file. -Each such -.I value -must ``point to'' a place in the base file where the corresponding -.I key -sequence is found. -A key can be no longer than -.SM DBZMAXKEY -(a constant defined in the header file) bytes. -No key can be an initial subsequence of another, -which in most applications requires that keys be -either bracketed or terminated in some way (see the -discussion of the -.I fieldsep -parameter of -.IR dbzfresh , -below, -for a fine point on terminators). -.PP -.I Dbminit -opens a database, -an index into the base file -.IR base , -consisting of files -.IB base .dir -and -.IB base .pag -which must already exist. -(If the database is new, they should be zero-length files.) -Subsequent accesses go to that database until -.I dbmclose -is called to close the database. -The base file need not exist at the time of the -.IR dbminit , -but it must exist before accesses are attempted. -.PP -.I Fetch -searches the database for the specified -.IR key , -returning the corresponding -.IR value -if any. -.I Store -stores the -.IR key - value -pair in the database. -.I Store -will fail unless the database files are writeable. -See below for a complication arising from case mapping. -.PP -.I Dbzfresh -is a variant of -.I dbminit -for creating a new database with more control over details. -Unlike for -.IR dbminit , -the database files need not exist: -they will be created if necessary, -and truncated in any case. -.PP -.IR Dbzfresh 's -.I size -parameter specifies the size of the first hash table within the database, -in key-value pairs. -Performance will be best if -.I size -is a prime number and -the number of key-value pairs stored in the database does not exceed -about 2/3 of -.IR size . -(The -.I dbzsize -function, given the expected number of key-value pairs, -will suggest a database size that meets these criteria.) -Assuming that an -.I fseek -offset is 4 bytes, -the -.B .pag -file will be -.RI 4* size -bytes -(the -.B .dir -file is tiny and roughly constant in size) -until -the number of key-value pairs exceeds about 80% of -.IR size . -(Nothing awful will happen if the database grows beyond 100% of -.IR size , -but accesses will slow down somewhat and the -.B .pag -file will grow somewhat.) -.PP -.IR Dbzfresh 's -.I fieldsep -parameter specifies the field separator in the base file. -If this is not -NUL (0), and the last character of a -.I key -argument is NUL, that NUL compares equal to either a NUL or a -.I fieldsep -in the base file. -This permits use of NUL to terminate key strings without requiring that -NULs appear in the base file. -The -.I fieldsep -of a database created with -.I dbminit -is the horizontal-tab character. -.PP -For use in news systems, various forms of case mapping (e.g. uppercase to -lowercase) in keys are available. -The -.I cmap -parameter to -.I dbzfresh -is a single character specifying which of several mapping algorithms to use. -Available algorithms are: -.RS -.TP -.B 0 -case-sensitive: no case mapping -.TP -.B B -same as -.B 0 -.TP -.B NUL -same as -.B 0 -.TP -.B = -case-insensitive: uppercase and lowercase equivalent -.TP -.B b -same as -.B = -.TP -.B C -RFC822 message-ID rules, case-sensitive before `@' (with certain exceptions) -and case-insensitive after -.TP -.B ? -whatever the local default is, normally -.B C -.RE -.PP -Mapping algorithm -.B 0 -(no mapping) is faster than the others and is overwhelmingly the correct -choice for most applications. -Unless compatibility constraints interfere, it is more efficient to pre-map -the keys, storing mapped keys in the base file, than to have -.I dbz -do the mapping on every search. -.PP -For historical reasons, -.I fetch -and -.I store -expect their -.I key -arguments to be pre-mapped, but expect unmapped keys in the base file. -.I Dbzfetch -and -.I dbzstore -do the same jobs but handle all case mapping internally, -so the customer need not worry about it. -.PP -.I Dbz -stores only the database -.IR value s -in its files, relying on reference to the base file to confirm a hit on a key. -References to the base file can be minimized, greatly speeding up searches, -if a little bit of information about the keys can be stored in the -.I dbz -files. -This is ``free'' if there are some unused bits in an -.I fseek -offset, -so that the offset can be -.I tagged -with some information about the key. -The -.I tagmask -parameter of -.I dbzfresh -allows specifying the location of unused bits. -.I Tagmask -should be a mask with -one group of -contiguous -.B 1 -bits. -The bits in the mask should -be unused (0) in -.I most -offsets. -The bit immediately above the mask (the -.I flag -bit) should be unused (0) in -.I all -offsets; -.I (dbz)store -will reject attempts to store a key-value pair in which the -.I value -has the flag bit on. -Apart from this restriction, tagging is invisible to the user. -As a special case, a -.I tagmask -of 1 means ``no tagging'', for use with enormous base files or -on systems with unusual offset representations. -.PP -A -.I size -of 0 -given to -.I dbzfresh -is synonymous with the local default; -the normal default is suitable for tables of 90-100,000 -key-value pairs. -A -.I cmap -of 0 (NUL) is synonymous with the character -.BR 0 , -signifying no case mapping -(note that the character -.B ? -specifies the local default mapping, -normally -.BR C ). -A -.I tagmask -of 0 is synonymous with the local default tag mask, -normally 0x7f000000 (specifying the top bit in a 32-bit offset -as the flag bit, and the next 7 bits as the mask, -which is suitable for base files up to circa 24MB). -Calling -.I dbminit(name) -with the database files empty is equivalent to calling -.IR dbzfresh(name,0,'\et','?',0) . -.PP -When databases are regenerated periodically, as in news, -it is simplest to pick the parameters for a new database based on the old one. -This also permits some memory of past sizes of the old database, so that -a new database size can be chosen to cover expected fluctuations. -.I Dbzagain -is a variant of -.I dbminit -for creating a new database as a new generation of an old database. -The database files for -.I oldbase -must exist. -.I Dbzagain -is equivalent to calling -.I dbzfresh -with the same field separator, case mapping, and tag mask as the old database, -and a -.I size -equal to the result of applying -.I dbzsize -to the largest number of entries in the -.I oldbase -database and its previous 10 generations. -.PP -When many accesses are being done by the same program, -.I dbz -is massively faster if its first hash table is in memory. -If an internal flag is 1, -an attempt is made to read the table in when -the database is opened, and -.I dbmclose -writes it out to disk again (if it was read successfully and -has been modified). -.I Dbzincore -sets the flag to -.I newvalue -(which should be 0 or 1) -and returns the previous value; -this does not affect the status of a database that has already been opened. -The default is 0. -The attempt to read the table in may fail due to memory shortage; -in this case -.I dbz -quietly falls back on its default behavior. -.IR Store s -to an in-memory database are not (in general) written out to the file -until -.IR dbmclose -or -.IR dbzsync , -so if robustness in the presence of crashes -or concurrent accesses -is crucial, in-memory databases -should probably be avoided. -.PP -.I Dbzsync -causes all buffers etc. to be flushed out to the files. -It is typically used as a precaution against crashes or concurrent accesses -when a -.IR dbz -using -process will be running for a long time. -It is a somewhat expensive operation, -especially -for an in-memory database. -.PP -.I Dbzcancel -cancels any pending writes from buffers. -This is typically useful only for in-core databases, since writes are -otherwise done immediately. -Its main purpose is to let a child process, in the wake of a -.IR fork , -do a -.I dbmclose -without writing its parent's data to disk. -.PP -If -.I dbz -has been compiled with debugging facilities available (which makes it -bigger and a bit slower), -.I dbzdebug -alters the value (and returns the previous value) of an internal flag -which (when 1; default is 0) causes -verbose and cryptic debugging output on standard output. -.PP -Concurrent reading of databases is fairly safe, -but there is no (inter)locking, -so concurrent updating is not. -.PP -The database files include a record of the byte order of the processor -creating the database, and accesses by processors with different byte -order will work, although they will be slightly slower. -Byte order is preserved by -.IR dbzagain . -However, -agreement on the size and internal structure of an -.I fseek -offset is necessary, as is consensus on -the character set. -.PP -An open database occupies three -.I stdio -streams and their corresponding file descriptors; -a fourth is needed for an in-memory database. -Memory consumption is negligible (except for -.I stdio -buffers) except for in-memory databases. -.SH SEE ALSO -dbz(1), dbm(3) -.SH DIAGNOSTICS -Functions returning -.I int -values return 0 for success, \-1 for failure. -Functions returning -.I datum -values return a value with -.I dptr -set to NULL for failure. -.I Dbminit -attempts to have -.I errno -set plausibly on return, but otherwise this is not guaranteed. -An -.I errno -of -.B EDOM -from -.I dbminit -indicates that the database did not appear to be in -.I dbz -format. -.SH HISTORY -The original -.I dbz -was written by -Jon Zeeff (zeeff@b-tech.ann-arbor.mi.us). -Later contributions by David Butler and Mark Moraes. -Extensive reworking, -including this documentation, -by Henry Spencer (henry@zoo.toronto.edu) as -part of the C News project. -Hashing function by Peter Honeyman. -.SH BUGS -The -.I dptr -members of returned -.I datum -values point to static storage which is overwritten by later calls. -.PP -Unlike -.IR dbm , -.I dbz -will misbehave if an existing key-value pair is `overwritten' by -a new -.I (dbz)store -with the same key. -The user is responsible for avoiding this by using -.I (dbz)fetch -first to check for duplicates; -an internal optimization remembers the result of the -first search so there is minimal overhead in this. -.PP -Waiting until after -.I dbminit -to bring the base file into existence -will fail if -.IR chdir (2) -has been used meanwhile. -.PP -The RFC822 case mapper implements only a first approximation to the -hideously-complex RFC822 case rules. -.PP -The prime finder in -.I dbzsize -is not particularly quick. -.PP -Should implement the -.I dbm -functions -.IR delete , -.IR firstkey , -and -.IR nextkey . -.PP -On C implementations which trap integer overflow, -.I dbz -will refuse to -.I (dbz)store -an -.I fseek -offset equal to the greatest -representable -positive number, -as this would cause overflow in the biased representation used. -.PP -.I Dbzagain -perhaps ought to notice when many offsets -in the old database were -too big for -tagging, and shrink the tag mask to match. -.PP -Marking -.IR dbz 's -file descriptors -.RI close-on- exec -would be a better approach to the problem -.I dbzcancel -tries to address, but that's harder to do portably. diff --git a/contrib/libio/dbz/dbz.c b/contrib/libio/dbz/dbz.c deleted file mode 100644 index 7489a09d15..0000000000 --- a/contrib/libio/dbz/dbz.c +++ /dev/null @@ -1,1768 +0,0 @@ -/* - -dbz.c V3.2 - -Copyright 1988 Jon Zeeff (zeeff@b-tech.ann-arbor.mi.us) -You can use this code in any manner, as long as you leave my name on it -and don't hold me responsible for any problems with it. - -Hacked on by gdb@ninja.UUCP (David Butler); Sun Jun 5 00:27:08 CDT 1988 - -Various improvments + INCORE by moraes@ai.toronto.edu (Mark Moraes) - -Major reworking by Henry Spencer as part of the C News project. - -These routines replace dbm as used by the usenet news software -(it's not a full dbm replacement by any means). It's fast and -simple. It contains no AT&T code. - -In general, dbz's files are 1/20 the size of dbm's. Lookup performance -is somewhat better, while file creation is spectacularly faster, especially -if the incore facility is used. - -*/ - -#include -#include -#include -#include -#include -#ifndef __STDC__ -extern int errno; -#endif -#include - -/* - * #ifdef index. "LIA" = "leave it alone unless you know what you're doing". - * - * FUNNYSEEKS SEEK_SET is not 0, get it from - * INDEX_SIZE backward compatibility with old dbz; avoid using this - * NMEMORY number of days of memory for use in sizing new table (LIA) - * INCORE backward compatibility with old dbz; use dbzincore() instead - * DBZDEBUG enable debugging - * DEFSIZE default table size (not as critical as in old dbz) - * OLDBNEWS default case mapping as in old B News; set NOBUFFER - * BNEWS default case mapping as in current B News; set NOBUFFER - * DEFCASE default case-map algorithm selector - * NOTAGS fseek offsets are strange, do not do tagging (see below) - * NPAGBUF size of .pag buffer, in longs (LIA) - * SHISTBUF size of ASCII-file buffer, in bytes (LIA) - * MAXRUN length of run which shifts to next table (see below) (LIA) - * OVERFLOW long-int arithmetic overflow must be avoided, will trap - * NOBUFFER do not buffer hash-table i/o, B News locking is defective - */ - -#ifdef FUNNYSEEKS -#include -#else -#define SEEK_SET 0 -#endif -#ifdef OVERFLOW -#include -#endif - -static int dbzversion = 3; /* for validating .dir file format */ - -/* - * The dbz database exploits the fact that when news stores a - * tuple, the `value' part is a seek offset into a text file, pointing to - * a copy of the `key' part. This avoids the need to store a copy of - * the key in the dbz files. However, the text file *must* exist and be - * consistent with the dbz files, or things will fail. - * - * The basic format of the database is a simple hash table containing the - * values. A value is stored by indexing into the table using a hash value - * computed from the key; collisions are resolved by linear probing (just - * search forward for an empty slot, wrapping around to the beginning of - * the table if necessary). Linear probing is a performance disaster when - * the table starts to get full, so a complication is introduced. The - * database is actually one *or more* tables, stored sequentially in the - * .pag file, and the length of linear-probe sequences is limited. The - * search (for an existing item or an empty slot) always starts in the - * first table, and whenever MAXRUN probes have been done in table N, - * probing continues in table N+1. This behaves reasonably well even in - * cases of massive overflow. There are some other small complications - * added, see comments below. - * - * The table size is fixed for any particular database, but is determined - * dynamically when a database is rebuilt. The strategy is to try to pick - * the size so the first table will be no more than 2/3 full, that being - * slightly before the point where performance starts to degrade. (It is - * desirable to be a bit conservative because the overflow strategy tends - * to produce files with holes in them, which is a nuisance.) - */ - -/* - * The following is for backward compatibility. - */ -#ifdef INDEX_SIZE -#define DEFSIZE INDEX_SIZE -#endif - -/* - * ANSI C says the offset argument to fseek is a long, not an off_t, for some - * reason. Let's use off_t anyway. - */ -#define SOF (sizeof(off_t)) - -/* - * We assume that unused areas of a binary file are zeros, and that the - * bit pattern of `(off_t)0' is all zeros. The alternative is rather - * painful file initialization. Note that okayvalue(), if OVERFLOW is - * defined, knows what value of an offset would cause overflow. - */ -#define VACANT ((off_t)0) -#define BIAS(o) ((o)+1) /* make any valid off_t non-VACANT */ -#define UNBIAS(o) ((o)-1) /* reverse BIAS() effect */ - -/* - * In a Unix implementation, or indeed any in which an off_t is a byte - * count, there are a bunch of high bits free in an off_t. There is a - * use for them. Checking a possible hit by looking it up in the base - * file is relatively expensive, and the cost can be dramatically reduced - * by using some of those high bits to tag the value with a few more bits - * of the key's hash. This detects most false hits without the overhead of - * seek+read+strcmp. We use the top bit to indicate whether the value is - * tagged or not, and don't tag a value which is using the tag bits itself. - * We're in trouble if the off_t representation wants to use the top bit. - * The actual bitmasks and offset come from the configuration stuff, - * which permits fiddling with them as necessary, and also suppressing - * them completely (by defining the masks to 0). We build pre-shifted - * versions of the masks for efficiency. - */ -static off_t tagbits; /* pre-shifted tag mask */ -static off_t taghere; /* pre-shifted tag-enable bit */ -static off_t tagboth; /* tagbits|taghere */ -#define HASTAG(o) ((o)&taghere) -#define TAG(o) ((o)&tagbits) -#define NOTAG(o) ((o)&~tagboth) -#define CANTAG(o) (((o)&tagboth) == 0) -#define MKTAG(v) (((v)<>= 1; - c.tagshift++; - } - c.tagmask = m; - c.tagenb = (m << 1) & ~m; - break; - } - - /* write it out */ - fn = enstring(name, dir); - if (fn == NULL) - return(-1); - f = fopen(fn, "w"); - free(fn); - if (f == NULL) { - DEBUG(("dbzfresh: unable to write config\n")); - return(-1); - } - if (putconf(f, &c) < 0) { - (void) fclose(f); - return(-1); - } - if (fclose(f) == EOF) { - DEBUG(("dbzfresh: fclose failure\n")); - return(-1); - } - - /* create/truncate .pag */ - fn = enstring(name, pag); - if (fn == NULL) - return(-1); - f = fopen(fn, "w"); - free(fn); - if (f == NULL) { - DEBUG(("dbzfresh: unable to create/truncate .pag file\n")); - return(-1); - } else - (void) fclose(f); - - /* and punt to dbminit for the hard work */ - return(dbminit(name)); -} - -/* - - dbzsize - what's a good table size to hold this many entries? - */ -long -dbzsize(contents) -long contents; /* 0 means what's the default */ -{ - register long n; - - if (contents <= 0) { /* foulup or default inquiry */ - DEBUG(("dbzsize: preposterous input (%ld)\n", contents)); - return(DEFSIZE); - } - n = (contents/2)*3; /* try to keep table at most 2/3 full */ - if (!(n&01)) /* make it odd */ - n++; - DEBUG(("dbzsize: tentative size %ld\n", n)); - while (!isprime(n)) /* and look for a prime */ - n += 2; - DEBUG(("dbzsize: final size %ld\n", n)); - - return(n); -} - -/* - - isprime - is a number prime? - * - * This is not a terribly efficient approach. - */ -static int /* predicate */ -isprime(x) -register long x; -{ - static int quick[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 0 }; - register int *ip; - register long div; - register long stop; - - /* hit the first few primes quickly to eliminate easy ones */ - /* this incidentally prevents ridiculously small tables */ - for (ip = quick; (div = *ip) != 0; ip++) - if (x%div == 0) { - DEBUG(("isprime: quick result on %ld\n", (long)x)); - return(0); - } - - /* approximate square root of x */ - for (stop = x; x/stop < stop; stop >>= 1) - continue; - stop <<= 1; - - /* try odd numbers up to stop */ - for (div = *--ip; div < stop; div += 2) - if (x%div == 0) - return(0); - - return(1); -} - -/* - - dbzagain - set up a new database to be a rebuild of an old one - */ -int /* 0 success, -1 failure */ -dbzagain(name, oldname) -char *name; /* base name; .dir and .pag must exist */ -char *oldname; /* base name; all must exist */ -{ - register char *fn; - struct dbzconfig c; - register int i; - register long top; - register FILE *f; - register int newtable; - register off_t newsize; - - if (pagf != NULL) { - DEBUG(("dbzagain: database already open\n")); - return(-1); - } - - /* pick up the old configuration */ - fn = enstring(oldname, dir); - if (fn == NULL) - return(-1); - f = fopen(fn, "r"); - free(fn); - if (f == NULL) { - DEBUG(("dbzagain: cannot open old .dir file\n")); - return(-1); - } - i = getconf(f, (FILE *)NULL, &c); - (void) fclose(f); - if (i < 0) { - DEBUG(("dbzagain: getconf failed\n")); - return(-1); - } - - /* tinker with it */ - top = 0; - newtable = 0; - for (i = 0; i < NUSEDS; i++) { - if (top < c.used[i]) - top = c.used[i]; - if (c.used[i] == 0) - newtable = 1; /* hasn't got full usage history yet */ - } - if (top == 0) { - DEBUG(("dbzagain: old table has no contents!\n")); - newtable = 1; - } - for (i = NUSEDS-1; i > 0; i--) - c.used[i] = c.used[i-1]; - c.used[0] = 0; - newsize = dbzsize(top); - if (!newtable || newsize > c.tsize) /* don't shrink new table */ - c.tsize = newsize; - - /* write it out */ - fn = enstring(name, dir); - if (fn == NULL) - return(-1); - f = fopen(fn, "w"); - free(fn); - if (f == NULL) { - DEBUG(("dbzagain: unable to write new .dir\n")); - return(-1); - } - i = putconf(f, &c); - (void) fclose(f); - if (i < 0) { - DEBUG(("dbzagain: putconf failed\n")); - return(-1); - } - - /* create/truncate .pag */ - fn = enstring(name, pag); - if (fn == NULL) - return(-1); - f = fopen(fn, "w"); - free(fn); - if (f == NULL) { - DEBUG(("dbzagain: unable to create/truncate .pag file\n")); - return(-1); - } else - (void) fclose(f); - - /* and let dbminit do the work */ - return(dbminit(name)); -} - -/* - - dbminit - open a database, creating it (using defaults) if necessary - * - * We try to leave errno set plausibly, to the extent that underlying - * functions permit this, since many people consult it if dbminit() fails. - */ -int /* 0 success, -1 failure */ -dbminit(name) -char *name; -{ - register int i; - register size_t s; - register char *dirfname; - register char *pagfname; - - if (pagf != NULL) { - DEBUG(("dbminit: dbminit already called once\n")); - errno = 0; - return(-1); - } - - /* open the .dir file */ - dirfname = enstring(name, dir); - if (dirfname == NULL) - return(-1); - dirf = fopen(dirfname, "r+"); - if (dirf == NULL) { - dirf = fopen(dirfname, "r"); - dirronly = 1; - } else - dirronly = 0; - free(dirfname); - if (dirf == NULL) { - DEBUG(("dbminit: can't open .dir file\n")); - return(-1); - } - - /* open the .pag file */ - pagfname = enstring(name, pag); - if (pagfname == NULL) { - (void) fclose(dirf); - return(-1); - } - pagf = fopen(pagfname, "r+b"); - if (pagf == NULL) { - pagf = fopen(pagfname, "rb"); - if (pagf == NULL) { - DEBUG(("dbminit: .pag open failed\n")); - (void) fclose(dirf); - free(pagfname); - return(-1); - } - pagronly = 1; - } else if (dirronly) - pagronly = 1; - else - pagronly = 0; -#ifdef NOBUFFER - /* - * B News does not do adequate locking on its database accesses. - * Why it doesn't get into trouble using dbm is a mystery. In any - * case, doing unbuffered i/o does not cure the problem, but does - * enormously reduce its incidence. - */ - (void) setbuf(pagf, (char *)NULL); -#else -#ifdef _IOFBF - (void) setvbuf(pagf, (char *)pagbuf, _IOFBF, sizeof(pagbuf)); -#endif -#endif - pagpos = -1; - /* don't free pagfname, need it below */ - - /* open the base file */ - basef = fopen(name, "r"); - if (basef == NULL) { - DEBUG(("dbminit: basefile open failed\n")); - basefname = enstring(name, ""); - if (basefname == NULL) { - (void) fclose(pagf); - (void) fclose(dirf); - free(pagfname); - pagf = NULL; - return(-1); - } - } else - basefname = NULL; -#ifdef _IOFBF - if (basef != NULL) - (void) setvbuf(basef, basebuf, _IOFBF, sizeof(basebuf)); -#endif - - /* pick up configuration */ - if (getconf(dirf, pagf, &conf) < 0) { - DEBUG(("dbminit: getconf failure\n")); - (void) fclose(basef); - (void) fclose(pagf); - (void) fclose(dirf); - free(pagfname); - pagf = NULL; - errno = EDOM; /* kind of a kludge, but very portable */ - return(-1); - } - tagbits = conf.tagmask << conf.tagshift; - taghere = conf.tagenb << conf.tagshift; - tagboth = tagbits | taghere; - mybytemap(mybmap); - bytesame = 1; - for (i = 0; i < SOF; i++) - if (mybmap[i] != conf.bytemap[i]) - bytesame = 0; - - /* get first table into core, if it looks desirable and feasible */ - s = (size_t)conf.tsize * SOF; - if (incore && (off_t)(s/SOF) == conf.tsize) { - bufpagf = fopen(pagfname, (pagronly) ? "rb" : "r+b"); - if (bufpagf != NULL) - corepag = getcore(bufpagf); - } else { - bufpagf = NULL; - corepag = NULL; - } - free(pagfname); - - /* misc. setup */ - crcinit(); - written = 0; - prevp = FRESH; - DEBUG(("dbminit: succeeded\n")); - return(0); -} - -/* - - enstring - concatenate two strings into a malloced area - */ -static char * /* NULL if malloc fails */ -enstring(s1, s2) -char *s1; -char *s2; -{ - register char *p; - - p = malloc((size_t)strlen(s1) + (size_t)strlen(s2) + 1); - if (p != NULL) { - (void) strcpy(p, s1); - (void) strcat(p, s2); - } else { - DEBUG(("enstring(%s, %s) out of memory\n", s1, s2)); - } - return(p); -} - -/* - - dbmclose - close a database - */ -int -dbmclose() -{ - register int ret = 0; - - if (pagf == NULL) { - DEBUG(("dbmclose: not opened!\n")); - return(-1); - } - - if (fclose(pagf) == EOF) { - DEBUG(("dbmclose: fclose(pagf) failed\n")); - ret = -1; - } - pagf = basef; /* ensure valid pointer; dbzsync checks it */ - if (dbzsync() < 0) - ret = -1; - if (bufpagf != NULL && fclose(bufpagf) == EOF) { - DEBUG(("dbmclose: fclose(bufpagf) failed\n")); - ret = -1; - } - if (corepag != NULL) - free((char *)corepag); - corepag = NULL; - if (fclose(basef) == EOF) { - DEBUG(("dbmclose: fclose(basef) failed\n")); - ret = -1; - } - if (basefname != NULL) - free(basefname); - basef = NULL; - pagf = NULL; - if (fclose(dirf) == EOF) { - DEBUG(("dbmclose: fclose(dirf) failed\n")); - ret = -1; - } - - DEBUG(("dbmclose: %s\n", (ret == 0) ? "succeeded" : "failed")); - return(ret); -} - -/* - - dbzsync - push all in-core data out to disk - */ -int -dbzsync() -{ - register int ret = 0; - - if (pagf == NULL) { - DEBUG(("dbzsync: not opened!\n")); - return(-1); - } - if (!written) - return(0); - - if (corepag != NULL) { - if (putcore(corepag, bufpagf) < 0) { - DEBUG(("dbzsync: putcore failed\n")); - ret = -1; - } - } - if (!conf.olddbz) - if (putconf(dirf, &conf) < 0) - ret = -1; - - DEBUG(("dbzsync: %s\n", (ret == 0) ? "succeeded" : "failed")); - return(ret); -} - -/* - - dbzcancel - cancel writing of in-core data - * Mostly for use from child processes. - * Note that we don't need to futz around with stdio buffers, because we - * always fflush them immediately anyway and so they never have stale data. - */ -int -dbzcancel() -{ - if (pagf == NULL) { - DEBUG(("dbzcancel: not opened!\n")); - return(-1); - } - - written = 0; - return(0); -} - -/* - - dbzfetch - fetch() with case mapping built in - */ -datum -dbzfetch(key) -datum key; -{ - char buffer[DBZMAXKEY + 1]; - datum mappedkey; - register size_t keysize; - - DEBUG(("dbzfetch: (%s)\n", key.dptr)); - - /* Key is supposed to be less than DBZMAXKEY */ - keysize = key.dsize; - if (keysize >= DBZMAXKEY) { - keysize = DBZMAXKEY; - DEBUG(("keysize is %d - truncated to %d\n", key.dsize, DBZMAXKEY)); - } - - mappedkey.dptr = mapcase(buffer, key.dptr, keysize); - buffer[keysize] = '\0'; /* just a debug aid */ - mappedkey.dsize = keysize; - - return(fetch(mappedkey)); -} - -/* - - fetch - get an entry from the database - * - * Disgusting fine point, in the name of backward compatibility: if the - * last character of "key" is a NUL, that character is (effectively) not - * part of the comparison against the stored keys. - */ -datum /* dptr NULL, dsize 0 means failure */ -fetch(key) -datum key; -{ - char buffer[DBZMAXKEY + 1]; - static off_t key_ptr; /* return value points here */ - datum output; - register size_t keysize; - register size_t cmplen; - register char *sepp; - - DEBUG(("fetch: (%s)\n", key.dptr)); - output.dptr = NULL; - output.dsize = 0; - prevp = FRESH; - - /* Key is supposed to be less than DBZMAXKEY */ - keysize = key.dsize; - if (keysize >= DBZMAXKEY) { - keysize = DBZMAXKEY; - DEBUG(("keysize is %d - truncated to %d\n", key.dsize, DBZMAXKEY)); - } - - if (pagf == NULL) { - DEBUG(("fetch: database not open!\n")); - return(output); - } else if (basef == NULL) { /* basef didn't exist yet */ - basef = latebase(); - if (basef == NULL) - return(output); - } - - cmplen = keysize; - sepp = &conf.fieldsep; - if (key.dptr[keysize-1] == '\0') { - cmplen--; - sepp = &buffer[keysize-1]; - } - start(&srch, &key, FRESH); - while ((key_ptr = search(&srch)) != NOTFOUND) { - DEBUG(("got 0x%lx\n", key_ptr)); - - /* fetch the key */ - if (fseek(basef, key_ptr, SEEK_SET) != 0) { - DEBUG(("fetch: seek failed\n")); - return(output); - } - if (fread(buffer, 1, keysize, basef) != keysize) { - DEBUG(("fetch: read failed\n")); - return(output); - } - - /* try it */ - buffer[keysize] = '\0'; /* terminated for DEBUG */ - (void) mapcase(buffer, buffer, keysize); - DEBUG(("fetch: buffer (%s) looking for (%s) size = %d\n", - buffer, key.dptr, keysize)); - if (memcmp(key.dptr, buffer, cmplen) == 0 && - (*sepp == conf.fieldsep || *sepp == '\0')) { - /* we found it */ - output.dptr = (char *)&key_ptr; - output.dsize = SOF; - DEBUG(("fetch: successful\n")); - return(output); - } - } - - /* we didn't find it */ - DEBUG(("fetch: failed\n")); - prevp = &srch; /* remember where we stopped */ - return(output); -} - -/* - - latebase - try to open a base file that wasn't there at the start - */ -static FILE * -latebase() -{ - register FILE *it; - - if (basefname == NULL) { - DEBUG(("latebase: name foulup\n")); - return(NULL); - } - it = fopen(basefname, "r"); - if (it == NULL) { - DEBUG(("latebase: still can't open base\n")); - } else { - DEBUG(("latebase: late open succeeded\n")); - free(basefname); - basefname = NULL; -#ifdef _IOFBF - (void) setvbuf(it, basebuf, _IOFBF, sizeof(basebuf)); -#endif - } - return(it); -} - -/* - - dbzstore - store() with case mapping built in - */ -int -dbzstore(key, data) -datum key; -datum data; -{ - char buffer[DBZMAXKEY + 1]; - datum mappedkey; - register size_t keysize; - - DEBUG(("dbzstore: (%s)\n", key.dptr)); - - /* Key is supposed to be less than DBZMAXKEY */ - keysize = key.dsize; - if (keysize >= DBZMAXKEY) { - DEBUG(("dbzstore: key size too big (%d)\n", key.dsize)); - return(-1); - } - - mappedkey.dptr = mapcase(buffer, key.dptr, keysize); - buffer[keysize] = '\0'; /* just a debug aid */ - mappedkey.dsize = keysize; - - return(store(mappedkey, data)); -} - -/* - - store - add an entry to the database - */ -int /* 0 success, -1 failure */ -store(key, data) -datum key; -datum data; -{ - off_t value; - - if (pagf == NULL) { - DEBUG(("store: database not open!\n")); - return(-1); - } else if (basef == NULL) { /* basef didn't exist yet */ - basef = latebase(); - if (basef == NULL) - return(-1); - } - if (pagronly) { - DEBUG(("store: database open read-only\n")); - return(-1); - } - if (data.dsize != SOF) { - DEBUG(("store: value size wrong (%d)\n", data.dsize)); - return(-1); - } - if (key.dsize >= DBZMAXKEY) { - DEBUG(("store: key size too big (%d)\n", key.dsize)); - return(-1); - } - - /* copy the value in to ensure alignment */ - (void) memcpy((char *)&value, data.dptr, SOF); - DEBUG(("store: (%s, %ld)\n", key.dptr, (long)value)); - if (!okayvalue(value)) { - DEBUG(("store: reserved bit or overflow in 0x%lx\n", value)); - return(-1); - } - - /* find the place, exploiting previous search if possible */ - start(&srch, &key, prevp); - while (search(&srch) != NOTFOUND) - continue; - - prevp = FRESH; - conf.used[0]++; - DEBUG(("store: used count %ld\n", conf.used[0])); - written = 1; - return(set(&srch, value)); -} - -/* - - dbzincore - control attempts to keep .pag file in core - */ -int /* old setting */ -dbzincore(value) -int value; -{ - register int old = incore; - - incore = value; - return(old); -} - -/* - - getconf - get configuration from .dir file - */ -static int /* 0 success, -1 failure */ -getconf(df, pf, cp) -register FILE *df; /* NULL means just give me the default */ -register FILE *pf; /* NULL means don't care about .pag */ -register struct dbzconfig *cp; -{ - register int c; - register int i; - int err = 0; - - c = (df != NULL) ? getc(df) : EOF; - if (c == EOF) { /* empty file, no configuration known */ - cp->olddbz = 0; - if (df != NULL && pf != NULL && getc(pf) != EOF) - cp->olddbz = 1; - cp->tsize = DEFSIZE; - cp->fieldsep = '\t'; - for (i = 0; i < NUSEDS; i++) - cp->used[i] = 0; - cp->valuesize = SOF; - mybytemap(cp->bytemap); - cp->casemap = DEFCASE; - cp->tagenb = TAGENB; - cp->tagmask = TAGMASK; - cp->tagshift = TAGSHIFT; - DEBUG(("getconf: defaults (%ld, %c, (0x%lx/0x%lx<<%d))\n", - cp->tsize, cp->casemap, cp->tagenb, - cp->tagmask, cp->tagshift)); - return(0); - } - (void) ungetc(c, df); - - /* first line, the vital stuff */ - if (getc(df) != 'd' || getc(df) != 'b' || getc(df) != 'z') - err = -1; - if (getno(df, &err) != dbzversion) - err = -1; - cp->tsize = getno(df, &err); - cp->fieldsep = getno(df, &err); - while ((c = getc(df)) == ' ') - continue; - cp->casemap = c; - cp->tagenb = getno(df, &err); - cp->tagmask = getno(df, &err); - cp->tagshift = getno(df, &err); - cp->valuesize = getno(df, &err); - if (cp->valuesize != SOF) { - DEBUG(("getconf: wrong off_t size (%d)\n", cp->valuesize)); - err = -1; - cp->valuesize = SOF; /* to protect the loops below */ - } - for (i = 0; i < cp->valuesize; i++) - cp->bytemap[i] = getno(df, &err); - if (getc(df) != '\n') - err = -1; - DEBUG(("size %ld, sep %d, cmap %c, tags 0x%lx/0x%lx<<%d, ", cp->tsize, - cp->fieldsep, cp->casemap, cp->tagenb, cp->tagmask, - cp->tagshift)); - DEBUG(("bytemap (%d)", cp->valuesize)); - for (i = 0; i < cp->valuesize; i++) { - DEBUG((" %d", cp->bytemap[i])); - } - DEBUG(("\n")); - - /* second line, the usages */ - for (i = 0; i < NUSEDS; i++) - cp->used[i] = getno(df, &err); - if (getc(df) != '\n') - err = -1; - DEBUG(("used %ld %ld %ld...\n", cp->used[0], cp->used[1], cp->used[2])); - - if (err < 0) { - DEBUG(("getconf error\n")); - return(-1); - } - return(0); -} - -/* - - getno - get a long - */ -static long -getno(f, ep) -FILE *f; -int *ep; -{ - register char *p; -# define MAXN 50 - char getbuf[MAXN]; - register int c; - - while ((c = getc(f)) == ' ') - continue; - if (c == EOF || c == '\n') { - DEBUG(("getno: missing number\n")); - *ep = -1; - return(0); - } - p = getbuf; - *p++ = c; - while ((c = getc(f)) != EOF && c != '\n' && c != ' ') - if (p < &getbuf[MAXN-1]) - *p++ = c; - if (c == EOF) { - DEBUG(("getno: EOF\n")); - *ep = -1; - } else - (void) ungetc(c, f); - *p = '\0'; - - if (strspn(getbuf, "-1234567890") != strlen(getbuf)) { - DEBUG(("getno: `%s' non-numeric\n", getbuf)); - *ep = -1; - } - return(atol(getbuf)); -} - -/* - - putconf - write configuration to .dir file - */ -static int /* 0 success, -1 failure */ -putconf(f, cp) -register FILE *f; -register struct dbzconfig *cp; -{ - register int i; - register int ret = 0; - - if (fseek(f, 0, SEEK_SET) != 0) { - DEBUG(("fseek failure in putconf\n")); - ret = -1; - } - fprintf(f, "dbz %d %ld %d %c %ld %ld %d %d", dbzversion, - (long)cp->tsize, - cp->fieldsep, cp->casemap, (long)cp->tagenb, - (long)cp->tagmask, cp->tagshift, - cp->valuesize); - - for (i = 0; i < cp->valuesize; i++) - fprintf(f, " %d", cp->bytemap[i]); - fprintf(f, "\n"); - for (i = 0; i < NUSEDS; i++) - fprintf(f, "%ld%c", - (long)cp->used[i], (i < NUSEDS-1) ? ' ' : '\n'); - - - (void) fflush(f); - if (ferror(f)) - ret = -1; - - DEBUG(("putconf status %d\n", ret)); - return(ret); -} - -/* - - getcore - try to set up an in-core copy of .pag file - */ -static off_t * /* pointer to copy, or NULL */ -getcore(f) -FILE *f; -{ - register off_t *p; - register size_t i; - register size_t nread; - register char *it; - - it = malloc((size_t)conf.tsize * SOF); - if (it == NULL) { - DEBUG(("getcore: malloc failed\n")); - return(NULL); - } - - nread = fread(it, SOF, (size_t)conf.tsize, f); - if (ferror(f)) { - DEBUG(("getcore: read failed\n")); - free(it); - return(NULL); - } - - p = (off_t *)it + nread; - i = (size_t)conf.tsize - nread; - while (i-- > 0) - *p++ = VACANT; - return((off_t *)it); -} - -/* - - putcore - try to rewrite an in-core table - */ -static int /* 0 okay, -1 fail */ -putcore(tab, f) -off_t *tab; -FILE *f; -{ - if (fseek(f, 0, SEEK_SET) != 0) { - DEBUG(("fseek failure in putcore\n")); - return(-1); - } - (void) fwrite((char *)tab, SOF, (size_t)conf.tsize, f); - (void) fflush(f); - return((ferror(f)) ? -1 : 0); -} - -/* - - start - set up to start or restart a search - */ -static void -start(sp, kp, osp) -register struct searcher *sp; -register datum *kp; -register struct searcher *osp; /* may be FRESH, i.e. NULL */ -{ - register long h; - - h = hash(kp->dptr, kp->dsize); - if (osp != FRESH && osp->hash == h) { - if (sp != osp) - *sp = *osp; - DEBUG(("search restarted\n")); - } else { - sp->hash = h; - sp->tag = MKTAG(h / conf.tsize); - DEBUG(("tag 0x%lx\n", sp->tag)); - sp->place = h % conf.tsize; - sp->tabno = 0; - sp->run = (conf.olddbz) ? conf.tsize : MAXRUN; - sp->aborted = 0; - } - sp->seen = 0; -} - -/* - - search - conduct part of a search - */ -static off_t /* NOTFOUND if we hit VACANT or error */ -search(sp) -register struct searcher *sp; -{ - register off_t dest; - register off_t value; - off_t val; /* buffer for value (can't fread register) */ - register off_t place; - - if (sp->aborted) - return(NOTFOUND); - - for (;;) { - /* determine location to be examined */ - place = sp->place; - if (sp->seen) { - /* go to next location */ - if (--sp->run <= 0) { - sp->tabno++; - sp->run = MAXRUN; - } - place = (place+1)%conf.tsize + sp->tabno*conf.tsize; - sp->place = place; - } else - sp->seen = 1; /* now looking at current location */ - DEBUG(("search @ %ld\n", place)); - - /* get the tagged value */ - if (corepag != NULL && place < conf.tsize) { - DEBUG(("search: in core\n")); - value = MAPIN(corepag[place]); - } else { - /* seek, if necessary */ - dest = place * SOF; - if (pagpos != dest) { - if (fseek(pagf, dest, SEEK_SET) != 0) { - DEBUG(("search: seek failed\n")); - pagpos = -1; - sp->aborted = 1; - return(NOTFOUND); - } - pagpos = dest; - } - - /* read it */ - if (fread((char *)&val, sizeof(val), 1, pagf) == 1) - value = MAPIN(val); - else if (ferror(pagf)) { - DEBUG(("search: read failed\n")); - pagpos = -1; - sp->aborted = 1; - return(NOTFOUND); - } else - value = VACANT; - - /* and finish up */ - pagpos += sizeof(val); - } - - /* vacant slot is always cause to return */ - if (value == VACANT) { - DEBUG(("search: empty slot\n")); - return(NOTFOUND); - }; - - /* check the tag */ - value = UNBIAS(value); - DEBUG(("got 0x%lx\n", value)); - if (!HASTAG(value)) { - DEBUG(("tagless\n")); - return(value); - } else if (TAG(value) == sp->tag) { - DEBUG(("match\n")); - return(NOTAG(value)); - } else { - DEBUG(("mismatch 0x%lx\n", TAG(value))); - } - } - /* NOTREACHED */ -} - -/* - - okayvalue - check that a value can be stored - */ -static int /* predicate */ -okayvalue(value) -off_t value; -{ - if (HASTAG(value)) - return(0); -#ifdef OVERFLOW - if (value == LONG_MAX) /* BIAS() and UNBIAS() will overflow */ - return(0); -#endif - return(1); -} - -/* - - set - store a value into a location previously found by search - */ -static int /* 0 success, -1 failure */ -set(sp, value) -register struct searcher *sp; -off_t value; -{ - register off_t place = sp->place; - register off_t v = value; - - if (sp->aborted) - return(-1); - - if (CANTAG(v) && !conf.olddbz) { - v |= sp->tag | taghere; - if (v != UNBIAS(VACANT)) /* BIAS(v) won't look VACANT */ -#ifdef OVERFLOW - if (v != LONG_MAX) /* and it won't overflow */ -#endif - value = v; - } - DEBUG(("tagged value is 0x%lx\n", value)); - value = BIAS(value); - value = MAPOUT(value); - - /* If we have the index file in memory, use it */ - if (corepag != NULL && place < conf.tsize) { - corepag[place] = value; - DEBUG(("set: incore\n")); - return(0); - } - - /* seek to spot */ - pagpos = -1; /* invalidate position memory */ - if (fseek(pagf, place * SOF, SEEK_SET) != 0) { - DEBUG(("set: seek failed\n")); - sp->aborted = 1; - return(-1); - } - - /* write in data */ - if (fwrite((char *)&value, SOF, 1, pagf) != 1) { - DEBUG(("set: write failed\n")); - sp->aborted = 1; - return(-1); - } - /* fflush improves robustness, and buffer re-use is rare anyway */ - if (fflush(pagf) == EOF) { - DEBUG(("set: fflush failed\n")); - sp->aborted = 1; - return(-1); - } - - DEBUG(("set: succeeded\n")); - return(0); -} - -/* - - mybytemap - determine this machine's byte map - * - * A byte map is an array of ints, sizeof(off_t) of them. The 0th int - * is the byte number of the high-order byte in my off_t, and so forth. - */ -static void -mybytemap(map) -int map[]; /* -> int[SOF] */ -{ - union { - off_t o; - char c[SOF]; - } u; - register int *mp = &map[SOF]; - register int ntodo; - register int i; - - u.o = 1; - for (ntodo = (int)SOF; ntodo > 0; ntodo--) { - for (i = 0; i < SOF; i++) - if (u.c[i] != 0) - break; - if (i == SOF) { - /* trouble -- set it to *something* consistent */ - DEBUG(("mybytemap: nonexistent byte %d!!!\n", ntodo)); - for (i = 0; i < SOF; i++) - map[i] = i; - return; - } - DEBUG(("mybytemap: byte %d\n", i)); - *--mp = i; - while (u.c[i] != 0) - u.o <<= 1; - } -} - -/* - - bytemap - transform an off_t from byte ordering map1 to map2 - */ -static off_t /* transformed result */ -bytemap(ino, map1, map2) -off_t ino; -int *map1; -int *map2; -{ - union oc { - off_t o; - char c[SOF]; - }; - union oc in; - union oc out; - register int i; - - in.o = ino; - for (i = 0; i < SOF; i++) - out.c[map2[i]] = in.c[map1[i]]; - return(out.o); -} - -/* - * This is a simplified version of the pathalias hashing function. - * Thanks to Steve Belovin and Peter Honeyman - * - * hash a string into a long int. 31 bit crc (from andrew appel). - * the crc table is computed at run time by crcinit() -- we could - * precompute, but it takes 1 clock tick on a 750. - * - * This fast table calculation works only if POLY is a prime polynomial - * in the field of integers modulo 2. Since the coefficients of a - * 32-bit polynomial won't fit in a 32-bit word, the high-order bit is - * implicit. IT MUST ALSO BE THE CASE that the coefficients of orders - * 31 down to 25 are zero. Happily, we have candidates, from - * E. J. Watson, "Primitive Polynomials (Mod 2)", Math. Comp. 16 (1962): - * x^32 + x^7 + x^5 + x^3 + x^2 + x^1 + x^0 - * x^31 + x^3 + x^0 - * - * We reverse the bits to get: - * 111101010000000000000000000000001 but drop the last 1 - * f 5 0 0 0 0 0 0 - * 010010000000000000000000000000001 ditto, for 31-bit crc - * 4 8 0 0 0 0 0 0 - */ - -#define POLY 0x48000000L /* 31-bit polynomial (avoids sign problems) */ - -static long CrcTable[128]; - -/* - - crcinit - initialize tables for hash function - */ -static void -crcinit() -{ - register int i, j; - register long sum; - - for (i = 0; i < 128; ++i) { - sum = 0L; - for (j = 7 - 1; j >= 0; --j) - if (i & (1 << j)) - sum ^= POLY >> j; - CrcTable[i] = sum; - } - DEBUG(("crcinit: done\n")); -} - -/* - - hash - Honeyman's nice hashing function - */ -static long -hash(name, size) -register char *name; -register int size; -{ - register long sum = 0L; - - while (size--) { - sum = (sum >> 7) ^ CrcTable[(sum ^ (*name++)) & 0x7f]; - } - DEBUG(("hash: returns (%ld)\n", sum)); - return(sum); -} - -/* - * case-mapping stuff - * - * Borrowed from C News, by permission of the authors. Somewhat modified. - * - * We exploit the fact that we are dealing only with headers here, and - * headers are limited to the ASCII characters by RFC822. It is barely - * possible that we might be dealing with a translation into another - * character set, but in particular it's very unlikely for a header - * character to be outside -128..255. - * - * Life would be a whole lot simpler if tolower() could safely and portably - * be applied to any char. - */ - -#define OFFSET 128 /* avoid trouble with negative chars */ - -/* must call casencmp before invoking TOLOW... */ -#define TOLOW(c) (cmap[(c)+OFFSET]) - -/* ...but the use of it in CISTREQN is safe without the preliminary call (!) */ -/* CISTREQN is an optimised case-insensitive strncmp(a,b,n)==0; n > 0 */ -#define CISTREQN(a, b, n) \ - (TOLOW((a)[0]) == TOLOW((b)[0]) && casencmp(a, b, n) == 0) - -#define MAPSIZE (256+OFFSET) -static char cmap[MAPSIZE]; /* relies on init to '\0' */ -static int mprimed = 0; /* has cmap been set up? */ - -/* - - mapprime - set up case-mapping stuff - */ -static void -mapprime() -{ - register char *lp; - register char *up; - register int c; - register int i; - static char lower[] = "abcdefghijklmnopqrstuvwxyz"; - static char upper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - - for (lp = lower, up = upper; *lp != '\0'; lp++, up++) { - c = *lp; - cmap[c+OFFSET] = c; - cmap[*up+OFFSET] = c; - } - for (i = 0; i < MAPSIZE; i++) - if (cmap[i] == '\0') - cmap[i] = (char)(i-OFFSET); - mprimed = 1; -} - -/* - - casencmp - case-independent strncmp - */ -static int /* < == > 0 */ -casencmp(s1, s2, len) -char *s1; -char *s2; -int len; -{ - register char *p1; - register char *p2; - register int n; - - if (!mprimed) - mapprime(); - - p1 = s1; - p2 = s2; - n = len; - while (--n >= 0 && *p1 != '\0' && TOLOW(*p1) == TOLOW(*p2)) { - p1++; - p2++; - } - if (n < 0) - return(0); - - /* - * The following case analysis is necessary so that characters - * which look negative collate low against normal characters but - * high against the end-of-string NUL. - */ - if (*p1 == '\0' && *p2 == '\0') - return(0); - else if (*p1 == '\0') - return(-1); - else if (*p2 == '\0') - return(1); - else - return(TOLOW(*p1) - TOLOW(*p2)); -} - -/* - - mapcase - do case-mapped copy - */ -static char * /* returns src or dst */ -mapcase(dst, src, siz) -char *dst; /* destination, used only if mapping needed */ -char *src; /* source; src == dst is legal */ -size_t siz; -{ - register char *s; - register char *d; - register char *c; /* case break */ - register char *e; /* end of source */ - - - c = cipoint(src, siz); - if (c == NULL) - return(src); - - if (!mprimed) - mapprime(); - s = src; - e = s + siz; - d = dst; - - while (s < c) - *d++ = *s++; - while (s < e) - *d++ = TOLOW(*s++); - - return(dst); -} - -/* - - cipoint - where in this message-ID does it become case-insensitive? - * - * The RFC822 code is not quite complete. Absolute, total, full RFC822 - * compliance requires a horrible parsing job, because of the arcane - * quoting conventions -- abc"def"ghi is not equivalent to abc"DEF"ghi, - * for example. There are three or four things that might occur in the - * domain part of a message-id that are case-sensitive. They don't seem - * to ever occur in real news, thank Cthulhu. (What? You were expecting - * a merciful and forgiving deity to be invoked in connection with RFC822? - * Forget it; none of them would come near it.) - */ -static char * /* pointer into s, or NULL for "nowhere" */ -cipoint(s, siz) -char *s; -size_t siz; -{ - register char *p; - static char post[] = "postmaster"; - static int plen = sizeof(post)-1; - - switch (conf.casemap) { - case '0': /* unmapped, sensible */ - return(NULL); - break; - case 'C': /* C News, RFC 822 conformant (approx.) */ - p = memchr(s, '@', siz); - if (p == NULL) /* no local/domain split */ - return(NULL); /* assume all local */ - else if (p - (s+1) == plen && CISTREQN(s+1, post, plen)) { - /* crazy -- "postmaster" is case-insensitive */ - return(s); - } else - return(p); - break; - case '=': /* 2.11, neither sensible nor conformant */ - return(s); /* all case-insensitive */ - break; - } - - DEBUG(("cipoint: unknown case mapping `%c'\n", conf.casemap)); - return(NULL); /* just leave it alone */ -} - -/* - - dbzdebug - control dbz debugging at run time - */ -int /* old value */ -dbzdebug(value) -int value; -{ -#ifdef DBZDEBUG - register int old = debug; - - debug = value; - return(old); -#else - return(-1); -#endif -} diff --git a/contrib/libio/dbz/dbz.h b/contrib/libio/dbz/dbz.h deleted file mode 100644 index 3d7e8ed702..0000000000 --- a/contrib/libio/dbz/dbz.h +++ /dev/null @@ -1,32 +0,0 @@ -/* for dbm and dbz */ -typedef struct { - char *dptr; - int dsize; -} datum; - -/* standard dbm functions */ -extern int dbminit(); -extern datum fetch(); -extern int store(); -extern int delete(); /* not in dbz */ -extern datum firstkey(); /* not in dbz */ -extern datum nextkey(); /* not in dbz */ -extern int dbmclose(); /* in dbz, but not in old dbm */ - -/* new stuff for dbz */ -extern int dbzfresh(); -extern int dbzagain(); -extern datum dbzfetch(); -extern int dbzstore(); -extern int dbzsync(); -extern long dbzsize(); -extern int dbzincore(); -extern int dbzcancel(); -extern int dbzdebug(); - -/* - * In principle we could handle unlimited-length keys by operating a chunk - * at a time, but it's not worth it in practice. Setting a nice large - * bound on them simplifies the code and doesn't hurt anything. - */ -#define DBZMAXKEY 255 diff --git a/contrib/libio/dbz/dbzmain.c b/contrib/libio/dbz/dbzmain.c deleted file mode 100644 index a393d6432b..0000000000 --- a/contrib/libio/dbz/dbzmain.c +++ /dev/null @@ -1,519 +0,0 @@ -/* - * dbz - use and test dbz in various ways - * - * -Log- - */ - -#include -#include -#include -#include -#include - -#ifdef FUNNYSEEKS -#include -#else -#define SEEK_SET 0 -#endif - -#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) - -#ifndef lint -static char RCSid[] = "$Header: /egcs/carton/cvsfiles/egcs/./libio/dbz/dbzmain.c,v 1.1.1.1 1997/08/21 22:58:23 jason Exp $"; -#endif - -char *progname; - -char *inname = "(no file)"; /* filename for messages etc. */ -long lineno; /* line number for messages etc. */ - -char *my_basename; -char *pagname; -char *dir_name; -char *str2dup(); -FILE *base; - -int op = 'b'; /* what to do, default build a new table */ -int baseinput = 1; /* is the base file also the input? */ - -char *from = NULL; /* old table to use for dbzagain() */ -int omitzero = 0; /* omit lines tagged with 0 */ -long every = 0; /* report every n lines */ -int syncs = 0; /* dbzsync() on each report */ -int quick = 0; /* quick checking, not too thorough */ -int sweep = 0; /* sweep file checking all offsets */ -int useincore = 1; /* should we use incore facility? */ -long xxx = 0; /* debugging variable */ -int printx = 0; /* print xxx after all is done */ -int unique = 1; /* before store(), check with fetch() */ -int usefresh = 0; /* use dbzfresh? */ -long siz = 0; /* -p size */ -char map = 'C'; /* -p map */ -long tag = 0; /* -p tag mask */ -int exact = 0; /* do not run dbzsize(siz) */ -int dbzint = 1; /* use new interface? */ -char fs = '\t'; /* field separator, default tab */ -int unopen = 0; /* make base unopenable during dbminit? */ -char *change = NULL; /* chdir here before dbmclose */ - -#define DEFBUF 1024 /* default line-buffer size */ -int buflen = DEFBUF; /* line length limit */ -char lbuf[DEFBUF]; -char *line = lbuf; -char cbuf[DEFBUF]; -char *cmp = cbuf; - -void fail(); -void dofile(); -void runs(); -void dosweep(); -void mkfiles(); -void crfile(); -void doline(); -void process(); - -#ifdef HAVERFCIZE -extern char *rfc822ize(); -#else -#define rfc822ize(n) (n) -#endif - -extern char *malloc(); - -/* - - main - parse arguments and handle options - */ -int -main(argc, argv) -int argc; -char *argv[]; -{ - int c; - int errflg = 0; - extern int optind; - extern char *optarg; - int doruns = 0; - extern long atol(); - - progname = argv[0]; - - while ((c = getopt(argc, argv, "axcmt:l:R0E:SqOiX:Yuf:p:eMUC:d")) != EOF) - switch (c) { - case 'a': /* append to existing table */ - if (op != 'b') - fail("only one of -a -x -c -m can be given", ""); - op = 'a'; - baseinput = 0; - break; - case 'x': /* extract from existing table */ - if (op != 'b') - fail("only one of -a -x -c -m can be given", ""); - op = 'x'; - baseinput = 0; - break; - case 'c': /* check existing table */ - if (op != 'b') - fail("only one of -a -x -c -m can be given", ""); - op = 'c'; - break; - case 'm': /* extract missing (complement of -x) */ - if (op != 'b') - fail("only one of -a -x -c -m can be given", ""); - op = 'm'; - baseinput = 0; - break; - case 't': /* set field separator */ - if (strlen(optarg) > 1) - fail("only one field separator allowed", ""); - fs = *optarg; - break; - case 'l': /* override line-length limit */ - buflen = atoi(optarg) + 1; - if (buflen <= 2) - fail("bad -l value `%s'", optarg); - line = malloc(buflen); - cmp = malloc(buflen); - if (line == NULL || cmp == NULL) - fail("cannot allocate %s-byte buffers", optarg); - break; - case 'R': /* print run statistics */ - doruns = 1; - break; - case '0': /* omit lines tagged (by fake -t) with 0 */ - omitzero = 1; - break; - case 'E': /* report every n items */ - every = atol(optarg); - break; - case 'S': /* dbzsync() on each -E report */ - syncs = 1; - break; - case 'q': /* quick check or extract */ - quick = 1; - break; - case 'O': /* sweep file checking all offsets */ - sweep = 1; - break; - case 'i': /* don't use incore */ - useincore = 0; - break; - case 'X': /* set xxx */ - xxx = atoi(optarg); - break; - case 'Y': /* print xxx afterward */ - printx = 1; - break; - case 'u': /* don't check uniqueness */ - unique = 0; - break; - case 'f': /* init from existing table's parameters */ - from = optarg; - break; - case 'p': /* parameters for dbzfresh */ - if (sscanf(optarg, "%ld %1s %lx", &siz, &map, &tag) != 3) { - map = '?'; - tag = 0; - if (sscanf(optarg, "%ld", &siz) != 1) - fail("bad -n value `%s'", optarg); - } - usefresh = 1; - break; - case 'e': /* -p size is exact, don't dbzsize() it */ - exact = 1; - break; - case 'M': /* use old dbm interface + rfc822ize */ - dbzint = 0; - break; - case 'U': /* make base unopenable during init */ - unopen = 1; - break; - case 'C': /* change directories before dbmclose */ - change = optarg; - break; - case 'd': /* Debugging. */ - if (dbzdebug(1) < 0) - fail("dbz debugging not available", ""); - break; - case '?': - default: - errflg++; - break; - } - if (errflg || optind >= argc || (optind+1 < argc && baseinput)) { - fprintf(stderr, "usage: %s ", progname); - fprintf(stderr, "[-a] [-x] [-c] database [file] ...\n"); - exit(2); - } - - (void) dbzincore(useincore); - my_basename = argv[optind]; - pagname = str2dup(my_basename, ".pag"); - dir_name = str2dup(my_basename, ".dir"); - mkfiles(); - optind++; - - if (baseinput) /* implies no further arguments */ - process(base, my_basename); - else if (optind >= argc) - process(stdin, "stdin"); - else - for (; optind < argc; optind++) - dofile(argv[optind]); - - if (change != NULL) - (void) chdir(change); - if (dbmclose() < 0) - fail("dbmclose failed", ""); - if (doruns) - runs(pagname); - if (sweep) - dosweep(my_basename, pagname); - if (printx) - printf("%ld\n", xxx); -#ifdef DBZ_FINISH - DBZ_FINISH; -#endif - exit(0); -} - -/* - - dofile - open a file and invoke process() - */ -void -dofile(name) -char *name; -{ - register FILE *in; - - if (STREQ(name, "-")) - process(stdin, "-"); - else { - in = fopen(name, "r"); - if (in == NULL) - fail("cannot open `%s'", name); - process(in, name); - (void) fclose(in); - } -} - -/* - - mkfiles - create empty files and open them up - */ -void -mkfiles() -{ - if (op == 'b' && !dbzint) { - crfile(dir_name); - crfile(pagname); - } - - base = fopen(my_basename, (op == 'a') ? "a" : "r"); - if (base == NULL) - fail("cannot open `%s'", my_basename); - if (unopen) - (void) chmod(my_basename, 0); - if (from != NULL) { - if (dbzagain(my_basename, from) < 0) - fail("dbzagain(`%s'...) failed", my_basename); - } else if (op == 'b' && dbzint) { - if (!exact) - siz = dbzsize(siz); - if (dbzfresh(my_basename, siz, (int)fs, map, (off_t)tag) < 0) - fail("dbzfresh(`%s'...) failed", my_basename); - } else if (dbminit(my_basename) < 0) - fail("dbminit(`%s') failed", my_basename); - if (unopen) - (void) chmod(my_basename, 0600); /* hard to restore original */ -} - -/* - - crfile - create a file - */ -void -crfile(name) -char *name; -{ - register int f; - - f = creat(name, 0666); - if (f < 0) - fail("cannot create `%s'", name); - (void) close(f); -} - -/* - - process - process input file - */ -void -process(in, name) -FILE *in; -char *name; -{ - register off_t place; - - inname = name; - lineno = 0; - - for (;;) { - place = ftell(in); - if (fgets(line, buflen, in) == NULL) - return; - lineno++; - if (every > 0 && lineno%every == 0) { - fprintf(stderr, "%ld\n", lineno); - if (dbzsync() < 0) - fail("dbzsync failed", ""); - } - doline(line, place); - } - /* NOTREACHED */ -} - -/* - - doline - process input line - */ -void -doline(lp, inoffset) -char *lp; -off_t inoffset; -{ - register char *p; - register char pc; - datum key, value; - off_t place = inoffset; - register int shouldfind; - register int llen; - char keytext[DBZMAXKEY+1]; - - p = NULL; - if (fs != '\0') - p = strchr(lp, fs); - if (p == NULL) - p = lp + strlen(lp); - if (p > lp && *(p-1) == '\n') - p--; - if (p - lp > DBZMAXKEY) - fail("key of `%.40s...' too long", lp); - pc = *p; - *p = '\0'; - (void) strcpy(keytext, lp); - *p = pc; - key.dptr = (dbzint) ? keytext : rfc822ize(keytext); - key.dsize = strlen(keytext)+1; - - switch (op) { - case 'a': - place = ftell(base); - llen = strlen(lp); - if (fwrite(lp, 1, llen, base) != llen) - fail("write error in `%s'", my_basename); - /* FALLTHROUGH */ - case 'b': - if (omitzero && p != NULL && *(p+1) == '0') - return; - if (unique) { - value = (dbzint) ? dbzfetch(key) : fetch(key); - if (value.dptr != NULL) - fail("`%.40s...' already present", lp); - } - value.dptr = (char *)&place; - value.dsize = (int)sizeof(off_t); - if (((dbzint) ? dbzstore(key, value) : store(key, value)) < 0) - fail("store failed on `%.40s...'", lp); - break; - case 'c': - value = (dbzint) ? dbzfetch(key) : fetch(key); - shouldfind = (omitzero && p != NULL && *(p+1) == '0') ? 0 : 1; - if (!shouldfind && (value.dptr != NULL || value.dsize != 0)) - fail("`%.40s...' found, shouldn't be", lp); - if (shouldfind && (value.dptr == NULL || - value.dsize != sizeof(off_t))) - fail("can't find `%.40s...'", lp); - if (shouldfind && !quick) { - (void) memcpy((char *)&place, value.dptr, sizeof(off_t)); - if (place != inoffset) - fail("offset mismatch on `%.40s...'", lp); - if (fseek(base, place, SEEK_SET) == -1) - fail("fseek failed on `%.40s...'", lp); - if (fgets(cmp, buflen, base) == NULL) - fail("can't read line for `%.40s...'", lp); - if (!STREQ(lp, cmp)) - fail("compare failed on `%.40s...'", lp); - } - break; - case 'x': - value = (dbzint) ? dbzfetch(key) : fetch(key); - if (value.dptr != NULL && !quick) { - (void) memcpy((char *)&place, value.dptr, sizeof(off_t)); - if (fseek(base, place, SEEK_SET) == -1) - fail("fseek failed on `%.40s...'", lp); - if (fgets(cmp, buflen, base) == NULL) - fail("can't read line for `%.40s...'", lp); - fputs(cmp, stdout); - } else if (value.dptr != NULL) - fputs(lp, stdout); - break; - case 'm': - value = (dbzint) ? dbzfetch(key) : fetch(key); - if (value.dptr == NULL) { - fputs(keytext, stdout); - putchar('\n'); - } - break; - default: - fail("unknown operator -- can't happen", ""); - break; - } -} - -/* - - runs - print run statistics - */ -void -runs(file) -char *file; -{ - register FILE *fd; - off_t it; - register long run; - - fd = fopen(file, "r"); - if (fd == NULL) - fail("cannot reopen `%s'", file); - run = 0; - while (fread((char *)&it, sizeof(off_t), 1, fd) == 1) { - if (it != 0) - run++; - else if (run > 0) { - printf("%ld\n", run); - run = 0; - } - } - (void) fclose(fd); -} - -/* - - dosweep - sweep pag file checking for valid offsets - */ -void -dosweep(fn, pn) -char *fn; -char *pn; -{ - register FILE *pf; - off_t it; - char nl; - register FILE *hf; - - hf = fopen(fn, "r"); - if (hf == NULL) - fail("cannot reopen `%s'", fn); - pf = fopen(pn, "r"); - if (pf == NULL) - fail("cannot reopen `%s'", pn); - while (fread((char *)&it, sizeof(off_t), 1, pf) == 1) { - it = (it & ((off_t)0x80000000)) ? (it&~((off_t)0xff000000)) : it; - if (it != 0 && it != 1) { /* 0 empty, 1 known okay */ - it--; /* get rid of bias */ - (void) fseek(hf, it-1, SEEK_SET); - nl = getc(hf); - if (nl != '\n') - fprintf(stderr, "offset 0%lo does not point to line\n", - (long)it); - } - } - (void) fclose(hf); - (void) fclose(pf); -} - -/* - - fail - complain and die - */ -void -fail(s1, s2) -char *s1; -char *s2; -{ - fprintf(stderr, "%s: (file `%s', line %ld) ", progname, inname, lineno); - fprintf(stderr, s1, s2); - fprintf(stderr, "\n"); - exit(1); -} - -/* - - str2dup - concatenate strings and malloc result - */ -char * -str2dup(s1, s2) -char *s1; -char *s2; -{ - register char *p; - - p = malloc((size_t)strlen(s1) + strlen(s2) + 1); - if (p == NULL) - fail("can't allocate space for strings", ""); - (void) strcpy(p, s1); - (void) strcat(p, s2); - return(p); -} diff --git a/contrib/libio/dbz/fake.c b/contrib/libio/dbz/fake.c deleted file mode 100644 index ed2a2b7593..0000000000 --- a/contrib/libio/dbz/fake.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * fake - make up random lines resembling history-file entries, reproducibly - * - * -Log- - */ - -#include -#include -#include -#include - -#define MAXSTR 500 /* For sizing strings -- DON'T use BUFSIZ! */ -#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) - -#ifndef lint -static char RCSid[] = "$Header: /rel/cvsfiles/devo/libio/dbz/fake.c,v 1.2 1993/10/25 20:02:42 bothner Exp $"; -#endif - -int midonly = 0; /* just message ids, rest not realistic */ -int tag = 0; /* tag lines with random digit for later use */ -int expired = -1; /* percentage of lines to be expired */ - -int debug = 0; -char *progname; - -char *inname; /* filename for messages etc. */ -long lineno; /* line number for messages etc. */ - -void doline(); -void addchars(); -void seed(); - -/* - - main - parse arguments and handle options - */ -int -main(argc, argv) -int argc; -char *argv[]; -{ - int c; - int errflg = 0; - FILE *in; - struct stat statbuf; - extern int optind; - extern char *optarg; - void process(); - register long no; - extern long atol(); - char line[MAXSTR]; - - progname = argv[0]; - - while ((c = getopt(argc, argv, "ms:te:d")) != EOF) - switch (c) { - case 'm': /* message-ids only */ - midonly = 1; - break; - case 's': /* seed */ - seed(atol(optarg)); - break; - case 't': /* tag lines with a random digit */ - tag = 1; - break; - case 'e': /* percentage to be expired */ - expired = atoi(optarg); - break; - case 'd': /* Debugging. */ - debug++; - break; - case '?': - default: - errflg++; - break; - } - if (errflg || optind != argc - 1) { - fprintf(stderr, "usage: %s ", progname); - fprintf(stderr, "[-m] [-s seed] length\n"); - exit(2); - } - - for (no = atol(argv[optind]); no > 0; no--) { - doline(line); - puts(line); - } -#ifdef DBZ_FINISH - DBZ_FINISH; -#endif - exit(0); -} - -/* - - doline - generate random history pseudo-line - */ -void -doline(buf) -char *buf; -{ - char tagch[2]; - - (void) strcpy(buf, "<"); - addchars(buf, range(4, 20)); - (void) strcat(buf, "@"); - addchars(buf, range(8, 20)); - if (midonly) - (void) strcat(buf, ">\tx"); - else { - if (tag) { - tagch[0] = "1234567890"[range(0,9)]; - tagch[1] = '\0'; - (void) strcat(buf, ">\t"); - (void) strcat(buf, tagch); - (void) strcat(buf, "00000000~-"); - } else - (void) strcat(buf, ">\t1234567890~-"); - } - if (range(1, 100) > expired) { - if (midonly) - (void) strcat(buf, "\tx"); - else { - (void) strcat(buf, "\t"); - addchars(buf, range(10, 30)); - } - } -} - -/* - - addchars - generate n random characters suitable for history file - */ -void -addchars(buf, len) -char *buf; -int len; -{ - register int i; - register char *p = buf + strlen(buf); - static char vocab[] = "1234567890.abcde.fghij.klmno.pqrst.uvwxyz.\ -1234567890.ABCDE.FGHIJ.KLMNO.PQRST.UVWXYZ.1234567890.\ -1234567890.abcde.fghij.klmno.pqrst.uvwxyz.1234567890"; - - for (i = len; i > 0; i--) - *p++ = vocab[range(0, sizeof(vocab)-2)]; - *p++ = '\0'; -} diff --git a/contrib/libio/dbz/firstlast25 b/contrib/libio/dbz/firstlast25 deleted file mode 100644 index 4850468c0c..0000000000 --- a/contrib/libio/dbz/firstlast25 +++ /dev/null @@ -1,50 +0,0 @@ - 600000000~- 90fz0706yo.1Env21x8b - 200000000~- -<1Hy.ufmjqe371x5.o@HEEl0tAp4> 700000000~- - 600000000~- - 700000000~- -<6kUzkf.v74@iC1iGj882RQ0zli> 400000000~- - 600000000~- -<.wVJi1DX42@5.4i6.jaZ6qw9Ln1.> 500000000~- - 300000000~- -<43hQ.5shbE7@912400.ajES6x0sXl.M> 400000000~- - 600000000~- -<923s5e67d5Oq085Y.1@6Pik68584> 900000000~- -<.5.n5cx5aD62i9q8@Ai60Sc.4x> 200000000~- -<9N9n@3.1ql87.yj2xFs.zLqI> 700000000~- Q2.kni8kZps7kF5uiEv32B38y4z.p -<.X.fw.6LtoT.0@pp6bp.5s6yh74.> 400000000~- -<54c1w@7..u1.99m9T4j.BNGBiK> 600000000~- .F3hb.OFh06V..p - 500000000~- - 000000000~- -<0C605s6plaAgfM.ap40@e6d66n.uv01W.j.8ph.> 100000000~- m.x7TY8.8DQ5 -<.2.14xdn.@D0g.W.uZ.75gyyg.q1G> 100000000~- -<.A..03.@5v..64.5v3.3tbjUo.> 500000000~- -<72..c19ms65.WCf0G3.@83seEG9nnhM.O.j22> 900000000~- - 000000000~- NPLL42XVfM -<6HO.nFal1ufl3.8b@3.n0k7a.IDgNy> 700000000~- Wv4j3Itccnh0Zp3 - 400000000~- k67.hvXwv6X745R4rh2ybuFN3n. -<62dIeg.fW92.ov375@x76mf5c6.37.v> 000000000~- - 900000000~- -<.9Xr.7V91..oe5CG.hX@p5x3jos3s27R6O3yj1> 400000000~- - 100000000~- - 200000000~- - 400000000~- -<87.W3r6is4.@svVqQCBiNqz400A.qwj> 200000000~- -<0liI7Lu0Mx435m7M99@87Xw.8j63.9.> 500000000~- - 200000000~- e27S.BKVD70P.o - 200000000~- -<.2.69hy3JT1@Aq3.r83o.9> 700000000~- -<.W7EurYppo4fhzs.I@8651m2W7v> 700000000~- -<3m02.@22074.a5ct2j3> 900000000~- -<.fy9Epa@.1.kNGCNokFwB8ezo1WM> 800000000~- - 900000000~- - 100000000~- 9A6Ejq5t55I4VJ6.q1 - 300000000~- - 400000000~- - 000000000~- -<.0p3G7novlrYz9kjI@Sx.2w.yqzerZl12781.k> 700000000~- -<51ny.pQ7ay4@nfU2l1f0ixG09584.m> 000000000~- 38K5bhK7cr6.bg.5MlC2Fxq06Ziuw. -<2.cau.9s@.n4Pk0Jd9g> 300000000~- - 300000000~- c8.t4Q0.8t0.m50 -<.t13789u5AqM4m3.z0T@P17e.ypf> 200000000~- q17z.fZ3.FyD533WthqZs8q7 - 100000000~- diff --git a/contrib/libio/dbz/getmap b/contrib/libio/dbz/getmap deleted file mode 100755 index fd746cad7d..0000000000 --- a/contrib/libio/dbz/getmap +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -awk 'NR == 1 { - for (i = 9; i <= NF; i++) - printf "%s ", $i - printf "\n" -}' $* diff --git a/contrib/libio/dbz/random.c b/contrib/libio/dbz/random.c deleted file mode 100644 index 1d8de3a2b4..0000000000 --- a/contrib/libio/dbz/random.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * random-number generator for testing - */ -static unsigned long next = 1; - -/* - - range - generate a random number within an inclusive range - * - * Algorithm from ANSI C standard. Limitation: max-min <= 32767. - */ -int -range(min, max) -int min; -int max; -{ - register int temp; - - next = next * 1103515245 + 12345; - temp = (int)((next/65536)%32768); - return(temp%(max - min + 1) + min); -} - -/* - - seed - seed random number generator - */ -void -seed(n) -long n; -{ - next = (unsigned long)n; -} diff --git a/contrib/libio/dbz/revbytes b/contrib/libio/dbz/revbytes deleted file mode 100644 index b3d80c2685..0000000000 --- a/contrib/libio/dbz/revbytes +++ /dev/null @@ -1,7 +0,0 @@ -NR == 1 { - printf "%s %s %s %s %s %s %s %s %s", $1, $2, $3, $4, $5, $6, $7, $8, $9 - for (i = NF; i > 9; i--) - printf " %s", $i - printf "\n" -} -NR > 1 { print } diff --git a/contrib/libio/dbz/stdio.h b/contrib/libio/dbz/stdio.h deleted file mode 100644 index 80faee30ad..0000000000 --- a/contrib/libio/dbz/stdio.h +++ /dev/null @@ -1 +0,0 @@ -#include "../iostdio.h" diff --git a/contrib/libio/depend b/contrib/libio/depend deleted file mode 100644 index 15888c4574..0000000000 --- a/contrib/libio/depend +++ /dev/null @@ -1,379 +0,0 @@ -# AUTOMATICALLY GENERATED BY 'make depend' - DO NOT EDIT - -PlotFile.o: PlotFile.cc \ - $(srcdir)/PlotFile.h \ - $(srcdir)/fstream.h \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -SFile.o: SFile.cc \ - $(srcdir)/SFile.h \ - $(srcdir)/fstream.h \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -builtinbuf.o: builtinbuf.cc \ - $(srcdir)/builtinbuf.h \ - $(srcdir)/streambuf.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/iostreamP.h \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h -editbuf.o: editbuf.cc \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/editbuf.h \ - $(srcdir)/fstream.h \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h -filebuf.o: filebuf.cc \ - $(srcdir)/iostreamP.h \ - $(srcdir)/streambuf.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/builtinbuf.h -fstream.o: fstream.cc \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/fstream.h \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h -indstream.o: indstream.cc \ - $(srcdir)/indstream.h \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -ioassign.o: ioassign.cc \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h -ioextend.o: ioextend.cc \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iomanip.o: iomanip.cc \ - $(srcdir)/iomanip.h \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iostream.o: iostream.cc \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/floatio.h -isgetline.o: isgetline.cc \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h -isgetsb.o: isgetsb.cc \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h -isscan.o: isscan.cc \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h -osform.o: osform.cc \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h -parsestream.o: parsestream.cc \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/parsestream.h \ - $(srcdir)/streambuf.h -pfstream.o: pfstream.cc \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/pfstream.h \ - $(srcdir)/fstream.h \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h \ - $(srcdir)/procbuf.h -procbuf.o: procbuf.cc \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/procbuf.h \ - $(srcdir)/streambuf.h -sbform.o: sbform.cc \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/streambuf.h -sbgetline.o: sbgetline.cc \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/streambuf.h -sbscan.o: sbscan.cc \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/streambuf.h -stdiostream.o: stdiostream.cc \ - $(srcdir)/stdiostream.h \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h -stdstrbufs.o: stdstrbufs.cc \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/stdiostream.h \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h -stdstreams.o: stdstreams.cc \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/streambuf.h \ - $(srcdir)/iostream.h -stream.o: stream.cc \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/stream.h \ - $(srcdir)/iostream.h \ - $(srcdir)/streambuf.h \ - $(srcdir)/strstream.h \ - $(srcdir)/strfile.h -streambuf.o: streambuf.cc \ - $(srcdir)/iostreamP.h \ - $(srcdir)/streambuf.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h -strstream.o: strstream.cc \ - $(srcdir)/iostreamP.h \ - $(srcdir)/streambuf.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/strstream.h \ - $(srcdir)/iostream.h \ - $(srcdir)/strfile.h -cleanup.o: cleanup.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -filedoalloc.o: filedoalloc.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -fileops.o: fileops.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -floatconv.o: floatconv.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -genops.o: genops.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iofclose.o: iofclose.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iofdopen.o: iofdopen.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iofeof.o: iofeof.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -ioferror.o: ioferror.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iofflush.o: iofflush.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iofflush_u.o: iofflush_u.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iofgetpos.o: iofgetpos.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iofgets.o: iofgets.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iofopen.o: iofopen.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iofprintf.o: iofprintf.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iofputs.o: iofputs.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iofread.o: iofread.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iofscanf.o: iofscanf.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iofsetpos.o: iofsetpos.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -ioftell.o: ioftell.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iofwrite.o: iofwrite.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iogetc.o: iogetc.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iogetdelim.o: iogetdelim.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iogetline.o: iogetline.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iogets.o: iogets.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -ioignore.o: ioignore.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iopadn.o: iopadn.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -ioperror.o: ioperror.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iopopen.o: iopopen.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -ioprims.o: ioprims.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -ioprintf.o: ioprintf.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -ioputc.o: ioputc.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -ioputs.o: ioputs.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -ioscanf.o: ioscanf.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -ioseekoff.o: ioseekoff.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -ioseekpos.o: ioseekpos.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iosetbuffer.o: iosetbuffer.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iosetvbuf.o: iosetvbuf.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iosprintf.o: iosprintf.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iosscanf.o: iosscanf.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iostrerror.o: iostrerror.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -ioungetc.o: ioungetc.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -iovfprintf.o: iovfprintf.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/floatio.h -iovfscanf.o: iovfscanf.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/floatio.h -iovsprintf.o: iovsprintf.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/strfile.h -iovsscanf.o: iovsscanf.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/strfile.h -outfloat.o: outfloat.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -peekc.o: peekc.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -stdfiles.o: stdfiles.c \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) -strops.o: strops.c \ - $(srcdir)/strfile.h \ - $(srcdir)/libio.h $(_G_CONFIG_H) \ - $(srcdir)/libioP.h \ - $(srcdir)/iolibio.h diff --git a/contrib/libio/editbuf.cc b/contrib/libio/editbuf.cc deleted file mode 100644 index 22304820f8..0000000000 --- a/contrib/libio/editbuf.cc +++ /dev/null @@ -1,717 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. - -Written by Per Bothner (bothner@cygnus.com). */ - -#ifdef __GNUG__ -#pragma implementation -#endif -#include "libioP.h" -#include "editbuf.h" -#include -#include - -/* NOTE: Some of the code here is taken from GNU emacs */ -/* Hence this file falls under the GNU License! */ - -// Invariants for edit_streambuf: -// An edit_streambuf is associated with a specific edit_string, -// which again is a sub-string of a specific edit_buffer. -// An edit_streambuf is always in either get mode or put mode, never both. -// In get mode, gptr() is the current position, -// and pbase(), pptr(), and epptr() are all NULL. -// In put mode, pptr() is the current position, -// and eback(), gptr(), and egptr() are all NULL. -// Any edit_streambuf that is actively doing insertion (as opposed to -// replacing) // must have its pptr() pointing to the start of the gap. -// Only one edit_streambuf can be actively inserting into a specific -// edit_buffer; the edit_buffer's _writer field points to that edit_streambuf. -// That edit_streambuf "owns" the gap, and the actual start of the -// gap is the pptr() of the edit_streambuf; the edit_buffer::_gap_start pointer -// will only be updated on an edit_streambuf::overflow(). - -int edit_streambuf::truncate() -{ - str->buffer->delete_range(str->buffer->tell((buf_char*)pptr()), - str->buffer->tell(str->end)); - return 0; -} - -#ifdef OLD_STDIO -inline void disconnect_gap_from_file(edit_buffer* buffer, FILE* fp) -{ - if (buffer->gap_start_ptr != &fp->__bufp) - return; - buffer->gap_start_normal = fp->__bufp; - buffer->gap_start_ptr = &buffer->gap_start_normal; -} -#endif - -void edit_streambuf::flush_to_buffer(edit_buffer* buffer) -{ - if (pptr() > buffer->_gap_start && pptr() < buffer->gap_end()) - buffer->_gap_start = pptr(); -} - -void edit_streambuf::disconnect_gap_from_file(edit_buffer* buffer) -{ - if (buffer->_writer != this) return; - flush_to_buffer(buffer); - setp(pptr(),pptr()); - buffer->_writer = NULL; -} - -buf_index edit_buffer::tell(buf_char *ptr) -{ - if (ptr <= gap_start()) - return ptr - data; - else - return ptr - gap_end() + size1(); -} - -#if 0 -buf_index buf_cookie::tell() -{ - return str->buffer->tell(file->__bufp); -} -#endif - -buf_index edit_buffer::tell(edit_mark*mark) -{ - return tell(data + mark->index_in_buffer(this)); -} - -// adjust the position of the gap - -void edit_buffer::move_gap(buf_offset pos) -{ - if (pos < size1()) - gap_left (pos); - else if (pos > size1()) - gap_right (pos); -} - -void edit_buffer::gap_left (int pos) -{ - register buf_char *to, *from; - register int i; - int new_s1; - - i = size1(); - from = gap_start(); - to = from + gap_size(); - new_s1 = size1(); - - /* Now copy the characters. To move the gap down, - copy characters up. */ - - for (;;) - { - /* I gets number of characters left to copy. */ - i = new_s1 - pos; - if (i == 0) - break; -#if 0 - /* If a quit is requested, stop copying now. - Change POS to be where we have actually moved the gap to. */ - if (QUITP) - { - pos = new_s1; - break; - } -#endif - /* Move at most 32000 chars before checking again for a quit. */ - if (i > 32000) - i = 32000; - new_s1 -= i; - while (--i >= 0) - *--to = *--from; - } - - /* Adjust markers, and buffer data structure, to put the gap at POS. - POS is where the loop above stopped, which may be what was specified - or may be where a quit was detected. */ - adjust_markers (pos << 1, size1() << 1, gap_size(), data); -#ifndef OLD_STDIO - _gap_start = data + pos; -#else - if (gap_start_ptr == &gap_start_normal) - gap_start_normal = data + pos; -#endif - __gap_end_pos = to - data; -/* QUIT;*/ -} - -void edit_buffer::gap_right (int pos) -{ - register buf_char *to, *from; - register int i; - int new_s1; - - i = size1(); - to = gap_start(); - from = i + gap_end(); - new_s1 = i; - - /* Now copy the characters. To move the gap up, - copy characters down. */ - - while (1) - { - /* I gets number of characters left to copy. */ - i = pos - new_s1; - if (i == 0) - break; -#if 0 - /* If a quit is requested, stop copying now. - Change POS to be where we have actually moved the gap to. */ - if (QUITP) - { - pos = new_s1; - break; - } -#endif - /* Move at most 32000 chars before checking again for a quit. */ - if (i > 32000) - i = 32000; - new_s1 += i; - while (--i >= 0) - *to++ = *from++; - } - - adjust_markers ((size1() + gap_size()) << 1, (pos + gap_size()) << 1, - - gap_size(), data); -#ifndef OLD_STDIO - _gap_start = data+pos; -#else - if (gap_start_ptr == &gap_start_normal) - gap_start_normal = data + pos; -#endif - __gap_end_pos = from - data; -/* QUIT;*/ -} - -/* make sure that the gap in the current buffer is at least k - characters wide */ - -void edit_buffer::make_gap(buf_offset k) -{ - register buf_char *p1, *p2, *lim; - buf_char *old_data = data; - int s1 = size1(); - - if (gap_size() >= k) - return; - - /* Get more than just enough */ - if (buf_size > 1000) k += 2000; - else k += /*200;*/ 20; // for testing! - - p1 = (buf_char *) realloc (data, s1 + size2() + k); - if (p1 == 0) - abort(); /*memory_full ();*/ - - k -= gap_size(); /* Amount of increase. */ - - /* Record new location of text */ - data = p1; - - /* Transfer the new free space from the end to the gap - by shifting the second segment upward */ - p2 = data + buf_size; - p1 = p2 + k; - lim = p2 - size2(); - while (lim < p2) - *--p1 = *--p2; - - /* Finish updating text location data */ - __gap_end_pos += k; - -#ifndef OLD_STDIO - _gap_start = data + s1; -#else - if (gap_start_ptr == &gap_start_normal) - gap_start_normal = data + s1; -#endif - - /* adjust markers */ - adjust_markers (s1 << 1, (buf_size << 1) + 1, k, old_data); - buf_size += k; -} - -/* Add `amount' to the position of every marker in the current buffer - whose current position is between `from' (exclusive) and `to' (inclusive). - Also, any markers past the outside of that interval, in the direction - of adjustment, are first moved back to the near end of the interval - and then adjusted by `amount'. */ - -void edit_buffer::adjust_markers(register mark_pointer low, - register mark_pointer high, - int amount, buf_char *old_data) -{ - register struct edit_mark *m; - register mark_pointer mpos; - /* convert to mark_pointer */ - amount <<= 1; - - if (_writer) - _writer->disconnect_gap_from_file(this); - - for (m = mark_list(); m != NULL; m = m->chain) - { - mpos = m->_pos; - if (amount > 0) - { - if (mpos > high && mpos < high + amount) - mpos = high + amount; - } - else - { - if (mpos > low + amount && mpos <= low) - mpos = low + amount; - } - if (mpos > low && mpos <= high) - mpos += amount; - m->_pos = mpos; - } - - // Now adjust files - edit_streambuf *file; - - for (file = files; file != NULL; file = file->next) { - mpos = file->current() - old_data; - if (amount > 0) - { - if (mpos > high && mpos < high + amount) - mpos = high + amount; - } - else - { - if (mpos > low + amount && mpos <= low) - mpos = low + amount; - } - if (mpos > low && mpos <= high) - mpos += amount; - char* new_pos = data + mpos; - file->set_current(new_pos, file->is_reading()); - } -} - -#if 0 -stdio_ - __off == index at start of buffer (need only be valid after seek ? ) - __buf == - -if read/read_delete/overwrite mode: - __endp <= min(*gap_start_ptr, edit_string->end->ptr(buffer)) - -if inserting: - must have *gap_start_ptr == __bufp && *gap_start_ptr+gap == __endp - file->edit_string->end->ptr(buffer) == *gap_start_ptr+end -if write_mode: - if before gap -#endif - -int edit_streambuf::underflow() -{ - if (!(_mode & ios::in)) - return EOF; - struct edit_buffer *buffer = str->buffer; - if (!is_reading()) { // Must switch from put to get mode. - disconnect_gap_from_file(buffer); - set_current(pptr(), 1); - } - buf_char *str_end = str->end->ptr(buffer); - retry: - if (gptr() < egptr()) { - return *gptr(); - } - if ((buf_char*)gptr() == str_end) - return EOF; - if (str_end <= buffer->gap_start()) { - setg(eback(), gptr(), str_end); - goto retry; - } - if (gptr() < buffer->gap_start()) { - setg(eback(), gptr(), buffer->gap_start()); - goto retry; - } - if (gptr() == buffer->gap_start()) { - disconnect_gap_from_file(buffer); -// fp->__offset += fp->__bufp - fp->__buffer; - setg(buffer->gap_end(), buffer->gap_end(), str_end); - } - else - setg(eback(), gptr(), str_end); - goto retry; -} - -int edit_streambuf::overflow(int ch) -{ - if (_mode == ios::in) - return EOF; - struct edit_buffer *buffer = str->buffer; - flush_to_buffer(buffer); - if (ch == EOF) - return 0; - if (is_reading()) { // Must switch from get to put mode. - set_current(gptr(), 0); - } - buf_char *str_end = str->end->ptr(buffer); - retry: - if (pptr() < epptr()) { - *pptr() = ch; - pbump(1); - return (unsigned char)ch; - } - if ((buf_char*)pptr() == str_end || inserting()) { - /* insert instead */ - if (buffer->_writer) - buffer->_writer->flush_to_buffer(); // Redundant? - buffer->_writer = NULL; - if (pptr() >= buffer->gap_end()) - buffer->move_gap(pptr() - buffer->gap_size()); - else - buffer->move_gap(pptr()); - buffer->make_gap(1); - setp(buffer->gap_start(), buffer->gap_end()); - buffer->_writer = this; - *pptr() = ch; - pbump(1); - return (unsigned char)ch; - } - if (str_end <= buffer->gap_start()) { - // Entire string is left of gap. - setp(pptr(), str_end); - } - else if (pptr() < buffer->gap_start()) { - // Current pos is left of gap. - setp(pptr(), buffer->gap_start()); - goto retry; - } - else if (pptr() == buffer->gap_start()) { - // Current pos is at start of gap; move to end of gap. -// disconnect_gap_from_file(buffer); - setp(buffer->gap_end(), str_end); -// __offset += __bufp - __buffer; - } - else { - // Otherwise, current pos is right of gap. - setp(pptr(), str_end); - } - goto retry; -} - -void edit_streambuf::set_current(char *new_pos, int reading) -{ - if (reading) { - setg(new_pos, new_pos, new_pos); - setp(NULL, NULL); - } - else { - setg(NULL, NULL, NULL); - setp(new_pos, new_pos); - } -} - -// Called by fseek(fp, pos, whence) if fp is bound to a edit_buffer. - -streampos edit_streambuf::seekoff(streamoff offset, _seek_dir dir, - int /* =ios::in|ios::out*/) -{ - struct edit_buffer *buffer = str->buffer; - disconnect_gap_from_file(buffer); - buf_index cur_pos = buffer->tell((buf_char*)current());; - buf_index start_pos = buffer->tell(str->start); - buf_index end_pos = buffer->tell(str->end); - switch (dir) { - case ios::beg: - offset += start_pos; - break; - case ios::cur: - offset += cur_pos; - break; - case ios::end: - offset += end_pos; - break; - } - if (offset < start_pos || offset > end_pos) - return EOF; - buf_char *new_pos = buffer->data + offset; - buf_char* gap_start = buffer->gap_start(); - if (new_pos > gap_start) { - buf_char* gap_end = buffer->gap_end(); - new_pos += gap_end - gap_start; - if (new_pos >= buffer->data + buffer->buf_size) abort(); // Paranoia. - } - set_current(new_pos, is_reading()); - return EOF; -} - -#if 0 -int buf_seek(void *arg_cookie, fpos_t * pos, int whence) -{ - struct buf_cookie *cookie = arg_cookie; - FILE *file = cookie->file; - struct edit_buffer *buffer = cookie->str->buffer; - buf_char *str_start = cookie->str->start->ptr(buffer); - disconnect_gap_from_file(buffer, cookie->file); - fpos_t cur_pos, new_pos; - if (file->__bufp <= *buffer->gap_start_ptr - || str_start >= buffer->__gap_end) - cur_pos = str_start - file->__bufp; - else - cur_pos = - (*buffer->gap_start_ptr - str_start) + (file->__bufp - __gap_end); - end_pos = ...; - switch (whence) { - case SEEK_SET: - new_pos = *pos; - break; - case SEEK_CUR: - new_pos = cur_pos + *pos; - break; - case SEEK_END: - new_pos = end_pos + *pos; - break; - } - if (new_pos > end_pos) { - seek to end_pos; - insert_nulls(new_pos - end_pos); - return; - } - if (str_start + new_pos <= *gap_start_ptr &* *gap_start_ptr < end) { - __buffer = str_start; - __off = 0; - __bufp = str_start + new_pos; - file->__get_limit = - *buffer->gap_start_ptr; /* what if gap_start_ptr == &bufp ??? */ - } else if () { - - } - *pos = new_pos; -} -#endif - -/* Delete characters from `from' up to (but not incl) `to' */ - -void edit_buffer::delete_range (buf_index from, buf_index to) -{ - register int numdel; - - if ((numdel = to - from) <= 0) - return; - - /* Make sure the gap is somewhere in or next to what we are deleting */ - if (from > size1()) - gap_right (from); - if (to < size1()) - gap_left (to); - - /* Relocate all markers pointing into the new, larger gap - to point at the end of the text before the gap. */ - adjust_markers ((to + gap_size()) << 1, (to + gap_size()) << 1, - - numdel - gap_size(), data); - - __gap_end_pos = to + gap_size(); - _gap_start = data + from; -} - -void edit_buffer::delete_range(struct edit_mark *start, struct edit_mark *end) -{ - delete_range(tell(start), tell(end)); -} - -void buf_delete_chars(struct edit_buffer *, struct edit_mark *, size_t) -{ - abort(); -} - -edit_streambuf::edit_streambuf(edit_string* bstr, int mode) -{ - _mode = mode; - str = bstr; - edit_buffer* buffer = bstr->buffer; - next = buffer->files; - buffer->files = this; - char* buf_ptr = bstr->start->ptr(buffer); - _inserting = 0; -// setb(buf_ptr, buf_ptr, 0); - set_current(buf_ptr, !(mode & ios::out+ios::trunc+ios::app)); - if (_mode & ios::trunc) - truncate(); - if (_mode & ios::ate) - seekoff(0, ios::end); -} - -// Called by fclose(fp) if fp is bound to a edit_buffer. - -#if 0 -static int buf_close(void *arg) -{ - register struct buf_cookie *cookie = arg; - struct edit_buffer *buffer = cookie->str->buffer; - struct buf_cookie **ptr; - for (ptr = &buffer->files; *ptr != cookie; ptr = &(*ptr)->next) ; - *ptr = cookie->next; - disconnect_gap_from_file(buffer, cookie->file); - free (cookie); - return 0; -} -#endif - -edit_streambuf::~edit_streambuf() -{ - if (_mode == ios::out) - truncate(); - // Unlink this from list of files associated with bstr->buffer. - edit_streambuf **ptr = &str->buffer->files; - for (; *ptr != this; ptr = &(*ptr)->next) { } - *ptr = next; - - disconnect_gap_from_file(str->buffer); -} - -edit_buffer::edit_buffer() -{ - buf_size = /*200;*/ 15; /* for testing! */ - data = (buf_char*)malloc(buf_size); - files = NULL; -#ifndef OLD_STDIO - _gap_start = data; - _writer = NULL; -#else - gap_start_normal = data; - gap_start_ptr = &gap_start_normal; -#endif - __gap_end_pos = buf_size; - start_mark.chain = &end_mark; - start_mark._pos = 0; - end_mark.chain = NULL; - end_mark._pos = 2 * buf_size + 1; -} - -// Allocate a new mark, which is adjusted by 'delta' bytes from 'this'. -// Restrict new mark to lie within 'str'. - -edit_mark::edit_mark(struct edit_string *str, long delta) -{ - struct edit_buffer *buf = str->buffer; - chain = buf->start_mark.chain; - buf->start_mark.chain = this; - mark_pointer size1 = buf->size1() << 1; - int gap_size = buf->gap_size() << 1; - delta <<= 1; - - // check if new and old marks are opposite sides of gap - if (_pos <= size1 && _pos + delta > size1) - delta += gap_size; - else if (_pos >= size1 + gap_size && _pos + delta < size1 + gap_size) - delta -= gap_size; - - _pos = _pos + delta; - if (_pos < str->start->_pos & ~1) - _pos = (str->start->_pos & ~ 1) + (_pos & 1); - else if (_pos >= str->end->_pos) - _pos = (str->end->_pos & ~ 1) + (_pos & 1); -} - -// A (slow) way to find the buffer a mark belongs to. - -edit_buffer * edit_mark::buffer() -{ - struct edit_mark *mark; - for (mark = this; mark->chain != NULL; mark = mark->chain) ; - // Assume that the last mark on the chain is the end_mark. - return (edit_buffer *)((char*)mark - offsetof(edit_buffer, end_mark)); -} - -edit_mark::~edit_mark() -{ - // Must unlink mark from chain of owning buffer - struct edit_buffer *buf = buffer(); - if (this == &buf->start_mark || this == &buf->end_mark) abort(); - edit_mark **ptr; - for (ptr = &buf->start_mark.chain; *ptr != this; ptr = &(*ptr)->chain) ; - *ptr = this->chain; -} - -int edit_string::length() const -{ - ptrdiff_t delta = end->ptr(buffer) - start->ptr(buffer); - if (end->ptr(buffer) <= buffer->gap_start() || - start->ptr(buffer) >= buffer->gap_end()) - return delta; - return delta - buffer->gap_size(); -} - -buf_char * edit_string::copy_bytes(int *lenp) const -{ - char *new_str; - int len1, len2; - buf_char *start1, *start2; - start1 = start->ptr(buffer); - if (end->ptr(buffer) <= buffer->gap_start() - || start->ptr(buffer) >= buffer->gap_end()) { - len1 = end->ptr(buffer) - start1; - len2 = 0; - start2 = NULL; // To avoid a warning from g++. - } - else { - len1 = buffer->gap_start() - start1; - start2 = buffer->gap_end(); - len2 = end->ptr(buffer) - start2; - } - new_str = (char*)malloc(len1 + len2 + 1); - memcpy(new_str, start1, len1); - if (len2 > 0) memcpy(new_str + len1, start2, len2); - new_str[len1+len2] = '\0'; - *lenp = len1+len2; - return new_str; -} - -// Replace the buf_chars in 'this' with ones from 'src'. -// Equivalent to deleting this, then inserting src, except tries -// to leave marks in place: Marks whose offset from the start -// of 'this' is less than 'src->length()' will still have the -// same offset in 'this' when done. - -void edit_string::assign(struct edit_string *src) -{ - edit_streambuf dst_file(this, ios::out); - if (buffer == src->buffer /*&& ???*/) { /* overly conservative */ - int src_len; - buf_char *new_str; - new_str = src->copy_bytes(&src_len); - dst_file.sputn(new_str, src_len); - free (new_str); - } else { - edit_streambuf src_file(src, ios::in); - for ( ; ; ) { - int ch = src_file.sbumpc(); - if (ch == EOF) break; - dst_file.sputc(ch); - } - } -} diff --git a/contrib/libio/editbuf.h b/contrib/libio/editbuf.h deleted file mode 100644 index d15758f257..0000000000 --- a/contrib/libio/editbuf.h +++ /dev/null @@ -1,185 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. - -Written by Per Bothner (bothner@cygnus.com). */ - -#ifndef _EDITBUF_H -#define _EDITBUF_H -#ifdef __GNUG__ -#pragma interface -#endif -#include -#include - -extern "C++" { -typedef unsigned long mark_pointer; -// At some point, it might be nice to parameterize this code -// in terms of buf_char. -typedef /*unsigned*/ char buf_char; - -// Logical pos from start of buffer (does not count gap). -typedef long buf_index; - -// Pos from start of buffer, possibly including gap_size. -typedef long buf_offset; - -#if 0 -struct buf_cookie { - FILE *file; - struct edit_string *str; - struct buf_cookie *next; - buf_index tell(); -}; -#endif - -struct edit_buffer; -struct edit_mark; - -// A edit_string is defined as the region between the 'start' and 'end' marks. -// Normally (always?) 'start->insert_before()' should be false, -// and 'end->insert_before()' should be true. - -struct edit_string { - struct edit_buffer *buffer; // buffer that 'start' and 'end' belong to - struct edit_mark *start, *end; - int length() const; // count of buf_chars currently in string - edit_string(struct edit_buffer *b, - struct edit_mark *ms, struct edit_mark *me) - { buffer = b; start = ms; end = me; } -/* Make a fresh, contiguous copy of the data in STR. - Assign length of STR to *LENP. - (Output has extra NUL at out[*LENP].) */ - buf_char *copy_bytes(int *lenp) const; -// FILE *open_file(char *mode); - void assign(struct edit_string *src); // copy bytes from src to this -}; - -struct edit_streambuf : public streambuf { - friend edit_buffer; - edit_string *str; - edit_streambuf* next; // Chain of edit_streambuf's for a edit_buffer. - short _mode; - edit_streambuf(edit_string* bstr, int mode); - ~edit_streambuf(); - virtual int underflow(); - virtual int overflow(int c = EOF); - virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); - void flush_to_buffer(); - void flush_to_buffer(edit_buffer* buffer); - int _inserting; - int inserting() { return _inserting; } - void inserting(int i) { _inserting = i; } -// int delete_chars(int count, char* cut_buf); Not implemented. - int truncate(); - int is_reading() { return gptr() != NULL; } - buf_char* current() { return is_reading() ? gptr() : pptr(); } - void set_current(char *p, int is_reading); - protected: - void disconnect_gap_from_file(edit_buffer* buffer); -}; - -// A 'edit_mark' indicates a position in a buffer. -// It is "attached" the text (rather than the offset). -// There are two kinds of mark, which have different behavior -// when text is inserted at the mark: -// If 'insert_before()' is true the mark will be adjusted to be -// *after* the new text. - -struct edit_mark { - struct edit_mark *chain; - mark_pointer _pos; - inline int insert_before() { return _pos & 1; } - inline unsigned long index_in_buffer(struct edit_buffer *) - { return _pos >> 1; } - inline buf_char *ptr(struct edit_buffer *buf); - buf_index tell(); - edit_mark() { } - edit_mark(struct edit_string *str, long delta); - edit_buffer *buffer(); - ~edit_mark(); -}; - -// A 'edit_buffer' consists of a sequence of buf_chars (the data), -// a list of edit_marks pointing into the data, and a list of FILEs -// also pointing into the data. -// A 'edit_buffer' coerced to a edit_string is the string of -// all the buf_chars in the buffer. - -// This implementation uses a conventional buffer gap (as in Emacs). -// The gap start is defined by de-referencing a (buf_char**). -// This is because sometimes a FILE is inserting into the buffer, -// so rather than having each putc adjust the gap, we use indirection -// to have the gap be defined as the write pointer of the FILE. -// (This assumes that putc adjusts a pointer (as in GNU's libc), not an index.) - -struct edit_buffer { - buf_char *data; /* == emacs buffer_text.p1+1 */ - buf_char *_gap_start; - edit_streambuf* _writer; // If non-NULL, currently writing stream - inline buf_char *gap_start() - { return _writer ? _writer->pptr() : _gap_start; } - buf_offset __gap_end_pos; // size of part 1 + size of gap - /* int gap; implicit: buf_size - size1 - size2 */ - int buf_size; - struct edit_streambuf *files; - struct edit_mark start_mark; - struct edit_mark end_mark; - edit_buffer(); - inline buf_offset gap_end_pos() { return __gap_end_pos; } - inline struct edit_mark *start_marker() { return &start_mark; } - inline struct edit_mark *end_marker() { return &end_mark; } -/* these should be protected, ultimately */ - buf_index tell(edit_mark*); - buf_index tell(buf_char*); - inline buf_char *gap_end() { return data + gap_end_pos(); } - inline int gap_size() { return gap_end() - gap_start(); } - inline int size1() { return gap_start() - data; } - inline int size2() { return buf_size - gap_end_pos(); } - inline struct edit_mark * mark_list() { return &start_mark; } - void make_gap (buf_offset); - void move_gap (buf_offset pos); - void move_gap (buf_char *pos) { move_gap(pos - data); } - void gap_left (int pos); - void gap_right (int pos); - void adjust_markers(mark_pointer low, mark_pointer high, - int amount, buf_char *old_data); - void delete_range(buf_index from, buf_index to); - void delete_range(struct edit_mark *start, struct edit_mark *end); -}; - -extern buf_char * bstr_copy(struct edit_string *str, int *lenp); - -// Convert a edit_mark to a (buf_char*) - -inline buf_char *edit_mark::ptr(struct edit_buffer *buf) - { return buf->data + index_in_buffer(buf); } - -inline void edit_streambuf::flush_to_buffer() -{ - edit_buffer* buffer = str->buffer; - if (buffer->_writer == this) flush_to_buffer(buffer); -} -} // extern "C++" -#endif /* !_EDITBUF_H*/ - diff --git a/contrib/libio/filebuf.cc b/contrib/libio/filebuf.cc deleted file mode 100644 index 0b0fd6d88d..0000000000 --- a/contrib/libio/filebuf.cc +++ /dev/null @@ -1,223 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993, 1995, 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. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. - -Written by Per Bothner (bothner@cygnus.com). */ - -#include "iostreamP.h" -#include -#include -#include -#include -#include "builtinbuf.h" - -void filebuf::init() -{ - _IO_file_init(this); -} - -filebuf::filebuf() -{ - _IO_file_init(this); -} - -#if !_IO_UNIFIED_JUMPTABLES -/* This is like "new filebuf()", but it uses the _IO_file_jump jumptable, - for eficiency. */ - -filebuf* filebuf::__new() -{ - filebuf *fb = new filebuf; - _IO_JUMPS(fb) = &_IO_file_jumps; - fb->_vtable() = builtinbuf_vtable; - return fb; -} -#endif - -filebuf::filebuf(int fd) -{ - _IO_file_init(this); - _IO_file_attach(this, fd); -} - -filebuf::filebuf(int fd, char* p, int len) -{ - _IO_file_init(this); - _IO_file_attach(this, fd); - setbuf(p, len); -} - -filebuf::~filebuf() -{ - if (_IO_file_is_open(this)) - { - _IO_do_flush (this); - if (!(xflags() & _IO_DELETE_DONT_CLOSE)) - _IO_SYSCLOSE (this); - } -} - -filebuf* filebuf::open(const char *filename, ios::openmode mode, int prot) -{ - if (_IO_file_is_open (this)) - return NULL; - int posix_mode; - int read_write; - if (mode & ios::app) - mode |= ios::out; - if ((mode & (ios::in|ios::out)) == (ios::in|ios::out)) { - posix_mode = O_RDWR; - read_write = 0; - } - else if (mode & ios::out) - posix_mode = O_WRONLY, read_write = _IO_NO_READS; - else if (mode & (int)ios::in) - posix_mode = O_RDONLY, read_write = _IO_NO_WRITES; - else - posix_mode = 0, read_write = _IO_NO_READS+_IO_NO_WRITES; - if (mode & ios::binary) - { - mode &= ~ios::binary; -#ifdef O_BINARY - /* This is a (mis-)feature of DOS/Windows C libraries. */ - posix_mode |= O_BINARY; -#endif - } - if ((mode & (int)ios::trunc) || mode == (int)ios::out) - posix_mode |= O_TRUNC; - if (mode & ios::app) - posix_mode |= O_APPEND, read_write |= _IO_IS_APPENDING; - if (!(mode & (int)ios::nocreate) && mode != ios::in) - posix_mode |= O_CREAT; - if (mode & (int)ios::noreplace) - posix_mode |= O_EXCL; -#if _G_HAVE_IO_FILE_OPEN - if (!_IO_file_open (this, filename, posix_mode, prot, - read_write, 0)) - return NULL; - if (mode & ios::ate) { - if (pubseekoff(0, ios::end) == EOF) { - _IO_un_link (this); - return NULL; - } - } - return this; -#else - int fd = ::open(filename, posix_mode, prot); - if (fd < 0) - return NULL; - _fileno = fd; - xsetflags(read_write, _IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING); - if (mode & ios::ate) { - if (pubseekoff(0, ios::end) == EOF) - return NULL; - } - _IO_link_in(this); - return this; -#endif -} - -filebuf* filebuf::open(const char *filename, const char *mode) -{ -#if _G_IO_IO_FILE_VERSION == 0x20001 - return (filebuf*)_IO_file_fopen(this, filename, mode, 0); -#else - return (filebuf*)_IO_file_fopen(this, filename, mode); -#endif -} - -filebuf* filebuf::attach(int fd) -{ - return (filebuf*)_IO_file_attach(this, fd); -} - -streambuf* filebuf::setbuf(char* p, int len) -{ - return (streambuf*)_IO_file_setbuf (this, p, len); -} - -int filebuf::doallocate() { return _IO_file_doallocate(this); } - -int filebuf::overflow(int c) -{ - return _IO_file_overflow(this, c); -} - -int filebuf::underflow() -{ - return _IO_file_underflow(this); -} - -int filebuf::sync() -{ - return _IO_file_sync(this); -} - -streampos filebuf::seekoff(streamoff offset, _seek_dir dir, int mode) -{ - return _IO_file_seekoff (this, offset, dir, mode); -} - -filebuf* filebuf::close() -{ - return (_IO_file_close_it(this) ? (filebuf*)NULL : this); -} - -streamsize filebuf::sys_read(char* buf, streamsize size) -{ - return _IO_file_read(this, buf, size); -} - -streampos filebuf::sys_seek(streamoff offset, _seek_dir dir) -{ - return _IO_file_seek(this, offset, dir); -} - -streamsize filebuf::sys_write(const char *buf, streamsize n) -{ - return _IO_file_write (this, buf, n); -} - -int filebuf::sys_stat(void* st) -{ - return _IO_file_stat (this, st); -} - -int filebuf::sys_close() -{ - return _IO_file_close (this); -} - -streamsize filebuf::xsputn(const char *s, streamsize n) -{ - return _IO_file_xsputn(this, s, n); -} - -streamsize filebuf::xsgetn(char *s, streamsize n) -{ - // FIXME: OPTIMIZE THIS (specifically, when unbuffered()). - return streambuf::xsgetn(s, n); -} - -// Non-ANSI AT&T-ism: Default open protection. -const int filebuf::openprot = 0644; diff --git a/contrib/libio/filedoalloc.c b/contrib/libio/filedoalloc.c deleted file mode 100644 index 52b554400c..0000000000 --- a/contrib/libio/filedoalloc.c +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. - This file is part of the GNU IO Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - - As a special exception, if you link this library with files - compiled with a GNU compiler to produce an executable, this does - not cause the resulting executable to be covered by the GNU General - Public License. This exception does not however invalidate any - other reasons why the executable file might be covered by the GNU - General Public License. */ - -/* - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -/* Modified for GNU iostream by Per Bothner 1991, 1992. */ - -#include "libioP.h" -#include -#include -#ifdef __STDC__ -#include -#include -#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/contrib/libio/fileops.c b/contrib/libio/fileops.c deleted file mode 100644 index 54e13d3f18..0000000000 --- a/contrib/libio/fileops.c +++ /dev/null @@ -1,811 +0,0 @@ -/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc. - This file is part of the GNU IO Library. - Written by Per Bothner . - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the 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 -#include -#include -#include -#include -#include -#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/contrib/libio/floatconv.c b/contrib/libio/floatconv.c deleted file mode 100644 index 9503187b5d..0000000000 --- a/contrib/libio/floatconv.c +++ /dev/null @@ -1,2375 +0,0 @@ -/* -Copyright (C) 1993, 1994 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include -#ifdef _IO_USE_DTOA -/**************************************************************** - * - * The author of this software is David M. Gay. - * - * Copyright (c) 1991 by AT&T. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose without fee is hereby granted, provided that this entire notice - * is included in all copies of any software which is or includes a copy - * or modification of this software and in all copies of the supporting - * documentation for such software. - * - * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY - * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY - * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. - * - ***************************************************************/ - -/* Some cleaning up by Per Bothner, bothner@cygnus.com, 1992, 1993. - Re-written to not need static variables - (except result, result_k, HIWORD, LOWORD). */ - -/* Note that the checking of _DOUBLE_IS_32BITS is for use with the - cross targets that employ the newlib ieeefp.h header. -- brendan */ - -/* Please send bug reports to - David M. Gay - AT&T Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-2070 - U.S.A. - dmg@research.att.com or research!dmg - */ - -/* strtod for IEEE-, VAX-, and IBM-arithmetic machines. - * - * This strtod returns a nearest machine number to the input decimal - * string (or sets errno to ERANGE). With IEEE arithmetic, ties are - * broken by the IEEE round-even rule. Otherwise ties are broken by - * biased rounding (add half and chop). - * - * Inspired loosely by William D. Clinger's paper "How to Read Floating - * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101]. - * - * Modifications: - * - * 1. We only require IEEE, IBM, or VAX double-precision - * arithmetic (not IEEE double-extended). - * 2. We get by with floating-point arithmetic in a case that - * Clinger missed -- when we're computing d * 10^n - * for a small integer d and the integer n is not too - * much larger than 22 (the maximum integer k for which - * we can represent 10^k exactly), we may be able to - * compute (d*10^k) * 10^(e-k) with just one roundoff. - * 3. Rather than a bit-at-a-time adjustment of the binary - * result in the hard case, we use floating-point - * arithmetic to determine the adjustment to within - * one bit; only in really hard cases do we need to - * compute a second residual. - * 4. Because of 3., we don't need a large table of powers of 10 - * for ten-to-e (just some small tables, e.g. of 10^k - * for 0 <= k <= 22). - */ - -/* - * #define IEEE_8087 for IEEE-arithmetic machines where the least - * significant byte has the lowest address. - * #define IEEE_MC68k for IEEE-arithmetic machines where the most - * significant byte has the lowest address. - * #define Sudden_Underflow for IEEE-format machines without gradual - * underflow (i.e., that flush to zero on underflow). - * #define IBM for IBM mainframe-style floating-point arithmetic. - * #define VAX for VAX-style floating-point arithmetic. - * #define Unsigned_Shifts if >> does treats its left operand as unsigned. - * #define No_leftright to omit left-right logic in fast floating-point - * computation of dtoa. - * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3. - * #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines - * that use extended-precision instructions to compute rounded - * products and quotients) with IBM. - * #define ROUND_BIASED for IEEE-format with biased rounding. - * #define Inaccurate_Divide for IEEE-format with correctly rounded - * products but inaccurate quotients, e.g., for Intel i860. - * #define KR_headers for old-style C function headers. - */ - -#ifdef DEBUG -#include -#define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);} -#endif - -#ifdef __STDC__ -#include -#include -#include -#define CONST const -#else -#define CONST -#define KR_headers - -/* In this case, we assume IEEE floats. */ -#define FLT_ROUNDS 1 -#define FLT_RADIX 2 -#define DBL_MANT_DIG 53 -#define DBL_DIG 15 -#define DBL_MAX_10_EXP 308 -#define DBL_MAX_EXP 1024 -#endif - -#include -#ifndef __MATH_H__ -#include -#endif - -#ifdef Unsigned_Shifts -#define Sign_Extend(a,b) if (b < 0) a |= 0xffff0000; -#else -#define Sign_Extend(a,b) /*no-op*/ -#endif - -#if defined(__i386__) || defined(__i860__) || defined(clipper) -#define IEEE_8087 -#endif -#if defined(MIPSEL) || defined(__alpha__) -#define IEEE_8087 -#endif -#if defined(__sparc__) || defined(sparc) || defined(MIPSEB) -#define IEEE_MC68k -#endif - -#if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1 - -#ifndef _DOUBLE_IS_32BITS -#if FLT_RADIX==16 -#define IBM -#else -#if DBL_MANT_DIG==56 -#define VAX -#else -#if DBL_MANT_DIG==53 && DBL_MAX_10_EXP==308 -#define IEEE_Unknown -#else -Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined. -#endif -#endif -#endif -#endif /* !_DOUBLE_IS_32BITS */ -#endif - -typedef _G_uint32_t unsigned32; - -union doubleword { - double d; - unsigned32 u[2]; -}; - -#ifdef IEEE_8087 -#define HIWORD 1 -#define LOWORD 0 -#define TEST_ENDIANNESS /* nothing */ -#else -#if defined(IEEE_MC68k) -#define HIWORD 0 -#define LOWORD 1 -#define TEST_ENDIANNESS /* nothing */ -#else -static int HIWORD = -1, LOWORD; -static void test_endianness() -{ - union doubleword dw; - dw.d = 10; - if (dw.u[0] != 0) /* big-endian */ - HIWORD=0, LOWORD=1; - else - HIWORD=1, LOWORD=0; -} -#define TEST_ENDIANNESS if (HIWORD<0) test_endianness(); -#endif -#endif - -#if 0 -union doubleword _temp; -#endif -#if defined(__GNUC__) && !defined(_DOUBLE_IS_32BITS) -#define word0(x) ({ union doubleword _du; _du.d = (x); _du.u[HIWORD]; }) -#define word1(x) ({ union doubleword _du; _du.d = (x); _du.u[LOWORD]; }) -#define setword0(D,W) \ - ({ union doubleword _du; _du.d = (D); _du.u[HIWORD]=(W); (D)=_du.d; }) -#define setword1(D,W) \ - ({ union doubleword _du; _du.d = (D); _du.u[LOWORD]=(W); (D)=_du.d; }) -#define setwords(D,W0,W1) ({ union doubleword _du; \ - _du.u[HIWORD]=(W0); _du.u[LOWORD]=(W1); (D)=_du.d; }) -#define addword0(D,W) \ - ({ union doubleword _du; _du.d = (D); _du.u[HIWORD]+=(W); (D)=_du.d; }) -#else -#define word0(x) ((unsigned32 *)&x)[HIWORD] -#ifndef _DOUBLE_IS_32BITS -#define word1(x) ((unsigned32 *)&x)[LOWORD] -#else -#define word1(x) 0 -#endif -#define setword0(D,W) word0(D) = (W) -#ifndef _DOUBLE_IS_32BITS -#define setword1(D,W) word1(D) = (W) -#define setwords(D,W0,W1) (setword0(D,W0),setword1(D,W1)) -#else -#define setword1(D,W) -#define setwords(D,W0,W1) (setword0(D,W0)) -#endif -#define addword0(D,X) (word0(D) += (X)) -#endif - -/* The following definition of Storeinc is appropriate for MIPS processors. */ -#if defined(IEEE_8087) + defined(VAX) -#define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \ -((unsigned short *)a)[0] = (unsigned short)c, a++) -#else -#if defined(IEEE_MC68k) -#define Storeinc(a,b,c) (((unsigned short *)a)[0] = (unsigned short)b, \ -((unsigned short *)a)[1] = (unsigned short)c, a++) -#else -#define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff) -#endif -#endif - -/* #define P DBL_MANT_DIG */ -/* Ten_pmax = floor(P*log(2)/log(5)) */ -/* Bletch = (highest power of 2 < DBL_MAX_10_EXP) / 16 */ -/* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */ -/* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */ - -#if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(IEEE_Unknown) -#define Exp_shift 20 -#define Exp_shift1 20 -#define Exp_msk1 0x100000 -#define Exp_msk11 0x100000 -#define Exp_mask 0x7ff00000 -#define P 53 -#define Bias 1023 -#define IEEE_Arith -#define Emin (-1022) -#define Exp_1 0x3ff00000 -#define Exp_11 0x3ff00000 -#define Ebits 11 -#define Frac_mask 0xfffff -#define Frac_mask1 0xfffff -#define Ten_pmax 22 -#define Bletch 0x10 -#define Bndry_mask 0xfffff -#define Bndry_mask1 0xfffff -#define LSB 1 -#define Sign_bit 0x80000000 -#define Log2P 1 -#define Tiny0 0 -#define Tiny1 1 -#define Quick_max 14 -#define Int_max 14 -#define Infinite(x) (word0(x) == 0x7ff00000) /* sufficient test for here */ -#else -#undef Sudden_Underflow -#define Sudden_Underflow -#ifdef IBM -#define Exp_shift 24 -#define Exp_shift1 24 -#define Exp_msk1 0x1000000 -#define Exp_msk11 0x1000000 -#define Exp_mask 0x7f000000 -#define P 14 -#define Bias 65 -#define Exp_1 0x41000000 -#define Exp_11 0x41000000 -#define Ebits 8 /* exponent has 7 bits, but 8 is the right value in b2d */ -#define Frac_mask 0xffffff -#define Frac_mask1 0xffffff -#define Bletch 4 -#define Ten_pmax 22 -#define Bndry_mask 0xefffff -#define Bndry_mask1 0xffffff -#define LSB 1 -#define Sign_bit 0x80000000 -#define Log2P 4 -#define Tiny0 0x100000 -#define Tiny1 0 -#define Quick_max 14 -#define Int_max 15 -#else /* VAX */ -#define Exp_shift 23 -#define Exp_shift1 7 -#define Exp_msk1 0x80 -#define Exp_msk11 0x800000 -#define Exp_mask 0x7f80 -#define P 56 -#define Bias 129 -#define Exp_1 0x40800000 -#define Exp_11 0x4080 -#define Ebits 8 -#define Frac_mask 0x7fffff -#define Frac_mask1 0xffff007f -#define Ten_pmax 24 -#define Bletch 2 -#define Bndry_mask 0xffff007f -#define Bndry_mask1 0xffff007f -#define LSB 0x10000 -#define Sign_bit 0x8000 -#define Log2P 1 -#define Tiny0 0x80 -#define Tiny1 0 -#define Quick_max 15 -#define Int_max 15 -#endif -#endif - -#ifndef IEEE_Arith -#define ROUND_BIASED -#endif - -#ifdef RND_PRODQUOT -#define rounded_product(a,b) a = rnd_prod(a, b) -#define rounded_quotient(a,b) a = rnd_quot(a, b) -extern double rnd_prod(double, double), rnd_quot(double, double); -#else -#define rounded_product(a,b) a *= b -#define rounded_quotient(a,b) a /= b -#endif - -#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1)) -#define Big1 0xffffffff - -#define Kmax 15 - -/* (1<on_stack = 1; - v->k = BIGINT_MINIMUM_K; - v->maxwds = 1 << BIGINT_MINIMUM_K; - v->sign = v->wds = 0; - return v; -} - -/* Allocate a Bigint with '1<k = k; - rv->maxwds = x; - rv->sign = rv->wds = 0; - rv->on_stack = 0; - return rv; -} - -static void -Bfree -#ifdef KR_headers - (v) Bigint *v; -#else - (Bigint *v) -#endif -{ - if (v && !v->on_stack) - free (v); -} - -static void -Bcopy -#ifdef KR_headers - (x, y) Bigint *x, *y; -#else - (Bigint *x, Bigint *y) -#endif -{ - register unsigned32 *xp, *yp; - register int i = y->wds; - x->sign = y->sign; - x->wds = i; - for (xp = x->x, yp = y->x; --i >= 0; ) - *xp++ = *yp++; -} - -/* Make sure b has room for at least 1<k >= k) - return b; - else - { - Bigint *rv = Balloc (k); - Bcopy(rv, b); - Bfree(b); - return rv; - } -} - -/* Return b*m+a. b is modified. - Assumption: 0xFFFF*m+a fits in 32 bits. */ - -static Bigint * -multadd -#ifdef KR_headers - (b, m, a) Bigint *b; int m, a; -#else - (Bigint *b, int m, int a) -#endif -{ - int i, wds; - unsigned32 *x, y; - unsigned32 xi, z; - - wds = b->wds; - x = b->x; - i = 0; - do { - xi = *x; - y = (xi & 0xffff) * m + a; - z = (xi >> 16) * m + (y >> 16); - a = (int)(z >> 16); - *x++ = (z << 16) + (y & 0xffff); - } - while(++i < wds); - if (a) { - if (wds >= b->maxwds) - b = Brealloc(b, b->k+1); - b->x[wds++] = a; - b->wds = wds; - } - return b; - } - -static Bigint * -s2b -#ifdef KR_headers - (result, s, nd0, nd, y9) - Bigint *result; CONST char *s; int nd0, nd; unsigned32 y9; -#else - (Bigint *result, CONST char *s, int nd0, int nd, unsigned32 y9) -#endif -{ - int i, k; - _G_int32_t x, y; - - x = (nd + 8) / 9; - for(k = 0, y = 1; x > y; y <<= 1, k++) ; - result = Brealloc(result, k); - result->x[0] = y9; - result->wds = 1; - - i = 9; - if (9 < nd0) - { - s += 9; - do - result = multadd(result, 10, *s++ - '0'); - while (++i < nd0); - s++; - } - else - s += 10; - for(; i < nd; i++) - result = multadd(result, 10, *s++ - '0'); - return result; -} - -static int -hi0bits -#ifdef KR_headers - (x) register unsigned32 x; -#else - (register unsigned32 x) -#endif -{ - register int k = 0; - - if (!(x & 0xffff0000)) { - k = 16; - x <<= 16; - } - if (!(x & 0xff000000)) { - k += 8; - x <<= 8; - } - if (!(x & 0xf0000000)) { - k += 4; - x <<= 4; - } - if (!(x & 0xc0000000)) { - k += 2; - x <<= 2; - } - if (!(x & 0x80000000)) { - k++; - if (!(x & 0x40000000)) - return 32; - } - return k; - } - -static int -lo0bits -#ifdef KR_headers - (y) unsigned32 *y; -#else - (unsigned32 *y) -#endif -{ - register int k; - register unsigned32 x = *y; - - if (x & 7) { - if (x & 1) - return 0; - if (x & 2) { - *y = x >> 1; - return 1; - } - *y = x >> 2; - return 2; - } - k = 0; - if (!(x & 0xffff)) { - k = 16; - x >>= 16; - } - if (!(x & 0xff)) { - k += 8; - x >>= 8; - } - if (!(x & 0xf)) { - k += 4; - x >>= 4; - } - if (!(x & 0x3)) { - k += 2; - x >>= 2; - } - if (!(x & 1)) { - k++; - x >>= 1; - if (!x & 1) - return 32; - } - *y = x; - return k; - } - -static Bigint * -i2b -#ifdef KR_headers - (result, i) Bigint *result; int i; -#else - (Bigint* result, int i) -#endif -{ - result = Brealloc(result, 1); - result->x[0] = i; - result->wds = 1; - return result; -} - -/* Do: c = a * b. */ - -static Bigint * -mult -#ifdef KR_headers - (c, a, b) Bigint *a, *b, *c; -#else - (Bigint *c, Bigint *a, Bigint *b) -#endif -{ - int k, wa, wb, wc; - unsigned32 carry, y, z; - unsigned32 *x, *xa, *xae, *xb, *xbe, *xc, *xc0; - unsigned32 z2; - if (a->wds < b->wds) { - Bigint *tmp = a; - a = b; - b = tmp; - } - k = a->k; - wa = a->wds; - wb = b->wds; - wc = wa + wb; - if (wc > a->maxwds) - k++; - c = Brealloc(c, k); - for(x = c->x, xa = x + wc; x < xa; x++) - *x = 0; - xa = a->x; - xae = xa + wa; - xb = b->x; - xbe = xb + wb; - xc0 = c->x; - for(; xb < xbe; xb++, xc0++) { - if ((y = *xb & 0xffff)) { - x = xa; - xc = xc0; - carry = 0; - do { - z = (*x & 0xffff) * y + (*xc & 0xffff) + carry; - carry = z >> 16; - z2 = (*x++ >> 16) * y + (*xc >> 16) + carry; - carry = z2 >> 16; - Storeinc(xc, z2, z); - } - while(x < xae); - *xc = carry; - } - if ((y = *xb >> 16)) { - x = xa; - xc = xc0; - carry = 0; - z2 = *xc; - do { - z = (*x & 0xffff) * y + (*xc >> 16) + carry; - carry = z >> 16; - Storeinc(xc, z, z2); - z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry; - carry = z2 >> 16; - } - while(x < xae); - *xc = z2; - } - } - for(xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ; - c->wds = wc; - return c; - } - -/* Returns b*(5**k). b is modified. */ -/* Re-written by Per Bothner to not need a static list. */ - -static Bigint * -pow5mult -#ifdef KR_headers - (b, k) Bigint *b; int k; -#else - (Bigint *b, int k) -#endif -{ - static int p05[6] = { 5, 25, 125, 625, 3125, 15625 }; - - for (; k > 6; k -= 6) - b = multadd(b, 15625, 0); /* b *= 5**6 */ - if (k == 0) - return b; - else - return multadd(b, p05[k-1], 0); -} - -/* Re-written by Per Bothner so shift can be in place. */ - -static Bigint * -lshift -#ifdef KR_headers - (b, k) Bigint *b; int k; -#else - (Bigint *b, int k) -#endif -{ - int i; - unsigned32 *x, *x1, *xe; - int old_wds = b->wds; - int n = k >> 5; - int k1 = b->k; - int n1 = n + old_wds + 1; - - if (k == 0) - return b; - - for(i = b->maxwds; n1 > i; i <<= 1) - k1++; - b = Brealloc(b, k1); - - xe = b->x; /* Source limit */ - x = xe + old_wds; /* Source pointer */ - x1 = x + n; /* Destination pointer */ - if (k &= 0x1f) { - int k1 = 32 - k; - unsigned32 z = *--x; - if ((*x1 = (z >> k1)) != 0) { - ++n1; - } - while (x > xe) { - unsigned32 w = *--x; - *--x1 = (z << k) | (w >> k1); - z = w; - } - *--x1 = z << k; - } - else - do { - *--x1 = *--x; - } while(x > xe); - while (x1 > xe) - *--x1 = 0; - b->wds = n1 - 1; - return b; -} - -static int -cmp -#ifdef KR_headers - (a, b) Bigint *a, *b; -#else - (Bigint *a, Bigint *b) -#endif -{ - unsigned32 *xa, *xa0, *xb, *xb0; - int i, j; - - i = a->wds; - j = b->wds; -#ifdef DEBUG - if (i > 1 && !a->x[i-1]) - Bug("cmp called with a->x[a->wds-1] == 0"); - if (j > 1 && !b->x[j-1]) - Bug("cmp called with b->x[b->wds-1] == 0"); -#endif - if (i -= j) - return i; - xa0 = a->x; - xa = xa0 + j; - xb0 = b->x; - xb = xb0 + j; - for(;;) { - if (*--xa != *--xb) - return *xa < *xb ? -1 : 1; - if (xa <= xa0) - break; - } - return 0; - } - -/* Do: c = a-b. */ - -static Bigint * -diff -#ifdef KR_headers - (c, a, b) Bigint *c, *a, *b; -#else - (Bigint *c, Bigint *a, Bigint *b) -#endif -{ - int i, wa, wb; - _G_int32_t borrow, y; /* We need signed shifts here. */ - unsigned32 *xa, *xae, *xb, *xbe, *xc; - _G_int32_t z; - - i = cmp(a,b); - if (!i) { - c = Brealloc(c, 0); - c->wds = 1; - c->x[0] = 0; - return c; - } - if (i < 0) { - Bigint *tmp = a; - a = b; - b = tmp; - i = 1; - } - else - i = 0; - c = Brealloc(c, a->k); - c->sign = i; - wa = a->wds; - xa = a->x; - xae = xa + wa; - wb = b->wds; - xb = b->x; - xbe = xb + wb; - xc = c->x; - borrow = 0; - do { - y = (*xa & 0xffff) - (*xb & 0xffff) + borrow; - borrow = y >> 16; - Sign_Extend(borrow, y); - z = (*xa++ >> 16) - (*xb++ >> 16) + borrow; - borrow = z >> 16; - Sign_Extend(borrow, z); - Storeinc(xc, z, y); - } - while(xb < xbe); - while(xa < xae) { - y = (*xa & 0xffff) + borrow; - borrow = y >> 16; - Sign_Extend(borrow, y); - z = (*xa++ >> 16) + borrow; - borrow = z >> 16; - Sign_Extend(borrow, z); - Storeinc(xc, z, y); - } - while(!*--xc) - wa--; - c->wds = wa; - return c; - } - -static double -ulp -#ifdef KR_headers - (x) double x; -#else - (double x) -#endif -{ - register _G_int32_t L; - double a; - - L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1; -#ifndef Sudden_Underflow - if (L > 0) { -#endif -#ifdef IBM - L |= Exp_msk1 >> 4; -#endif - setwords(a, L, 0); -#ifndef Sudden_Underflow - } - else { - L = -L >> Exp_shift; - if (L < Exp_shift) - setwords(a, 0x80000 >> L, 0); - else { - L -= Exp_shift; - setwords(a, 0, L >= 31 ? 1 : 1 << (31 - L)); - } - } -#endif - return a; - } - -static double -b2d -#ifdef KR_headers - (a, e) Bigint *a; int *e; -#else - (Bigint *a, int *e) -#endif -{ - unsigned32 *xa, *xa0, w, y, z; - int k; - double d; - unsigned32 d0, d1; - - xa0 = a->x; - xa = xa0 + a->wds; - y = *--xa; -#ifdef DEBUG - if (!y) Bug("zero y in b2d"); -#endif - k = hi0bits(y); - *e = 32 - k; - if (k < Ebits) { - d0 = Exp_1 | y >> (Ebits - k); - w = xa > xa0 ? *--xa : 0; -#ifndef _DOUBLE_IS_32BITS - d1 = y << ((32-Ebits) + k) | w >> (Ebits - k); -#endif - goto ret_d; - } - z = xa > xa0 ? *--xa : 0; - if (k -= Ebits) { - d0 = Exp_1 | y << k | z >> (32 - k); - y = xa > xa0 ? *--xa : 0; -#ifndef _DOUBLE_IS_32BITS - d1 = z << k | y >> (32 - k); -#endif - } - else { - d0 = Exp_1 | y; -#ifndef _DOUBLE_IS_32BITS - d1 = z; -#endif - } - ret_d: -#ifdef VAX - setwords(d, d0 >> 16 | d0 << 16, d1 >> 16 | d1 << 16); -#else - setwords (d, d0, d1); -#endif - return d; - } - -static Bigint * -d2b -#ifdef KR_headers - (result, d, e, bits) Bigint *result; double d; _G_int32_t *e, *bits; -#else - (Bigint *result, double d, _G_int32_t *e, _G_int32_t *bits) -#endif -{ - int de, i, k; - unsigned32 *x, y, z; - unsigned32 d0, d1; -#ifdef VAX - d0 = word0(d) >> 16 | word0(d) << 16; - d1 = word1(d) >> 16 | word1(d) << 16; -#else - d0 = word0(d); - d1 = word1(d); -#endif - - result = Brealloc(result, 1); - x = result->x; - - z = d0 & Frac_mask; - d0 &= 0x7fffffff; /* clear sign bit, which we ignore */ - - de = (int)(d0 >> Exp_shift); /* The exponent part of d. */ - - /* Put back the suppressed high-order bit, if normalized. */ -#ifndef IBM -#ifndef Sudden_Underflow - if (de) -#endif - z |= Exp_msk11; -#endif - -#ifndef _DOUBLE_IS_32BITS - if ((y = d1)) { - if ((k = lo0bits(&y))) { - x[0] = y | z << (32 - k); - z >>= k; - } - else - x[0] = y; - i = result->wds = (x[1] = z) ? 2 : 1; - } - else { -#endif /* !_DOUBLE_IS_32BITS */ -#ifdef DEBUG - if (!z) - Bug("Zero passed to d2b"); -#endif - k = lo0bits(&z); - x[0] = z; - i = result->wds = 1; -#ifndef _DOUBLE_IS_32BITS - k += 32; - } -#endif -#ifndef Sudden_Underflow - if (de) { -#endif -#ifdef IBM - *e = (de - Bias - (P-1) << 2) + k; - *bits = 4*P + 8 - k - hi0bits(word0(d) & Frac_mask); -#else - *e = de - Bias - (P-1) + k; - *bits = P - k; -#endif -#ifndef Sudden_Underflow - } - else { - *e = de - Bias - (P-1) + 1 + k; - *bits = 32*i - hi0bits(x[i-1]); - } -#endif - return result; - } - -static double -ratio -#ifdef KR_headers - (a, b) Bigint *a, *b; -#else - (Bigint *a, Bigint *b) -#endif -{ - double da, db; - int k, ka, kb; - - da = b2d(a, &ka); - db = b2d(b, &kb); - k = ka - kb + 32*(a->wds - b->wds); -#ifdef IBM - if (k > 0) { - addword0(da, (k >> 2)*Exp_msk1); - if (k &= 3) - da *= 1 << k; - } - else { - k = -k; - addword0(db,(k >> 2)*Exp_msk1); - if (k &= 3) - db *= 1 << k; - } -#else - if (k > 0) - addword0(da, k*Exp_msk1); - else { - k = -k; - addword0(db, k*Exp_msk1); - } -#endif - return da / db; - } - -static CONST double -tens[] = { - 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, - 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, - 1e20, 1e21, 1e22 -#ifdef VAX - , 1e23, 1e24 -#endif - }; - -#ifdef IEEE_Arith -static CONST double bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 }; -static CONST double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128, 1e-256 }; -#define n_bigtens 5 -#else -#ifdef IBM -static CONST double bigtens[] = { 1e16, 1e32, 1e64 }; -static CONST double tinytens[] = { 1e-16, 1e-32, 1e-64 }; -#define n_bigtens 3 -#else -/* Also used for the case when !_DOUBLE_IS_32BITS. */ -static CONST double bigtens[] = { 1e16, 1e32 }; -static CONST double tinytens[] = { 1e-16, 1e-32 }; -#define n_bigtens 2 -#endif -#endif - - double -_IO_strtod -#ifdef KR_headers - (s00, se) CONST char *s00; char **se; -#else - (CONST char *s00, char **se) -#endif -{ - _G_int32_t bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign, - e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; - CONST char *s, *s0, *s1; - double aadj, aadj1, adj, rv, rv0; - _G_int32_t L; - unsigned32 y, z; - Bigint _bb, _b_avail, _bd, _bd0, _bs, _delta; - Bigint *bb = Binit(&_bb); - Bigint *bd = Binit(&_bd); - Bigint *bd0 = Binit(&_bd0); - Bigint *bs = Binit(&_bs); - Bigint *b_avail = Binit(&_b_avail); - Bigint *delta = Binit(&_delta); - - TEST_ENDIANNESS; - sign = nz0 = nz = 0; - rv = 0.; - (void)&rv; /* Force rv into the stack */ - for(s = s00;;s++) switch(*s) { - case '-': - sign = 1; - /* no break */ - case '+': - if (*++s) - goto break2; - /* no break */ - case 0: - /* "+" and "-" should be reported as an error? */ - sign = 0; - s = s00; - goto ret; - case '\t': - case '\n': - case '\v': - case '\f': - case '\r': - case ' ': - continue; - default: - goto break2; - } - break2: - if (*s == '0') { - nz0 = 1; - while(*++s == '0') ; - if (!*s) - goto ret; - } - s0 = s; - y = z = 0; - for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++) - if (nd < 9) - y = 10*y + c - '0'; - else if (nd < 16) - z = 10*z + c - '0'; - nd0 = nd; - if (c == '.') { - c = *++s; - if (!nd) { - for(; c == '0'; c = *++s) - nz++; - if (c > '0' && c <= '9') { - s0 = s; - nf += nz; - nz = 0; - goto have_dig; - } - goto dig_done; - } - for(; c >= '0' && c <= '9'; c = *++s) { - have_dig: - nz++; - if (c -= '0') { - nf += nz; - for(i = 1; i < nz; i++) - if (nd++ < 9) - y *= 10; - else if (nd <= DBL_DIG + 1) - z *= 10; - if (nd++ < 9) - y = 10*y + c; - else if (nd <= DBL_DIG + 1) - z = 10*z + c; - nz = 0; - } - } - } - dig_done: - e = 0; - if (c == 'e' || c == 'E') { - if (!nd && !nz && !nz0) { - s = s00; - goto ret; - } - s00 = s; - esign = 0; - switch(c = *++s) { - case '-': - esign = 1; - case '+': - c = *++s; - } - if (c >= '0' && c <= '9') { - while(c == '0') - c = *++s; - if (c > '0' && c <= '9') { - e = c - '0'; - s1 = s; - while((c = *++s) >= '0' && c <= '9') - e = 10*e + c - '0'; - if (s - s1 > 8) - /* Avoid confusion from exponents - * so large that e might overflow. - */ - e = 9999999; - if (esign) - e = -e; - } - else - e = 0; - } - else - s = s00; - } - if (!nd) { - if (!nz && !nz0) - s = s00; - goto ret; - } - e1 = e -= nf; - - /* Now we have nd0 digits, starting at s0, followed by a - * decimal point, followed by nd-nd0 digits. The number we're - * after is the integer represented by those digits times - * 10**e */ - - if (!nd0) - nd0 = nd; - k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1; - rv = y; - if (k > 9) - rv = tens[k - 9] * rv + z; - if (nd <= DBL_DIG -#ifndef RND_PRODQUOT - && FLT_ROUNDS == 1 -#endif - ) { - if (!e) - goto ret; - if (e > 0) { - if (e <= Ten_pmax) { -#ifdef VAX - goto vax_ovfl_check; -#else - /* rv = */ rounded_product(rv, tens[e]); - goto ret; -#endif - } - i = DBL_DIG - nd; - if (e <= Ten_pmax + i) { - /* A fancier test would sometimes let us do - * this for larger i values. - */ - e -= i; - rv *= tens[i]; -#ifdef VAX - /* VAX exponent range is so narrow we must - * worry about overflow here... - */ - vax_ovfl_check: - addword0(rv, - P*Exp_msk1); - /* rv = */ rounded_product(rv, tens[e]); - if ((word0(rv) & Exp_mask) - > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) - goto ovfl; - addword0(rv, P*Exp_msk1); -#else - /* rv = */ rounded_product(rv, tens[e]); -#endif - goto ret; - } - } -#ifndef Inaccurate_Divide - else if (e >= -Ten_pmax) { - /* rv = */ rounded_quotient(rv, tens[-e]); - goto ret; - } -#endif - } - e1 += nd - k; - - /* Get starting approximation = rv * 10**e1 */ - - if (e1 > 0) { - if ((i = e1 & 15)) - rv *= tens[i]; - if (e1 &= ~15) { - if (e1 > DBL_MAX_10_EXP) { - ovfl: - errno = ERANGE; -#if defined(sun) && !defined(__svr4__) -/* SunOS defines HUGE_VAL as __infinity(), which is in libm. */ -#undef HUGE_VAL -#endif -#ifndef HUGE_VAL -#define HUGE_VAL 1.7976931348623157E+308 -#endif - rv = HUGE_VAL; - goto ret; - } - if (e1 >>= 4) { - for(j = 0; e1 > 1; j++, e1 >>= 1) - if (e1 & 1) - rv *= bigtens[j]; - /* The last multiplication could overflow. */ - addword0(rv, -P*Exp_msk1); - rv *= bigtens[j]; - if ((z = word0(rv) & Exp_mask) - > Exp_msk1*(DBL_MAX_EXP+Bias-P)) - goto ovfl; - if (z > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) { - /* set to largest number */ - /* (Can't trust DBL_MAX) */ - setwords(rv, Big0, Big1); - } - else - addword0(rv, P*Exp_msk1); - } - - } - } - else if (e1 < 0) { - e1 = -e1; - if ((i = e1 & 15)) - rv /= tens[i]; - if (e1 &= ~15) { - e1 >>= 4; - for(j = 0; e1 > 1; j++, e1 >>= 1) - if (e1 & 1) - rv *= tinytens[j]; - /* The last multiplication could underflow. */ - rv0 = rv; - rv *= tinytens[j]; - if (!rv) { - rv = 2.*rv0; - rv *= tinytens[j]; - if (!rv) { - undfl: - rv = 0.; - errno = ERANGE; - goto ret; - } - setwords(rv, Tiny0, Tiny1); - /* The refinement below will clean - * this approximation up. - */ - } - } - } - - /* Now the hard part -- adjusting rv to the correct value.*/ - - /* Put digits into bd: true value = bd * 10^e */ - - bd0 = s2b(bd0, s0, nd0, nd, y); - bd = Brealloc(bd, bd0->k); - - for(;;) { - Bcopy(bd, bd0); - bb = d2b(bb, rv, &bbe, &bbbits); /* rv = bb * 2^bbe */ - bs = i2b(bs, 1); - - if (e >= 0) { - bb2 = bb5 = 0; - bd2 = bd5 = e; - } - else { - bb2 = bb5 = -e; - bd2 = bd5 = 0; - } - if (bbe >= 0) - bb2 += bbe; - else - bd2 -= bbe; - bs2 = bb2; -#ifdef Sudden_Underflow -#ifdef IBM - j = 1 + 4*P - 3 - bbbits + ((bbe + bbbits - 1) & 3); -#else - j = P + 1 - bbbits; -#endif -#else - i = bbe + bbbits - 1; /* logb(rv) */ - if (i < Emin) /* denormal */ - j = bbe + (P-Emin); - else - j = P + 1 - bbbits; -#endif - bb2 += j; - bd2 += j; - i = bb2 < bd2 ? bb2 : bd2; - if (i > bs2) - i = bs2; - if (i > 0) { - bb2 -= i; - bd2 -= i; - bs2 -= i; - } - if (bb5 > 0) { - Bigint *b_tmp; - bs = pow5mult(bs, bb5); - b_tmp = mult(b_avail, bs, bb); - b_avail = bb; - bb = b_tmp; - } - if (bb2 > 0) - bb = lshift(bb, bb2); - if (bd5 > 0) - bd = pow5mult(bd, bd5); - if (bd2 > 0) - bd = lshift(bd, bd2); - if (bs2 > 0) - bs = lshift(bs, bs2); - delta = diff(delta, bb, bd); - dsign = delta->sign; - delta->sign = 0; - i = cmp(delta, bs); - if (i < 0) { - /* Error is less than half an ulp -- check for - * special case of mantissa a power of two. - */ - if (dsign || word1(rv) || word0(rv) & Bndry_mask) - break; - delta = lshift(delta,Log2P); - if (cmp(delta, bs) > 0) - goto drop_down; - break; - } - if (i == 0) { - /* exactly half-way between */ - if (dsign) { - if ((word0(rv) & Bndry_mask1) == Bndry_mask1 - && word1(rv) == 0xffffffff) { - /*boundary case -- increment exponent*/ - setword0(rv, (word0(rv) & Exp_mask) - + Exp_msk1); -#ifdef IBM - setword0 (rv, - word0(rv) | (Exp_msk1 >> 4)); -#endif - setword1(rv, 0); - break; - } - } - else if (!(word0(rv) & Bndry_mask) && !word1(rv)) { - drop_down: - /* boundary case -- decrement exponent */ -#ifdef Sudden_Underflow - L = word0(rv) & Exp_mask; -#ifdef IBM - if (L < Exp_msk1) -#else - if (L <= Exp_msk1) -#endif - goto undfl; - L -= Exp_msk1; -#else - L = (word0(rv) & Exp_mask) - Exp_msk1; -#endif - setwords(rv, L | Bndry_mask1, 0xffffffff); -#ifdef IBM - continue; -#else - break; -#endif - } -#ifndef ROUND_BIASED - if (!(word1(rv) & LSB)) - break; -#endif - if (dsign) - rv += ulp(rv); -#ifndef ROUND_BIASED - else { - rv -= ulp(rv); -#ifndef Sudden_Underflow - if (!rv) - goto undfl; -#endif - } -#endif - break; - } - if ((aadj = ratio(delta, bs)) <= 2.) { - if (dsign) - aadj = aadj1 = 1.; - else if (word1(rv) || word0(rv) & Bndry_mask) { -#ifndef Sudden_Underflow - if (word1(rv) == Tiny1 && !word0(rv)) - goto undfl; -#endif - aadj = 1.; - aadj1 = -1.; - } - else { - /* special case -- power of FLT_RADIX to be */ - /* rounded down... */ - - if (aadj < 2./FLT_RADIX) - aadj = 1./FLT_RADIX; - else - aadj *= 0.5; - aadj1 = -aadj; - } - } - else { - aadj *= 0.5; - aadj1 = dsign ? aadj : -aadj; -#ifdef Check_FLT_ROUNDS - switch(FLT_ROUNDS) { - case 2: /* towards +infinity */ - aadj1 -= 0.5; - break; - case 0: /* towards 0 */ - case 3: /* towards -infinity */ - aadj1 += 0.5; - } -#else - if (FLT_ROUNDS == 0) - aadj1 += 0.5; -#endif - } - y = word0(rv) & Exp_mask; - - /* Check for overflow */ - - if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) { - rv0 = rv; - addword0(rv, - P*Exp_msk1); - adj = aadj1 * ulp(rv); - rv += adj; - if ((word0(rv) & Exp_mask) >= - Exp_msk1*(DBL_MAX_EXP+Bias-P)) { - if (word0(rv0) == Big0 && word1(rv0) == Big1) - goto ovfl; - setwords(rv, Big0, Big1); - continue; - } - else - addword0(rv, P*Exp_msk1); - } - else { -#ifdef Sudden_Underflow - if ((word0(rv) & Exp_mask) <= P*Exp_msk1) { - rv0 = rv; - addword0(rv, P*Exp_msk1); - adj = aadj1 * ulp(rv); - rv += adj; -#ifdef IBM - if ((word0(rv) & Exp_mask) < P*Exp_msk1) -#else - if ((word0(rv) & Exp_mask) <= P*Exp_msk1) -#endif - { - if (word0(rv0) == Tiny0 - && word1(rv0) == Tiny1) - goto undfl; - setwords(rv, Tiny0, Tiny1); - continue; - } - else - addword0(rv, -P*Exp_msk1); - } - else { - adj = aadj1 * ulp(rv); - rv += adj; - } -#else - /* Compute adj so that the IEEE rounding rules will - * correctly round rv + adj in some half-way cases. - * If rv * ulp(rv) is denormalized (i.e., - * y <= (P-1)*Exp_msk1), we must adjust aadj to avoid - * trouble from bits lost to denormalization; - * example: 1.2e-307 . - */ - if (y <= (P-1)*Exp_msk1 && aadj >= 1.) { - aadj1 = (double)(int)(aadj + 0.5); - if (!dsign) - aadj1 = -aadj1; - } - adj = aadj1 * ulp(rv); - rv += adj; -#endif - } - z = word0(rv) & Exp_mask; - if (y == z) { - /* Can we stop now? */ - L = (_G_int32_t)aadj; - aadj -= L; - /* The tolerances below are conservative. */ - if (dsign || word1(rv) || word0(rv) & Bndry_mask) { - if (aadj < .4999999 || aadj > .5000001) - break; - } - else if (aadj < .4999999/FLT_RADIX) - break; - } - } - Bfree(bb); - Bfree(bd); - Bfree(bs); - Bfree(bd0); - Bfree(delta); - Bfree(b_avail); - ret: - if (se) - *se = (char *)s; - return sign ? -rv : rv; - } - -static int -quorem -#ifdef KR_headers - (b, S) Bigint *b, *S; -#else - (Bigint *b, Bigint *S) -#endif -{ - int n; - _G_int32_t borrow, y; - unsigned32 carry, q, ys; - unsigned32 *bx, *bxe, *sx, *sxe; - _G_int32_t z; - unsigned32 si, zs; - - n = S->wds; -#ifdef DEBUG - /*debug*/ if (b->wds > n) - /*debug*/ Bug("oversize b in quorem"); -#endif - if (b->wds < n) - return 0; - sx = S->x; - sxe = sx + --n; - bx = b->x; - bxe = bx + n; - q = *bxe / (*sxe + 1); /* ensure q <= true quotient */ -#ifdef DEBUG - /*debug*/ if (q > 9) - /*debug*/ Bug("oversized quotient in quorem"); -#endif - if (q) { - borrow = 0; - carry = 0; - do { - si = *sx++; - ys = (si & 0xffff) * q + carry; - zs = (si >> 16) * q + (ys >> 16); - carry = zs >> 16; - y = (*bx & 0xffff) - (ys & 0xffff) + borrow; - borrow = y >> 16; - Sign_Extend(borrow, y); - z = (*bx >> 16) - (zs & 0xffff) + borrow; - borrow = z >> 16; - Sign_Extend(borrow, z); - Storeinc(bx, z, y); - } - while(sx <= sxe); - if (!*bxe) { - bx = b->x; - while(--bxe > bx && !*bxe) - --n; - b->wds = n; - } - } - if (cmp(b, S) >= 0) { - q++; - borrow = 0; - carry = 0; - bx = b->x; - sx = S->x; - do { - si = *sx++; - ys = (si & 0xffff) + carry; - zs = (si >> 16) + (ys >> 16); - carry = zs >> 16; - y = (*bx & 0xffff) - (ys & 0xffff) + borrow; - borrow = y >> 16; - Sign_Extend(borrow, y); - z = (*bx >> 16) - (zs & 0xffff) + borrow; - borrow = z >> 16; - Sign_Extend(borrow, z); - Storeinc(bx, z, y); - } - while(sx <= sxe); - bx = b->x; - bxe = bx + n; - if (!*bxe) { - while(--bxe > bx && !*bxe) - --n; - b->wds = n; - } - } - return q; - } - -/* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. - * - * Inspired by "How to Print Floating-Point Numbers Accurately" by - * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 92-101]. - * - * Modifications: - * 1. Rather than iterating, we use a simple numeric overestimate - * to determine k = floor(log10(d)). We scale relevant - * quantities using O(log2(k)) rather than O(k) multiplications. - * 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't - * try to generate digits strictly left to right. Instead, we - * compute with fewer bits and propagate the carry if necessary - * when rounding the final digit up. This is often faster. - * 3. Under the assumption that input will be rounded nearest, - * mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22. - * That is, we allow equality in stopping tests when the - * round-nearest rule will give the same floating-point value - * as would satisfaction of the stopping test with strict - * inequality. - * 4. We remove common factors of powers of 2 from relevant - * quantities. - * 5. When converting floating-point integers less than 1e16, - * we use floating-point arithmetic rather than resorting - * to multiple-precision integers. - * 6. When asked to produce fewer than 15 digits, we first try - * to get by with floating-point arithmetic; we resort to - * multiple-precision integer arithmetic only if we cannot - * guarantee that the floating-point calculation has given - * the correctly rounded result. For k requested digits and - * "uniformly" distributed input, the probability is - * something like 10^(k-15) that we must resort to the long - * calculation. - */ - - char * -_IO_dtoa -#ifdef KR_headers - (d, mode, ndigits, decpt, sign, rve) - double d; int mode, ndigits, *decpt, *sign; char **rve; -#else - (double d, int mode, int ndigits, int *decpt, int *sign, char **rve) -#endif -{ - /* Arguments ndigits, decpt, sign are similar to those - of ecvt and fcvt; trailing zeros are suppressed from - the returned string. If not null, *rve is set to point - to the end of the return value. If d is +-Infinity or NaN, - then *decpt is set to 9999. - - mode: - 0 ==> shortest string that yields d when read in - and rounded to nearest. - 1 ==> like 0, but with Steele & White stopping rule; - e.g. with IEEE P754 arithmetic , mode 0 gives - 1e23 whereas mode 1 gives 9.999999999999999e22. - 2 ==> max(1,ndigits) significant digits. This gives a - return value similar to that of ecvt, except - that trailing zeros are suppressed. - 3 ==> through ndigits past the decimal point. This - gives a return value similar to that from fcvt, - except that trailing zeros are suppressed, and - ndigits can be negative. - 4-9 should give the same return values as 2-3, i.e., - 4 <= mode <= 9 ==> same return as mode - 2 + (mode & 1). These modes are mainly for - debugging; often they run slower but sometimes - faster than modes 2-3. - 4,5,8,9 ==> left-to-right digit generation. - 6-9 ==> don't try fast floating-point estimate - (if applicable). - - Values of mode other than 0-9 are treated as mode 0. - - Sufficient space is allocated to the return value - to hold the suppressed trailing zeros. - */ - - _G_int32_t bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1, - j, j1, k, k0, k_check, leftright, m2, m5, s2, s5, - spec_case, try_quick; - _G_int32_t L; -#ifndef Sudden_Underflow - int denorm; -#endif - Bigint _b_avail, _b, _mhi, _mlo, _S; - Bigint *b_avail = Binit(&_b_avail); - Bigint *b = Binit(&_b); - Bigint *S = Binit(&_S); - /* mhi and mlo are only set and used if leftright. */ - Bigint *mhi = NULL, *mlo = NULL; - double d2, ds, eps; - char *s, *s0; - static Bigint *result = NULL; - static int result_k; - - TEST_ENDIANNESS; - if (result) { - /* result is contains a string, so its fields (interpreted - as a Bigint have been trashed. Restore them. - This is a really ugly interface - result should - not be static, since that is not thread-safe. FIXME. */ - result->k = result_k; - result->maxwds = 1 << result_k; - result->on_stack = 0; - } - - if (word0(d) & Sign_bit) { - /* set sign for everything, including 0's and NaNs */ - *sign = 1; - setword0(d, word0(d) & ~Sign_bit); /* clear sign bit */ - } - else - *sign = 0; - -#if defined(IEEE_Arith) + defined(VAX) -#ifdef IEEE_Arith - if ((word0(d) & Exp_mask) == Exp_mask) -#else - if (word0(d) == 0x8000) -#endif - { - /* Infinity or NaN */ - *decpt = 9999; -#ifdef IEEE_Arith - if (!word1(d) && !(word0(d) & 0xfffff)) - { - s = "Infinity"; - if (rve) - *rve = s + 8; - } - else -#endif - { - s = "NaN"; - if (rve) - *rve = s +3; - } - return s; - } -#endif -#ifdef IBM - d += 0; /* normalize */ -#endif - if (!d) { - *decpt = 1; - s = "0"; - if (rve) - *rve = s + 1; - return s; - } - - b = d2b(b, d, &be, &bbits); - i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)); -#ifndef Sudden_Underflow - if (i) { -#endif - d2 = d; - setword0(d2, (word0(d2) & Frac_mask1) | Exp_11); -#ifdef IBM - if (j = 11 - hi0bits(word0(d2) & Frac_mask)) - d2 /= 1 << j; -#endif - - i -= Bias; -#ifdef IBM - i <<= 2; - i += j; -#endif -#ifndef Sudden_Underflow - denorm = 0; - } - else { - /* d is denormalized */ - unsigned32 x; - - i = bbits + be + (Bias + (P-1) - 1); - x = i > 32 ? word0(d) << (64 - i) | word1(d) >> (i - 32) - : word1(d) << (32 - i); - d2 = x; - addword0(d2, - 31*Exp_msk1); /* adjust exponent */ - i -= (Bias + (P-1) - 1) + 1; - denorm = 1; - } -#endif - - /* Now i is the unbiased base-2 exponent. */ - - /* log(x) ~=~ log(1.5) + (x-1.5)/1.5 - * log10(x) = log(x) / log(10) - * ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10)) - * log10(d) = i*log(2)/log(10) + log10(d2) - * - * This suggests computing an approximation k to log10(d) by - * - * k = i*0.301029995663981 - * + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 ); - * - * We want k to be too large rather than too small. - * The error in the first-order Taylor series approximation - * is in our favor, so we just round up the constant enough - * to compensate for any error in the multiplication of - * (i) by 0.301029995663981; since |i| <= 1077, - * and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14, - * adding 1e-13 to the constant term more than suffices. - * Hence we adjust the constant term to 0.1760912590558. - * (We could get a more accurate k by invoking log10, - * but this is probably not worthwhile.) - */ - - ds = (d2-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; - k = (int)ds; - if (ds < 0. && ds != k) - k--; /* want k = floor(ds) */ - k_check = 1; - if (k >= 0 && k <= Ten_pmax) { - if (d < tens[k]) - k--; - k_check = 0; - } - j = bbits - i - 1; - if (j >= 0) { - b2 = 0; - s2 = j; - } - else { - b2 = -j; - s2 = 0; - } - if (k >= 0) { - b5 = 0; - s5 = k; - s2 += k; - } - else { - b2 -= k; - b5 = -k; - s5 = 0; - } - if (mode < 0 || mode > 9) - mode = 0; - try_quick = 1; - if (mode > 5) { - mode -= 4; - try_quick = 0; - } - leftright = 1; - switch(mode) { - case 0: - case 1: - ilim = ilim1 = -1; - i = 18; - ndigits = 0; - break; - case 2: - leftright = 0; - /* no break */ - case 4: - if (ndigits <= 0) - ndigits = 1; - ilim = ilim1 = i = ndigits; - break; - case 3: - leftright = 0; - /* no break */ - case 5: - i = ndigits + k + 1; - ilim = i; - ilim1 = i - 1; - if (i <= 0) - i = 1; - } - /* i is now an upper bound of the number of digits to generate. */ - j = sizeof(unsigned32) * (1< result->k) - { - Bfree (result); - result = Balloc(result_k); - } - s = s0 = (char *)result; - - if (ilim >= 0 && ilim <= Quick_max && try_quick) { - - /* Try to get by with floating-point arithmetic. */ - - i = 0; - d2 = d; - k0 = k; - ilim0 = ilim; - ieps = 2; /* conservative */ - if (k > 0) { - ds = tens[k&0xf]; - j = k >> 4; - if (j & Bletch) { - /* prevent overflows */ - j &= Bletch - 1; - d /= bigtens[n_bigtens-1]; - ieps++; - } - for(; j; j >>= 1, i++) - if (j & 1) { - ieps++; - ds *= bigtens[i]; - } - d /= ds; - } - else if ((j1 = -k)) { - d *= tens[j1 & 0xf]; - for(j = j1 >> 4; j; j >>= 1, i++) - if (j & 1) { - ieps++; - d *= bigtens[i]; - } - } - if (k_check && d < 1. && ilim > 0) { - if (ilim1 <= 0) - goto fast_failed; - ilim = ilim1; - k--; - d *= 10.; - ieps++; - } - eps = ieps*d + 7.; - addword0(eps, - (P-1)*Exp_msk1); - if (ilim == 0) { - d -= 5.; - if (d > eps) - goto one_digit; - if (d < -eps) - goto no_digits; - goto fast_failed; - } -#ifndef No_leftright - if (leftright) { - /* Use Steele & White method of only - * generating digits needed. - */ - eps = 0.5/tens[ilim-1] - eps; - for(i = 0;;) { - L = (_G_int32_t)d; - d -= L; - *s++ = '0' + (int)L; - if (d < eps) - goto ret1; - if (1. - d < eps) - goto bump_up; - if (++i >= ilim) - break; - eps *= 10.; - d *= 10.; - } - } - else { -#endif - /* Generate ilim digits, then fix them up. */ - eps *= tens[ilim-1]; - for(i = 1;; i++, d *= 10.) { - L = (_G_int32_t)d; - d -= L; - *s++ = '0' + (int)L; - if (i == ilim) { - if (d > 0.5 + eps) - goto bump_up; - else if (d < 0.5 - eps) { - while(*--s == '0'); - s++; - goto ret1; - } - break; - } - } -#ifndef No_leftright - } -#endif - fast_failed: - s = s0; - d = d2; - k = k0; - ilim = ilim0; - } - - /* Do we have a "small" integer? */ - - if (be >= 0 && k <= Int_max) { - /* Yes. */ - ds = tens[k]; - if (ndigits < 0 && ilim <= 0) { - if (ilim < 0 || d <= 5*ds) - goto no_digits; - goto one_digit; - } - for(i = 1;; i++) { - L = (_G_int32_t)(d / ds); - d -= L*ds; -#ifdef Check_FLT_ROUNDS - /* If FLT_ROUNDS == 2, L will usually be high by 1 */ - if (d < 0) { - L--; - d += ds; - } -#endif - *s++ = '0' + (int)L; - if (i == ilim) { - d += d; - if (d > ds || (d == ds && L & 1)) { - bump_up: - while(*--s == '9') - if (s == s0) { - k++; - *s = '0'; - break; - } - ++*s++; - } - break; - } - if (!(d *= 10.)) - break; - } - goto ret1; - } - - m2 = b2; - m5 = b5; - if (leftright) { - if (mode < 2) { - i = -#ifndef Sudden_Underflow - denorm ? be + (Bias + (P-1) - 1 + 1) : -#endif -#ifdef IBM - 1 + 4*P - 3 - bbits + ((bbits + be - 1) & 3); -#else - 1 + P - bbits; -#endif - } - else { - j = ilim - 1; - if (m5 >= j) - m5 -= j; - else { - s5 += j -= m5; - b5 += j; - m5 = 0; - } - if ((i = ilim) < 0) { - m2 -= i; - i = 0; - } - } - b2 += i; - s2 += i; - mhi = i2b(Binit(&_mhi), 1); - } - if (m2 > 0 && s2 > 0) { - i = m2 < s2 ? m2 : s2; - b2 -= i; - m2 -= i; - s2 -= i; - } - if (b5 > 0) { - if (leftright) { - if (m5 > 0) { - Bigint *b_tmp; - mhi = pow5mult(mhi, m5); - b_tmp = mult(b_avail, mhi, b); - b_avail = b; - b = b_tmp; - } - if ((j = b5 - m5)) - b = pow5mult(b, j); - } - else - b = pow5mult(b, b5); - } - S = i2b(S, 1); - if (s5 > 0) - S = pow5mult(S, s5); - - /* Check for special case that d is a normalized power of 2. */ - - if (mode < 2) { - if (!word1(d) && !(word0(d) & Bndry_mask) -#ifndef Sudden_Underflow - && word0(d) & Exp_mask -#endif - ) { - /* The special case */ - b2 += Log2P; - s2 += Log2P; - spec_case = 1; - } - else - spec_case = 0; - } - - /* Arrange for convenient computation of quotients: - * shift left if necessary so divisor has 4 leading 0 bits. - * - * Perhaps we should just compute leading 28 bits of S once - * and for all and pass them and a shift to quorem, so it - * can do shifts and ors to compute the numerator for q. - */ - if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f)) - i = 32 - i; - if (i > 4) { - i -= 4; - b2 += i; - m2 += i; - s2 += i; - } - else if (i < 4) { - i += 28; - b2 += i; - m2 += i; - s2 += i; - } - if (b2 > 0) - b = lshift(b, b2); - if (s2 > 0) - S = lshift(S, s2); - if (k_check) { - if (cmp(b,S) < 0) { - k--; - b = multadd(b, 10, 0); /* we botched the k estimate */ - if (leftright) - mhi = multadd(mhi, 10, 0); - ilim = ilim1; - } - } - if (ilim <= 0 && mode > 2) { - if (ilim < 0 || cmp(b,S = multadd(S,5,0)) <= 0) { - /* no digits, fcvt style */ - no_digits: - k = -1 - ndigits; - goto ret; - } - one_digit: - *s++ = '1'; - k++; - goto ret; - } - if (leftright) { - if (m2 > 0) - mhi = lshift(mhi, m2); - - /* Compute mlo -- check for special case - * that d is a normalized power of 2. - */ - - if (spec_case) { - mlo = Brealloc(Binit(&_mlo), mhi->k); - Bcopy(mlo, mhi); - mhi = lshift(mhi, Log2P); - } - else - mlo = mhi; - - for(i = 1;;i++) { - dig = quorem(b,S) + '0'; - /* Do we yet have the shortest decimal string - * that will round to d? - */ - j = cmp(b, mlo); - b_avail = diff(b_avail, S, mhi); /* b_avail = S - mi */ - j1 = b_avail->sign ? 1 : cmp(b, b_avail); -#ifndef ROUND_BIASED - if (j1 == 0 && !mode && !(word1(d) & 1)) { - if (dig == '9') - goto round_9_up; - if (j > 0) - dig++; - *s++ = dig; - goto ret; - } -#endif - if (j < 0 || (j == 0 && !mode -#ifndef ROUND_BIASED - && !(word1(d) & 1) -#endif - )) { - if (j1 > 0) { - b = lshift(b, 1); - j1 = cmp(b, S); - if ((j1 > 0 || (j1 == 0 && dig & 1)) - && dig++ == '9') - goto round_9_up; - } - *s++ = dig; - goto ret; - } - if (j1 > 0) { - if (dig == '9') { /* possible if i == 1 */ - round_9_up: - *s++ = '9'; - goto roundoff; - } - *s++ = dig + 1; - goto ret; - } - *s++ = dig; - if (i == ilim) - break; - b = multadd(b, 10, 0); - if (mlo == mhi) - mlo = mhi = multadd(mhi, 10, 0); - else { - mlo = multadd(mlo, 10, 0); - mhi = multadd(mhi, 10, 0); - } - } - } - else - for(i = 1;; i++) { - *s++ = dig = quorem(b,S) + '0'; - if (i >= ilim) - break; - b = multadd(b, 10, 0); - } - - /* Round off last digit */ - - b = lshift(b, 1); - j = cmp(b, S); - if (j > 0 || (j == 0 && dig & 1)) { - roundoff: - while(*--s == '9') - if (s == s0) { - k++; - *s++ = '1'; - goto ret; - } - ++*s++; - } - else { - while(*--s == '0'); - s++; - } - ret: - Bfree(b_avail); - Bfree(S); - if (mhi) { - if (mlo && mlo != mhi) - Bfree(mlo); - Bfree(mhi); - } - ret1: - Bfree(b); - *s = 0; - *decpt = k + 1; - if (rve) - *rve = s; - return s0; - } -#endif /* _IO_USE_DTOA */ diff --git a/contrib/libio/floatio.h b/contrib/libio/floatio.h deleted file mode 100644 index 827767bde3..0000000000 --- a/contrib/libio/floatio.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * %W% (Berkeley) %G% - */ - -/* - * Floating point scanf/printf (input/output) definitions. - */ - -/* 11-bit exponent (VAX G floating point) is 308 decimal digits */ -#define MAXEXP 308 -/* 128 bit fraction takes up 39 decimal digits; max reasonable precision */ -#define MAXFRACT 39 diff --git a/contrib/libio/fstream.cc b/contrib/libio/fstream.cc deleted file mode 100644 index 8930e0b927..0000000000 --- a/contrib/libio/fstream.cc +++ /dev/null @@ -1,110 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. - -Written by Per Bothner (bothner@cygnus.com). */ - -#ifdef __GNUG__ -#pragma implementation -#endif -#define _STREAM_COMPAT -extern "C" { -#include "libioP.h" -} -#include - -inline void -fstreambase::__fb_init() -{ -#ifdef _IO_NEW_STREAMS -#if !_IO_UNIFIED_JUMPTABLES - /* Uses the _IO_file_jump jumptable, for eficiency. */ - __my_fb._jumps = &_IO_file_jumps; - __my_fb._vtable() = builtinbuf_vtable; -#endif - init (&__my_fb); -#else - init(filebuf::__new()); - _flags &= ~ios::dont_close; -#endif -} - -fstreambase::fstreambase() -{ - __fb_init (); -} - -fstreambase::fstreambase(int fd) -{ - __fb_init (); - _IO_file_attach(rdbuf(), fd); -} - -fstreambase::fstreambase(const char *name, int mode, int prot) -{ - __fb_init (); - if (!rdbuf()->open(name, mode, prot)) - set(ios::badbit); -} - -fstreambase::fstreambase(int fd, char *p, int l) -{ -#ifdef _IO_NEW_STREAMS - __fb_init (); -#else - init(filebuf::__new()); -#endif - _IO_file_attach(rdbuf(), fd); - _IO_file_setbuf(rdbuf(), p, l); -} - -void fstreambase::open(const char *name, int mode, int prot) -{ - clear(); - if (!rdbuf()->open(name, mode, prot)) - set(ios::badbit); -} - -void fstreambase::close() -{ - if (!rdbuf()->close()) - set(ios::failbit); -} - -void fstreambase::attach(int fd) -{ - if (!rdbuf()->attach(fd)) - set(ios::failbit); -} - -#if 0 -static int mode_to_sys(enum open_mode mode) -{ - return O_WRONLY; -} - -static char* fopen_cmd_arg(io_mode i) -{ - return "w"; -} -#endif diff --git a/contrib/libio/fstream.h b/contrib/libio/fstream.h deleted file mode 100644 index b5f6598538..0000000000 --- a/contrib/libio/fstream.h +++ /dev/null @@ -1,92 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993, 2000 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#ifndef _FSTREAM_H -#define _FSTREAM_H -#ifdef __GNUG__ -#pragma interface -#endif -#include - -extern "C++" { -class fstreambase : virtual public ios { -#ifdef _IO_NEW_STREAMS - mutable filebuf __my_fb; // mutable so rdbuf() can be const -#endif - void __fb_init (); - public: - fstreambase(); - fstreambase(int fd); - fstreambase(int fd, char *p, int l); /* Deprecated */ - fstreambase(const char *name, int mode, int prot=0664); - void close(); -#ifdef _IO_NEW_STREAMS - filebuf* rdbuf() const { return &__my_fb; } -#else - filebuf* rdbuf() const { return (filebuf*) ios::rdbuf(); } -#endif - void open(const char *name, int mode, int prot=0664); - int is_open() const { return rdbuf()->is_open(); } - void setbuf(char *ptr, int len) { rdbuf()->setbuf(ptr, len); } - void attach(int fd); -#ifdef _STREAM_COMPAT - int filedesc() { return rdbuf()->fd(); } - fstreambase& raw() { rdbuf()->setbuf(NULL, 0); return *this; } -#endif -}; - -class ifstream : public fstreambase, public istream { - public: - ifstream() : fstreambase() { } - ifstream(int fd) : fstreambase(fd) { } - ifstream(int fd, char *p, int l) : fstreambase(fd, p, l) { } /*Deprecated*/ - ifstream(const char *name, int mode=ios::in, int prot=0664) - : fstreambase(name, mode | ios::in, prot) { } - void open(const char *name, int mode=ios::in, int prot=0664) - { fstreambase::open(name, mode | ios::in, prot); } -}; - -class ofstream : public fstreambase, public ostream { - public: - ofstream() : fstreambase() { } - ofstream(int fd) : fstreambase(fd) { } - ofstream(int fd, char *p, int l) : fstreambase(fd, p, l) { } /*Deprecated*/ - ofstream(const char *name, int mode=ios::out, int prot=0664) - : fstreambase(name, mode | ios::out, prot) { } - void open(const char *name, int mode=ios::out, int prot=0664) - { fstreambase::open(name, mode | ios::out, prot); } -}; - -class fstream : public fstreambase, public iostream { - public: - fstream() : fstreambase() { } - fstream(int fd) : fstreambase(fd) { } - fstream(const char *name, int mode, int prot=0664) - : fstreambase(name, mode, prot) { } - fstream(int fd, char *p, int l) : fstreambase(fd, p, l) { } /*Deprecated*/ - void open(const char *name, int mode, int prot=0664) - { fstreambase::open(name, mode, prot); } -}; -} // extern "C++" -#endif /*!_FSTREAM_H*/ diff --git a/contrib/libio/gen-params b/contrib/libio/gen-params deleted file mode 100755 index afb8f3b03c..0000000000 --- a/contrib/libio/gen-params +++ /dev/null @@ -1,739 +0,0 @@ -#!/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`} - -cat <dummy.h <dummy.C <&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 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' 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 /p' \ - >>dummy.out - # Now we get rid of the <>, and any other junk on the nm output line. - # (We get rid of 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 '//d' \ - -e '/\.data[$_.]<_vt\$7filebuf>/d' \ - -e 's/^.*<\(.*\)>.*$/\1/p' \ - &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 < -#include -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 <&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 - if ${CPP} dummy.c >/dev/null 2>&1 ; then eval $hdr=1; fi -done - -cat >dummy.c < -#include -#ifdef __STDC__ -#include -#else /* !__STDC__ */ -#include -#endif /* __STDC__ */ -#include -#include -#include -#ifdef __STDC__ -#include -#endif -#if WCHAR == 1 -#include -#endif -#if WCTYPE == 1 -#include -#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 ' ' ' ' 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" /dev/null - # Now select the first definition. - if [ -s TMP ]; then - eval "$NAME='"`${SED} -e '2,$d' /dev/null - # Now select the first definition. - if [ -s TMP ]; then - eval "$NAME='"`${SED} -e '2,$d' 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 - echo "#include - 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 </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 < -} -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 < -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 < -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 < -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 < -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 < -#include -#include - 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 < -#include - 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 ' >dummy.c - echo '#include ' >>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 ' >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 < -#include - 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 ' >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 -#include ' >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 ' >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 - -# A little test program to check if __printf_fp is available. -cat >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 - -# 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 - -rm -f dummy.C dummy.o dummy.c dummy.out TMP core a.out - -echo "#endif /* !${macro_prefix}config_h */" diff --git a/contrib/libio/genops.c b/contrib/libio/genops.c deleted file mode 100644 index b899e150af..0000000000 --- a/contrib/libio/genops.c +++ /dev/null @@ -1,946 +0,0 @@ -/* 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 -#endif -#include - -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/contrib/libio/include/empty.h b/contrib/libio/include/empty.h deleted file mode 100644 index dcbf758df9..0000000000 --- a/contrib/libio/include/empty.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Thread package specific definitions of stream lock type. - Copyright (C) 1996, 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 _LIBIO_LOCK_H -#define _LIBIO_LOCK_H 1 - -typedef void *_IO_lock_t; - -/* We need recursive (counting) mutexes. */ -#define _IO_lock_initializer NULL - - -#define _IO_cleanup_region_start(_fct, _fp) -#define _IO_cleanup_region_end(_doit) -#define _IO_lock_init(_name) -#define _IO_lock_fini(_name) -#define _IO_lock_lock(_name) -#define _IO_lock_unlock(_name) - -#endif /* libio-lock.h */ -/* this will be used later*/ diff --git a/contrib/libio/indstream.cc b/contrib/libio/indstream.cc deleted file mode 100644 index 15a1bb2778..0000000000 --- a/contrib/libio/indstream.cc +++ /dev/null @@ -1,121 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. - -Written by Per Bothner (bothner@cygnus.com). */ - -#ifdef __GNUG__ -#pragma implementation -#endif - -#include - -indirectbuf::indirectbuf(streambuf *get, streambuf *put, int delete_mode) -: streambuf() -{ - _get_stream = get; - _put_stream = put == NULL ? get : put; - _delete_flags = delete_mode; -} - -indirectbuf::~indirectbuf() -{ - if (_delete_flags & ios::in) delete get_stream(); - if (_delete_flags & ios::out) delete put_stream(); -} - -streamsize indirectbuf::xsputn(const char* s, streamsize n) -{ - return put_stream()->sputn(s, n); -} - -streamsize indirectbuf::xsgetn(char* s, streamsize n) -{ - return get_stream()->sgetn(s, n); -} - -int indirectbuf::overflow(int c /* = EOF */) -{ - if (c == EOF) - return put_stream()->overflow(c); - else - return put_stream()->sputc(c); -} - -int indirectbuf::underflow() -{ - return get_stream()->sgetc(); -} - -int indirectbuf::uflow() -{ - return get_stream()->sbumpc(); -} - -streampos indirectbuf::seekoff(streamoff off, _seek_dir dir, int mode) -{ - int ret_val = 0; - int select = mode == 0 ? (ios::in|ios::out) : mode; - streambuf *gbuf = (select & ios::in) ? get_stream() : (streambuf*)NULL; - streambuf *pbuf = (select & ios::out) ? put_stream() : (streambuf*)NULL; - if (gbuf == pbuf) - ret_val = gbuf->seekoff(off, dir, mode); - else { - if (gbuf) - ret_val = gbuf->seekoff(off, dir, ios::in); - if (pbuf && ret_val != EOF) - ret_val = pbuf->seekoff(off, dir, ios::out); - } - return ret_val; -} - -streampos indirectbuf::seekpos(streampos pos, int mode) -{ - int ret_val = EOF; - int select = mode == 0 ? (ios::in|ios::out) : mode; - streambuf *gbuf = (select & ios::in) ? get_stream() : (streambuf*)NULL; - streambuf *pbuf = (select & ios::out) ? put_stream() : (streambuf*)NULL; - if (gbuf == pbuf && gbuf != NULL) - ret_val = gbuf->seekpos(pos, mode); - else { - if (gbuf) - ret_val = gbuf->seekpos(pos, ios::in); - if (pbuf && ret_val != EOF) - ret_val = pbuf->seekpos(pos, ios::out); - } - return ret_val; -} - -int indirectbuf::sync() -{ - streambuf *gbuf = get_stream(); - int get_ret_val = gbuf ? gbuf->sync() : 0; - streambuf *pbuf = put_stream(); - int put_ret_val = (pbuf && pbuf != gbuf) ? pbuf->sync() : 0; - return get_ret_val || put_ret_val; -} - -int indirectbuf::pbackfail(int c) -{ - return get_stream()->sputbackc(c); -} diff --git a/contrib/libio/indstream.h b/contrib/libio/indstream.h deleted file mode 100644 index c4558623d0..0000000000 --- a/contrib/libio/indstream.h +++ /dev/null @@ -1,77 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. - -Written by Per Bothner (bothner@cygnus.com). */ - -#ifndef _INDSTREAM_H -#define _INDSTREAM_H - -#ifdef __GNUG__ -#pragma interface -#endif - -#include - -extern "C++" { -// An indirectbuf is one that forwards all of its I/O requests -// to another streambuf. -// All get-related requests are sent to get_stream(). -// All put-related requests are sent to put_stream(). - -// An indirectbuf can be used to implement Common Lisp -// synonym-streams and two-way-streams. -// -// class synonymbuf : public indirectbuf { -// Symbol *sym; -// synonymbuf(Symbol *s) { sym = s; } -// virtual streambuf *lookup_stream(int mode) { -// return coerce_to_streambuf(lookup_value(sym)); } -// }; - -class indirectbuf : public streambuf { - protected: - streambuf *_get_stream; // Optional cache for get_stream(). - streambuf *_put_stream; // Optional cache for put_stream(). - int _delete_flags; - public: - streambuf *get_stream() - { return _get_stream ? _get_stream : lookup_stream(ios::in); } - streambuf *put_stream() - { return _put_stream ? _put_stream : lookup_stream(ios::out); } - virtual streambuf *lookup_stream(int/*mode*/) { return NULL; } // ERROR! - indirectbuf(streambuf *get=NULL, streambuf *put=NULL, int delete_mode=0); - virtual ~indirectbuf(); - virtual streamsize xsputn(const char* s, streamsize n); - virtual streamsize xsgetn(char* s, streamsize n); - virtual int underflow(); - virtual int uflow(); - virtual int overflow(int c = EOF); - virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); - virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out); - virtual int sync(); - virtual int pbackfail(int c); -}; -} // extern "C++" - -#endif /* !_INDSTREAM_H */ diff --git a/contrib/libio/ioassign.cc b/contrib/libio/ioassign.cc deleted file mode 100644 index 5b8e68bbf5..0000000000 --- a/contrib/libio/ioassign.cc +++ /dev/null @@ -1,49 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1994 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* Written by Per Bothner (bothner@cygnus.com). */ - -#include -#include "libioP.h" - -// These method are provided for backward compatibility reasons. -// It's generally poor style to use them. -// They are not supported by the ANSI/ISO working paper. - -_IO_istream_withassign& _IO_istream_withassign::operator=(istream& rhs) -{ - if (&rhs != (istream*)this) - { - init (rhs.rdbuf ()); - _gcount = 0; - } - return *this; -} - -_IO_ostream_withassign& _IO_ostream_withassign::operator=(ostream& rhs) -{ - if (&rhs != (ostream*)this) - init (rhs.rdbuf ()); - return *this; -} diff --git a/contrib/libio/ioextend.cc b/contrib/libio/ioextend.cc deleted file mode 100644 index a31ff36e6e..0000000000 --- a/contrib/libio/ioextend.cc +++ /dev/null @@ -1,132 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include - -static int __xalloc = 0; - -int ios::xalloc() -{ - return __xalloc++; -} - -static ios::fmtflags __used_fmt_flags -= ios::skipws | ios::left | ios::right | ios::internal -| ios::dec | ios::oct | ios::hex | ios::showbase | ios::showpoint -| ios::uppercase | ios::showpos | ios::scientific | ios::fixed -#ifndef _IO_NEW_STREAMS -| ios::dont_close -#endif -| ios::unitbuf | ios::stdio; - -ios::fmtflags ios::bitalloc() -{ - fmtflags bit_to_try = (fmtflags)1; - for (; bit_to_try; bit_to_try <<= 1) - { - if ((__used_fmt_flags & bit_to_try) == 0) - { - __used_fmt_flags |= bit_to_try; - return bit_to_try; - } - } - return 0; -} - -// NOTE: This implementation of ios::iword and ios::pword assumes -// that these methods are seldom used, so we want to minimize -// the space and time overhead when NOT using these methods. -// -// ANSI specifies two conceptually-infinite arrays, one whose -// elements are longs, and one whose elements are (void*)s. -// We implement this as a single array, each of whose element is -// a (struct ptr_and_long), which has space for both a long and a void*. -// We also specify that (the i field of) the 0'th element of the array -// contains the allocated length of the array (not counting that -// initial element). - -struct ptr_and_long { - void *p; - long i; -}; - -static struct ptr_and_long& -get_array_element(ios& io, int index) -{ - if (index < 0) - io._throw_failure(); - register struct ptr_and_long *array = (ptr_and_long*)io._arrays; - int old_length = array == NULL ? 0 : array[0].i; - if (index >= old_length) - { - register int i; - int new_length = index + 10; - register struct ptr_and_long *new_array - = new ptr_and_long[1 + new_length]; - if (array != NULL) - { - for (i = 1; i <= old_length; i++) - new_array[i] = array[i]; - delete [] array; - } - for (i = old_length + 1; i <= new_length; i++) - { - new_array[i].i = 0; - new_array[i].p = NULL; - } - new_array[0].i = new_length; - new_array[0].p = NULL; - io._arrays = (void*)new_array; - array = new_array; - } - return array[index+1]; -} - -long& ios::iword(int index) -{ - return get_array_element(*this, index).i; -} - -void*& ios::pword(int index) -{ - return get_array_element(*this, index).p; -} - -long ios::iword(int index) const -{ - if (index < 0) - _throw_failure(); - register struct ptr_and_long *pl_array = (ptr_and_long*)_arrays; - int len = pl_array == NULL ? 0 : pl_array[0].i; - return index >= len ? 0 : pl_array[index+1].i; -} - -void* ios::pword(int index) const -{ - if (index < 0) - _throw_failure(); - register struct ptr_and_long *pl_array = (ptr_and_long*)_arrays; - int len = pl_array == NULL ? 0 : pl_array[0].i; - return index >= len ? 0 : pl_array[index+1].p; -} diff --git a/contrib/libio/iofclose.c b/contrib/libio/iofclose.c deleted file mode 100644 index 7db336c5d5..0000000000 --- a/contrib/libio/iofclose.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#ifdef __STDC__ -#include -#endif - -int -_IO_fclose (fp) - _IO_FILE *fp; -{ - int status; - - CHECK_FILE(fp, EOF); - - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - if (fp->_IO_file_flags & _IO_IS_FILEBUF) - status = _IO_file_close_it (fp); - else - status = fp->_flags & _IO_ERR_SEEN ? -1 : 0; - _IO_FINISH (fp); - _IO_cleanup_region_end (1); - if (fp != _IO_stdin && fp != _IO_stdout && fp != _IO_stderr) - { - fp->_IO_file_flags = 0; - free(fp); - } - - return status; -} - -#ifdef weak_alias -weak_alias (_IO_fclose, fclose) -#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL) -int fclose (_IO_FILE *) __attribute__ ((weak, alias("_IO_fclose"))); -#endif diff --git a/contrib/libio/iofdopen.c b/contrib/libio/iofdopen.c deleted file mode 100644 index 841e7032b8..0000000000 --- a/contrib/libio/iofdopen.c +++ /dev/null @@ -1,134 +0,0 @@ -/* Copyright (C) 1993, 1994, 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. */ - -#ifdef __STDC__ -#include -#endif -#include "libioP.h" -#include - -#ifndef _IO_fcntl -#define _IO_fcntl fcntl -#endif - -_IO_FILE * -_IO_fdopen (fd, mode) - int fd; - const char *mode; -{ - int read_write; - int posix_mode = 0; - struct locked_FILE - { - struct _IO_FILE_plus fp; -#ifdef _IO_MTSAFE_IO - _IO_lock_t lock; -#endif - } *new_f; - int fd_flags; - - switch (*mode++) - { - case 'r': - read_write = _IO_NO_WRITES; - break; - case 'w': - read_write = _IO_NO_READS; - break; - case 'a': - posix_mode = O_APPEND; - read_write = _IO_NO_READS|_IO_IS_APPENDING; - break; - default: - MAYBE_SET_EINVAL; - return NULL; - } - if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+')) - read_write &= _IO_IS_APPENDING; -#ifdef F_GETFL - fd_flags = _IO_fcntl (fd, F_GETFL); -#ifndef O_ACCMODE -#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) -#endif - if (fd_flags == -1 - || ((fd_flags & O_ACCMODE) == O_RDONLY && !(read_write & _IO_NO_WRITES)) - || ((fd_flags & O_ACCMODE) == O_WRONLY && !(read_write & _IO_NO_READS))) - return NULL; - - /* The May 93 draft of P1003.4/D14.1 (redesignated as 1003.1b) - [System Application Program Interface (API) Amendment 1: - Realtime Extensions], Rationale B.8.3.3 - Open a Stream on a File Descriptor says: - - Although not explicitly required by POSIX.1, a good - implementation of append ("a") mode would cause the - O_APPEND flag to be set. - - (Historical implementations [such as Solaris2] do a one-time - seek in fdopen.) - - However, we do not turn O_APPEND off if the mode is "w" (even - though that would seem consistent) because that would be more - likely to break historical programs. - */ - if ((posix_mode & O_APPEND) && !(fd_flags & O_APPEND)) - { -#ifdef F_SETFL - if (_IO_fcntl (fd, F_SETFL, fd_flags | O_APPEND) == -1) -#endif - return NULL; - } -#endif - - new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE)); - if (new_f == NULL) - return NULL; -#ifdef _IO_MTSAFE_IO - new_f->fp.file._lock = &new_f->lock; -#endif - _IO_init (&new_f->fp.file, 0); - _IO_JUMPS (&new_f->fp.file) = &_IO_file_jumps; - _IO_file_init (&new_f->fp.file); -#if !_IO_UNIFIED_JUMPTABLES - new_f->fp.vtable = NULL; -#endif - if (_IO_file_attach (&new_f->fp.file, fd) == NULL) - { - _IO_un_link (&new_f->fp.file); - free (new_f); - return NULL; - } - new_f->fp.file._flags &= ~_IO_DELETE_DONT_CLOSE; - - new_f->fp.file._IO_file_flags = - _IO_mask_flags (&new_f->fp.file, read_write, - _IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING); - - return (_IO_FILE *) &new_f->fp; -} - -#ifdef weak_alias -weak_alias (_IO_fdopen, fdopen) -#endif diff --git a/contrib/libio/iofeof.c b/contrib/libio/iofeof.c deleted file mode 100644 index 7bf8cba285..0000000000 --- a/contrib/libio/iofeof.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "libioP.h" -#include "stdio.h" - -int -_IO_feof (fp) - _IO_FILE* fp; -{ - int result; - CHECK_FILE (fp, EOF); - _IO_flockfile (fp); - result = _IO_feof_unlocked (fp); - _IO_funlockfile (fp); - return result; -} - -#ifdef weak_alias -weak_alias (_IO_feof, feof) -#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL) -int feof (_IO_FILE *) __attribute__ ((weak, alias("_IO_feof"))); -#endif diff --git a/contrib/libio/ioferror.c b/contrib/libio/ioferror.c deleted file mode 100644 index 3019e796a1..0000000000 --- a/contrib/libio/ioferror.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include "stdio.h" - -int -_IO_ferror (fp) - _IO_FILE* fp; -{ - int result; - CHECK_FILE (fp, EOF); - _IO_flockfile (fp); - result = _IO_ferror_unlocked (fp); - _IO_funlockfile (fp); - return result; -} - -#ifdef weak_alias -weak_alias (_IO_ferror, ferror) -#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL) -int ferror (_IO_FILE *) __attribute__ ((weak, alias("_IO_ferror"))); -#endif diff --git a/contrib/libio/iofflush.c b/contrib/libio/iofflush.c deleted file mode 100644 index 540c99d535..0000000000 --- a/contrib/libio/iofflush.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include - -int -_IO_fflush (fp) - _IO_FILE *fp; -{ - if (fp == NULL) - return _IO_flush_all (); - else - { - int result; - CHECK_FILE (fp, EOF); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - result = _IO_SYNC (fp) ? EOF : 0; - _IO_cleanup_region_end (1); - return result; - } -} - -#ifdef weak_alias -weak_alias (_IO_fflush, fflush) -#endif diff --git a/contrib/libio/iofflush_u.c b/contrib/libio/iofflush_u.c deleted file mode 100644 index b46ae4a3f9..0000000000 --- a/contrib/libio/iofflush_u.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include - -int -fflush_unlocked (fp) - _IO_FILE *fp; -{ - if (fp == NULL) - return _IO_flush_all (); - else - { - CHECK_FILE (fp, EOF); - return _IO_SYNC (fp) ? EOF : 0; - } -} diff --git a/contrib/libio/iofgetpos.c b/contrib/libio/iofgetpos.c deleted file mode 100644 index 716be4bca1..0000000000 --- a/contrib/libio/iofgetpos.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include -/* ANSI explicitly requires setting errno to a positive value on failure. */ - -int -_IO_fgetpos (fp, posp) - _IO_FILE* fp; - _IO_fpos_t *posp; -{ - _IO_fpos_t pos; - CHECK_FILE (fp, EOF); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0); - _IO_cleanup_region_end (1); - if (pos == _IO_pos_BAD) - { -#ifdef EIO - if (errno == 0) - __set_errno (EIO); -#endif - return EOF; - } - *posp = pos; - return 0; -} - -#ifdef weak_alias -weak_alias (_IO_fgetpos, fgetpos) -#endif diff --git a/contrib/libio/iofgets.c b/contrib/libio/iofgets.c deleted file mode 100644 index 74754d5d1e..0000000000 --- a/contrib/libio/iofgets.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include - -char * -_IO_fgets (buf, n, fp) - char *buf; - int n; - _IO_FILE *fp; -{ - _IO_size_t count; - char *result; - CHECK_FILE (fp, NULL); - if (n <= 0) - return NULL; - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - count = _IO_getline (fp, buf, n - 1, '\n', 1); - if (count == 0 || (fp->_IO_file_flags & _IO_ERR_SEEN)) - result = NULL; - else - { - buf[count] = '\0'; - result = buf; - } - _IO_cleanup_region_end (1); - return result; -} - -#ifdef weak_alias -weak_alias (_IO_fgets, fgets) -#endif diff --git a/contrib/libio/iofopen.c b/contrib/libio/iofopen.c deleted file mode 100644 index 1dbeccb81a..0000000000 --- a/contrib/libio/iofopen.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. - This file is part of the GNU IO Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - - As a special exception, if you link this library with files - compiled with a GNU compiler to produce an executable, this does - not cause the resulting executable to be covered by the GNU General - Public License. This exception does not however invalidate any - other reasons why the executable file might be covered by the GNU - General Public License. */ - -#include "libioP.h" -#ifdef __STDC__ -#include -#endif - -_IO_FILE * -_IO_fopen (filename, mode) - const char *filename; - const char *mode; -{ - struct locked_FILE - { - struct _IO_FILE_plus fp; -#ifdef _IO_MTSAFE_IO - _IO_lock_t lock; -#endif - } *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE)); - - if (new_f == NULL) - return NULL; -#ifdef _IO_MTSAFE_IO - new_f->fp.file._lock = &new_f->lock; -#endif - _IO_init (&new_f->fp.file, 0); - _IO_JUMPS (&new_f->fp.file) = &_IO_file_jumps; - _IO_file_init (&new_f->fp.file); -#if !_IO_UNIFIED_JUMPTABLES - new_f->fp.vtable = NULL; -#endif - if (_IO_file_fopen (&new_f->fp.file, filename, mode) != NULL) - return (_IO_FILE *) &new_f->fp; - _IO_un_link (&new_f->fp.file); - free (new_f); - return NULL; -} - -#ifdef weak_alias -weak_alias (_IO_fopen, fopen) -#endif diff --git a/contrib/libio/iofprintf.c b/contrib/libio/iofprintf.c deleted file mode 100644 index 4dc9d3f661..0000000000 --- a/contrib/libio/iofprintf.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. - This file is part of the GNU IO Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - - As a special exception, if you link this library with files - compiled with a GNU compiler to produce an executable, this does - not cause the resulting executable to be covered by the GNU General - Public License. This exception does not however invalidate any - other reasons why the executable file might be covered by the GNU - General Public License. */ - -#include "libioP.h" - -#ifdef __STDC__ -#include -#else -#include -#endif - -int -#ifdef __STDC__ -_IO_fprintf (_IO_FILE *fp, const char* format, ...) -#else -_IO_fprintf (fp, format, va_alist) - _IO_FILE *fp; - char *format; - va_dcl -#endif -{ - int ret; - va_list args; - CHECK_FILE (fp, -1); - _IO_va_start (args, format); - ret = _IO_vfprintf (fp, format, args); - va_end (args); - return ret; -} diff --git a/contrib/libio/iofputs.c b/contrib/libio/iofputs.c deleted file mode 100644 index 1a329bbe26..0000000000 --- a/contrib/libio/iofputs.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "libioP.h" -#include - -int -_IO_fputs (str, fp) - const char *str; - _IO_FILE *fp; -{ - _IO_size_t len = strlen (str); - int result; - CHECK_FILE (fp, EOF); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - if (_IO_sputn (fp, str, len) != len) - result = EOF; - else - result = 1; - _IO_cleanup_region_end (1); - return result; -} - -#ifdef weak_alias -weak_alias (_IO_fputs, fputs) -#endif diff --git a/contrib/libio/iofread.c b/contrib/libio/iofread.c deleted file mode 100644 index c83d2b638c..0000000000 --- a/contrib/libio/iofread.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" - -_IO_size_t -_IO_fread (buf, size, count, fp) - void *buf; - _IO_size_t size; - _IO_size_t count; - _IO_FILE *fp; -{ - _IO_size_t bytes_requested = size*count; - _IO_size_t bytes_read; - CHECK_FILE (fp, 0); - if (bytes_requested == 0) - return 0; - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - bytes_read = _IO_sgetn (fp, (char *) buf, bytes_requested); - _IO_cleanup_region_end (1); - return bytes_requested == bytes_read ? count : bytes_read / size; -} - -#ifdef weak_alias -weak_alias (_IO_fread, fread) -#endif diff --git a/contrib/libio/iofscanf.c b/contrib/libio/iofscanf.c deleted file mode 100644 index 3e12d9b531..0000000000 --- a/contrib/libio/iofscanf.c +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" - -#ifdef __STDC__ -#include -#else -#include -#endif - -int -_IO_fscanf -#ifdef __STDC__ - (_IO_FILE *fp, const char* format, ...) -#else -(fp, format, va_alist) _IO_FILE *fp; char *format; va_dcl -#endif -{ - int ret; - va_list args; - CHECK_FILE(fp, EOF); - _IO_va_start(args, format); - ret = _IO_vfscanf(fp, format, args, NULL); - va_end(args); - return ret; -} diff --git a/contrib/libio/iofsetpos.c b/contrib/libio/iofsetpos.c deleted file mode 100644 index a8d816f5a3..0000000000 --- a/contrib/libio/iofsetpos.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include -#include - -int -_IO_fsetpos (fp, posp) - _IO_FILE *fp; - const _IO_fpos_t *posp; -{ - int result; - CHECK_FILE (fp, EOF); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - if (_IO_seekpos (fp, *posp, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD) - { - /* ANSI explicitly requires setting errno to a positive value on - failure. */ -#ifdef EIO - if (errno == 0) - __set_errno (EIO); -#endif - result = EOF; - } - else - result = 0; - _IO_cleanup_region_end (1); - return result; -} - -#ifdef weak_alias -weak_alias (_IO_fsetpos, fsetpos) -#endif diff --git a/contrib/libio/ioftell.c b/contrib/libio/ioftell.c deleted file mode 100644 index d8a1ce1d24..0000000000 --- a/contrib/libio/ioftell.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include -/* ANSI explicily requires setting errno to a positive value on failure. */ - -long int -_IO_ftell (fp) - _IO_FILE *fp; -{ - _IO_pos_t pos; - CHECK_FILE (fp, -1L); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0); - _IO_cleanup_region_end (1); - if (pos == _IO_pos_BAD) - { -#ifdef EIO - if (errno == 0) - __set_errno (EIO); -#endif - return -1L; - } - return _IO_pos_as_off (pos); -} - -#ifdef weak_alias -weak_alias (_IO_ftell, ftell) -#endif diff --git a/contrib/libio/iofwrite.c b/contrib/libio/iofwrite.c deleted file mode 100644 index 5bc525ffc7..0000000000 --- a/contrib/libio/iofwrite.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "libioP.h" - -_IO_size_t -_IO_fwrite (buf, size, count, fp) - const void *buf; - _IO_size_t size; - _IO_size_t count; - _IO_FILE *fp; -{ - _IO_size_t request = size * count; - _IO_size_t written; - CHECK_FILE (fp, 0); - if (request == 0) - return 0; - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - written = _IO_sputn (fp, (const char *) buf, request); - _IO_cleanup_region_end (1); - /* Many traditional implementations return 0 if size==0 && count > 0, - but ANSI requires us to return count in this case. */ - if (written == request) - return count; - else - return written / size; -} - -#ifdef weak_alias -weak_alias (_IO_fwrite, fwrite) -#endif diff --git a/contrib/libio/iogetc.c b/contrib/libio/iogetc.c deleted file mode 100644 index 6a11e47334..0000000000 --- a/contrib/libio/iogetc.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include "stdio.h" - -#undef _IO_getc - -int -_IO_getc (fp) - _IO_FILE *fp; -{ - int result; - CHECK_FILE (fp, EOF); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - result = _IO_getc_unlocked (fp); - _IO_cleanup_region_end (1); - return result; -} - -#undef getc - -#ifdef weak_alias -weak_alias (_IO_getc, getc) -#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL) -int getc (_IO_FILE *) __attribute__ ((weak, alias("_IO_getc"))); -#endif diff --git a/contrib/libio/iogetdelim.c b/contrib/libio/iogetdelim.c deleted file mode 100644 index 50918b3e8d..0000000000 --- a/contrib/libio/iogetdelim.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Copyright (C) 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. */ - -#ifdef __STDC__ -#include -#endif -#include "libioP.h" -#include -#include - -/* Read up to (and including) a TERMINATOR from FP into *LINEPTR - (and null-terminate it). *LINEPTR is a pointer returned from malloc (or - NULL), pointing to *N characters of space. It is realloc'ed as - necessary. Returns the number of characters read (not including the - null terminator), or -1 on error or EOF. */ - -_IO_ssize_t -_IO_getdelim (lineptr, n, delimiter, fp) - char **lineptr; - _IO_size_t *n; - int delimiter; - _IO_FILE *fp; -{ - int result; - _IO_ssize_t cur_len = 0; - _IO_ssize_t len; - - if (lineptr == NULL || n == NULL) - { - MAYBE_SET_EINVAL; - return -1; - } - CHECK_FILE (fp, -1); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - if (_IO_ferror_unlocked (fp)) - { - result = -1; - goto unlock_return; - } - - if (*lineptr == NULL || *n == 0) - { - *n = 120; - *lineptr = (char *) malloc (*n); - if (*lineptr == NULL) - { - result = -1; - goto unlock_return; - } - } - - len = fp->_IO_read_end - fp->_IO_read_ptr; - if (len <= 0) - { - if (__underflow (fp) == EOF) - { - result = -1; - goto unlock_return; - } - len = fp->_IO_read_end - fp->_IO_read_ptr; - } - - for (;;) - { - _IO_size_t needed; - char *t; - t = (char *) memchr ((void *) fp->_IO_read_ptr, delimiter, len); - if (t != NULL) - len = (t - fp->_IO_read_ptr) + 1; - /* Make enough space for len+1 (for final NUL) bytes. */ - needed = cur_len + len + 1; - if (needed > *n) - { - if (needed < 2 * *n) - needed = 2 * *n; /* Be generous. */ - *n = needed; - *lineptr = (char *) realloc (*lineptr, needed); - if (*lineptr == NULL) - { - result = -1; - goto unlock_return; - } - } - memcpy (*lineptr + cur_len, (void *) fp->_IO_read_ptr, len); - fp->_IO_read_ptr += len; - cur_len += len; - if (t != NULL || __underflow (fp) == EOF) - break; - len = fp->_IO_read_end - fp->_IO_read_ptr; - } - (*lineptr)[cur_len] = '\0'; - result = cur_len; - -unlock_return: - _IO_cleanup_region_end (1); - return result; -} - -#ifdef weak_alias -weak_alias (_IO_getdelim, __getdelim) -weak_alias (_IO_getdelim, getdelim) -#endif diff --git a/contrib/libio/iogetline.c b/contrib/libio/iogetline.c deleted file mode 100644 index 5aac9b5638..0000000000 --- a/contrib/libio/iogetline.c +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "libioP.h" -#include - -#if defined(_LIBC) || !_G_HAVE_IO_GETLINE_INFO - -_IO_size_t -_IO_getline (fp, buf, n, delim, extract_delim) - _IO_FILE *fp; - char *buf; - _IO_size_t n; - int delim; - int extract_delim; -{ - return _IO_getline_info (fp, buf, n, delim, extract_delim, (int *) 0); -} - -/* Algorithm based on that used by Berkeley pre-4.4 fgets implementation. - - Read chars into buf (of size n), until delim is seen. - Return number of chars read (at most n). - Does not put a terminating '\0' in buf. - If extract_delim < 0, leave delimiter unread. - If extract_delim > 0, insert delim in output. */ - -_IO_size_t -_IO_getline_info (fp, buf, n, delim, extract_delim, eof) - _IO_FILE *fp; - char *buf; - _IO_size_t n; - int delim; - int extract_delim; - int *eof; -{ - char *ptr = buf; - if (eof) *eof = 0; - while (n != 0) - { - _IO_ssize_t len = fp->_IO_read_end - fp->_IO_read_ptr; - if (len <= 0) - { - int c = __uflow (fp); - if (c == EOF) - { - if (eof) *eof = c; - break; - } - if (c == delim) - { - if (extract_delim > 0) - *ptr++ = c; - else if (extract_delim < 0) - _IO_sputbackc (fp, c); - return ptr - buf; - } - *ptr++ = c; - n--; - } - else - { - char *t; - if ((_IO_size_t) len >= n) - len = n; - t = (char *) memchr ((void *) fp->_IO_read_ptr, delim, len); - if (t != NULL) - { - _IO_size_t old_len = ptr-buf; - len = t - fp->_IO_read_ptr; - if (extract_delim >= 0) - { - ++t; - if (extract_delim > 0) - ++len; - } - memcpy ((void *) ptr, (void *) fp->_IO_read_ptr, len); - fp->_IO_read_ptr = t; - return old_len + len; - } - memcpy ((void *) ptr, (void *) fp->_IO_read_ptr, len); - fp->_IO_read_ptr += len; - ptr += len; - n -= len; - } - } - return ptr - buf; -} - -#endif /* Defined(_LIBC) || !_G_HAVE_IO_GETLINE_INFO */ diff --git a/contrib/libio/iogets.c b/contrib/libio/iogets.c deleted file mode 100644 index 9e88ca1037..0000000000 --- a/contrib/libio/iogets.c +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "libioP.h" -#include - -char* -_IO_gets (buf) - char *buf; -{ - _IO_size_t count; - int ch; - char *retval; - - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _IO_stdin); - _IO_flockfile (_IO_stdin); - ch = _IO_getc_unlocked (_IO_stdin); - if (ch == EOF) - { - retval = NULL; - goto unlock_return; - } - if (ch == '\n') - count = 0; - else - { - buf[0] = (char) ch; - count = _IO_getline (_IO_stdin, buf + 1, INT_MAX, '\n', 0) + 1; - if (_IO_stdin->_IO_file_flags & _IO_ERR_SEEN) - { - retval = NULL; - goto unlock_return; - } - } - buf[count] = 0; - retval = buf; -unlock_return: - _IO_cleanup_region_end (1); - return retval; -} - -#ifdef weak_alias -weak_alias (_IO_gets, gets) -#endif - -#ifdef _LIBC -link_warning (gets, "the `gets' function is dangerous and should not be used.") -#endif diff --git a/contrib/libio/ioignore.c b/contrib/libio/ioignore.c deleted file mode 100644 index ac0678ed7b..0000000000 --- a/contrib/libio/ioignore.c +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" - -int -_IO_ignore (fp, n) - _IO_FILE *fp; - _IO_size_t n; -{ - register _IO_size_t more = n; - for (;;) - { - _IO_ssize_t count = fp->_IO_read_end - fp->_IO_read_ptr; - if (count > 0) - { - if (count > more) - count = more; - fp->_IO_read_ptr += count; - more -= count; - } - if (more == 0 || __underflow(fp) == EOF) - break; - } - return n - more; -} diff --git a/contrib/libio/iolibio.h b/contrib/libio/iolibio.h deleted file mode 100644 index 0ebc14f7ac..0000000000 --- a/contrib/libio/iolibio.h +++ /dev/null @@ -1,67 +0,0 @@ -#include - -/* 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 -# 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 -#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/contrib/libio/iomanip.cc b/contrib/libio/iomanip.cc deleted file mode 100644 index fddba55a2b..0000000000 --- a/contrib/libio/iomanip.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#ifdef __GNUG__ -#pragma implementation -#endif - -#include "iomanip.h" - - -// Those functions are called through a pointer, -// thus it does not make sense, to inline them. - -ios & __iomanip_setbase (ios& i, int n) -{ - ios::fmtflags b; - switch (n) - { - case 8: - b = ios::oct; break; - case 10: - b = ios::dec; break; - case 16: - b = ios::hex; break; - default: - b = 0; - } - i.setf(b, ios::basefield); - return i; -} - -ios & __iomanip_setfill (ios& i, int n) -{ - //FIXME if ( i.flags() & ios::widechar ) - i.fill( (char) n); - //FIXME else - //FIXME i.fill( (wchar) n); - return i; -} - -ios & __iomanip_setprecision (ios& i, int n) -{ - i.precision(n); - return i; -} -ios & __iomanip_setw (ios& i, int n) -{ - i.width(n); - return i; -} - -ios & __iomanip_setiosflags (ios& i, ios::fmtflags n) -{ - i.setf(n,n); - return i; -} - -ios & __iomanip_resetiosflags (ios& i, ios::fmtflags n) -{ - i.setf(0,n); - return i; -} - -template class smanip; -template class smanip; -template istream& operator>>(istream&, const smanip&); -template istream& operator>>(istream&, const smanip&); -template ostream& operator<<(ostream&, const smanip&); -template ostream& operator<<(ostream&, const smanip&); diff --git a/contrib/libio/iomanip.h b/contrib/libio/iomanip.h deleted file mode 100644 index 7c0232ed1e..0000000000 --- a/contrib/libio/iomanip.h +++ /dev/null @@ -1,180 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#ifndef _IOMANIP_H -#ifdef __GNUG__ -#pragma interface -#endif -#define _IOMANIP_H - -#include - -extern "C++" { -//----------------------------------------------------------------------------- -// Parametrized Manipulators as specified by ANSI draft -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// Stream Manipulators -//----------------------------------------------------------------------------- -// -template class smanip; // TP = Type Param - -template class sapp { - ios& (*_f)(ios&, TP); -public: - sapp(ios& (*f)(ios&, TP)) : _f(f) {} - // - smanip operator()(TP a) - { return smanip(_f, a); } -}; - -template -inline istream& operator>>(istream& i, const smanip& m); -template -inline ostream& operator<<(ostream& o, const smanip& m); - -template class smanip { - ios& (*_f)(ios&, TP); - TP _a; -public: - smanip(ios& (*f)(ios&, TP), TP a) : _f(f), _a(a) {} - // - friend - istream& operator>> <>(istream& i, const smanip& m); - friend - ostream& operator<< <>(ostream& o, const smanip& m); -}; - -#ifdef __GNUG__ -__extension__ extern template class smanip; -__extension__ extern template class smanip; -#endif - -template -inline istream& operator>>(istream& i, const smanip& m) -{ (*m._f)(i, m._a); return i; } - -template -inline ostream& operator<<(ostream& o, const smanip& m) -{ (*m._f)(o, m._a); return o;} - -#ifdef __GNUG__ -__extension__ extern -template istream& operator>>(istream&, const smanip&); -__extension__ extern -template istream& operator>>(istream&, const smanip&); -__extension__ extern -template ostream& operator<<(ostream&, const smanip&); -__extension__ extern -template ostream& operator<<(ostream&, const smanip&); -#endif - -//----------------------------------------------------------------------------- -// Input-Stream Manipulators -//----------------------------------------------------------------------------- -// -template class imanip; - -template class iapp { - istream& (*_f)(istream&, TP); -public: - iapp(istream& (*f)(istream&,TP)) : _f(f) {} - // - imanip operator()(TP a) - { return imanip(_f, a); } -}; - -template -inline istream& operator>>(istream&, const imanip&); - -template class imanip { - istream& (*_f)(istream&, TP); - TP _a; -public: - imanip(istream& (*f)(istream&, TP), TP a) : _f(f), _a(a) {} - // - friend - istream& operator>> <>(istream& i, const imanip& m); -}; - -template -inline istream& operator>>(istream& i, const imanip& m) -{ return (*m._f)( i, m._a); } - -//----------------------------------------------------------------------------- -// Output-Stream Manipulators -//----------------------------------------------------------------------------- -// -template class omanip; - -template class oapp { - ostream& (*_f)(ostream&, TP); -public: - oapp(ostream& (*f)(ostream&,TP)) : _f(f) {} - // - omanip operator()(TP a) - { return omanip(_f, a); } -}; - -template -inline ostream& operator<<(ostream&, const omanip&); - -template class omanip { - ostream& (*_f)(ostream&, TP); - TP _a; -public: - omanip(ostream& (*f)(ostream&, TP), TP a) : _f(f), _a(a) {} - // - friend - ostream& operator<< <>(ostream& o, const omanip& m); -}; - -template -inline ostream& operator<<(ostream& o, const omanip& m) -{ return (*m._f)(o, m._a); } - -//----------------------------------------------------------------------------- -// Available Manipulators -//----------------------------------------------------------------------------- - -// -// Macro to define an iomanip function, with one argument -// The underlying function is `__iomanip_' -// -#define __DEFINE_IOMANIP_FN1(type,param,function) \ - extern ios& __iomanip_##function (ios&, param); \ - inline type function (param n) \ - { return type (__iomanip_##function, n); } - -__DEFINE_IOMANIP_FN1( smanip, int, setbase) -__DEFINE_IOMANIP_FN1( smanip, int, setfill) -__DEFINE_IOMANIP_FN1( smanip, int, setprecision) -__DEFINE_IOMANIP_FN1( smanip, int, setw) - -__DEFINE_IOMANIP_FN1( smanip, ios::fmtflags, resetiosflags) -__DEFINE_IOMANIP_FN1( smanip, ios::fmtflags, setiosflags) -} // extern "C++" - -#endif /*!_IOMANIP_H*/ diff --git a/contrib/libio/iopadn.c b/contrib/libio/iopadn.c deleted file mode 100644 index 087715b349..0000000000 --- a/contrib/libio/iopadn.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. - This file is part of the GNU IO Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - - As a special exception, if you link this library with files - compiled with a GNU compiler to produce an executable, this does - not cause the resulting executable to be covered by the GNU General - Public License. This exception does not however invalidate any - other reasons why the executable file might be covered by the GNU - General Public License. */ - -#include "libioP.h" - -#define PADSIZE 16 -static char const blanks[PADSIZE] = -{' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '}; -static char const zeroes[PADSIZE] = -{'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'}; - -_IO_ssize_t -_IO_padn (fp, pad, count) - _IO_FILE *fp; - int pad; - _IO_ssize_t count; -{ - char padbuf[PADSIZE]; - const char *padptr; - int i; - _IO_size_t written = 0; - _IO_size_t w; - - if (pad == ' ') - padptr = blanks; - else if (pad == '0') - padptr = zeroes; - else - { - for (i = PADSIZE; --i >= 0; ) - padbuf[i] = pad; - padptr = padbuf; - } - for (i = count; i >= PADSIZE; i -= PADSIZE) - { - w = _IO_sputn (fp, padptr, PADSIZE); - written += w; - if (w != PADSIZE) - return written; - } - - if (i > 0) - { - w = _IO_sputn (fp, padptr, i); - written += w; - } - return written; -} diff --git a/contrib/libio/ioperror.c b/contrib/libio/ioperror.c deleted file mode 100644 index 7ca72b0bb6..0000000000 --- a/contrib/libio/ioperror.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "libioP.h" -#include -#include -#ifndef errno -extern int errno; -#endif - -#ifndef _IO_strerror -extern char* _IO_strerror __P((int)); -#endif - -void -_IO_perror (s) - const char *s; -{ - char *error = _IO_strerror (errno); - - if (s != NULL && *s != '\0') - _IO_fprintf (_IO_stderr, "%s:", s); - - _IO_fprintf (_IO_stderr, "%s\n", error ? error : ""); -} diff --git a/contrib/libio/iopopen.c b/contrib/libio/iopopen.c deleted file mode 100644 index 58f97495c1..0000000000 --- a/contrib/libio/iopopen.c +++ /dev/null @@ -1,248 +0,0 @@ -/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. - This file is part of the GNU IO Library. - Written by Per Bothner . - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the 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" -#if _IO_HAVE_SYS_WAIT -#include -#include -#ifdef __STDC__ -#include -#endif -#ifdef _LIBC -# include -#endif -#include -#include - -#ifndef _IO_fork -#define _IO_fork vfork /* defined in libiberty, if needed */ -extern _IO_pid_t _IO_fork __P ((void)); -#endif - -#endif /* _IO_HAVE_SYS_WAIT */ - -#ifndef _IO_pipe -#define _IO_pipe pipe -extern int _IO_pipe __P ((int des[2])); -#endif - -#ifndef _IO_dup2 -#define _IO_dup2 dup2 -extern int _IO_dup2 __P ((int fd, int fd2)); -#endif - -#ifndef _IO_waitpid -#define _IO_waitpid waitpid -#endif - -#ifndef _IO_execl -#define _IO_execl execl -#endif -#ifndef _IO__exit -#define _IO__exit _exit -#endif - -#ifndef _IO_close -#define _IO_close close -#endif - -struct _IO_proc_file -{ - struct _IO_FILE_plus file; - /* Following fields must match those in class procbuf (procbuf.h) */ - _IO_pid_t pid; - struct _IO_proc_file *next; -}; -typedef struct _IO_proc_file _IO_proc_file; - -static struct _IO_proc_file *proc_file_chain = NULL; - -_IO_FILE * -_IO_proc_open (fp, command, mode) - _IO_FILE *fp; - const char *command; - const char *mode; -{ -#if _IO_HAVE_SYS_WAIT - volatile int read_or_write; - volatile int parent_end, child_end; - int pipe_fds[2]; - _IO_pid_t child_pid; - if (_IO_file_is_open (fp)) - return NULL; - if (_IO_pipe (pipe_fds) < 0) - return NULL; - if (mode[0] == 'r') - { - parent_end = pipe_fds[0]; - child_end = pipe_fds[1]; - read_or_write = _IO_NO_WRITES; - } - else - { - parent_end = pipe_fds[1]; - child_end = pipe_fds[0]; - read_or_write = _IO_NO_READS; - } - ((_IO_proc_file *) fp)->pid = child_pid = _IO_fork (); - if (child_pid == 0) - { - int child_std_end = mode[0] == 'r' ? 1 : 0; - _IO_close (parent_end); - if (child_end != child_std_end) - { - _IO_dup2 (child_end, child_std_end); - _IO_close (child_end); - } - /* POSIX.2: "popen() shall ensure that any streams from previous - popen() calls that remain open in the parent process are closed - in the new child process." */ - while (proc_file_chain) - { - _IO_close (_IO_fileno ((_IO_FILE *) proc_file_chain)); - proc_file_chain = proc_file_chain->next; - } - - _IO_execl ("/bin/sh", "sh", "-c", command, (char *) 0); - _IO__exit (127); - } - _IO_close (child_end); - if (child_pid < 0) - { - _IO_close (parent_end); - return NULL; - } - _IO_fileno (fp) = parent_end; - - /* Link into proc_file_chain. */ - ((_IO_proc_file *) fp)->next = proc_file_chain; - proc_file_chain = (_IO_proc_file *) fp; - - _IO_mask_flags (fp, read_or_write, _IO_NO_READS|_IO_NO_WRITES); - return fp; -#else /* !_IO_HAVE_SYS_WAIT */ - return NULL; -#endif -} - -_IO_FILE * -_IO_popen (command, mode) - const char *command; - const char *mode; -{ - struct locked_FILE - { - struct _IO_proc_file fpx; -#ifdef _IO_MTSAFE_IO - _IO_lock_t lock; -#endif - } *new_f; - _IO_FILE *fp; - - new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE)); - if (new_f == NULL) - return NULL; -#ifdef _IO_MTSAFE_IO - new_f->fpx.file.file._lock = &new_f->lock; -#endif - fp = (_IO_FILE*)&new_f->fpx; - _IO_init (fp, 0); - _IO_JUMPS (fp) = &_IO_proc_jumps; - _IO_file_init (fp); -#if !_IO_UNIFIED_JUMPTABLES - ((struct _IO_FILE_plus *) fp)->vtable = NULL; -#endif - if (_IO_proc_open (fp, command, mode) != NULL) - return fp; - free (new_f); - return NULL; -} - -#ifdef strong_alias -strong_alias (_IO_popen, popen); -#endif - -int -_IO_proc_close (fp) - _IO_FILE *fp; -{ - /* This is not name-space clean. FIXME! */ -#if _IO_HAVE_SYS_WAIT - int wstatus; - _IO_proc_file **ptr = &proc_file_chain; - _IO_pid_t wait_pid; - int status = -1; - - /* Unlink from proc_file_chain. */ - for ( ; *ptr != NULL; ptr = &(*ptr)->next) - { - if (*ptr == (_IO_proc_file *) fp) - { - *ptr = (*ptr)->next; - status = 0; - break; - } - } - - if (status < 0 || _IO_close (_IO_fileno(fp)) < 0) - return -1; - /* POSIX.2 Rationale: "Some historical implementations either block - or ignore the signals SIGINT, SIGQUIT, and SIGHUP while waiting - for the child process to terminate. Since this behavior is not - described in POSIX.2, such implementations are not conforming." */ - do - { - wait_pid = _IO_waitpid (((_IO_proc_file *) fp)->pid, &wstatus, 0); - } - while (wait_pid == -1 && errno == EINTR); - if (wait_pid == -1) - return -1; - return wstatus; -#else /* !_IO_HAVE_SYS_WAIT */ - return -1; -#endif -} - -struct _IO_jump_t _IO_proc_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_proc_close), - JUMP_INIT(stat, _IO_file_stat) -}; diff --git a/contrib/libio/ioprims.c b/contrib/libio/ioprims.c deleted file mode 100644 index e3e0d7e75c..0000000000 --- a/contrib/libio/ioprims.c +++ /dev/null @@ -1,80 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* I/O OS-level primitives. - Needs to be replaced if not using Unix. - Also needs to be replaced if avoiding name-space pollution - (in which case read would be defined in terms of _IO_read, - rather than vice versa). */ - -#include "libioP.h" -#include -#include -#include - -#ifdef TODO -/* Add open, isatty */ -#endif - -_IO_ssize_t -_IO_read (fildes, buf, nbyte) - int fildes; - void *buf; - _IO_size_t nbyte; -{ - return read (fildes, buf, nbyte); -} - -_IO_ssize_t -_IO_write (fildes, buf, nbyte) - int fildes; - const void *buf; - _IO_size_t nbyte; -{ - return write (fildes, buf, nbyte); -} - -_IO_off_t -_IO_lseek (fildes, offset, whence) - int fildes; - _IO_off_t offset; - int whence; -{ - return lseek (fildes, offset, whence); -} - -int -_IO_close (fildes) - int fildes; -{ - return close (fildes); -} - -int -_IO_fstat (fildes, buf) - int fildes; - struct stat *buf; -{ - return fstat (fildes, buf); -} diff --git a/contrib/libio/ioprintf.c b/contrib/libio/ioprintf.c deleted file mode 100644 index 0b99c2a663..0000000000 --- a/contrib/libio/ioprintf.c +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" - -#ifdef __STDC__ -#include -#else -#include -#endif - -int -_IO_printf -#ifdef __STDC__ - (const char* format, ...) -#else -(format, va_alist) char *format; va_dcl -#endif -{ - int ret; - va_list args; - _IO_va_start(args, format); - ret = _IO_vfprintf(_IO_stdout, format, args); - va_end(args); - return ret; -} diff --git a/contrib/libio/ioputc.c b/contrib/libio/ioputc.c deleted file mode 100644 index 38a3ec9a00..0000000000 --- a/contrib/libio/ioputc.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 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. */ - -#include "libioP.h" -#include "stdio.h" - -#undef _IO_putc - -int -_IO_putc (c, fp) - int c; - _IO_FILE *fp; -{ - int result; - CHECK_FILE (fp, EOF); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - result = _IO_putc_unlocked (c, fp); - _IO_cleanup_region_end (1); - return result; -} - -#undef putc - -#ifdef weak_alias -weak_alias (_IO_putc, putc) -#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL) -int putc (int, _IO_FILE *) __attribute__ ((weak, alias("_IO_putc"))); -#endif diff --git a/contrib/libio/ioputs.c b/contrib/libio/ioputs.c deleted file mode 100644 index ab5e6aaa4c..0000000000 --- a/contrib/libio/ioputs.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "libioP.h" -#include - -int -_IO_puts (str) - const char *str; -{ - int result; - _IO_size_t len = strlen (str); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _IO_stdout); - _IO_flockfile (_IO_stdout); - if (_IO_sputn (_IO_stdout, str, len) == len - && _IO_putc_unlocked ('\n', _IO_stdout) != EOF) - result = len + 1; - else - result = EOF; - _IO_cleanup_region_end (1); - return result; -} - -#ifdef weak_alias -weak_alias (_IO_puts, puts) -#endif diff --git a/contrib/libio/ioscanf.c b/contrib/libio/ioscanf.c deleted file mode 100644 index 405d1e2eb0..0000000000 --- a/contrib/libio/ioscanf.c +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" - -#ifdef __STDC__ -#include -#else -#include -#endif - -int -_IO_scanf -#ifdef __STDC__ - (const char* format, ...) -#else -(format, va_alist) char *format; va_dcl -#endif -{ - int ret; - va_list args; - _IO_va_start(args, format); - ret = _IO_vfscanf(_IO_stdin, format, args, NULL); - va_end(args); - return ret; -} diff --git a/contrib/libio/ioseekoff.c b/contrib/libio/ioseekoff.c deleted file mode 100644 index b1c4729b3d..0000000000 --- a/contrib/libio/ioseekoff.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. - This file is part of the GNU IO Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - - As a special exception, if you link this library with files - compiled with a GNU compiler to produce an executable, this does - not cause the resulting executable to be covered by the GNU General - Public License. This exception does not however invalidate any - other reasons why the executable file might be covered by the GNU - General Public License. */ - -#include - -_IO_pos_t -_IO_seekoff (fp, offset, dir, mode) - _IO_FILE *fp; - _IO_off_t offset; - int dir; - int mode; -{ - _IO_pos_t retval; - - /* If we have a backup buffer, get rid of it, since the __seekoff - callback may not know to do the right thing about it. - This may be over-kill, but it'll do for now. TODO */ - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - - - if (_IO_have_backup (fp)) - { - if (dir == _IO_seek_cur && _IO_in_backup (fp)) - offset -= fp->_IO_read_end - fp->_IO_read_ptr; - _IO_free_backup_area (fp); - } - retval = _IO_SEEKOFF (fp, offset, dir, mode); - - _IO_cleanup_region_end (1); - return retval; -} diff --git a/contrib/libio/ioseekpos.c b/contrib/libio/ioseekpos.c deleted file mode 100644 index 2ce0c2224e..0000000000 --- a/contrib/libio/ioseekpos.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. - This file is part of the GNU IO Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - - As a special exception, if you link this library with files - compiled with a GNU compiler to produce an executable, this does - not cause the resulting executable to be covered by the GNU General - Public License. This exception does not however invalidate any - other reasons why the executable file might be covered by the GNU - General Public License. */ - -#include - -_IO_pos_t -_IO_seekpos (fp, pos, mode) - _IO_FILE *fp; - _IO_pos_t pos; - int mode; -{ - _IO_pos_t retval; - - /* If we have a backup buffer, get rid of it, since the __seekoff - callback may not know to do the right thing about it. - This may be over-kill, but it'll do for now. TODO */ - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - - if (_IO_have_backup (fp)) - _IO_free_backup_area (fp); - retval = _IO_SEEKPOS (fp, pos, mode); - - _IO_cleanup_region_end (1); - return retval; -} diff --git a/contrib/libio/iosetbuffer.c b/contrib/libio/iosetbuffer.c deleted file mode 100644 index f140a9ad04..0000000000 --- a/contrib/libio/iosetbuffer.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" - -void -_IO_setbuffer (fp, buf, size) - _IO_FILE *fp; - char *buf; - _IO_size_t size; -{ - CHECK_FILE (fp, ); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - fp->_flags &= ~_IO_LINE_BUF; - if (!buf) - size = 0; - (void) _IO_SETBUF (fp, buf, size); - _IO_cleanup_region_end (1); -} - -#ifdef weak_alias -weak_alias (_IO_setbuffer, setbuffer) -#endif diff --git a/contrib/libio/iosetvbuf.c b/contrib/libio/iosetvbuf.c deleted file mode 100644 index 65eeea51a6..0000000000 --- a/contrib/libio/iosetvbuf.c +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "libioP.h" - -#define _IOFBF 0 /* Fully buffered. */ -#define _IOLBF 1 /* Line buffered. */ -#define _IONBF 2 /* No buffering. */ - -int -_IO_setvbuf (fp, buf, mode, size) - _IO_FILE *fp; - char *buf; - int mode; - _IO_size_t size; -{ - int result; - CHECK_FILE (fp, EOF); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - switch (mode) - { - case _IOFBF: - fp->_IO_file_flags &= ~_IO_LINE_BUF|_IO_UNBUFFERED; - if (buf == NULL) - { - if (fp->_IO_buf_base == NULL) - { - /* There is no flag to distinguish between "fully buffered - mode has been explicitly set" as opposed to "line - buffering has not been explicitly set". In both - cases, _IO_LINE_BUF is off. If this is a tty, and - _IO_filedoalloc later gets called, it cannot know if - it should set the _IO_LINE_BUF flag (because that is - the default), or not (because we have explicitly asked - for fully buffered mode). So we make sure a buffer - gets allocated now, and explicitly turn off line - buffering. - - A possibly cleaner alternative would be to add an - extra flag, but then flags are a finite resource. */ - if (_IO_DOALLOCATE (fp) < 0) - { - result = EOF; - goto unlock_return; - } - fp->_IO_file_flags &= ~_IO_LINE_BUF; - } - result = 0; - goto unlock_return; - } - break; - case _IOLBF: - fp->_IO_file_flags &= ~_IO_UNBUFFERED; - fp->_IO_file_flags |= _IO_LINE_BUF; - if (buf == NULL) - { - result = 0; - goto unlock_return; - } - break; - case _IONBF: - buf = NULL; - size = 0; - break; - default: - result = EOF; - goto unlock_return; - } - result = _IO_SETBUF (fp, buf, size) == NULL ? EOF : 0; -unlock_return: - _IO_cleanup_region_end (1); - return result; -} - -#ifdef weak_alias -weak_alias (_IO_setvbuf, setvbuf) -#endif diff --git a/contrib/libio/iosprintf.c b/contrib/libio/iosprintf.c deleted file mode 100644 index 704a6dbd72..0000000000 --- a/contrib/libio/iosprintf.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. - This file is part of the GNU IO Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - - As a special exception, if you link this library with files - compiled with a GNU compiler to produce an executable, this does - not cause the resulting executable to be covered by the GNU General - Public License. This exception does not however invalidate any - other reasons why the executable file might be covered by the GNU - General Public License. */ - -#include "libioP.h" - -#ifdef __STDC__ -#include -#else -#include -#endif - -int -#ifdef __STDC__ -_IO_sprintf (char *string, const char* format, ...) -#else -_IO_sprintf (string, format, va_alist) - char *string; - char *format; - va_dcl -#endif -{ - int ret; - va_list args; - _IO_va_start (args, format); - ret = _IO_vsprintf (string, format, args); - va_end (args); - return ret; -} diff --git a/contrib/libio/iosscanf.c b/contrib/libio/iosscanf.c deleted file mode 100644 index 58868778c4..0000000000 --- a/contrib/libio/iosscanf.c +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" - -#ifdef __STDC__ -#include -#else -#include -#endif - -int -_IO_sscanf -#ifdef __STDC__ - (const char * string, const char* format, ...) -#else -(string, format, va_alist) char *string; char *format; va_dcl -#endif -{ - int ret; - va_list args; - _IO_va_start(args, format); - ret = _IO_vsscanf(string, format, args); - va_end(args); - return ret; -} diff --git a/contrib/libio/iostdio.h b/contrib/libio/iostdio.h deleted file mode 100644 index 9ed47a4654..0000000000 --- a/contrib/libio/iostdio.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* This file defines a stdio-like environment, except that it avoid - link-time name clashes with an existing stdio. - It allows for testing the libio using stdio-using programs - with an incompatible libc.a. - It is not predantically correct - e.g. some macros are used - that may evaluate a stream argument more than once. */ - -#ifndef _IOSTDIO_H -#define _IOSTDIO_H - -#include "iolibio.h" - -typedef _IO_FILE FILE; -#ifndef EOF -#define EOF (-1) -#endif -#ifndef BUFSIZ -#define BUFSIZ 1024 -#endif - -/* #define size_t, fpos_t L_tmpname TMP_MAX */ - -#define _IOFBF 0 /* Fully buffered. */ -#define _IOLBF 1 /* Line buffered. */ -#define _IONBF 2 /* No buffering. */ - -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 - -#define stdin _IO_stdin -#define stdout _IO_stdout -#define stderr _IO_stderr - -#define getc(_fp) _IO_getc(_fp) -#define putc(_ch, _fp) _IO_putc(_ch, _fp) - -#define clearerr _IO_clearerr -#define fclose _IO_fclose -#define feof _IO_feof -#define ferror _IO_ferror -#define fflush _IO_fflush -#define fgetc(__fp) _IO_getc(_fp) -#define fgetpos _IO_fgetpos -#define fgets _IO_fgets -#define fopen _IO_fopen -#define fprintf _IO_fprintf -#define fputc(_ch, _fp) _IO_putc(_ch, _fp) -#define fputs _IO_fputs -#define fread _IO_fread -#define freopen _IO_freopen -#define fscanf _IO_fscanf -#define fseek _IO_fseek -#define fsetpos _IO_fsetpos -#define ftell _IO_ftell -#define fwrite _IO_fwrite -#define gets _IO_gets -#define perror _IO_perror -#define printf _IO_printf -#define puts _IO_puts -#define rewind _IO_rewind -#define scanf _IO_scanf -#define setbuf _IO_setbuf -#define setbuffer _IO_setbuffer -#define setvbuf _IO_setvbuf -#define sprintf _IO_sprintf -#define sscanf _IO_sscanf -#define ungetc _IO_ungetc -#define vfprintf _IO_vfprintf -#define vprintf(__fmt, __args) vfprintf(stdout, __fmt, __args) -#define vsprintf _IO_vsprintf - -#if 0 -/* We can use the libc versions of these, since they don't pass FILE*s. */ -#define remove ??? __P((const char*)) -#define rename ??? __P((const char* _old, const char* _new)) -#define tmpfile ??? __P((void)) -#define tmpnam ??? __P((char*)) -#endif - -#if !defined(__STRICT_ANSI__) || defined(_POSIX_SOURCE) -#define fdopen _IO_fdopen -#define fileno _IO_fileno -#define popen _IO_popen -#define pclose _IO_pclose -#define setbuf _IO_setbuf -#define setlinebuf _IO_setlinebuf -#endif - -#endif /* _IOSTDIO_H */ diff --git a/contrib/libio/iostream.cc b/contrib/libio/iostream.cc deleted file mode 100644 index 792eaae6b4..0000000000 --- a/contrib/libio/iostream.cc +++ /dev/null @@ -1,1049 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. - Copyright (C) 1993, 1997, 2000 Free Software Foundation, Inc. - - This file is part of the GNU IO Library. This library is free - software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the - Free Software Foundation; either version 2, or (at your option) - any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, - USA. - - As a special exception, if you link this library with files - compiled with a GNU compiler to produce an executable, this does not cause - the resulting executable to be covered by the GNU General Public License. - This exception does not however invalidate any other reasons why - the executable file might be covered by the GNU General Public License. */ - -/* Written by Per Bothner (bothner@cygnus.com). */ - -#ifdef __GNUC__ -#pragma implementation -#endif -#define _STREAM_COMPAT -#include -#include "libioP.h" -#include /* Needed for sprintf */ -#include -#include -#include - -#if _G_HAVE_PRINTF_FP -#include -extern "C" int __printf_fp (_IO_FILE *, const struct printf_info *, - const void *const *); -#else -#include "floatio.h" -# ifndef _IO_USE_DTOA -int __cvt_double(double number, register int prec, int flags, int *signp, - int fmtch, char *startp, char *endp); -# endif -#endif - -#define BUF (MAXEXP+MAXFRACT+1) /* + decimal point */ - -//#define isspace(ch) ((ch)==' ' || (ch)=='\t' || (ch)=='\n') - -istream::istream(streambuf *sb, ostream* tied) -{ - init (sb, tied); - _gcount = 0; -} - -int skip_ws(streambuf* sb) -{ - int ch; - for (;;) { - ch = sb->sbumpc(); - if (ch == EOF || !isspace(ch)) - return ch; - } -} - -istream& istream::get(char& c) -{ - if (ipfx1()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - int ch = _strbuf->sbumpc(); - if (ch == EOF) { - set(ios::eofbit|ios::failbit); - _gcount = 0; - } - else { - c = (char)ch; - _gcount = 1; - } - isfx(); - _IO_cleanup_region_end (0); - } - else - _gcount = 0; - return *this; -} - -int istream::peek() -{ - if (!good()) - return EOF; - if (_tie && rdbuf()->in_avail() == 0) - _tie->flush(); - int ch = _strbuf->sgetc(); - if (ch == EOF) - set(ios::eofbit); - return ch; -} - -istream& istream::ignore(int n /* = 1 */, int delim /* = EOF */) -{ - _gcount = 0; - if (ipfx1()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - register streambuf* sb = _strbuf; - if (delim == EOF) { - _gcount = sb->ignore(n); - goto unlock; - } - for (;;) { -#if 0 - if (n != MAXINT) // FIXME -#endif - if (--n < 0) - break; - int ch = sb->sbumpc(); - if (ch == EOF) { - set(ios::eofbit|ios::failbit); - break; - } - _gcount++; - if (ch == delim) - break; - } - unlock: - isfx(); - _IO_cleanup_region_end (0); - } - return *this; -} - -istream& istream::read(char *s, streamsize n) -{ - if (ipfx1()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - _gcount = _strbuf->sgetn(s, n); - if (_gcount != n) - set(ios::failbit|ios::eofbit); - isfx(); - _IO_cleanup_region_end (0); - } - else - _gcount = 0; - return *this; -} - -int -istream::sync () -{ - streambuf *sb = rdbuf (); - if (sb == NULL) - return EOF; - if (sb->sync ()) // Later: pubsync - { - setstate (ios::badbit); - return EOF; - } - else - return 0; -} - -istream& istream::seekg(streampos pos) -{ - pos = _strbuf->pubseekpos(pos, ios::in); - if (pos == streampos(EOF)) - set(ios::badbit); - return *this; -} - -istream& istream::seekg(streamoff off, _seek_dir dir) -{ - streampos pos = _IO_seekoff (_strbuf, off, (int) dir, _IOS_INPUT); - if (pos == streampos(EOF)) - set(ios::badbit); - return *this; -} - -streampos istream::tellg() -{ -#if 0 - streampos pos = _strbuf->pubseekoff(0, ios::cur, ios::in); -#else - streampos pos = _IO_seekoff (_strbuf, 0, _IO_seek_cur, _IOS_INPUT); -#endif - if (pos == streampos(EOF)) - set(ios::badbit); - return pos; -} - -istream& istream::operator>>(char& c) -{ - if (ipfx0()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - int ch = _strbuf->sbumpc(); - if (ch == EOF) - set(ios::eofbit|ios::failbit); - else - c = (char)ch; - isfx(); - _IO_cleanup_region_end (0); - } - return *this; -} - -istream& -istream::operator>> (char* ptr) -{ - register char *p = ptr; - int w = width(0); - if (ipfx0()) - { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - register streambuf* sb = _strbuf; - for (;;) - { - int ch = sb->sbumpc(); - if (ch == EOF) - { - set(ios::eofbit); - break; - } - else if (isspace(ch) || w == 1) - { - sb->sputbackc(ch); - break; - } - else *p++ = ch; - w--; - } - if (p == ptr) - set(ios::failbit); - isfx(); - _IO_cleanup_region_end (0); - } - *p = '\0'; - return *this; -} - -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) -#define LONGEST long long -#else -#define LONGEST long -#endif - -static int read_int(istream& stream, unsigned LONGEST& val, int& neg) -{ - if (!stream.ipfx0()) - return 0; - int retval; - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - stream._strbuf); - register streambuf* sb = stream.rdbuf(); - int base = 10; - int ndigits = 0; - register int ch = skip_ws(sb); - if (ch == EOF) - goto eof_fail; - neg = 0; - if (ch == '+') { - ch = skip_ws(sb); - } - else if (ch == '-') { - neg = 1; - ch = skip_ws(sb); - } - if (ch == EOF) goto eof_fail; - if (!(stream.flags() & ios::basefield)) { - if (ch == '0') { - ch = sb->sbumpc(); - if (ch == EOF) { - val = 0; - goto unlock; - } - if (ch == 'x' || ch == 'X') { - base = 16; - ch = sb->sbumpc(); - if (ch == EOF) goto eof_fail; - } - else { - sb->sputbackc(ch); - base = 8; - ch = '0'; - } - } - } - else if ((stream.flags() & ios::basefield) == ios::hex) - base = 16; - else if ((stream.flags() & ios::basefield) == ios::oct) - base = 8; - val = 0; - for (;;) { - if (ch == EOF) - break; - int digit; - if (ch >= '0' && ch <= '9') - digit = ch - '0'; - else if (ch >= 'A' && ch <= 'F') - digit = ch - 'A' + 10; - else if (ch >= 'a' && ch <= 'f') - digit = ch - 'a' + 10; - else - digit = 999; - if (digit >= base) { - sb->sputbackc(ch); - if (ndigits == 0) - goto fail; - else - goto unlock; - } - ndigits++; - val = base * val + digit; - ch = sb->sbumpc(); - } - unlock: - retval = 1; - goto out; - fail: - stream.set(ios::failbit); - retval = 0; - goto out; - eof_fail: - stream.set(ios::failbit|ios::eofbit); - retval = 0; - out: - stream.isfx(); - _IO_cleanup_region_end (0); - return retval; -} - -#define READ_INT(TYPE) \ -istream& istream::operator>>(TYPE& i)\ -{\ - unsigned LONGEST val; int neg;\ - if (read_int(*this, val, neg)) {\ - if (neg) val = -val;\ - i = (TYPE)val;\ - }\ - return *this;\ -} - -READ_INT(short) -READ_INT(unsigned short) -READ_INT(int) -READ_INT(unsigned int) -READ_INT(long) -READ_INT(unsigned long) -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) -READ_INT(long long) -READ_INT(unsigned long long) -#endif -#if _G_HAVE_BOOL -READ_INT(bool) -#endif - -istream& istream::operator>>(long double& x) -{ - if (ipfx0()) - { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); -#if _G_HAVE_LONG_DOUBLE_IO - scan("%Lg", &x); -#else - double y; - scan("%lg", &y); - x = y; -#endif - isfx(); - _IO_cleanup_region_end (0); - } - return *this; -} - -istream& istream::operator>>(double& x) -{ - if (ipfx0()) - { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - scan("%lg", &x); - isfx(); - _IO_cleanup_region_end (0); - } - return *this; -} - -istream& istream::operator>>(float& x) -{ - if (ipfx0()) - { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - scan("%g", &x); - isfx(); - _IO_cleanup_region_end (0); - } - return *this; -} - -istream& istream::operator>>(register streambuf* sbuf) -{ - if (ipfx0()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - register streambuf* inbuf = rdbuf(); - // FIXME: Should optimize! - for (;;) { - register int ch = inbuf->sbumpc(); - if (ch == EOF) { - set(ios::eofbit); - break; - } - if (sbuf->sputc(ch) == EOF) { - set(ios::failbit); - break; - } - } - isfx(); - _IO_cleanup_region_end (0); - } - return *this; -} - -ostream& ostream::operator<<(char c) -{ - if (opfx()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); -#if 1 - // This is what the cfront implementation does. - if (_strbuf->sputc(c) == EOF) { - set(ios::badbit); - goto failed; - } -#else - // This is what cfront documentation and current ANSI drafts say. - int w = width(0); - char fill_char = fill(); - register int padding = w > 0 ? w - 1 : 0; - register streambuf *sb = _strbuf; - if (!(flags() & ios::left) && padding) // Default adjustment. - if (_IO_padn(sb, fill_char, padding) < padding) { - set(ios::badbit); - goto failed; - } - if (sb->sputc(c) == EOF) { - set(ios::badbit); - goto failed; - } - if (flags() & ios::left && padding) // Left adjustment. - if (_IO_padn(sb, fill_char, padding) < padding) - set(ios::badbit); -#endif - failed: - osfx(); - _IO_cleanup_region_end (0); - } - return *this; -} - -/* Write VAL on STREAM. - If SIGN<0, val is the absolute value of a negative number. - If SIGN>0, val is a signed non-negative number. - If SIGN==0, val is unsigned. */ - -static void write_int(ostream& stream, unsigned LONGEST val, int sign) -{ -#define WRITE_BUF_SIZE (10 + sizeof(unsigned LONGEST) * 3) - char buf[WRITE_BUF_SIZE]; - register char *buf_ptr = buf+WRITE_BUF_SIZE; // End of buf. - const char *show_base = ""; - int show_base_len = 0; - int show_pos = 0; // If 1, print a '+'. - - // Now do the actual conversion, placing the result at the *end* of buf. - // Note that we use separate code for decimal, octal, and hex, - // so we can divide by optimizable constants. - if ((stream.flags() & ios::basefield) == ios::oct) { // Octal - do { - *--buf_ptr = (val & 7) + '0'; - val = val >> 3; - } while (val != 0); - if ((stream.flags() & ios::showbase) && (*buf_ptr != '0')) - *--buf_ptr = '0'; - } - else if ((stream.flags() & ios::basefield) == ios::hex) { // Hex - const char *xdigs = (stream.flags() & ios::uppercase) ? "0123456789ABCDEF0X" - : "0123456789abcdef0x"; - do { - *--buf_ptr = xdigs[val & 15]; - val = val >> 4; - } while (val != 0); - if ((stream.flags() & ios::showbase)) { - show_base = xdigs + 16; // Either "0X" or "0x". - show_base_len = 2; - } - } - else { // Decimal -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) - // Optimization: Only use long long when we need to. - while (val > UINT_MAX) { - *--buf_ptr = (val % 10) + '0'; - val /= 10; - } - // Use more efficient (int) arithmetic for the rest. - register unsigned int ival = (unsigned int)val; -#else - register unsigned LONGEST ival = val; -#endif - do { - *--buf_ptr = (ival % 10) + '0'; - ival /= 10; - } while (ival != 0); - if (sign > 0 && (stream.flags() & ios::showpos)) - show_pos=1; - } - - int buf_len = buf+WRITE_BUF_SIZE - buf_ptr; - int w = stream.width(0); - - // Calculate padding. - int len = buf_len+show_pos; - if (sign < 0) len++; - len += show_base_len; - int padding = len > w ? 0 : w - len; - - // Do actual output. - register streambuf* sbuf = stream.rdbuf(); - ios::fmtflags pad_kind = - stream.flags() & (ios::left|ios::right|ios::internal); - char fill_char = stream.fill(); - if (padding > 0 - && pad_kind != (ios::fmtflags)ios::left - && pad_kind != (ios::fmtflags)ios::internal) // Default (right) adjust. - if (_IO_padn(sbuf, fill_char, padding) < padding) - goto failed; - if (sign < 0 || show_pos) - { - char ch = sign < 0 ? '-' : '+'; - if (sbuf->sputc(ch) < 0) - goto failed; - } - if (show_base_len) - if (_IO_sputn(sbuf, show_base, show_base_len) <= 0) - goto failed; - if (pad_kind == (ios::fmtflags)ios::internal && padding > 0) - if (_IO_padn(sbuf, fill_char, padding) < padding) - goto failed; - if (_IO_sputn (sbuf, buf_ptr, buf_len) != buf_len) - goto failed; - if (pad_kind == (ios::fmtflags)ios::left && padding > 0) // Left adjustment - if (_IO_padn(sbuf, fill_char, padding) < padding) - goto failed; - stream.osfx(); - return; - failed: - stream.set(ios::badbit); - stream.osfx(); -} - -ostream& ostream::operator<<(int n) -{ - if (opfx()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - int sign = 1; - unsigned int abs_n = (unsigned)n; - if (n < 0 && (flags() & (ios::oct|ios::hex)) == 0) - abs_n = -((unsigned)n), sign = -1; - write_int(*this, abs_n, sign); - _IO_cleanup_region_end (0); - } - return *this; -} - -ostream& ostream::operator<<(unsigned int n) -{ - if (opfx()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - write_int(*this, n, 0); - _IO_cleanup_region_end (0); - } - return *this; -} - - -ostream& ostream::operator<<(long n) -{ - if (opfx()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - int sign = 1; - unsigned long abs_n = (unsigned long)n; - if (n < 0 && (flags() & (ios::oct|ios::hex)) == 0) - abs_n = -((unsigned long)n), sign = -1; - write_int(*this, abs_n, sign); - _IO_cleanup_region_end (0); - } - return *this; -} - -ostream& ostream::operator<<(unsigned long n) -{ - if (opfx()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - write_int(*this, n, 0); - _IO_cleanup_region_end (0); - } - return *this; -} - -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) -ostream& ostream::operator<<(long long n) -{ - if (opfx()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - int sign = 1; - unsigned long long abs_n = (unsigned long long)n; - if (n < 0 && (flags() & (ios::oct|ios::hex)) == 0) - abs_n = -((unsigned long long)n), sign = -1; - write_int(*this, abs_n, sign); - _IO_cleanup_region_end (0); - } - return *this; -} - - -ostream& ostream::operator<<(unsigned long long n) -{ - if (opfx()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - write_int(*this, n, 0); - _IO_cleanup_region_end (0); - } - return *this; -} -#endif /*__GNUC__*/ - -ostream& ostream::operator<<(double n) -{ - if (opfx()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - // Uses __cvt_double (renamed from static cvt), in Chris Torek's - // stdio implementation. The setup code uses the same logic - // as in __vsbprintf.C (also based on Torek's code). - int format_char; - if ((flags() & ios::floatfield) == ios::fixed) - format_char = 'f'; - else if ((flags() & ios::floatfield) == ios::scientific) - format_char = flags() & ios::uppercase ? 'E' : 'e'; - else - format_char = flags() & ios::uppercase ? 'G' : 'g'; - - int prec = precision(); - if (prec <= 0 && !(flags() & ios::fixed)) - prec = 6; /* default */ - - // Do actual conversion. -#if _G_HAVE_PRINTF_FP - { - struct printf_info info = { /* prec: */ prec, - /* width: */ width(0), - /* spec: */ format_char, - /* is_long_double: */ 0, - /* is_short: */ 0, - /* is_long: */ 0, - /* alt: */ (flags() & ios::showpoint) != 0, - /* space: */ 0, - /* left: */ (flags() & ios::left) != 0, - /* showsign: */ (flags() & ios::showpos) != 0, - /* group: */ 0, -#if defined __GLIBC__ && __GLIBC__ >= 2 - /* extra: */ 0, -#if __GLIBC_MINOR__ >= 1 - /* is_char: */ 0, -#if __GLIBC_MINOR__ >= 2 - /* wide: */ 0, - /* i18n: */ 0, -#endif -#endif -#endif - /* pad: */ fill() - }; - const void *ptr = (const void *) &n; - if (__printf_fp (rdbuf(), &info, &ptr) < 0) - set(ios::badbit|ios::failbit); - } -#elif defined _IO_USE_DTOA - if (_IO_outfloat(n, rdbuf(), format_char, width(0), - prec, flags(), - flags() & ios::showpos ? '+' : 0, - fill()) < 0) - set(ios::badbit|ios::failbit); // ?? -#else - int fpprec = 0; // 'Extra' (suppressed) floating precision. - if (prec > MAXFRACT) { - if (flags() & (ios::fixed|ios::scientific) & ios::showpos) - fpprec = prec - MAXFRACT; - prec = MAXFRACT; - } - int negative; - char buf[BUF]; - int sign = '\0'; - char *cp = buf; - *cp = 0; - int size = __cvt_double(n, prec, - flags() & ios::showpoint ? 0x80 : 0, - &negative, - format_char, cp, buf + sizeof(buf)); - if (negative) sign = '-'; - else if (flags() & ios::showpos) sign = '+'; - if (*cp == 0) - cp++; - - // Calculate padding. - int fieldsize = size + fpprec; - if (sign) fieldsize++; - int padding = 0; - int w = width(0); - if (fieldsize < w) - padding = w - fieldsize; - - // Do actual output. - register streambuf* sbuf = rdbuf(); - register i; - char fill_char = fill(); - ios::fmtflags pad_kind = - flags() & (ios::left|ios::right|ios::internal); - if (pad_kind != (ios::fmtflags)ios::left // Default (right) adjust. - && pad_kind != (ios::fmtflags)ios::internal) - for (i = padding; --i >= 0; ) sbuf->sputc(fill_char); - if (sign) - sbuf->sputc(sign); - if (pad_kind == (ios::fmtflags)ios::internal) - for (i = padding; --i >= 0; ) sbuf->sputc(fill_char); - - // Emit the actual concented field, followed by extra zeros. - _IO_sputn (sbuf, cp, size); - for (i = fpprec; --i >= 0; ) sbuf->sputc('0'); - - if (pad_kind == (ios::fmtflags)ios::left) // Left adjustment - for (i = padding; --i >= 0; ) sbuf->sputc(fill_char); -#endif - osfx(); - _IO_cleanup_region_end (0); - } - return *this; -} - -#if _G_HAVE_LONG_DOUBLE_IO -ostream& ostream::operator<<(long double n) -{ - if (opfx()) - { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - int format_char; - if ((flags() & ios::floatfield) == ios::fixed) - format_char = 'f'; - else if ((flags() & ios::floatfield) == ios::scientific) - format_char = flags() & ios::uppercase ? 'E' : 'e'; - else - format_char = flags() & ios::uppercase ? 'G' : 'g'; - - int prec = precision(); - if (prec <= 0 && !(flags() & ios::fixed)) - prec = 6; /* default */ - -#if _G_HAVE_PRINTF_FP - // Do actual conversion. - struct printf_info info = { /* prec: */ prec, - /* width: */ width(0), - /* spec: */ format_char, - /* is_long_double: */ 1, - /* is_short: */ 0, - /* is_long: */ 0, - /* alt: */ (flags() & ios::showpoint) != 0, - /* space: */ 0, - /* left: */ (flags() & ios::left) != 0, - /* showsign: */ (flags() & ios::showpos) != 0, - /* group: */ 0, -#if defined __GLIBC__ && __GLIBC__ >= 2 - /* extra: */ 0, -#if __GLIBC_MINOR__ >= 1 - /* is_char: */ 0, -#if __GLIBC_MINOR__ >= 2 - /* wide: */ 0, - /* i18n: */ 0, -#endif -#endif -#endif - /* pad: */ fill() - }; - - const void *ptr = (const void *) &n; - - if (__printf_fp (rdbuf(), &info, &ptr) < 0) - set (ios::badbit|ios::failbit); -#else -# error "long double I/O using dtoa or cvt_double is not implemented" -#endif - osfx(); - _IO_cleanup_region_end (0); - } - return *this; -} -#endif - -ostream& ostream::operator<<(const char *s) -{ - if (opfx()) - { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - if (s == NULL) - s = "(null)"; - int len = strlen(s); - int w = width(0); -// FIXME: Should we: if (w && len>w) len = w; - char fill_char = fill(); - register streambuf *sbuf = rdbuf(); - register int padding = w > len ? w - len : 0; - if (!(flags() & ios::left) && padding > 0) // Default adjustment. - if (_IO_padn(sbuf, fill_char, padding) != padding) - { - set(ios::badbit); - goto failed; - } - if (_IO_sputn (sbuf, s, len) != len) - { - set(ios::badbit); - goto failed; - } - if (flags() & ios::left && padding > 0) // Left adjustment. - if (_IO_padn(sbuf, fill_char, padding) != padding) - set(ios::badbit); - failed: - osfx(); - _IO_cleanup_region_end (0); - } - return *this; -} - -#if 0 -ostream& ostream::operator<<(const void *p) -{ Is in osform.cc, to avoid pulling in all of _IO_vfprintf by this file. */ } -#endif - -ostream& ostream::operator<<(register streambuf* sbuf) -{ - if (opfx()) - { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - char buffer[_IO_BUFSIZ]; - register streambuf* outbuf = _strbuf; - for (;;) - { - _IO_size_t count = _IO_sgetn(sbuf, buffer, _IO_BUFSIZ); - if (count <= 0) - break; - if (_IO_sputn(outbuf, buffer, count) != count) - { - set(ios::badbit); - break; - } - } - osfx(); - _IO_cleanup_region_end (0); - } - return *this; -} - -ostream::ostream(streambuf* sb, ostream* tied) -{ - init (sb, tied); -} - -ostream& ostream::seekp(streampos pos) -{ - pos = _strbuf->pubseekpos(pos, ios::out); - if (pos == streampos(EOF)) - set(ios::badbit); - return *this; -} - -ostream& ostream::seekp(streamoff off, _seek_dir dir) -{ - streampos pos = _IO_seekoff (_strbuf, off, (int) dir, _IOS_OUTPUT); - if (pos == streampos(EOF)) - set(ios::badbit); - return *this; -} - -streampos ostream::tellp() -{ -#if 1 - streampos pos = _IO_seekoff (_strbuf, 0, _IO_seek_cur, _IOS_OUTPUT); -#else - streampos pos = _strbuf->pubseekoff(0, ios::cur, ios::out); -#endif - if (pos == streampos(EOF)) - set(ios::badbit); - return pos; -} - -ostream& ostream::flush() -{ - if (_strbuf->sync()) - set(ios::badbit); - return *this; -} - -ostream& flush(ostream& outs) -{ - return outs.flush(); -} - -istream& ws(istream& ins) -{ - if (ins.ipfx1()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - ins._strbuf); - int ch = skip_ws(ins._strbuf); - if (ch == EOF) - ins.set(ios::eofbit); - else - ins._strbuf->sputbackc(ch); - ins.isfx(); - _IO_cleanup_region_end (0); - } - return ins; -} - -// Skip white-space. Return 0 on failure (EOF), or 1 on success. -// Differs from ws() manipulator in that failbit is set on EOF. -// Called by ipfx() and ipfx0() if needed. - -int istream::_skip_ws() -{ - int ch = skip_ws(_strbuf); - if (ch == EOF) { - set(ios::eofbit|ios::failbit); - return 0; - } - else { - _strbuf->sputbackc(ch); - return 1; - } -} - -ostream& ends(ostream& outs) -{ - outs.put('\0'); - return outs; -} - -ostream& endl(ostream& outs) -{ - return flush(outs.put('\n')); -} - -istream& lock(istream& ins) -{ - _IO_flockfile (ins._strbuf); - return ins; -} -istream& unlock(istream& ins) -{ - _IO_funlockfile (ins._strbuf); - return ins; -} -ostream& lock(ostream& outs) -{ - _IO_flockfile (outs._strbuf); - return outs; -} -ostream& unlock(ostream& outs) -{ - _IO_funlockfile (outs._strbuf); - return outs; -} - - -ostream& ostream::write(const char *s, streamsize n) -{ - if (opfx()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - if (_IO_sputn(_strbuf, s, n) != n) - set(ios::failbit); - osfx(); - _IO_cleanup_region_end (0); - } - return *this; -} - -void ostream::do_osfx() -{ - if (flags() & ios::unitbuf) - flush(); - if (flags() & ios::stdio) { - fflush(stdout); - fflush(stderr); - } -} - -iostream::iostream(streambuf* sb, ostream* tied) -{ - init (sb, tied); -} - -// NOTE: extension for compatibility with old libg++. -// Not really compatible with fistream::close(). -#ifdef _STREAM_COMPAT -void ios::close() -{ - if (_strbuf->_flags & _IO_IS_FILEBUF) - ((struct filebuf*)rdbuf())->close(); - else if (_strbuf != NULL) - rdbuf()->sync(); - _strbuf = NULL; - _state = badbit; -} - -int istream::skip(int i) -{ - int old = (_flags & ios::skipws) != 0; - if (i) - _flags |= ios::skipws; - else - _flags &= ~ios::skipws; - return old; -} -#endif diff --git a/contrib/libio/iostream.h b/contrib/libio/iostream.h deleted file mode 100644 index 19fbf8a4d9..0000000000 --- a/contrib/libio/iostream.h +++ /dev/null @@ -1,273 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#ifndef _IOSTREAM_H -#ifdef __GNUG__ -#pragma interface -#endif -#define _IOSTREAM_H - -#include - -extern "C++" { -class istream; class ostream; -typedef ios& (*__manip)(ios&); -typedef istream& (*__imanip)(istream&); -typedef ostream& (*__omanip)(ostream&); - -extern istream& ws(istream& ins); -extern ostream& flush(ostream& outs); -extern ostream& endl(ostream& outs); -extern ostream& ends(ostream& outs); - -class ostream : virtual public ios -{ - // NOTE: If fields are changed, you must fix _fake_ostream in stdstreams.C! - void do_osfx(); - public: - ostream() { } - ostream(streambuf* sb, ostream* tied=NULL); - int opfx() { - if (!good()) return 0; - else { if (_tie) _tie->flush(); _IO_flockfile(_strbuf); return 1;} } - void osfx() { _IO_funlockfile(_strbuf); - if (flags() & (ios::unitbuf|ios::stdio)) - do_osfx(); } - ostream& flush(); - ostream& put(char c) { _strbuf->sputc(c); return *this; } -#ifdef _STREAM_COMPAT - /* Temporary binary compatibility. REMOVE IN NEXT RELEASE. */ - ostream& put(unsigned char c) { return put((char)c); } - ostream& put(signed char c) { return put((char)c); } -#endif - ostream& write(const char *s, streamsize n); - ostream& write(const unsigned char *s, streamsize n) - { return write((const char*)s, n);} - ostream& write(const signed char *s, streamsize n) - { return write((const char*)s, n);} - ostream& write(const void *s, streamsize n) - { return write((const char*)s, n);} - ostream& seekp(streampos); - ostream& seekp(streamoff, _seek_dir); - streampos tellp(); - ostream& form(const char *format ...); - ostream& vform(const char *format, _IO_va_list args); - - ostream& operator<<(char c); - ostream& operator<<(unsigned char c) { return (*this) << (char)c; } - ostream& operator<<(signed char c) { return (*this) << (char)c; } - ostream& operator<<(const char *s); - ostream& operator<<(const unsigned char *s) - { return (*this) << (const char*)s; } - ostream& operator<<(const signed char *s) - { return (*this) << (const char*)s; } - ostream& operator<<(const void *p); - ostream& operator<<(int n); - ostream& operator<<(unsigned int n); - ostream& operator<<(long n); - ostream& operator<<(unsigned long n); -#if defined(__GNUC__) - __extension__ ostream& operator<<(long long n); - __extension__ ostream& operator<<(unsigned long long n); -#endif - ostream& operator<<(short n) {return operator<<((int)n);} - ostream& operator<<(unsigned short n) {return operator<<((unsigned int)n);} -#if _G_HAVE_BOOL - ostream& operator<<(bool b) { return operator<<((int)b); } -#endif - ostream& operator<<(double n); - ostream& operator<<(float n) { return operator<<((double)n); } -#if _G_HAVE_LONG_DOUBLE_IO - ostream& operator<<(long double n); -#else - ostream& operator<<(long double n) { return operator<<((double)n); } -#endif - ostream& operator<<(__omanip func) { return (*func)(*this); } - ostream& operator<<(__manip func) {(*func)(*this); return *this;} - ostream& operator<<(streambuf*); -#ifdef _STREAM_COMPAT - streambuf* ostreambuf() const { return _strbuf; } -#endif -}; - -class istream : virtual public ios -{ - // NOTE: If fields are changed, you must fix _fake_istream in stdstreams.C! -protected: - _IO_size_t _gcount; - - int _skip_ws(); - public: - istream(): _gcount (0) { } - istream(streambuf* sb, ostream*tied=NULL); - istream& get(char* ptr, int len, char delim = '\n'); - istream& get(unsigned char* ptr, int len, char delim = '\n') - { return get((char*)ptr, len, delim); } - istream& get(char& c); - istream& get(unsigned char& c) { return get((char&)c); } - istream& getline(char* ptr, int len, char delim = '\n'); - istream& getline(unsigned char* ptr, int len, char delim = '\n') - { return getline((char*)ptr, len, delim); } - istream& get(signed char& c) { return get((char&)c); } - istream& get(signed char* ptr, int len, char delim = '\n') - { return get((char*)ptr, len, delim); } - istream& getline(signed char* ptr, int len, char delim = '\n') - { return getline((char*)ptr, len, delim); } - istream& read(char *ptr, streamsize n); - istream& read(unsigned char *ptr, streamsize n) - { return read((char*)ptr, n); } - istream& read(signed char *ptr, streamsize n) - { return read((char*)ptr, n); } - istream& read(void *ptr, streamsize n) - { return read((char*)ptr, n); } - istream& get(streambuf& sb, char delim = '\n'); - istream& gets(char **s, char delim = '\n'); - int ipfx(int need = 0) { - if (!good()) { set(ios::failbit); return 0; } - else { - _IO_flockfile(_strbuf); - if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush(); - if (!need && (flags() & ios::skipws)) return _skip_ws(); - else return 1; - } - } - int ipfx0() { // Optimized version of ipfx(0). - if (!good()) { set(ios::failbit); return 0; } - else { - _IO_flockfile(_strbuf); - if (_tie) _tie->flush(); - if (flags() & ios::skipws) return _skip_ws(); - else return 1; - } - } - int ipfx1() { // Optimized version of ipfx(1). - if (!good()) { set(ios::failbit); return 0; } - else { - _IO_flockfile(_strbuf); - if (_tie && rdbuf()->in_avail() == 0) _tie->flush(); - return 1; - } - } - void isfx() { _IO_funlockfile(_strbuf); } - int get() { if (!ipfx1()) return EOF; - else { int ch = _strbuf->sbumpc(); - if (ch == EOF) set(ios::eofbit); - isfx(); - return ch; - } } - int peek(); - _IO_size_t gcount() { return _gcount; } - istream& ignore(int n=1, int delim = EOF); - int sync (); - istream& seekg(streampos); - istream& seekg(streamoff, _seek_dir); - streampos tellg(); - istream& putback(char ch) { - if (good() && _strbuf->sputbackc(ch) == EOF) clear(ios::badbit); - return *this;} - istream& unget() { - if (good() && _strbuf->sungetc() == EOF) clear(ios::badbit); - return *this;} - istream& scan(const char *format ...); - istream& vscan(const char *format, _IO_va_list args); -#ifdef _STREAM_COMPAT - istream& unget(char ch) { return putback(ch); } - int skip(int i); - streambuf* istreambuf() const { return _strbuf; } -#endif - - istream& operator>>(char*); - istream& operator>>(unsigned char* p) { return operator>>((char*)p); } - istream& operator>>(signed char*p) { return operator>>((char*)p); } - istream& operator>>(char& c); - istream& operator>>(unsigned char& c) {return operator>>((char&)c);} - istream& operator>>(signed char& c) {return operator>>((char&)c);} - istream& operator>>(int&); - istream& operator>>(long&); -#if defined(__GNUC__) - __extension__ istream& operator>>(long long&); - __extension__ istream& operator>>(unsigned long long&); -#endif - istream& operator>>(short&); - istream& operator>>(unsigned int&); - istream& operator>>(unsigned long&); - istream& operator>>(unsigned short&); -#if _G_HAVE_BOOL - istream& operator>>(bool&); -#endif - istream& operator>>(float&); - istream& operator>>(double&); - istream& operator>>(long double&); - istream& operator>>( __manip func) {(*func)(*this); return *this;} - istream& operator>>(__imanip func) { return (*func)(*this); } - istream& operator>>(streambuf*); -}; - -class iostream : public istream, public ostream -{ - public: - iostream() { } - iostream(streambuf* sb, ostream*tied=NULL); -}; - -class _IO_istream_withassign : public istream { -public: - _IO_istream_withassign& operator=(istream&); - _IO_istream_withassign& operator=(_IO_istream_withassign& rhs) - { return operator= (static_cast (rhs)); } -}; - -class _IO_ostream_withassign : public ostream { -public: - _IO_ostream_withassign& operator=(ostream&); - _IO_ostream_withassign& operator=(_IO_ostream_withassign& rhs) - { return operator= (static_cast (rhs)); } -}; - -extern _IO_istream_withassign cin; -// clog->rdbuf() == cerr->rdbuf() -extern _IO_ostream_withassign cout, cerr; - -extern _IO_ostream_withassign clog -#if _G_CLOG_CONFLICT -__asm__ ("__IO_clog") -#endif -; - -extern istream& lock(istream& ins); -extern istream& unlock(istream& ins); -extern ostream& lock(ostream& outs); -extern ostream& unlock(ostream& outs); - -struct Iostream_init { } ; // Compatibility hack for AT&T library. - -inline ios& dec(ios& i) -{ i.setf(ios::dec, ios::dec|ios::hex|ios::oct); return i; } -inline ios& hex(ios& i) -{ i.setf(ios::hex, ios::dec|ios::hex|ios::oct); return i; } -inline ios& oct(ios& i) -{ i.setf(ios::oct, ios::dec|ios::hex|ios::oct); return i; } -} // extern "C++" - -#endif /*!_IOSTREAM_H*/ diff --git a/contrib/libio/iostream.texi b/contrib/libio/iostream.texi deleted file mode 100644 index 641cd7da22..0000000000 --- a/contrib/libio/iostream.texi +++ /dev/null @@ -1,1971 +0,0 @@ -\input texinfo @c -*-Texinfo-*- -@c Copyright (c) 1993 Free Software Foundation, Inc. - -@c %**start of header -@setfilename iostream.info -@settitle The GNU C++ Iostream Library -@setchapternewpage odd -@c %**end of header - -@ifinfo -@format -START-INFO-DIR-ENTRY -* iostream: (iostream). The C++ input/output facility. -END-INFO-DIR-ENTRY -@end format - -This file describes libio, the GNU library for C++ iostreams and C stdio. - -libio includes software developed by the University of California, -Berkeley. - -Copyright (C) 1993 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions. -@end ifinfo - -@finalout -@syncodeindex fn cp -@syncodeindex vr cp - -@titlepage -@title The GNU C++ Iostream Library -@subtitle Reference Manual for @code{libio} Version 0.64 -@sp 3 -@author Per Bothner @hfill @code{bothner@@cygnus.com} -@author Cygnus Support @hfill @code{doc@@cygnus.com} -@page - -@vskip 0pt plus 1filll -Copyright @copyright{} 1993 Free Software Foundation, Inc. - -@code{libio} includes software developed by the University of -California, Berkeley. - -@code{libio} uses floating-point software written by David M. Gay, which -includes the following notice: - -@quotation -The author of this software is David M. Gay. - -Copyright (c) 1991 by AT&T. - -Permission to use, copy, modify, and distribute this software for any -purpose without fee is hereby granted, provided that this entire notice -is included in all copies of any software which is or includes a copy -or modification of this software and in all copies of the supporting -documentation for such software. - -THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED -WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY -REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY -OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. -@end quotation - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions. -@end titlepage - -@ifinfo -@node Top -@top The GNU C++ Iostream Library - -This file provides reference information on the GNU C++ iostream library -(@code{libio}), version 0.64. - -@menu -* Introduction:: -* Operators:: Operators and default streams. -* Streams:: Stream classes. -* Files and Strings:: Classes for files and strings. -* Streambuf:: Using the streambuf layer. -* Stdio:: C input and output. -* Index:: -@end menu -@end ifinfo - -@node Introduction -@chapter Introduction - -The iostream classes implement most of the features of AT&T version 2.0 -iostream library classes, and most of the features of the ANSI X3J16 -library draft (which is based on the AT&T design). - -This manual is meant as a reference; for tutorial material on iostreams, -see the corresponding section of any recent popular introduction to C++. - -@menu -* Copying:: Special GNU licensing terms for libio. -* Acknowledgements:: Contributors to GNU iostream. -@end menu - -@node Copying -@section Licensing terms for @code{libio} - -Since the @code{iostream} classes are so fundamental to standard C++, -the Free Software Foundation has agreed to a special exception to its -standard license, when you link programs with @code{libio.a}: - -@quotation -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. -@end quotation - -The code is under the @sc{gnu} General Public License (version 2) for -all other purposes than linking with this library; that means that you -can modify and redistribute the code as usual, but remember that if you -do, your modifications, and anything you link with the modified code, -must be available to others on the same terms. - -These functions are also available as part of the @code{libg++} -library; if you link with that library instead of @code{libio}, the -@sc{gnu} Library General Public License applies. - -@node Acknowledgements -@section Acknowledgements - -Per Bothner wrote most of the @code{iostream} library, but some portions -have their origins elsewhere in the free software community. Heinz -Seidl wrote the IO manipulators. The floating-point conversion software -is by David M. Gay of AT&T. Some code was derived from parts of BSD -4.4, which was written at the University of California, Berkeley. - -The iostream classes are found in the @code{libio} library. An early -version was originally distributed in @code{libg++}, and they are still -included there as well, for convenience if you need other @code{libg++} -classes. Doug Lea was the original author of @code{libg++}, and some of -the file-management code still in @code{libio} is his. - -Various people found bugs or offered suggestions. Hongjiu Lu worked -hard to use the library as the default stdio implementation for Linux, -and has provided much stress-testing of the library. - -@node Operators -@chapter Operators and Default Streams - -The @sc{gnu} iostream library, @file{libio}, implements the standard -input and output facilities for C++. These facilities are roughly -analogous (in their purpose and ubiquity, at least) with those defined -by the C @file{stdio} functions. - -Although these definitions come from a library, rather than being part -of the ``core language'', they are sufficiently central to be specified -in the latest working papers for C++. - -You can use two operators defined in this library for basic input and -output operations. They are familiar from any C++ introductory -textbook: @code{<<} for output, and @code{>>} for input. (Think of data -flowing in the direction of the ``arrows''.) - -These operators are often used in conjunction with three streams that -are open by default: - -@deftypevar ostream cout -The standard output stream, analogous to the C @code{stdout}. -@end deftypevar - -@deftypevar istream cin -The standard input stream, analogous to the C @code{stdin}. -@end deftypevar - -@deftypevar ostream cerr -An alternative output stream for errors, analogous to the C -@code{stderr}. -@end deftypevar - -@noindent -For example, this bare-bones C++ version of the traditional ``hello'' -program uses @code{<<} and @code{cout}: - -@example -#include - -int main(int argc, char **argv) -@{ - cout << "Well, hi there.\n"; - return 0; -@} -@end example - -Casual use of these operators may be seductive, but---other than in -writing throwaway code for your own use---it is not necessarily simpler -than managing input and output in any other language. For example, -robust code should check the state of the input and output streams -between operations (for example, using the method @code{good}). -@xref{States,,Checking the state of a stream}. You may also need to -adjust maximum input or output field widths, using manipulators like -@code{setw} or @code{setprecision}. - -@defop Operator ostream << -Write output to an open output stream of class @code{ostream}. -Defined by this library on any @var{object} of a C++ primitive type, and -on other classes of the library. You can overload the definition for any -of your own applications' classes. - -Returns a reference to the implied argument @code{*this} (the open stream it -writes on), permitting statements like -@example -cout << "The value of i is " << i << "\n"; -@end example -@end defop - -@defop Operator istream >> -Read input from an open input stream of class @code{istream}. Defined -by this library on primitive numeric, pointer, and string types; you can -extend the definition for any of your own applications' classes. - -Returns a reference to the implied argument @code{*this} (the open stream -it reads), permitting multiple inputs in one statement. -@end defop - -@node Streams -@chapter Stream Classes - -The previous chapter referred in passing to the classes @code{ostream} -and @code{istream}, for output and input respectively. These classes -share certain properties, captured in their base class @code{ios}. - -@menu -* Ios:: Shared properties. -* Ostream:: Managing output streams. -* Istream:: Managing input streams. -* Iostream:: Input and output together. -@end menu - -@node Ios -@section Shared properties: class @code{ios} - -The base class @code{ios} provides methods to test and manage the state -of input or output streams. - -@code{ios} delegates the job of actually reading and writing bytes to -the abstract class @code{streambuf}, which is designed to provide -buffered streams (compatible with C, in the @sc{gnu} implementation). -@xref{Streambuf,,Using the @code{streambuf} layer}, for information on -the facilities available at the @code{streambuf} level. - -@deftypefn Constructor {} ios::ios ([streambuf* @var{sb} @w{[, ostream*} @var{tie}]) -The @code{ios} constructor by default initializes a new @code{ios}, and -if you supply a @code{streambuf} @var{sb} to associate with it, sets the -state @code{good} in the new @code{ios} object. It also sets the -default properties of the new object. - -@ignore -@c FIXME--future: this (a) doesn't work, (b) is controversial at ANSI -An @code{ios} without a @code{streambuf} has the state @code{bad} until -you supply a @code{streambuf}; you can do that by assigning a new value -to the @code{ios} with @samp{=}. -@end ignore - -You can also supply an optional second argument @var{tie} to the -constructor: if present, it is an initial value for @code{ios::tie}, to -associate the new @code{ios} object with another stream. -@end deftypefn - -@deftypefn Destructor {} ios::~ios () -The @code{ios} destructor is virtual, permitting application-specific -behavior when a stream is closed---typically, the destructor frees any -storage associated with the stream and releases any other associated -objects. -@end deftypefn - -@c FIXME-future: Is @deftypefn really the best way of displaying these? - -@c FIXME-future: Undocumented: ios::_throw_failure, ios::exceptions; things -@c controlled by _STREAM_COMPAT; ios::Init; ios::_IO_fix_vtable. - -@menu -* States:: Checking the state of a stream. -* Format Control:: Choices in formatting. -* Manipulators:: Convenient ways of changing stream properties. -* Extending:: Extended data fields. -* Synchronization:: Synchronizing related streams. -* Streambuf from Ios:: Reaching the underlying streambuf. -@end menu - -@node States -@subsection Checking the state of a stream - -Use this collection of methods to test for (or signal) errors and other -exceptional conditions of streams: - -@deftypefn Method {ios::operator void*} () const -You can do a quick check on the state of the most recent operation on a -stream by examining a pointer to the stream itself. The pointer is -arbitrary except for its truth value; it is true if no failures have -occurred (@code{ios::fail} is not true). For example, you might ask for -input on @code{cin} only if all prior output operations succeeded: - -@example -if (cout) -@{ - // Everything OK so far - cin >> new_value; - @dots{} -@} -@end example -@end deftypefn - -@deftypefn Method {ios::operator !} () const -In case it is more convenient to check whether something has failed, the -operator @code{!} returns true if @code{ios::fail} is true (an operation -has failed). For example, -you might issue an error message if input failed: - -@example -if (!cin) -@{ - // Oops - cerr << "Eh?\n"; -@} -@end example -@end deftypefn - -@deftypefn Method iostate ios::rdstate () const -Return the state flags for this stream. The value is from the -enumeration @code{iostate}. You can test for any combination of - -@vtable @code -@item goodbit -There are no indications of exceptional states on this stream. - -@item eofbit -End of file. - -@item failbit -An operation has failed on this stream; this usually indicates bad -format of input. - -@item badbit -The stream is unusable. -@end vtable -@end deftypefn - -@deftypefn Method void ios::setstate (iostate @var{state}) -@findex ios::set -Set the state flag for this stream to @var{state} @emph{in addition to} -any state flags already set. Synonym (for upward compatibility): -@code{ios::set}. - -See @code{ios::clear} to set the stream state without regard to existing -state flags. See @code{ios::good}, @code{ios::eof}, @code{ios::fail}, -and @code{ios::bad}, to test the state. -@end deftypefn - -@deftypefn Method int ios::good () const -Test the state flags associated with this stream; true if no error -indicators are set. -@end deftypefn - -@deftypefn Method int ios::bad () const -Test whether a stream is marked as unusable. (Whether -@code{ios::badbit} is set.) -@end deftypefn - -@deftypefn Method int ios::eof () const -True if end of file was reached on this stream. (If @code{ios::eofbit} -is set.) -@end deftypefn - -@deftypefn Method int ios::fail () const -Test for any kind of failure on this stream: @emph{either} some -operation failed, @emph{or} the stream is marked as bad. (If either -@code{ios::failbit} or @code{ios::badbit} is set.) -@end deftypefn - -@deftypefn Method void ios::clear (iostate @var{state}) -@c FIXME-future: There is some complication to do with buffering and _throw_failure -Set the state indication for this stream to the argument @var{state}. -You may call @code{ios::clear} with no argument, in which case the state -is set to @code{good} (no errors pending). - -See @code{ios::good}, @code{ios::eof}, @code{ios::fail}, and -@code{ios::bad}, to test the state; see @code{ios::set} or -@code{ios::setstate} for an alternative way of setting the state. -@end deftypefn - -@node Format Control -@subsection Choices in formatting - -These methods control (or report on) settings for some details of -controlling streams, primarily to do with formatting output: - -@deftypefn Method char ios::fill () const -Report on the padding character in use. -@end deftypefn - -@deftypefn Method char ios::fill (char @var{padding}) -Set the padding character. You can also use the manipulator -@code{setfill}. @xref{Manipulators,,Changing stream properties in -expressions}. - -Default: blank. -@end deftypefn - -@deftypefn Method int ios::precision () const -Report the number of significant digits currently in use for output of -floating point numbers. - -Default: @code{6}. -@end deftypefn - -@deftypefn Method int ios::precision (int @var{signif}) -Set the number of significant digits (for input and output numeric -conversions) to @var{signif}. - -@findex setprecision -@cindex setting @code{ios::precision} -You can also use the manipulator @code{setprecision} for this purpose. -@xref{Manipulators,,Changing stream properties using manipulators}. -@end deftypefn - -@deftypefn Method int ios::width () const -Report the current output field width setting (the number of -characters to write on the next @samp{<<} output operation). - -Default: @code{0}, which means to use as many characters as necessary. -@end deftypefn - -@deftypefn Method int ios::width (int @var{num}) -Set the input field width setting to @var{num}. Return the -@emph{previous} value for this stream. - -@findex setw -@cindex setting @code{ios::width} -This value resets to zero (the default) every time you use @samp{<<}; it is -essentially an additional implicit argument to that operator. You can -also use the manipulator @code{setw} for this purpose. -@xref{Manipulators,,Changing stream properties using manipulators}. -@end deftypefn - -@need 2000 -@deftypefn Method fmtflags ios::flags () const -Return the current value of the complete collection of flags controlling -the format state. These are the flags and their meanings when set: - -@vtable @code -@item ios::dec -@itemx ios::oct -@itemx ios::hex -What numeric base to use in converting integers from internal to display -representation, or vice versa: decimal, octal, or hexadecimal, -respectively. (You can change the base using the manipulator -@code{setbase}, or any of the manipulators @code{dec}, @code{oct}, or -@code{hex}; @pxref{Manipulators,,Changing stream properties in -expressions}.) - -On input, if none of these flags is set, read numeric constants -according to the prefix: decimal if no prefix (or a @samp{.} suffix), -octal if a @samp{0} prefix is present, hexadecimal if a @samp{0x} prefix -is present. - -Default: @code{dec}. - -@item ios::fixed -Avoid scientific notation, and always show a fixed number of digits after -the decimal point, according to the output precision in effect. -Use @code{ios::precision} to set precision. - -@item ios::left -@itemx ios::right -@itemx ios::internal -Where output is to appear in a fixed-width field; left-justified, -right-justified, or with padding in the middle (e.g. between a numeric -sign and the associated value), respectively. - -@item ios::scientific -Use scientific (exponential) notation to display numbers. - -@item ios::showbase -Display the conventional prefix as a visual indicator of the conversion -base: no prefix for decimal, @samp{0} for octal, @samp{0x} for hexadecimal. - -@item ios::showpoint -Display a decimal point and trailing zeros after it to fill out numeric -fields, even when redundant. - -@item ios::showpos -Display a positive sign on display of positive numbers. - -@item ios::skipws -Skip white space. (On by default). - -@item ios::stdio -Flush the C @code{stdio} streams @code{stdout} and @code{stderr} after -each output operation (for programs that mix C and C++ output conventions). - -@item ios::unitbuf -Flush after each output operation. - -@item ios::uppercase -Use upper-case characters for the non-numeral elements in numeric -displays; for instance, @samp{0X7A} rather than @samp{0x7a}, or -@samp{3.14E+09} rather than @samp{3.14e+09}. -@end vtable -@end deftypefn - -@deftypefn Method fmtflags ios::flags (fmtflags @var{value}) -Set @var{value} as the complete collection of flags controlling the -format state. The flag values are described under @samp{ios::flags ()}. - -Use @code{ios::setf} or @code{ios::unsetf} to change one property at a -time. -@end deftypefn - -@deftypefn Method fmtflags ios::setf (fmtflags @var{flag}) -Set one particular flag (of those described for @samp{ios::flags ()}; -return the complete collection of flags @emph{previously} in effect. -(Use @code{ios::unsetf} to cancel.) -@end deftypefn - -@deftypefn Method fmtflags ios::setf (fmtflags @var{flag}, fmtflags @var{mask}) -Clear the flag values indicated by @var{mask}, then set any of them that -are also in @var{flag}. (Flag values are described for @samp{ios::flags -()}.) Return the complete collection of flags @emph{previously} in -effect. (See @code{ios::unsetf} for another way of clearing flags.) -@end deftypefn - -@deftypefn Method fmtflags ios::unsetf (fmtflags @var{flag}) -Make certain @var{flag} (a combination of flag values described for -@samp{ios::flags ()}) is not set for this stream; converse of -@code{ios::setf}. Returns the old values of those flags. -@c FIXME-future: should probably be fixed to give same result as setf. -@end deftypefn - -@node Manipulators -@subsection Changing stream properties using manipulators - -For convenience, @var{manipulators} provide a way to change certain -properties of streams, or otherwise affect them, in the middle of -expressions involving @samp{<<} or @samp{>>}. For example, you might -write - -@example -cout << "|" << setfill('*') << setw(5) << 234 << "|"; -@end example - -@noindent -to produce @samp{|**234|} as output. - -@deftypefn Manipulator {} ws -Skip whitespace. -@end deftypefn - -@deftypefn Manipulator {} flush -Flush an output stream. For example, @samp{cout << @dots{} <}. -@end deftypefn - -@deftypefn Manipulator {} setw (int @var{n}) -You can change the value of @code{ios::width} in @samp{<<} expressions -with the manipulator @samp{setw(@var{n})}; for example, - -@example -cout << setw(5) << 234; -@end example - -@noindent -prints @w{@samp{ 234}} with two leading blanks. Requires @file{#include -}. -@end deftypefn - -@deftypefn Manipulator {} setbase (int @var{base}) -Where @var{base} is one of @code{10} (decimal), @code{8} (octal), or -@code{16} (hexadecimal), change the base value for numeric -representations. Requires @file{#include }. -@end deftypefn - -@deftypefn Manipulator {} dec -Select decimal base; equivalent to @samp{setbase(10)}. -@end deftypefn - -@deftypefn Manipulator {} hex -Select hexadecimal base; equivalent to @samp{setbase(16)}. -@end deftypefn - -@deftypefn Manipulator {} oct -Select octal base; equivalent to @samp{setbase(8)}. -@end deftypefn - -@deftypefn Manipulator {} setfill (char @var{padding}) -Set the padding character, in the same way as @code{ios::fill}. -Requires @file{#include }. -@end deftypefn - -@node Extending -@subsection Extended data fields - -A related collection of methods allows you to extend this collection of -flags and parameters for your own applications, without risk of conflict -between them: - -@deftypefn Method {static fmtflags} ios::bitalloc () -Reserve a bit (the single bit on in the result) to use as a flag. Using -@code{bitalloc} guards against conflict between two packages that use -@code{ios} objects for different purposes. - -This method is available for upward compatibility, but is not in the -@sc{ansi} working paper. The number of bits available is limited; a -return value of @code{0} means no bit is available. -@end deftypefn - -@deftypefn Method {static int} ios::xalloc () -Reserve space for a long integer or pointer parameter. The result is a -unique nonnegative integer. You can use it as an index to -@code{ios::iword} or @code{ios::pword}. Use @code{xalloc} to arrange -for arbitrary special-purpose data in your @code{ios} objects, without -risk of conflict between packages designed for different purposes. -@end deftypefn - -@deftypefn Method long& ios::iword (int @var{index}) -Return a reference to arbitrary data, of long integer type, stored in an -@code{ios} instance. @var{index}, conventionally returned from -@code{ios::xalloc}, identifies what particular data you need. -@end deftypefn - -@deftypefn Method long ios::iword (int @var{index}) const -Return the actual value of a long integer stored in an @code{ios}. -@end deftypefn - -@deftypefn Method void*& ios::pword (int @var{index}) -Return a reference to an arbitrary pointer, stored in an @code{ios} -instance. @var{index}, originally returned from @code{ios::xalloc}, -identifies what particular pointer you need. -@end deftypefn - -@deftypefn Method void* ios::pword (int @var{index}) const -Return the actual value of a pointer stored in an @code{ios}. -@end deftypefn - -@node Synchronization -@subsection Synchronizing related streams - -You can use these methods to synchronize related streams with -one another: - -@deftypefn Method ostream* ios::tie () const -Report on what output stream, if any, is to be flushed before accessing -this one. A pointer value of @code{0} means no stream is tied. -@end deftypefn - -@deftypefn Method ostream* ios::tie (ostream* @var{assoc}) -Declare that output stream @var{assoc} must be flushed before accessing -this stream. -@end deftypefn - -@deftypefn Method int ios::sync_with_stdio ([int @var{switch}]) -Unless iostreams and C @code{stdio} are designed to work together, you -may have to choose between efficient C++ streams output and output -compatible with C @code{stdio}. Use @samp{ios::sync_with_stdio()} to -select C compatibility. - -The argument @var{switch} is a @sc{gnu} extension; use @code{0} as the -argument to choose output that is not necessarily compatible with C -@code{stdio}. The default value for @var{switch} is @code{1}. - -If you install the @code{stdio} implementation that comes with @sc{gnu} -@code{libio}, there are compatible input/output facilities for both C -and C++. In that situation, this method is unnecessary---but you may -still want to write programs that call it, for portability. -@end deftypefn - -@node Streambuf from Ios -@subsection Reaching the underlying @code{streambuf} - -Finally, you can use this method to access the underlying object: - -@deftypefn Method streambuf* ios::rdbuf () const -Return a pointer to the @code{streambuf} object that underlies this -@code{ios}. -@end deftypefn - -@node Ostream -@section Managing output streams: class @code{ostream} - -Objects of class @code{ostream} inherit the generic methods from -@code{ios}, and in addition have the following methods available. -Declarations for this class come from @file{iostream.h}. - -@deftypefn Constructor {} ostream::ostream () -The simplest form of the constructor for an @code{ostream} simply -allocates a new @code{ios} object. -@end deftypefn - -@deftypefn Constructor {} ostream::ostream (streambuf* @var{sb} @w{[, ostream} @var{tie}]) -This alternative constructor requires a first argument @var{sb} of type -@code{streambuf*}, to use an existing open stream for output. It also -accepts an optional second argument @var{tie}, to specify a related -@code{ostream*} as the initial value for @code{ios::tie}. - -If you give the @code{ostream} a @code{streambuf} explicitly, using -this constructor, the @var{sb} is @emph{not} destroyed (or deleted or -closed) when the @code{ostream} is destroyed. -@end deftypefn - -@menu -* Writing:: Writing on an ostream. -* Output Position:: Repositioning an ostream. -* Ostream Housekeeping:: Miscellaneous ostream utilities. -@end menu - -@node Writing -@subsection Writing on an @code{ostream} - -These methods write on an @code{ostream} (you may also use the operator -@code{<<}; @pxref{Operators,,Operators and Default Streams}). - -@deftypefn Method ostream& ostream::put (char @var{c}) -Write the single character @var{c}. -@end deftypefn - -@deftypefn Method ostream& ostream::write (@var{string}, int @var{length}) -Write @var{length} characters of a string to this @code{ostream}, -beginning at the pointer @var{string}. - -@var{string} may have any of these types: @code{char*}, @code{unsigned -char*}, @code{signed char*}. -@end deftypefn - -@deftypefn Method ostream& ostream::form (const char *@var{format}, ...) -A @sc{gnu} extension, similar to @code{fprintf(@var{file}, -@var{format}, ...)}. - -@var{format} is a @code{printf}-style format control string, which is used -to format the (variable number of) arguments, printing the result on -this @code{ostream}. See @code{ostream::vform} for a version that uses -an argument list rather than a variable number of arguments. -@end deftypefn - -@deftypefn Method ostream& ostream::vform (const char *@var{format}, va_list @var{args}) -A @sc{gnu} extension, similar to @code{vfprintf(@var{file}, -@var{format}, @var{args})}. - -@var{format} is a @code{printf}-style format control string, which is used -to format the argument list @var{args}, printing the result on -this @code{ostream}. See @code{ostream::form} for a version that uses a -variable number of arguments rather than an argument list. -@end deftypefn - -@node Output Position -@subsection Repositioning an @code{ostream} - -You can control the output position (on output streams that actually -support positions, typically files) with these methods: -@c FIXME-future: sort out which classes support this and which -@c don't; fstream, filebuf? And what is failure condition when not supported? - -@deftypefn Method streampos ostream::tellp () -Return the current write position in the stream. -@end deftypefn - -@deftypefn Method ostream& ostream::seekp (streampos @var{loc}) -Reset the output position to @var{loc} (which is usually the result of a -previous call to @code{ostream::tellp}). @var{loc} specifies an -absolute position in the output stream. -@end deftypefn - -@deftypefn Method ostream& ostream::seekp (streamoff @var{loc}, @var{rel}) -@findex ios::seekdir -Reset the output position to @var{loc}, relative to the beginning, end, -or current output position in the stream, as indicated by @var{rel} (a -value from the enumeration @code{ios::seekdir}): - -@vtable @code -@item beg -Interpret @var{loc} as an absolute offset from the beginning of the -file. - -@item cur -Interpret @var{loc} as an offset relative to the current output -position. - -@item end -Interpret @var{loc} as an offset from the current end of the output -stream. -@end vtable -@end deftypefn - -@node Ostream Housekeeping -@subsection Miscellaneous @code{ostream} utilities - -You may need to use these @code{ostream} methods for housekeeping: - -@deftypefn Method ostream& flush () -Deliver any pending buffered output for this @code{ostream}. -@end deftypefn - -@deftypefn Method int ostream::opfx () -@code{opfx} is a @dfn{prefix} method for operations on @code{ostream} -objects; it is designed to be called before any further processing. See -@code{ostream::osfx} for the converse. -@c FIXME-future: specify sometime which methods start with opfx. - -@code{opfx} tests that the stream is in state @code{good}, and if so -flushes any stream tied to this one. - -The result is @code{1} when @code{opfx} succeeds; else (if the stream state is -not @code{good}), the result is @code{0}. -@end deftypefn - -@deftypefn Method void ostream::osfx () -@code{osfx} is a @dfn{suffix} method for operations on @code{ostream} -objects; it is designed to be called at the conclusion of any processing. All -the @code{ostream} methods end by calling @code{osfx}. See -@code{ostream::opfx} for the converse. - -If the @code{unitbuf} flag is set for this stream, @code{osfx} flushes -any buffered output for it. - -If the @code{stdio} flag is set for this stream, @code{osfx} flushes any -output buffered for the C output streams @file{stdout} and @file{stderr}. -@end deftypefn - -@node Istream -@section Managing input streams: class @code{istream} - -Class @code{istream} objects are specialized for input; as for -@code{ostream}, they are derived from @code{ios}, so you can use any of -the general-purpose methods from that base class. Declarations for this -class also come from @file{iostream.h}. - -@deftypefn Constructor {} istream::istream () -When used without arguments, the @code{istream} constructor simply -allocates a new @code{ios} object and initializes the input counter (the -value reported by @code{istream::gcount}) to @code{0}. -@end deftypefn - -@deftypefn Constructor {} istream::istream (streambuf *@var{sb} @w{[, ostream} @var{tie}]) -You can also call the constructor with one or two arguments. The first -argument @var{sb} is a @code{streambuf*}; if you supply this pointer, -the constructor uses that @code{streambuf} for input. -You can use the second optional argument @var{tie} to specify a related -output stream as the initial value for @code{ios::tie}. - -If you give the @code{istream} a @code{streambuf} explicitly, using -this constructor, the @var{sb} is @emph{not} destroyed (or deleted or -closed) when the @code{ostream} is destroyed. -@end deftypefn - -@menu -* Char Input:: Reading one character. -* String Input:: Reading strings. -* Input Position:: Repositioning an istream. -* Istream Housekeeping:: Miscellaneous istream utilities. -@end menu - -@node Char Input -@subsection Reading one character - -Use these methods to read a single character from the input stream: - -@deftypefn Method int istream::get () -Read a single character (or @code{EOF}) from the input stream, returning -it (coerced to an unsigned char) as the result. -@end deftypefn - -@deftypefn Method istream& istream::get (char& @var{c}) -Read a single character from the input stream, into @code{&@var{c}}. -@end deftypefn - -@deftypefn Method int istream::peek () -Return the next available input character, but @emph{without} changing -the current input position. -@end deftypefn - -@node String Input -@subsection Reading strings - -Use these methods to read strings (for example, a line at a time) from -the input stream: - -@deftypefn Method istream& istream::get (char* @var{c}, int @var{len} @w{[, char} @var{delim}]) -Read a string from the input stream, into the array at @var{c}. - -The remaining arguments limit how much to read: up to @samp{len-1} -characters, or up to (but not including) the first occurrence in the -input of a particular delimiter character @var{delim}---newline -(@code{\n}) by default. (Naturally, if the stream reaches end of file -first, that too will terminate reading.) - -If @var{delim} was present in the input, it remains available as if -unread; to discard it instead, see @code{iostream::getline}. - -@code{get} writes @samp{\0} at the end of the string, regardless -of which condition terminates the read. -@end deftypefn - -@deftypefn Method istream& istream::get (streambuf& @var{sb} @w{[, char} @var{delim}]) -Read characters from the input stream and copy them on the -@code{streambuf} object @var{sb}. Copying ends either just before the -next instance of the delimiter character @var{delim} (newline @code{\n} -by default), or when either stream ends. If @var{delim} was present in -the input, it remains available as if unread. -@end deftypefn - -@deftypefn Method istream& istream::getline (@var{charptr}, int @var{len} @w{[, char} @var{delim}]) -Read a line from the input stream, into the array at @var{charptr}. -@var{charptr} may be any of three kinds of pointer: @code{char*}, -@code{unsigned char*}, or @code{signed char*}. - -The remaining arguments limit how much to read: up to (but not -including) the first occurrence in the input of a line delimiter -character @var{delim}---newline (@code{\n}) by default, or up to -@samp{len-1} characters (or to end of file, if that happens sooner). - -If @code{getline} succeeds in reading a ``full line'', it also discards -the trailing delimiter character from the input stream. (To preserve it -as available input, see the similar form of @code{iostream::get}.) - -If @var{delim} was @emph{not} found before @var{len} characters or end -of file, @code{getline} sets the @code{ios::fail} flag, as well as the -@code{ios::eof} flag if appropriate. - -@code{getline} writes a null character at the end of the string, regardless -of which condition terminates the read. -@end deftypefn - -@deftypefn Method istream& istream::read (@var{pointer}, int @var{len}) -Read @var{len} bytes into the location at @var{pointer}, unless the -input ends first. - -@var{pointer} may be of type @code{char*}, @code{void*}, @code{unsigned -char*}, or @code{signed char*}. - -If the @code{istream} ends before reading @var{len} bytes, @code{read} -sets the @code{ios::fail} flag. -@end deftypefn - -@deftypefn Method istream& istream::gets (char **@var{s} @w{[, char} @var{delim}]) -A @sc{gnu} extension, to read an arbitrarily long string -from the current input position to the next instance of the @var{delim} -character (newline @code{\n} by default). - -To permit reading a string of arbitrary length, @code{gets} allocates -whatever memory is required. Notice that the first argument @var{s} is -an address to record a character pointer, rather than the pointer -itself. -@end deftypefn - -@deftypefn Method istream& istream::scan (const char *format ...) -A @sc{gnu} extension, similar to @code{fscanf(@var{file}, -@var{format}, ...)}. The @var{format} is a @code{scanf}-style format -control string, which is used to read the variables in the remainder of -the argument list from the @code{istream}. -@end deftypefn - -@deftypefn Method istream& istream::vscan (const char *format, va_list args) -Like @code{istream::scan}, but takes a single @code{va_list} argument. -@end deftypefn - -@node Input Position -@subsection Repositioning an @code{istream} - -Use these methods to control the current input position: - -@deftypefn Method streampos istream::tellg () -Return the current read position, so that you can save it and return to -it later with @code{istream::seekg}. -@end deftypefn - -@deftypefn Method istream& istream::seekg (streampos @var{p}) -Reset the input pointer (if the input device permits it) to @var{p}, -usually the result of an earlier call to @code{istream::tellg}. -@end deftypefn - -@deftypefn Method istream& istream::seekg (streamoff @var{offset}, ios::seek_dir @var{ref}) -Reset the input pointer (if the input device permits it) to @var{offset} -characters from the beginning of the input, the current position, or the -end of input. Specify how to interpret @var{offset} with one of these -values for the second argument: - -@vtable @code -@item ios::beg -Interpret @var{loc} as an absolute offset from the beginning of the -file. - -@item ios::cur -Interpret @var{loc} as an offset relative to the current output -position. - -@item ios::end -Interpret @var{loc} as an offset from the current end of the output -stream. -@end vtable -@end deftypefn - -@node Istream Housekeeping -@subsection Miscellaneous @code{istream} utilities - -Use these methods for housekeeping on @code{istream} objects: - -@deftypefn Method int istream::gcount () -Report how many characters were read from this @code{istream} in the -last unformatted input operation. -@c FIXME! Define "unformatted input" somewhere... -@end deftypefn - -@deftypefn Method int istream::ipfx (int @var{keepwhite}) -Ensure that the @code{istream} object is ready for reading; check for -errors and end of file and flush any tied stream. @code{ipfx} skips -whitespace if you specify @code{0} as the @var{keepwhite} -argument, @emph{and} @code{ios::skipws} is set for this stream. - -To avoid skipping whitespace (regardless of the @code{skipws} setting on -the stream), use @code{1} as the argument. - -Call @code{istream::ipfx} to simplify writing your own methods for reading -@code{istream} objects. -@end deftypefn - -@deftypefn Method void istream::isfx () -A placeholder for compliance with the draft @sc{ansi} standard; this -method does nothing whatever. - -If you wish to write portable standard-conforming code on @code{istream} -objects, call @code{isfx} after any operation that reads from an -@code{istream}; if @code{istream::ipfx} has any special effects that -must be cancelled when done, @code{istream::isfx} will cancel them. -@end deftypefn - -@deftypefn Method istream& istream::ignore ([int @var{n}] @w{[, int} @var{delim}]) -Discard some number of characters pending input. The first optional -argument @var{n} specifies how many characters to skip. The second -optional argument @var{delim} specifies a ``boundary'' character: -@code{ignore} returns immediately if this character appears in the -input. - -By default, @var{delim} is @code{EOF}; that is, if you do not specify a -second argument, only the count @var{n} restricts how much to ignore -(while input is still available). - -If you do not specify how many characters to ignore, @code{ignore} -returns after discarding only one character. -@end deftypefn - -@deftypefn Method istream& istream::putback (char @var{ch}) -Attempts to back up one character, replacing the character backed-up -over by @var{ch}. Returns @code{EOF} if this is not allowed. Putting -back the most recently read character is always allowed. (This method -corresponds to the C function @code{ungetc}.) -@end deftypefn - -@deftypefn Method istream& istream::unget () -Attempt to back up one character. -@end deftypefn - -@node Iostream -@section Input and output together: class @code{iostream} - -If you need to use the same stream for input and output, you can use an -object of the class @code{iostream}, which is derived from @emph{both} -@code{istream} and @code{ostream}. - -The constructors for @code{iostream} behave just like the constructors -for @code{istream}. - -@deftypefn Constructor {} iostream::iostream () -When used without arguments, the @code{iostream} constructor simply -allocates a new @code{ios} object, and initializes the input counter -(the value reported by @code{istream::gcount}) to @code{0}. -@end deftypefn - -@deftypefn Constructor {} iostream::iostream (streambuf* @var{sb} @w{[, ostream*} @var{tie}]) -You can also call a constructor with one or two arguments. The first -argument @var{sb} is a @code{streambuf*}; if you supply this pointer, -the constructor uses that @code{streambuf} for input and output. - -You can use the optional second argument @var{tie} (an @code{ostream*}) -to specify a related output stream as the initial value for -@code{ios::tie}. -@end deftypefn - -@cindex @code{iostream} destructor -@cindex destructor for @code{iostream} -As for @code{ostream} and @code{istream}, @code{iostream} simply uses -the @code{ios} destructor. However, an @code{iostream} is not deleted by -its destructor. - -You can use all the @code{istream}, @code{ostream}, and @code{ios} -methods with an @code{iostream} object. - -@node Files and Strings -@chapter Classes for Files and Strings - -There are two very common special cases of input and output: using files, -and using strings in memory. - -@code{libio} defines four specialized classes for these cases: - -@ftable @code -@item ifstream -Methods for reading files. - -@item ofstream -Methods for writing files. - -@item istrstream -Methods for reading strings from memory. - -@item ostrstream -Methods for writing strings in memory. -@end ftable - -@menu -* Files:: Reading and writing files. -* Strings:: Reading and writing strings in memory. -@end menu - -@node Files -@section Reading and writing files - -These methods are declared in @file{fstream.h}. - -@findex ifstream -@cindex class @code{ifstream} -You can read data from class @code{ifstream} with any operation from class -@code{istream}. There are also a few specialized facilities: - -@deftypefn Constructor {} ifstream::ifstream () -Make an @code{ifstream} associated with a new file for input. (If you -use this version of the constructor, you need to call -@code{ifstream::open} before actually reading anything) -@end deftypefn - -@deftypefn Constructor {} ifstream::ifstream (int @var{fd}) -Make an @code{ifstream} for reading from a file that was already open, -using file descriptor @var{fd}. (This constructor is compatible with -other versions of iostreams for @sc{posix} systems, but is not part of -the @sc{ansi} working paper.) -@end deftypefn - -@deftypefn Constructor {} ifstream::ifstream (const char* @var{fname} @w{[, int} @var{mode} @w{[, int} @var{prot}]]) -Open a file @code{*@var{fname}} for this @code{ifstream} object. - -By default, the file is opened for input (with @code{ios::in} as -@var{mode}). If you use this constructor, the file will be closed when -the @code{ifstream} is destroyed. - -You can use the optional argument @var{mode} to specify how to open the -file, by combining these enumerated values (with @samp{|} bitwise or). -(These values are actually defined in class @code{ios}, so that all -file-related streams may inherit them.) Only some of these modes are -defined in the latest draft @sc{ansi} specification; if portability is -important, you may wish to avoid the others. - -@vtable @code -@item ios::in -Open for input. (Included in @sc{ansi} draft.) - -@item ios::out -Open for output. (Included in @sc{ansi} draft.) - -@item ios::ate -Set the initial input (or output) position to the end of the file. - -@item ios::app -Seek to end of file before each write. (Included in @sc{ansi} draft.) - -@item ios::trunc -Guarantee a fresh file; discard any contents that were previously -associated with it. - -@item ios::nocreate -Guarantee an existing file; fail if the specified file did not already -exist. - -@item ios::noreplace -Guarantee a new file; fail if the specified file already existed. - -@item ios::bin -Open as a binary file (on systems where binary and text files have different -properties, typically how @samp{\n} is mapped; included in @sc{ansi} draft). -@end vtable - -@noindent -The last optional argument @var{prot} is specific to Unix-like systems; -it specifies the file protection (by default @samp{644}). -@end deftypefn - -@deftypefn Method void ifstream::open (const char* @var{fname} @w{[, int} @var{mode} @w{[, int} @var{prot}]]) -Open a file explicitly after the associated @code{ifstream} object -already exists (for instance, after using the default constructor). The -arguments, options and defaults all have the same meanings as in the -fully specified @code{ifstream} constructor. -@end deftypefn - -@findex ostream -@cindex class @code{ostream} -You can write data to class @code{ofstream} with any operation from class -@code{ostream}. There are also a few specialized facilities: - -@deftypefn Constructor {} ofstream::ofstream () -Make an @code{ofstream} associated with a new file for output. -@end deftypefn - -@deftypefn Constructor {} ofstream::ofstream (int @var{fd}) -Make an @code{ofstream} for writing to a file that was already open, -using file descriptor @var{fd}. -@end deftypefn - -@deftypefn Constructor {} ofstream::ofstream (const char* @var{fname} @w{[, int} @var{mode} @w{[, int} @var{prot}]]) -Open a file @code{*@var{fname}} for this @code{ofstream} object. - -By default, the file is opened for output (with @code{ios::out} as @var{mode}). -You can use the optional argument @var{mode} to specify how to open the -file, just as described for @code{ifstream::ifstream}. - -The last optional argument @var{prot} specifies the file protection (by -default @samp{644}). -@end deftypefn - -@deftypefn Destructor {} ofstream::~ofstream () -The files associated with @code{ofstream} objects are closed when the -corresponding object is destroyed. -@end deftypefn - -@deftypefn Method void ofstream::open (const char* @var{fname} @w{[, int} @var{mode} @w{[, int} @var{prot}]]) -Open a file explicitly after the associated @code{ofstream} object -already exists (for instance, after using the default constructor). The -arguments, options and defaults all have the same meanings as in the -fully specified @code{ofstream} constructor. -@end deftypefn - -@findex fstream -@cindex class @code{fstream} -The class @code{fstream} combines the facilities of @code{ifstream} and -@code{ofstream}, just as @code{iostream} combines @code{istream} and -@code{ostream}. - -@c FIXME-future: say something about fstream constructor, maybe. - -@findex fstreambase -@cindex class @code{fstreambase} -The class @code{fstreambase} underlies both @code{ifstream} and -@code{ofstream}. They both inherit this additional method: - -@deftypefn Method void fstreambase::close () -Close the file associated with this object, and set @code{ios::fail} in -this object to mark the event. -@end deftypefn - -@node Strings -@section Reading and writing in memory - -@c FIXME!! Per, there's a lot of guesswork here---please check carefully! - -@findex istrstream -@cindex class @code{istrstream} -@findex ostrstream -@cindex class @code{ostrstream} -@findex strstream -@cindex class @code{strstream} -@findex strstreambase -@cindex class @code{strstreambase} -@findex strstreambuf -@cindex class @code{strstreambuf} -The classes @code{istrstream}, @code{ostrstream}, and @code{strstream} -provide some additional features for reading and writing strings in -memory---both static strings, and dynamically allocated strings. The -underlying class @code{strstreambase} provides some features common to -all three; @code{strstreambuf} underlies that in turn. - -@c FIXME-future: Document strstreambuf methods one day, when we document -@c streambuf more fully. - -@deftypefn Constructor {} istrstream::istrstream (const char* @var{str} @w{[, int} @var{size}]) -Associate the new input string class @code{istrstream} with an existing -static string starting at @var{str}, of size @var{size}. If you do not -specify @var{size}, the string is treated as a @code{NUL} terminated string. -@end deftypefn - -@deftypefn Constructor {} ostrstream::ostrstream () -Create a new stream for output to a dynamically managed string, which -will grow as needed. -@end deftypefn - -@deftypefn Constructor {} ostrstream::ostrstream (char* @var{str}, int @var{size} [,int @var{mode}]) -A new stream for output to a statically defined string of length -@var{size}, starting at @var{str}. You may optionally specify one of -the modes described for @code{ifstream::ifstream}; if you do not specify -one, the new stream is simply open for output, with mode @code{ios::out}. -@end deftypefn - -@deftypefn Method int ostrstream::pcount () -Report the current length of the string associated with this @code{ostrstream}. -@end deftypefn - -@deftypefn Method char* ostrstream::str () -A pointer to the string managed by this @code{ostrstream}. Implies -@samp{ostrstream::freeze()}. - -Note that if you want the string to be nul-terminated, -you must do that yourself (perhaps by writing ends to the stream). -@end deftypefn - -@deftypefn Method void ostrstream::freeze ([int @var{n}]) -If @var{n} is nonzero (the default), declare that the string associated -with this @code{ostrstream} is not to change dynamically; while frozen, -it will not be reallocated if it needs more space, and it will not be -deallocated when the @code{ostrstream} is destroyed. Use -@samp{freeze(1)} if you refer to the string as a pointer after creating -it via @code{ostrstream} facilities. - -@samp{freeze(0)} cancels this declaration, allowing a dynamically -allocated string to be freed when its @code{ostrstream} is destroyed. - -If this @code{ostrstream} is already static---that is, if it was created -to manage an existing statically allocated string---@code{freeze} is -unnecessary, and has no effect. -@end deftypefn - -@deftypefn Method int ostrstream::frozen () -Test whether @code{freeze(1)} is in effect for this string. -@end deftypefn - -@deftypefn Method strstreambuf* strstreambase::rdbuf () -A pointer to the underlying @code{strstreambuf}. -@end deftypefn - -@node Streambuf -@chapter Using the @code{streambuf} Layer - -The @code{istream} and @code{ostream} classes are meant to handle -conversion between objects in your program and their textual representation. - -By contrast, the underlying @code{streambuf} class is for transferring -raw bytes between your program, and input sources or output sinks. -Different @code{streambuf} subclasses connect to different kinds of -sources and sinks. - -The @sc{gnu} implementation of @code{streambuf} is still evolving; we -describe only some of the highlights. - -@menu -* Areas:: Areas in a streambuf. -* Overflow:: Simple output re-direction -* Formatting:: C-style formatting for streambuf objects. -* Stdiobuf:: Wrappers for C stdio. -* Procbuf:: Reading/writing from/to a pipe -* Backing Up:: Marking and returning to a position. -* Indirectbuf:: Forwarding I/O activity. -@end menu - -@node Areas -@section Areas of a @code{streambuf} - -Streambuf buffer management is fairly sophisticated (this is a -nice way to say ``complicated''). The standard protocol -has the following ``areas'': - -@itemize @bullet -@item -@cindex put area -The @dfn{put area} contains characters waiting for output. - -@item -@cindex get area -The @dfn{get area} contains characters available for reading. -@end itemize - -The @sc{gnu} @code{streambuf} design extends this, but the details are -still evolving. - -The following methods are used to manipulate these areas. -These are all protected methods, which are intended to be -used by virtual function in classes derived from @code{streambuf}. -They are also all ANSI/ISO-standard, and the ugly names -are traditional. -(Note that if a pointer points to the 'end' of an area, -it means that it points to the character after the area.) - -@deftypefn Method char* streambuf::pbase () const -Returns a pointer to the start of the put area. -@end deftypefn - -@deftypefn Method char* streambuf::epptr () const -Returns a pointer to the end of the put area. -@end deftypefn - -@deftypefn Method char* streambuf::pptr () const -If @code{pptr() < epptr ()}, the @code{pptr()} -returns a pointer to the current put position. -(In that case, the next write will -overwrite @code{*pptr()}, and increment @code{pptr()}.) -Otherwise, there is no put position available -(and the next character written will cause @code{streambuf::overflow} -to be called). -@end deftypefn - -@deftypefn Method void streambuf::pbump (int @var{N}) -Add @var{N} to the current put pointer. -No error checking is done. -@end deftypefn - -@deftypefn Method void streambuf::setp (char* @var{P}, char* @var{E}) -Sets the start of the put area to @var{P}, the end of the put area to @var{E}, -and the current put pointer to @var{P} (also). -@end deftypefn - -@deftypefn Method char* streambuf::eback () const -Returns a pointer to the start of the get area. -@end deftypefn - -@deftypefn Method char* streambuf::egptr () const -Returns a pointer to the end of the get area. -@end deftypefn - -@deftypefn Method char* streambuf::gptr () const -If @code{gptr() < egptr ()}, then @code{gptr()} -returns a pointer to the current get position. -(In that case the next read will read @code{*gptr()}, -and possibly increment @code{gptr()}.) -Otherwise, there is no read position available -(and the next read will cause @code{streambuf::underflow} -to be called). -@end deftypefn - -@deftypefn Method void streambuf:gbump (int @var{N}) -Add @var{N} to the current get pointer. -No error checking is done. -@end deftypefn - -@deftypefn Method void streambuf::setg (char* @var{B}, char* @var{P}, char* @var{E}) -Sets the start of the get area to @var{B}, the end of the get area to @var{E}, -and the current put pointer to @var{P}. -@end deftypefn - -@node Overflow -@section Simple output re-direction by redefining @code{overflow} - -Suppose you have a function @code{write_to_window} that -writes characters to a @code{window} object. If you want to use the -ostream function to write to it, here is one (portable) way to do it. -This depends on the default buffering (if any). - -@cartouche -@smallexample -#include -/* Returns number of characters successfully written to @var{win}. */ -extern int write_to_window (window* win, char* text, int length); - -class windowbuf : public streambuf @{ - window* win; - public: - windowbuf (window* w) @{ win = w; @} - int sync (); - int overflow (int ch); - // Defining xsputn is an optional optimization. - // (streamsize was recently added to ANSI C++, not portable yet.) - streamsize xsputn (char* text, streamsize n); -@}; - -int windowbuf::sync () -@{ streamsize n = pptr () - pbase (); - return (n && write_to_window (win, pbase (), n) != n) ? EOF : 0; -@} - -int windowbuf::overflow (int ch) -@{ streamsize n = pptr () - pbase (); - if (n && sync ()) - return EOF; - if (ch != EOF) - @{ - char cbuf[1]; - cbuf[0] = ch; - if (write_to_window (win, cbuf, 1) != 1) - return EOF; - @} - pbump (-n); // Reset pptr(). - return 0; -@} - -streamsize windowbuf::xsputn (char* text, streamsize n) -@{ return sync () == EOF ? 0 : write_to_window (win, text, n); @} - -int -main (int argc, char**argv) -@{ - window *win = ...; - windowbuf wbuf(win); - ostream wstr(&wbuf); - wstr << "Hello world!\n"; -@} -@end smallexample -@end cartouche - - - -@node Formatting -@section C-style formatting for @code{streambuf} objects - -The @sc{gnu} @code{streambuf} class supports @code{printf}-like -formatting and scanning. - -@deftypefn Method int streambuf::form (const char *@var{format}, ...) -Similar to @code{fprintf(@var{file}, @var{format}, ...)}. -The @var{format} is a @code{printf}-style format control string, which is used -to format the (variable number of) arguments, printing the result on -the @code{this} streambuf. The result is the number of characters printed. -@end deftypefn - -@deftypefn Method int streambuf::vform (const char *@var{format}, va_list @var{args}) -Similar to @code{vfprintf(@var{file}, @var{format}, @var{args})}. -The @var{format} is a @code{printf}-style format control string, which is used -to format the argument list @var{args}, printing the result on -the @code{this} streambuf. The result is the number of characters printed. -@end deftypefn - -@deftypefn Method int streambuf::scan (const char *@var{format}, ...) -Similar to @code{fscanf(@var{file}, @var{format}, ...)}. -The @var{format} is a @code{scanf}-style format control string, which is used -to read the (variable number of) arguments from the @code{this} streambuf. -The result is the number of items assigned, or @code{EOF} in case of -input failure before any conversion. -@end deftypefn - -@deftypefn Method int streambuf::vscan (const char *@var{format}, va_list @var{args}) -Like @code{streambuf::scan}, but takes a single @code{va_list} argument. -@end deftypefn - -@node Stdiobuf -@section Wrappers for C @code{stdio} - -A @dfn{stdiobuf} is a @code{streambuf} object that points to -a @code{FILE} object (as defined by @code{stdio.h}). -All @code{streambuf} operations on the @code{stdiobuf} are forwarded -to the @code{FILE}. Thus the @code{stdiobuf} object provides a -wrapper around a @code{FILE}, allowing use of @code{streambuf} -operations on a @code{FILE}. This can be useful when mixing -C code with C++ code. - -The pre-defined streams @code{cin}, @code{cout}, and @code{cerr} are -normally implemented as @code{stdiobuf} objects that point to -respectively @code{stdin}, @code{stdout}, and @code{stderr}. This is -convenient, but it does cost some extra overhead. - -If you set things up to use the implementation of @code{stdio} provided -with this library, then @code{cin}, @code{cout}, and @code{cerr} will be -set up to use @code{stdiobuf} objects, since you get their benefits -for free. @xref{Stdio,,C Input and Output}. - -@ignore -@c FIXME-future: setbuf is not yet documented, hence this para is not useful. -Note that if you use @code{setbuf} to give a buffer to a @code{stdiobuf}, -that buffer will provide intermediate buffering in addition that -whatever is done by the @code{FILE}. -@end ignore - -@node Procbuf -@section Reading/writing from/to a pipe - -The @dfn{procbuf} class is a @sc{gnu} extension. It is derived from -@code{streambuf}. A @code{procbuf} can be @dfn{closed} (in which case -it does nothing), or @dfn{open} (in which case it allows communicating -through a pipe with some other program). - -@deftypefn Constructor {} procbuf::procbuf () -Creates a @code{procbuf} in a @dfn{closed} state. -@end deftypefn - -@deftypefn Method procbuf* procbuf::open (const char *@var{command}, int @var{mode}) -Uses the shell (@file{/bin/sh}) to run a program specified by @var{command}. - -If @var{mode} is @samp{ios::in}, standard output from the program is sent -to a pipe; you can read from the pipe by reading from the -@code{procbuf}. (This is similar to @w{@samp{popen(@var{command}, "r")}}.) - -If @var{mode} is @samp{ios::out}, output written to the -@code{procbuf} is written to a pipe; the program is set up to read its -standard input from (the other end of) the pipe. (This is similar to -@w{@samp{popen(@var{command}, "w")}}.) - -The @code{procbuf} must start out in the @dfn{closed} state. -Returns @samp{*this} on success, and @samp{NULL} on failure. -@end deftypefn - -@deftypefn Constructor {} procbuf::procbuf (const char *@var{command}, int @var{mode}) -Calls @samp{procbuf::open (@var{command}, @var{mode})}. -@end deftypefn - -@deftypefn Method procbuf* procbuf::close () -Waits for the program to finish executing, -and then cleans up the resources used. -Returns @samp{*this} on success, and @samp{NULL} on failure. -@end deftypefn - -@deftypefn Destructor {} procbuf::~procbuf () -Calls @samp{procbuf::close}. -@end deftypefn - -@node Backing Up -@section Backing up - -The @sc{gnu} iostream library allows you to ask a @code{streambuf} to -remember the current position. This allows you to go back to this -position later, after reading further. You can back up arbitrary -amounts, even on unbuffered files or multiple buffers' worth, as long as -you tell the library in advance. This unbounded backup is very useful -for scanning and parsing applications. This example shows a typical -scenario: - -@cartouche -@smallexample -// Read either "dog", "hound", or "hounddog". -// If "dog" is found, return 1. -// If "hound" is found, return 2. -// If "hounddog" is found, return 3. -// If none of these are found, return -1. -int my_scan(streambuf* sb) -@{ - streammarker fence(sb); - char buffer[20]; - // Try reading "hounddog": - if (sb->sgetn(buffer, 8) == 8 - && strncmp(buffer, "hounddog", 8) == 0) - return 3; - // No, no "hounddog": Back up to 'fence' - sb->seekmark(fence); // - // ... and try reading "dog": - if (sb->sgetn(buffer, 3) == 3 - && strncmp(buffer, "dog", 3) == 0) - return 1; - // No, no "dog" either: Back up to 'fence' - sb->seekmark(fence); // - // ... and try reading "hound": - if (sb->sgetn(buffer, 5) == 5 - && strncmp(buffer, "hound", 5) == 0) - return 2; - // No, no "hound" either: Back up and signal failure. - sb->seekmark(fence); // Backup to 'fence' - return -1; -@} -@end smallexample -@end cartouche - -@deftypefn Constructor {} streammarker::streammarker (streambuf* @var{sbuf}) -Create a @code{streammarker} associated with @var{sbuf} -that remembers the current position of the get pointer. -@end deftypefn - -@deftypefn Method int streammarker::delta (streammarker& @var{mark2}) -Return the difference between the get positions corresponding -to @code{*this} and @var{mark2} (which must point into the same -@code{streambuffer} as @code{this}). -@end deftypefn - -@deftypefn Method int streammarker::delta () -Return the position relative to the streambuffer's current get position. -@end deftypefn - -@deftypefn Method int streambuf::seekmark (streammarker& @var{mark}) -Move the get pointer to where it (logically) was when @var{mark} -was constructed. -@end deftypefn - -@node Indirectbuf -@section Forwarding I/O activity - -An @dfn{indirectbuf} is one that forwards all of its I/O requests -to another streambuf. - -@ignore -@c FIXME-future: get_stream and put_stream are so far undocumented. -All get-related requests are sent to get_stream(). -All put-related requests are sent to put_stream(). -@end ignore - -An @code{indirectbuf} can be used to implement Common Lisp -synonym-streams and two-way-streams: - -@example -class synonymbuf : public indirectbuf @{ - Symbol *sym; - synonymbuf(Symbol *s) @{ sym = s; @} - virtual streambuf *lookup_stream(int mode) @{ - return coerce_to_streambuf(lookup_value(sym)); @} -@}; -@end example - -@node Stdio -@chapter C Input and Output - -@code{libio} is distributed with a complete implementation of the ANSI C -@code{stdio} facility. It is implemented using @code{streambuf} -objects. @xref{Stdiobuf,,Wrappers for C @code{stdio}}. - -The @code{stdio} package is intended as a replacement for the whatever -@code{stdio} is in your C library. -@ignore -@c FIXME-future: This is not useful unless we specify what problems. -It can co-exist with C libraries that have alternate implementations of -stdio, but there may be some problems. -@end ignore -Since @code{stdio} works best when you build @code{libc} to contain it, and -that may be inconvenient, it is not installed by default. - -Extensions beyond @sc{ansi}: - -@itemize @bullet -@item -A stdio @code{FILE} is identical to a streambuf. -Hence there is no need to worry about synchronizing C and C++ -input/output---they are by definition always synchronized. - -@item -If you create a new streambuf sub-class (in C++), you can use it as a -@code{FILE} from C. Thus the system is extensible using the standard -@code{streambuf} protocol. - -@item -You can arbitrarily mix reading and writing, without having to seek -in between. - -@item -Unbounded @code{ungetc()} buffer. -@end itemize - -@ignore -@c FIXME-future: Per says this is not ready to go public at v0.5 -@node Libio buffer management -@chapter Libio buffer management - -The libio user functions present an abstract sequence of characters, -that they read and write from. A number of buffers are used to go -between the user program and the abstract sequence. These buffers are -concrete arrays of characters that contain some sub-sequence of the -abstract sequence. - -The libio buffer management protocol is fairly complex. Its design is -based on the C++ @code{streambuf} protocol, so that the C++ -@code{streambuf} classes can be trivially implemented on top of the -libio protocol. - -The @dfn{write area} contains characters waiting for output. - -The @dfn{read area} contains characters available for reading. - -The @dfn{reserve area} is available to virtual methods. -Usually, the get and/or put areas are part of the reserve area. - -The @dfn{main get area} contains characters that have -been read in from the character source, but not yet -read by the application. - -The @dfn{backup area} contains previously read data that is being saved -because of a user request, or that have been "unread" (put back). -@end ignore - -@ignore -@c Per says this design is not finished -@node Streambuf internals -@chapter Streambuf internals - -@menu -* Buffer management:: -* Filebuf internals:: -@end menu - -@node Buffer management -@section Buffer management - -@subsection Areas - -NOTE: This chapter is due for an update. - -Streambuf buffer management is fairly sophisticated (this is a -nice way to say "complicated"). The standard protocol -has the following "areas": - -@itemize @bullet -@cindex put area -@item -The @dfn{put area} contains characters waiting for output. -@cindex get area -@item -The @dfn{get area} contains characters available for reading. -@cindex reserve area -@item -The @dfn{reserve area} is available to virtual methods. -Usually, the get and/or put areas are part of the reserve area. -@end itemize - -The @sc{gnu} @code{streambuf} design extends this by supporting two -get areas: -@itemize @bullet -@cindex main get area -@item -The @dfn{main get area} contains characters that have -been read in from the character source, but not yet -read by the application. -@cindex backup area -@item -The @dfn{backup area} contains previously read data that is being -saved because of a user request, or that have been "unread" (putback). -@end itemize - -The backup and the main get area are logically contiguous: That is, -the first character of the main get area follows the last character -of the backup area. - -The @dfn{current get area} is whichever one of the backup or -main get areas that is currently being read from. -The other of the two is the @dfn{non-current get area}. - -@subsection Pointers - -The following @code{char*} pointers define the various areas. - -@deftypefn Method char* streambuf::base () -The start of the reserve area. -@end deftypefn - -@deftypefn Method char* streambuf::ebuf () -The end of the reserve area. -@end deftypefn - -@deftypefn Method char* streambuf::Gbase () -The start of the main get area. -@end deftypefn - -@deftypefn Method char* streambuf::eGptr () -The end of the main get area. -@end deftypefn - -@deftypefn Method char* streambuf::Bbase () -The start of the backup area. -@end deftypefn - -@deftypefn Method char* streambuf::Bptr () -The start of the used part of the backup area. -The area (@code{Bptr()} .. @code{eBptr()}) contains data that has been -pushed back, while (@code{Bbase()} .. @code{eBptr()}) contains unused -space available for future putbacks. -@end deftypefn - -@deftypefn Method char* streambuf::eBptr () -The end of the backup area. -@end deftypefn - -@deftypefn Method char* streambuf::Nbase () -The start of the non-current get area (either @code{main_gbase} or @code{backup_gbase}). -@end deftypefn - -@deftypefn Method char* streambuf::eNptr () -The end of the non-current get area. -@end deftypefn - -@node Filebuf internals -@section Filebuf internals - -The @code{filebuf} is used a lot, so it is importamt that it be -efficient. It is also supports rather complex semantics. -so let us examine its implementation. - -@subsection Tied read and write pointers - -The streambuf model allows completely independent read and write pointers. -However, a @code{filebuf} has only a single logical pointer used -for both reads and writes. Since the @code{streambuf} protocol -uses @code{gptr()} for reading and @code{pptr()} for writing, -we map the logical file pointer into either @code{gptr()} or @code{pptr()} -at different times. - -@itemize @bullet -@item -Reading is allowed when @code{gptr() < egptr()}, which we call get mode. - -@item -Writing is allowed when @code{pptr() < epptr()}, which we call put mode. -@end itemize - -@noindent -A @code{filebuf} cannot be in get mode and put mode at the same time. - -We have up to two buffers: - -@itemize @bullet -@item -The backup area, defined by @code{Bbase()}, @code{Bptr()}, and @code{eBptr()}. -This can be empty. - -@item -The reserve area, which also contains the main get area. -For an unbuffered file, the (@code{shortbuf()}..@code{shortbuf()+1}) is used, -where @code{shortbuf()} points to a 1-byte buffer that is part of -the @code{filebuf}. -@end itemize - -@noindent -The file system's idea of the current position is @code{eGptr()}. - -Characters that have been written into a buffer but not yet written -out (flushed) to the file systems are those between @code{pbase()} -and @code{pptr()}. - -The end of the valid data bytes is: -@code{pptr() > eGptr() && pptr() < ebuf() ? pptr() : eGptr()}. - -If the @code{filebuf} is unbuffered or line buffered, -the @code{eptr()} is @code{pbase()}. This forces a call -to @code{overflow()} on each put of a character. -The logical @code{epptr()} is @code{epptr() ? ebuf() : NULL}. -(If the buffer is read-only, set @code{pbase()}, @code{pptr()}, -and @code{epptr()} to @code{NULL}. NOT!) -@end ignore - -@node Index -@unnumbered Index -@printindex cp - -@contents -@bye diff --git a/contrib/libio/iostreamP.h b/contrib/libio/iostreamP.h deleted file mode 100644 index c9c40cb6ba..0000000000 --- a/contrib/libio/iostreamP.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "streambuf.h" -#include "libioP.h" diff --git a/contrib/libio/iostrerror.c b/contrib/libio/iostrerror.c deleted file mode 100644 index 348e0956d7..0000000000 --- a/contrib/libio/iostrerror.c +++ /dev/null @@ -1,12 +0,0 @@ -/* This should be replaced by whatever namespace-clean - version of strerror you have available. */ - -#include "libioP.h" -extern char *strerror __P ((int)); - -char * -_IO_strerror (errnum) - int errnum; -{ - return strerror(errnum); -} diff --git a/contrib/libio/ioungetc.c b/contrib/libio/ioungetc.c deleted file mode 100644 index 07f38e747b..0000000000 --- a/contrib/libio/ioungetc.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "libioP.h" - -int -_IO_ungetc (c, fp) - int c; - _IO_FILE *fp; -{ - int result; - CHECK_FILE (fp, EOF); - if (c == EOF) - return EOF; - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - result = _IO_sputbackc (fp, (unsigned char) c); - _IO_cleanup_region_end (1); - return result; -} - -#ifdef weak_alias -weak_alias (_IO_ungetc, ungetc) -#endif diff --git a/contrib/libio/iovfprintf.c b/contrib/libio/iovfprintf.c deleted file mode 100644 index 755334c2bf..0000000000 --- a/contrib/libio/iovfprintf.c +++ /dev/null @@ -1,890 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* - * Copyright (c) 1990 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "%W% (Berkeley) %G%"; -#endif /* LIBC_SCCS and not lint */ - -/* - * Actual printf innards. - * - * This code is large and complicated... - */ - -#include -#include "libioP.h" -#include -#ifdef __STDC__ -#include -#else -#include -#endif - -#ifndef _IO_USE_DTOA -int __cvt_double __P((double number, register int prec, int flags, int *signp, int fmtch, char *startp, char *endp)); -#endif - -/* - * Define FLOATING_POINT to get floating point. - */ -#ifndef NO_FLOATING_POINT -#define FLOATING_POINT -#endif - -/* end of configuration stuff */ - - -/* - * Helper "class" for `fprintf to unbuffered': creates a - * temporary buffer. */ - -struct helper_file -{ - struct _IO_FILE_plus _f; - _IO_FILE *_put_stream; -}; - -static int -_IO_helper_overflow (fp, c) - _IO_FILE *fp; - int c; -{ - _IO_FILE *target = ((struct helper_file*)fp)->_put_stream; - int used = fp->_IO_write_ptr - fp->_IO_write_base; - if (used) - { - _IO_sputn(target, fp->_IO_write_base, used); - fp->_IO_write_ptr -= used; - } - return _IO_putc (c, fp); -} - -static struct _IO_jump_t _IO_helper_jumps = { - JUMP_INIT_DUMMY, - JUMP_INIT(finish, _IO_default_finish), - JUMP_INIT(overflow, _IO_helper_overflow), - JUMP_INIT(underflow, _IO_default_underflow), - JUMP_INIT(uflow, _IO_default_uflow), - JUMP_INIT(pbackfail, _IO_default_pbackfail), - JUMP_INIT(xsputn, _IO_default_xsputn), - JUMP_INIT(xsgetn, _IO_default_xsgetn), - JUMP_INIT(seekoff, _IO_default_seekoff), - JUMP_INIT(seekpos, _IO_default_seekpos), - JUMP_INIT(setbuf, _IO_default_setbuf), - JUMP_INIT(sync, _IO_default_sync), - JUMP_INIT(doallocate, _IO_default_doallocate), - JUMP_INIT(read, _IO_default_read), - JUMP_INIT(write, _IO_default_write), - JUMP_INIT(seek, _IO_default_seek), - JUMP_INIT(close, _IO_default_close), - JUMP_INIT(stat, _IO_default_stat) -}; - -static int -helper_vfprintf (fp, fmt0, ap) - _IO_FILE *fp; - char const *fmt0; - _IO_va_list ap; -{ - char buf[_IO_BUFSIZ]; - struct helper_file helper; - register _IO_FILE *hp = (_IO_FILE*)&helper; - int result, to_flush; - - /* initialize helper */ - helper._put_stream = fp; - hp->_IO_write_base = buf; - hp->_IO_write_ptr = buf; - hp->_IO_write_end = buf+_IO_BUFSIZ; - hp->_IO_file_flags = _IO_MAGIC|_IO_NO_READS; - _IO_JUMPS(hp) = &_IO_helper_jumps; - - /* Now print to helper instead. */ - result = _IO_vfprintf(hp, fmt0, ap); - - /* Now flush anything from the helper to the fp. */ - if ((to_flush = hp->_IO_write_ptr - hp->_IO_write_base) > 0) - { - if (_IO_sputn(fp, hp->_IO_write_base, to_flush) != to_flush) - return EOF; - } - return result; -} - -#ifdef FLOATING_POINT - -#include "floatio.h" -#define BUF (MAXEXP+MAXFRACT+1) /* + decimal point */ -#define DEFPREC 6 -extern double modf __P((double, double*)); - -#else /* no FLOATING_POINT */ - -#define BUF 40 - -#endif /* FLOATING_POINT */ - - -/* - * Macros for converting digits to letters and vice versa - */ -#define to_digit(c) ((c) - '0') -#define is_digit(c) ((unsigned)to_digit(c) <= 9) -#define to_char(n) ((n) + '0') - -/* - * Flags used during conversion. - */ -#define LONGINT 0x01 /* long integer */ -#define LONGDBL 0x02 /* long double; unimplemented */ -#define SHORTINT 0x04 /* short integer */ -#define ALT 0x08 /* alternate form */ -#define LADJUST 0x10 /* left adjustment */ -#define ZEROPAD 0x20 /* zero (as opposed to blank) pad */ -#define HEXPREFIX 0x40 /* add 0x or 0X prefix */ - -int -_IO_vfprintf (fp, fmt0, ap) - _IO_FILE *fp; - char const *fmt0; - _IO_va_list ap; -{ - register const char *fmt; /* format string */ - register int ch; /* character from fmt */ - register int n; /* handy integer (short term usage) */ - register char *cp; /* handy char pointer (short term usage) */ - const char *fmark; /* for remembering a place in fmt */ - register int flags; /* flags as above */ - int ret; /* return value accumulator */ - int width; /* width from format (%8d), or 0 */ - int prec; /* precision from format (%.3d), or -1 */ - char sign; /* sign prefix (' ', '+', '-', or \0) */ -#ifdef FLOATING_POINT - int softsign; /* temporary negative sign for floats */ - double _double; /* double precision arguments %[eEfgG] */ -#ifndef _IO_USE_DTOA - int fpprec; /* `extra' floating precision in [eEfgG] */ -#endif -#endif - unsigned long _ulong; /* integer arguments %[diouxX] */ - enum { OCT, DEC, HEX } base;/* base for [diouxX] conversion */ - int dprec; /* a copy of prec if [diouxX], 0 otherwise */ - int dpad; /* extra 0 padding needed for integers */ - int fieldsz; /* field size expanded by sign, dpad etc */ - /* The initialization of 'size' is to suppress a warning that - 'size' might be used unitialized. It seems gcc can't - quite grok this spaghetti code ... */ - int size = 0; /* size of converted field or string */ - char buf[BUF]; /* space for %c, %[diouxX], %[eEfgG] */ - char ox[2]; /* space for 0x hex-prefix */ - - /* - * BEWARE, these `goto error' on error, and PAD uses `n'. - */ -#define PRINT(ptr, len) \ - do { if (_IO_sputn(fp,ptr, len) != len) goto error; } while (0) -#define PAD_SP(howmany) if (_IO_padn(fp, ' ', howmany) < (howmany)) goto error; -#define PAD_0(howmany) if (_IO_padn(fp, '0', howmany) < (howmany)) goto error; - - /* - * To extend shorts properly, we need both signed and unsigned - * argument extraction methods. - */ -#define SARG() \ - (flags&LONGINT ? va_arg(ap, long) : \ - flags&SHORTINT ? (long)(short)va_arg(ap, int) : \ - (long)va_arg(ap, int)) -#define UARG() \ - (flags&LONGINT ? va_arg(ap, unsigned long) : \ - flags&SHORTINT ? (unsigned long)(unsigned short)va_arg(ap, int) : \ - (unsigned long)va_arg(ap, unsigned int)) - - /* optimise stderr (and other unbuffered Unix files) */ - if (fp->_IO_file_flags & _IO_UNBUFFERED) - return helper_vfprintf(fp, fmt0, ap); - - fmt = fmt0; - ret = 0; - - /* - * Scan the format for conversions (`%' character). - */ - for (;;) { - for (fmark = fmt; (ch = *fmt) != '\0' && ch != '%'; fmt++) - /* void */; - if ((n = fmt - fmark) != 0) { - PRINT(fmark, n); - ret += n; - } - if (ch == '\0') - goto done; - fmt++; /* skip over '%' */ - - flags = 0; - dprec = 0; -#if defined(FLOATING_POINT) && !defined (_IO_USE_DTOA) - fpprec = 0; -#endif - width = 0; - prec = -1; - sign = '\0'; - -rflag: ch = *fmt++; -reswitch: switch (ch) { - case ' ': - /* - * ``If the space and + flags both appear, the space - * flag will be ignored.'' - * -- ANSI X3J11 - */ - if (!sign) - sign = ' '; - goto rflag; - case '#': - flags |= ALT; - goto rflag; - case '*': - /* - * ``A negative field width argument is taken as a - * - flag followed by a positive field width.'' - * -- ANSI X3J11 - * They don't exclude field widths read from args. - */ - if ((width = va_arg(ap, int)) >= 0) - goto rflag; - width = -width; - /* FALLTHROUGH */ - case '-': - flags |= LADJUST; - flags &= ~ZEROPAD; /* '-' disables '0' */ - goto rflag; - case '+': - sign = '+'; - goto rflag; - case '.': - if ((ch = *fmt++) == '*') { - n = va_arg(ap, int); - prec = n < 0 ? -1 : n; - goto rflag; - } - n = 0; - while (is_digit(ch)) { - n = 10 * n + to_digit(ch); - ch = *fmt++; - } - prec = n < 0 ? -1 : n; - goto reswitch; - case '0': - /* - * ``Note that 0 is taken as a flag, not as the - * beginning of a field width.'' - * -- ANSI X3J11 - */ - if (!(flags & LADJUST)) - flags |= ZEROPAD; /* '-' disables '0' */ - goto rflag; - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - n = 0; - do { - n = 10 * n + to_digit(ch); - ch = *fmt++; - } while (is_digit(ch)); - width = n; - goto reswitch; -#ifdef FLOATING_POINT - case 'L': - flags |= LONGDBL; - goto rflag; -#endif - case 'h': - flags |= SHORTINT; - goto rflag; - case 'l': - flags |= LONGINT; - goto rflag; - case 'c': - *(cp = buf) = va_arg(ap, int); - size = 1; - sign = '\0'; - break; - case 'D': - flags |= LONGINT; - /*FALLTHROUGH*/ - case 'd': - case 'i': - _ulong = SARG(); - if ((long)_ulong < 0) { - _ulong = -_ulong; - sign = '-'; - } - base = DEC; - goto number; -#ifdef FLOATING_POINT - case 'e': - case 'E': - case 'f': - case 'F': - case 'g': - case 'G': - _double = va_arg(ap, double); -#ifdef _IO_USE_DTOA - { - int fmt_flags = 0; - int fill = ' '; - if (flags & ALT) - fmt_flags |= _IO_SHOWPOINT; - if (flags & LADJUST) - fmt_flags |= _IO_LEFT; - else if (flags & ZEROPAD) - fmt_flags |= _IO_INTERNAL, fill = '0'; - n = _IO_outfloat(_double, fp, ch, width, - prec < 0 ? DEFPREC : prec, - fmt_flags, sign, fill); - if (n < 0) - goto error; - ret += n; - } - /* CHECK ERROR! */ - continue; -#else - /* - * don't do unrealistic precision; just pad it with - * zeroes later, so buffer size stays rational. - */ - if (prec > MAXFRACT) { - if ((ch != 'g' && ch != 'G') || (flags&ALT)) - fpprec = prec - MAXFRACT; - prec = MAXFRACT; - } else if (prec == -1) - prec = DEFPREC; - /* __cvt_double may have to round up before the - "start" of its buffer, i.e. - ``intf("%.2f", (double)9.999);''; - if the first character is still NUL, it did. - softsign avoids negative 0 if _double < 0 but - no significant digits will be shown. */ - cp = buf; - *cp = '\0'; - size = __cvt_double(_double, prec, flags, &softsign, - ch, cp, buf + sizeof(buf)); - if (softsign) - sign = '-'; - if (*cp == '\0') - cp++; - break; -#endif -#endif /* FLOATING_POINT */ - case 'n': - if (flags & LONGINT) - *va_arg(ap, long *) = ret; - else if (flags & SHORTINT) - *va_arg(ap, short *) = ret; - else - *va_arg(ap, int *) = ret; - continue; /* no output */ - case 'O': - flags |= LONGINT; - /*FALLTHROUGH*/ - case 'o': - _ulong = UARG(); - base = OCT; - goto nosign; - case 'p': - /* - * ``The argument shall be a pointer to void. The - * value of the pointer is converted to a sequence - * of printable characters, in an implementation- - * defined manner.'' - * -- ANSI X3J11 - */ - /* NOSTRICT */ - _ulong = (unsigned long)va_arg(ap, void *); - base = HEX; - flags |= HEXPREFIX; - ch = 'x'; - goto nosign; - case 's': - if ((cp = va_arg(ap, char *)) == NULL) - cp = "(null)"; - if (prec >= 0) { - /* - * can't use strlen; can only look for the - * NUL in the first `prec' characters, and - * strlen() will go further. - */ - char *p = (char*)memchr(cp, 0, prec); - - if (p != NULL) { - size = p - cp; - if (size > prec) - size = prec; - } else - size = prec; - } else - size = strlen(cp); - sign = '\0'; - break; - case 'U': - flags |= LONGINT; - /*FALLTHROUGH*/ - case 'u': - _ulong = UARG(); - base = DEC; - goto nosign; - case 'X': - case 'x': - _ulong = UARG(); - base = HEX; - /* leading 0x/X only if non-zero */ - if (flags & ALT && _ulong != 0) - flags |= HEXPREFIX; - - /* unsigned conversions */ -nosign: sign = '\0'; - /* - * ``... diouXx conversions ... if a precision is - * specified, the 0 flag will be ignored.'' - * -- ANSI X3J11 - */ -number: if ((dprec = prec) >= 0) - flags &= ~ZEROPAD; - - /* - * ``The result of converting a zero value with an - * explicit precision of zero is no characters.'' - * -- ANSI X3J11 - */ - cp = buf + BUF; - if (_ulong != 0 || prec != 0) { - char *xdigs; /* digits for [xX] conversion */ - /* - * unsigned mod is hard, and unsigned mod - * by a constant is easier than that by - * a variable; hence this switch. - */ - switch (base) { - case OCT: - do { - *--cp = to_char(_ulong & 7); - _ulong >>= 3; - } while (_ulong); - /* handle octal leading 0 */ - if (flags & ALT && *cp != '0') - *--cp = '0'; - break; - - case DEC: - /* many numbers are 1 digit */ - while (_ulong >= 10) { - *--cp = to_char(_ulong % 10); - _ulong /= 10; - } - *--cp = to_char(_ulong); - break; - - case HEX: - if (ch == 'X') - xdigs = "0123456789ABCDEF"; - else /* ch == 'x' || ch == 'p' */ - xdigs = "0123456789abcdef"; - do { - *--cp = xdigs[_ulong & 15]; - _ulong >>= 4; - } while (_ulong); - break; - - default: - cp = "bug in vform: bad base"; - goto skipsize; - } - } - size = buf + BUF - cp; - skipsize: - break; - default: /* "%?" prints ?, unless ? is NUL */ - if (ch == '\0') - goto done; - /* pretend it was %c with argument ch */ - cp = buf; - *cp = ch; - size = 1; - sign = '\0'; - break; - } - - /* - * All reasonable formats wind up here. At this point, - * `cp' points to a string which (if not flags&LADJUST) - * should be padded out to `width' places. If - * flags&ZEROPAD, it should first be prefixed by any - * sign or other prefix; otherwise, it should be blank - * padded before the prefix is emitted. After any - * left-hand padding and prefixing, emit zeroes - * required by a decimal [diouxX] precision, then print - * the string proper, then emit zeroes required by any - * leftover floating precision; finally, if LADJUST, - * pad with blanks. - */ - - /* - * compute actual size, so we know how much to pad. - */ -#if defined(FLOATING_POINT) && !defined (_IO_USE_DTOA) - fieldsz = size + fpprec; -#else - fieldsz = size; -#endif - dpad = dprec - size; - if (dpad < 0) - dpad = 0; - - if (sign) - fieldsz++; - else if (flags & HEXPREFIX) - fieldsz += 2; - fieldsz += dpad; - - /* right-adjusting blank padding */ - if ((flags & (LADJUST|ZEROPAD)) == 0) - PAD_SP(width - fieldsz); - - /* prefix */ - if (sign) { - PRINT(&sign, 1); - } else if (flags & HEXPREFIX) { - ox[0] = '0'; - ox[1] = ch; - PRINT(ox, 2); - } - - /* right-adjusting zero padding */ - if ((flags & (LADJUST|ZEROPAD)) == ZEROPAD) - PAD_0(width - fieldsz); - - /* leading zeroes from decimal precision */ - PAD_0(dpad); - - /* the string or number proper */ - PRINT(cp, size); - -#if defined(FLOATING_POINT) && !defined (_IO_USE_DTOA) - /* trailing f.p. zeroes */ - PAD_0(fpprec); -#endif - - /* left-adjusting padding (always blank) */ - if (flags & LADJUST) - PAD_SP(width - fieldsz); - - /* finally, adjust ret */ - ret += width > fieldsz ? width : fieldsz; - - } -done: - return ret; -error: - return EOF; - /* NOTREACHED */ -} - -#if defined(FLOATING_POINT) && !defined(_IO_USE_DTOA) - -static char *exponent(register char *p, register int exp, int fmtch) -{ - register char *t; - char expbuf[MAXEXP]; - - *p++ = fmtch; - if (exp < 0) { - exp = -exp; - *p++ = '-'; - } - else - *p++ = '+'; - t = expbuf + MAXEXP; - if (exp > 9) { - do { - *--t = to_char(exp % 10); - } while ((exp /= 10) > 9); - *--t = to_char(exp); - for (; t < expbuf + MAXEXP; *p++ = *t++); - } - else { - *p++ = '0'; - *p++ = to_char(exp); - } - return (p); -} - -static char * round(double fract, int *exp, - register char *start, register char *end, - char ch, int *signp) -{ - double tmp; - - if (fract) - (void)modf(fract * 10, &tmp); - else - tmp = to_digit(ch); - if (tmp > 4) - for (;; --end) { - if (*end == '.') - --end; - if (++*end <= '9') - break; - *end = '0'; - if (end == start) { - if (exp) { /* e/E; increment exponent */ - *end = '1'; - ++*exp; - } - else { /* f; add extra digit */ - *--end = '1'; - --start; - } - break; - } - } - /* ``"%.3f", (double)-0.0004'' gives you a negative 0. */ - else if (*signp == '-') - for (;; --end) { - if (*end == '.') - --end; - if (*end != '0') - break; - if (end == start) - *signp = 0; - } - return (start); -} - -int __cvt_double(double number, register int prec, int flags, int *signp, - int fmtch, char *startp, char *endp) -{ - register char *p, *t; - register double fract; - int dotrim = 0, expcnt, gformat = 0; - double integer, tmp; - - expcnt = 0; - if (number < 0) { - number = -number; - *signp = '-'; - } else - *signp = 0; - - fract = modf(number, &integer); - - /* get an extra slot for rounding. */ - t = ++startp; - - /* - * get integer portion of number; put into the end of the buffer; the - * .01 is added for modf(356.0 / 10, &integer) returning .59999999... - */ - for (p = endp - 1; p >= startp && integer; ++expcnt) { - tmp = modf(integer / 10, &integer); - *p-- = to_char((int)((tmp + .01) * 10)); - } - switch (fmtch) { - case 'f': - case 'F': - /* reverse integer into beginning of buffer */ - if (expcnt) - for (; ++p < endp; *t++ = *p); - else - *t++ = '0'; - /* - * if precision required or alternate flag set, add in a - * decimal point. - */ - if (prec || flags&ALT) - *t++ = '.'; - /* if requires more precision and some fraction left */ - if (fract) { - if (prec) - do { - fract = modf(fract * 10, &tmp); - *t++ = to_char((int)tmp); - } while (--prec && fract); - if (fract) - startp = round(fract, (int *)NULL, startp, - t - 1, (char)0, signp); - } - for (; prec--; *t++ = '0'); - break; - case 'e': - case 'E': -eformat: if (expcnt) { - *t++ = *++p; - if (prec || flags&ALT) - *t++ = '.'; - /* if requires more precision and some integer left */ - for (; prec && ++p < endp; --prec) - *t++ = *p; - /* - * if done precision and more of the integer component, - * round using it; adjust fract so we don't re-round - * later. - */ - if (!prec && ++p < endp) { - fract = 0; - startp = round((double)0, &expcnt, startp, - t - 1, *p, signp); - } - /* adjust expcnt for digit in front of decimal */ - --expcnt; - } - /* until first fractional digit, decrement exponent */ - else if (fract) { - /* adjust expcnt for digit in front of decimal */ - for (expcnt = -1;; --expcnt) { - fract = modf(fract * 10, &tmp); - if (tmp) - break; - } - *t++ = to_char((int)tmp); - if (prec || flags&ALT) - *t++ = '.'; - } - else { - *t++ = '0'; - if (prec || flags&ALT) - *t++ = '.'; - } - /* if requires more precision and some fraction left */ - if (fract) { - if (prec) - do { - fract = modf(fract * 10, &tmp); - *t++ = to_char((int)tmp); - } while (--prec && fract); - if (fract) - startp = round(fract, &expcnt, startp, - t - 1, (char)0, signp); - } - /* if requires more precision */ - for (; prec--; *t++ = '0'); - - /* unless alternate flag, trim any g/G format trailing 0's */ - if (gformat && !(flags&ALT)) { - while (t > startp && *--t == '0'); - if (*t == '.') - --t; - ++t; - } - t = exponent(t, expcnt, fmtch); - break; - case 'g': - case 'G': - /* a precision of 0 is treated as a precision of 1. */ - if (!prec) - ++prec; - /* - * ``The style used depends on the value converted; style e - * will be used only if the exponent resulting from the - * conversion is less than -4 or greater than the precision.'' - * -- ANSI X3J11 - */ - if (expcnt > prec || (!expcnt && fract && fract < .0001)) { - /* - * g/G format counts "significant digits, not digits of - * precision; for the e/E format, this just causes an - * off-by-one problem, i.e. g/G considers the digit - * before the decimal point significant and e/E doesn't - * count it as precision. - */ - --prec; - fmtch -= 2; /* G->E, g->e */ - gformat = 1; - goto eformat; - } - /* - * reverse integer into beginning of buffer, - * note, decrement precision - */ - if (expcnt) - for (; ++p < endp; *t++ = *p, --prec); - else - *t++ = '0'; - /* - * if precision required or alternate flag set, add in a - * decimal point. If no digits yet, add in leading 0. - */ - if (prec || flags&ALT) { - dotrim = 1; - *t++ = '.'; - } - else - dotrim = 0; - /* if requires more precision and some fraction left */ - if (fract) { - if (prec) { - /* If no integer part, don't count initial - * zeros as significant digits. */ - do { - fract = modf(fract * 10, &tmp); - *t++ = to_char((int)tmp); - } while(!tmp && !expcnt); - while (--prec && fract) { - fract = modf(fract * 10, &tmp); - *t++ = to_char((int)tmp); - } - } - if (fract) - startp = round(fract, (int *)NULL, startp, - t - 1, (char)0, signp); - } - /* alternate format, adds 0's for precision, else trim 0's */ - if (flags&ALT) - for (; prec--; *t++ = '0'); - else if (dotrim) { - while (t > startp && *--t == '0'); - if (*t != '.') - ++t; - } - } - return (t - startp); -} - -#endif /* defined(FLOATING_POINT) && !defined(_IO_USE_DTOA) */ diff --git a/contrib/libio/iovfscanf.c b/contrib/libio/iovfscanf.c deleted file mode 100644 index 0631458f21..0000000000 --- a/contrib/libio/iovfscanf.c +++ /dev/null @@ -1,790 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -/* Extensively hacked for GNU iostream by Per Bothner 1991, 1992, 1993. - Changes copyright Free Software Foundation 1992, 1993. */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "%W% (Berkeley) %G%"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#ifdef __STDC__ -#include -#else -#include -#endif - -#ifndef NO_FLOATING_POINT -#define FLOATING_POINT -#endif - -#ifdef FLOATING_POINT -#include "floatio.h" -#define BUF (MAXEXP+MAXFRACT+3) /* 3 = sign + decimal point + NUL */ -#else -#define BUF 40 -#endif - -/* - * Flags used during conversion. - */ -#define LONG 0x01 /* l: long or double */ -#define LONGDBL 0x02 /* L: long double; unimplemented */ -#define SHORT 0x04 /* h: short */ -#define SUPPRESS 0x08 /* suppress assignment */ -#define POINTER 0x10 /* weird %p pointer (`fake hex') */ -#define NOSKIP 0x20 /* do not skip blanks */ -#define WIDTH 0x40 /* width */ - -/* - * The following are used in numeric conversions only: - * SIGNOK, NDIGITS, DPTOK, and EXPOK are for floating point; - * SIGNOK, NDIGITS, PFXOK, and NZDIGITS are for integral. - */ -#define SIGNOK 0x40 /* +/- is (still) legal */ -#define NDIGITS 0x80 /* no digits detected */ - -#define DPTOK 0x100 /* (float) decimal point is still legal */ -#define EXPOK 0x200 /* (float) exponent (e+3, etc) still legal */ - -#define PFXOK 0x100 /* 0x prefix is (still) legal */ -#define NZDIGITS 0x200 /* no zero digits detected */ - -/* - * Conversion types. - */ -#define CT_CHAR 0 /* %c conversion */ -#define CT_CCL 1 /* %[...] conversion */ -#define CT_STRING 2 /* %s conversion */ -#define CT_INT 3 /* integer, i.e., strtol or strtoul */ -#define CT_FLOAT 4 /* floating, i.e., strtod */ - -#define u_char unsigned char -#define u_long unsigned long - -#ifdef __cplusplus -extern "C" { -#endif -extern u_long strtoul __P((const char*, char**, int)); -extern long strtol __P((const char*, char**, int)); -static const u_char *__sccl __P((char *tab, const u_char *fmt)); -#ifndef _IO_USE_DTOA -extern double atof(); -#endif -#ifdef __cplusplus -} -#endif - -/* If errp != NULL, *errp|=1 if we see a premature EOF; - *errp|=2 if we an invalid character. */ - -int -_IO_vfscanf (fp, fmt0, ap, errp) - _IO_FILE *fp; - char const *fmt0; - _IO_va_list ap; - int *errp; -{ - register const u_char *fmt = (const u_char *)fmt0; - register int c; /* character from format, or conversion */ - register _IO_ssize_t width; /* field width, or 0 */ - register char *p; /* points into all kinds of strings */ - register int n; /* handy integer */ - register int flags = 0; /* flags as defined above */ - register char *p0; /* saves original value of p when necessary */ - int nassigned; /* number of fields assigned */ - int nread; /* number of characters consumed from fp */ - /* Assignments to base and ccfn are just to suppress warnings from gcc.*/ - int base = 0; /* base argument to strtol/strtoul */ - typedef u_long (*strtoulfn) __P((const char*, char**, int)); - strtoulfn ccfn = 0; - /* conversion function (strtol/strtoul) */ - char ccltab[256]; /* character class table for %[...] */ - char buf[BUF]; /* buffer for numeric conversions */ - int seen_eof = 0; - - /* `basefix' is used to avoid `if' tests in the integer scanner */ - static short basefix[17] = - { 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; - - nassigned = 0; - nread = 0; - for (;;) { - c = *fmt++; - if (c == 0) - goto done; - if (isspace(c)) { - for (;;) { - c = _IO_getc(fp); - if (c == EOF) { - seen_eof++; - break; - } - if (!isspace(c)) { - _IO_ungetc (c, fp); - break; - } - nread++; - } - continue; - } - if (c != '%') - goto literal; - width = 0; - flags = 0; - /* - * switch on the format. continue if done; - * break once format type is derived. - */ -again: c = *fmt++; - switch (c) { - case '%': -literal: - n = _IO_getc(fp); - if (n == EOF) - goto eof_failure; - if (n != c) { - _IO_ungetc (n, fp); - goto match_failure; - } - nread++; - continue; - - case '*': - if (flags) goto control_failure; - flags = SUPPRESS; - goto again; - case 'l': - if (flags & ~(SUPPRESS | WIDTH)) goto control_failure; - flags |= LONG; - goto again; - case 'L': - if (flags & ~(SUPPRESS | WIDTH)) goto control_failure; - flags |= LONGDBL; - goto again; - case 'h': - if (flags & ~(SUPPRESS | WIDTH)) goto control_failure; - flags |= SHORT; - goto again; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - if (flags & ~(SUPPRESS | WIDTH)) goto control_failure; - flags |= WIDTH; - width = width * 10 + c - '0'; - goto again; - - /* - * Conversions. - * Those marked `compat' are for 4.[123]BSD compatibility. - * - * (According to ANSI, E and X formats are supposed - * to the same as e and x. Sorry about that.) - */ - case 'D': /* compat */ - flags |= LONG; - /* FALLTHROUGH */ - case 'd': - c = CT_INT; - ccfn = (strtoulfn)strtol; - base = 10; - break; - - case 'i': - c = CT_INT; - ccfn = (strtoulfn)strtol; - base = 0; - break; - - case 'O': /* compat */ - flags |= LONG; - /* FALLTHROUGH */ - case 'o': - c = CT_INT; - ccfn = strtoul; - base = 8; - break; - - case 'u': - c = CT_INT; - ccfn = strtoul; - base = 10; - break; - - case 'X': - case 'x': - flags |= PFXOK; /* enable 0x prefixing */ - c = CT_INT; - ccfn = strtoul; - base = 16; - break; - -#ifdef FLOATING_POINT - case 'E': case 'F': - case 'e': case 'f': case 'g': - c = CT_FLOAT; - break; -#endif - - case 's': - c = CT_STRING; - break; - - case '[': - fmt = __sccl(ccltab, fmt); - flags |= NOSKIP; - c = CT_CCL; - break; - - case 'c': - flags |= NOSKIP; - c = CT_CHAR; - break; - - case 'p': /* pointer format is like hex */ - flags |= POINTER | PFXOK; - c = CT_INT; - ccfn = strtoul; - base = 16; - break; - - case 'n': - if (flags & SUPPRESS) /* ??? */ - continue; - if (flags & SHORT) - *va_arg(ap, short *) = nread; - else if (flags & LONG) - *va_arg(ap, long *) = nread; - else - *va_arg(ap, int *) = nread; - continue; - - /* - * Disgusting backwards compatibility hacks. XXX - */ - case '\0': /* compat */ - nassigned = EOF; - goto done; - - default: /* compat */ - if (isupper(c)) - flags |= LONG; - c = CT_INT; - ccfn = (strtoulfn)strtol; - base = 10; - break; - } - - /* - * We have a conversion that requires input. - */ - if (_IO_peekc(fp) == EOF) - goto eof_failure; - - /* - * Consume leading white space, except for formats - * that suppress this. - */ - if ((flags & NOSKIP) == 0) { - n = (unsigned char)*fp->_IO_read_ptr; - while (isspace(n)) { - fp->_IO_read_ptr++; - nread++; - n = _IO_peekc(fp); - if (n == EOF) - goto eof_failure; - } - /* Note that there is at least one character in - the buffer, so conversions that do not set NOSKIP - can no longer result in an input failure. */ - } - - /* - * Do the conversion. - */ - switch (c) { - - case CT_CHAR: - /* scan arbitrary characters (sets NOSKIP) */ - if (width == 0) /* FIXME! */ - width = 1; - if (flags & SUPPRESS) { - _IO_size_t sum = 0; - for (;;) { - n = fp->_IO_read_end - fp->_IO_read_ptr; - if (n < (int)width) { - sum += n; - width -= n; - fp->_IO_read_ptr += n; - if (__underflow(fp) == EOF) - if (sum == 0) - goto eof_failure; - else { - seen_eof++; - break; - } - } else { - sum += width; - fp->_IO_read_ptr += width; - break; - } - } - nread += sum; - } else { - _IO_size_t r = - - _IO_XSGETN (fp, (char*)va_arg(ap, char*), width); - if (r != width) - goto eof_failure; - nread += r; - nassigned++; - } - break; - - case CT_CCL: - /* scan a (nonempty) character class (sets NOSKIP) */ - if (width == 0) - width = ~0; /* `infinity' */ - /* take only those things in the class */ - if (flags & SUPPRESS) { - n = 0; - while (ccltab[(unsigned char)*fp->_IO_read_ptr]) { - n++, fp->_IO_read_ptr++; - if (--width == 0) - break; - if (_IO_peekc(fp) == EOF) { - if (n == 0) - goto eof_failure; - seen_eof++; - break; - } - } - if (n == 0) - goto match_failure; - } else { - p0 = p = va_arg(ap, char *); - while (ccltab[(unsigned char)*fp->_IO_read_ptr]) { - *p++ = *fp->_IO_read_ptr++; - if (--width == 0) - break; - if (_IO_peekc(fp) == EOF) { - if (p == p0) - goto eof_failure; - seen_eof++; - break; - } - } - n = p - p0; - if (n == 0) - goto match_failure; - *p = 0; - nassigned++; - } - nread += n; - break; - - case CT_STRING: - /* like CCL, but zero-length string OK, & no NOSKIP */ - if (width == 0) - width = ~0; - if (flags & SUPPRESS) { - n = 0; - while (!isspace((unsigned char)*fp->_IO_read_ptr)) { - n++, fp->_IO_read_ptr++; - if (--width == 0) - break; - if (_IO_peekc(fp) == EOF) { - seen_eof++; - break; - } - } - nread += n; - } else { - p0 = p = va_arg(ap, char *); - while (!isspace((unsigned char)*fp->_IO_read_ptr)) { - *p++ = *fp->_IO_read_ptr++; - if (--width == 0) - break; - if (_IO_peekc(fp) == EOF) { - seen_eof++; - break; - } - } - *p = 0; - nread += p - p0; - nassigned++; - } - continue; - - case CT_INT: - /* scan an integer as if by strtol/strtoul */ - if (width == 0 || width > sizeof(buf) - 1) - width = sizeof(buf) - 1; - flags |= SIGNOK | NDIGITS | NZDIGITS; - for (p = buf; width; width--) { - c = (unsigned char)*fp->_IO_read_ptr; - /* - * Switch on the character; `goto ok' - * if we accept it as a part of number. - */ - switch (c) { - - /* - * The digit 0 is always legal, but is - * special. For %i conversions, if no - * digits (zero or nonzero) have been - * scanned (only signs), we will have - * base==0. In that case, we should set - * it to 8 and enable 0x prefixing. - * Also, if we have not scanned zero digits - * before this, do not turn off prefixing - * (someone else will turn it off if we - * have scanned any nonzero digits). - */ - case '0': - if (base == 0) { - base = 8; - flags |= PFXOK; - } - if (flags & NZDIGITS) - flags &= ~(SIGNOK|NZDIGITS|NDIGITS); - else - flags &= ~(SIGNOK|PFXOK|NDIGITS); - goto ok; - - /* 1 through 7 always legal */ - case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - base = basefix[base]; - flags &= ~(SIGNOK | PFXOK | NDIGITS); - goto ok; - - /* digits 8 and 9 ok iff decimal or hex */ - case '8': case '9': - base = basefix[base]; - if (base <= 8) - break; /* not legal here */ - flags &= ~(SIGNOK | PFXOK | NDIGITS); - goto ok; - - /* letters ok iff hex */ - case 'A': case 'B': case 'C': - case 'D': case 'E': case 'F': - case 'a': case 'b': case 'c': - case 'd': case 'e': case 'f': - /* no need to fix base here */ - if (base <= 10) - break; /* not legal here */ - flags &= ~(SIGNOK | PFXOK | NDIGITS); - goto ok; - - /* sign ok only as first character */ - case '+': case '-': - if (flags & SIGNOK) { - flags &= ~SIGNOK; - goto ok; - } - break; - - /* x ok iff flag still set & 2nd char */ - case 'x': case 'X': - if (flags & PFXOK && p == buf + 1) { - base = 16; /* if %i */ - flags &= ~PFXOK; - goto ok; - } - break; - } - - /* - * If we got here, c is not a legal character - * for a number. Stop accumulating digits. - */ - break; - ok: - /* - * c is legal: store it and look at the next. - */ - *p++ = c; - fp->_IO_read_ptr++; - if (_IO_peekc(fp) == EOF) { - seen_eof++; - break; /* EOF */ - } - } - /* - * If we had only a sign, it is no good; push - * back the sign. If the number ends in `x', - * it was [sign] '0' 'x', so push back the x - * and treat it as [sign] '0'. - */ - if (flags & NDIGITS) { - if (p > buf) - (void) _IO_ungetc(*(u_char *)--p, fp); - goto match_failure; - } - c = ((u_char *)p)[-1]; - if (c == 'x' || c == 'X') { - --p; - (void) _IO_ungetc (c, fp); - } - if ((flags & SUPPRESS) == 0) { - u_long res; - - *p = 0; - res = (*ccfn)(buf, (char **)NULL, base); - if (flags & POINTER) - *va_arg(ap, void **) = (void *)res; - else if (flags & SHORT) - *va_arg(ap, short *) = res; - else if (flags & LONG) - *va_arg(ap, long *) = res; - else - *va_arg(ap, int *) = res; - nassigned++; - } - nread += p - buf; - break; - -#ifdef FLOATING_POINT - case CT_FLOAT: - /* scan a floating point number as if by strtod */ - if (width == 0 || width > sizeof(buf) - 1) - width = sizeof(buf) - 1; - flags |= SIGNOK | NDIGITS | DPTOK | EXPOK; - for (p = buf; width; width--) { - c = (unsigned char)*fp->_IO_read_ptr; - /* - * This code mimicks the integer conversion - * code, but is much simpler. - */ - switch (c) { - - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - case '8': case '9': - flags &= ~(SIGNOK | NDIGITS); - goto fok; - - case '+': case '-': - if (flags & SIGNOK) { - flags &= ~SIGNOK; - goto fok; - } - break; - case '.': - if (flags & DPTOK) { - flags &= ~(SIGNOK | DPTOK); - goto fok; - } - break; - case 'e': case 'E': - /* no exponent without some digits */ - if ((flags&(NDIGITS|EXPOK)) == EXPOK) { - flags = - (flags & ~(EXPOK|DPTOK)) | - SIGNOK | NDIGITS; - goto fok; - } - break; - } - break; - fok: - *p++ = c; - fp->_IO_read_ptr++; - if (_IO_peekc(fp) == EOF) { - seen_eof++; - break; /* EOF */ - } - } - /* - * If no digits, might be missing exponent digits - * (just give back the exponent) or might be missing - * regular digits, but had sign and/or decimal point. - */ - if (flags & NDIGITS) { - if (flags & EXPOK) { - /* no digits at all */ - while (p > buf) - _IO_ungetc (*(u_char *)--p, fp); - goto match_failure; - } - /* just a bad exponent (e and maybe sign) */ - c = *(u_char *)--p; - if (c != 'e' && c != 'E') { - (void) _IO_ungetc (c, fp);/* sign */ - c = *(u_char *)--p; - } - (void) _IO_ungetc (c, fp); - } - if ((flags & SUPPRESS) == 0) { - double res; - *p = 0; -#ifdef _IO_USE_DTOA - res = _IO_strtod(buf, NULL); -#else - res = atof(buf); -#endif - if (flags & LONG) - *va_arg(ap, double *) = res; - else - *va_arg(ap, float *) = res; - nassigned++; - } - nread += p - buf; - break; -#endif /* FLOATING_POINT */ - } - } -eof_failure: - seen_eof++; -input_failure: - if (nassigned == 0) - nassigned = -1; -control_failure: -match_failure: - if (errp) - *errp |= 2; -done: - if (errp && seen_eof) - *errp |= 1; - return (nassigned); -} - -/* - * Fill in the given table from the scanset at the given format - * (just after `['). Return a pointer to the character past the - * closing `]'. The table has a 1 wherever characters should be - * considered part of the scanset. - */ -static const u_char * -__sccl (tab, fmt) - char *tab; - const u_char *fmt; -{ - register int c, n, v; - - /* first `clear' the whole table */ - c = *fmt++; /* first char hat => negated scanset */ - if (c == '^') { - v = 1; /* default => accept */ - c = *fmt++; /* get new first char */ - } else - v = 0; /* default => reject */ - /* should probably use memset here */ - for (n = 0; n < 256; n++) - tab[n] = v; - if (c == 0) - return (fmt - 1);/* format ended before closing ] */ - - /* - * Now set the entries corresponding to the actual scanset - * to the opposite of the above. - * - * The first character may be ']' (or '-') without being special; - * the last character may be '-'. - */ - v = 1 - v; - for (;;) { - tab[c] = v; /* take character c */ -doswitch: - n = *fmt++; /* and examine the next */ - switch (n) { - - case 0: /* format ended too soon */ - return (fmt - 1); - - case '-': - /* - * A scanset of the form - * [01+-] - * is defined as `the digit 0, the digit 1, - * the character +, the character -', but - * the effect of a scanset such as - * [a-zA-Z0-9] - * is implementation defined. The V7 Unix - * scanf treats `a-z' as `the letters a through - * z', but treats `a-a' as `the letter a, the - * character -, and the letter a'. - * - * For compatibility, the `-' is not considerd - * to define a range if the character following - * it is either a close bracket (required by ANSI) - * or is not numerically greater than the character - * we just stored in the table (c). - */ - n = *fmt; - if (n == ']' || n < c) { - c = '-'; - break; /* resume the for(;;) */ - } - fmt++; - do { /* fill in the range */ - tab[++c] = v; - } while (c < n); -#if 1 /* XXX another disgusting compatibility hack */ - /* - * Alas, the V7 Unix scanf also treats formats - * such as [a-c-e] as `the letters a through e'. - * This too is permitted by the standard.... - */ - goto doswitch; -#else - c = *fmt++; - if (c == 0) - return (fmt - 1); - if (c == ']') - return (fmt); -#endif - break; - - case ']': /* end of scanset */ - return (fmt); - - default: /* just another character */ - c = n; - break; - } - } - /* NOTREACHED */ -} diff --git a/contrib/libio/iovsprintf.c b/contrib/libio/iovsprintf.c deleted file mode 100644 index 617a588840..0000000000 --- a/contrib/libio/iovsprintf.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. - This file is part of the GNU IO Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - - As a special exception, if you link this library with files - compiled with a GNU compiler to produce an executable, this does - not cause the resulting executable to be covered by the GNU General - Public License. This exception does not however invalidate any - other reasons why the executable file might be covered by the GNU - General Public License. */ - -#include "libioP.h" -#include "strfile.h" - -int -_IO_vsprintf (string, format, args) - char *string; - const char *format; - _IO_va_list args; -{ - _IO_strfile sf; -#ifdef _IO_MTSAFE_IO - _IO_lock_t lock; -#endif - int ret; - -#ifdef _IO_MTSAFE_IO - sf._sbf._f._lock = &lock; -#endif - _IO_init (&sf._sbf._f, 0); - _IO_JUMPS (&sf._sbf._f) = &_IO_str_jumps; - _IO_str_init_static (&sf._sbf._f, string, -1, string); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, &sf); - _IO_flockfile (&sf._sbf._f); - ret = _IO_vfprintf (&sf._sbf._f, format, args); - _IO_putc_unlocked ('\0', &sf._sbf._f); - _IO_cleanup_region_end (1); - return ret; -} - -#ifdef weak_alias -weak_alias (_IO_vsprintf, vsprintf) -#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL) -int vsprintf (char *, const char *, _IO_va_list) - __attribute__ ((weak, alias("_IO_vsprintf"))); -#endif diff --git a/contrib/libio/iovsscanf.c b/contrib/libio/iovsscanf.c deleted file mode 100644 index 6bdc3ccf01..0000000000 --- a/contrib/libio/iovsscanf.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. - This file is part of the GNU IO Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - - As a special exception, if you link this library with files - compiled with a GNU compiler to produce an executable, this does - not cause the resulting executable to be covered by the GNU General - Public License. This exception does not however invalidate any - other reasons why the executable file might be covered by the GNU - General Public License. */ - -#include "libioP.h" -#include "strfile.h" - -int -_IO_vsscanf (string, format, args) - const char *string; - const char *format; - _IO_va_list args; -{ - int ret; - _IO_strfile sf; -#ifdef _IO_MTSAFE_IO - _IO_lock_t lock; - sf._sbf._f._lock = &lock; -#endif - _IO_init (&sf._sbf._f, 0); - _IO_JUMPS (&sf._sbf._f) = &_IO_str_jumps; - _IO_str_init_static (&sf._sbf._f, (char*)string, 0, NULL); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, &sf); - _IO_flockfile (&sf._sbf._f); - ret = _IO_vfscanf (&sf._sbf._f, format, args, NULL); - _IO_cleanup_region_end (1); - return ret; -} - -#ifdef weak_alias -weak_alias (_IO_vsscanf, __vsscanf) -weak_alias (_IO_vsscanf, vsscanf) -#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL) -int __vsscanf (const char *, const char *, _IO_va_list) - __attribute__ ((weak, alias("_IO_vsscanf"))); -int vsscanf (const char *, const char *, _IO_va_list) - __attribute__ ((weak, alias("_IO_vsscanf"))); -#endif diff --git a/contrib/libio/isgetline.cc b/contrib/libio/isgetline.cc deleted file mode 100644 index 5e48a000c0..0000000000 --- a/contrib/libio/isgetline.cc +++ /dev/null @@ -1,153 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include -#include "iostream.h" -#include - -istream& istream::getline(char* buf, int len, char delim) -{ - _gcount = 0; - if (len <= 0) - { - set(ios::failbit); - return *this; - } - int ch; - if (ipfx1()) - { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - streambuf *sb = rdbuf(); - _gcount = _IO_getline_info(sb, buf, len - 1, delim, -1, &ch); - if (ch != EOF) - ch = sb->sbumpc(); - if (ch == EOF) - set (_gcount == 0 ? (ios::failbit|ios::eofbit) : ios::eofbit); - else if (ch != (unsigned char) delim) - { - set(ios::failbit); - sb->sungetc(); // Leave delimiter unread. - } - isfx(); - _IO_cleanup_region_end (0); - } - else - ch = EOF; - buf[_gcount] = '\0'; - if (ch == (unsigned char)delim) - _gcount++; // The delimiter is counted in the gcount(). - return *this; -} - -istream& istream::get(char* buf, int len, char delim) -{ - _gcount = 0; - if (len <= 0) - { - set(ios::failbit); - return *this; - } - if (ipfx1()) - { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - streambuf *sbuf = rdbuf(); - int ch; - _gcount = _IO_getline_info(sbuf, buf, len - 1, delim, -1, &ch); - if (_gcount == 0 && ch == EOF) - set(ios::failbit|ios::eofbit); - isfx(); - _IO_cleanup_region_end (0); - } - buf[_gcount] = '\0'; - return *this; -} - - -// from Doug Schmidt - -#define CHUNK_SIZE 512 - -/* Reads an arbitrarily long input line terminated by a user-specified - TERMINATOR. Super-nifty trick using recursion avoids unnecessary calls - to NEW! */ - -char *_sb_readline (streambuf *sb, long& total, char terminator) -{ - char buf[CHUNK_SIZE]; - char *ptr; - int ch; - - _IO_size_t count = _IO_getline_info(sb, buf, CHUNK_SIZE, terminator, - -1, &ch); - if (ch != EOF) - ch = sb->sbumpc(); - long old_total = total; - total += count; - if (ch != EOF && ch != terminator) { - total++; // Include ch in total. - ptr = _sb_readline(sb, total, terminator); - if (ptr) { - memcpy(ptr + old_total, buf, count); - ptr[old_total+count] = ch; - } - return ptr; - } - - ptr = new char[total+1]; - if (ptr != NULL) { - ptr[total] = '\0'; - memcpy(ptr + total - count, buf, count); - } - return ptr; -} - -/* Reads an arbitrarily long input line terminated by TERMINATOR. - This routine allocates its own memory, so the user should - only supply the address of a (char *). */ - -istream& istream::gets(char **s, char delim /* = '\n' */) -{ - if (ipfx1()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - long size = 0; - streambuf *sb = rdbuf(); - *s = _sb_readline (sb, size, delim); - _gcount = *s ? size : 0; - if (sb->_flags & _IO_EOF_SEEN) { - set(ios::eofbit); - if (_gcount == 0) - set(ios::failbit); - } - isfx(); - _IO_cleanup_region_end (0); - } - else { - _gcount = 0; - *s = NULL; - } - return *this; -} diff --git a/contrib/libio/isgetsb.cc b/contrib/libio/isgetsb.cc deleted file mode 100644 index 655c972589..0000000000 --- a/contrib/libio/isgetsb.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" -#include "iostream.h" -#include - -istream& istream::get(streambuf& sb, char delim /* = '\n' */) -{ - _gcount = 0; - if (ipfx1()) - { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - register streambuf* isb = rdbuf(); - for (;;) - { - streamsize len = isb->_IO_read_end - isb->_IO_read_ptr; - if (len <= 0) - if (__underflow(isb) == EOF) - break; - else - len = isb->_IO_read_end - isb->_IO_read_ptr; - char *delimp = (char*)memchr((void*)isb->_IO_read_ptr, delim, len); - if (delimp != NULL) - len = delimp - isb->_IO_read_ptr; - int written = sb.sputn(isb->_IO_read_ptr, len); - isb->_IO_read_ptr += written; - _gcount += written; - if (written != len) - { - set(ios::failbit); - break; - } - if (delimp != NULL) - break; - } - isfx(); - _IO_cleanup_region_end (0); - } - return *this; -} diff --git a/contrib/libio/isscan.cc b/contrib/libio/isscan.cc deleted file mode 100644 index 977559c2cb..0000000000 --- a/contrib/libio/isscan.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" -#include -#include - -istream& istream::scan(const char *format ...) -{ - if (ipfx0()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - va_list ap; - va_start(ap, format); - _strbuf->vscan(format, ap, this); - va_end(ap); - isfx(); - _IO_cleanup_region_end (0); - } - return *this; -} - -istream& istream::vscan(const char *format, _IO_va_list args) -{ - if (ipfx0()) - { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - _strbuf->vscan(format, args, this); - isfx(); - _IO_cleanup_region_end (0); - } - return *this; -} diff --git a/contrib/libio/istream.h b/contrib/libio/istream.h deleted file mode 100644 index f54ec1de9a..0000000000 --- a/contrib/libio/istream.h +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include diff --git a/contrib/libio/libio.h b/contrib/libio/libio.h deleted file mode 100644 index c453b77bf3..0000000000 --- a/contrib/libio/libio.h +++ /dev/null @@ -1,365 +0,0 @@ -/* 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 . - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the 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 -# 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 -# 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 -#define _IO_USER_LOCK 0x8000 - -/* These are "formatting flags" matching the iostream fmtflags enum values. */ -#define _IO_SKIPWS 01 -#define _IO_LEFT 02 -#define _IO_RIGHT 04 -#define _IO_INTERNAL 010 -#define _IO_DEC 020 -#define _IO_OCT 040 -#define _IO_HEX 0100 -#define _IO_SHOWBASE 0200 -#define _IO_SHOWPOINT 0400 -#define _IO_UPPERCASE 01000 -#define _IO_SHOWPOS 02000 -#define _IO_SCIENTIFIC 04000 -#define _IO_FIXED 010000 -#define _IO_UNITBUF 020000 -#define _IO_STDIO 040000 -#define _IO_DONT_CLOSE 0100000 -#define _IO_BOOLALPHA 0200000 - - -struct _IO_jump_t; struct _IO_FILE; - -/* Handle lock. */ -#ifdef _IO_MTSAFE_IO -# if defined __GLIBC__ && __GLIBC__ >= 2 -# if __GLIBC_MINOR__ > 0 -# include -# else -# include -# endif -# define _IO_LOCK_T _IO_lock_t * -# else -/*# include */ -# 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; -# 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/contrib/libio/libioP.h b/contrib/libio/libioP.h deleted file mode 100644 index be70f526bb..0000000000 --- a/contrib/libio/libioP.h +++ /dev/null @@ -1,648 +0,0 @@ -/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. - This file is part of the GNU IO Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - - As a special exception, if you link this library with files - compiled with a GNU compiler to produce an executable, this does - not cause the resulting executable to be covered by the GNU General - Public License. This exception does not however invalidate any - other reasons why the executable file might be covered by the GNU - General Public License. */ - -#ifndef _POSIX_SOURCE -# define _POSIX_SOURCE -#endif - -#include -#ifndef __set_errno -# define __set_errno(Val) errno = (Val) -#endif - -#ifdef _IO_MTSAFE_IO -# if defined __GLIBC__ && __GLIBC__ >= 2 -# if __GLIBC_MINOR__ > 0 -# include -# else -# include -# endif -# else -/*# include */ -# 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 -# include -# include -# include - -# 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/contrib/libio/osform.cc b/contrib/libio/osform.cc deleted file mode 100644 index f08f2efaa3..0000000000 --- a/contrib/libio/osform.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" -#include -#include - -ostream& ostream::form(const char *format ...) -{ - if (opfx()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - va_list ap; - va_start(ap, format); - _IO_vfprintf(rdbuf(), format, ap); - va_end(ap); - osfx(); - _IO_cleanup_region_end (0); - } - return *this; -} - -ostream& ostream::vform(const char *format, _IO_va_list args) -{ - if (opfx()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - _IO_vfprintf(rdbuf(), format, args); - osfx(); - _IO_cleanup_region_end (0); - } - return *this; -} - -ostream& ostream::operator<<(const void *p) -{ - if (opfx()) { - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _strbuf); - form("%p", p); - osfx(); - _IO_cleanup_region_end (0); - } - return *this; -} diff --git a/contrib/libio/ostream.h b/contrib/libio/ostream.h deleted file mode 100644 index f54ec1de9a..0000000000 --- a/contrib/libio/ostream.h +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include diff --git a/contrib/libio/outfloat.c b/contrib/libio/outfloat.c deleted file mode 100644 index 5cbb6c9259..0000000000 --- a/contrib/libio/outfloat.c +++ /dev/null @@ -1,211 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" - -#ifdef _IO_USE_DTOA -/* Format floating-point number and print them. - Return number of chars printed, or EOF on error. - - sign_mode == '+' : print "-" or "+" - sign_mode == ' ' : print "-" or " " - sign_mode == '\0' : print "-' or "" -*/ - -int -_IO_outfloat (value, sb, type, width, precision, flags, sign_mode, fill) - double value; - _IO_FILE *sb; - int type; - int width; - int precision; - int flags; - int sign_mode; - int fill; -{ - int count = 0; -#define PUT(x) do {if (_IO_putc(x, sb) < 0) goto error; count++;} while (0) -#define PUTN(p, n) \ - do {int _n=n; count+=_n; if (_IO_sputn(sb, p,_n) != _n) goto error;} while(0) -#define PADN(fill, n) \ - do {int _n = n; count+=_n; if (_IO_padn(sb, fill, _n) != _n) goto error;} while (0) - int pad_kind = flags & (_IO_LEFT|_IO_RIGHT|_IO_INTERNAL); - int skip_zeroes = 0; - int show_dot = (flags & _IO_SHOWPOINT) != 0; - int decpt; - int sign; - int mode; - int exponent_size; - int print_sign; - int trailing_zeroes, useful_digits; - int padding, unpadded_width; - char *p; - char *exponent_start; - register int i; -#define EBUF_SIZE 12 -#define EBUF_END &ebuf[EBUF_SIZE] - char ebuf[EBUF_SIZE]; - char *end; - int exp = 0; - switch (type) - { - case 'f': - mode = 3; - break; - case 'e': - case 'E': - exp = type; - mode = 2; - if (precision != 999) - precision++; /* Add one to include digit before decimal point. */ - break; - case 'g': - case 'G': - exp = type == 'g' ? 'e' : 'E'; - if (precision == 0) precision = 1; - if (!(flags & _IO_SHOWPOINT)) - skip_zeroes = 1; - type = 'g'; - mode = 2; - break; - } - /* Do the actual convension */ - if (precision == 999 && mode != 3) - mode = 0; - p = _IO_dtoa(value, mode, precision, &decpt, &sign, &end); - useful_digits = end-p; - exponent_start = EBUF_END; - if (mode == 0) - precision = useful_digits; - /* Check if we need to emit an exponent. */ - if (mode != 3 && decpt != 9999) - { - i = decpt - 1; - if ((type != 'g' && type != 'F') || i < -4 || i >= precision) - { - /* Print the exponent into ebuf. - We write ebuf in reverse order (right-to-left). */ - char sign; - if (i >= 0) - sign = '+'; - else - sign = '-', i = -i; - /* Note: ANSI requires at least 2 exponent digits. */ - do { - *--exponent_start = (i % 10) + '0'; - i /= 10; - } while (i >= 10); - *--exponent_start = i + '0'; - *--exponent_start = sign; - *--exponent_start = exp; - } - } - exponent_size = EBUF_END - exponent_start; - if (mode == 1) - precision = 1; - /* If we print an exponent, always show just one digit before point. */ - if (exponent_size) - decpt = 1; - if (decpt == 9999) - { /* Infinity or NaN */ - decpt = useful_digits; - precision = 0; - show_dot = 0; - } - - /* dtoa truncates trailing zeroes. Set the variable trailing_zeroes to - the number of 0's we have to add (after the decimal point). */ - if (skip_zeroes) - trailing_zeroes = 0; - else if (type == 'f') - trailing_zeroes = useful_digits <= decpt ? precision - : precision-(useful_digits-decpt); - else if (exponent_size) /* 'e' 'E' or 'g' format using exponential notation*/ - trailing_zeroes = precision - useful_digits; - else /* 'g' format not using exponential notation. */ - trailing_zeroes = useful_digits <= decpt ? precision - decpt - : precision-useful_digits; - if (trailing_zeroes < 0) trailing_zeroes = 0; - - if (trailing_zeroes != 0 || useful_digits > decpt) - show_dot = 1; - if (sign_mode == 0) - print_sign = sign ? '-' : 0; - else if (sign_mode == '+') - print_sign = sign ? '-' : '+'; - else /* if (sign_mode == ' ') */ - print_sign = sign ? '-' : ' '; - - /* Calculate the width (before padding). */ - unpadded_width = - (print_sign != 0) + trailing_zeroes + exponent_size + show_dot - + useful_digits - + (decpt > useful_digits ? decpt - useful_digits - : decpt > 0 ? 0 : 1 - decpt); - - padding = width > unpadded_width ? width - unpadded_width : 0; - if (padding > 0 && pad_kind != _IO_LEFT && pad_kind != _IO_INTERNAL) - PADN(fill, padding); /* Default (right) adjust */ - if (print_sign) - PUT(print_sign); - if (pad_kind == _IO_INTERNAL && padding > 0) - PADN(fill, padding); - if (decpt > 0) - { - if (useful_digits >= decpt) - PUTN(p, decpt); - else - { - PUTN(p, useful_digits); - PADN('0', decpt-useful_digits); - } - if (show_dot) - { - PUT('.'); - /* Print digits after the decimal point. */ - if (useful_digits > decpt) - PUTN(p + decpt, useful_digits-decpt); - } - } - else - { - PUT('0'); - if (show_dot) - { - PUT('.'); - PADN('0', -decpt); - /* Print digits after the decimal point. */ - PUTN(p, useful_digits); - } - } - PADN('0', trailing_zeroes); - if (exponent_size) - PUTN(exponent_start, exponent_size); - if (pad_kind == _IO_LEFT && padding > 0) /* Left adjustment*/ - PADN(fill, padding); - return count; - error: - return EOF; -} -#endif diff --git a/contrib/libio/parsestream.cc b/contrib/libio/parsestream.cc deleted file mode 100644 index e430e602c8..0000000000 --- a/contrib/libio/parsestream.cc +++ /dev/null @@ -1,317 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. - -Written by Per Bothner (bothner@cygnus.com). */ - -#ifdef __GNUG__ -#pragma implementation -#endif -#include "libioP.h" -#include "parsestream.h" -#include - -streambuf* parsebuf::setbuf(char*, int) -{ - return NULL; -} - -int parsebuf::tell_in_line() -{ - return 0; -} - -int parsebuf::pbackfail(int c) -{ - if (c == EOF) - return 0; - if (seekoff(-1, ios::cur) == EOF) - return EOF; - return (unsigned char)c; -} - -char* parsebuf::current_line() { return NULL; } - -streampos parsebuf::seekoff(streamoff offset, _seek_dir dir, int) -{ - // Make offset relative to line start. - switch (dir) { - case ios::beg: - offset -= pos_at_line_start; - break; - case ios::cur: - offset += tell_in_line(); - break; - default: - return EOF; - } - if (offset < -1) - return EOF; - if (offset > _line_length + 1) - return EOF; - return seek_in_line(offset) + pos_at_line_start; -} - -// string_parsebuf invariants: -// The reserve ares (base() .. ebuf()) is always the entire string. -// The get area (eback() .. egptr()) is the extended current line -// (i.e. with the '\n' at either end, if these exist). - -string_parsebuf::string_parsebuf(char *buf, int len, - int delete_at_close /* = 0*/) -: parsebuf() -{ - setb(buf, buf+len, delete_at_close); - register char *ptr = buf; - while (ptr < ebuf() && *ptr != '\n') ptr++; - _line_length = ptr - buf; - setg(buf, buf, ptr); -} - -int string_parsebuf::underflow() -{ - register char* ptr = egptr(); // Point to end of current_line - do { - int i = right() - ptr; - if (i <= 0) - return EOF; - ptr++; i--; // Skip '\n'. - char *line_start = ptr; - while (ptr < right() && *ptr == '\n') ptr++; - setg(line_start-1, line_start, ptr + (ptr < right())); - pos_at_line_start = line_start - left(); - _line_length = ptr - line_start; - __line_number++; - } while (gptr() == ptr); - return *gptr(); -} - -char* string_parsebuf::current_line() -{ - char *ptr = eback(); - if (__line_number > 0) - ptr++; // Skip '\n' at end of previous line. - return ptr; -} - -int string_parsebuf::tell_in_line() -{ - int offset = gptr() - eback(); - if (__line_number > 0) - offset--; - return offset; -} - -int string_parsebuf::seek_in_line(int i) -{ - int delta = i - tell_in_line(); - gbump(delta); // FIXME: Needs error (bounds) checking! - return i; -} - -static const char NewLine[1] = { '\n' }; - -general_parsebuf::general_parsebuf(streambuf *buf, int delete_arg_buf) - : parsebuf() -{ - delete_buf = delete_arg_buf; - sbuf = buf; - int buf_size = 128; - char* buffer = (char*)malloc(buf_size); - setb(buffer, buffer+buf_size, 1); -// setg(buffer, buffer, buffer); -} - -general_parsebuf::~general_parsebuf() -{ - if (delete_buf) - delete sbuf; -} - -int general_parsebuf::underflow() -{ - register char *ptr = base(); - int has_newline = eback() < gptr() && gptr()[-1] == '\n'; - if (has_newline) - *ptr++ = '\n'; - register streambuf *sb = sbuf; - register int ch; - for (;;) { - ch = sb->sbumpc(); - if (ch == EOF) - break; - if (ptr == ebuf()) { - int old_size = ebuf() - base(); - char *new_buffer = new char[old_size * 2]; - memcpy(new_buffer, base(), old_size); - setb(new_buffer, new_buffer + 2 * old_size, 1); - ptr = new_buffer + old_size; - } - *ptr++ = ch; - if (ch == '\n') - break; - } - char *cur_pos = base() + has_newline; - pos_at_line_start += _line_length + 1; - _line_length = ptr - cur_pos; - if (ch != EOF || _line_length > 0) - __line_number++; - setg(base(), cur_pos, ptr); - return ptr == cur_pos ? EOF : cur_pos[0]; -} - -char* general_parsebuf::current_line() -{ - char* ret = base(); - if (__line_number > 1) - ret++; // Move past '\n' from end of previous line. - return ret; -} - -int general_parsebuf::tell_in_line() -{ - int off = gptr() - base(); - if (__line_number > 1) - off--; // Subtract 1 for '\n' from end of previous line. - return off; -} - -int general_parsebuf::seek_in_line(int i) -{ - if (__line_number == 0) - (void)general_parsebuf::underflow(); - if (__line_number > 1) - i++; // Add 1 for '\n' from end of previous line. - if (i < 0) i = 0; - int len = egptr() - eback(); - if (i > len) i = len; - setg(base(), base() + i, egptr()); - return i; -} - -func_parsebuf::func_parsebuf(CharReader func, void *argm) : parsebuf() -{ - read_func = func; - arg = argm; - buf_start = NULL; - buf_end = NULL; - setb((char*)NewLine, (char*)NewLine+1, 0); - setg((char*)NewLine, (char*)NewLine+1, (char*)NewLine+1); - backed_up_to_newline = 0; -} - -int func_parsebuf::tell_in_line() -{ - if (buf_start == NULL) - return 0; - if (egptr() != (char*)NewLine+1) - // Get buffer was line buffer. - return gptr() - buf_start; - if (backed_up_to_newline) - return -1; // Get buffer is '\n' preceding current line. - // Get buffer is '\n' following current line. - return (buf_end - buf_start) + (gptr() - (char*)NewLine); -} - -char* func_parsebuf::current_line() -{ - return buf_start; -} - -int func_parsebuf::seek_in_line(int i) -{ - if (i < 0) { - // Back up to preceding '\n'. - if (i < -1) i = -1; - backed_up_to_newline = 1; - setg((char*)NewLine, (char*)NewLine+(i+1), (char*)NewLine+1); - return i; - } - backed_up_to_newline = 0; - int line_length = buf_end-buf_start; - if (i <= line_length) { - setg(buf_start, buf_start+i, buf_end); - return i; - } - i -= line_length; - if (i > 0) i = 1; - setg((char*)NewLine, (char*)NewLine+i, (char*)NewLine+1); - return line_length + i; -} - -int func_parsebuf::underflow() -{ - retry: - if (gptr() < egptr()) - return *gptr(); - if (gptr() != (char*)NewLine+1) { - // Get buffer was line buffer. Move to following '\n'. - setg((char*)NewLine, (char*)NewLine, (char*)NewLine+1); - return *gptr(); - } - if (backed_up_to_newline) - // Get buffer was '\n' preceding current line. Move to current line. - backed_up_to_newline = 0; - else { - // Get buffer was '\n' following current line. Read new line. - if (buf_start) free(buf_start); - char *str = (*read_func)(arg); - buf_start = str; - if (str == NULL) - return EOF; - // Initially, _line_length == -1, so pos_at_line_start becomes 0. - pos_at_line_start += _line_length + 1; - _line_length = strlen(str); - buf_end = str + _line_length; - __line_number++; - } - setg(buf_start, buf_start, buf_end); - goto retry; -} - -#if 0 -size_t parsebuf::line_length() -{ - if (current_line_length == (size_t)(-1)) // Initial value; - (void)sgetc(); - return current_line_length; -} -#endif - -int parsebuf::seek_in_line(int i) -{ -#if 1 - abort(); - return i; // Suppress warnings. -#else - if (i > 0) { - size_t len = line_length(); - if ((unsigned)i > len) i = len; - } - else if (i < -1) i = -1; - int new_pos = seekoff(pos_at_line_start + i, ios::beg); - if (new_pos == EOF) - return tell_in_line(); - else return new_pos - pos_at_line_start; -#endif -} diff --git a/contrib/libio/parsestream.h b/contrib/libio/parsestream.h deleted file mode 100644 index 97655bcbf6..0000000000 --- a/contrib/libio/parsestream.h +++ /dev/null @@ -1,156 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. - -Written by Per Bothner (bothner@cygnus.com). */ - -#ifndef PARSESTREAM_H -#define PARSESTREAM_H -#ifdef __GNUG__ -#pragma interface -#endif -#include "streambuf.h" - -extern "C++" { -// A parsebuf is a streambuf optimized for scanning text files. -// It keeps track of line and column numbers. -// It is guaranteed to remember the entire current line, -// as well the '\n'-s on either side of it (if they exist). -// You can arbitrarily seek (or unget) within this extended line. -// Other backward seeks are not supported. -// Normal read semantics are supported (and hence istream operators like >>). - -class parsebuf : public streambuf { - protected: - _IO_off_t pos_at_line_start; - long _line_length; - unsigned long __line_number; - char *buf_start; - char *buf_end; - - public: - parsebuf *chain; - - // Return column number (raw - don't handle tabs etc). - // Retult can be -1, meaning: at '\n' before current line. - virtual int tell_in_line(); - - // seek to (raw) column I in current line. - // Result is new (raw) column position - differs from I if unable to seek. - // Seek to -1 tries to seek to before previous LF. - virtual int seek_in_line(int i); - - // Note: there is no "current line" initially, until something is read. - - // Current line number, starting with 0. - // If tell_in_line()==-1, then line number of next line. - int line_number() { return __line_number; } - - // Length of current line, not counting either '\n'. - int line_length() { return _line_length; } - // Current line - not a copy, so file ops may trash it. - virtual char* current_line(); - virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); - virtual streambuf* setbuf(char* p, int len); - protected: - parsebuf() { chain= NULL; - __line_number = 0; pos_at_line_start = 0; _line_length = -1; } - virtual int pbackfail(int c); -}; - -// A string_parsebuf is a parsebuf whose source is a fixed string. - -class string_parsebuf : public parsebuf { - public: - int do_delete; - string_parsebuf(char *str, int len, int delete_at_close=0); - virtual int underflow(); - virtual char* current_line(); - virtual int seek_in_line(int i); - virtual int tell_in_line(); - char *left() const { return base(); } - char *right() const { return ebuf(); } -// streampos seekoff(streamoff, _seek_dir, int); -}; - -// A func_parsebuf calls a given function to get new input. -// Each call returns an entire NUL-terminated line (without the '\n'). -// That line has been allocated with malloc(), not new. -// The interface is tailored to the GNU readline library. -// Example: -// char* DoReadLine(void* arg) -// { -// char *line = readline((char*)arg); /* 'arg' is used as prompt. */ -// if line == NULL) { putc('\n', stderr); return NULL; } -// if (line[0] != '\0') add_history(line); -// return line; -// } -// char PromptBuffer[100] = "> "; -// func_parsebuf my_stream(DoReadLine, PromptBuffer); - -typedef char *(*CharReader)(void *arg); -class istream; - -class func_parsebuf : public parsebuf { - public: - void *arg; - CharReader read_func; - int backed_up_to_newline; - func_parsebuf(CharReader func, void *argm = NULL); - int underflow(); - virtual int tell_in_line(); - virtual int seek_in_line(int i); - virtual char* current_line(); -}; - -// A general_parsebuf is a parsebuf which gets its input from some -// other streambuf. It explicitly buffers up an entire line. - -class general_parsebuf : public parsebuf { - public: - streambuf *sbuf; - int delete_buf; // Delete sbuf when destroying this. - general_parsebuf(streambuf *buf, int delete_arg_buf = 0); - int underflow(); - virtual int tell_in_line(); - virtual int seek_in_line(int i); - ~general_parsebuf(); - virtual char* current_line(); -}; - -#if 0 -class parsestream : public istream { - streammarker marks[2]; - short _first; // of the two marks; either 0 or 1 - int _lineno; - int first() { return _first; } - int second() { return 1-_first; } - int line_length() { marks[second].delta(marks[first]); } - int line_length() { marks[second].delta(marks[first]); } - int seek_in_line(int i); - int tell_in_line(); - int line_number(); -}; -#endif -} // extern "C++" -#endif /*!defined(PARSESTREAM_H)*/ diff --git a/contrib/libio/peekc.c b/contrib/libio/peekc.c deleted file mode 100644 index 0b3b5140c2..0000000000 --- a/contrib/libio/peekc.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include "stdio.h" - -#undef _IO_peekc - -int -_IO_peekc_locked (fp) - _IO_FILE *fp; -{ - int result; - CHECK_FILE (fp, EOF); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - result = _IO_peekc_unlocked (fp); - _IO_cleanup_region_end (1); - return result; -} diff --git a/contrib/libio/pfstream.cc b/contrib/libio/pfstream.cc deleted file mode 100644 index 3fa93c958f..0000000000 --- a/contrib/libio/pfstream.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* Written by Per Bothner (bothner@cygnus.com). */ - -#ifdef __GNUG__ -#pragma implementation -#endif -#include "libioP.h" -#include -#include - -ipfstream::ipfstream(const char *name, int mode, int prot) -{ - const char* p; - - // Look for '| command' (as used by ftp). - for (p = name; *p == ' ' || *p == '\t'; p++) ; - if (*p == '|') { - procbuf *pbuf = new procbuf(); - init(pbuf); - if (!pbuf->open(p+1, mode)) - set(ios::badbit); - return; - } - - // Look for 'command |' - while (*p) p++; // Point to last - while (p[-1] == ' ' || p[-1] == '\t' || p[-1] == '\n') p--; - if (p[-1] == '|') { - // Must remove the final '|'. - p--; -#if !defined (__GNUC__) || defined (__STRICT_ANSI__) - char *command = new char[p-name+1]; -#else - char command[p-name+1]; -#endif - memcpy(command, name, p-name); - command[p-name] = '\0'; - - procbuf *pbuf = new procbuf(); - if (pbuf->open(command, mode)) - set(ios::badbit); -#if !defined (__GNUC__) || defined (__STRICT_ANSI__) - delete command; -#endif - return; - } - - init(new filebuf()); - if (!rdbuf()->open(name, mode, prot)) - set(ios::badbit); -} - -opfstream::opfstream(const char *name, int mode, int prot) -{ - const char *p; - // Look for '| command'. - for (p = name; *p == ' ' || *p == '\t'; p++) ; - if (*p == '|') { - procbuf *pbuf = new procbuf(); - init(pbuf); - if (!pbuf->open(p+1, mode)) - set(ios::badbit); - } - else { - init(new filebuf()); - if (!rdbuf()->open(name, mode, prot)) - set(ios::badbit); - } -} diff --git a/contrib/libio/pfstream.h b/contrib/libio/pfstream.h deleted file mode 100644 index 3c5458baaa..0000000000 --- a/contrib/libio/pfstream.h +++ /dev/null @@ -1,59 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* Written by Per Bothner (bothner@cygnus.com). */ - -#ifndef _PFSTREAM_H -#define _PFSTREAM_H -#ifdef __GNUG__ -#pragma interface -#endif -#include - -extern "C++" { -// ipfstream foo("NAME") is like: ifstream foo("NAME"). However, -// if NAME starts *or ends* with a '|', the remainder of NAME is -// evaluated as a shell command (using a procbuf), and all input -// read from foo is whatever that shell writes to its standard output. -// E.g. ipfstream foo("|zcat foo.Z") or ipfstream foo("zcat foo.Z|") -// (These two forms are equivalent.) - -class ipfstream : public ifstream { - public: - ipfstream(const char *name, int mode=ios::in, int prot=0664); -}; - -// opfstream foo("NAME") is like: ofstream foo("NAME"). -// However, if NAME starts with a '|', the remainder of NAME is -// evaluated as a shell command (using a procbuf), and all output -// written to foo is piped to the standard input of that shell. -// E.g. opfstream foo("|more"); - -class opfstream : public ofstream { - public: - opfstream(const char *name, int mode=ios::out, int prot=0664); -}; -} // extern "C++" -#endif /*!_PFSTREAM_H*/ - diff --git a/contrib/libio/procbuf.cc b/contrib/libio/procbuf.cc deleted file mode 100644 index eb6d50e779..0000000000 --- a/contrib/libio/procbuf.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* Written by Per Bothner (bothner@cygnus.com). */ - -#ifdef __GNUG__ -#pragma implementation -#endif - -#include "libioP.h" -#include "procbuf.h" - -procbuf::procbuf(const char *command, int mode) : filebuf() -{ - _IO_proc_open(this, command, (mode & ios::in) ? "r" : "w"); -} - -procbuf *procbuf::open(const char *command, int mode) -{ - return (procbuf*)_IO_proc_open(this, command, (mode & ios::in) ? "r" : "w"); -} - -/* #define USE_SIGMASK */ - -int procbuf::sys_close() -{ - return _IO_proc_close(this); -} - -procbuf::~procbuf() -{ - close(); -} diff --git a/contrib/libio/procbuf.h b/contrib/libio/procbuf.h deleted file mode 100644 index b361a6a7c8..0000000000 --- a/contrib/libio/procbuf.h +++ /dev/null @@ -1,50 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* Written by Per Bothner (bothner@cygnus.com). */ - -#ifndef _PROCBUF_H -#define _PROCBUF_H -#ifdef __GNUG__ -#pragma interface -#endif - -#include - -extern "C++" { -class procbuf : public filebuf { - /* Following fields must match those in struct _IO_proc_file */ - _IO_pid_t _pid; - procbuf *_next; - public: - procbuf() : filebuf() { } - procbuf(const char *command, int mode); - procbuf* open(const char *command, int mode); - procbuf *close() { return (procbuf*)filebuf::close(); } - virtual int sys_close(); - ~procbuf(); -}; -} // extern "C++" - -#endif /* !_PROCBUF_H */ diff --git a/contrib/libio/sbform.cc b/contrib/libio/sbform.cc deleted file mode 100644 index c17bd08db1..0000000000 --- a/contrib/libio/sbform.cc +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" -#include "streambuf.h" -#include - -int streambuf::vform(char const *fmt0, _IO_va_list ap) -{ - return _IO_vfprintf(this, fmt0, ap); -} -int streambuf::form(char const *format ...) -{ - va_list ap; - va_start(ap, format); - int count = _IO_vfprintf(this, format, ap); - va_end(ap); - return count; -} diff --git a/contrib/libio/sbgetline.cc b/contrib/libio/sbgetline.cc deleted file mode 100644 index 0475114c62..0000000000 --- a/contrib/libio/sbgetline.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" -#include "streambuf.h" - -long streambuf::sgetline(char* buf, _IO_size_t n, char delim, int extract_delim) -{ - return _IO_getline_info(this, buf, n, delim, extract_delim, (int *) 0); -} diff --git a/contrib/libio/sbscan.cc b/contrib/libio/sbscan.cc deleted file mode 100644 index c0ec35c53d..0000000000 --- a/contrib/libio/sbscan.cc +++ /dev/null @@ -1,45 +0,0 @@ - -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" -#include "streambuf.h" -#include - -int streambuf::vscan(char const *fmt0, _IO_va_list ap, ios* stream /* = NULL*/) -{ - int errcode = 0; - int count = _IO_vfscanf(this, fmt0, ap, &errcode); - if (stream) - stream->setstate((ios::iostate)errcode); - return count; -} -int streambuf::scan(char const *format ...) -{ - va_list ap; - va_start(ap, format); - int count = _IO_vfscanf(this, format, ap, NULL); - va_end(ap); - return count; -} diff --git a/contrib/libio/stdfiles.c b/contrib/libio/stdfiles.c deleted file mode 100644 index 8453e33c34..0000000000 --- a/contrib/libio/stdfiles.c +++ /dev/null @@ -1,51 +0,0 @@ -/* 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/contrib/libio/stdio/ChangeLog b/contrib/libio/stdio/ChangeLog deleted file mode 100644 index 8ef9dcc0b3..0000000000 --- a/contrib/libio/stdio/ChangeLog +++ /dev/null @@ -1,153 +0,0 @@ -Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com) - - * gcc-2.95.3 Released. - -Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.2 Released. - -Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.1 Released. - -Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -1997-09-04 16:11 Ulrich Drepper - - * Makefile.in (STDIO_OBJECTS): Lose feof.o and ferror.o. Add getc.o - and putc.o. - (stmp-libio, stmp-libiostream, stmp-io, stmp-streamlib): New rules. - - (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. - - * clearerr.c: Add copyright and lock stream before use. - * feof.c: Likewise. - * ferror.c: Likewise. - * fgetc.c: Likewise. - * fputc.c: Likewise. - * freopen.c: Likewise. - * fseek.c: Likewise. - * getc.c: Likewise. - * getchar.c: Likewise. - * putc.c: Likewise. - * putchar.c: Likewise. - * rewind.c: Likewise. - - * setbuf.c: Update copyright. - * setlinebuf.c: Likewise. - * vscanf.c: Likewise. - - * fileno.c: Define alias fileno_unlocked. Update copyright. - - * clearerr_u.c: New file. Implement clearerr_unlocked function. - * feof_u.c: New file. Implement feof_unlocked function. - * ferror_u.c: New file. Implement ferror_unlocked function. - * fputc_u.c: New file. Implement fputc_unlocked function. - * getc_u.c: New file. Implement getc_unclocked function. - * getchar_u.c: New file. Implement getchar_unclocked function. - * putc_u.c: New file. Implement putc_unclocked function. - * putchar_u.c: New file. Implement putchar_unclocked function. - - * vsnprintf.c: Rewrite according to ISO C 9X draft. - -Thu May 1 11:03:45 1997 Brendan Kehoe - - * stdio.h (TMP_MAX): Wrap it with #ifndef for now, since it can - get defined by (e.g., HP/UX and AIX). - -Wed Mar 12 08:51:37 1997 Gavin Koch - - * stdio.h: Use _IO_va_list rather than _G_va_list. - -Wed Jun 14 21:41:50 1995 Jason Merrill - - * configure.in (LIBDIR): Set. - (MOSTLYCLEAN): Remove pic and stamp-picdir. - (stdio_objects): Also compile pic version. - - * Makefile.in (STDIO_OBJECTS): Remove getdelim.o. - -Wed May 10 03:05:53 1995 Jason Merrill - - * vsnprintf.c (vsnprintf): Update to use _IO_JUMPS. - - * Makefile.in (STDIO_OBJECTS): Fix typo. - -Tue Oct 18 17:15:09 1994 Per Bothner - - * getline.c, snprintf.c, vsnprintf.c: New files, providing - functionality of the GNU C library. - * Makefile.in (STDIO_OBJECTS), configure.in: Add new files. - * stdio.h: Add new functions. - -Fri Oct 14 15:56:27 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * stdio.h: Added vfscanf, vscanf, vsscanf, #ifndef __STRICT_ANSI__. - -Tue Aug 23 16:17:25 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * stdio.h: Added comment, at hjl's request. - -Sun Aug 7 13:28:12 1994 H.J. Lu (hjl@nynexst.com) - - * stdio.h (getc, getchar, putc, putchar): New declarations. - Move macros after the declarations. - -Fri Aug 5 18:27:21 1994 H.J. Lu (hjl@nynexst.com) - - * clearerr.c, rewind.c, setfileno.c: - Add CHECK_FILE(fp, ) and remove COERCE_FILE(fp). - * feof.c, ferror.c, fgetc.c, fileno.c, fputc.c, getw.c, putw.c, - vfscanf.c: Add CHECK_FILE(fp, EOF) and remove COERCE_FILE(fp). - * freopen.c: Add CHECK_FILE(fp, NULL) and remove COERCE_FILE(fp). - * fseek.c, vfprintf.c: - Add CHECK_FILE(fp, -1) and remove COERCE_FILE(fp). - -Fri May 20 13:11:58 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * stdio.h: Rename _ARGS macro to __P for better gnlibc and - BSD compatibility. - -Fri Nov 26 13:26:35 1993 Per Bothner (bothner@kalessin.cygnus.com) - - Bunch of little changes, many from H.J. Lu . - * feof.c, setbuf.c, vprintf.c, vcanf.c: #include , - for error checking. - * fileno.c: #include libioP.h, not just libio.h. - * fputc.c: Fix typo. - * fseek.c, rewind.c: Use #include "...", not <...> ,for local files. - * getc.c, getchar.c, putc.c, putchar.c: New files, providing - non-macro versions of the standard macros. - * getw.c, putw.c, setfileno.c, setlinebuf.c: New files. - * Makefile.in (STDIO_OBJECTS): Add new files. - * vfscanf.c: Add missing new 4th arg to _IO_vfscanf call. - -Thu Oct 14 16:12:07 1993 Karen Christiansen (karen@deneb.cygnus.com) - - * configure.in: changed mv to mv -f - -Mon Oct 4 17:29:23 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * configure.in (stdio_renames): Add fgetpos, fsetpos, gets, - perror, setbuffer, ungetc. - * clearerr.c, ferror.c, fgetc.c, fileno.c, fputc.c, freopen.c, - fseek.c, popen.c, rewind.c, setbuf.c: New files. - * Makefile.in (STDIO_OBJECTS): Add new files. - * stdio.h: Use _IO_XXX instead of _G_XXX many places. - #include instead of <_stdio.h>, to get useful defs. - -Fri Aug 20 00:28:28 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * feof.c, vprintf.c, vscanf.c: Converted stub functions. - * configure.in (stdio_renamed): Removed feof. - Added sprintf sscanf vsscanf. - * ChangeLog.old: Copy of old libg++/iostream/stdio/ChangeLog. diff --git a/contrib/libio/stdio/Makefile.in b/contrib/libio/stdio/Makefile.in deleted file mode 100644 index 680c8a497a..0000000000 --- a/contrib/libio/stdio/Makefile.in +++ /dev/null @@ -1,35 +0,0 @@ -srcdir = . - -#### package, host, target, and site dependent Makefile fragments come in here. -## - -# These are compiled from the corresponding ../ioFOO.c files. -STDIO_RENAMED_OBJECTS = ... filled in by configure ... -# These are the files that a libc would want. -STDIO_OBJECTS = $(STDIO_RENAMED_OBJECTS) \ - clearerr.o fdopen.o fgetc.o fileno.o \ - fputc.o freopen.o fseek.o getchar.o getline.o getw.o \ - popen.o putchar.o putw.o rewind.o \ - setbuf.o setfileno.o setlinebuf.o snprintf.o \ - vfprintf.o vfscanf.o vprintf.o vscanf.o vsnprintf.o - -CC_FOR_STDIO=$(CC) -CINCLUDES = -I. -I$(srcdir) -I.. -I$(srcdir)/.. -D__USE_GNU - -nothing: - -stmp-libio: stdio.list stamp-io - -stamp-io: - $(AR) $(AR_FLAGS) ../libio.a $(STDIO_OBJECTS) - touch stmp-io - -stmp-libiostream: stdio.list stamp-streamlib - -stamp-streamlib: - $(AR) $(AR_FLAGS) ../libiostream.a $(STDIO_OBJECTS) - touch stmp-streamlib - -stdio.list: stamp-picdir $(STDIO_OBJECTS) - @echo "$(STDIO_OBJECTS)" >stdio.list - diff --git a/contrib/libio/stdio/clearerr.c b/contrib/libio/stdio/clearerr.c deleted file mode 100644 index 4776250ff8..0000000000 --- a/contrib/libio/stdio/clearerr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 1995, 1996, 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. */ - -#include "libioP.h" -#include "stdio.h" - -void -clearerr (fp) - FILE *fp; -{ - CHECK_FILE (fp, /*nothing*/); - _IO_flockfile (fp); - _IO_clearerr (fp); - _IO_funlockfile (fp); -} diff --git a/contrib/libio/stdio/clearerr_u.c b/contrib/libio/stdio/clearerr_u.c deleted file mode 100644 index 2a1ba7070b..0000000000 --- a/contrib/libio/stdio/clearerr_u.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 1995, 1996, 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. */ - -#include "libioP.h" -#include "stdio.h" - -void -clearerr_unlocked (fp) - FILE *fp; -{ - CHECK_FILE (fp, /*nothing*/); - _IO_clearerr (fp); -} diff --git a/contrib/libio/stdio/configure.in b/contrib/libio/stdio/configure.in deleted file mode 100644 index 83cac17ebc..0000000000 --- a/contrib/libio/stdio/configure.in +++ /dev/null @@ -1,49 +0,0 @@ -# This file is a shell script fragment that supplies the information -# necessary for a configure script to process the program in -# this directory. For more information, look at ../configure. - -configdirs= -srctrigger=stdio.h -srcname="libio/stdio" -package_makefile_frag=../Make.pack -package_makefile_rules_frag=../Make.pack.r - -# per-host: - -# per-target: - -LIBDIR=yes -TO_TOPDIR=../../ -ALL=nothing -MOSTLYCLEAN='*.o pic stamp-picdir core stdio.list' -(. ${srcdir}/../config.shared) >${package_makefile_frag} 2>${package_makefile_rules_frag} - -# post-target: - -# Certain files that are used to build a C library (such as fprintf.o) -# are compled from the same sources as the ioXXX versions (such as ioprintf.c). -# These lines add the appropriate rules. -# NOTE: We assume a C compiler that where -o with -c works. -# But these files are not built by default anyway ... - -# TODO: remove rename tmpfile tmpnam - -stdio_renames="fclose fflush fgetpos fgets fopen fprintf fputs fread \ - fscanf fsetpos ftell fwrite getdelim gets perror printf puts \ - scanf setbuffer setvbuf sprintf sscanf ungetc vsprintf vsscanf" -stdio_objects="" - -for file in $stdio_renames ; do - cat >>Makefile <tmp -mv -f tmp Makefile diff --git a/contrib/libio/stdio/fdopen.c b/contrib/libio/stdio/fdopen.c deleted file mode 100644 index 83e026ec7f..0000000000 --- a/contrib/libio/stdio/fdopen.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "libioP.h" - -_IO_FILE * -fdopen (fd, mode) - int fd; - const char *mode; -{ - return _IO_fdopen (fd, mode); -} diff --git a/contrib/libio/stdio/feof.c b/contrib/libio/stdio/feof.c deleted file mode 100644 index d06de044fb..0000000000 --- a/contrib/libio/stdio/feof.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "libioP.h" -#include "stdio.h" - -int -_IO_feof (fp) - _IO_FILE* fp; -{ - int result; - CHECK_FILE (fp, EOF); - _IO_flockfile (fp); - result = _IO_feof_unlocked (fp); - _IO_funlockfile (fp); - return result; -} - -#ifdef weak_alias -weak_alias (_IO_feof, feof) -#endif diff --git a/contrib/libio/stdio/feof_u.c b/contrib/libio/stdio/feof_u.c deleted file mode 100644 index 4773599012..0000000000 --- a/contrib/libio/stdio/feof_u.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "libioP.h" -#include "stdio.h" - -#undef feof_unlocked - -int -feof_unlocked (fp) - _IO_FILE* fp; -{ - CHECK_FILE (fp, EOF); - return _IO_feof_unlocked (fp); -} diff --git a/contrib/libio/stdio/ferror.c b/contrib/libio/stdio/ferror.c deleted file mode 100644 index 855627ade6..0000000000 --- a/contrib/libio/stdio/ferror.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include "stdio.h" - -int -_IO_ferror (fp) - _IO_FILE* fp; -{ - int result; - CHECK_FILE (fp, EOF); - _IO_flockfile (fp); - result = _IO_ferror_unlocked (fp); - _IO_funlockfile (fp); - return result; -} - -#ifdef weak_alias -weak_alias (_IO_ferror, ferror) -#endif diff --git a/contrib/libio/stdio/ferror_u.c b/contrib/libio/stdio/ferror_u.c deleted file mode 100644 index 6e13e53ddc..0000000000 --- a/contrib/libio/stdio/ferror_u.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include "stdio.h" - -#undef ferror_unlocked - -int -ferror_unlocked (fp) - _IO_FILE* fp; -{ - CHECK_FILE (fp, EOF); - return _IO_ferror_unlocked (fp); -} diff --git a/contrib/libio/stdio/fgetc.c b/contrib/libio/stdio/fgetc.c deleted file mode 100644 index 174e60fa3f..0000000000 --- a/contrib/libio/stdio/fgetc.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include "stdio.h" - -int -fgetc (fp) - FILE *fp; -{ - int result; - CHECK_FILE (fp, EOF); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - result = _IO_getc_unlocked (fp); - _IO_cleanup_region_end (1); - return result; -} diff --git a/contrib/libio/stdio/fileno.c b/contrib/libio/stdio/fileno.c deleted file mode 100644 index 7ff93e6a81..0000000000 --- a/contrib/libio/stdio/fileno.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include "stdio.h" - -int -fileno (fp) - _IO_FILE* fp; -{ - CHECK_FILE (fp, EOF); - - if (!(fp->_flags & _IO_IS_FILEBUF)) - return EOF; - - return _IO_fileno (fp); -} - -#ifdef _IO_MTSAFE_IO -#ifdef weak_alias -/* The fileno implementation for libio does not require locking because - it only accesses once a single variable and this is already atomic - (at least at thread level). */ - -weak_alias (fileno, fileno_unlocked) -#endif -#endif diff --git a/contrib/libio/stdio/fputc.c b/contrib/libio/stdio/fputc.c deleted file mode 100644 index 22cdfab9a8..0000000000 --- a/contrib/libio/stdio/fputc.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "libioP.h" -#include "stdio.h" - -int -fputc (c, fp) - int c; - _IO_FILE *fp; -{ - int result; - CHECK_FILE (fp, EOF); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - result = _IO_putc_unlocked (c, fp); - _IO_cleanup_region_end (1); - return result; -} diff --git a/contrib/libio/stdio/fputc_u.c b/contrib/libio/stdio/fputc_u.c deleted file mode 100644 index 48701e1d6c..0000000000 --- a/contrib/libio/stdio/fputc_u.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "libioP.h" -#include "stdio.h" - -#undef fputc_unlocked - -int -fputc_unlocked (c, fp) - int c; - _IO_FILE *fp; -{ - CHECK_FILE (fp, EOF); - return _IO_putc_unlocked (c, fp); -} diff --git a/contrib/libio/stdio/freopen.c b/contrib/libio/stdio/freopen.c deleted file mode 100644 index ff57d6033d..0000000000 --- a/contrib/libio/stdio/freopen.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include "stdio.h" - -FILE* -freopen (filename, mode, fp) - const char* filename; - const char* mode; - FILE* fp; -{ - FILE *result; - CHECK_FILE (fp, NULL); - if (!(fp->_flags & _IO_IS_FILEBUF)) - return NULL; - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - result = _IO_freopen (filename, mode, fp); - _IO_cleanup_region_end (1); - return result; -} diff --git a/contrib/libio/stdio/fseek.c b/contrib/libio/stdio/fseek.c deleted file mode 100644 index f2563d33f2..0000000000 --- a/contrib/libio/stdio/fseek.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include "stdio.h" - -int -fseek (fp, offset, whence) - _IO_FILE* fp; - long int offset; - int whence; -{ - int result; - CHECK_FILE (fp, -1); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - result = _IO_fseek (fp, offset, whence); - _IO_cleanup_region_end (1); - return result; -} diff --git a/contrib/libio/stdio/getc.c b/contrib/libio/stdio/getc.c deleted file mode 100644 index 1dc53b5ed6..0000000000 --- a/contrib/libio/stdio/getc.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include "stdio.h" - -#undef _IO_getc - -int -_IO_getc (fp) - FILE *fp; -{ - int result; - CHECK_FILE (fp, EOF); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - result = _IO_getc_unlocked (fp); - _IO_cleanup_region_end (1); - return result; -} - -#undef getc - -#ifdef weak_alias -weak_alias (_IO_getc, getc) -#endif diff --git a/contrib/libio/stdio/getc_u.c b/contrib/libio/stdio/getc_u.c deleted file mode 100644 index f074427446..0000000000 --- a/contrib/libio/stdio/getc_u.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1993, 1995, 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. */ - -#include "libioP.h" -#include "stdio.h" - -#undef getc_unlocked - -int -getc_unlocked (fp) - FILE *fp; -{ - CHECK_FILE (fp, EOF); - return _IO_getc_unlocked (fp); -} diff --git a/contrib/libio/stdio/getchar.c b/contrib/libio/stdio/getchar.c deleted file mode 100644 index 93194b3912..0000000000 --- a/contrib/libio/stdio/getchar.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "libioP.h" -#include "stdio.h" - -#undef getchar - -int -getchar () -{ - int result; - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, stdin); - _IO_flockfile (stdin); - result = _IO_getc_unlocked (stdin); - _IO_cleanup_region_end (1); - return result; -} diff --git a/contrib/libio/stdio/getchar_u.c b/contrib/libio/stdio/getchar_u.c deleted file mode 100644 index bfbe56b30c..0000000000 --- a/contrib/libio/stdio/getchar_u.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "libioP.h" -#include "stdio.h" - -#undef getchar_unlocked - -int -getchar_unlocked () -{ - return _IO_getc_unlocked (stdin); -} diff --git a/contrib/libio/stdio/getline.c b/contrib/libio/stdio/getline.c deleted file mode 100644 index 6f4b677086..0000000000 --- a/contrib/libio/stdio/getline.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "libioP.h" -#include "stdio.h" - -/* NOTE: This geline function is different from _IO_getline. */ - -_IO_ssize_t -getline (lineptr, linelen, fp) - char** lineptr; - size_t* linelen; - FILE* fp; -{ - return _IO_getdelim (lineptr, linelen, '\n', fp); -} diff --git a/contrib/libio/stdio/getw.c b/contrib/libio/stdio/getw.c deleted file mode 100644 index 1dfafbc1d4..0000000000 --- a/contrib/libio/stdio/getw.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "libioP.h" -#include "stdio.h" - -int -getw(fp) - FILE *fp; -{ - int w; - _IO_size_t bytes_read; - CHECK_FILE(fp, EOF); - bytes_read = _IO_sgetn (fp, (char*)&w, sizeof(w)); - return sizeof(w) == bytes_read ? w : EOF; -} diff --git a/contrib/libio/stdio/obprintf.c b/contrib/libio/stdio/obprintf.c deleted file mode 100644 index 6b959e455a..0000000000 --- a/contrib/libio/stdio/obprintf.c +++ /dev/null @@ -1,168 +0,0 @@ -/* Print output of stream to given obstack. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - - 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. */ - - -#ifdef __STDC__ -#include -#endif -#include "libioP.h" -#include -#include -#include -#include - - -struct _IO_obstack_file -{ - struct _IO_FILE file; - const void *vtable; - struct obstack *obstack; -}; - - -static int -_IO_obstack_overflow (_IO_FILE *fp, int c) -{ - struct obstack *obstack = ((struct _IO_obstack_file *) fp)->obstack; - - /* Make room for another character. This might as well allocate a - new chunk a memory and moves the old contents over. */ - if (c != EOF) - obstack_1grow (obstack, c); - - /* Setup the buffer pointers again. */ - fp->_IO_write_base = obstack_base (obstack); - fp->_IO_write_ptr = obstack_next_free (obstack); - fp->_IO_write_end = fp->_IO_write_base + obstack_room (obstack); - /* Now allocate the rest of the current chunk. */ - obstack_blank_fast (obstack, fp->_IO_write_end - fp->_IO_write_ptr); - - return c; -} - - -static _IO_size_t -_IO_obstack_xsputn (_IO_FILE *fp, const void *data, _IO_size_t n) -{ - struct obstack *obstack = ((struct _IO_obstack_file *) fp)->obstack; - - if (fp->_IO_write_ptr + n > fp->_IO_write_end) - { - /* We need some more memory. First shrink the buffer to the - space we really currently need. */ - obstack_blank (obstack, fp->_IO_write_ptr - fp->_IO_write_end); - - /* Now grow for N bytes. */ - obstack_blank (obstack, n); - - /* Setup the buffer pointers again. */ - fp->_IO_write_base = obstack_base (obstack); - fp->_IO_write_ptr = obstack_next_free (obstack); - fp->_IO_write_end = (fp->_IO_write_base + obstack_room (obstack)); - /* Now allocate the rest of the current chunk. */ - obstack_blank_fast (obstack, fp->_IO_write_end - fp->_IO_write_ptr); - } - else - { - memcpy (fp->_IO_write_ptr, data, n); - fp->_IO_write_ptr += n; - } - - return n; -} - - -/* the jump table. */ -static struct _IO_jump_t _IO_obstack_jumps = -{ - JUMP_INIT_DUMMY, - JUMP_INIT(finish, NULL), - JUMP_INIT(overflow, _IO_obstack_overflow), - JUMP_INIT(underflow, NULL), - JUMP_INIT(uflow, NULL), - JUMP_INIT(pbackfail, NULL), - JUMP_INIT(xsputn, _IO_obstack_xsputn), - JUMP_INIT(xsgetn, NULL), - JUMP_INIT(seekoff, NULL), - JUMP_INIT(seekpos, NULL), - JUMP_INIT(setbuf, NULL), - JUMP_INIT(sync, NULL), - JUMP_INIT(doallocate, NULL), - JUMP_INIT(read, NULL), - JUMP_INIT(write, NULL), - JUMP_INIT(seek, NULL), - JUMP_INIT(close, NULL), - JUMP_INIT(stat, NULL) -}; - - -int -_IO_obstack_vprintf (struct obstack *obstack, const char *format, va_list args) -{ - struct obstack_FILE - { - struct _IO_obstack_file ofile; -#ifdef _IO_MTSAFE_IO - _IO_lock_t lock; -#endif - } new_f; - int result; - -#ifdef _IO_MTSAFE_IO - new_f.ofile.file._lock = &new_f.lock; -#endif - - _IO_init ((_IO_FILE *) &new_f.ofile, 0); - _IO_JUMPS (&new_f.ofile.file) = &_IO_obstack_jumps; - _IO_str_init_static (&new_f.ofile.file, obstack_base (obstack), - (obstack_object_size (obstack) + - obstack_room (obstack)), obstack_next_free (obstack)); - /* Now allocate the rest of the current chunk. */ - obstack_blank_fast (obstack, - (new_f.ofile.file._IO_write_end - - new_f.ofile.file._IO_write_ptr)); - new_f.ofile.obstack = obstack; - - result = _IO_vfprintf ((_IO_FILE *) &new_f, format, args); - - /* Shrink the buffer to the space we really currently need. */ - obstack_blank (obstack, (new_f.ofile.file._IO_write_ptr - - new_f.ofile.file._IO_write_end)); - - return result; -} -#ifdef weak_alias -weak_alias (_IO_obstack_vprintf, obstack_vprintf) -#endif - - -int -_IO_obstack_printf (struct obstack *obstack, const char *format, ...) -{ - int result; - va_list ap; - va_start (ap, format); - result = _IO_obstack_vprintf (obstack, format, ap); - va_end (ap); - return result; -} -#ifdef weak_alias -weak_alias (_IO_obstack_printf, obstack_printf) -#endif diff --git a/contrib/libio/stdio/popen.c b/contrib/libio/stdio/popen.c deleted file mode 100644 index 9f9f3f72f5..0000000000 --- a/contrib/libio/stdio/popen.c +++ /dev/null @@ -1,23 +0,0 @@ -#include "libioP.h" -#include "stdio.h" -#include - -FILE * -popen(command, mode) - const char *command; const char *mode; -{ - return _IO_popen(command, mode); -} - -int -pclose(fp) - FILE *fp; -{ -#if 0 - /* Does not actually test that stream was created by popen(). Instead, - it depends on the filebuf::sys_close() virtual to Do The Right Thing. */ - if (fp is not a proc_file) - return -1; -#endif - return _IO_fclose(fp); -} diff --git a/contrib/libio/stdio/putc.c b/contrib/libio/stdio/putc.c deleted file mode 100644 index 3c35c365f0..0000000000 --- a/contrib/libio/stdio/putc.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 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. */ - -#include "libioP.h" -#include "stdio.h" - -#undef _IO_putc - -int -_IO_putc (c, fp) - int c; - _IO_FILE *fp; -{ - int result; - CHECK_FILE (fp, EOF); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - result = _IO_putc_unlocked (c, fp); - _IO_cleanup_region_end (1); - return result; -} - -#undef putc - -#ifdef weak_alias -weak_alias (_IO_putc, putc) -#endif diff --git a/contrib/libio/stdio/putc_u.c b/contrib/libio/stdio/putc_u.c deleted file mode 100644 index b4d94e8912..0000000000 --- a/contrib/libio/stdio/putc_u.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 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. */ - -#include "libioP.h" -#include "stdio.h" - -#undef putc_unlocked - -int -putc_unlocked (c, fp) - int c; - _IO_FILE *fp; -{ - CHECK_FILE (fp, EOF); - return _IO_putc_unlocked (c, fp); -} diff --git a/contrib/libio/stdio/putchar.c b/contrib/libio/stdio/putchar.c deleted file mode 100644 index 1e1dd13762..0000000000 --- a/contrib/libio/stdio/putchar.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 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. */ - -#include "libioP.h" -#include "stdio.h" - -#undef putchar - -int -putchar (c) - int c; -{ - int result; - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _IO_stdout); - _IO_flockfile (_IO_stdout); - result = _IO_putc_unlocked (c, _IO_stdout); - _IO_cleanup_region_end (1); - return result; -} diff --git a/contrib/libio/stdio/putchar_u.c b/contrib/libio/stdio/putchar_u.c deleted file mode 100644 index f8f387ac4e..0000000000 --- a/contrib/libio/stdio/putchar_u.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 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. */ - -#include "libioP.h" -#include "stdio.h" - -#undef putchar_unlocked - -int -putchar_unlocked (c) - int c; -{ - CHECK_FILE (stdout, EOF); - return _IO_putc_unlocked (c, stdout); -} diff --git a/contrib/libio/stdio/putw.c b/contrib/libio/stdio/putw.c deleted file mode 100644 index fd73261359..0000000000 --- a/contrib/libio/stdio/putw.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "libioP.h" -#include "stdio.h" - -#undef putw - -int -putw(w, fp) - int w; - FILE *fp; -{ - _IO_size_t written; - CHECK_FILE(fp, EOF); - written = _IO_sputn(fp, (const char *)&w, sizeof(w)); - return written == sizeof(w) ? 0 : EOF; -} diff --git a/contrib/libio/stdio/rewind.c b/contrib/libio/stdio/rewind.c deleted file mode 100644 index bce27575fd..0000000000 --- a/contrib/libio/stdio/rewind.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "libioP.h" -#include "stdio.h" - -void -rewind (fp) - _IO_FILE *fp; -{ - CHECK_FILE (fp, ); - _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - _IO_rewind (fp); - _IO_cleanup_region_end (1); -} diff --git a/contrib/libio/stdio/setbuf.c b/contrib/libio/stdio/setbuf.c deleted file mode 100644 index ac323a31b5..0000000000 --- a/contrib/libio/stdio/setbuf.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. - This file is part of the GNU IO Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - - As a special exception, if you link this library with files - compiled with a GNU compiler to produce an executable, this does - not cause the resulting executable to be covered by the GNU General - Public License. This exception does not however invalidate any - other reasons why the executable file might be covered by the GNU - General Public License. */ - -#include "libioP.h" -#include "stdio.h" - -void -setbuf (fp, buf) - _IO_FILE *fp; - char *buf; -{ - _IO_setbuffer (fp, buf, _IO_BUFSIZ); -} diff --git a/contrib/libio/stdio/setfileno.c b/contrib/libio/stdio/setfileno.c deleted file mode 100644 index f7ccc6fdd6..0000000000 --- a/contrib/libio/stdio/setfileno.c +++ /dev/null @@ -1,17 +0,0 @@ -/* Some known programs (xterm, pdksh?) non-portably change the _file - field of s struct _iobuf. This kludge allows the same "functionality". - This code is an undocumented feature for iostream/stdio. Use it at - your own risk. */ - -#include "libioP.h" -#include "stdio.h" - -void -setfileno(fp, fd) - _IO_FILE* fp; - int fd; -{ - CHECK_FILE(fp, ); - if ((fp->_flags & _IO_IS_FILEBUF) != 0) - fp->_fileno = fd; -} diff --git a/contrib/libio/stdio/setlinebuf.c b/contrib/libio/stdio/setlinebuf.c deleted file mode 100644 index e4e029faea..0000000000 --- a/contrib/libio/stdio/setlinebuf.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. - This file is part of the GNU IO Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - - As a special exception, if you link this library with files - compiled with a GNU compiler to produce an executable, this does - not cause the resulting executable to be covered by the GNU General - Public License. This exception does not however invalidate any - other reasons why the executable file might be covered by the GNU - General Public License. */ - -#include "libioP.h" -#include "stdio.h" - -#undef setlinebuf - -void -setlinebuf (stream) - _IO_FILE *stream; -{ - _IO_setvbuf (stream, NULL, 1, 0); -} diff --git a/contrib/libio/stdio/snprintf.c b/contrib/libio/stdio/snprintf.c deleted file mode 100644 index 5c70a44411..0000000000 --- a/contrib/libio/stdio/snprintf.c +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright (C) 1994 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" - -#ifdef __STDC__ -#include -#else -#include -#endif - -int -snprintf -#ifdef __STDC__ - (char *string, _IO_size_t maxlen, const char *format, ...) -#else -(string, maxlen, format, va_alist) - char *string; - _IO_size_t maxlen; - char *format; - va_dcl -#endif -{ - int ret; - va_list args; - _IO_va_start(args, format); - ret = vsnprintf(string, maxlen, format, args); - va_end(args); - return ret; -} diff --git a/contrib/libio/stdio/stdio.h b/contrib/libio/stdio/stdio.h deleted file mode 100644 index 30065ac871..0000000000 --- a/contrib/libio/stdio/stdio.h +++ /dev/null @@ -1,219 +0,0 @@ -/* This is part of the iostream/stdio library, providing -*- C -*- I/O. - Define ANSI C stdio on top of C++ iostreams. - Copyright (C) 1991, 1994 Free Software Foundation - -This 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. - - -This library is distributed in the hope that 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 this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -/* - * ANSI Standard: 4.9 INPUT/OUTPUT - */ - -#ifndef _STDIO_H -#define _STDIO_H -#define _STDIO_USES_IOSTREAM - -#include - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL (void*)0 -#endif -#endif - -#ifndef EOF -#define EOF (-1) -#endif -#ifndef BUFSIZ -#define BUFSIZ 1024 -#endif - -#define _IOFBF 0 /* Fully buffered. */ -#define _IOLBF 1 /* Line buffered. */ -#define _IONBF 2 /* No buffering. */ - -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 - - /* define size_t. Crud in case has defined it. */ -#if !defined(_SIZE_T) && !defined(_T_SIZE_) && !defined(_T_SIZE) -#if !defined(__SIZE_T) && !defined(_SIZE_T_) && !defined(___int_size_t_h) -#if !defined(_GCC_SIZE_T) && !defined(_SIZET_) -#define _SIZE_T -#define _T_SIZE_ -#define _T_SIZE -#define __SIZE_T -#define _SIZE_T_ -#define ___int_size_t_h -#define _GCC_SIZE_T -#define _SIZET_ -typedef _IO_size_t size_t; -#endif -#endif -#endif - -typedef struct _IO_FILE FILE; -typedef _IO_fpos_t fpos_t; - -#define FOPEN_MAX _G_FOPEN_MAX -#define FILENAME_MAX _G_FILENAME_MAX -#ifndef TMP_MAX -#define TMP_MAX 999 /* Only limited by filename length */ -#endif - -#define L_ctermid 9 -#define L_cuserid 9 -#define P_tmpdir "/tmp" -#define L_tmpnam 20 - -/* For use by debuggers. These are linked in if printf or fprintf are used. */ -extern FILE *stdin, *stdout, *stderr; /* TODO */ - -#define stdin _IO_stdin -#define stdout _IO_stdout -#define stderr _IO_stderr - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __P -#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) -#define __P(args) args -#else -#define __P(args) () -#endif -#endif /*!__P*/ - -extern void clearerr __P((FILE*)); -extern int fclose __P((FILE*)); -extern int feof __P((FILE*)); -extern int ferror __P((FILE*)); -extern int fflush __P((FILE*)); -extern int fgetc __P((FILE *)); -extern int fgetpos __P((FILE* fp, fpos_t *pos)); -extern char* fgets __P((char*, int, FILE*)); -extern FILE* fopen __P((const char*, const char*)); -extern int fprintf __P((FILE*, const char* format, ...)); -extern int fputc __P((int, FILE*)); -extern int fputs __P((const char *str, FILE *fp)); -extern size_t fread __P((void*, size_t, size_t, FILE*)); -extern FILE* freopen __P((const char*, const char*, FILE*)); -extern int fscanf __P((FILE *fp, const char* format, ...)); -extern int fseek __P((FILE* fp, long int offset, int whence)); -extern int fsetpos __P((FILE* fp, const fpos_t *pos)); -extern long int ftell __P((FILE* fp)); -extern size_t fwrite __P((const void*, size_t, size_t, FILE*)); -extern int getc __P((FILE *)); -extern int getchar __P((void)); -extern char* gets __P((char*)); -extern void perror __P((const char *)); -extern int printf __P((const char* format, ...)); -extern int putc __P((int, FILE *)); -extern int putchar __P((int)); -extern int puts __P((const char *str)); -extern int remove __P((const char*)); -extern int rename __P((const char* _old, const char* _new)); -extern void rewind __P((FILE*)); -extern int scanf __P((const char* format, ...)); -extern void setbuf __P((FILE*, char*)); -extern void setlinebuf __P((FILE*)); -extern void setbuffer __P((FILE*, char*, int)); -extern int setvbuf __P((FILE*, char*, int mode, size_t size)); -extern int sprintf __P((char*, const char* format, ...)); -extern int sscanf __P((const char* string, const char* format, ...)); -extern FILE* tmpfile __P((void)); -extern char* tmpnam __P((char*)); -extern int ungetc __P((int c, FILE* fp)); -extern int vfprintf __P((FILE *fp, char const *fmt0, _IO_va_list)); -extern int vprintf __P((char const *fmt, _IO_va_list)); -extern int vsprintf __P((char* string, const char* format, _IO_va_list)); - -#ifndef __STRICT_ANSI__ -extern int vfscanf __P((FILE*, const char *, _IO_va_list)); -extern int vscanf __P((const char *, _IO_va_list)); -extern int vsscanf __P((const char *, const char *, _IO_va_list)); -#endif - -#if !defined(__STRICT_ANSI__) || defined(_POSIX_SOURCE) -extern FILE *fdopen __P((int, const char *)); -extern int fileno __P((FILE*)); -extern FILE* popen __P((const char*, const char*)); -extern int pclose __P((FILE*)); -#endif - -#ifdef __USE_GNU -extern _IO_ssize_t getdelim __P ((char **, size_t *, int, FILE*)); -extern _IO_ssize_t getline __P ((char **, size_t *, FILE *)); - -extern int snprintf __P ((char *, size_t, const char *, ...)); -extern int vsnprintf __P ((char *, size_t, const char *, _IO_va_list)); -#endif - -extern int __underflow __P((struct _IO_FILE*)); -extern int __overflow __P((struct _IO_FILE*, int)); - -/* Handle locking of streams. */ -#if defined _REENTRANT || defined _THREAD_SAFE -extern void clearerr_locked __P ((FILE *)); -extern void clearerr_unlocked __P ((FILE *)); -extern int feof_locked __P ((FILE *)); -extern int feof_unlocked __P ((FILE *)); -extern int ferror_locked __P ((FILE*)); -extern int ferror_unlocked __P ((FILE*)); -extern int fileno_locked __P ((FILE *)); -extern int fileno_unlocked __P ((FILE *)); -extern void flockfile __P ((FILE *)); -extern void funlockfile __P ((FILE *)); -extern int ftrylockfile __P ((FILE *)); -extern int fclose_unlocked __P ((FILE *)); -extern int fflush_locked __P ((FILE *)); -extern int fflush_unlocked __P ((FILE *)); -extern size_t fread_unlocked __P ((void *, size_t, size_t, FILE *)); -extern size_t fwrite_unlocked __P ((const void *, size_t, size_t, FILE *)); - -extern int fputc_locked __P ((int, FILE*)); -extern int fputc_unlocked __P ((int, FILE*)); -extern int getc_locked __P ((FILE *)); -extern int getc_unlocked __P ((FILE *)); -extern int getchar_locked __P ((void)); -extern int getchar_unlocked __P ((void)); -extern int putc_locked __P ((int, FILE *)); -extern int putc_unlocked __P ((int, FILE *)); -extern int putchar_locked __P ((int)); -extern int putchar_unlocked __P ((int)); - -# define getc_unlocked(fp) _IO_getc_unlocked (fp) -# define getc_locked(fp) _IO_getc (fp) -# define getchar_unlocked() _IO_getc_unlocked (stdin) -# define getchar_locked() _IO_getc (stdin) -# define putchar_unlocked(c) _IO_putc_unlocked (c, stdout) -# define putchar_locked(c) _IO_putc (c, stdout) -#endif /* __USE_REENTRANT */ - -#define getc(fp) _IO_getc(fp) -#define putc(c, fp) _IO_putc(c, fp) -#define putchar(c) _IO_putc(c, stdout) -#define getchar() _IO_getc(stdin) - -#ifdef __cplusplus -} -#endif - -#endif /*!_STDIO_H*/ diff --git a/contrib/libio/stdio/vasprintf.c b/contrib/libio/stdio/vasprintf.c deleted file mode 100644 index 15513d0fca..0000000000 --- a/contrib/libio/stdio/vasprintf.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (C) 1995, 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. */ - -#include -#include "libioP.h" -#include "stdio.h" -#include "strfile.h" - -int -_IO_vasprintf (result_ptr, format, args) - char **result_ptr; - const char *format; - _IO_va_list args; -{ - /* Initial size of the buffer to be used. Will be doubled each time an - overflow occurs. */ - const _IO_size_t init_string_size = 100; - char *string; - _IO_strfile sf; -#ifdef _IO_MTSAFE_IO - _IO_lock_t lock; -#endif - int ret; - string = (char *) malloc (init_string_size); - if (string == NULL) - return -1; -#ifdef _IO_MTSAFE_IO - sf._sbf._f._lock = &lock; -#endif - _IO_init ((_IO_FILE *) &sf, 0); - _IO_JUMPS ((_IO_FILE *) &sf) = &_IO_str_jumps; - _IO_str_init_static ((_IO_FILE *) &sf, string, init_string_size, string); - sf._sbf._f._flags &= ~_IO_USER_BUF; - sf._s._allocate_buffer = (_IO_alloc_type) malloc; - sf._s._free_buffer = (_IO_free_type) free; - ret = _IO_vfprintf ((_IO_FILE *) &sf, format, args); - if (ret < 0) - return ret; - *result_ptr = (char *) realloc (sf._sbf._f._IO_buf_base, - (sf._sbf._f._IO_write_ptr - - sf._sbf._f._IO_write_base) +1); - if (*result_ptr == NULL) - *result_ptr = sf._sbf._f._IO_buf_base; - (*result_ptr)[sf._sbf._f._IO_write_ptr-sf._sbf._f._IO_write_base] = '\0'; - return ret; -} - -#ifdef weak_alias -weak_alias (_IO_vasprintf, vasprintf) -#endif diff --git a/contrib/libio/stdio/vfprintf.c b/contrib/libio/stdio/vfprintf.c deleted file mode 100644 index fca6209445..0000000000 --- a/contrib/libio/stdio/vfprintf.c +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" - -int -vfprintf(fp, format, args) - register _IO_FILE* fp; - char const *format; - _IO_va_list args; -{ - CHECK_FILE(fp, -1); - return _IO_vfprintf(fp, format, args); -} diff --git a/contrib/libio/stdio/vfscanf.c b/contrib/libio/stdio/vfscanf.c deleted file mode 100644 index 1759ee5ee0..0000000000 --- a/contrib/libio/stdio/vfscanf.c +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" -#include "stdio.h" - -int -vfscanf(fp, format, args) - register _IO_FILE* fp; - const char *format; - _IO_va_list args; -{ - CHECK_FILE(fp, EOF); - return _IO_vfscanf(fp, format, args, NULL); -} diff --git a/contrib/libio/stdio/vprintf.c b/contrib/libio/stdio/vprintf.c deleted file mode 100644 index 784f0d9b8d..0000000000 --- a/contrib/libio/stdio/vprintf.c +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include "libioP.h" -#include "stdio.h" - -int vprintf(format, args) - const char* format; - _IO_va_list args; -{ - return _IO_vfprintf(_IO_stdout, format, args); -} diff --git a/contrib/libio/stdio/vscanf.c b/contrib/libio/stdio/vscanf.c deleted file mode 100644 index 8b92ae270e..0000000000 --- a/contrib/libio/stdio/vscanf.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. - This file is part of the GNU IO Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - - As a special exception, if you link this library with files - compiled with a GNU compiler to produce an executable, this does - not cause the resulting executable to be covered by the GNU General - Public License. This exception does not however invalidate any - other reasons why the executable file might be covered by the GNU - General Public License. */ - -#include "libioP.h" -#include "stdio.h" - -#undef vscanf - -int -_IO_vscanf (format, args) - const char *format; - _IO_va_list args; -{ - return _IO_vfscanf (_IO_stdin, format, args, NULL); -} - -#ifdef weak_alias -weak_alias (_IO_vscanf, vscanf) -#endif diff --git a/contrib/libio/stdio/vsnprintf.c b/contrib/libio/stdio/vsnprintf.c deleted file mode 100644 index 3f35af299a..0000000000 --- a/contrib/libio/stdio/vsnprintf.c +++ /dev/null @@ -1,136 +0,0 @@ -/* Copyright (C) 1994, 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. */ - -#include "libioP.h" -#include "strfile.h" - - -typedef struct -{ - _IO_strfile f; - /* This is used for the characters which do not fit in the buffer - provided by the user. */ - char overflow_buf[64]; -} _IO_strnfile; - - -static int _IO_strn_overflow __P ((_IO_FILE *fp, int c)); - -static int -_IO_strn_overflow (fp, c) - _IO_FILE *fp; - int c; -{ - /* When we come to here this means the user supplied buffer is - filled. But since we must return the number of characters which - would have been written in total we must provide a buffer for - further use. We can do this by writing on and on in the overflow - buffer in the _IO_strnfile structure. */ - _IO_strnfile *snf = (_IO_strnfile *) fp; - - if (fp->_IO_buf_base != snf->overflow_buf) - { - /* Terminate the string. We know that there is room for at - least one more character since we initialized the stream with - a size to make this possible. */ - *fp->_IO_write_ptr = '\0'; - - _IO_setb (fp, snf->overflow_buf, - snf->overflow_buf + sizeof (snf->overflow_buf), 0); - - fp->_IO_write_base = snf->overflow_buf; - fp->_IO_read_base = snf->overflow_buf; - fp->_IO_read_ptr = snf->overflow_buf; - fp->_IO_read_end = snf->overflow_buf + sizeof (snf->overflow_buf); - } - - fp->_IO_write_ptr = snf->overflow_buf; - fp->_IO_write_end = snf->overflow_buf; - - /* Since we are not really interested in storing the characters - which do not fit in the buffer we simply ignore it. */ - return c; -} - - -static struct _IO_jump_t _IO_strn_jumps = -{ - JUMP_INIT_DUMMY, - JUMP_INIT(finish, _IO_str_finish), - JUMP_INIT(overflow, _IO_strn_overflow), - JUMP_INIT(underflow, _IO_str_underflow), - JUMP_INIT(uflow, _IO_default_uflow), - JUMP_INIT(pbackfail, _IO_str_pbackfail), - JUMP_INIT(xsputn, _IO_default_xsputn), - JUMP_INIT(xsgetn, _IO_default_xsgetn), - JUMP_INIT(seekoff, _IO_str_seekoff), - JUMP_INIT(seekpos, _IO_default_seekpos), - JUMP_INIT(setbuf, _IO_default_setbuf), - JUMP_INIT(sync, _IO_default_sync), - JUMP_INIT(doallocate, _IO_default_doallocate), - JUMP_INIT(read, _IO_default_read), - JUMP_INIT(write, _IO_default_write), - JUMP_INIT(seek, _IO_default_seek), - JUMP_INIT(close, _IO_default_close), - JUMP_INIT(stat, _IO_default_stat) -}; - - -int -_IO_vsnprintf (string, maxlen, format, args) - char *string; - _IO_size_t maxlen; - const char *format; - _IO_va_list args; -{ - _IO_strnfile sf; - int ret; -#ifdef _IO_MTSAFE_IO - _IO_lock_t lock; - sf.f._sbf._f._lock = &lock; -#endif - - /* We need to handle the special case where MAXLEN is 0. Use the - overflow buffer right from the start. */ - if (maxlen == 0) - { - string = sf.overflow_buf; - maxlen = sizeof (sf.overflow_buf); - } - - _IO_init ((_IO_FILE *) &sf, 0); - _IO_JUMPS ((_IO_FILE *) &sf) = &_IO_strn_jumps; - _IO_str_init_static ((_IO_FILE *) &sf, string, maxlen - 1, string); - ret = _IO_vfprintf ((_IO_FILE *) &sf, format, args); - - if (sf.f._sbf._f._IO_buf_base != sf.overflow_buf) - *sf.f._sbf._f._IO_write_ptr = '\0'; - return ret; -} - -#ifdef weak_alias -weak_alias (_IO_vsnprintf, __vsnprintf) -weak_alias (_IO_vsnprintf, vsnprintf) -#endif diff --git a/contrib/libio/stdiostream.cc b/contrib/libio/stdiostream.cc deleted file mode 100644 index ee0907b209..0000000000 --- a/contrib/libio/stdiostream.cc +++ /dev/null @@ -1,159 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* Written by Per Bothner (bothner@cygnus.com). */ - -#ifdef __GNUG__ -#pragma implementation -#endif - -#include "libioP.h" -#include - -// A stdiobuf is "tied" to a FILE object (as used by the stdio package). -// Thus a stdiobuf is always synchronized with the corresponding FILE, -// though at the cost of some overhead. (If you use the implementation -// of stdio supplied with this library, you don't need stdiobufs.) -// This implementation inherits from filebuf, but implement the virtual -// functions sys_read/..., using the stdio functions fread/... instead -// of the low-level read/... system calls. This has the advantage that -// we get all of the nice filebuf semantics automatically, though -// with some overhead. - - -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif -#ifndef SEEK_CUR -#define SEEK_CUR 1 -#endif -#ifndef SEEK_END -#define SEEK_END 2 -#endif - -stdiobuf::stdiobuf(FILE *f) : filebuf(fileno(f)) -{ - _file = f; - // Turn off buffer in stdiobuf. Instead, rely on buffering in (FILE). - // Thus the stdiobuf will be synchronized with the FILE. - setbuf(NULL, 0); -} - -stdiobuf::~stdiobuf() -{ - /* Only needed if we're buffered. Not buffered is the default. */ - _IO_do_flush((_IO_FILE*)this); -} - -streamsize stdiobuf::sys_read(char* buf, streamsize size) -{ - // A minor optimization, but it makes a noticable difference. - // A bigger optimization would be to write stdiobuf::underflow, - // but that has some modularity disadvantages. Re-evaluate that - // after we have gotten rid of the double indirection. FIXME - if (size == 1) - { - register int ch = getc(_file); - if (ch == EOF) - return 0; - *buf = (char)ch; - return 1; - } - else - return fread(buf, 1, size, _file); -} - -streamsize stdiobuf::sys_write(const char *buf, streamsize n) -{ - _IO_ssize_t count = fwrite(buf, 1, n, _file); - if (_offset >= 0) - _offset += n; - return count; -} - -streampos stdiobuf::sys_seek(streamoff offset, _seek_dir dir) -{ - // Normally, equivalent to: fdir=dir - int fdir = - (dir == ios::beg) ? SEEK_SET : - (dir == ios::cur) ? SEEK_CUR : - (dir == ios::end) ? SEEK_END : - dir; - return fseek(_file, offset, fdir); -} - -int stdiobuf::sys_close() -{ - int status = fclose(_file); - _file = NULL; - return status; -} - -int stdiobuf::sync() -{ - if (_IO_do_flush((_IO_FILE*)this)) - return EOF; - if (!(xflags() & _IO_NO_WRITES)) - if (fflush(_file)) - return EOF; - return 0; -} - -int stdiobuf::overflow(int c /* = EOF*/) -{ - if (filebuf::overflow(c) == EOF) - return EOF; - if (c != EOF) - return c; - return fflush(_file); -} - -streamsize stdiobuf::xsputn(const char* s, streamsize n) -{ - if (buffered ()) - { - // The filebuf implementation of sputn loses. - return streambuf::xsputn(s, n); - } - else - return fwrite (s, 1, n, _file); -} - -void stdiobuf::buffered (int b) -{ - if (b) - { - if (_flags & _IO_UNBUFFERED) - { /* Was unbuffered, make it buffered. */ - _flags &= ~_IO_UNBUFFERED; - } - } - else - { - if (!(_flags & _IO_UNBUFFERED)) - { /* Was buffered, make it unbuffered. */ - setbuf(NULL, 0); - } - } -} diff --git a/contrib/libio/stdiostream.h b/contrib/libio/stdiostream.h deleted file mode 100644 index b973d7a39b..0000000000 --- a/contrib/libio/stdiostream.h +++ /dev/null @@ -1,79 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* Written by Per Bothner (bothner@cygnus.com). */ - -#ifndef _STDIOSTREAM_H -#define _STDIOSTREAM_H - -#ifdef __GNUG__ -#pragma interface -#endif - -#include -#include - -extern "C++" { -class stdiobuf : public filebuf { - protected: - FILE *_file; - public: - FILE* stdiofile() const { return _file; } - stdiobuf(FILE *); - ~stdiobuf(); - int buffered () const { return _flags & _IO_UNBUFFERED ? 0 : 1; } - void buffered (int); - virtual streamsize sys_read(char*, streamsize); - virtual streampos sys_seek(streamoff, _seek_dir); - virtual streamsize sys_write(const char*, streamsize); - virtual int sys_close(); - virtual int sync(); - virtual int overflow(int c = EOF); - streamsize xsputn(const char* s, streamsize n); -}; - -class istdiostream : public istream -{ -private: - stdiobuf _file; -public: - istdiostream (FILE* __f) : istream(), _file(__f) { init(&_file); } - stdiobuf* rdbuf()/* const */ { return &_file; } - int buffered () const { return _file.buffered (); } - void buffered (int _i) { _file.buffered (_i); } -}; - -class ostdiostream : public ostream -{ -private: - stdiobuf _file; -public: - ostdiostream (FILE* __f) : ostream(), _file(__f) { init(&_file); } - stdiobuf* rdbuf() /* const */ { return &_file; } - int buffered () const { return _file.buffered (); } - void buffered (int _i) { _file.buffered (_i); } -}; -} // extern "C++" - -#endif /* !_STDIOSTREAM_H */ diff --git a/contrib/libio/stdstrbufs.cc b/contrib/libio/stdstrbufs.cc deleted file mode 100644 index 48aa719df8..0000000000 --- a/contrib/libio/stdstrbufs.cc +++ /dev/null @@ -1,126 +0,0 @@ -/* -Copyright (C) 1994 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - - -/* This file provides definitions of _IO_stdin, _IO_stdout, and _IO_stderr - for C++ code. Compare stdfiles.c. - (The difference is that here the vtable field is set to - point to builtinbuf's vtable, so the objects are effectively - of class builtinbuf.) */ - -#include "libioP.h" -#include - -#if !defined(filebuf_vtable) && defined(__cplusplus) -#ifdef __GNUC__ -extern char filebuf_vtable[] - asm (_G_VTABLE_LABEL_PREFIX -#if _G_VTABLE_LABEL_HAS_LENGTH - "7" -#endif - "filebuf"); -#else /* !__GNUC__ */ -#if _G_VTABLE_LABEL_HAS_LENGTH -#define filebuf_vtable _G_VTABLE_LABEL_PREFIX_ID##7filebuf -#else -#define filebuf_vtable _G_VTABLE_LABEL_PREFIX_ID##filebuf -#endif -extern char filebuf_vtable[]; -#endif /* !__GNUC__ */ -#endif /* !defined(filebuf_vtable) && defined(__cplusplus) */ - -#ifndef STD_VTABLE -#define STD_VTABLE (const struct _IO_jump_t *)filebuf_vtable -#endif - -#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), STD_VTABLE} -#else -#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \ - struct _IO_FILE_plus NAME = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), STD_VTABLE} -#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); - -#ifdef _STDIO_USES_IOSTREAM -_IO_FILE *_IO_list_all = &_IO_stderr_.file; -#else /* !_STDIO_USES_IOSTREAM */ -#include "stdiostream.h" - -struct _IO_fake_stdiobuf { - struct { - _IO_FILE file; - const void *vtable; - } s; - FILE *stdio_file; -}; - -/* Define stdiobuf_vtable as a name for the virtual function table - of the stdiobuf class. */ -#ifndef stdiobuf_vtable -#ifdef __GNUC__ -extern struct _IO_jump_t stdiobuf_vtable - asm (_G_VTABLE_LABEL_PREFIX -#if _G_VTABLE_LABEL_HAS_LENGTH - "8" -#endif - "stdiobuf"); -#else /* !__GNUC__ */ -#if _G_VTABLE_LABEL_HAS_LENGTH -#define stdiobuf_vtable _G_VTABLE_LABEL_PREFIX_ID##8stdiobuf -#else -#define stdiobuf_vtable _G_VTABLE_LABEL_PREFIX_ID##stdiobuf -#endif -extern struct _IO_jump_t stdiobuf_vtable; -#endif /* !__GNUC__ */ -#endif /* !stdiobuf_vtable */ - -#ifdef _IO_MTSAFE_IO -#define DEF_STDIOFILE(NAME, FD, FILE, FLAGS, CHAIN) \ - static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \ - struct _IO_fake_stdiobuf NAME = \ - {{{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+_IO_UNBUFFERED+FLAGS, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD, \ - 0, 0, 0, 0, { 0 }, _IO_stdfile_##FD##_lock},\ - &stdiobuf_vtable}, FILE} -#else -#define DEF_STDIOFILE(NAME, FD, FILE, FLAGS, CHAIN) \ - struct _IO_fake_stdiobuf NAME = \ - {{{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+_IO_UNBUFFERED+FLAGS, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD}, \ - &stdiobuf_vtable}, FILE} -#endif - -DEF_STDIOFILE(_IO_stdin_buf, 0, stdin, _IO_NO_WRITES, &_IO_stderr_.file); -DEF_STDIOFILE(_IO_stdout_buf, 1, stdout, _IO_NO_READS, &_IO_stdin_buf.s.file); -DEF_STDIOFILE(_IO_stderr_buf, 2, stderr, _IO_NO_READS, &_IO_stdout_buf.s.file); - -_IO_FILE *_IO_list_all = &_IO_stderr_buf.s.file; -#endif /* !_STDIO_USES_IOSTREAM */ diff --git a/contrib/libio/stdstreams.cc b/contrib/libio/stdstreams.cc deleted file mode 100644 index 7a74eaaa44..0000000000 --- a/contrib/libio/stdstreams.cc +++ /dev/null @@ -1,153 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* Written by Per Bothner (bothner@cygnus.com). */ - -#include "libioP.h" -#include "streambuf.h" -#include - -// The ANSI draft requires that operations on cin/cout/cerr can be -// mixed with operations on stdin/stdout/stderr on a character by -// character basis. This normally requires that the streambuf's -// used by cin/cout/cerr be stdiostreams. However, if the stdio -// implementation is the one that is built using this library, -// then we don't need to, since in that case stdin/stdout/stderr -// are identical to _IO_stdin/_IO_stdout/_IO_stderr. - -#include - -#ifdef _STDIO_USES_IOSTREAM -#define CIN_SBUF _IO_stdin_ -#define COUT_SBUF _IO_stdout_ -#define CERR_SBUF _IO_stderr_ -static int use_stdiobuf = 0; -#else -#define CIN_SBUF _IO_stdin_buf -#define COUT_SBUF _IO_stdout_buf -#define CERR_SBUF _IO_stderr_buf -static int use_stdiobuf = 1; -#endif - -#define cin CIN -#define cout COUT -#define cerr CERR -#define clog CLOG -#include "iostream.h" -#undef cin -#undef cout -#undef cerr -#undef clog - -#ifdef __GNUG__ -#define PAD 0 /* g++ allows 0-length arrays. */ -#else -#define PAD 1 -#endif -struct _fake_istream { - struct myfields { -#ifdef __GNUC__ - _ios_fields *vb; /* pointer to virtual base class ios */ - _IO_ssize_t _gcount; -#else - /* This is supposedly correct for cfront. */ - _IO_ssize_t _gcount; - void *vptr; - _ios_fields *vb; /* pointer to virtual base class ios */ -#endif - } mine; - _ios_fields base; - char filler[sizeof(struct istream)-sizeof(struct _ios_fields)+PAD]; -}; -struct _fake_ostream { - struct myfields { -#ifndef __GNUC__ - void *vptr; -#endif - _ios_fields *vb; /* pointer to virtual base class ios */ - } mine; - _ios_fields base; - char filler[sizeof(struct ostream)-sizeof(struct _ios_fields)+PAD]; -}; - - -#ifdef _IO_NEW_STREAMS -#define STD_STR(SBUF, TIE, EXTRA_FLAGS) \ - (streambuf*)&SBUF, TIE, 0, ios::skipws|ios::dec|EXTRA_FLAGS, ' ',0,0,6 -#else -#define STD_STR(SBUF, TIE, EXTRA_FLAGS) \ - (streambuf*)&SBUF, TIE, 0, ios::dont_close|ios::dec|ios::skipws|EXTRA_FLAGS, ' ',0,0,6 -#endif - -#ifdef __GNUC__ -#define OSTREAM_DEF(NAME, SBUF, TIE, EXTRA_FLAGS, ASM) \ - _fake_ostream NAME ASM = { {&NAME.base}, {STD_STR(SBUF, TIE, EXTRA_FLAGS) }}; -#define ISTREAM_DEF(NAME, SBUF, TIE, EXTRA_FLAGS) \ - _fake_istream NAME = { {&NAME.base}, {STD_STR(SBUF, TIE, EXTRA_FLAGS) }}; -#else -#define OSTREAM_DEF(NAME, SBUF, TIE, EXTRA_FLAGS) \ - _fake_ostream NAME = { {0, &NAME.base}, {STD_STR(SBUF, TIE, EXTRA_FLAGS) }}; -#define ISTREAM_DEF(NAME, SBUF, TIE, EXTRA_FLAGS) \ - _fake_istream NAME = {{0, 0, &NAME.base}, {STD_STR(SBUF, TIE, EXTRA_FLAGS)}}; -#endif - -OSTREAM_DEF(cout, COUT_SBUF, NULL, 0, ) -OSTREAM_DEF(cerr, CERR_SBUF,(ostream*)&cout, ios::unitbuf, ) -ISTREAM_DEF(cin, CIN_SBUF, (ostream*)&cout, 0) - -/* Only for (partial) compatibility with AT&T's library. */ -#if _G_CLOG_CONFLICT -OSTREAM_DEF(clog, CERR_SBUF, (ostream*)&cout, 0, __asm__ ("__IO_clog")) -#else -OSTREAM_DEF(clog, CERR_SBUF, (ostream*)&cout, 0, ) -#endif - -// Switches between using _IO_std{in,out,err} and __std{in,out,err}_buf -// for standard streams. This does not normally need to be called -// explicitly, but is provided for AT&T compatibility. - -int ios::sync_with_stdio(int new_state) -{ -#ifdef _STDIO_USES_IOSTREAM - // It is always synced. - return 0; -#else - if (new_state == use_stdiobuf) // The usual case now. - return use_stdiobuf; - if (new_state) { - cin.base._strbuf = (streambuf*)&_IO_stdin_buf; - cout.base._strbuf = (streambuf*)&_IO_stdout_buf; - cerr.base._strbuf = (streambuf*)&_IO_stderr_buf; - clog.base._strbuf = (streambuf*)&_IO_stderr_buf; - } else { - cin.base._strbuf = (streambuf*)_IO_stdin; - cout.base._strbuf = (streambuf*)_IO_stdout; - cerr.base._strbuf = (streambuf*)_IO_stderr; - clog.base._strbuf = (streambuf*)_IO_stderr; - } - int old_state = use_stdiobuf; - use_stdiobuf = new_state; - return old_state; -#endif -} diff --git a/contrib/libio/stream.cc b/contrib/libio/stream.cc deleted file mode 100644 index 3440a0c9bd..0000000000 --- a/contrib/libio/stream.cc +++ /dev/null @@ -1,170 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include -#include -#include "libioP.h" -#include "stream.h" -#include "strstream.h" - -static char Buffer[_IO_BUFSIZ]; -#define EndBuffer (Buffer+_IO_BUFSIZ) -static char* next_chunk = Buffer; // Start of available part of Buffer. - -char* form(const char* format, ...) -{ - int space_left = EndBuffer - next_chunk; - // If less that 25% of the space is available start over. - if (space_left < (_IO_BUFSIZ>>2)) - next_chunk = Buffer; - char* buf = next_chunk; - - strstreambuf stream(buf, EndBuffer-buf-1, buf); - va_list ap; - va_start(ap, format); - int count = stream.vform(format, ap); - va_end(ap); - stream.sputc(0); - next_chunk = buf + stream.pcount(); - return buf; -} - -#define u_long unsigned long - -static char* itoa(unsigned long i, int size, int neg, int base) -{ - // Conservative estimate: If base==2, might need 8 characters - // for each input byte, but normally 3 is plenty. - int needed = size ? size - : (base >= 8 ? 3 : 8) * sizeof(unsigned long) + 2; - int space_left = EndBuffer - next_chunk; - if (space_left <= needed) - next_chunk = Buffer; // start over. - - char* buf = next_chunk; - - register char* ptr = buf+needed+1; - next_chunk = ptr; - - if (needed < (2+neg) || ptr > EndBuffer) - return NULL; - *--ptr = 0; - - if (i == 0) - *--ptr = '0'; - while (i != 0 && ptr > buf) { - int ch = i % base; - i = i / base; - if (ch >= 10) - ch += 'a' - 10; - else - ch += '0'; - *--ptr = ch; - } - if (neg) - *--ptr = '-'; - if (size == 0) - return ptr; - while (ptr > buf) - *--ptr = ' '; - return buf; -} - -char* dec(long i, int len /* = 0 */) -{ - if (i >= 0) return itoa((unsigned long)i, len, 0, 10); - else return itoa((unsigned long)(-i), len, 1, 10); -} -char* dec(int i, int len /* = 0 */) -{ - if (i >= 0) return itoa((unsigned long)i, len, 0, 10); - else return itoa((unsigned long)(-i), len, 1, 10); -} -char* dec(unsigned long i, int len /* = 0 */) -{ - return itoa(i, len, 0, 10); -} -char* dec(unsigned int i, int len /* = 0 */) -{ - return itoa(i, len, 0, 10); -} - -char* hex(long i, int len /* = 0 */) -{ - return itoa((unsigned long)i, len, 0, 16); -} -char* hex(int i, int len /* = 0 */) -{ - return itoa((unsigned long)i, len, 0, 16); -} -char* hex(unsigned long i, int len /* = 0 */) -{ - return itoa(i, len, 0, 16); -} -char* hex(unsigned int i, int len /* = 0 */) -{ - return itoa(i, len, 0, 16); -} - -char* oct(long i, int len /* = 0 */) -{ - return itoa((unsigned long)i, len, 0, 8); -} -char* oct(int i, int len /* = 0 */) -{ - return itoa((unsigned long)i, len, 0, 8); -} -char* oct(unsigned long i, int len /* = 0 */) -{ - return itoa(i, len, 0, 8); -} -char* oct(unsigned int i, int len /* = 0 */) -{ - return itoa(i, len, 0, 8); -} - -static char *str(const char* s, int len, int width) -{ - if (width < len) - width = len; - int space_left = EndBuffer - next_chunk; - if (space_left <= width + 1) - next_chunk = Buffer; // start over. - char* buf = next_chunk; - memset (buf, ' ', width - len); - memcpy (buf + width - len, s, len); - buf[width] = 0; - return buf; -} - -char* str(const char* s, int width) -{ - return str (s, strlen (s), width); -} - -char* chr(char ch, int width) -{ - char c = ch; - return str (&c, 1, width); -} diff --git a/contrib/libio/stream.h b/contrib/libio/stream.h deleted file mode 100644 index 90f8c1f278..0000000000 --- a/contrib/libio/stream.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright (C) 1993, 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. - -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 _COMPAT_STREAM_H -#define _COMPAT_STREAM_H - -// Compatibility with old library. -// DO NOT USE THESE FUNCTIONS IN NEW CODE! -// They are obsolete, non-standard, and non-reentrant. - -#define _STREAM_COMPAT -#include - -extern "C++" { -extern char* form(const char*, ...); - -extern char* dec(long, int=0); -extern char* dec(int, int=0); -extern char* dec(unsigned long, int=0); -extern char* dec(unsigned int, int=0); - -extern char* hex(long, int=0); -extern char* hex(int, int=0); -extern char* hex(unsigned long, int=0); -extern char* hex(unsigned int, int=0); - -extern char* oct(long, int=0); -extern char* oct(int, int=0); -extern char* oct(unsigned long, int=0); -extern char* oct(unsigned int, int=0); - -char* chr(char ch, int width = 0); -char* str(const char* s, int width = 0); - -inline istream& WS(istream& __str) { return ws(__str); } -} // extern "C++" - -#endif /* !_COMPAT_STREAM_H */ diff --git a/contrib/libio/streambuf.cc b/contrib/libio/streambuf.cc deleted file mode 100644 index 057d1e6e4c..0000000000 --- a/contrib/libio/streambuf.cc +++ /dev/null @@ -1,364 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1991, 1992, 1993, 1995 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* Written by Per Bothner (bothner@cygnus.com). */ - -#define _STREAM_COMPAT -#ifdef __GNUG__ -#pragma implementation -#endif -#include "iostreamP.h" -#include -#include -#include -#ifndef errno -extern int errno; -#endif - -void streambuf::_un_link() { _IO_un_link(this); } - -void streambuf::_link_in() { _IO_link_in(this); } - -int streambuf::switch_to_get_mode() -{ return _IO_switch_to_get_mode(this); } - -void streambuf::free_backup_area() -{ _IO_free_backup_area(this); } - -#if 0 -int streambuf::switch_to_put_mode() -{ return _IO_:switch_to_put_mode(this); } -#endif - -int __overflow(streambuf* sb, int c) -{ - return sb->overflow(c); -} - -int streambuf::underflow() -{ return EOF; } - -int streambuf::uflow() -{ return _IO_default_uflow (this); } - -int streambuf::overflow(int /* = EOF */) -{ return EOF; } - -streamsize streambuf::xsputn(register const char* s, streamsize n) -{ return _IO_default_xsputn(this, s, n); } - -streamsize streambuf::xsgetn(char* s, streamsize n) -{ return _IO_default_xsgetn(this, s, n); } - -int streambuf::ignore(int n) -{ - register int more = n; - for (;;) { - int count = _IO_read_end - _IO_read_ptr; // Data available. - if (count > 0) { - if (count > more) - count = more; - _IO_read_ptr += count; - more -= count; - } - if (more == 0 || __underflow(this) == EOF) - break; - } - return n - more; -} - -int streambuf::sync() -{ - return 0; -} - -int streambuf::pbackfail(int c) -{ - return _IO_default_pbackfail(this, c); -} - -streambuf* streambuf::setbuf(char* p, int len) -{ - if (sync() == EOF) - return NULL; - if (p == NULL || len == 0) { - unbuffered(1); - setb(_shortbuf, _shortbuf+1, 0); - } - else { - unbuffered(0); - setb(p, p+len, 0); - } - setp(0, 0); - setg(0, 0, 0); - return this; -} - -streampos streambuf::seekpos(streampos pos, int mode) -{ - return seekoff(pos, ios::beg, mode); -} - -streampos streambuf::sseekpos(streampos pos, int mode) -{ - return _IO_seekpos (this, pos, mode); -} - -void streambuf::setb(char* b, char* eb, int a) -{ _IO_setb(this, b, eb, a); } - -int streambuf::doallocate() { return _IO_default_doallocate(this); } - -void streambuf::doallocbuf() { _IO_doallocbuf(this); } - -#if !_IO_UNIFIED_JUMPTABLES -/* The following are jump table entries that just call the virtual method */ - -static int _IO_sb_overflow(_IO_FILE *fp, int c) -{ return ((streambuf*)fp)->overflow(c); } -static int _IO_sb_underflow(_IO_FILE *fp) -{ return ((streambuf*)fp)->underflow(); } -static _IO_size_t _IO_sb_xsputn(_IO_FILE *fp, const void *s, _IO_size_t n) -{ return ((streambuf*)fp)->xsputn((const char*)s, n); } -static _IO_size_t _IO_sb_xsgetn(_IO_FILE *fp, void *s, _IO_size_t n) -{ return ((streambuf*)fp)->xsgetn((char*)s, n); } -static int _IO_sb_close(_IO_FILE *fp) -{ return ((streambuf*)fp)->sys_close(); } -static int _IO_sb_stat(_IO_FILE *fp, void *b) -{ return ((streambuf*)fp)->sys_stat(b); } -static int _IO_sb_doallocate(_IO_FILE *fp) -{ return ((streambuf*)fp)->doallocate(); } - -static _IO_pos_t _IO_sb_seekoff(_IO_FILE *fp, _IO_off_t pos, int dir, int mode) -{ - return ((streambuf*)fp)->seekoff(pos, (ios::seek_dir)dir, mode); -} - -static _IO_pos_t _IO_sb_seekpos(_IO_FILE *fp, _IO_pos_t pos, int mode) -{ - return ((streambuf*)fp)->seekpos(pos, mode); -} - -static int _IO_sb_pbackfail(_IO_FILE *fp, int ch) -{ return ((streambuf*)fp)->pbackfail(ch); } -static void _IO_sb_finish(_IO_FILE *fp, int) -{ ((streambuf*)fp)->~streambuf(); } -static _IO_ssize_t _IO_sb_read(_IO_FILE *fp, void *buf, _IO_ssize_t n) -{ return ((streambuf*)fp)->sys_read((char*)buf, n); } -static _IO_ssize_t _IO_sb_write(_IO_FILE *fp, const void *buf, _IO_ssize_t n) -{ return ((streambuf*)fp)->sys_write((const char*)buf, n); } -static int _IO_sb_sync(_IO_FILE *fp) -{ return ((streambuf*)fp)->sync(); } -static _IO_pos_t _IO_sb_seek(_IO_FILE *fp, _IO_off_t off, int dir) -{ return ((streambuf*)fp)->sys_seek(off, (_seek_dir)dir); } -static _IO_FILE* _IO_sb_setbuf(_IO_FILE *fp, char *buf, _IO_ssize_t n) -{ return ((streambuf*)fp)->setbuf(buf, n); } - -/* This callbacks in this jumptable just call the corresponding - virtual function, so that C functions can access (potentially user-defined) - streambuf-derived objects. - Contrast the builtinbuf class, which does the converse: Allow - C++ virtual calls to be used on _IO_FILE objects that are builtin - (or defined by C code). */ - - -struct _IO_jump_t _IO_streambuf_jumps = { - JUMP_INIT_DUMMY, - JUMP_INIT(finish, _IO_sb_finish), - JUMP_INIT(overflow, _IO_sb_overflow), - JUMP_INIT(underflow, _IO_sb_underflow), - JUMP_INIT(uflow, _IO_default_uflow), - JUMP_INIT(pbackfail, _IO_sb_pbackfail), - JUMP_INIT(xsputn, _IO_sb_xsputn), - JUMP_INIT(xsgetn, _IO_sb_xsgetn), - JUMP_INIT(seekoff, _IO_sb_seekoff), - JUMP_INIT(seekpos, _IO_sb_seekpos), - JUMP_INIT(setbuf, _IO_sb_setbuf), - JUMP_INIT(sync, _IO_sb_sync), - JUMP_INIT(doallocate, _IO_sb_doallocate), - JUMP_INIT(read, _IO_sb_read), - JUMP_INIT(write, _IO_sb_write), - JUMP_INIT(seek, _IO_sb_seek), - JUMP_INIT(close, _IO_sb_close), - JUMP_INIT(stat, _IO_sb_stat) -}; -#endif - -streambuf::streambuf(int flags) -{ -#ifdef _IO_MTSAFE_IO - _lock = new _IO_lock_t; -#endif - _IO_init(this, flags); -#if !_IO_UNIFIED_JUMPTABLES - _jumps = &_IO_streambuf_jumps; -#endif -} - -streambuf::~streambuf() -{ - _IO_default_finish(this,0); -#ifdef _IO_MTSAFE_IO - if (this != _IO_stdin && this != _IO_stdout && this != _IO_stderr) - delete _lock; -#endif -} - -streampos -streambuf::seekoff(streamoff, _seek_dir, int /*=ios::in|ios::out*/) -{ - return EOF; -} - -streampos -streambuf::sseekoff(streamoff o , _seek_dir d, int m /*=ios::in|ios::out*/) -{ - return _IO_seekoff (this, o, d, m); -} - -int streambuf::sputbackc(char c) -{ - return _IO_sputbackc(this, c); -} - -int streambuf::sungetc() -{ - return _IO_sungetc(this); -} - -#if 0 /* Work in progress */ -void streambuf::collumn(int c) -{ - if (c == -1) - _collumn = -1; - else - _collumn = c - (_IO_write_ptr - _IO_write_base); -} -#endif - - -int streambuf::get_column() -{ - if (_cur_column) - return _IO_adjust_column(_cur_column - 1, pbase(), pptr() - pbase()); - return -1; -} - -int streambuf::set_column(int i) -{ - _cur_column = i+1; - return 0; -} - -int streambuf::flush_all() { return _IO_flush_all (); } - -void streambuf::flush_all_linebuffered() -{ _IO_flush_all_linebuffered(); } - -int streambuf::sys_stat(void *) -{ -#ifdef EIO - errno = EIO; -#endif - return -1; -} - -streamsize streambuf::sys_read(char* /*buf*/, streamsize /*size*/) -{ - return 0; -} - -streamsize streambuf::sys_write(const char* /*buf*/, streamsize /*size*/) -{ - return 0; -} - -streampos streambuf::sys_seek(streamoff, _seek_dir) -{ - return EOF; -} - -int streambuf::sys_close() { return 0; /* Suceess; do nothing */ } - -#if _G_IO_IO_FILE_VERSION == 0x20001 -int streambuf::showmanyc() -{ - return -1; -} - -void streambuf::imbue(void *) -{ -} -#endif - -streammarker::streammarker(streambuf *sb) -{ - _IO_init_marker(this, sb); -} - -streammarker::~streammarker() -{ - _IO_remove_marker(this); -} - -#define BAD_DELTA EOF - -int streammarker::delta(streammarker& other_mark) -{ - return _IO_marker_difference(this, &other_mark); -} - -int streammarker::delta() -{ - return _IO_marker_delta(this); -} - -int streambuf::seekmark(streammarker& mark, int delta /* = 0 */) -{ - return _IO_seekmark(this, &mark, delta); -} - -void streambuf::unsave_markers() -{ - _IO_unsave_markers(this); -} - -int ios::readable() { return !(rdbuf()->_flags & _IO_NO_READS); } -int ios::writable() { return !(rdbuf()->_flags & _IO_NO_WRITES); } -int ios::is_open() { return rdbuf() - && (rdbuf()->_flags & _IO_NO_READS+_IO_NO_WRITES) - != _IO_NO_READS+_IO_NO_WRITES; } - -#if defined(linux) -#define IO_CLEANUP -#endif - -#ifdef IO_CLEANUP - IO_CLEANUP -#else -struct __io_defs { - ~__io_defs() { _IO_cleanup (); } -}; -__io_defs io_defs__; -#endif diff --git a/contrib/libio/streambuf.h b/contrib/libio/streambuf.h deleted file mode 100644 index 193c499382..0000000000 --- a/contrib/libio/streambuf.h +++ /dev/null @@ -1,490 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#ifndef _STREAMBUF_H -#define _STREAMBUF_H -#ifdef __GNUG__ -#pragma interface -#endif - -/* #define _G_IO_THROW */ /* Not implemented: ios::failure */ - -#define _IO_NEW_STREAMS // new optimizated stream representation - -extern "C" { -#include -} -//#include <_G_config.h> -#ifdef _G_NEED_STDARG_H -#include -#endif -#ifndef _IO_va_list -#define _IO_va_list char * -#endif - -#ifndef EOF -#define EOF (-1) -#endif -#ifndef NULL -#ifdef __GNUG__ -#define NULL (__null) -#else -#define NULL (0) -#endif -#endif - -#ifndef _IO_wchar_t -#if _G_IO_IO_FILE_VERSION == 0x20001 -#define _IO_wchar_t _G_wchar_t -#else -#define _IO_wchar_t short -#endif -#endif - -extern "C++" { -class istream; /* Work-around for a g++ name mangling bug. Fixed in 2.6. */ -class ostream; class streambuf; - -// In case some header files defines these as macros. -#undef open -#undef close - -#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 -typedef _IO_off64_t streamoff; -typedef _IO_off64_t streampos; -#else -typedef _IO_off_t streamoff; -typedef _IO_off_t streampos; -#endif -typedef _IO_ssize_t streamsize; - -typedef unsigned long __fmtflags; -typedef unsigned char __iostate; - -struct _ios_fields -{ // The data members of an ios. - streambuf *_strbuf; - ostream* _tie; - int _width; - __fmtflags _flags; - _IO_wchar_t _fill; - __iostate _state; - __iostate _exceptions; - int _precision; - - void *_arrays; /* Support for ios::iword and ios::pword. */ -}; - -#define _IOS_GOOD 0 -#define _IOS_EOF 1 -#define _IOS_FAIL 2 -#define _IOS_BAD 4 - -#define _IO_INPUT 1 -#define _IO_OUTPUT 2 -#define _IO_ATEND 4 -#define _IO_APPEND 8 -#define _IO_TRUNC 16 -#define _IO_NOCREATE 32 -#define _IO_NOREPLACE 64 -#define _IO_BIN 128 - -#ifdef _STREAM_COMPAT -enum state_value { - _good = _IOS_GOOD, - _eof = _IOS_EOF, - _fail = _IOS_FAIL, - _bad = _IOS_BAD }; -enum open_mode { - input = _IO_INPUT, - output = _IO_OUTPUT, - atend = _IO_ATEND, - append = _IO_APPEND }; -#endif - -class ios : public _ios_fields { - ios& operator=(ios&); /* Not allowed! */ - ios (const ios&); /* Not allowed! */ - public: - typedef __fmtflags fmtflags; - typedef int iostate; - typedef int openmode; - typedef _IO_ssize_t streamsize; - enum io_state { - goodbit = _IOS_GOOD, - eofbit = _IOS_EOF, - failbit = _IOS_FAIL, - badbit = _IOS_BAD }; - enum open_mode { - in = _IO_INPUT, - out = _IO_OUTPUT, - ate = _IO_ATEND, - app = _IO_APPEND, - trunc = _IO_TRUNC, - nocreate = _IO_NOCREATE, - noreplace = _IO_NOREPLACE, - bin = _IOS_BIN, // Deprecated - ANSI uses ios::binary. - binary = _IOS_BIN }; - enum seek_dir { beg, cur, end}; - typedef enum seek_dir seekdir; - // NOTE: If adding flags here, before to update ios::bitalloc(). - enum { skipws=_IO_SKIPWS, - left=_IO_LEFT, right=_IO_RIGHT, internal=_IO_INTERNAL, - dec=_IO_DEC, oct=_IO_OCT, hex=_IO_HEX, - showbase=_IO_SHOWBASE, showpoint=_IO_SHOWPOINT, - uppercase=_IO_UPPERCASE, showpos=_IO_SHOWPOS, - scientific=_IO_SCIENTIFIC, fixed=_IO_FIXED, - unitbuf=_IO_UNITBUF, stdio=_IO_STDIO -#ifndef _IO_NEW_STREAMS - , dont_close=_IO_DONT_CLOSE // Don't delete streambuf on stream destruction -#endif - }; - enum { // Masks. - basefield=dec+oct+hex, - floatfield = scientific+fixed, - adjustfield = left+right+internal - }; - -#ifdef _IO_THROW - class failure : public xmsg { - ios* _stream; - public: - failure(ios* stream) { _stream = stream; } - failure(string cause, ios* stream) { _stream = stream; } - ios* rdios() const { return _stream; } - }; -#endif - - ostream* tie() const { return _tie; } - ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; } - - // Methods to change the format state. - _IO_wchar_t fill() const { return _fill; } - _IO_wchar_t fill(_IO_wchar_t newf) - {_IO_wchar_t oldf = _fill; _fill = newf; return oldf;} - fmtflags flags() const { return _flags; } - fmtflags flags(fmtflags new_val) { - fmtflags old_val = _flags; _flags = new_val; return old_val; } - int precision() const { return _precision; } - int precision(int newp) { - unsigned short oldp = _precision; _precision = (unsigned short)newp; - return oldp; } - fmtflags setf(fmtflags val) { - fmtflags oldbits = _flags; - _flags |= val; return oldbits; } - fmtflags setf(fmtflags val, fmtflags mask) { - fmtflags oldbits = _flags; - _flags = (_flags & ~mask) | (val & mask); return oldbits; } - fmtflags unsetf(fmtflags mask) { - fmtflags oldbits = _flags; - _flags &= ~mask; return oldbits; } - int width() const { return _width; } - int width(int val) { int save = _width; _width = val; return save; } - -#ifdef _IO_THROW - void _throw_failure() const { throw new ios::failure(this); } -#else - void _throw_failure() const { } -#endif - void clear(iostate state = 0) { - _state = _strbuf ? state : state|badbit; - if (_state & _exceptions) _throw_failure(); } - void set(iostate flag) { _state |= flag; - if (_state & _exceptions) _throw_failure(); } - void setstate(iostate flag) { _state |= flag; // ANSI - if (_state & _exceptions) _throw_failure(); } - int good() const { return _state == 0; } - int eof() const { return _state & ios::eofbit; } - int fail() const { return _state & (ios::badbit|ios::failbit); } - int bad() const { return _state & ios::badbit; } - iostate rdstate() const { return _state; } - operator void*() const { return fail() ? (void*)0 : (void*)(-1); } - int operator!() const { return fail(); } - iostate exceptions() const { return _exceptions; } - void exceptions(iostate enable) { - _exceptions = enable; - if (_state & _exceptions) _throw_failure(); } - - streambuf* rdbuf() const { return _strbuf; } - streambuf* rdbuf(streambuf *_s) { - streambuf *_old = _strbuf; _strbuf = _s; clear (); return _old; } - - static int sync_with_stdio(int on); - static void sync_with_stdio() { sync_with_stdio(1); } - static fmtflags bitalloc(); - static int xalloc(); - void*& pword(int); - void* pword(int) const; - long& iword(int); - long iword(int) const; - -#ifdef _STREAM_COMPAT - void unset(state_value flag) { _state &= ~flag; } - void close(); - int is_open(); - int readable(); - int writable(); -#endif - - // Used to initialize standard streams. Not needed in this implementation. - class Init { - public: - Init () { } - }; - - protected: - inline ios(streambuf* sb = 0, ostream* tie_to = 0); - inline virtual ~ios(); - inline void init(streambuf* sb, ostream* tie = 0); -}; - -#if __GNUG__==1 -typedef int _seek_dir; -#else -typedef ios::seek_dir _seek_dir; -#endif - -// Magic numbers and bits for the _flags field. -// The magic numbers use the high-order bits of _flags; -// the remaining bits are abailable for variable flags. -// Note: The magic numbers must all be negative if stdio -// emulation is desired. - -// A streammarker remembers a position in a buffer. -// You are guaranteed to be able to seek back to it if it is saving(). -class streammarker : private _IO_marker { - friend class streambuf; - void set_offset(int offset) { _pos = offset; } - public: - streammarker(streambuf *sb); - ~streammarker(); - int saving() { return 1; } - int delta(streammarker&); - int delta(); -}; - -struct streambuf : public _IO_FILE { // protected?? - friend class ios; - friend class istream; - friend class ostream; - friend class streammarker; - const void *&_vtable() { return *(const void**)((_IO_FILE*)this + 1); } - protected: - static streambuf* _list_all; /* List of open streambufs. */ - _IO_FILE*& xchain() { return _chain; } - void _un_link(); - void _link_in(); - char* gptr() const - { return _IO_file_flags & _IO_IN_BACKUP ? _IO_save_base : _IO_read_ptr; } - char* pptr() const { return _IO_write_ptr; } - char* egptr() const - { return _IO_file_flags & _IO_IN_BACKUP ? _IO_save_end : _IO_read_end; } - char* epptr() const { return _IO_write_end; } - char* pbase() const { return _IO_write_base; } - char* eback() const - { return _IO_file_flags & _IO_IN_BACKUP ? _IO_save_base : _IO_read_base;} - char* base() const { return _IO_buf_base; } - char* ebuf() const { return _IO_buf_end; } - int blen() const { return _IO_buf_end - _IO_buf_base; } - void xput_char(char c) { *_IO_write_ptr++ = c; } - int xflags() { return _IO_file_flags; } - int xflags(int f) {int fl = _IO_file_flags; _IO_file_flags = f; return fl;} - void xsetflags(int f) { _IO_file_flags |= f; } - void xsetflags(int f, int mask) - { _IO_file_flags = (_IO_file_flags & ~mask) | (f & mask); } - void gbump(int n) - { _IO_file_flags & _IO_IN_BACKUP ? (_IO_save_base+=n):(_IO_read_ptr+=n);} - void pbump(int n) { _IO_write_ptr += n; } - void setb(char* b, char* eb, int a=0); - void setp(char* p, char* ep) - { _IO_write_base=_IO_write_ptr=p; _IO_write_end=ep; } - void setg(char* eb, char* g, char *eg) { - if (_IO_file_flags & _IO_IN_BACKUP) _IO_free_backup_area(this); - _IO_read_base = eb; _IO_read_ptr = g; _IO_read_end = eg; } - char *shortbuf() { return _shortbuf; } - - int in_backup() { return _flags & _IO_IN_BACKUP; } - // The start of the main get area: FIXME: wrong for write-mode filebuf? - char *Gbase() { return in_backup() ? _IO_save_base : _IO_read_base; } - // The end of the main get area: - char *eGptr() { return in_backup() ? _IO_save_end : _IO_read_end; } - // The start of the backup area: - char *Bbase() { return in_backup() ? _IO_read_base : _IO_save_base; } - char *Bptr() { return _IO_backup_base; } - // The end of the backup area: - char *eBptr() { return in_backup() ? _IO_read_end : _IO_save_end; } - char *Nbase() { return _IO_save_base; } - char *eNptr() { return _IO_save_end; } - int have_backup() { return _IO_save_base != NULL; } - int have_markers() { return _markers != NULL; } - void free_backup_area(); - void unsave_markers(); // Make all streammarkers !saving(). - int put_mode() { return _flags & _IO_CURRENTLY_PUTTING; } - int switch_to_get_mode(); - - streambuf(int flags=0); - public: - static int flush_all(); - static void flush_all_linebuffered(); // Flush all line buffered files. - virtual ~streambuf(); - virtual int overflow(int c = EOF); // Leave public for now - virtual int underflow(); // Leave public for now - virtual int uflow(); // Leave public for now - virtual int pbackfail(int c); -// virtual int showmany (); - virtual streamsize xsputn(const char* s, streamsize n); - virtual streamsize xsgetn(char* s, streamsize n); - virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); - virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out); - - streampos pubseekoff(streamoff o, _seek_dir d, int mode=ios::in|ios::out) - { return _IO_seekoff (this, o, d, mode); } - streampos pubseekpos(streampos pos, int mode = ios::in|ios::out) - { return _IO_seekpos (this, pos, mode); } - streampos sseekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); - streampos sseekpos(streampos pos, int mode = ios::in|ios::out); - virtual streambuf* setbuf(char* p, int len); - virtual int sync(); - virtual int doallocate(); - - int seekmark(streammarker& mark, int delta = 0); - int sputbackc(char c); - int sungetc(); - int unbuffered() { return _flags & _IO_UNBUFFERED ? 1 : 0; } - int linebuffered() { return _flags & _IO_LINE_BUF ? 1 : 0; } - void unbuffered(int i) - { if (i) _flags |= _IO_UNBUFFERED; else _flags &= ~_IO_UNBUFFERED; } - void linebuffered(int i) - { if (i) _flags |= _IO_LINE_BUF; else _flags &= ~_IO_LINE_BUF; } - int allocate() { // For AT&T compatibility - if (base() || unbuffered()) return 0; - else return doallocate(); } - // Allocate a buffer if needed; use _shortbuf if appropriate. - void allocbuf() { if (base() == NULL) doallocbuf(); } - void doallocbuf(); - int in_avail() { return _IO_read_end - _IO_read_ptr; } - int out_waiting() { return _IO_write_ptr - _IO_write_base; } - streamsize sputn(const char* s, streamsize n) { return xsputn(s, n); } - streamsize padn(char pad, streamsize n) { return _IO_padn(this, pad, n); } - streamsize sgetn(char* s, streamsize n) { return _IO_sgetn(this, s, n); } - int ignore(int); - int get_column(); - int set_column(int); - long sgetline(char* buf, _IO_size_t n, char delim, int putback_delim); - int sputc(int c) { return _IO_putc(c, this); } - int sbumpc() { return _IO_getc(this); } - int sgetc() { return _IO_peekc(this); } - int snextc() { - if (_IO_read_ptr >= _IO_read_end && __underflow(this) == EOF) - return EOF; - else return _IO_read_ptr++, sgetc(); } - void stossc() { if (_IO_read_ptr < _IO_read_end) _IO_read_ptr++; } - int vscan(char const *fmt0, _IO_va_list ap, ios* stream = NULL); - int scan(char const *fmt0 ...); - int vform(char const *fmt0, _IO_va_list ap); - int form(char const *fmt0 ...); -#if 0 /* Work in progress */ - int column(); // Current column number (of put pointer). -1 is unknown. - void column(int c); // Set column number of put pointer to c. -#endif - virtual streamsize sys_read(char* buf, streamsize size); - virtual streamsize sys_write(const char*, streamsize); - virtual streampos sys_seek(streamoff, _seek_dir); - virtual int sys_close(); - virtual int sys_stat(void*); // Actually, a (struct stat*) -#if _G_IO_IO_FILE_VERSION == 0x20001 - virtual int showmanyc(); - virtual void imbue(void *); -#endif -}; - -// A backupbuf is a streambuf with full backup and savepoints on reading. -// All standard streambufs in the GNU iostream library are backupbufs. - -class filebuf : public streambuf { - protected: - void init(); - public: - static const int openprot; // Non-ANSI AT&T-ism: Default open protection. - filebuf(); - filebuf(int fd); - filebuf(int fd, char* p, int len); -#if !_IO_UNIFIED_JUMPTABLES - static filebuf *__new(); -#endif - ~filebuf(); - filebuf* attach(int fd); - filebuf* open(const char *filename, const char *mode); - filebuf* open(const char *filename, ios::openmode mode, int prot = 0664); - virtual int underflow(); - virtual int overflow(int c = EOF); - int is_open() const { return _fileno >= 0; } - int fd() const { return is_open() ? _fileno : EOF; } - filebuf* close(); - virtual int doallocate(); - virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); - virtual streambuf* setbuf(char* p, int len); - streamsize xsputn(const char* s, streamsize n); - streamsize xsgetn(char* s, streamsize n); - virtual int sync(); - protected: // See documentation in filebuf.C. -// virtual int pbackfail(int c); - int is_reading() { return eback() != egptr(); } - char* cur_ptr() { return is_reading() ? gptr() : pptr(); } - /* System's idea of pointer */ - char* file_ptr() { return eGptr(); } - // Low-level operations (Usually invoke system calls.) - virtual streamsize sys_read(char* buf, streamsize size); - virtual streampos sys_seek(streamoff, _seek_dir); - virtual streamsize sys_write(const char*, streamsize); - virtual int sys_stat(void*); // Actually, a (struct stat*) - virtual int sys_close(); -#if 0 - virtual uflow; - virtual showmany; -#endif -}; - -inline void ios::init(streambuf* sb, ostream* tie_to) { - _state = sb ? ios::goodbit : ios::badbit; _exceptions=0; - _strbuf=sb; _tie = tie_to; _width=0; _fill=' '; -#ifdef _IO_NEW_STREAMS - _flags=ios::skipws|ios::dec; -#else - _flags=ios::skipws|ios::dec|ios::dont_close; -#endif - _precision=6; _arrays = 0; } - -inline ios::ios(streambuf* sb, ostream* tie_to) { init(sb, tie_to); } - -inline ios::~ios() { -#ifndef _IO_NEW_STREAMS - if (!(_flags & (unsigned int)ios::dont_close)) delete rdbuf(); -#endif - // It is safe to use naked operator delete[] as we know elements have no - // dtor, and g++ does not add a new[] cookie for such cases. - operator delete[] (_arrays); -} -} // extern "C++" -#endif /* _STREAMBUF_H */ diff --git a/contrib/libio/strfile.h b/contrib/libio/strfile.h deleted file mode 100644 index 85e83a95d0..0000000000 --- a/contrib/libio/strfile.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include -#ifdef TODO -Merge into libio.h ? -#endif - -#ifndef __PMT -# ifdef __STDC__ -# define __PMT(p) p -# else -# define __PMT(p) () -# endif -#endif /*!__P*/ - -typedef void *(*_IO_alloc_type) __PMT ((_IO_size_t)); -typedef void (*_IO_free_type) __PMT ((void*)); - -struct _IO_str_fields -{ - _IO_alloc_type _allocate_buffer; - _IO_free_type _free_buffer; -}; - -/* This is needed for the Irix6 N32 ABI, which has a 64 bit off_t type, - but a 32 bit pointer type. In this case, we get 4 bytes of padding - after the vtable pointer. Putting them in a structure together solves - this problem. */ - -struct _IO_streambuf -{ - struct _IO_FILE _f; - const void *_vtable; -}; - -typedef struct _IO_strfile_ -{ - struct _IO_streambuf _sbf; - struct _IO_str_fields _s; -} _IO_strfile; - -/* dynamic: set when the array object is allocated (or reallocated) as - necessary to hold a character sequence that can change in length. */ -#define _IO_STR_DYNAMIC(FP) ((FP)->_s._allocate_buffer != (_IO_alloc_type)0) - -/* frozen: set when the program has requested that the array object not - be altered, reallocated, or freed. */ -#define _IO_STR_FROZEN(FP) ((FP)->_f._IO_file_flags & _IO_USER_BUF) diff --git a/contrib/libio/strops.c b/contrib/libio/strops.c deleted file mode 100644 index 193e39d55c..0000000000 --- a/contrib/libio/strops.c +++ /dev/null @@ -1,303 +0,0 @@ -/* Copyright (C) 1993, 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. */ - -#include "strfile.h" -#include "libioP.h" -#include - -#if 0 -/* The following definitions are for exposition only. - They map the terminology used in the ANSI/ISO C++ draft standard - to the implementation. */ - -/* allocated: set when a dynamic array object has been allocated, and - hence should be freed by the destructor for the strstreambuf object. */ -#define ALLOCATED(FP) ((FP)->_f._IO_buf_base && DYNAMIC(FP)) - -/* constant: set when the array object has const elements, - so the output sequence cannot be written. */ -#define CONSTANT(FP) ((FP)->_f._IO_file_flags & _IO_NO_WRITES) - -/* alsize: the suggested minimum size for a dynamic array object. */ -#define ALSIZE(FP) ??? /* not stored */ - -/* palloc: points to the function to call to allocate a dynamic array object.*/ -#define PALLOC(FP) \ - ((FP)->_s._allocate_buffer == default_alloc ? 0 : (FP)->_s._allocate_buffer) - -/* pfree: points to the function to call to free a dynamic array object. */ -#define PFREE(FP) \ - ((FP)->_s._free_buffer == default_free ? 0 : (FP)->_s._free_buffer) - -#endif - -#ifdef TODO -/* An "unbounded buffer" is when a buffer is supplied, but with no - specified length. An example is the buffer argument to sprintf. - */ -#endif - -void -_IO_str_init_static (fp, ptr, size, pstart) - _IO_FILE *fp; - char *ptr; - int size; - char *pstart; -{ - if (size == 0) - size = strlen (ptr); - else if (size < 0) - { - /* If size is negative 'the characters are assumed to - continue indefinitely.' This is kind of messy ... */ - int s; - size = 512; - /* Try increasing powers of 2, as long as we don't wrap around. */ - for (; s = 2*size, s > 0 && ptr + s > ptr && s < 0x4000000L; ) - size = s; - /* Try increasing size as much as we can without wrapping around. */ - for (s = size >> 1; s > 0; s >>= 1) - { - if (ptr + size + s > ptr) - size += s; - } - } - _IO_setb (fp, ptr, ptr + size, 0); - - fp->_IO_write_base = ptr; - fp->_IO_read_base = ptr; - fp->_IO_read_ptr = ptr; - if (pstart) - { - fp->_IO_write_ptr = pstart; - fp->_IO_write_end = ptr + size; - fp->_IO_read_end = pstart; - } - else - { - fp->_IO_write_ptr = ptr; - fp->_IO_write_end = ptr; - fp->_IO_read_end = ptr+size; - } - /* A null _allocate_buffer function flags the strfile as being static. */ - (((_IO_strfile *) fp)->_s._allocate_buffer) = (_IO_alloc_type)0; -} - -void -_IO_str_init_readonly (fp, ptr, size) - _IO_FILE *fp; - const char *ptr; - int size; -{ - _IO_str_init_static (fp, (char *) ptr, size, NULL); - fp->_IO_file_flags |= _IO_NO_WRITES; -} - -int -_IO_str_overflow (fp, c) - _IO_FILE *fp; - int c; -{ - int flush_only = c == EOF; - _IO_size_t pos; - if (fp->_flags & _IO_NO_WRITES) - return flush_only ? 0 : EOF; - if ((fp->_flags & _IO_TIED_PUT_GET) && !(fp->_flags & _IO_CURRENTLY_PUTTING)) - { - fp->_flags |= _IO_CURRENTLY_PUTTING; - fp->_IO_write_ptr = fp->_IO_read_ptr; - fp->_IO_read_ptr = fp->_IO_read_end; - } - pos = fp->_IO_write_ptr - fp->_IO_write_base; - if (pos >= (_IO_size_t) (_IO_blen (fp) + flush_only)) - { - if (fp->_flags & _IO_USER_BUF) /* not allowed to enlarge */ - return EOF; - else - { - char *new_buf; - char *old_buf = fp->_IO_buf_base; - _IO_size_t new_size = 2 * _IO_blen (fp) + 100; - new_buf - = (char *) (*((_IO_strfile *) fp)->_s._allocate_buffer) (new_size); - if (new_buf == NULL) - { - /* __ferror(fp) = 1; */ - return EOF; - } - if (fp->_IO_buf_base) - { - memcpy (new_buf, old_buf, _IO_blen (fp)); - (*((_IO_strfile *) fp)->_s._free_buffer) (fp->_IO_buf_base); - /* Make sure _IO_setb won't try to delete _IO_buf_base. */ - fp->_IO_buf_base = NULL; - } -#if 0 - if (lenp == &LEN(fp)) /* use '\0'-filling */ - memset (new_buf + pos, 0, blen() - pos); -#endif - _IO_setb (fp, new_buf, new_buf + new_size, 1); - fp->_IO_read_base = new_buf + (fp->_IO_read_base - old_buf); - fp->_IO_read_ptr = new_buf + (fp->_IO_read_ptr - old_buf); - fp->_IO_read_end = new_buf + (fp->_IO_read_end - old_buf); - fp->_IO_write_ptr = new_buf + (fp->_IO_write_ptr - old_buf); - - fp->_IO_write_base = new_buf; - fp->_IO_write_end = fp->_IO_buf_end; - } - } - - if (!flush_only) - *fp->_IO_write_ptr++ = (unsigned char) c; - if (fp->_IO_write_ptr > fp->_IO_read_end) - fp->_IO_read_end = fp->_IO_write_ptr; - return c; -} - -int -_IO_str_underflow (fp) - _IO_FILE *fp; -{ - if (fp->_IO_write_ptr > fp->_IO_read_end) - fp->_IO_read_end = fp->_IO_write_ptr; - if ((fp->_flags & _IO_TIED_PUT_GET) && (fp->_flags & _IO_CURRENTLY_PUTTING)) - { - fp->_flags &= ~_IO_CURRENTLY_PUTTING; - fp->_IO_read_ptr = fp->_IO_write_ptr; - fp->_IO_write_ptr = fp->_IO_write_end; - } - if (fp->_IO_read_ptr < fp->_IO_read_end) - return *((unsigned char *) fp->_IO_read_ptr); - else - return EOF; -} - -/* The size of the valid part of the buffer. */ - -_IO_ssize_t -_IO_str_count (fp) - _IO_FILE *fp; -{ - return ((fp->_IO_write_ptr > fp->_IO_read_end - ? fp->_IO_write_ptr : fp->_IO_read_end) - - fp->_IO_read_base); -} - -_IO_pos_t -_IO_str_seekoff (fp, offset, dir, mode) - _IO_FILE *fp; - _IO_off_t offset; - int dir; - int mode; -{ - _IO_ssize_t cur_size = _IO_str_count (fp); - _IO_pos_t new_pos = EOF; - - /* Move the get pointer, if requested. */ - if (mode & _IOS_INPUT) - { - switch (dir) - { - case _IO_seek_end: - offset += cur_size; - break; - case _IO_seek_cur: - offset += fp->_IO_read_ptr - fp->_IO_read_base; - break; - default: /* case _IO_seek_set: */ - break; - } - if (offset < 0 || (_IO_ssize_t) offset > cur_size) - return EOF; - fp->_IO_read_ptr = fp->_IO_read_base + offset; - fp->_IO_read_end = fp->_IO_read_base + cur_size; - new_pos = offset; - } - - /* Move the put pointer, if requested. */ - if (mode & _IOS_OUTPUT) - { - switch (dir) - { - case _IO_seek_end: - offset += cur_size; - break; - case _IO_seek_cur: - offset += fp->_IO_write_ptr - fp->_IO_write_base; - break; - default: /* case _IO_seek_set: */ - break; - } - if (offset < 0 || (_IO_ssize_t) offset > cur_size) - return EOF; - fp->_IO_write_ptr = fp->_IO_write_base + offset; - new_pos = offset; - } - return new_pos; -} - -int -_IO_str_pbackfail (fp, c) - _IO_FILE *fp; - int c; -{ - if ((fp->_flags & _IO_NO_WRITES) && c != EOF) - return EOF; - return _IO_default_pbackfail (fp, c); -} - -void -_IO_str_finish (fp, dummy) - _IO_FILE *fp; - int dummy; -{ - if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF)) - (((_IO_strfile *) fp)->_s._free_buffer) (fp->_IO_buf_base); - fp->_IO_buf_base = NULL; - - _IO_default_finish (fp, 0); -} - -struct _IO_jump_t _IO_str_jumps = -{ - JUMP_INIT_DUMMY, - JUMP_INIT(finish, _IO_str_finish), - JUMP_INIT(overflow, _IO_str_overflow), - JUMP_INIT(underflow, _IO_str_underflow), - JUMP_INIT(uflow, _IO_default_uflow), - JUMP_INIT(pbackfail, _IO_str_pbackfail), - JUMP_INIT(xsputn, _IO_default_xsputn), - JUMP_INIT(xsgetn, _IO_default_xsgetn), - JUMP_INIT(seekoff, _IO_str_seekoff), - JUMP_INIT(seekpos, _IO_default_seekpos), - JUMP_INIT(setbuf, _IO_default_setbuf), - JUMP_INIT(sync, _IO_default_sync), - JUMP_INIT(doallocate, _IO_default_doallocate), - JUMP_INIT(read, _IO_default_read), - JUMP_INIT(write, _IO_default_write), - JUMP_INIT(seek, _IO_default_seek), - JUMP_INIT(close, _IO_default_close), - JUMP_INIT(stat, _IO_default_stat) -}; diff --git a/contrib/libio/strstream.cc b/contrib/libio/strstream.cc deleted file mode 100644 index a32e811c9d..0000000000 --- a/contrib/libio/strstream.cc +++ /dev/null @@ -1,116 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* Written by Per Bothner (bothner@cygnus.com). */ - -#ifdef __GNUG__ -#pragma implementation -#endif -#include "iostreamP.h" -#include "strstream.h" -#include - -static void* default_alloc(_IO_size_t size) -{ - return (void*)new char[size]; -} - -static void default_free(void* ptr) -{ - delete [] (char*)ptr; -} - -istrstream::istrstream(const char *cp, int n) -{ - __my_sb.init_readonly (cp, n); -} - -strstreambase::strstreambase(char *cp, int n, int mode) -: __my_sb (cp, n, - (mode == ios::app || mode == ios::ate) ? cp + strlen(cp) : cp) -{ - init (&__my_sb); -} - -char *strstreambuf::str() -{ - freeze(1); - return base(); -} - -_IO_ssize_t strstreambuf::pcount () { return _IO_write_ptr - _IO_write_base; } - -int strstreambuf::overflow(int c /* = EOF */) -{ - return _IO_str_overflow (this, c); -} - -int strstreambuf::underflow() -{ - return _IO_str_underflow(this); -} - - -void strstreambuf::init_dynamic(_IO_alloc_type alloc, _IO_free_type free, - int initial_size) - -{ - _s._allocate_buffer = alloc ? alloc : default_alloc; - _s._free_buffer = free ? free : default_free; - if (initial_size > 0) - { - char * buf = (char*)(*_s._allocate_buffer)(initial_size); - setb(buf, buf + initial_size, 1); - setp(buf, buf + initial_size); - setg(buf, buf, buf); - } -} - -void strstreambuf::init_static(char *ptr, int size, char *pstart) -{ - _IO_str_init_static (this, ptr, size, pstart); -} - -void strstreambuf::init_readonly (const char *ptr, int size) -{ - _IO_str_init_readonly (this, ptr, size); -} - -strstreambuf::~strstreambuf() -{ - if (_IO_buf_base && !(_flags & _IO_USER_BUF)) - (_s._free_buffer)(_IO_buf_base); - _IO_buf_base = NULL; -} - -streampos strstreambuf::seekoff(streamoff off, _seek_dir dir, - int mode /*=ios::in|ios::out*/) -{ - return _IO_str_seekoff (this, off, dir, mode); -} - -int strstreambuf::pbackfail(int c) -{ - return _IO_str_pbackfail (this, c); -} diff --git a/contrib/libio/strstream.h b/contrib/libio/strstream.h deleted file mode 100644 index 967e5b0b76..0000000000 --- a/contrib/libio/strstream.h +++ /dev/null @@ -1,113 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993, 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. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* Written by Per Bothner (bothner@cygnus.com). */ - -#ifndef __STRSTREAM_H -#define __STRSTREAM_H -#ifdef __GNUG__ -#pragma interface -#endif -#include -#include - -extern "C++" { -class strstreambuf : public streambuf -{ - struct _IO_str_fields _s; - friend class istrstream; - - void init_dynamic(_IO_alloc_type alloc, _IO_free_type free, - int initial_size = 0); - void init_static(char *ptr, int size, char *pstart); - void init_readonly(const char *ptr, int size); - protected: - virtual int overflow(int = EOF); - virtual int underflow(); - virtual int pbackfail(int c); - public: - virtual ~strstreambuf(); - strstreambuf() { init_dynamic(0, 0); } - strstreambuf(int initial_size) { init_dynamic(0, 0, initial_size); } - strstreambuf(void *(*__alloc)(_IO_size_t), void (*__free)(void*)) - { init_dynamic(__alloc, __free); } - strstreambuf(char *ptr, int size, char *pstart = NULL) - { init_static(ptr, size, pstart); } - strstreambuf(unsigned char *ptr, int size, unsigned char *pstart = NULL) - { init_static((char*)ptr, size, (char*)pstart); } - strstreambuf(const char *ptr, int size) - { init_readonly(ptr, size); } - strstreambuf(const unsigned char *ptr, int size) - { init_readonly((const char*)ptr, size); } - strstreambuf(signed char *ptr, int size, signed char *pstart = NULL) - { init_static((char*)ptr, size, (char*)pstart); } - strstreambuf(const signed char *ptr, int size) - { init_readonly((const char*)ptr, size); } - // Note: frozen() is always true if !_IO_STR_DYNAMIC(this). - int frozen() { return _flags & _IO_USER_BUF ? 1 : 0; } - void freeze(int n=1) - { if (_IO_STR_DYNAMIC(this)) - { if (n) _flags |= _IO_USER_BUF; else _flags &= ~_IO_USER_BUF; } } - _IO_ssize_t pcount(); - char *str(); - virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); -}; - -class strstreambase : virtual public ios { - protected: - strstreambuf __my_sb; - public: - strstreambuf* rdbuf() { return &__my_sb; } - protected: - strstreambase() { init (&__my_sb); } - strstreambase(char *cp, int n, int mode=ios::out); -}; - -class istrstream : public strstreambase, public istream { - public: - istrstream(const char*, int=0); -}; - -class ostrstream : public strstreambase, public ostream { - public: - ostrstream() { } - ostrstream(char *cp, int n, int mode=ios::out) :strstreambase(cp,n,mode){} - _IO_ssize_t pcount() { return ((strstreambuf*)_strbuf)->pcount(); } - char *str() { return ((strstreambuf*)_strbuf)->str(); } - void freeze(int n = 1) { ((strstreambuf*)_strbuf)->freeze(n); } - int frozen() { return ((strstreambuf*)_strbuf)->frozen(); } -}; - -class strstream : public strstreambase, public iostream { - public: - strstream() { } - strstream(char *cp, int n, int mode=ios::out) :strstreambase(cp,n,mode){} - _IO_ssize_t pcount() { return ((strstreambuf*)_strbuf)->pcount(); } - char *str() { return ((strstreambuf*)_strbuf)->str(); } - void freeze(int n = 1) { ((strstreambuf*)_strbuf)->freeze(n); } - int frozen() { return ((strstreambuf*)_strbuf)->frozen(); } -}; -} // extern "C++" - -#endif /*!__STRSTREAM_H*/ diff --git a/contrib/libio/tests/ChangeLog b/contrib/libio/tests/ChangeLog deleted file mode 100644 index 548e9e0519..0000000000 --- a/contrib/libio/tests/ChangeLog +++ /dev/null @@ -1,166 +0,0 @@ -Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com) - - * gcc-2.95.3 Released. - -Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.2 Released. - -Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.1 Released. - -Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -1997-10-31 Brendan Kehoe - - * tFile.cc (t4): Cast TMPFILE to char* in the call to unlink, to - solve warning problems with vxworks headers that leave const off - their declarations. - -Tue May 20 17:57:31 1997 Jeffrey A Law (law@cygnus.com) - - * tfformat.c (main): Only run half the testcases if SLOW_SIMULATOR - is defined. - -Sun May 18 17:15:32 1997 Jeffrey A Law (law@cygnus.com) - - * tfformat.c (main): Exit immediately if doubles are not - at least 64 bits wide. - -Fri May 16 19:31:29 1997 Bob Manson - - Fix testscases to use _G_int32_t appropriately. - -Thu May 1 17:35:43 1997 Jason Merrill - - * Makefile.in (tgetl, tFile, tiomisc, hounddog, putbackdog, - tiomanip, foo, foo+): Add $(CXXFLAGS). - (tfseek, twrseek, trdseek, tstdiomisc, tpopen): Add $(CFLAGS). - -Mon Apr 28 11:28:36 1997 Brendan Kehoe - - * tiomisc.cc (operator delete): Add throw spec. - -Sat Apr 26 13:40:17 1997 Bob Manson - - * Makefile.in: Change check to check-old. Add do-nothing - check target. - -Wed Apr 10 17:15:47 1996 Jason Merrill - - * Makefile.in (IOLIBS): Link with libstdc++. - -Tue Mar 12 11:45:14 1996 Per Bothner - - * tiomisc.cc (test_read_write_flush): New test for read/write/seek - on block end. From Luke Blanshard . - -Thu Jul 6 17:51:30 1995 Per Bothner - - * tiomisc.cc (getline_test3): New function. Test reading long lines. - * tiomisc.exp: Update for output from getline_test3. - -Wed May 10 03:06:51 1995 Jason Merrill - - * configure.in (X*INCLUDES): Renamed. - -Thu Apr 27 21:05:00 1995 Per Bothner - - * tiomisc.cc (test_destroy), tiomisc.exp: Add support for - _IO_NEW_STREAMS. - -Tue Apr 25 15:15:01 1995 Jim Wilson - - * tstdiomisc.c (t2): Use N not n in last SCAN macro call. - -Sun Feb 12 21:23:24 1995 Brendan Kehoe (brendan@lisa.cygnus.com) - - * Makefile.in (JUNK_TO_CLEAN): Also delete foo.dat from tiomisc. - -Sat Nov 5 14:37:36 1994 Per Bothner - - * tiomisc.cc (test_destroy): New test case from Jason Merrill. - * tiomisc.exp: Update. - - * Makefile.in (JUNK_TO_CLEAN): Add tstdiomisc. - -Thu Oct 13 16:47:30 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * tiomisc.cc (reread_test): Remove bogus istream assignment. - -Wed Aug 31 13:59:56 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * Makefile.in (CXX_FLAGS): Not used. Removed. - -Wed Aug 17 18:27:37 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * tiomisc.cc (getline_test1, getline_test2, flush1_test): New tests, - * tiomisc.cc (reread_test): New tests, - -Wed Jun 22 13:44:19 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * tstdiomisc.c: Add some sscanf tests. - * Makefile.in (check-tstdiomisc): Run diff with expected output. - * tstdiomisc.exp: New file. Expected output from tstdiomisc. - * Makefile.in (foo): New rule, for quick one-off tests. - -Fri May 6 14:10:24 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * tFile.cc (t7): Revert Mar 4 change - I was confused. - -Sat Apr 2 04:41:41 1994 Andreas Schwab (schwab@issan.informatik.uni-dortmund.de) - - * Makefile.in (tfformat): Fix dependency. - -Fri Mar 4 17:40:14 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * tFile.cc (t7): gcount after getline shouldn't include delimiter. - * tFile.cc (show_int, t12), tFile.exp: More integer formatting tests. - -Tue Feb 8 18:39:09 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * tiomisc.cc, tiomisc.exp: New test case (for filebuf::attach) - from Joe Buck. - -Mon Jan 31 13:24:58 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * tfformat.c (main): Fix fprintf format string (%s -> %d). - Bug reported by Jochen Voss . - -Sun Dec 19 15:29:00 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * tstdiomisc.c, Makefile.in: New tests. - -Thu Dec 2 22:56:21 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * Makefile.in (JUNK_TO_CLEAN), configure.in (MOSTLYCLEAN): - Added, to cleanup after tests. - -Fri Nov 26 16:05:43 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * tiomisc.cc, tiomisc.exp: A (hopefully growing) collection - of small, random tests (mainly regression tests). - * tiomisc.cc (test1 and test2): Tests from Wilco van Hoogstraeten - to check for (now-fixed) bugs. - -Mon Oct 4 17:38:27 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * Makefile.in (IOSTDIOLIB): New macro. - -Fri Aug 27 12:22:10 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * tFile.cc (t7): Add test for buffer overflow. - -Fri Aug 20 00:23:53 1993 Per Bothner (bothner@kalessin.cygnus.com) - - Moved various tests over from old libg++/iostream/test. - * Makefile.in: Edit appropriately. - - diff --git a/contrib/libio/tests/Makefile.in b/contrib/libio/tests/Makefile.in deleted file mode 100644 index b70639a680..0000000000 --- a/contrib/libio/tests/Makefile.in +++ /dev/null @@ -1,196 +0,0 @@ -# Copyright (C) 1993, 1998 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 GNU CC; see the file COPYING. If not, write to -# the Free Software Foundation, 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. */ - -srcdir = . - -CFLAGS = -g -C_FLAGS = $(CFLAGS) -I. -I.. -I$(srcdir) -I$(srcdir)/.. -CXXFLAGS = -g -CC = gcc -CXX = gcc - -#### package, host, target, and site dependent Makefile fragments come in here. -## - -STDIO_LD_FLAGS = -u __cleanup - -#LIBS = ../../libg++.a - -#LIBSTDIO = ../stdio/libstdio++.a -#LIBIO = ../libio.a - -#STDIOLIBS = $(STDIO_LD_FLAGS) $(LIBSTDIO) $(LIBIO) $(LIBS) -STDIOLIBS = $(LIBSTDIO) $(LIBIO) $(LIBS) -IOLIBS = -L../../libstdc++ -lstdc++ -IOSTDIOLIB = ../libio.a ../../libiberty/libiberty.a - -DEPEND_SOURCES = $(srcdir)/*.C - -.PHONY: check check-old check-iostream check-stdio -check: $(CHECK) - - -# These are tests written in C++, that test the iostream facility. -check-iostream: check-tFile check-tiomisc \ - check-hounddog check-putbackdog check-tiomanip - -# These are tests written in C, that don't need C++. -# They test libio's emulation of stdio. -check-iostdio: check-tiformat check-tfformat check-tstdiomisc - -# check-stdio runs test programs that use stdio. -# These aren't run by default because there may be linker tricks needed -# to build them (if libc.a contains a competing stdio implementation). - -check-stdio: check-tfseek check-twrseek check-trdseek check-tpopen - -# See ${MOSTLYCLEAN} in configure.in -JUNK_TO_CLEAN = tFile tiomisc hounddog putbackdog tiomanip \ - t?format *.out streamfile ftmp* tstdiomisc foo.dat - -.PHONY: info -info: -.PHONY: clean-info -clean-info: -.PHONY: install-info -install-info: - -tst: tst.o - gcc -v -o tst tst.o $(STDIOLIBS) - -tgetl: tgetl.o - $(CXX) $(CXXFLAGS) -o tgetl tgetl.o $(IOLIBS) - -tFile: tFile.o - $(CXX) $(CXXFLAGS) -o tFile tFile.o $(IOLIBS) - -tiomisc: tiomisc.o - $(CXX) $(CXXFLAGS) -o tiomisc tiomisc.o $(IOLIBS) - -hounddog: hounddog.o - $(CXX) $(CXXFLAGS) -o hounddog hounddog.o $(IOLIBS) - -check-hounddog: hounddog - ./hounddog <$(srcdir)/hounddog.inp > hounddog.out 2>&1 - diff -c hounddog.out $(srcdir)/hounddog.exp - ./hounddog -b0 <$(srcdir)/hounddog.inp > hound-b0.out 2>&1 - diff -c hound-b0.out $(srcdir)/hounddog.exp - ./hounddog -b2 <$(srcdir)/hounddog.inp > hound-b2.out 2>&1 - diff -c hound-b2.out $(srcdir)/hounddog.exp - -putbackdog: putbackdog.o - $(CXX) $(CXXFLAGS) -o putbackdog putbackdog.o $(IOLIBS) - -check-putbackdog-regular: putbackdog - ./putbackdog <$(srcdir)/hounddog.inp > putback.out 2>&1 - diff -c putback.out $(srcdir)/hounddog.exp -check-putbackdog-nobuf: putbackdog - ./putbackdog -b0 <$(srcdir)/hounddog.inp > putback-b0.out 2>&1 - diff -c putback-b0.out $(srcdir)/hounddog.exp -check-putbackdog-buf2: putbackdog - ./putbackdog -b2 <$(srcdir)/hounddog.inp > putback-b2.out 2>&1 - diff -c putback-b2.out $(srcdir)/hounddog.exp -check-putbackdog: \ - check-putbackdog-regular check-putbackdog-nobuf check-putbackdog-buf2 - -tfseek: tfseek.o - $(CC) $(CFLAGS) -o tfseek tfseek.o $(STDIOLIBS) - -check-tfseek: tfseek - ./tfseek SEEK_SET fopen > tfseek-set-fopen.out 2>&1 - diff -c tfseek-set-fopen.out $(srcdir)/tfseek-set.exp - ./tfseek SEEK_SET freopen > tfseek-set-freopen.out 2>&1 - diff -c tfseek-set-freopen.out $(srcdir)/tfseek-set.exp - ./tfseek SEEK_CUR fopen > tfseek-cur-fopen.out 2>&1 - diff -c tfseek-cur-fopen.out $(srcdir)/tfseek-cur.exp - ./tfseek SEEK_CUR freopen > tfseek-cur-freopen.out 2>&1 - diff -c tfseek-cur-freopen.out $(srcdir)/tfseek-cur.exp - -twrseek: twrseek.o - $(CC) $(CFLAGS) -o twrseek twrseek.o $(STDIOLIBS) - -check-twrseek: twrseek - ./twrseek > twrseek.out 2>&1 - diff -c twrseek.out $(srcdir)/twrseek.exp - -trdseek: trdseek.o - $(CC) $(CFLAGS) -o trdseek -v trdseek.o $(STDIOLIBS) - -check-trdseek: trdseek - ./trdseek - -check-tFile-regular: tFile - ./tFile < $(srcdir)/tFile.inp > tFile.out 2>&1 - diff -c tFile.out $(srcdir)/tFile.exp -# Run tFile with cout.rdbuf() unbuffered. -check-tFile-nobuf: tFile - ./tFile -b0 < $(srcdir)/tFile.inp > tFile-buf0.out 2>&1 - diff -c tFile-buf0.out $(srcdir)/tFile.exp -# Run tFile with a 3-byte buffer for cout.rdbuf(). -check-tFile-buf3: tFile - ./tFile -b3 < $(srcdir)/tFile.inp > tFile-buf3.out 2>&1 - diff -c tFile-buf3.out $(srcdir)/tFile.exp -check-tFile: check-tFile-regular check-tFile-nobuf check-tFile-buf3 - -check-tiomisc: tiomisc - ./tiomisc >tiomisc.out 2>&1 - diff -c tiomisc.out $(srcdir)/tiomisc.exp - -tiomanip: tiomanip.o - $(CXX) $(CXXFLAGS) -o tiomanip tiomanip.o $(IOLIBS) -check-tiomanip: tiomanip - ./tiomanip >tiomanip.out 2>&1 - diff -c tiomanip.out $(srcdir)/tiomanip.exp - -tfformat: $(srcdir)/tfformat.c - $(CC) $(C_FLAGS) -DTEST_LIBIO -DTEST_EXACTNESS \ - -o tfformat $(srcdir)/tfformat.c $(IOSTDIOLIB) - -check-tfformat: tfformat - ./tfformat - -tiformat: $(srcdir)/tiformat.c - $(CC) $(C_FLAGS) -DTEST_LIBIO -o tiformat $(srcdir)/tiformat.c $(IOSTDIOLIB) - -check-tiformat: tiformat - ./tiformat - -tstdiomisc: tstdiomisc.o - $(CC) $(CFLAGS) -o tstdiomisc tstdiomisc.o $(IOSTDIOLIB) - -check-tstdiomisc: tstdiomisc - ./tstdiomisc >tstdiomisc.out 2>&1 - diff -c tstdiomisc.out $(srcdir)/tstdiomisc.exp - -tpopen: tpopen.o - $(CC) $(CFLAGS) -o tpopen tpopen.o $(STDIOLIBS) - -check-tpopen: tpopen - ./tpopen > tpopen.out 2>&1 - diff -c tpopen.out $(srcdir)/tpopen.exp - -trwseek: trwseek.o - $(CC) $(CFLAGS) -o trwseek trwseek.o $(STDIOLIBS) - -check-trwseek: trwseek - ./trwsseek TMP r+ k w o - -foo: foo.o - $(CXX) $(CXXFLAGS) -o foo foo.o $(STDIOLIBS) -foo+: foo+.o - $(CXX) $(CXXFLAGS) -o foo+ foo+.o $(IOLIBS) diff --git a/contrib/libio/tests/configure.in b/contrib/libio/tests/configure.in deleted file mode 100644 index 46deefbc8c..0000000000 --- a/contrib/libio/tests/configure.in +++ /dev/null @@ -1,36 +0,0 @@ -# This file is a shell script fragment that supplies the information -# necessary for a configure script to process the program in -# this directory. For more information, look at ../../configure. - -configdirs= -srctrigger=tFile.cc -srcname="test C++ input/output library" -package_makefile_frag=Make.pack -package_makefile_rules_frag=Make.pack.r - -# per-host: - -# per-target: - -TO_TOPDIR=../../ -ALL=' ' -XCINCLUDES='-I. -I.. -I$(srcdir) -I$(srcdir)/..' -XCXXINCLUDES='-I. -I.. -I$(srcdir) -I$(srcdir)/..' -MOSTLYCLEAN='*.o core $(JUNK_TO_CLEAN)' -(. ${srcdir}/../config.shared) >${package_makefile_frag} 2>${package_makefile_rules_frag} - -if [ "${srcdir}" = "." ] ; then - if [ "${with_target_subdir}" != "." ] ; then - topsrcdir=${with_multisrctop}../../.. - else - topsrcdir=${with_multisrctop}../.. - fi -else - topsrcdir=${srcdir}/../.. -fi - -if [ ! -d ${topsrcdir}/gcc ] ; then - echo "CHECK = check-iostream check-iostdio" >>${package_makefile_frag} -fi - -# post-target: diff --git a/contrib/libio/tests/hounddog.cc b/contrib/libio/tests/hounddog.cc deleted file mode 100644 index 29a9238364..0000000000 --- a/contrib/libio/tests/hounddog.cc +++ /dev/null @@ -1,85 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include -#include -#include - -// Read either "dog", "hound", or "hounddog". -// If "dog" is found, return 1. -// If "hound" is found, return 2. -// If "hounddog" is found, return 3. -// If non of these are found, return -1. -int my_scan(streambuf* sb) -{ - streammarker fence(sb); - char buffer[20]; - // Try reading "hounddog": - if (sb->sgetn(buffer, 8) == 8 && strncmp(buffer, "hounddog", 8) == 0) - return 3; - // No, no "hounddog": Backup to 'fence' ... - sb->seekmark(fence); - // ... and try reading "dog": - if (sb->sgetn(buffer, 3) == 3 && strncmp(buffer, "dog", 3) == 0) - return 1; - // No, no "dog" either: Backup to 'fence' ... - sb->seekmark(fence); - // ... and try reading "hound": - if (sb->sgetn(buffer, 5) == 5 && strncmp(buffer, "hound", 5) == 0) - return 2; - // No, no "hound" either: Backup to 'fence' and signal failure. - sb->seekmark(fence); // Backup to 'fence'.. - return -1; -} - -int main(int argc, char **argv) -{ - streambuf *sb = cin.rdbuf(); - if (argc > 1 && strncmp(argv[1], "-b", 2) == 0) { - streambuf *ret; - int buffer_size = atoi(&argv[1][2]); - if (buffer_size == 0) - ret = sb->setbuf(NULL, 0); - else - ret = sb->setbuf(new char[buffer_size], buffer_size); - if (ret != sb) - cerr << "Warning: cin.rdbuf()->setbuf failed!\n"; - } - for (;;) { - int code = my_scan(sb); - int ch = sb->sbumpc(); - if (code == -1 && ch == EOF) - break; - int n = 0; - while (ch != EOF && ch != '\n') { - n++; - ch = sb->sbumpc(); - }; - if (ch == EOF) { - cout << "[Unexpected EOF]\n"; - break; - } - cout << "Code: " << code << " followed by " << n << " chars\n"; - } -} diff --git a/contrib/libio/tests/hounddog.exp b/contrib/libio/tests/hounddog.exp deleted file mode 100644 index 2060807b43..0000000000 --- a/contrib/libio/tests/hounddog.exp +++ /dev/null @@ -1,7 +0,0 @@ -Code: -1 followed by 6 chars -Code: 1 followed by 3 chars -Code: 2 followed by 0 chars -Code: -1 followed by 3 chars -Code: 3 followed by 4 chars -Code: 1 followed by 0 chars -Code: -1 followed by 3 chars diff --git a/contrib/libio/tests/hounddog.inp b/contrib/libio/tests/hounddog.inp deleted file mode 100644 index 370371bc20..0000000000 --- a/contrib/libio/tests/hounddog.inp +++ /dev/null @@ -1,7 +0,0 @@ -hello! -doggie -hound -cat -hounddog rat -dog -foo diff --git a/contrib/libio/tests/putbackdog.cc b/contrib/libio/tests/putbackdog.cc deleted file mode 100644 index 0e1ed61f55..0000000000 --- a/contrib/libio/tests/putbackdog.cc +++ /dev/null @@ -1,97 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -// Test streambuf::sputbackc - -#include -#include -#include - -// Read either "dog", "hound", or "hounddog". -// If "dog" is found, return 1. -// If "hound" is found, return 2. -// If "hounddog" is found, return 3. -// If non of these are found, return -1. - -void unget_string(streambuf *sb, char *str, int count) -{ - for (str += count; -- count >= 0; ) - sb->sputbackc(*--str); -} - -int my_scan(streambuf* sb) -{ - char buffer[20]; - // Try reading "hounddog": - int count; - count = sb->sgetn(buffer, 8); - if (count == 8 && strncmp(buffer, "hounddog", 8) == 0) - return 3; - // No, no "hounddog": Backup to 'fence' ... - unget_string(sb, buffer, count); - // ... and try reading "dog": - count = sb->sgetn(buffer, 3); - if (count == 3 && strncmp(buffer, "dog", 3) == 0) - return 1; - // No, no "dog" either: Backup to 'fence' ... - unget_string(sb, buffer, count); - // ... and try reading "hound": - count = sb->sgetn(buffer, 5); - if (count == 5 && strncmp(buffer, "hound", 5) == 0) - return 2; - // No, no "hound" either: Backup to 'fence' and signal failure. - unget_string(sb, buffer, count); - return -1; -} - -int main(int argc, char **argv) -{ - streambuf *sb = cin.rdbuf(); - if (argc > 1 && strncmp(argv[1], "-b", 2) == 0) { - streambuf *ret; - int buffer_size = atoi(&argv[1][2]); - if (buffer_size == 0) - ret = sb->setbuf(NULL, 0); - else - ret = sb->setbuf(new char[buffer_size], buffer_size); - if (ret != sb) - cerr << "Warning: cin.rdbuf()->setbuf failed!\n"; - } - for (;;) { - int code = my_scan(sb); - int ch = sb->sbumpc(); - if (code == -1 && ch == EOF) - break; - int n = 0; - while (ch != EOF && ch != '\n') { - n++; - ch = sb->sbumpc(); - }; - if (ch == EOF) { - cout << "[Unexpected EOF]\n"; - break; - } - cout << "Code: " << code << " followed by " << n << " chars\n"; - } -} diff --git a/contrib/libio/tests/tFile.cc b/contrib/libio/tests/tFile.cc deleted file mode 100644 index 42090ff83a..0000000000 --- a/contrib/libio/tests/tFile.cc +++ /dev/null @@ -1,558 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -// This may look like C code, but it is really -*- C++ -*- - -/* - * a few tests for streams - * - */ - -#include -#include -#ifndef _OLD_STREAMS -#include -#include "unistd.h" -#endif -#include -#include - -#include -#include -#include -#include - -const char *tempfile; - -class record -{ -public: - char c; int i; double d; -}; - -ostream& operator<<(ostream& s, record& r) -{ - return(s << "(i = " << r.i << " c = " << r.c << " d = " << r.d << ")"); -} - -void t1() -{ - char ch; - - assert(cout.good()); - assert(cout.writable()); - assert(cout.is_open()); - cout << "Hello, world via cout\n"; - assert(cerr.good()); - assert(cerr.writable()); - assert(cerr.is_open()); - cerr << "Hello, world via cerr\n"; - - assert(cin.good()); - assert(cin.readable()); - assert(cin.is_open()); - - cout << "enter a char:"; cin >> ch; - cout.put('c'); cout.put(' '); cout.put('='); cout.put(' '); - cout.put('"'); cout.put(ch); cout << '"'; cout << char('\n'); - assert(cin.good()); - assert(cout.good()); -} - -void t2() -{ - int i; - short h; - long l; - float f; - double d; - char s[100]; - - cout << "enter three integers (short, int, long):"; - cin >> h; cin >> i; - // cin.scan("%ld", &l); - cin >> l; - cout << "first = " << h << " via dec = " << dec(h, 8) << "\n"; - cout << "second = " << i << form(" via form = %d = 0%o", i, i); - cout.form(" via cout.form = %d = 0x%x\n", i, i); - cout << "third = " << l << " via hex = " << hex(l) << "\n"; - assert(cin.good()); - assert(cout.good()); - - cout << "enter a float then a double:"; cin >> f; cin >> d; - cout << "first = " << f << "\n"; - cout << "second = " << d << "\n"; - assert(cin.good()); - assert(cout.good()); - - cout << "enter 5 characters separated with spaces:"; cin >> s; - cout << "first = " << s << "\n"; - cin.get(s, 100); - cout << "rest = " << s << "\n"; - - assert(cin.good()); - - cin.width(10); - cin >> s; - cin.clear(); - cout << "A 10-character buffer: " << s << endl; - - assert(cout.good()); - -} - -void t3() -{ - char ch; - cout << "\nMaking streams sout and sin..."; -#ifdef _OLD_STREAMS - ostream sout("streamfile", io_writeonly, a_create); -#else - ofstream sout("streamfile"); -#endif - assert(sout.good()); - assert(sout.is_open()); - assert(sout.writable()); - assert(!sout.readable()); - sout << "This file has one line testing output streams.\n"; - sout.close(); - assert(!sout.is_open()); -#ifdef _OLD_STREAMS - istream sin("streamfile", io_readonly, a_useonly); -#else - ifstream sin("streamfile"); -#endif - assert(sin.good()); - assert(sin.is_open()); - assert(!sin.writable()); - assert(sin.readable()); - cout << "contents of file:\n"; - while(sin >> ch) cout << ch; - sin.close(); - assert(!sin.is_open()); -} - - -void t4() -{ - char s[100]; - char ch; - int i; - - cout << "\nMaking File tf ... "; -#ifdef _OLD_STREAMS - File tf(tempfile, io_readwrite, a_create); -#else - fstream tf(tempfile, ios::in|ios::out|ios::trunc); -#endif - assert(tf.good()); - assert(tf.is_open()); - assert(tf.writable()); - assert(tf.readable()); - strcpy(s, "This is the first and only line of this file.\n"); -#ifdef _OLD_STREAMS - tf.put(s); - tf.seek(0); -#else - tf << s; - tf.rdbuf()->seekoff(0, ios::beg); -#endif - tf.get(s, 100); - assert(tf.good()); - cout << "first line of file:\n" << s << "\n"; - cout << "next char = "; - tf.get(ch); - cout << (int)ch; - cout.put('\n'); - assert(ch == 10); - strcpy(s, "Now there is a second line.\n"); - cout << "reopening tempfile, appending: " << s; -#ifdef _OLD_STREAMS - tf.open(tf.name(), io_appendonly, a_use); -#else - tf.close(); - tf.open(tempfile, ios::app); -#endif - assert(tf.good()); - assert(tf.is_open()); - assert(tf.writable()); - assert(!tf.readable()); -#ifdef _OLD_STREAMS - tf.put(s); - assert(tf.good()); - tf.open(tf.name(), io_readonly, a_use); -#else - tf << s; - assert(tf.good()); - tf.close(); - tf.open(tempfile, ios::in); -#endif - tf.raw(); - assert(tf.good()); - assert(tf.is_open()); - assert(!tf.writable()); - assert(tf.readable()); - cout << "First 10 chars via raw system read after reopen for input:\n"; - read(tf.filedesc(), s, 10); - assert(tf.good()); - for (i = 0; i < 10; ++ i) - cout.put(s[i]); - lseek(tf.filedesc(), 5, 0); - cout << "\nContents after raw lseek to pos 5:\n"; - while ( (tf.get(ch)) && (cout.put(ch)) ); -#ifdef _OLD_STREAMS - tf.remove(); -#else - tf.close(); - unlink((char*)tempfile); -#endif - assert(!tf.is_open()); -} - -void t5() -{ - record r; - int i; - cout << "\nMaking SFile rf..."; -#ifdef _OLD_STREAMS - SFile rf("recfile", sizeof(record), io_readwrite, a_create); -#else - SFile rf("recfile", sizeof(record), ios::in|ios::out|ios::trunc); -#endif - assert(rf.good()); - assert(rf.is_open()); - assert(rf.writable()); - assert(rf.readable()); - for (i = 0; i < 10; ++i) - { - r.c = i + 'a'; - r.i = i; - r.d = (double)(i) / 1000.0; - rf.put(&r); - } - assert(rf.good()); - cout << "odd elements of file in reverse order:\n"; - for (i = 9; i >= 0; i -= 2) - { - rf[i].get(&r); - assert(r.c == i + 'a'); - assert(r.i == i); - cout << r << "\n"; - } - assert(rf.good()); -#ifdef _OLD_STREAMS - rf.remove(); -#else - rf.close(); - unlink("recfile"); -#endif - assert(!rf.is_open()); -} - -void t6() -{ - cout << "\nMaking PlotFile pf ..."; - static const char plot_name[] = "plot.out"; - PlotFile pf(plot_name); - assert(pf.good()); - assert(pf.is_open()); - assert(pf.writable()); - assert(!pf.readable()); - pf.move(10,10); - pf.label("Test"); - pf.circle(300,300,200); - pf.line(100, 100, 500, 500); - assert(pf.good()); -#ifdef _OLD_STREAMS - cout << "(You may delete or attempt to plot " << pf.name() << ")\n"; -#else - cout << "(You may delete or attempt to plot " << plot_name << ")\n"; -#endif -} - -void t7() -{ - char ch; - static char t7_line1[] = "This is a string-based stream.\n"; - static char t7_line2[] = "With two lines.\n"; - char mybuf[60]; - char *bufp; -#ifdef _OLD_STREAMS - cout << "creating string-based ostream...\n"; - ostream strout(60, mybuf); -#else - cout << "creating ostrstream...\n"; - ostrstream strout(mybuf, 60); -#endif - assert(strout.good()); - assert(strout.writable()); - strout << t7_line1 << t7_line2 << ends; - assert(strout.good()); - cout << "with contents:\n"; - bufp = strout.str(); - assert(bufp == mybuf); - strout.rdbuf()->freeze(0); /* Should be a no-op */ - cout << mybuf; -#ifdef _OLD_STREAMS - cout << "using it to create string-based istream...\n"; - istream strin(strlen(mybuf), mybuf); -#else - cout << "using it to create istrstream...\n"; - istrstream strin(mybuf, strlen(mybuf)); -#endif - assert(strin.good()); - assert(strin.readable()); - cout << "with contents:\n"; -#ifndef _OLD_STREAMS - char line[100]; - strin.getline(line, 100); - int line1_len = strlen(t7_line1); - assert(strin.tellg() == line1_len); - int line_len = strin.gcount(); - assert(line_len == line1_len); - cout.write(line, line1_len - 1); - cout << endl; -#endif - while (strin.get(ch)) cout.put(ch); - - strstream str1; - strstream str2; - str1 << "Testing string-based stream using strstream.\n"; - str1.seekg(0); - for (;;) { - int i = str1.get(); - if (i == EOF) - break; - str2 << (char)i; - } - str2 << ends; - cout << str2.str(); - - // This should make it overflow. - strout << t7_line1; - assert (strout.bad()); -} - -void t8() -{ -#ifdef _OLD_STREAMS - cout << "\nThe following file open should generate error message:"; - cout.flush(); - File ef("shouldnotexist", io_readonly, a_useonly); -#else - ifstream ef("shouldnotexist"); -#endif - assert(!ef.good()); - assert(!ef.is_open()); -} - -void t9() -{ - char ch; - static char ffile_name[] = "ftmp"; - { - cout << "\nMaking filebuf streams fout and fin..."; - filebuf foutbuf; -#ifdef _OLD_STREAMS - foutbuf.open(ffile_name, output); -#else - foutbuf.open(ffile_name, ios::out); -#endif - ostream fout(&foutbuf); - assert(fout.good()); - assert(fout.is_open()); - assert(fout.writable()); - assert(!fout.readable()); - fout << "This file has one line testing output streams.\n"; -#ifdef _OLD_STREAMS - fout.close(); - assert(!fout.is_open()); -#endif - } - filebuf finbuf; -#ifdef _OLD_STREAMS - finbuf.open(ffile_name, input); -#else - finbuf.open(ffile_name, ios::in); -#endif - istream fin(&finbuf); - assert(fin.good()); - assert(fin.is_open()); - assert(!fin.writable()); - assert(fin.readable()); - cout << "contents of file:\n"; - while(fin >> ch) cout << ch; -#ifndef _OLD_STREAMS - cout << '\n'; -#endif - fin.close(); - assert(!fin.is_open()); -} - -void t10() -{ - int fileCnt = 3; - char *file_name_pattern = "ftmp%d"; - char current_file_name[50]; - ifstream inFile; - ofstream outFile; - char c; - int i; - - cout << '\n'; - - // Write some files. - for (i=0; i < fileCnt; i++) { - sprintf(current_file_name, file_name_pattern, i); - outFile.open(current_file_name, ios::out); - - if ( outFile.fail() ) - cerr << "File " << current_file_name - << " can't be opened for output" << endl; - else { - outFile << "This is line 1 of " << current_file_name << '\n'; - outFile << "This is line 2 of " << current_file_name << endl; - outFile.close(); - } - } - - // Now read the files back in, and write then out to cout. - for (i=0; i < fileCnt; i++) { - sprintf(current_file_name, file_name_pattern, i); - inFile.open(current_file_name, ios::in); - - - if ( inFile.fail() ) - cerr << "File " << current_file_name - << " can't be opened for input" << endl; - else { - while ( inFile.get (c)) - cout << c; - cout << endl; - inFile.close(); - } - } -} - -// Test form - -void t11() -{ - int count1, count2; - cout.form("%.2f+%.2f = %4.3e\n%n", 5.5, 6.25, 5.5+6.25, &count1); - char *text = "Previous line has12345"; - char text_length_to_use = strlen(text) - 5; - count2 = cout.rdbuf()->form("%-*.*s%3g characters\n", - text_length_to_use + 1, - text_length_to_use, - text, - (double)(count1-1)); - cout.form("%-*.*s%+d characters\n%n", - text_length_to_use + 1, text_length_to_use, text, - count2-1, &count1); - assert(count1 == 33); -} - -static void -show_int (long val) -{ - cout.setf(ios::showbase); - cout << dec; cout.width (8); cout << val << "(dec) = "; - cout << hex; cout.width (8); cout << (0xFFFF & val) << "(hex) = "; - cout << oct; cout.width (8); - cout << (0xFFFF & val) << "(oct) [showbase on]\n"; - cout.unsetf(ios::showbase); - cout << dec; cout.width (8); cout << val << "(dec) = "; - cout << hex; cout.width (8); cout << (0xFFFF & val) << "(hex) = "; - cout << oct; cout.width (8); - cout << (0xFFFF & val) << "(oct) [showbase off]\n"; -} - -void -t12 () -{ - ios::fmtflags old_flags = cout.setf(ios::showpos); - int fill = cout.fill('_'); - cout.unsetf(ios::uppercase); - cout.setf(ios::internal, ios::adjustfield); - show_int(34567); - show_int(-34567); - cout.setf(ios::right, ios::adjustfield); - show_int(0); - cout.setf(ios::uppercase); - cout.unsetf(ios::showpos); - show_int(34567); - cout.setf(ios::left, ios::adjustfield); - show_int(-34567); - cout.fill(fill); - show_int(0); - cout.setf(old_flags, - ios::adjustfield|ios::basefield - |ios::showbase|ios::showpos|ios::uppercase); -} - -main(int argc, char **argv) -{ - char temp [1024] = "tempfile"; - - if (argc > 1 && strncmp(argv[1], "-b", 2) == 0) { - streambuf *sb = cout.rdbuf(); - streambuf *ret; - int buffer_size = atoi(&argv[1][2]); - if (buffer_size == 0) - ret = sb->setbuf(NULL, 0); - else - ret = sb->setbuf(new char[buffer_size], buffer_size); - if (ret != sb) - cerr << "Warning: cout.rdbuf()->setbuf failed!\n"; - - strncpy (&temp [8], &argv[1][2], 1000); - temp [1008] = '\0'; - } - tempfile = temp; - t1(); - t2(); - t3(); - t4(); - t5(); - t6(); - t7(); - t9(); - t8(); - t10(); - t11(); - t12(); - - cout << "Final names & states:\n"; -#ifdef _OLD_STREAMS - cout << "cin: " << cin.name() << "\t" << cin.rdstate() << "\n"; - cout << "cout: " << cout.name() << "\t" << cout.rdstate() << "\n"; - cout << "cerr: " << cerr.name() << "\t" << cerr.rdstate() << "\n"; -#else - cout << "cin: " << "(stdin)" << "\t" << cin.rdstate() << "\n"; - cout << "cout: " << "(stdout)" << "\t" << cout.rdstate() << "\n"; - cout << "cerr: " << "(stderr)" << "\t" << cerr.rdstate() << "\n"; -#endif - cout << "\nend of test.\n"; -} diff --git a/contrib/libio/tests/tFile.exp b/contrib/libio/tests/tFile.exp deleted file mode 100644 index 154cd24dc0..0000000000 --- a/contrib/libio/tests/tFile.exp +++ /dev/null @@ -1,75 +0,0 @@ -Hello, world via cout -Hello, world via cerr -enter a char:c = "a" -enter three integers (short, int, long):first = 123 via dec = 123 -second = 4567 via form = 4567 = 010727 via cout.form = 4567 = 0x11d7 -third = 89012 via hex = 15bb4 -enter a float then a double:first = 123.456 -second = -0.012 -enter 5 characters separated with spaces:first = 1 -rest = 2 3 4 5 -A 10-character buffer: abcdefghi - -Making streams sout and sin...contents of file: -Thisfilehasonelinetestingoutputstreams. -Making File tf ... first line of file: -This is the first and only line of this file. -next char = 10 -reopening tempfile, appending: Now there is a second line. -First 10 chars via raw system read after reopen for input: -This is th -Contents after raw lseek to pos 5: -is the first and only line of this file. -Now there is a second line. - -Making SFile rf...odd elements of file in reverse order: -(i = 9 c = j d = 0.009) -(i = 7 c = h d = 0.007) -(i = 5 c = f d = 0.005) -(i = 3 c = d d = 0.003) -(i = 1 c = b d = 0.001) - -Making PlotFile pf ...(You may delete or attempt to plot plot.out) -creating ostrstream... -with contents: -This is a string-based stream. -With two lines. -using it to create istrstream... -with contents: -This is a string-based stream. -With two lines. -Testing string-based stream using strstream. - -Making filebuf streams fout and fin...contents of file: -Thisfilehasonelinetestingoutputstreams. - -This is line 1 of ftmp0 -This is line 2 of ftmp0 - -This is line 1 of ftmp1 -This is line 2 of ftmp1 - -This is line 1 of ftmp2 -This is line 2 of ftmp2 - -5.50+6.25 = 1.175e+01 -Previous line has 21 characters -Previous line has +32 characters -+__34567(dec) = 0x__8707(hex) = _0103407(oct) [showbase on] -+__34567(dec) = ____8707(hex) = __103407(oct) [showbase off] --__34567(dec) = 0x__78f9(hex) = __074371(oct) [showbase on] --__34567(dec) = ____78f9(hex) = ___74371(oct) [showbase off] -______+0(dec) = _____0x0(hex) = _______0(oct) [showbase on] -______+0(dec) = _______0(hex) = _______0(oct) [showbase off] -___34567(dec) = __0X8707(hex) = _0103407(oct) [showbase on] -___34567(dec) = ____8707(hex) = __103407(oct) [showbase off] --34567__(dec) = 0X78F9__(hex) = 074371__(oct) [showbase on] --34567__(dec) = 78F9____(hex) = 74371___(oct) [showbase off] -0 (dec) = 0X0 (hex) = 0 (oct) [showbase on] -0 (dec) = 0 (hex) = 0 (oct) [showbase off] -Final names & states: -cin: (stdin) 0 -cout: (stdout) 0 -cerr: (stderr) 0 - -end of test. diff --git a/contrib/libio/tests/tFile.inp b/contrib/libio/tests/tFile.inp deleted file mode 100644 index 5b821ef072..0000000000 --- a/contrib/libio/tests/tFile.inp +++ /dev/null @@ -1,5 +0,0 @@ -a -123 4567 89012 -123.456 -1.2e-2 -1 2 3 4 5 -abcdefghijklmnop diff --git a/contrib/libio/tests/tfformat.c b/contrib/libio/tests/tfformat.c deleted file mode 100644 index 29bac8b6b7..0000000000 --- a/contrib/libio/tests/tfformat.c +++ /dev/null @@ -1,4181 +0,0 @@ -#ifdef TEST_LIBIO -#include -#else -#ifdef __cplusplus -#include -#else -#include -#endif -#endif /* !TEST_LIBIO */ - -/* Tests taken from Cygnus C library. */ - -typedef struct -{ - int line; - double value; - char *result; - char *format_string; -} sprint_double_type; - -sprint_double_type sprint_doubles[] = -{ -__LINE__, 30.3, "< +30.3>", "<%+15.10g>", -__LINE__, 10.0, "<10.00>", "<%5.2f>", - -__LINE__, 1.002121970718271e+05, "100212.19707 ", "%0-15.5f", -__LINE__, -1.002121970718271e+05, "-100212.19707 ", "%0-15.5f", -__LINE__, 1.002121970718271e+05, "000100212.19707", "%015.5f", -__LINE__, -1.002121970718271e+05, "-00100212.19707", "%015.5f", -__LINE__, 1.002121970718271e+05, "+00100212.19707", "%+015.5f", -__LINE__, -1.002121970718271e+05, "-00100212.19707", "%+015.5f", -__LINE__, 1.002121970718271e+05, " 00100212.19707", "% 015.5f", -__LINE__, -1.002121970718271e+05, "-00100212.19707", "% 015.5f", -__LINE__, 1.002121970718271e+05, "+100212.19707 ", "%+-15.5f", -__LINE__, -1.002121970718271e+05, "-100212.19707 ", "%+-15.5f", - -__LINE__, -1.002121970718271e+29, "-1.0E+29", "%.1E", -__LINE__, -1.002126048612756e-02, "-1.002126E-02", "%+#E", -__LINE__, -1.002653755271637e+00, "-1.00265", "%G", -__LINE__, -1.003238744365917e-23, "-0.00", "%4.2f", -__LINE__, -1.005084840877781e-29, " -0", "%4.f", -__LINE__, -1.005362549674427e+01, "-10.0536", "%#g", -__LINE__, -1.005915042991691e-17, "-1.00592E-17", "%G", -__LINE__, -1.007829874228503e-18, "-1.00783e-18", "%.7g", -__LINE__, -1.007829874228503e-18, "-1.007830e-18", "%#.7g", -__LINE__, -1.009390937771849e+15, "-1009390937771848.628657", "%+f", -__LINE__, -1.010679382726182e-29, "-0.0000000", "%.7f", -__LINE__, -1.010691853346650e+13, "-10106918533466.497934", "%+f", -__LINE__, -1.013412912122286e-22, "-1.01E-22", "%.2E", -__LINE__, -1.019269582113858e-25, " -0", "%4.0f", -__LINE__, -1.019886033368556e+24, "-1.019886E+24", "%+.7G", -__LINE__, -1.021037413548719e+02, "-102.103741", "%f", -__LINE__, -1.023833576089065e+26, "-1.023834E+26", "%+E", -__LINE__, -1.024736652408627e+10, "-10247366524.086265", "%+f", -__LINE__, -1.025439198495476e+09, "-1.02544e+09", "%+g", -__LINE__, -1.027080247585776e-04, "-0.0001027", "%6.7f", -__LINE__, -1.028096307262016e+18, "-1.0281E+18", "%3G", -__LINE__, -1.029604290697901e-02, "-0.010296", "%g", -__LINE__, -1.034347730570491e+16, "-10343477305704908.975059", "%+f", -__LINE__, -1.034663325049286e+22, "-1.0E+22", "%#.1E", -__LINE__, -1.034843152721857e-14, " -0", "%6.f", -__LINE__, -1.036082122299529e-29, "-1.04e-29", "%4.3g", -__LINE__, -1.037213662365954e-09, "-1e-09", "%3.e", -__LINE__, -1.038563976775690e-12, "-0.000000", "%f", -__LINE__, -1.040910158681323e-02, "-0.0104091", "%+G", -__LINE__, -1.044680094714482e-20, "-1.04468E-20", "%G", -__LINE__, -1.044990054091126e+24, "-1.044990E+24", "%+E", -__LINE__, -1.045693871096982e+11, "-1.045694e+11", "%+e", -__LINE__, -1.045714133591312e-04, "-0.000104571", "%+#3g", -__LINE__, -1.046215079103016e-15, "-1.04622e-15", "%g", -__LINE__, -1.046285293993789e-18, "-1.04629E-18", "%+4G", -__LINE__, -1.046306092899333e-06, "-0.00", "%0.2f", -__LINE__, -1.047308973649206e-22, "-1.05E-22", "%+1.3G", -__LINE__, -1.047369032507755e+01, "-1.047369E+01", "%E", -__LINE__, -1.048986365562919e-21, "-1.05E-21", "%+.2E", -__LINE__, -1.049530193156793e-17, "-1.04953E-17", "%+G", -__LINE__, -1.050073419263768e+25, "-1.05007e+25", "%g", -__LINE__, -1.051739652002504e-28, "-0.000000", "%+f", -__LINE__, -1.054493420082636e+21, "-1.0545e+21", "%#5.4e", -__LINE__, -1.055867291029098e+18, "-1.05587e+18", "%g", -__LINE__, -1.056514389757866e-16, "-1.05651E-16", "%5.6G", -__LINE__, -1.057180924868704e+15, "-1057180924868704", "%4.f", -__LINE__, -1.058455468395683e-23, "-1.05846e-23", "%g", -__LINE__, -1.062560982393212e+08, "-1.06256e+08", "%g", -__LINE__, -1.063365829241138e-10, "-1.063366e-10", "%+e", -__LINE__, -1.063568908667280e-19, "-1.06357E-19", "%+G", -__LINE__, -1.063734263253492e-13, "-0.000000", "%0f", -__LINE__, -1.064472689765495e-13, "-1E-13", "%4.0G", -__LINE__, -1.067192610000129e-25, "-1.06719E-25", "%G", -__LINE__, -1.068401334996592e-12, "-0.0000000", "%+.7f", -__LINE__, -1.069012628653724e-13, "-1.069013E-13", "%+.7G", -__LINE__, -1.069451976810790e+16, "-10694519768107904.056365", "%f", -__LINE__, -1.069568935323556e+17, "-1.06957e+17", "%g", -__LINE__, -1.071351044854107e-29, "-1.07135e-29", "%g", -__LINE__, -1.072274197526185e-21, "-1E-21", "%1.G", -__LINE__, -1.073875921752995e+23, "-1E+23", "%5.E", -__LINE__, -1.074835151152265e-12, "-1.0748e-12", "%1.5g", -__LINE__, -1.075171047088241e-19, "-1.07517E-19", "%#G", -__LINE__, -1.076258826412760e+22, "-1.076259e+22", "%+e", -__LINE__, -1.076365103160401e+06, "-1.07637E+06", "%+4.6G", -__LINE__, -1.076817750454633e+08, "-1e+08", "%4.g", -__LINE__, -1.078615405755685e-30, "-1e-30", "%4.g", -__LINE__, -1.078629622917468e-25, "-1.078630e-25", "%e", -__LINE__, -1.079352432833170e+11, "-107935243283", "%+2.f", -__LINE__, -1.081431147440215e+16, "-10814311474402147.439378", "%+f", -__LINE__, -1.083042116905339e-16, "-1.083e-16", "%.5g", -__LINE__, -1.085351710708553e-10, "-1.085e-10", "%1.4g", -__LINE__, -1.085796045618276e+07, "-1.085796e+07", "%e", -__LINE__, -1.087398259981007e+22, "-1.0874e+22", "%g", -__LINE__, -1.087986044402224e-11, "-1.087986e-11", "%e", -__LINE__, -1.090451848762709e-02, "-1.090452e-02", "%e", -__LINE__, -1.091463236899737e+11, "-1.091463E+11", "%#E", -__LINE__, -1.091617921737384e-29, "-1.09162e-29", "%3g", -__LINE__, -1.092049328579047e-17, "-1.092049E-17", "%E", -__LINE__, -1.093647615472090e+06, "-1093647.61547", "%6.5f", -__LINE__, -1.094133175602384e-08, "-1.1E-08", "%0.1E", -__LINE__, -1.095397916728214e-23, "-1e-23", "%6.e", -__LINE__, -1.098958790437321e+02, "-109.895879", "%+#f", -__LINE__, -1.100194638181594e-20, "-1.100195e-20", "%e", -__LINE__, -1.102174253534260e+05, "-1.1e+05", "%2.3g", -__LINE__, -1.102890180316350e-12, "-1.10289e-12", "%+g", -__LINE__, -1.105582337418378e+00, "-1.11", "%3.3g", -__LINE__, -1.110515122647056e+04, "-1.E+04", "%#0.G", -__LINE__, -1.111365895262625e-18, "-1e-18", "%0.g", -__LINE__, -1.112010622677495e+04, "-11120.1", "%g", -__LINE__, -1.112580043156699e-23, "-1.11258e-23", "%1g", -__LINE__, -1.112829057091303e+08, "-1.11283e+08", "%+2g", -__LINE__, -1.115019046200472e+18, "-1.1150190e+18", "%+#.7e", -__LINE__, -1.118078332268016e-13, "-1.12E-13", "%1.3G", -__LINE__, -1.119113571963886e+08, "-1.119114e+08", "%e", -__LINE__, -1.120102397563448e-15, "-1.12e-15", "%.4g", -__LINE__, -1.120707480791434e-19, "-1.12071e-19", "%g", -__LINE__, -1.124243676139007e-07, "-0.000000", "%f", -__LINE__, -1.125025214608798e+15, "-1.12503E+15", "%0G", -__LINE__, -1.126074395136447e+06, "-1E+06", "%+.0G", -__LINE__, -1.127203019940870e-06, "-0.000001", "%+#7f", -__LINE__, -1.130577648480677e+01, "-1.130578e+01", "%e", -__LINE__, -1.131469694425240e-11, "-1.13147e-11", "%#0.6g", -__LINE__, -1.132225023239752e+02, "-113.223", "%G", -__LINE__, -1.133702113050128e+20, "-1E+20", "%+3.E", -__LINE__, -1.135529466224404e-13, "-1.13553e-13", "%#g", -__LINE__, -1.137587210063004e+21, "-1e+21", "%.1g", -__LINE__, -1.140765637106361e-21, "-1.1e-21", "%+.1e", -__LINE__, -1.141182595083699e-18, "-0.000000", "%f", -__LINE__, -1.141695709120972e+00, "-1.1417", "%3G", -__LINE__, -1.143199141708028e+18, "-1143199141708027833", "%2.f", -__LINE__, -1.146712902056139e+21, "-1146712902056139071760.298975", "%f", -__LINE__, -1.146837903839073e-02, " -0.0", "%+5.1f", -__LINE__, -1.147363016107446e+10, "-1.14736e+10", "%+7g", -__LINE__, -1.149575523465052e+20, "-114957552346505220697.28140", "%+.5f", -__LINE__, -1.152748955392589e+13, "-1.15275E+13", "%G", -__LINE__, -1.152751106015483e-17, "-1E-17", "%+3.E", -__LINE__, -1.155539139258226e-18, "-1.2e-18", "%+.2g", -__LINE__, -1.157089280563492e+20, "-1.15709e+20", "%g", -__LINE__, -1.161217745859779e+19, "-1.161218E+19", "%E", -__LINE__, -1.162293536734798e+10, "-11622935367.347980", "%f", -__LINE__, -1.162629909468603e+20, "-1.16E+20", "%.3G", -__LINE__, -1.164979155838631e+24, "-1.16498E+24", "%G", -__LINE__, -1.165103052644816e-20, " -1e-20", "%+7.g", -__LINE__, -1.166448459023264e-08, "-0.000000", "%f", -__LINE__, -1.167694506705309e+28, "-1e+28", "%.1g", -__LINE__, -1.169901754818745e-28, "-0.000000", "%+f", -__LINE__, -1.170330336216446e+08, " -1e+08", "%7.g", -__LINE__, -1.170946623214213e-17, "-1.17095E-17", "%G", -__LINE__, -1.174581596799302e+27, "-1.174582e+27", "%+e", -__LINE__, -1.174763473995155e-28, "-1E-28", "%.1G", -__LINE__, -1.175885640508038e-23, "-1E-23", "%+.0E", -__LINE__, -1.177268411775439e-05, "-0.000012", "%#2.6f", -__LINE__, -1.177739669428001e-30, "-1.17774E-30", "%G", -__LINE__, -1.178059639880544e-02, "-0.0117806", "%+.7G", -__LINE__, -1.178793300854446e-13, "-1.2E-13", "%+#0.2G", -__LINE__, -1.179629345138058e-04, "-0.000118", "%0.3g", -__LINE__, -1.180730292213358e-25, "-1.18073e-25", "%g", -__LINE__, -1.180766261654697e+02, "-118.077", "%3g", -__LINE__, -1.181880261069391e-29, "-1.181880e-29", "%+#e", -__LINE__, -1.183752810063514e-09, "-1.18375e-09", "%#g", -__LINE__, -1.184191742443406e-21, "-1.184192e-21", "%e", -__LINE__, -1.184859760488406e-26, "-1.18486E-26", "%G", -__LINE__, -1.187276828720072e-29, "-1.18728E-29", "%G", -__LINE__, -1.187992907205195e-04, "-1.187993E-04", "%E", -__LINE__, -1.190586192763405e-28, "-1.E-28", "%#1.E", -__LINE__, -1.192104053032086e+02, "-119.21", "%G", -__LINE__, -1.192917884333569e+26, "-1.192918E+26", "%E", -__LINE__, -1.195900753509801e+22, "-1.1959e+22", "%g", -__LINE__, -1.196559413116537e-28, "-0.000000", "%6.6f", -__LINE__, -1.197534588732952e+12, "-1.19753e+12", "%#g", -__LINE__, -1.200279514790649e-25, "-0.0000", "%0.4f", -__LINE__, -1.203806667944635e+10, "-1.2038067E+10", "%5.7E", -__LINE__, -1.204344885974736e+07, "-1.204E+07", "%#2.4G", -__LINE__, -1.205668007693083e+00, "-1.20567", "%g", -__LINE__, -1.205898515218947e-11, "-1.2059e-11", "%+g", -__LINE__, -1.206787414909373e-05, "-1.2e-05", "%2.2g", -__LINE__, -1.207905830366447e+15, "-1.207906e+15", "%6.7g", -__LINE__, -1.208067010597729e-17, "-1.208067e-17", "%5e", -__LINE__, -1.210189135822574e+01, "-12", "%+2.0f", -__LINE__, -1.211560695948122e+10, "-1.21156e+10", "%+g", -__LINE__, -1.214003025273234e-18, "-1.214e-18", "%+g", -__LINE__, -1.214096815259005e+17, "-121409681525900459.142520", "%f", -__LINE__, -1.214699041716797e-14, "-1.2147E-14", "%G", -__LINE__, -1.215061611919443e+14, "-121506161191944.306310", "%+#f", -__LINE__, -1.217491221065185e+27, "-1.21749e+27", "%g", -__LINE__, -1.218538401534388e-11, "-1.218538e-11", "%#e", -__LINE__, -1.218810085883466e+16, "-1e+16", "%+.1g", -__LINE__, -1.219422688169801e+08, "-1.219423e+08", "%e", -__LINE__, -1.220473194407651e-14, "-1.2205E-14", "%1.5G", -__LINE__, -1.220824440193375e-02, "-0.012208", "%4f", -__LINE__, -1.221520240637007e+13, "-1.221520E+13", "%1E", -__LINE__, -1.221894719843486e+29, "-1.22189E+29", "%G", -__LINE__, -1.223020108610281e+25, "-1.22302E+25", "%G", -__LINE__, -1.223203206227728e-02, "-0.012232", "%G", -__LINE__, -1.225661737076919e-15, "-1.22566E-15", "%G", -__LINE__, -1.228147221003795e-08, "-1.22815E-08", "%G", -__LINE__, -1.228298534591771e+20, "-1.22830E+20", "%#G", -__LINE__, -1.228469080229780e-02, "-0.012285", "%0f", -__LINE__, -1.229161950699222e-09, "-1e-09", "%0.e", -__LINE__, -1.231294820136559e-17, "-1.231295E-17", "%1.7G", -__LINE__, -1.232588663406698e-21, "-1E-21", "%+0.G", -__LINE__, -1.233381256982191e-26, "-0.000000", "%f", -__LINE__, -1.233435864835578e+14, "-1.23344e+14", "%#g", -__LINE__, -1.237409567806099e-25, "-1.23741E-25", "%#G", -__LINE__, -1.238244697758558e-02, "-1.238245e-02", "%7e", -__LINE__, -1.239393163123284e+26, "-1.23939e+26", "%+g", -__LINE__, -1.240484781756132e-18, "-1E-18", "%4.E", -__LINE__, -1.241420286838750e+23, "-1E+23", "%2.E", -__LINE__, -1.243781122052343e-18, "-1.243781e-18", "%+e", -__LINE__, -1.244421506844779e+07, "-1.244422E+07", "%+6E", -__LINE__, -1.245754054764741e-21, "-1e-21", "%5.0g", -__LINE__, -1.245992228426733e-24, "-0.000000", "%f", -__LINE__, -1.246498277739883e-12, "-0.0000000", "%5.7f", -__LINE__, -1.247130891343776e-18, "-1.24713E-18", "%G", -__LINE__, -1.247309461703025e-03, "-0.0012473", "%#5.5G", -__LINE__, -1.248139162966407e-29, "-1.e-29", "%+#6.g", -__LINE__, -1.249756153623776e+08, "-1.249756e+08", "%e", -__LINE__, -1.250899983565585e-10, "-1.2509e-10", "%5g", -__LINE__, -1.250957368798327e+19, "-1.25096E+19", "%0G", -__LINE__, -1.252630814464822e-02, "-0.012526", "%+f", -__LINE__, -1.253076368257011e-28, "-0.000000", "%f", -__LINE__, -1.254243507039370e+01, "-1.254244e+01", "%e", -__LINE__, -1.257605614492298e-12, "-1.257606E-12", "%6.7G", -__LINE__, -1.258041911573120e+06, "-1258041.911573", "%+f", -__LINE__, -1.261670983426507e-25, "-0.00", "%.2f", -__LINE__, -1.263216883336562e-14, "-1.26322e-14", "%g", -__LINE__, -1.266846944498751e-15, "-1e-15", "%0.g", -__LINE__, -1.266977908502326e+06, "-1266978", "%+1.f", -__LINE__, -1.267006162870084e-23, "-1.267006e-23", "%e", -__LINE__, -1.269144609375931e+01, "-1.269145e+01", "%+e", -__LINE__, -1.269458714257904e+25, "-1.26946E+25", "%G", -__LINE__, -1.276697325772662e-02, "-0.0128", "%7.3G", -__LINE__, -1.278855081807602e+15, "-1278855081807601.87891", "%#0.5f", -__LINE__, -1.278966821639612e+20, "-1.278967E+20", "%3E", -__LINE__, -1.281942705258106e+03, "-1281.94", "%+G", -__LINE__, -1.282331291499203e+14, "-128233129149920.266343", "%+f", -__LINE__, -1.285125739341808e-28, "-1.28513e-28", "%g", -__LINE__, -1.285700693704978e+11, "-1.285701E+11", "%E", -__LINE__, -1.286574096459251e+28, "-1.287E+28", "%6.4G", -__LINE__, -1.287967889247240e+03, "-1287.97", "%G", -__LINE__, -1.288913808801319e-27, "-1.3e-27", "%7.1e", -__LINE__, -1.289147517760377e-18, "-1.289148E-18", "%E", -__LINE__, -1.289355006600107e+23, "-1.28936E+23", "%+G", -__LINE__, -1.291232014623979e+01, "-1.29123E+01", "%+.5E", -__LINE__, -1.293658562875966e-18, "-1.29366e-18", "%+g", -__LINE__, -1.294982911983638e-19, "-1.29498E-19", "%#G", -__LINE__, -1.296123363481695e-13, "-1.296123E-13", "%E", -__LINE__, -1.296632862070602e-20, "-1.29663e-20", "%+g", -__LINE__, -1.297801639022777e+23, "-129780163902277735132884.11777", "%#0.5f", -__LINE__, -1.297886574534611e+16, "-1.297887e+16", "%+e", -__LINE__, -1.300588216308401e+11, "-1.30e+11", "%.2e", -__LINE__, -1.301296100909062e-10, "-1.3013e-10", "%+g", -__LINE__, -1.303144244306468e-07, "-1.303144E-07", "%E", -__LINE__, -1.304096315024042e-20, "-1.3041E-20", "%+G", -__LINE__, -1.304817970675085e+16, "-1.304818E+16", "%+E", -__LINE__, -1.304870304632683e-15, " -1e-15", "%7.g", -__LINE__, -1.305213586757638e-18, "-1.30521e-18", "%g", -__LINE__, -1.306880734910465e-22, "-1.306881E-22", "%E", -__LINE__, -1.308964092631446e-23, "-1.30896e-23", "%g", -__LINE__, -1.312070555198201e+26, "-131207055519820126043839537", "%+7.f", -__LINE__, -1.312511609151056e-30, "-1.312512E-30", "%#E", -__LINE__, -1.313087359008389e-23, "-0.000000", "%+f", -__LINE__, -1.316948423042059e-02, "-1.316948E-02", "%+E", -__LINE__, -1.317080882577385e+29, "-1.317E+29", "%+.4G", -__LINE__, -1.317514598984346e+24, "-1.317515e+24", "%e", -__LINE__, -1.317817551125923e-21, "-1.31782E-21", "%+G", -__LINE__, -1.319603985988120e+29, "-131960398598811989856471882376.354188", "%f", -__LINE__, -1.328850458671907e+06, "-1e+06", "%.0e", -__LINE__, -1.328945346449817e-23, "-1.328945e-23", "%+e", -__LINE__, -1.330146584094221e-08, "-1e-08", "%+5.g", -__LINE__, -1.332609617892115e+00, "-1.33261", "%2.7G", -#ifndef __PCCNECV70__ -__LINE__, -1.332751724965715e+22, "-13327517249657150344432.920974", "%f", -__LINE__, -1.333194379353273e-19, "-0.000000", "%f", -__LINE__, -1.334304387932777e-06, "-1.334304e-06", "%e", -__LINE__, -1.334306581172082e-05, "-1.3e-05", "%+1.2g", -__LINE__, -1.335283510893438e-05, " -1E-05", "%7.G", -__LINE__, -1.337939692108373e+11, "-1.33794e+11", "%+4g", -__LINE__, -1.339117288874809e-03, "-0.001", "%1.3f", -__LINE__, -1.340100588141492e+27, "-1.340101E+27", "%E", -__LINE__, -1.341953272572953e-19, "-0.000000", "%+f", -__LINE__, -1.343058354301620e-02, "-1.343058e-02", "%e", -__LINE__, -1.346662720871543e+22, "-1.34666E+22", "%#G", -__LINE__, -1.354010578652210e-02, "-0.0135401", "%#g", -__LINE__, -1.354066549307666e-12, " -0", "%+6.f", -__LINE__, -1.355284719365947e+21, "-1.35528e+21", "%g", -__LINE__, -1.356326532145087e+29, "-1E+29", "%4.G", -__LINE__, -1.357278618897291e+19, "-13572786188972911780.581398", "%f", -__LINE__, -1.357537331348202e-10, "-0.000", "%+.3f", -__LINE__, -1.360011287595868e-10, "-0.000000", "%f", -__LINE__, -1.360506902899232e+16, "-13605069028992320.", "%#5.f", -__LINE__, -1.361102570277000e+10, "-1.3611E+10", "%G", -__LINE__, -1.362601255900219e+07, "-1.363E+07", "%.4G", -__LINE__, -1.366078182354771e+10, "-1.36608E+10", "%0G", -__LINE__, -1.366667926615127e+08, "-136666792.661513", "%f", -__LINE__, -1.367162823743231e-12, "-0.000000", "%#f", -__LINE__, -1.371523037550709e+09, "-1.37152e+09", "%+g", -__LINE__, -1.374328925986197e-17, "-1.37e-17", "%.2e", -__LINE__, -1.374995603898421e-26, "-1.375e-26", "%+g", -__LINE__, -1.376726539375688e+09, "-1.376727E+09", "%+E", -__LINE__, -1.378351117694958e-13, "-0.000000", "%f", -__LINE__, -1.378514699313619e-14, "-1.378515e-14", "%e", -__LINE__, -1.379347588942324e-23, "-1.4e-23", "%+.1e", -__LINE__, -1.380380583822272e-17, "-0.000000", "%+f", -__LINE__, -1.381658659947406e+19, "-1.38166e+19", "%g", -__LINE__, -1.382775316390237e+29, "-138277531639023653298181670834.3104", "%+#7.4f", -__LINE__, -1.383541138922400e+00, "-1.383541E+00", "%E", -__LINE__, -1.384625301445090e+01, "-13.8", "%+.3g", -__LINE__, -1.386844086284027e-13, "-1.38684E-13", "%+G", -__LINE__, -1.386930516448650e-28, "-1.386931E-28", "%E", -__LINE__, -1.387444896054260e-07, "-1.38744E-07", "%G", -__LINE__, -1.389685107980798e+22, "-1.38969E+22", "%G", -__LINE__, -1.390880300369347e+03, "-1390.880300", "%f", -__LINE__, -1.391423370198150e-17, "-1E-17", "%+2.G", -__LINE__, -1.394441767471218e-09, "-1.394442e-09", "%e", -__LINE__, -1.396275525062527e-20, "-1.39628E-20", "%G", -__LINE__, -1.397045957455157e+24, "-1E+24", "%.0E", -__LINE__, -1.397458546930799e+21, "-1397458546930798526375.383517", "%f", -__LINE__, -1.397584578988941e-14, "-1.39758e-14", "%5g", -__LINE__, -1.397789397300823e+09, "-1.398e+09", "%.4g", -__LINE__, -1.398167472294874e+21, "-1.398167E+21", "%+7E", -__LINE__, -1.398809636136688e-16, "-0.000000", "%+f", -__LINE__, -1.399545335304119e+26, "-139954533530411872277454676.805064", "%#5f", -__LINE__, -1.400102603335755e+20, "-140010260333575509150.705329", "%2f", -__LINE__, -1.401212746235235e+04, "-1.401213e+04", "%e", -__LINE__, -1.404409427681801e+07, "-1E+07", "%4.E", -__LINE__, -1.406018114263948e-25, "-1e-25", "%3.e", -__LINE__, -1.406245608096877e-06, "-1.4e-06", "%+.1e", -__LINE__, -1.410697254683835e-10, "-1.410697e-10", "%e", -__LINE__, -1.410739097553846e+25, "-1.410739E+25", "%+E", -__LINE__, -1.410850631189577e+04, "-14108.5", "%.6g", -__LINE__, -1.411680434455781e+28, "-14116804344557807304738616949.180141", "%f", -__LINE__, -1.413309465660099e-27, "-1.413309E-27", "%+#E", -__LINE__, -1.418468741386300e+09, "-1418468741.386300", "%f", -__LINE__, -1.420277110892909e+06, "-1.42028e+06", "%1g", -__LINE__, -1.420417889565590e-17, "-1.42E-17", "%.2E", -__LINE__, -1.421098212056305e+08, "-1.421098e+08", "%4e", -__LINE__, -1.421792812798986e-20, " -1E-20", "%7.G", -__LINE__, -1.423675488122461e+18, "-1423675488122461363.360571", "%f", -__LINE__, -1.423810545840653e+15, "-1E+15", "%3.E", -__LINE__, -1.424242673476368e-15, "-1.424243e-15", "%e", -__LINE__, -1.427847435688733e-01, "-1.427847E-01", "%E", -__LINE__, -1.433897734612555e-04, "-0.0001", "%3.g", -__LINE__, -1.434537754075696e-24, "-1.435E-24", "%+0.3E", -__LINE__, -1.434774864809324e-24, "-1E-24", "%2.E", -__LINE__, -1.435583851565142e-11, "-1E-11", "%.0E", -__LINE__, -1.438791024010112e+11, "-1.43879e+11", "%#.6g", -__LINE__, -1.439267565343777e+27, "-1.4e+27", "%2.1e", -__LINE__, -1.439440602670449e+02, "-143.944", "%G", -__LINE__, -1.439494412124925e+13, "-14394944121249.251268", "%f", -__LINE__, -1.440032823245152e+10, "-14400328232.451516", "%f", -__LINE__, -1.440174494009562e-08, "-0.000000", "%7f", -__LINE__, -1.440827804010568e+07, "-1.E+07", "%#6.1G", -__LINE__, -1.442760907195336e+09, "-1.44276E+09", "%+5G", -__LINE__, -1.444655304181403e+10, "-14446553041.814035", "%7f", -__LINE__, -1.444995766787036e+04, "-14450", "%5G", -__LINE__, -1.445078682874535e-13, "-1E-13", "%3.E", -__LINE__, -1.446781469662328e+01, "-14.4678", "%G", -__LINE__, -1.447795251395321e-04, "-0.000145", "%+f", -__LINE__, -1.448193079247108e-02, "-0.014", "%4.2G", -__LINE__, -1.449552967961345e+14, "-1E+14", "%1.E", -__LINE__, -1.451269763513571e+10, "-14512697635.135705", "%6f", -__LINE__, -1.451843176990292e+12, "-1e+12", "%1.g", -__LINE__, -1.452631405935931e+06, "-1.452631e+06", "%e", -__LINE__, -1.452753650285897e+21, "-1452753650285897091265.496783", "%5f", -__LINE__, -1.453811512433860e-05, "-1e-05", "%+6.g", -__LINE__, -1.454071430557372e+13, "-1.4541E+13", "%.4E", -__LINE__, -1.455956079562999e+03, "-1455.96", "%G", -__LINE__, -1.459712196146602e-17, "-1.45971e-17", "%g", -__LINE__, -1.461857733495947e-02, "-1.4619E-02", "%.4E", -__LINE__, -1.465257069090911e-11, "-1.465257E-11", "%+E", -__LINE__, -1.465306607257042e+05, "-146531", "%g", -__LINE__, -1.465857076315921e+20, "-1.46586E+20", "%+G", -__LINE__, -1.467919792051489e+16, "-1.46792e+16", "%2g", -__LINE__, -1.469271519834567e+20, "-146927151983456720785", "%+.0f", -__LINE__, -1.472961447442697e-28, "-1.47296e-28", "%#g", -__LINE__, -1.473385695190456e-12, "-1.473386E-12", "%E", -__LINE__, -1.485003089033267e-10, "-1.485E-10", "%2G", -__LINE__, -1.490541379072390e-18, "-1.490541E-18", "%4E", -__LINE__, -1.490683434793125e+22, "-14906834347931249951102.472551", "%#f", -__LINE__, -1.498356837215425e+20, "-1.49836E+20", "%#G", -__LINE__, -1.498677007818122e+14, "-1.49868E+14", "%+4G", -__LINE__, -1.502143197677119e+23, "-150214319767711934616727.", "%#7.f", -__LINE__, -1.503563770470753e-24, "-1.50356e-24", "%.6g", -__LINE__, -1.504643092793197e-18, "-1.504643e-18", "%+4e", -__LINE__, -1.507017706254022e-13, "-1.50702e-13", "%+g", -__LINE__, -1.507054033750081e-22, "-0.000000", "%f", -__LINE__, -1.508662346022339e+16, "-1.508662E+16", "%#E", -__LINE__, -1.509366882438902e+08, "-2e+08", "%4.g", -__LINE__, -1.511086567087967e+20, "-1.51109e+20", "%g", -__LINE__, -1.514959134622707e-18, "-0.000000", "%+f", -__LINE__, -1.515730120364204e+06, "-2E+06", "%0.G", -__LINE__, -1.516372763118606e-09, "-1.51637e-09", "%g", -__LINE__, -1.520610443546204e+27, "-1.52061e+27", "%g", -__LINE__, -1.522040655642012e+11, "-1.52204E+11", "%+2G", -__LINE__, -1.523772495014966e-24, "-2E-24", "%2.G", -__LINE__, -1.523980825983892e-05, "-0.000", "%2.3f", -__LINE__, -1.526696214603152e-03, "-0.0015267", "%+6.5G", -__LINE__, -1.528680540769583e+00, "-1.5287", "%0.5G", -__LINE__, -1.529951830525433e+08, "-1.529952e+08", "%+e", -__LINE__, -1.533052896559935e+05, "-153305", "%4.0f", -__LINE__, -1.533829640475152e-03, "-0.00153383", "%+#g", -__LINE__, -1.535617804643105e-30, "-1.535618e-30", "%e", -__LINE__, -1.537623698361821e+16, "-15376236983618207.7875719", "%4.7f", -__LINE__, -1.544994895330616e+24, "-1.54499e+24", "%g", -__LINE__, -1.545083356728403e+17, "-1.545083e+17", "%e", -__LINE__, -1.545684535393879e+12, "-1.55E+12", "%3.3G", -__LINE__, -1.545878334099427e+13, "-15458783340994.268762", "%1f", -__LINE__, -1.547697185980564e-18, "-1.5477e-18", "%.6g", -__LINE__, -1.548576527172579e-29, "-1.5E-29", "%2.2G", -__LINE__, -1.549712227835891e+08, "-1.549712e+08", "%#6.7g", -__LINE__, -1.550010819435335e-21, "-1.55001E-21", "%G", -__LINE__, -1.551412476164257e+14, "-1.551412E+14", "%E", -__LINE__, -1.553156638090030e+01, " -2E+01", "%7.G", -__LINE__, -1.553733233064355e-01, "-0.2", "%3.g", -__LINE__, -1.558391111609365e+00, "-1.558391", "%+f", -__LINE__, -1.562004019284766e+15, "-1.562E+15", "%6.5G", -__LINE__, -1.562195733239758e-16, "-0.000000", "%f", -__LINE__, -1.563953339012525e-14, "-1.56395E-14", "%1G", -__LINE__, -1.568317638534983e+18, "-1.56832E+18", "%1G", -__LINE__, -1.568546851135348e+04, "-15685.5", "%+#G", -__LINE__, -1.574297872228857e+18, "-1.574298e+18", "%e", -__LINE__, -1.575696460196291e-21, "-1.5757E-21", "%G", -__LINE__, -1.576324848379791e+25, "-1.57632E+25", "%+G", -__LINE__, -1.577524395140843e+06, "-1.5775E+06", "%.5G", -__LINE__, -1.585122856675091e+12, "-1585122856675.091452", "%f", -__LINE__, -1.586734674395556e-02, "-1.586735E-02", "%E", -__LINE__, -1.592602264315192e+22, "-1.5926E+22", "%G", -__LINE__, -1.594121556700562e+05, "-2E+05", "%+.0G", -__LINE__, -1.598538116193430e+22, "-1.59854e+22", "%+g", -__LINE__, -1.605647463222382e+18, "-1.6056E+18", "%.5G", -__LINE__, -1.610891449201191e+06, "-1.6109E+06", "%#6.4E", -__LINE__, -1.614593168166818e-05, "-1.61459E-05", "%G", -__LINE__, -1.615597722557325e-03, "-0.001616", "%f", -__LINE__, -1.616038022182124e-29, "-1.61604E-29", "%1G", -__LINE__, -1.618380771451625e-28, "-2e-28", "%+1.g", -__LINE__, -1.620287456872150e+10, "-1.620e+10", "%#7.3e", -__LINE__, -1.620469955611903e-29, "-0.000000", "%f", -__LINE__, -1.622580720690927e+20, "-1.622581E+20", "%+#E", -__LINE__, -1.622752500991079e-12, "-1.622753E-12", "%E", -__LINE__, -1.622771933776459e+08, "-1.6228E+08", "%+4.4E", -__LINE__, -1.623894567037391e+09, "-1.623895e+09", "%#e", -__LINE__, -1.624021408185354e-25, "-1.624E-25", "%.5G", -__LINE__, -1.624405320939366e-06, "-1.62441e-06", "%+#g", -__LINE__, -1.631236208958857e-25, "-1.631236e-25", "%#e", -__LINE__, -1.632165969536046e+20, "-1.63217E+20", "%G", -__LINE__, -1.632859596256475e+06, "-1.63286E+06", "%G", -__LINE__, -1.634371961703112e+06, "-1.634372E+06", "%+E", -__LINE__, -1.637230383641845e+24, "-1.63723e+24", "%#g", -__LINE__, -1.638081480475853e+17, "-1.63808e+17", "%+g", -__LINE__, -1.638279690467673e+14, "-163827969046767.325523", "%#f", -__LINE__, -1.640360249548215e-29, "-1.64036e-29", "%+6.6g", -__LINE__, -1.645691728060833e-30, "-1.64569e-30", "%g", -__LINE__, -1.648548965852592e-03, " -0", "%5.f", -__LINE__, -1.650100957771182e+21, "-1650100957771182308420.065965", "%+f", -__LINE__, -1.650957176011913e-02, "-0.016510", "%#4.5G", -__LINE__, -1.651165108095301e+29, "-165116510809530137038336761179.380119", "%f", -__LINE__, -1.657132845094847e-06, "-0.000002", "%f", -__LINE__, -1.657152146172541e+12, "-1.657152E+12", "%.7G", -__LINE__, -1.658377345516132e-06, "-0.00", "%.2f", -__LINE__, -1.658850468902324e+20, "-1.659e+20", "%.4g", -__LINE__, -1.661723557149830e+18, "-1.66172E+18", "%G", -__LINE__, -1.663570885140273e+14, "-166357088514027", "%2.f", -__LINE__, -1.665186944896906e+25, "-1.66519E+25", "%G", -__LINE__, -1.675910137717036e+22, "-2e+22", "%5.g", -__LINE__, -1.677447987675587e-15, "-1.67745E-15", "%G", -__LINE__, -1.677510590697220e+06, "-1677510.590697", "%5f", -__LINE__, -1.677658141289510e-18, "-2E-18", "%+5.G", -__LINE__, -1.678316848066192e-03, "-1.678317E-03", "%E", -__LINE__, -1.681506404024821e+24, "-1.68151E+24", "%G", -__LINE__, -1.688584243722160e+12, "-1.68858E+12", "%+#G", -__LINE__, -1.689468295411408e+28, "-1.68947E+28", "%+G", -__LINE__, -1.690746767470207e-11, "-1.69075E-11", "%G", -__LINE__, -1.692773960755248e-14, "-2E-14", "%4.E", -__LINE__, -1.693349092740995e-18, "-1.69335e-18", "%g", -__LINE__, -1.693642321808920e-26, "-1.69364E-26", "%G", -__LINE__, -1.694579128700042e-12, "-0.000000", "%f", -__LINE__, -1.695454897264717e-08, "-1.7E-08", "%+4.3G", -__LINE__, -1.695733278397589e+19, "-1.695733e+19", "%4e", -__LINE__, -1.699522534409388e-05, "-1.69952E-05", "%G", -__LINE__, -1.701752039544919e+00, "-2", "%.0f", -__LINE__, -1.702304998615036e+16, "-1.7023E+16", "%1G", -__LINE__, -1.703113580904556e-25, "-1.703114e-25", "%+e", -__LINE__, -1.705165515454546e+29, "-1.705166e+29", "%+e", -__LINE__, -1.707392568277288e-05, "-1.70739E-05", "%G", -__LINE__, -1.707477319256742e+09, "-1707477319.26", "%7.2f", -__LINE__, -1.709669107513969e-03, " -0.002", "%7.g", -__LINE__, -1.713284011412432e-24, "-1.713e-24", "%3.3e", -__LINE__, -1.715512203951086e-28, "-1.715512E-28", "%E", -__LINE__, -1.716880832248879e+13, "-1.71688e+13", "%+g", -__LINE__, -1.720722835740680e-15, "-1.7E-15", "%.1E", -__LINE__, -1.721855769574895e+07, "-17218557.695749", "%3f", -__LINE__, -1.722449437415368e+01, "-1.722449e+01", "%e", -__LINE__, -1.723218805116591e-29, "-2e-29", "%.0g", -__LINE__, -1.726129004920195e-05, "-1.72613E-05", "%0G", -__LINE__, -1.727400228037571e-28, "-0.0000000", "%2.7f", -__LINE__, -1.730008745782339e-23, "-1.73e-23", "%.4g", -__LINE__, -1.731875670201859e+09, "-1.73188E+09", "%G", -__LINE__, -1.732142976428085e+10, "-2E+10", "%+6.0E", -__LINE__, -1.732699651229194e-02, "-0.017327", "%5g", -__LINE__, -1.734772870736446e-12, "-0.000000", "%+f", -__LINE__, -1.738576887938331e+09, "-1.73858e+09", "%g", -__LINE__, -1.738759937912438e-08, "-1.73876e-08", "%+2g", -__LINE__, -1.739320154069143e-18, "-0.0000", "%1.4f", -__LINE__, -1.739870415800800e+16, "-1.73987e+16", "%g", -__LINE__, -1.741290506928618e+04, "-17412.9", "%G", -__LINE__, -1.742520800031913e+29, "-1.742521e+29", "%7e", -__LINE__, -1.747620095195231e+01, "-2e+01", "%+2.g", -__LINE__, -1.749860675924882e-21, "-1.74986E-21", "%G", -__LINE__, -1.752675363661431e-06, "-1.7527E-06", "%.5G", -__LINE__, -1.752871508059699e-06, " -0", "%7.f", -__LINE__, -1.755178530989839e+25, "-1.7551785e+25", "%1.7e", -__LINE__, -1.755566213249512e-07, "-1.755566e-07", "%.6e", -__LINE__, -1.756193485005071e-24, "-1.75619E-24", "%+2.6G", -__LINE__, -1.758501410496218e+03, "-1758.501", "%.7G", -__LINE__, -1.758795617219102e+20, "-1.75880E+20", "%#6G", -__LINE__, -1.760538679276709e+03, "-2e+03", "%+1.e", -__LINE__, -1.762660914833003e+27, "-1.76266E+27", "%G", -__LINE__, -1.765122691141907e+19, "-17651226911419071186.1", "%5.1f", -__LINE__, -1.765313277389086e-18, "-2E-18", "%+1.E", -__LINE__, -1.765821717148734e+19, "-1.76582E+19", "%G", -__LINE__, -1.767048687863149e-17, "-1.77E-17", "%+.3G", -__LINE__, -1.768661645451962e+18, "-1.77E+18", "%+.3G", -__LINE__, -1.769753257452233e+01, "-17.6975", "%G", -__LINE__, -1.770945665065531e+28, "-1.770946E+28", "%0.7G", -__LINE__, -1.776713865753894e-09, "-2e-09", "%1.g", -__LINE__, -1.778424845787448e+03, "-1.7784E+03", "%.4E", -__LINE__, -1.779060610701250e+06, "-1.779061E+06", "%E", -__LINE__, -1.781447182110762e-27, "-1.781447E-27", "%E", -__LINE__, -1.782655842123784e-13, "-2.E-13", "%#2.1G", -__LINE__, -1.783071018169166e+16, "-17830710181691664.217851", "%+f", -__LINE__, -1.784665985294415e+25, "-2E+25", "%3.G", -__LINE__, -1.787297600658096e+25, "-2E+25", "%+5.E", -__LINE__, -1.788200250255718e+12, "-1.7882E+12", "%2.4E", -__LINE__, -1.792860730579114e-09, "-1.79286E-09", "%G", -__LINE__, -1.793122797100936e+24, "-1.793123e+24", "%e", -__LINE__, -1.793761706915029e-25, "-0.000000", "%f", -__LINE__, -1.793947567431932e+22, "-1.79395e+22", "%g", -__LINE__, -1.796428035404303e-18, "-1.79643e-18", "%g", -__LINE__, -1.797113144273918e-16, "-1.79711E-16", "%.6G", -__LINE__, -1.798796767828424e-29, "-1.7988E-29", "%G", -__LINE__, -1.805004010633763e-11, "-1.805e-11", "%2.5g", -__LINE__, -1.806936269752338e-26, "-1.80694e-26", "%g", -__LINE__, -1.807122541760172e-10, "-1.80712e-10", "%g", -__LINE__, -1.808295407815630e-06, "-1.8083E-06", "%+G", -__LINE__, -1.813893236685959e+15, "-1813893236685959", "%0.f", -__LINE__, -1.816201530145367e+06, "-1816202", "%+2.f", -__LINE__, -1.822811219123512e+13, "-1.82281e+13", "%g", -__LINE__, -1.826276499170243e-25, "-2E-25", "%+3.G", -__LINE__, -1.832399287433839e-26, "-1.832399E-26", "%#4E", -__LINE__, -1.833597815584463e-18, "-0.000000", "%+3f", -__LINE__, -1.834165532712233e+28, "-1.834166E+28", "%.7G", -__LINE__, -1.837633147831083e+28, "-1.8376331e+28", "%.7e", -__LINE__, -1.839756716742518e-01, "-0.2", "%+0.G", -__LINE__, -1.840101206950368e-14, "-1.840101E-14", "%+E", -__LINE__, -1.842043645474877e+17, "-1.84204e+17", "%+g", -__LINE__, -1.842155892969934e+17, "-1.84216e+17", "%+g", -__LINE__, -1.843566073012842e-25, "-1.84357E-25", "%G", -__LINE__, -1.843976321320497e-02, "-0.02", "%+4.2f", -__LINE__, -1.845299931651554e+11, "-1.8453E+11", "%0.4E", -__LINE__, -1.846199038659889e-06, "-1.8462e-06", "%0.5g", -__LINE__, -1.847062180184169e-30, "-1.847062E-30", "%5E", -__LINE__, -1.847962158722201e-16, "-0.000000", "%f", -__LINE__, -1.849446376756582e+15, "-1.8E+15", "%2.2G", -__LINE__, -1.853168465523878e-24, "-2E-24", "%1.E", -__LINE__, -1.853601367230139e+10, "-1.853601e+10", "%e", -__LINE__, -1.857367903775364e+18, "-1.86E+18", "%1.3G", -__LINE__, -1.858332820633906e-05, "-0.000019", "%7f", -__LINE__, -1.860243811657223e-23, "-1.860244e-23", "%e", -__LINE__, -1.860660612539794e+08, "-1.86066e+08", "%+6.5e", -__LINE__, -1.861160816251124e-09, "-2E-09", "%1.G", -__LINE__, -1.862380636974688e-25, "-1.9E-25", "%.2G", -__LINE__, -1.864168808453004e+15, "-1.86417E+15", "%G", -__LINE__, -1.864273144411246e+07, "-1.86427e+07", "%g", -__LINE__, -1.864929236615802e-02, "-2e-02", "%+3.e", -__LINE__, -1.865010503480847e+19, "-2E+19", "%4.G", -__LINE__, -1.866276374553144e+22, "-1.866276e+22", "%e", -__LINE__, -1.870809567910649e+09, "-1.870810e+09", "%e", -__LINE__, -1.872555495839008e-13, "-1.872555E-13", "%3E", -__LINE__, -1.874465717110388e-22, "-1.874466E-22", "%E", -__LINE__, -1.874916306627632e+21, "-1874916306627632422987.517202", "%f", -__LINE__, -1.875804322194491e-23, "-0.000000", "%+f", -__LINE__, -1.876662099198587e-04, "-0.000187666", "%G", -__LINE__, -1.876775504795760e-25, "-1.87678e-25", "%0g", -__LINE__, -1.879343051002554e-20, " -0.", "%#6.f", -__LINE__, -1.881535445774717e-15, "-1.881535e-15", "%e", -__LINE__, -1.887515901404300e+00, "-1.888", "%2.4G", -__LINE__, -1.887730637149009e+17, "-1.887731E+17", "%E", -__LINE__, -1.889920303480086e+17, "-1.889920e+17", "%+e", -__LINE__, -1.891903478784091e+04, "-1.891903e+04", "%e", -__LINE__, -1.893550084305833e+16, "-1.89355e+16", "%g", -__LINE__, -1.894675230197676e+05, "-1.894675e+05", "%#e", -__LINE__, -1.898389624953187e-27, "-1.898390e-27", "%+e", -__LINE__, -1.899250044644046e+21, "-1899250044644046120367.875119", "%+4.6f", -__LINE__, -1.904187609804679e-02, "-1.90419E-02", "%0.5E", -__LINE__, -1.904452538421193e-04, "-2e-04", "%4.0e", -__LINE__, -1.904615326969061e-16, "-1.904615e-16", "%1.7g", -__LINE__, -1.907761255064750e+02, "-190.776126", "%f", -__LINE__, -1.910727641826707e-10, " -2e-10", "%7.g", -__LINE__, -1.913149279262051e+15, "-1.913149e+15", "%.7g", -__LINE__, -1.913235739298009e+28, "-1.913236e+28", "%e", -__LINE__, -1.913526822735271e+18, "-1.914e+18", "%.4g", -__LINE__, -1.913780977515583e+17, "-191378097751558335.9150", "%5.4f", -__LINE__, -1.917095456962182e-10, "-2E-10", "%4.G", -__LINE__, -1.918803033972851e+23, "-191880303397285132405158.947222", "%f", -__LINE__, -1.926420984801848e+16, "-19264209848018483.128840", "%+f", -__LINE__, -1.931905465942639e-10, "-1.93191e-10", "%g", -__LINE__, -1.932907105840252e+06, "-1.932907e+06", "%+#e", -__LINE__, -1.933091601918916e+15, "-1.933092E+15", "%#E", -__LINE__, -1.934296184983361e+09, "-1.9343e+09", "%1.6g", -__LINE__, -1.934637311832448e+11, "-1.93464e+11", "%+g", -__LINE__, -1.936201483262186e+12, "-2e+12", "%+6.g", -__LINE__, -1.939114661603911e+19, "-1.93911E+19", "%G", -__LINE__, -1.940478182124347e-13, "-0.000000", "%f", -__LINE__, -1.943218220654923e+08, "-2E+08", "%+5.0G", -__LINE__, -1.943526872455779e-30, "-1.9E-30", "%.1E", -__LINE__, -1.949869164681357e+19, "-1.949869e+19", "%#3e", -__LINE__, -1.954181060535402e+23, "-1.954181e+23", "%e", -__LINE__, -1.961581555579142e+14, "-1.962E+14", "%.3E", -__LINE__, -1.964535562036915e+07, "-1.96454E+07", "%G", -__LINE__, -1.969749653575926e+04, "-19697.5", "%.6g", -__LINE__, -1.973475369169053e+15, "-1.97348e+15", "%g", -__LINE__, -1.975658532866600e-21, "-2e-21", "%+1.2g", -__LINE__, -1.984050343831260e+09, "-1.984050E+09", "%E", -__LINE__, -1.984422410018571e+12, "-1.984422e+12", "%+4.7g", -__LINE__, -1.984878687667223e-22, "-0.000000", "%f", -__LINE__, -1.986116930967811e-28, "-1.98612e-28", "%g", -__LINE__, -1.986774457812683e+02, "-1.986774e+02", "%e", -__LINE__, -1.987274814938726e-04, "-0.000198727", "%g", -__LINE__, -1.987319200580415e+10, "-1.987319E+10", "%E", -__LINE__, -1.987980768698114e-19, "-0.000000", "%3f", -__LINE__, -1.994698965044602e-29, "-2E-29", "%+4.0G", -__LINE__, -1.997833122667050e+26, "-1.99783E+26", "%G", -__LINE__, -1.999453681184129e-10, "-0.00000", "%.5f", -__LINE__, -1.999897345839745e-16, "-1.9999e-16", "%g", -__LINE__, -2.003703825123989e-22, "-0.000000", "%f", -__LINE__, -2.004569188274957e-23, "-2.00457E-23", "%G", -__LINE__, -2.005911883189058e+07, "-2.00591E+07", "%G", -__LINE__, -2.006438312005722e-25, "-2.006e-25", "%0.4g", -__LINE__, -2.017322171210280e+18, "-2.01732E+18", "%+0G", -__LINE__, -2.017718635819594e-06, "-2.01772e-06", "%5g", -__LINE__, -2.019187445568160e-12, "-0.00", "%.2f", -__LINE__, -2.021022665608503e+25, "-20210226656085028551501636.684", "%2.3f", -__LINE__, -2.022720393474145e+07, "-2.02272E+07", "%#G", -__LINE__, -2.024506694471065e+23, "-2.02451E+23", "%G", -__LINE__, -2.024884686553821e-15, " -2e-15", "%7.g", -__LINE__, -2.027484636128966e-23, "-2.0275E-23", "%.5G", -__LINE__, -2.028185530467237e+21, "-2028185530467237374097.067", "%+4.3f", -__LINE__, -2.028388905566873e-09, "-0.000000", "%f", -__LINE__, -2.029856507431584e-17, "-2.02986E-17", "%G", -__LINE__, -2.029891733449167e+27, "-2029891733449166846270372843.7190875", "%3.7f", -__LINE__, -2.031933616694469e+14, "-2.031934E+14", "%#E", -__LINE__, -2.034011738471413e-10, "-2.03401E-10", "%#G", -__LINE__, -2.036087355975756e+29, "-203608735597575574161055556032.806635", "%+f", -__LINE__, -2.036355025137273e+09, "-2.036355E+09", "%#.7G", -__LINE__, -2.038423730536878e+12, "-2E+12", "%4.G", -__LINE__, -2.045209202278810e+23, "-2.045209e+23", "%+#e", -__LINE__, -2.046794083517423e-06, "-2.04679e-06", "%g", -__LINE__, -2.048042459678599e-19, "-0.000000", "%f", -__LINE__, -2.050526462096153e+18, "-2.05053e+18", "%+g", -__LINE__, -2.053583900249402e+13, "-2.053584e+13", "%0.7g", -__LINE__, -2.054342100957522e-23, "-2.05434E-23", "%#G", -__LINE__, -2.054793400141025e+11, "-205479340014.1", "%+2.1f", -__LINE__, -2.059200689196498e-11, "-0.000000", "%#f", -__LINE__, -2.060960692728114e-16, "-0.000000", "%+f", -__LINE__, -2.061417528654300e-30, "-2.06E-30", "%.3G", -__LINE__, -2.061513401198340e-29, "-2.06151e-29", "%7g", -__LINE__, -2.061846698845984e+27, "-2.061847E+27", "%E", -__LINE__, -2.063922242876789e-19, "-2.06392e-19", "%#g", -__LINE__, -2.065359431805529e+03, "-2065.359432", "%f", -__LINE__, -2.065529069992156e-04, "-0.000206553", "%+G", -__LINE__, -2.066082546490980e-25, "-2.06608e-25", "%5g", -__LINE__, -2.068394312095200e+17, "-2.068394e+17", "%e", -__LINE__, -2.071024178556425e-10, "-2.07102E-10", "%G", -__LINE__, -2.074401605950382e-22, "-2.07e-22", "%1.3g", -__LINE__, -2.074731895144874e-26, "-2.07473E-26", "%G", -__LINE__, -2.074895800882730e+18, "-2074895800882730068.082083", "%+f", -__LINE__, -2.077336220500764e-30, "-0", "%2.f", -__LINE__, -2.078067878561077e+09, "-2.0781e+09", "%0.5g", -__LINE__, -2.080497889634533e+15, "-2.080498E+15", "%4E", -__LINE__, -2.084717279367594e-21, "-2.08472e-21", "%+g", -__LINE__, -2.087827915301948e+29, "-2E+29", "%6.1G", -__LINE__, -2.090268686389680e+05, "-2.090269e+05", "%1e", -__LINE__, -2.092036176589720e+24, "-2.09204e+24", "%+g", -__LINE__, -2.093546373938615e-21, "-2.093546e-21", "%#e", -__LINE__, -2.101302069316682e+18, "-2.1013e+18", "%+7g", -__LINE__, -2.103463622286002e-13, "-2.103464E-13", "%E", -__LINE__, -2.105622845016732e+06, "-2105622.845017", "%1f", -__LINE__, -2.109999123037767e+28, "-2.11E+28", "%.2E", -__LINE__, -2.110317013992166e+04, "-21103.2", "%+g", -__LINE__, -2.112226142154618e+21, "-2112226142154617569702.", "%#6.f", -__LINE__, -2.112519484486528e+06, "-2.11252E+06", "%G", -__LINE__, -2.113439260812000e+23, "-2E+23", "%1.G", -__LINE__, -2.113465893194608e-15, "-2.1135E-15", "%.5G", -__LINE__, -2.113547784669409e+20, "-2.1135e+20", "%2.5g", -__LINE__, -2.114146001321822e+28, "-2.114146e+28", "%e", -__LINE__, -2.114509425574444e-30, " -0", "%4.f", -__LINE__, -2.114887421659561e-21, "-0.000000", "%+f", -__LINE__, -2.121120215127601e+21, "-2121120215127601404958.5683097", "%.7f", -__LINE__, -2.122555390665796e+06, "-2E+06", "%0.G", -__LINE__, -2.123468430242052e-27, "-0.000000", "%+f", -__LINE__, -2.123473598890635e+28, "-2.12347e+28", "%+g", -__LINE__, -2.124328049748190e-04, "-2.124328E-04", "%E", -__LINE__, -2.125633890999010e+28, "-2E+28", "%+5.G", -__LINE__, -2.125697963566045e+21, "-2.1257E+21", "%0G", -__LINE__, -2.127638109230109e+06, "-2.12764e+06", "%+6g", -__LINE__, -2.128456114617786e+07, "-2.128456E+07", "%E", -__LINE__, -2.128732742932824e-04, "-2.128733E-04", "%#E", -__LINE__, -2.129654381588404e+27, "-2129654381588404365999167566.7697564", "%+.7f", -__LINE__, -2.129792795009985e+20, "-2.12979e+20", "%g", -__LINE__, -2.131026925664619e-20, "-2e-20", "%.0e", -__LINE__, -2.132860730144188e-04, "-0.0002", "%5.g", -__LINE__, -2.133620979309562e+06, "-2e+06", "%3.e", -__LINE__, -2.133821423139120e-27, "-2.13382E-27", "%.6G", -__LINE__, -2.134253401425940e-07, "-0.000000", "%f", -__LINE__, -2.135469568156964e-29, "-2.135470E-29", "%+7E", -__LINE__, -2.135723595288365e-25, "-0.0", "%.1f", -__LINE__, -2.137642458920094e-09, "-2.13764e-09", "%g", -__LINE__, -2.143412361116583e+12, "-2.14341e+12", "%+g", -__LINE__, -2.144467087741129e-17, "-2.14447e-17", "%+g", -__LINE__, -2.145726966596964e-11, "-0.000000", "%2f", -__LINE__, -2.148318753042597e+08, "-2.14832E+08", "%5G", -__LINE__, -2.149932310549644e-19, "-2.14993e-19", "%g", -__LINE__, -2.150050917377646e-21, " -0", "%3.f", -__LINE__, -2.150854313643430e-16, "-0.000000", "%.6f", -__LINE__, -2.151071797121845e+00, "-2.15107", "%+g", -__LINE__, -2.158728406865981e+14, "-215872840686598.088666", "%7f", -__LINE__, -2.166062878011641e-23, "-2.166063e-23", "%e", -__LINE__, -2.167045002060684e+12, "-2.167045E+12", "%E", -__LINE__, -2.173752581051530e+20, "-217375258105153035259.604621", "%f", -__LINE__, -2.175599129057555e+24, "-2.175599E+24", "%E", -__LINE__, -2.176564454093042e-02, "-0.0217656", "%+G", -__LINE__, -2.181270774327071e-12, "-0.000000", "%#1f", -__LINE__, -2.184404769844158e-09, "-2.2E-09", "%+.2G", -__LINE__, -2.184881476334310e-07, "-2.18488e-07", "%g", -__LINE__, -2.189197211449684e-11, "-2E-11", "%.0G", -__LINE__, -2.189451286805190e+20, "-218945128680519029984", "%3.f", -__LINE__, -2.190642494146884e-27, " -0.", "%#4.f", -__LINE__, -2.194727956725854e+06, "-2.19E+06", "%.3G", -__LINE__, -2.196145868303877e+11, "-219614586830.387726", "%+5f", -__LINE__, -2.196397972262690e-16, "-0.000000", "%3f", -__LINE__, -2.202692843474668e-01, "-2.203e-01", "%.3e", -__LINE__, -2.204528684782451e-21, "-2.20453E-21", "%G", -__LINE__, -2.214926838821340e-16, "-2e-16", "%+2.g", -__LINE__, -2.215558986352773e+18, "-2215558986352773374", "%0.f", -__LINE__, -2.216976693056186e+27, "-2216976693056186498154147557.215765", "%f", -__LINE__, -2.217348422793322e+13, "-2.21735E+13", "%6G", -__LINE__, -2.217732695583920e-07, "-0", "%.0f", -__LINE__, -2.221185494767834e-14, "-2.22119e-14", "%g", -__LINE__, -2.224557193699609e-16, "-2.224557E-16", "%E", -__LINE__, -2.227417758704028e-18, "-0.000000", "%0f", -__LINE__, -2.231261655673006e-30, "-2.231262E-30", "%E", -__LINE__, -2.233081938836160e+21, "-2233081938836160240668.960", "%+6.3f", -__LINE__, -2.233158918439853e+05, "-223316", "%2G", -__LINE__, -2.233802298007898e-30, "-2.2338E-30", "%2G", -__LINE__, -2.233864858404732e+17, "-223386485840473181.241350", "%f", -__LINE__, -2.241242805107749e+14, "-2.24124E+14", "%G", -__LINE__, -2.244555498855249e+25, "-2.24456E+25", "%#G", -__LINE__, -2.248170665127481e-07, "-2.248171E-07", "%E", -__LINE__, -2.252558275567388e-13, "-2.25256e-13", "%g", -__LINE__, -2.256190083496001e+13, "-22561900834960.0136398", "%7.7f", -__LINE__, -2.259851596715945e+27, "-2.259852e+27", "%e", -__LINE__, -2.260461480001174e-21, "-0.000000", "%f", -__LINE__, -2.264128628428577e+22, "-2.26413e+22", "%1g", -__LINE__, -2.265914518399595e-04, "-0.000226591", "%G", -__LINE__, -2.266251557092826e+23, "-2.26625e+23", "%g", -__LINE__, -2.268592252572450e+19, "-2.268592e+19", "%2.6e", -__LINE__, -2.268597523847349e+11, "-2.2686e+11", "%g", -__LINE__, -2.268963106935546e+05, "-226896", "%+g", -__LINE__, -2.272527876808919e-24, "-0.000000", "%#f", -__LINE__, -2.273366440479073e+02, "-227.337", "%g", -__LINE__, -2.277858038556191e+25, "-2.28E+25", "%0.3G", -__LINE__, -2.282019915623415e+25, "-2E+25", "%5.E", -__LINE__, -2.283333247435650e-27, " -0", "%4.f", -__LINE__, -2.285230610829355e+23, "-2E+23", "%2.G", -__LINE__, -2.290900253402985e+23, "-2.2909E+23", "%G", -__LINE__, -2.293266953268186e+08, "-2.29327e+08", "%g", -__LINE__, -2.293489603164786e+23, "-229348960316478578391752.3076525", "%4.7f", -__LINE__, -2.294434667605481e+15, "-2.2944E+15", "%.5G", -__LINE__, -2.296607768466765e+21, "-2.29661E+21", "%G", -__LINE__, -2.297449967994012e+14, "-229744996799401.23542", "%+.5f", -__LINE__, -2.301162556466583e-01, "-0.230116", "%+#2g", -__LINE__, -2.301676246374004e+05, "-230168.", "%#g", -__LINE__, -2.301976724487835e-01, "-0.230198", "%5G", -__LINE__, -2.303269770571222e-15, "-2.303270e-15", "%.6e", -__LINE__, -2.306451480495636e+23, "-2.30645E+23", "%G", -__LINE__, -2.307659351219690e-17, "-0.000000", "%+3f", -__LINE__, -2.309009762339430e+16, "-2.30901E+16", "%G", -__LINE__, -2.309261751862100e+06, "-2309261.751862", "%+f", -__LINE__, -2.309504876918634e-26, " -2E-26", "%7.E", -__LINE__, -2.310910348147804e-26, "-2e-26", "%5.g", -__LINE__, -2.317173552252235e+05, "-231717.4", "%.7g", -__LINE__, -2.319517289618469e-23, "-2.31952E-23", "%+G", -__LINE__, -2.320103195142527e+08, "-2.320103E+08", "%+E", -__LINE__, -2.323523032125633e+24, "-2323523032125633491773442.07419", "%.5f", -__LINE__, -2.326279126614399e-16, "-0.000000", "%f", -__LINE__, -2.331393688620925e-09, "-2.33139e-09", "%#g", -__LINE__, -2.334233527512469e+01, " -23", "%6.0f", -__LINE__, -2.337418834112767e+24, " -2E+24", "%7.E", -__LINE__, -2.339455293612118e+12, "-2339455293612.1", "%+.1f", -__LINE__, -2.341930318143367e-18, "-2.E-18", "%#4.E", -__LINE__, -2.346107614950921e-17, "-0.00000", "%+2.5f", -__LINE__, -2.348356578807972e+23, "-2.34836e+23", "%g", -__LINE__, -2.351485855138244e+19, "-2.351486e+19", "%+e", -__LINE__, -2.362101647639198e-15, "-2.36210e-15", "%#g", -__LINE__, -2.369743873030115e+08, "-2e+08", "%.1g", -__LINE__, -2.371658164739356e+25, "-23716581647393559784120498.079574", "%f", -__LINE__, -2.372427847607163e+28, "-2.37243E+28", "%G", -__LINE__, -2.375465465294647e+11, "-2.375465e+11", "%e", -__LINE__, -2.377128971572195e-18, "-0.0", "%1.1f", -__LINE__, -2.380322448568089e-13, "-2.38032E-13", "%+#0G", -__LINE__, -2.385960728264882e+26, "-2E+26", "%.0E", -__LINE__, -2.387345744004747e+00, "-2.38735", "%G", -__LINE__, -2.390480023300201e+25, "-2.39048e+25", "%g", -__LINE__, -2.395420431930886e+23, "-2E+23", "%2.E", -__LINE__, -2.401144663870969e-10, "-2.e-10", "%#6.g", -__LINE__, -2.402787441215039e-08, "-2.40279e-08", "%g", -__LINE__, -2.402990830425278e+08, "-2.40299E+08", "%G", -__LINE__, -2.404213682932215e+08, "-2.40421e+08", "%2g", -__LINE__, -2.409385592298822e+21, "-2409385592298821876511.283335", "%7f", -__LINE__, -2.410798267658614e+13, "-2.4108e+13", "%+g", -__LINE__, -2.413180068271811e-24, "-0.000000", "%+f", -__LINE__, -2.413268457113495e+26, "-2.41327E+26", "%3.6G", -__LINE__, -2.415341832206007e-13, "-0.000000", "%+f", -__LINE__, -2.422519577068670e-08, "-0.0000000", "%.7f", -__LINE__, -2.422533651282808e+20, "-2.42253E+20", "%#G", -__LINE__, -2.422795006880671e+17, "-2.4228e+17", "%g", -__LINE__, -2.423483330202008e+20, "-2.42348e+20", "%g", -__LINE__, -2.431756009640369e-04, "-0.000243176", "%+#3g", -__LINE__, -2.431878622534173e-05, "-0.000024", "%f", -__LINE__, -2.432012113077180e+24, "-2.43201e+24", "%g", -__LINE__, -2.433843704470487e+07, "-24338437", "%4.f", -__LINE__, -2.435475755031956e+11, "-2.435476E+11", "%1E", -__LINE__, -2.438081888695437e-13, "-0.000000", "%f", -__LINE__, -2.438334590462860e+10, "-2.4E+10", "%5.2G", -__LINE__, -2.440223135334059e+17, "-2.44022e+17", "%g", -__LINE__, -2.444107281115317e-21, "-2.44411e-21", "%+g", -__LINE__, -2.444582273206171e-02, " -0.02", "%7.G", -__LINE__, -2.445234676352794e+23, "-2.44523e+23", "%#g", -__LINE__, -2.449185020984714e+08, "-2.E+08", "%#2.G", -__LINE__, -2.450646640466020e+22, "-2.45065E+22", "%5G", -__LINE__, -2.456840850262473e+13, "-24568408502625", "%0.f", -__LINE__, -2.464466865714499e-10, "-2e-10", "%6.g", -__LINE__, -2.466022088999151e+27, "-2.46602E+27", "%G", -__LINE__, -2.484398113119779e-04, "-2.484398E-04", "%E", -__LINE__, -2.484591850456328e+23, "-248459185045632846566832.085955", "%+f", -__LINE__, -2.488166252162446e-11, "-2.5E-11", "%4.2G", -__LINE__, -2.493507313049390e+24, "-2.49E+24", "%4.3G", -__LINE__, -2.500280281988428e+28, "-2.5E+28", "%.4G", -__LINE__, -2.500373956445372e-07, "-2.50037e-07", "%g", -__LINE__, -2.505566434769299e-12, "-2.5E-12", "%+#0.2G", -__LINE__, -2.508215917020758e+05, "-2.508216e+05", "%5e", -__LINE__, -2.519368094680315e-29, "-2.51937e-29", "%#0g", -__LINE__, -2.522266530587753e-11, "-2.52227e-11", "%+g", -__LINE__, -2.534492886372514e-06, "-2.53449E-06", "%0G", -__LINE__, -2.534617610955074e-02, "-0.03", "%0.2f", -__LINE__, -2.540551642835634e+26, "-3E+26", "%4.G", -__LINE__, -2.548210731830516e-26, "-0.000", "%2.3f", -__LINE__, -2.558868082397931e-11, "-3E-11", "%2.E", -__LINE__, -2.560062512991052e+11, "-2.56006E+11", "%+G", -__LINE__, -2.561274682814428e-05, "-0.000026", "%f", -__LINE__, -2.563424949397357e-02, " -0", "%6.f", -__LINE__, -2.577010939931465e+17, "-2.57701E+17", "%G", -__LINE__, -2.578224879294822e+10, "-3E+10", "%+4.1G", -__LINE__, -2.585655636750244e+13, "-2.585656e+13", "%+0.7g", -__LINE__, -2.585657986834408e+14, "-2.5857e+14", "%3.5g", -__LINE__, -2.586728929368101e+02, "-258.673", "%+g", -__LINE__, -2.591293023229468e+06, "-2591293.0232295", "%2.7f", -__LINE__, -2.592454222603538e-06, "-2.59245E-06", "%G", -__LINE__, -2.599399905869649e+02, "-259.939991", "%f", -__LINE__, -2.605382860307596e+12, "-2.60538E+12", "%2G", -__LINE__, -2.607507689402762e-01, "-0.260751", "%#.6g", -__LINE__, -2.612933252582967e+15, "-2.61293e+15", "%g", -__LINE__, -2.614337505491483e-14, "-2.61434E-14", "%.6G", -__LINE__, -2.618302263333671e+14, "-2.62e+14", "%3.3g", -__LINE__, -2.622998533972296e+00, "-3.", "%#0.g", -__LINE__, -2.623348319869643e-15, "-2.62335E-15", "%#G", -__LINE__, -2.626703132693163e+23, "-3E+23", "%+6.E", -__LINE__, -2.629610853765779e+25, "-2.62961E+25", "%+#G", -__LINE__, -2.632993880472784e+26, "-2.63299E+26", "%G", -__LINE__, -2.635651112327873e-20, "-2.63565E-20", "%1G", -__LINE__, -2.636003980473492e-23, "-2.636E-23", "%G", -__LINE__, -2.639316453244009e+10, "-26393164532.440094", "%#f", -__LINE__, -2.640517223417942e-28, "-2.641e-28", "%.3e", -__LINE__, -2.640625797147664e-22, "-2.640626E-22", "%E", -__LINE__, -2.644401262524378e-12, " -0.000", "%7.3f", -__LINE__, -2.651033203243637e-14, "-2.651033e-14", "%+e", -__LINE__, -2.652386470126594e-24, "-2.652386E-24", "%E", -__LINE__, -2.654281018623631e-12, "-0.00000", "%6.5f", -__LINE__, -2.655529742118827e+02, "-265.552974", "%f", -__LINE__, -2.658550833241620e+22, "-26585508332416196708436.473273", "%+f", -__LINE__, -2.660515890519100e+08, "-2.660516E+08", "%E", -__LINE__, -2.665025749266086e-24, "-2.66503E-24", "%G", -__LINE__, -2.666117105643095e-20, "-2.66612e-20", "%g", -__LINE__, -2.667051347741259e+11, "-3e+11", "%6.g", -__LINE__, -2.667207607243375e+04, "-26672.076072", "%+#f", -__LINE__, -2.667631877167590e+26, "-2.667632E+26", "%E", -__LINE__, -2.673817942962878e+13, "-2.673818e+13", "%+2.6e", -__LINE__, -2.674972907853507e+20, "-2.674973E+20", "%E", -__LINE__, -2.675830887404867e+14, "-2.675831E+14", "%E", -__LINE__, -2.682749918168908e+26, "-2.682750E+26", "%E", -__LINE__, -2.689222801942679e-03, "-0.0027", "%7.2G", -__LINE__, -2.692245629411156e+25, "-2.69225e+25", "%g", -__LINE__, -2.692606702464273e+11, "-2.69261e+11", "%g", -__LINE__, -2.693070822061136e-27, "-2.69307e-27", "%+g", -__LINE__, -2.694415515655336e-30, "-3E-30", "%+3.0E", -__LINE__, -2.694770057384739e+15, "-2.69477e+15", "%g", -__LINE__, -2.699998392329361e+01, "-27", "%+.2g", -__LINE__, -2.700151952281511e+23, "-270015195228151050343968.", "%+#5.f", -__LINE__, -2.707398527302841e-08, "-2.70740e-08", "%+#3g", -__LINE__, -2.711404950850030e-21, "-2.71E-21", "%.2E", -__LINE__, -2.714057739024281e-10, "-2.714e-10", "%.4g", -__LINE__, -2.717657632815414e-10, "-2.71766e-10", "%g", -__LINE__, -2.720875786430592e-09, "-2.7E-09", "%6.2G", -__LINE__, -2.725886730997891e+19, "-2.72589e+19", "%g", -__LINE__, -2.726089169748676e-09, "-2.72609E-09", "%+G", -__LINE__, -2.732907572038661e-30, "-2.73291E-30", "%G", -__LINE__, -2.737918050958789e+11, "-3e+11", "%1.g", -__LINE__, -2.739024251198484e-18, "-2.73902e-18", "%+g", -__LINE__, -2.742646144452305e+13, "-2.74265e+13", "%g", -__LINE__, -2.742911865386719e+06, "-3E+06", "%+5.G", -__LINE__, -2.759159275123811e-30, "-0.000000", "%+f", -__LINE__, -2.759794813930001e-21, "-2.75979e-21", "%+g", -__LINE__, -2.763243077558348e+20, "-2.7632E+20", "%+0.4E", -__LINE__, -2.770348477810209e-14, "-0.000000", "%2f", -__LINE__, -2.776074766292453e+05, "-277607", "%g", -__LINE__, -2.776610811432007e-07, "-2.77661E-07", "%6G", -__LINE__, -2.778673793270678e+23, "-3E+23", "%+4.E", -__LINE__, -2.782405168708350e+08, "-278240516.87084", "%.5f", -__LINE__, -2.783316149365198e-09, "-3E-09", "%5.0G", -__LINE__, -2.785436703085409e-27, "-2.78544E-27", "%#G", -__LINE__, -2.787479051660640e+21, "-2.78748e+21", "%g", -__LINE__, -2.789445406042450e-03, "-0.002789", "%+f", -__LINE__, -2.791104581836077e+05, "-279110.4581836", "%+7.7f", -__LINE__, -2.802078617775784e+04, "-28020.786", "%0.3f", -__LINE__, -2.804954315579055e+20, "-2.80495E+20", "%G", -__LINE__, -2.806575341862696e-05, "-2.80658E-05", "%G", -__LINE__, -2.807769556900402e-06, "-0.000003", "%+#f", -__LINE__, -2.808882056357941e-12, "-0.0", "%.1f", -__LINE__, -2.809386677339924e+10, "-2.8094E+10", "%6.5G", -__LINE__, -2.818404311437694e+19, "-3E+19", "%6.G", -__LINE__, -2.819463285551660e+01, "-28.1946", "%+G", -__LINE__, -2.821428853207724e-16, "-3e-16", "%6.g", -__LINE__, -2.824452750788444e+07, "-3e+07", "%+2.g", -__LINE__, -2.825430381094971e+28, "-3e+28", "%+.0e", -__LINE__, -2.830010928384944e-17, "-0", "%.0f", -__LINE__, -2.832505114479680e-09, "-0.000000", "%f", -__LINE__, -2.833246604950796e+13, "-2.83325E+13", "%G", -__LINE__, -2.833274073265017e+13, "-28332740732650.174564", "%f", -__LINE__, -2.835842581787797e+07, "-2.83584E+07", "%2G", -__LINE__, -2.839758384681983e-07, "-2.83976E-07", "%.6G", -__LINE__, -2.841077022753766e-09, "-3E-09", "%0.1G", -__LINE__, -2.845307294930682e+00, "-2.845307e+00", "%+1e", -__LINE__, -2.847420163874243e+19, "-2.8e+19", "%1.2g", -__LINE__, -2.848133715109881e-25, "-2.848134E-25", "%E", -__LINE__, -2.850208101288058e-06, "-2.8502E-06", "%+5.4E", -__LINE__, -2.853666525870413e+04, "-28536.665259", "%f", -__LINE__, -2.855661543202034e+21, "-2.85566e+21", "%g", -__LINE__, -2.859528889324159e-08, "-2.859529e-08", "%3e", -__LINE__, -2.860545310690251e+29, "-3e+29", "%.1g", -__LINE__, -2.863576633666884e-14, "-2.863577e-14", "%+5e", -__LINE__, -2.864115740396321e-14, "-2.86412e-14", "%g", -__LINE__, -2.864481979037153e+20, "-2.86E+20", "%3.3G", -__LINE__, -2.867582970177984e-18, "-0.000000", "%f", -__LINE__, -2.868237707901564e+25, "-3E+25", "%6.E", -__LINE__, -2.871741071402520e+13, "-3e+13", "%.1g", -__LINE__, -2.873724610073364e+18, "-2873724610073364438.278531", "%+#f", -__LINE__, -2.876433859770866e-25, "-2.87643e-25", "%g", -__LINE__, -2.877458587075737e-08, "-2.877E-08", "%+.4G", -__LINE__, -2.883349842927101e+24, "-2.883350E+24", "%2E", -__LINE__, -2.883749925642885e+09, "-2.883750e+09", "%e", -__LINE__, -2.883773835633003e-17, "-0.000000", "%+f", -__LINE__, -2.890389090491409e+24, "-2890389090491409262995148.310438", "%#1f", -__LINE__, -2.900848552225810e-11, "-0.000000", "%+f", -__LINE__, -2.911942123176400e+25, "-29119421231764004431852300", "%0.f", -__LINE__, -2.912904462180751e-18, "-2.9129E-18", "%6G", -__LINE__, -2.917717875075651e+26, "-3e+26", "%0.e", -__LINE__, -2.922293201084093e-26, "-2.922293E-26", "%E", -__LINE__, -2.925070319932451e-30, "-0.000000", "%f", -__LINE__, -2.926558572870874e+15, "-2.926559E+15", "%E", -__LINE__, -2.928781435877896e+26, "-2.928781e+26", "%+e", -__LINE__, -2.930178318110376e+28, "-2.930178E+28", "%E", -__LINE__, -2.930984661925819e+05, "-293098.5", "%.7G", -__LINE__, -2.932762424932762e-08, "-0.000000", "%#f", -__LINE__, -2.933415597492494e+10, "-29334155974.924943", "%+#2f", -__LINE__, -2.933564314850986e+29, "-2.93356E+29", "%7G", -__LINE__, -2.943224907893795e+10, "-2.943225E+10", "%+7E", -__LINE__, -2.945311540471221e+19, "-2.94531E+19", "%#G", -__LINE__, -2.945812356522847e+15, "-2.94581e+15", "%+g", -__LINE__, -2.945836999630957e+00, "-2.945837E+00", "%E", -__LINE__, -2.947798782726622e-01, "-0.29478", "%+g", -__LINE__, -2.948958405827917e+18, "-2.94896e+18", "%g", -__LINE__, -2.949790871798059e-11, "-2.94979E-11", "%G", -__LINE__, -2.950347806125225e-12, "-2.95035e-12", "%g", -__LINE__, -2.952781884599368e-29, "-2.952782E-29", "%+E", -__LINE__, -2.956801341442716e+06, "-2.9568E+06", "%G", -__LINE__, -2.957469310356540e-07, "-0.000", "%1.3f", -__LINE__, -2.960464869534870e-23, "-2.96046E-23", "%G", -__LINE__, -2.962339381825446e-07, "-0", "%1.f", -__LINE__, -2.971013180028710e+22, "-2.971e+22", "%3.5g", -__LINE__, -2.975167862441254e+07, "-2.97517e+07", "%g", -__LINE__, -2.976018424339993e+16, "-2.976018e+16", "%3e", -__LINE__, -2.979173094835454e+29, "-2.97917E+29", "%G", -__LINE__, -2.983135249987541e-03, "-0.00298314", "%+G", -__LINE__, -2.985142444917919e-24, "-2.985142E-24", "%+#7E", -__LINE__, -2.988680953635159e-14, "-0.0000000", "%2.7f", -__LINE__, -2.989629778079379e+04, "-29896.297781", "%f", -__LINE__, -2.991274275137276e+19, "-29912742751372762839.423558", "%+4f", -__LINE__, -2.991286396006024e-06, "-2.99129e-06", "%4g", -__LINE__, -2.993310397844811e+04, "-2.993310E+04", "%3.6E", -__LINE__, -2.994669852410861e-29, "-2.99467E-29", "%G", -__LINE__, -2.996082093034831e+27, "-2.996082e+27", "%1e", -__LINE__, -2.999783904575110e+16, "-2.999784E+16", "%#E", -__LINE__, -3.012019221956988e+25, "-3.012019E+25", "%E", -__LINE__, -3.014211917706622e-25, "-0.000000", "%+f", -__LINE__, -3.015149723683428e-19, "-3.01515E-19", "%G", -__LINE__, -3.022158478004638e-19, "-3.02216e-19", "%6g", -__LINE__, -3.022825518373900e-12, "-3.0228E-12", "%+.4E", -__LINE__, -3.025108924057340e-19, "-0.000000", "%f", -__LINE__, -3.026316824631967e+24, "-3026316824631966717618070.106255", "%1f", -__LINE__, -3.033074643529623e-13, "-3.03307e-13", "%g", -__LINE__, -3.035292960731141e+24, "-3035292960731141409524980.190326", "%f", -__LINE__, -3.043291272956732e-13, "-3.04329e-13", "%#g", -__LINE__, -3.045216723973715e-23, "-3.045e-23", "%.4g", -__LINE__, -3.047140976048835e+09, "-3.04714E+09", "%3.5E", -__LINE__, -3.047680278470886e+09, "-3.047680E+09", "%#E", -__LINE__, -3.048465807963461e+05, "-304847", "%g", -__LINE__, -3.050904753556756e+22, "-3.0509E+22", "%G", -__LINE__, -3.052845748999047e-13, "-3.05285e-13", "%g", -__LINE__, -3.053395231883620e-06, "-3E-06", "%2.G", -__LINE__, -3.054894203375445e-28, "-3e-28", "%2.g", -__LINE__, -3.055080347760755e-13, "-0", "%2.f", -__LINE__, -3.055513037393624e-29, "-3e-29", "%3.g", -__LINE__, -3.056198778208295e-06, "-3.0562e-06", "%g", -__LINE__, -3.057813660266980e-21, "-3E-21", "%1.G", -__LINE__, -3.059687036330998e-11, "-3.1E-11", "%#2.2G", -__LINE__, -3.061450385559094e-10, "-3.06145E-10", "%G", -__LINE__, -3.066605713361383e-27, "-0.000000", "%f", -__LINE__, -3.071590110813156e+22, "-3.07159E+22", "%G", -__LINE__, -3.073253864426931e+26, "-3.0733E+26", "%.5G", -__LINE__, -3.078998328596940e+07, "-3.079e+07", "%5.4g", -__LINE__, -3.082733887951920e+06, "-3.082734e+06", "%+6e", -__LINE__, -3.084365358064710e+24, "-3.084365E+24", "%#E", -__LINE__, -3.086948022123716e+25, "-30869480221237162176350921.072299", "%+f", -__LINE__, -3.088200214218024e-10, "-0", "%0.f", -__LINE__, -3.093442983942874e+08, "-309344298.394287", "%f", -__LINE__, -3.103573455403534e-09, "-3.103573E-09", "%#E", -__LINE__, -3.109178443120997e+07, "-31091784.431210", "%f", -__LINE__, -3.111494549914917e+28, "-3e+28", "%0.g", -__LINE__, -3.113384020517480e-17, " -0", "%+6.f", -__LINE__, -3.121622779718055e+14, "-312162277971805.491", "%+.3f", -__LINE__, -3.122780443843900e-01, "-0.312278", "%#g", -__LINE__, -3.122952438335638e-25, "-3.122952E-25", "%E", -__LINE__, -3.128970339463168e-18, "-3e-18", "%3.g", -__LINE__, -3.130862507719335e+10, "-3.130863e+10", "%3e", -__LINE__, -3.145960838955379e+03, "-3145.96", "%g", -__LINE__, -3.149362645138929e+21, "-3.14936e+21", "%g", -__LINE__, -3.150697168664913e+26, "-315069716866491322804222363.629378", "%+f", -__LINE__, -3.157946785041287e+05, "-3.1579e+05", "%.4e", -__LINE__, -3.158347006986809e-02, "-3.E-02", "%#.0E", -__LINE__, -3.159542871923388e+07, "-31595429", "%2.f", -__LINE__, -3.169997512351985e+15, "-3.169998E+15", "%6.7G", -__LINE__, -3.170971776544746e+07, "-31709717.765447", "%f", -__LINE__, -3.173246079104466e+19, "-3.173246E+19", "%1E", -__LINE__, -3.173581228658553e-02, "-0.03", "%+0.G", -__LINE__, -3.187598864929850e-07, "-3.18760E-07", "%#G", -__LINE__, -3.190525302270244e+08, "-3.190525e+08", "%+0.7g", -__LINE__, -3.191879884186422e+19, "-3.19E+19", "%.2E", -__LINE__, -3.197292604744926e+02, "-3.197293e+02", "%+e", -__LINE__, -3.203713337688838e-12, "-3.20371E-12", "%6G", -__LINE__, -3.204416889544914e-18, "-0.000000", "%+f", -__LINE__, -3.204494471917096e+09, "-3.20449e+09", "%g", -__LINE__, -3.211933195516720e+11, "-3.21193E+11", "%G", -__LINE__, -3.214544021431917e-24, "-0.000000", "%1f", -__LINE__, -3.215501229487004e-07, "-3e-07", "%3.e", -__LINE__, -3.232157492322707e-13, "-3.E-13", "%+#5.G", -__LINE__, -3.239074974455177e-05, "-3.239e-05", "%2.4g", -__LINE__, -3.243083730801156e-24, "-3.243084e-24", "%#e", -__LINE__, -3.243128583394124e+07, "-32431285.8339", "%6.4f", -__LINE__, -3.247997999770571e-08, "-3e-08", "%5.e", -__LINE__, -3.258251054563991e-15, "-3.2583E-15", "%.5G", -__LINE__, -3.259499053187446e+07, "-3.2595E+07", "%5.6G", -__LINE__, -3.261907782031174e+20, "-3.3e+20", "%.2g", -__LINE__, -3.263979380855122e+29, "-3.26398E+29", "%G", -__LINE__, -3.264166546402073e+06, "-3.26417E+06", "%5G", -__LINE__, -3.269357648926951e+01, "-3.E+01", "%#5.G", -__LINE__, -3.273523287028019e-30, "-3.27352e-30", "%g", -__LINE__, -3.274464331526264e-14, "-3e-14", "%.0g", -__LINE__, -3.276647049958546e+05, "-327664.7", "%+.1f", -__LINE__, -3.276853612008326e-04, "-3.276854e-04", "%e", -__LINE__, -3.288077788905925e+17, "-3.28808e+17", "%g", -__LINE__, -3.292054327509010e+21, "-3.29205e+21", "%+g", -__LINE__, -3.292086868337041e-16, " -0", "%7.f", -__LINE__, -3.299368070005327e-17, "-3E-17", "%5.G", -__LINE__, -3.307165537474566e-30, "-3e-30", "%+2.g", -__LINE__, -3.310556325973673e-17, "-3.31056E-17", "%G", -__LINE__, -3.315407318453138e-09, "-3.315407e-09", "%+#.6e", -__LINE__, -3.318402800998018e-09, "-3.3184E-09", "%+G", -__LINE__, -3.324277622889107e-04, "-0.000332428", "%G", -__LINE__, -3.326372457131185e+14, "-3.326372e+14", "%0e", -__LINE__, -3.333300611287597e+18, "-3.3E+18", "%4.2G", -__LINE__, -3.333608976277018e-25, "-3.33361e-25", "%g", -__LINE__, -3.333613056182724e-24, "-3.33361e-24", "%.5e", -__LINE__, -3.338505874378410e-26, "-0.00000", "%.5f", -__LINE__, -3.339838772519661e+24, "-3.3398E+24", "%0.5G", -__LINE__, -3.354802735583258e-27, "-3.3548E-27", "%G", -__LINE__, -3.356542080644329e+15, "-3356542080644329.129058", "%#f", -__LINE__, -3.360027692463026e-29, "-3.36003e-29", "%+g", -__LINE__, -3.361845657814323e+06, "-3361845.657814", "%f", -__LINE__, -3.363135493765816e-12, " -0", "%5.f", -__LINE__, -3.367383112102258e+19, "-33673831121022579360.158034", "%f", -__LINE__, -3.376798505037497e+03, "-3376.8", "%+3G", -__LINE__, -3.388170639372559e+09, "-3.388171e+09", "%+e", -__LINE__, -3.397304185715499e-12, "-3.397304e-12", "%+e", -__LINE__, -3.401559374016378e-13, "-3.40156e-13", "%g", -__LINE__, -3.402651870178825e+21, "-3.40265e+21", "%+g", -__LINE__, -3.410491213537530e+12, "-3.41049E+12", "%G", -__LINE__, -3.411695570460075e-01, "-3.411696e-01", "%e", -__LINE__, -3.417311435719220e+29, "-3.4E+29", "%3.1E", -__LINE__, -3.417581063208165e-23, " -0", "%+4.f", -__LINE__, -3.424005615113663e-28, "-0.000000", "%f", -__LINE__, -3.424793585094130e-12, "-0.000000", "%f", -__LINE__, -3.434733077762304e-05, "-3.43473e-05", "%g", -__LINE__, -3.436384988494743e+08, "-3.43638E+08", "%G", -__LINE__, -3.441082995163884e-21, "-0.000000", "%f", -__LINE__, -3.442868661576827e-23, "-3.442869e-23", "%#.7g", -__LINE__, -3.444337521046186e+13, "-3.44434E+13", "%#G", -__LINE__, -3.448230173418967e-28, "-3.44823E-28", "%#G", -__LINE__, -3.448523828225326e-21, "-3.4485e-21", "%.4e", -__LINE__, -3.449876796754720e-07, "-3.44988e-07", "%g", -__LINE__, -3.450163790411588e+25, "-34501637904115876054333966.749255", "%2f", -__LINE__, -3.450224454406567e-26, "-3.450224E-26", "%#1E", -__LINE__, -3.459930768422874e-28, "-3.46E-28", "%2.3G", -__LINE__, -3.460730505022601e-28, "-3.46073e-28", "%#g", -__LINE__, -3.462894265593946e-10, "-3.46289e-10", "%+#g", -__LINE__, -3.464808359229496e+05, "-346481", "%6.6G", -__LINE__, -3.467272303652620e-03, "-0.00346727", "%g", -__LINE__, -3.468252706910251e+10, "-3.5E+10", "%#7.2G", -__LINE__, -3.473623965680253e+27, "-3.47362e+27", "%g", -__LINE__, -3.474527926009729e+11, "-3.475E+11", "%.4G", -__LINE__, -3.476489048299929e+15, "-3.47649e+15", "%g", -__LINE__, -3.477809698895344e-09, "-0.000", "%+.3f", -__LINE__, -3.493008398637667e-28, " -0", "%+4.f", -__LINE__, -3.497441286691613e+07, "-3.49744e+07", "%g", -__LINE__, -3.500904660533358e+00, "-3.500905E+00", "%+1E", -__LINE__, -3.504996054364915e+25, "-3.505e+25", "%+g", -__LINE__, -3.507738629125434e-24, "-0.00", "%+4.2f", -__LINE__, -3.508557770253211e-04, "-3.508558e-04", "%#6e", -__LINE__, -3.516056824437550e+20, "-3.516057e+20", "%#e", -__LINE__, -3.521102917733367e+02, "-352.11", "%g", -__LINE__, -3.523948985825251e+10, "-3.52395e+10", "%+g", -__LINE__, -3.525281835697895e-15, "-3.525282e-15", "%e", -__LINE__, -3.534088845494570e-26, "-0.000000", "%2f", -__LINE__, -3.541002442741569e+01, "-35.410", "%3.3f", -__LINE__, -3.541126630345017e-19, "-3.541127e-19", "%e", -__LINE__, -3.545277845967514e-17, "-0.000000", "%f", -__LINE__, -3.560935430637329e-12, "-3.56094E-12", "%G", -__LINE__, -3.564234584447659e-23, "-3.56423E-23", "%G", -__LINE__, -3.576040378379921e-11, "-0.000000", "%+6f", -__LINE__, -3.578133580350674e-05, "-3.578134e-05", "%#e", -__LINE__, -3.584484015191491e-28, "-0.0", "%+2.1f", -__LINE__, -3.591961845146752e+27, "-3.59196E+27", "%G", -__LINE__, -3.602508380305001e+26, "-3.60251e+26", "%g", -__LINE__, -3.603113449808132e+04, "-36031.134498", "%+3.6f", -__LINE__, -3.605569849504628e+25, "-4E+25", "%6.G", -__LINE__, -3.611297754851416e+05, "-361129.775485", "%+f", -__LINE__, -3.613177909959201e-28, "-0.000000", "%f", -__LINE__, -3.616261225230595e-01, "-0.361626", "%3g", -__LINE__, -3.619203521536307e+09, "-3.6192E+09", "%G", -__LINE__, -3.619316709131723e-27, "-0.0000000", "%.7f", -__LINE__, -3.623100583082346e+28, "-3.6231E+28", "%+G", -__LINE__, -3.626582653589919e+21, "-3626582653589918603387.332041", "%f", -__LINE__, -3.626667540343067e-30, "-4.E-30", "%#.0G", -__LINE__, -3.633539220625861e-30, "-3.634E-30", "%+.3E", -__LINE__, -3.641655782149502e-11, "-3.64166E-11", "%G", -__LINE__, -3.644523594046571e+25, "-3.64452e+25", "%5g", -__LINE__, -3.645977605394108e+25, "-3.646e+25", "%+0.3e", -__LINE__, -3.647864582248812e+13, "-4E+13", "%4.G", -__LINE__, -3.655241667633056e-25, "-3.655242E-25", "%E", -__LINE__, -3.662603655433297e+23, "-3.662604e+23", "%e", -__LINE__, -3.668995445134158e+22, " -4E+22", "%7.G", -__LINE__, -3.670006666569412e-11, "-3.670007e-11", "%e", -__LINE__, -3.670510381138509e-24, "-3.670510e-24", "%e", -__LINE__, -3.671283003268254e-20, "-3.67128E-20", "%G", -__LINE__, -3.687760201176777e-13, "-3.68776E-13", "%G", -__LINE__, -3.687983982100676e-14, "-0.00", "%.2f", -__LINE__, -3.694808382827435e-12, "-3.694808E-12", "%#E", -__LINE__, -3.696158520838821e+28, "-3.69616E+28", "%3G", -__LINE__, -3.700911860811323e+18, "-3.70091e+18", "%+g", -__LINE__, -3.701328314738669e+24, "-3.70133e+24", "%g", -__LINE__, -3.707068461822151e-19, "-3.707068E-19", "%E", -__LINE__, -3.710679411506914e+25, "-3.71068e+25", "%g", -__LINE__, -3.713003840923896e-23, "-3.713e-23", "%7g", -__LINE__, -3.717028397747828e-28, "-3.71703e-28", "%g", -__LINE__, -3.728159642236442e+14, "-3.72816E+14", "%G", -__LINE__, -3.731956233637010e+21, "-3.73196E+21", "%G", -__LINE__, -3.742336623322610e+07, "-3.74234e+07", "%g", -__LINE__, -3.748328269630045e+04, "-37483.3", "%G", -__LINE__, -3.750803081283569e-27, "-3.7508E-27", "%+7G", -__LINE__, -3.752021500826652e-04, "-0.0004", "%.1G", -__LINE__, -3.755942257004103e-12, "-3.75594E-12", "%G", -__LINE__, -3.765921235889045e+03, " -4e+03", "%+7.g", -__LINE__, -3.772453135667801e-28, "-3.77245E-28", "%G", -__LINE__, -3.776384200230367e+27, "-3.776e+27", "%1.4g", -__LINE__, -3.787035870684945e-25, "-4E-25", "%+3.G", -__LINE__, -3.798616350818839e-29, "-3.7986164e-29", "%.7e", -__LINE__, -3.807178315238428e-15, "-0.000000", "%+#6f", -__LINE__, -3.822059837967635e+18, "-3822059837967634621.236357", "%6.6f", -__LINE__, -3.823553096022006e+12, "-3.82355e+12", "%g", -__LINE__, -3.839198115259428e-23, "-0.000000", "%f", -__LINE__, -3.846953640321746e+02, "-3.846954E+02", "%E", -__LINE__, -3.852230696542361e+08, "-3.8522e+08", "%#.5g", -__LINE__, -3.861139362195314e-25, "-3.86114E-25", "%2G", -__LINE__, -3.873388618099769e+09, "-3873388618", "%0.0f", -__LINE__, -3.874161550543817e+15, "-3.874162e+15", "%+e", -__LINE__, -3.874527935469425e+20, "-3.87E+20", "%3.3G", -__LINE__, -3.878069577893697e-30, "-3.878070E-30", "%#E", -__LINE__, -3.878852490397702e-20, "-3.87885e-20", "%g", -__LINE__, -3.879688342272101e-10, "-0.00", "%#4.2f", -__LINE__, -3.879797428399897e+03, "-3880", "%1.4g", -__LINE__, -3.881588804766756e+00, "-3.9", "%+4.2G", -__LINE__, -3.889377318111182e+01, "-38.8938", "%+.4f", -__LINE__, -3.893444523430385e-03, "-0.004", "%+2.g", -__LINE__, -3.894912141515856e+03, "-3894.91", "%+g", -__LINE__, -3.905279115773667e+04, "-39052.791158", "%f", -__LINE__, -3.905333955484919e-20, "-3.90533E-20", "%G", -__LINE__, -3.906559442060730e+27, "-3906559442060730447110472596.250474", "%f", -__LINE__, -3.909396469655334e-26, "-3.91E-26", "%.3G", -__LINE__, -3.920132491092364e+11, "-3.92013e+11", "%g", -__LINE__, -3.935651497471973e+27, "-3935651497471972604103029880", "%5.f", -__LINE__, -3.939742577853889e-03, "-0.004", "%5.G", -__LINE__, -3.943284017088198e+19, "-39432840170881981123.3", "%.1f", -__LINE__, -3.947452186327660e+09, "-3947452186.33", "%0.2f", -__LINE__, -3.951967237553488e+18, "-3951967237553488132.562052", "%f", -__LINE__, -3.953673427359789e-28, "-3.954E-28", "%3.4G", -__LINE__, -3.956044867371602e+23, "-4e+23", "%+6.1g", -__LINE__, -3.965038994251913e-20, "-3.96504e-20", "%g", -__LINE__, -3.970527677577937e+05, "-4.e+05", "%#0.1g", -__LINE__, -3.970717822164395e-20, "-3.970718e-20", "%6e", -__LINE__, -3.978063834438912e-19, "-3.97806E-19", "%G", -__LINE__, -3.982705395472599e+27, "-3.9827e+27", "%#.5g", -__LINE__, -3.983486821352571e-28, "-3.98349e-28", "%g", -__LINE__, -3.985470630230926e-14, "-4e-14", "%.2g", -__LINE__, -3.993095662863953e-16, "-3.993096e-16", "%e", -__LINE__, -4.006984141314271e-22, " -4e-22", "%7.2g", -__LINE__, -4.006984141314271e-22, "-4.0e-22", "%#7.2g", -__LINE__, -4.013226099863981e+06, "-4.013226E+06", "%+E", -__LINE__, -4.013702226581167e+00, "-4.0137022", "%+#3.7f", -__LINE__, -4.017598274642537e+11, "-4E+11", "%5.G", -__LINE__, -4.021385792825529e-09, " -4e-09", "%7.2g", -__LINE__, -4.024099064819937e-20, "-4.0241E-20", "%+G", -__LINE__, -4.026952473441366e+22, "-4.026952e+22", "%6.7g", -__LINE__, -4.027636677087866e+12, "-4.02764E+12", "%G", -__LINE__, -4.036506013049443e+17, "-4.03651e+17", "%0.6g", -__LINE__, -4.063191953523012e-06, " -0.0", "%6.1f", -__LINE__, -4.070953223475192e-23, "-4.07095E-23", "%G", -__LINE__, -4.072425833070524e+09, "-4.072426E+09", "%E", -__LINE__, -4.086025576759603e+12, "-4.086026e+12", "%e", -__LINE__, -4.086627783296081e-24, "-4.087E-24", "%.3E", -__LINE__, -4.086683676772144e+10, "-40866836767.721439", "%f", -__LINE__, -4.087336043219081e-10, "-0.", "%+#0.f", -__LINE__, -4.125162973336809e-26, "-4.125163E-26", "%.7G", -__LINE__, -4.150753797717075e-10, "-4.2e-10", "%.2g", -__LINE__, -4.152126152181912e+23, "-4.15213e+23", "%g", -__LINE__, -4.164458223079432e-07, "-4.164458E-07", "%E", -__LINE__, -4.170624866130099e+03, "-4170.624866", "%4.6f", -__LINE__, -4.171137277374942e-01, " -4E-01", "%+7.E", -__LINE__, -4.176067421901769e-25, "-4.17607E-25", "%G", -__LINE__, -4.179514418604771e+24, "-4.1795e+24", "%3.5g", -__LINE__, -4.196285183415621e+23, "-4.19629E+23", "%5G", -__LINE__, -4.198600486581023e+23, "-4E+23", "%+4.G", -__LINE__, -4.199020494598538e-16, "-0.000000", "%+f", -__LINE__, -4.207824153501688e-01, "-0.420782", "%G", -__LINE__, -4.219086441294006e-13, " -0", "%+4.f", -__LINE__, -4.223689582765525e+12, "-4.22369e+12", "%g", -__LINE__, -4.230213377391093e+04, "-42302.1", "%+2.6G", -__LINE__, -4.232495358100605e-02, "-0.042325", "%+f", -__LINE__, -4.235459662515940e-29, "-0.000000", "%f", -__LINE__, -4.240807508057296e-07, "-4e-07", "%0.g", -__LINE__, -4.248376819122346e-13, "-4.248377e-13", "%7e", -__LINE__, -4.251361939638334e-23, "-4.251362E-23", "%E", -__LINE__, -4.253044333568077e+24, "-4.253044e+24", "%4e", -__LINE__, -4.255728039119772e-30, "-4.25573E-30", "%2G", -__LINE__, -4.256502531648988e+02, "-425.65", "%G", -__LINE__, -4.260731632612400e-04, "-0", "%2.f", -__LINE__, -4.262037138254753e-25, "-4e-25", "%5.g", -__LINE__, -4.270910126379393e+00, "-4.2709", "%#7.4f", -__LINE__, -4.273844276097008e-09, " -0.", "%#4.f", -__LINE__, -4.280424136111831e+21, "-4.280E+21", "%.3E", -__LINE__, -4.284351940366486e-23, "-0.000000", "%+f", -__LINE__, -4.291747881693517e-29, "-4.3e-29", "%+#.2g", -__LINE__, -4.298346825232928e+04, "-42983.5", "%G", -__LINE__, -4.298879924365432e+28, "-42988799243654316484253286034.800112", "%f", -__LINE__, -4.302192665689887e-25, "-0.000000", "%f", -__LINE__, -4.303899568112784e+06, "-4E+06", "%1.G", -__LINE__, -4.307399960278190e-30, "-4.31e-30", "%.3g", -__LINE__, -4.341161949359232e+01, "-43.411619", "%+f", -__LINE__, -4.353334435604675e+17, " -4e+17", "%+7.g", -__LINE__, -4.354760231068195e+08, "-4e+08", "%2.e", -__LINE__, -4.363535913318519e+08, "-4.363536E+08", "%+7E", -__LINE__, -4.365389605557404e-29, "-4.365390e-29", "%e", -__LINE__, -4.369278570829168e-22, "-4.369279E-22", "%5E", -__LINE__, -4.372187639240662e-11, "-4.37219e-11", "%+g", -__LINE__, -4.374221079233858e-15, "-4.37422E-15", "%4.6G", -__LINE__, -4.374840292001664e-13, "-0.000000", "%+f", -__LINE__, -4.376554800103945e+16, "-43765548001039453.751559", "%f", -__LINE__, -4.376659235899513e+07, "-4.4E+07", "%0.2G", -__LINE__, -4.377316129868239e-06, "-4.37732E-06", "%+5G", -__LINE__, -4.380028480226885e+21, "-4e+21", "%1.0e", -__LINE__, -4.380434965450223e+16, "-43804349654502230.393405", "%f", -__LINE__, -4.392477080355168e-15, "-4E-15", "%+2.G", -__LINE__, -4.396120020536161e+17, "-439612002053616102.159594", "%#f", -__LINE__, -4.400993154571784e+13, "-44009931545717.844159", "%f", -__LINE__, -4.402873692051930e-26, "-4.4e-26", "%5.3g", -__LINE__, -4.405330274903779e+24, "-4405330274903779042006135.568954", "%+5f", -__LINE__, -4.406272291312090e+06, "-4.40627e+06", "%+g", -__LINE__, -4.407065949816988e-13, "-0.000000", "%f", -__LINE__, -4.408295597674563e-10, "-4.4083e-10", "%g", -__LINE__, -4.417553815178214e-30, "-4.41755E-30", "%G", -__LINE__, -4.428894120469459e+16, "-4.42889e+16", "%g", -__LINE__, -4.433747825142046e+04, "-4.433748e+04", "%#e", -__LINE__, -4.435051082856639e+11, "-4.43505E+11", "%G", -__LINE__, -4.445045573007259e-27, "-4.445e-27", "%.5g", -__LINE__, -4.447791368960968e-25, " -4e-25", "%+7.g", -__LINE__, -4.449691386526521e-11, "-4.44969e-11", "%g", -__LINE__, -4.451399093849402e+06, "-4.e+06", "%#0.e", -__LINE__, -4.453753130320864e-22, "-4E-22", "%6.E", -__LINE__, -4.455910780463539e+00, "-4", "%2.g", -__LINE__, -4.464935674747308e+25, "-4.46494e+25", "%g", -__LINE__, -4.469759565657550e-29, "-4.46976e-29", "%g", -__LINE__, -4.473254139442931e+14, "-4E+14", "%3.1G", -__LINE__, -4.480844704930373e-04, "-0.000448", "%5.6f", -__LINE__, -4.484177356024563e+19, "-4.484177E+19", "%E", -__LINE__, -4.488115678357666e-13, "-4.48812e-13", "%g", -__LINE__, -4.491545112281561e+12, "-4.491545E+12", "%E", -__LINE__, -4.492547433553077e-23, "-4.49255e-23", "%g", -__LINE__, -4.492701755830813e-05, "-0.000045", "%f", -__LINE__, -4.497405935096372e-02, "-4.497406e-02", "%e", -__LINE__, -4.502764260212887e+21, "-4.50276E+21", "%G", -__LINE__, -4.511984199938207e+29, "-451198419993820731832556703011.505306", "%f", -__LINE__, -4.514517861504637e-13, "-4.51452e-13", "%g", -__LINE__, -4.525577218881990e+24, "-4.5e+24", "%2.2g", -__LINE__, -4.549244580903896e-26, "-5E-26", "%2.G", -__LINE__, -4.569192488002113e-29, "-5E-29", "%3.G", -__LINE__, -4.572011438847734e+17, "-4.57e+17", "%#.3g", -__LINE__, -4.573010973514519e-08, "-4.57301e-08", "%+7g", -__LINE__, -4.584534976177852e-04, "-0.000458453", "%7g", -__LINE__, -4.584729895132228e-21, "-0.000000", "%4f", -__LINE__, -4.585259328217483e-30, "-4.58526E-30", "%+#4.6G", -__LINE__, -4.589603063610410e-04, "-4.589603E-04", "%+E", -__LINE__, -4.592428795671033e+22, " -5e+22", "%7.g", -__LINE__, -4.595683678223830e-20, " -0", "%5.f", -__LINE__, -4.602585606100101e+05, "-4.602586E+05", "%E", -__LINE__, -4.603375306660027e-08, "-5E-08", "%+6.G", -__LINE__, -4.611341343728034e-18, "-4.611341e-18", "%5e", -__LINE__, -4.613608487855863e+05, "-461361", "%6g", -__LINE__, -4.615997775774194e-24, "-4.61600e-24", "%#g", -__LINE__, -4.620310950564759e+23, "-462031095056475926696749", "%1.0f", -__LINE__, -4.620645693595563e-10, "-4.6206457e-10", "%.7e", -__LINE__, -4.621527706233292e-09, "-4.621528e-09", "%#e", -__LINE__, -4.625215210297273e-13, "-4.62522E-13", "%G", -__LINE__, -4.636755152220100e-29, "-0.000000", "%#f", -__LINE__, -4.641203877508087e+23, "-4.6412e+23", "%0g", -__LINE__, -4.648627249239175e+23, "-4.65E+23", "%+0.3G", -__LINE__, -4.662546890623409e-10, "-4.663E-10", "%.3E", -__LINE__, -4.664488650292317e-27, "-4.66449e-27", "%#g", -__LINE__, -4.668715685060282e+08, "-466871568.50603", "%.5f", -__LINE__, -4.673332851657081e-18, "-4.7e-18", "%#5.2g", -__LINE__, -4.683361436174074e+24, "-4.68e+24", "%#.2e", -__LINE__, -4.693748680461066e-01, "-0.469375", "%G", -__LINE__, -4.697110010549124e+23, "-4.69711E+23", "%G", -__LINE__, -4.710442739966989e+06, "-4.710443e+06", "%2e", -__LINE__, -4.713427678642280e-09, "-4.71343e-09", "%g", -__LINE__, -4.721999055940316e-04, "-4.721999e-04", "%#1e", -__LINE__, -4.724262200578540e+17, "-472426220057853996.081576", "%+f", -__LINE__, -4.733267644288093e+01, "-4.733268e+01", "%7e", -__LINE__, -4.742854711396110e-11, "-0.000000", "%f", -__LINE__, -4.757456106385936e+23, "-4.75746e+23", "%g", -__LINE__, -4.770895495642298e+27, "-4770895495642298200777986494.358629", "%2f", -__LINE__, -4.775073456318149e+29, "-4.775073E+29", "%#E", -__LINE__, -4.779997387204258e+17, "-4.78e+17", "%g", -__LINE__, -4.799264315770707e-23, "-4.799264E-23", "%+.7G", -__LINE__, -4.814277930599660e+10, "-5e+10", "%2.1g", -__LINE__, -4.818413387018612e+05, "-5e+05", "%.0g", -__LINE__, -4.818827195107612e-16, "-4.818827e-16", "%e", -__LINE__, -4.841524514024803e+21, "-4.84152E+21", "%G", -__LINE__, -4.860585077313477e+10, "-4.86059E+10", "%+G", -__LINE__, -4.870037451948589e+28, "-48700374519485887248038125107.996166", "%f", -__LINE__, -4.888835952705153e-28, "-4.888836E-28", "%+E", -__LINE__, -4.893523355754114e-19, "-4.893523e-19", "%.6e", -__LINE__, -4.906070260482585e+17, "-490607026048258454", "%+.0f", -__LINE__, -4.907734144101900e+25, "-5E+25", "%+.1G", -__LINE__, -4.917899547741841e-25, "-4.917900e-25", "%e", -__LINE__, -4.923348512538722e+25, "-49233485125387215219916470.232420", "%+.6f", -__LINE__, -4.926052630078460e-26, "-4.926053e-26", "%e", -__LINE__, -4.926751662051156e+14, "-4.927E+14", "%+5.3E", -__LINE__, -4.928017952199046e-12, "-0.000000", "%f", -__LINE__, -4.944296782981195e-21, "-4.9443E-21", "%1.5G", -__LINE__, -4.947320427183599e-19, "-4.947320e-19", "%.6e", -__LINE__, -4.968188938972135e+17, "-4.96819E+17", "%G", -__LINE__, -4.968756725758674e+05, "-496876", "%G", -__LINE__, -4.968788759793340e-26, "-4.97E-26", "%.3G", -__LINE__, -4.983904999913364e-24, "-5E-24", "%0.G", -__LINE__, -4.985209496522767e+23, "-4.985209e+23", "%e", -__LINE__, -4.987363880732866e+08, "-4.98736E+08", "%G", -__LINE__, -4.989754940144973e+05, "-498975.494014", "%f", -__LINE__, -4.998203870733718e-25, "-4.9982e-25", "%g", -__LINE__, -4.999153445016792e-27, "-5e-27", "%+1.e", -__LINE__, -5.002693488258108e+06, " -5e+06", "%+7.g", -__LINE__, -5.017958458603783e+05, "-5.0179585E+05", "%+.7E", -__LINE__, -5.028902178573363e-12, "-5.0289e-12", "%0g", -__LINE__, -5.032337536971444e+07, "-50323375.369714", "%f", -__LINE__, -5.036525516370473e-24, "-5.0365e-24", "%4.5g", -__LINE__, -5.038642321515756e+18, "-5038642321515755639.893541", "%f", -__LINE__, -5.051003516976770e-14, "-5.051E-14", "%+G", -__LINE__, -5.051196143816789e+27, "-5.0512e+27", "%g", -__LINE__, -5.057372886713786e+28, "-5.057373e+28", "%#e", -__LINE__, -5.057475029459727e+12, "-5.05748e+12", "%+g", -__LINE__, -5.068286816124670e-17, "-5.068E-17", "%5.3E", -__LINE__, -5.070475165759468e-12, "-0.000000", "%4.6f", -__LINE__, -5.081352543220476e+20, "-5.081E+20", "%.3E", -__LINE__, -5.084398319179363e+11, "-508439831917.936313", "%#f", -__LINE__, -5.085781220648484e+05, "-5.E+05", "%+#7.G", -__LINE__, -5.094941054632498e-24, "-5.09494E-24", "%+G", -__LINE__, -5.100059596310871e-10, "-5.10006e-10", "%3.6g", -__LINE__, -5.103072553594136e-01, "-0.5", "%+1.g", -__LINE__, -5.106319890388412e+08, "-5.106320e+08", "%4e", -__LINE__, -5.107120687977690e+09, "-5107120687.977690", "%f", -__LINE__, -5.119910716893161e-13, "-5.11991E-13", "%6G", -__LINE__, -5.127594569425709e-29, "-5.12759e-29", "%#g", -__LINE__, -5.130365585632797e+29, "-5.13037e+29", "%#g", -__LINE__, -5.131415638022112e+08, "-513141563.802211", "%0f", -__LINE__, -5.144703216335916e-23, "-5.1447e-23", "%g", -__LINE__, -5.152511923201882e-05, "-5.15251E-05", "%+G", -__LINE__, -5.165484448280190e-12, " -0.0", "%5.1f", -__LINE__, -5.179220760465737e-20, "-5e-20", "%+5.g", -__LINE__, -5.183005119662180e-10, "-5.183005E-10", "%+E", -__LINE__, -5.199587953258117e+13, "-5.19959e+13", "%6g", -__LINE__, -5.202041951844580e-25, "-0.000000", "%f", -__LINE__, -5.202836038621740e+00, "-5.20284", "%G", -__LINE__, -5.212204099528552e-11, "-5.2122e-11", "%.6g", -__LINE__, -5.225617726710534e+17, "-522561772671053414.995868", "%+f", -__LINE__, -5.230162003281426e+25, "-52301620032814257754694153.84578", "%+6.5f", -__LINE__, -5.251849429321286e-11, "-5.25185e-11", "%g", -__LINE__, -5.265174939930368e+23, "-5.265175E+23", "%1.6E", -__LINE__, -5.271218134351422e+21, "-5.27122e+21", "%+1g", -__LINE__, -5.273823357545750e+17, "-527382335754575048.980541", "%f", -__LINE__, -5.279848797214957e+11, "-527984879721.495659", "%0f", -__LINE__, -5.281551888625290e+11, "-5e+11", "%4.g", -__LINE__, -5.281780377142961e-24, "-5.28178e-24", "%g", -__LINE__, -5.292125782379512e+03, "-5292.125782", "%f", -__LINE__, -5.292401691410388e+15, "-5292401691410387.520875", "%f", -__LINE__, -5.305120752102265e-25, "-5.30512e-25", "%+#.5e", -__LINE__, -5.317975791704413e+16, "-5.31798e+16", "%+g", -__LINE__, -5.336522843607233e+27, "-5.33652e+27", "%#6g", -__LINE__, -5.342016438000917e-05, " -5e-05", "%+7.e", -__LINE__, -5.351122291549103e+06, "-5351122.291549", "%+0f", -__LINE__, -5.352043956303597e+00, "-5.35204", "%g", -__LINE__, -5.353582488767747e+09, "-5.354E+09", "%7.3E", -__LINE__, -5.383420177718380e+04, "-5e+04", "%1.e", -__LINE__, -5.384320189791882e-10, "-5.384320e-10", "%e", -__LINE__, -5.409487543257379e-12, "-5.40949E-12", "%G", -__LINE__, -5.418395794776773e+23, "-5.4184e+23", "%g", -__LINE__, -5.419918795921525e-09, "-0.000000", "%+f", -__LINE__, -5.422374157832442e+11, "-5.42237e+11", "%3g", -__LINE__, -5.426916951577001e-27, "-5.42692E-27", "%+G", -__LINE__, -5.430058833461779e+28, "-5.43006E+28", "%G", -__LINE__, -5.444433348653147e+23, "-5.444433E+23", "%E", -__LINE__, -5.446560186537024e+09, "-5.446560E+09", "%E", -__LINE__, -5.464243500152188e+27, "-5.46424E+27", "%G", -__LINE__, -5.464427517531742e+20, "-546442751753174249529.365625", "%f", -__LINE__, -5.465783705970954e+05, "-5E+05", "%1.E", -__LINE__, -5.475138077475789e-11, "-5e-11", "%.0e", -__LINE__, -5.475302250616576e+10, "-54753022506.1658", "%.4f", -__LINE__, -5.488964905442472e+09, "-5.48896e+09", "%g", -__LINE__, -5.492508526846316e-08, "-5.49251e-08", "%.6g", -__LINE__, -5.520533408804846e-15, "-5.520533e-15", "%e", -__LINE__, -5.532744688447266e+28, "-55327446884472664123677532188.594341", "%2.6f", -__LINE__, -5.535834653450131e-14, "-5.5e-14", "%0.1e", -__LINE__, -5.554344735392882e-02, "-5.554345E-02", "%+#E", -__LINE__, -5.555497334515501e-17, "-5.5555e-17", "%g", -__LINE__, -5.558304303221977e+14, "-555830430322197.699411", "%f", -__LINE__, -5.562210815777694e-05, "-5.562211E-05", "%#1E", -__LINE__, -5.564800722538402e-09, "-5.56480e-09", "%#.6g", -__LINE__, -5.567143271590439e-01, "-5.567143e-01", "%#e", -__LINE__, -5.568606044396186e+01, "-55.6861", "%4g", -__LINE__, -5.592027856401721e+12, "-5.592028e+12", "%.7g", -__LINE__, -5.592295342565443e+22, "-6.E+22", "%#3.G", -__LINE__, -5.600007421926053e+07, "-56000074.219261", "%1f", -__LINE__, -5.601444553155006e-12, "-5.60144E-12", "%G", -__LINE__, -5.605128912835080e-03, "-0.005605", "%+f", -__LINE__, -5.610950285679577e+19, "-5.61095E+19", "%G", -__LINE__, -5.622074657679467e+11, "-562207465767.946690", "%f", -__LINE__, -5.627358352391656e-01, "-0.6", "%1.g", -__LINE__, -5.627974317622488e-02, "-5.627974e-02", "%+e", -__LINE__, -5.629497696447229e+27, "-5.629E+27", "%+.4G", -__LINE__, -5.631383567258576e-29, "-5.63138e-29", "%0g", -__LINE__, -5.635241327177333e-18, "-5.63524E-18", "%G", -__LINE__, -5.644819783138381e+06, "-5.644820E+06", "%#E", -__LINE__, -5.648538459114833e+26, "-564853845911483265496144667.849876", "%+f", -__LINE__, -5.649004865848537e+00, "-5.649", "%g", -__LINE__, -5.653403316885170e+23, "-6E+23", "%2.0E", -__LINE__, -5.656109962244926e-18, "-0.000000", "%f", -__LINE__, -5.674988031695793e+22, "-5.674988E+22", "%+.7G", -__LINE__, -5.686380226400881e-22, "-0.000000", "%f", -__LINE__, -5.698840855829442e-14, "-5.69884E-14", "%G", -__LINE__, -5.707036642649580e+03, "-5707.036643", "%f", -__LINE__, -5.710344882278847e+11, "-5.71034E+11", "%+G", -__LINE__, -5.714852196401017e+19, "-5.71485E+19", "%+G", -__LINE__, -5.720153622156089e-22, "-5.72015E-22", "%G", -__LINE__, -5.722366011976922e+26, "-5.72237e+26", "%+g", -__LINE__, -5.722909928097404e+12, "-5.72291E+12", "%2G", -__LINE__, -5.725325961787777e-25, "-5.72533e-25", "%g", -__LINE__, -5.727138241052646e+19, "-5.72714e+19", "%+#g", -__LINE__, -5.734025840446336e+14, "-5.73403e+14", "%+g", -__LINE__, -5.736469106710259e-05, "-0.000057", "%.6f", -__LINE__, -5.755099153733116e-14, "-5.7551e-14", "%+g", -__LINE__, -5.758411844890947e-20, "-6E-20", "%+6.G", -__LINE__, -5.760350214122813e+03, "-5760.35", "%+g", -__LINE__, -5.768009192512392e-30, "-0", "%1.f", -__LINE__, -5.772343286693103e+07, "-5.77234E+07", "%G", -__LINE__, -5.776693265471852e-27, "-5.776693E-27", "%E", -__LINE__, -5.779682861172754e-28, "-5.779683e-28", "%e", -__LINE__, -5.789953490749936e+26, "-578995349074993637117358957.76656", "%5.5f", -__LINE__, -5.796771264754334e+04, "-57967.7", "%g", -__LINE__, -5.804788370597286e-02, "-5.80479E-02", "%+#1.5E", -__LINE__, -5.805343475329215e-13, "-5.80534e-13", "%g", -__LINE__, -5.809853913830122e+09, "-5809853914", "%+0.f", -__LINE__, -5.817313814570609e-30, " -0", "%7.0f", -__LINE__, -5.831708441750138e+00, "-5.83171", "%#g", -__LINE__, -5.846914550593652e+29, "-5.846915e+29", "%e", -__LINE__, -5.851455214762288e+04, "-58514.6", "%+G", -__LINE__, -5.855803663871393e-23, "-6E-23", "%5.E", -__LINE__, -5.858065129988470e+10, "-5.85807e+10", "%+g", -__LINE__, -5.863147168075411e-14, "-5.86315e-14", "%+g", -__LINE__, -5.878936740266680e-04, "-0.000587894", "%g", -__LINE__, -5.887654893386630e+25, "-58876548933866299506689756.526612", "%#f", -__LINE__, -5.889416409731902e-02, "-0.06", "%5.g", -__LINE__, -5.897630195029892e-18, "-5.897630E-18", "%#0.7G", -__LINE__, -5.898506808456422e-19, "-5.89851E-19", "%G", -__LINE__, -5.901768645393515e+29, "-5.90177E+29", "%+G", -__LINE__, -5.907529093570369e+10, "-59075290935.703695", "%f", -__LINE__, -5.910069365260240e+13, "-59100693652602.39849", "%+#5.5f", -__LINE__, -5.915678929676435e-07, "-0.000001", "%+f", -__LINE__, -5.922232380131716e-01, "-0.592223", "%+3f", -__LINE__, -5.923716473994306e+19, "-5.92372E+19", "%+#.6G", -__LINE__, -5.929950428920404e-15, "-5.929950e-15", "%+e", -__LINE__, -5.949552735665802e+26, "-5.94955e+26", "%#g", -__LINE__, -5.949977081310732e-02, "-0.059500", "%f", -__LINE__, -5.954520303889356e-07, "-5.954520E-07", "%5E", -__LINE__, -5.978861337429145e-13, "-6E-13", "%1.G", -__LINE__, -5.980539445081087e+15, "-5.98054E+15", "%.6G", -__LINE__, -5.981724990853490e-03, " -0.006", "%#7.g", -__LINE__, -5.989488907825821e+03, "-6E+03", "%.2G", -__LINE__, -5.998272294890842e+06, "-6.00E+06", "%4.2E", -__LINE__, -6.023775731455919e-29, "-6.023776e-29", "%e", -__LINE__, -6.028153126666870e-05, "-6.e-05", "%+#6.e", -__LINE__, -6.036200621484690e+25, "-6e+25", "%2.2g", -__LINE__, -6.036400640928137e-14, "-6.036401e-14", "%e", -__LINE__, -6.038198451098329e-20, "-6.038198e-20", "%1.7g", -__LINE__, -6.045778975641123e-15, "-6.04578E-15", "%G", -__LINE__, -6.046038904252073e+00, "-6.04604", "%g", -__LINE__, -6.082158462782175e-06, "-0.000006", "%+#f", -__LINE__, -6.106162726644904e+10, "-6.10616e+10", "%g", -__LINE__, -6.126345215489182e+10, "-6e+10", "%+1.g", -__LINE__, -6.131852309620571e+02, "-6e+02", "%4.e", -__LINE__, -6.134589313243809e-01, "-0.613459", "%+#f", -__LINE__, -6.142358153783462e-10, "-6.14236E-10", "%4G", -__LINE__, -6.151524334856263e+27, "-6151524334856262932191839354.345575", "%+6f", -__LINE__, -6.156818333724550e+04, "-6.e+04", "%#.1g", -__LINE__, -6.166172551433993e+24, "-6166172551433993120895138.4178", "%5.4f", -__LINE__, -6.169532428006014e-09, "-6.16953e-09", "%3g", -__LINE__, -6.172019382601770e-28, "-0.000000", "%+f", -__LINE__, -6.174496985807155e-09, "-6.1745E-09", "%G", -__LINE__, -6.186771845105751e+04, "-61867.7", "%G", -__LINE__, -6.200817973780066e+22, "-6.20082E+22", "%3G", -__LINE__, -6.218004335456301e-22, "-0.000000", "%+f", -__LINE__, -6.219009630546262e-18, "-6.22e-18", "%6.3g", -__LINE__, -6.242532875230618e-06, "-0.000006", "%7f", -__LINE__, -6.243612261280864e+14, "-6.24361e+14", "%.6g", -__LINE__, -6.243689597320126e+10, "-6e+10", "%.0e", -__LINE__, -6.244620667090527e+04, "-6e+04", "%6.e", -__LINE__, -6.250789625572054e-09, "-0.000000", "%+f", -__LINE__, -6.253537566219164e+01, "-63.", "%#1.f", -__LINE__, -6.284420289484166e+21, "-6.2844203e+21", "%7.7e", -__LINE__, -6.285939888202846e+27, "-6e+27", "%+.0g", -__LINE__, -6.290025777678105e+13, "-6E+13", "%2.E", -__LINE__, -6.291364254323924e+10, "-6.3E+10", "%3.2G", -__LINE__, -6.292428812164449e+15, "-6292428812164448.714839", "%.6f", -__LINE__, -6.292600606358002e+29, "-6.29260E+29", "%#G", -__LINE__, -6.292739629144148e-15, "-6.292740E-15", "%E", -__LINE__, -6.296471626465745e+28, "-6.29647E+28", "%G", -__LINE__, -6.299575066640315e+27, "-6.300E+27", "%.3E", -__LINE__, -6.315234679394876e-24, "-6E-24", "%2.G", -__LINE__, -6.320883246383228e-01, "-0.632088", "%2g", -__LINE__, -6.324938413548937e-11, "-6e-11", "%.1g", -__LINE__, -6.336312983176250e+04, "-6.336313e+04", "%e", -__LINE__, -6.341786787214541e+06, "-6.341787E+06", "%+7.6E", -__LINE__, -6.360189291106185e-15, "-0.0000000", "%#.7f", -__LINE__, -6.364818355457748e-15, "-0.0000000", "%1.7f", -__LINE__, -6.366291103431814e+04, "-63662.9", "%#G", -__LINE__, -6.366334042923153e-05, "-6.37e-05", "%5.3g", -__LINE__, -6.370477455143194e-12, "-0.000000", "%f", -__LINE__, -6.372829256546279e+23, "-6.37283E+23", "%G", -__LINE__, -6.375208490193110e-23, "-6.37521e-23", "%4.5e", -__LINE__, -6.382595100891736e-24, "-6.3826E-24", "%5G", -__LINE__, -6.396882421146790e-22, "-6.39688e-22", "%+g", -__LINE__, -6.407190354039938e+08, "-6.40719e+08", "%+g", -__LINE__, -6.408581541430886e-10, "-6.E-10", "%#0.0G", -__LINE__, -6.409206904981703e-03, "-0.006", "%+.0G", -__LINE__, -6.416106714707772e+26, "-641610671470777216285341637.558304", "%f", -__LINE__, -6.417436981761998e-04, "-0.000642", "%+#f", -__LINE__, -6.429997249673124e+11, "-642999724967.312414", "%#f", -__LINE__, -6.440827429825250e+16, "-6.44083E+16", "%G", -__LINE__, -6.444869858444955e+02, "-6e+02", "%6.g", -__LINE__, -6.471701890976228e-25, " -6e-25", "%7.1g", -__LINE__, -6.485393161670371e-12, "-6.485393e-12", "%.6e", -__LINE__, -6.487710907063584e+23, "-6.E+23", "%#3.E", -__LINE__, -6.492942931343439e-08, "-0.", "%+#2.0f", -__LINE__, -6.496010652113223e+18, "-6.49601e+18", "%g", -__LINE__, -6.502856921840228e+22, "-6.50286e+22", "%4g", -__LINE__, -6.523559906055000e-10, "-6.52356E-10", "%.6G", -__LINE__, -6.525899074126662e+04, "-6.5e+04", "%+.1e", -__LINE__, -6.532216801155521e-09, "-6.53222E-09", "%G", -__LINE__, -6.544601787025684e-27, "-0", "%+.0f", -__LINE__, -6.558968312132168e-01, " -1", "%+6.f", -__LINE__, -6.559654261655786e+08, "-6.559654e+08", "%e", -__LINE__, -6.566562622196495e-21, "-6.56656E-21", "%.6G", -__LINE__, -6.573486832071960e+04, "-65734.9", "%G", -__LINE__, -6.573806290918275e+13, "-6.57381E+13", "%G", -__LINE__, -6.578113771674787e+17, "-6.57811E+17", "%+#G", -__LINE__, -6.584106931007506e+15, "-6.584107E+15", "%E", -__LINE__, -6.590538844308877e+07, "-65905388.443089", "%f", -__LINE__, -6.593708834068371e-07, "-0.000001", "%f", -__LINE__, -6.597116446195875e+08, "-6.5971164e+08", "%#1.7e", -__LINE__, -6.605813542127091e-04, "-0.0007", "%+0.g", -__LINE__, -6.607491403866429e+07, "-7e+07", "%3.g", -__LINE__, -6.616499847522278e+09, "-6.61650E+09", "%+#G", -__LINE__, -6.618619768691332e+20, "-7E+20", "%2.G", -__LINE__, -6.626748168962331e-22, "-7.E-22", "%+#3.E", -__LINE__, -6.639335450348280e+12, "-6.63934e+12", "%g", -__LINE__, -6.643910144912576e-03, "-0.006644", "%f", -__LINE__, -6.650293872031870e-18, "-6.65029e-18", "%+#g", -__LINE__, -6.654903858656310e-21, "-0.000000", "%f", -__LINE__, -6.665834666726511e-12, "-6.665835E-12", "%E", -__LINE__, -6.666428729917570e-19, "-0.000000", "%+#f", -__LINE__, -6.668415789681128e+27, "-6.66842E+27", "%+G", -__LINE__, -6.675214676269601e-28, "-6.67521e-28", "%#g", -__LINE__, -6.679560072732262e+01, "-66.7956", "%#g", -__LINE__, -6.692325075457020e-19, "-0.000000", "%1f", -__LINE__, -6.697096655164652e+00, "-6.70", "%#.3g", -__LINE__, -6.712436135928394e-28, "-7e-28", "%0.g", -__LINE__, -6.720769486122685e-16, "-7e-16", "%0.e", -__LINE__, -6.727196898490600e+26, "-672719689849060031860972230.8", "%.1f", -__LINE__, -6.744132627576416e+02, "-674.413", "%6G", -__LINE__, -6.757705576425288e+28, "-6.7577056e+28", "%.7e", -__LINE__, -6.760554929237173e-02, "-0.067606", "%+f", -__LINE__, -6.763538810629361e+10, "-6.7635E+10", "%.4E", -__LINE__, -6.764712008860796e-29, "-6.76471E-29", "%+G", -__LINE__, -6.767299719678443e+04, "-67672.997197", "%f", -__LINE__, -6.768326491352134e+20, "-676832649135213415547.70", "%+.2f", -__LINE__, -6.771116968952891e+03, "-7E+03", "%3.1G", -__LINE__, -6.775218099238350e-30, "-7.e-30", "%+#6.g", -__LINE__, -6.782142689928918e-18, "-0.00", "%4.2f", -__LINE__, -6.795409770512149e+08, "-7E+08", "%+5.0G", -__LINE__, -6.820966157097271e+14, "-6.820966e+14", "%e", -__LINE__, -6.824972990592273e-22, "-0.00", "%+#1.2f", -__LINE__, -6.830452914741750e+29, "-6.8E+29", "%+7.2G", -__LINE__, -6.835797187132348e+10, "-6.8358E+10", "%+5G", -__LINE__, -6.837040829636343e-03, "-0.00683704", "%+g", -__LINE__, -6.852956218658224e+23, "-6.85296e+23", "%3g", -__LINE__, -6.854102607287217e-26, "-7e-26", "%5.e", -__LINE__, -6.865065870249438e+16, "-6.86507E+16", "%#G", -__LINE__, -6.884819522625523e-13, "-6.88482E-13", "%5G", -__LINE__, -6.916316600148513e-12, "-0.000000", "%f", -__LINE__, -6.925312418761560e-05, "-6.92531E-05", "%#G", -__LINE__, -6.929518694178331e+09, "-6929518694.178", "%#.3f", -__LINE__, -6.936008056682024e+02, "-6.936008E+02", "%E", -__LINE__, -6.944911117352400e+26, "-6.944911E+26", "%1.6E", -__LINE__, -6.945829492125162e+05, "-6.9e+05", "%+2.2g", -__LINE__, -6.946603162471856e-13, "-6.94660E-13", "%#G", -__LINE__, -6.947529440406653e+22, "-6.9475e+22", "%+6.5g", -__LINE__, -6.950167604854856e-30, "-0.000000", "%7f", -__LINE__, -6.958122319262799e-26, "-7E-26", "%+1.E", -__LINE__, -6.958978258390961e+16, "-6.95898E+16", "%+5.6G", -__LINE__, -6.963780466334008e-06, "-6.96378E-06", "%2G", -__LINE__, -6.965570896221966e+13, "-6.965571E+13", "%5E", -__LINE__, -6.967741871945064e-10, "-6.96774E-10", "%+#G", -__LINE__, -6.973815739524307e+19, "-69738157395243067782.076", "%6.3f", -__LINE__, -6.982714545008106e+13, "-6.98271e+13", "%g", -__LINE__, -6.985955885054476e+03, "-6985.96", "%6G", -__LINE__, -6.986415266835747e+18, "-6.98642e+18", "%#g", -__LINE__, -6.996461529596512e-08, "-7.0E-08", "%#.1E", -__LINE__, -7.000144914012241e-05, "-7.00014e-05", "%#g", -__LINE__, -7.001017894492730e-03, "-0.00700102", "%+#.6G", -__LINE__, -7.003690685875917e+20, "-7E+20", "%0.G", -__LINE__, -7.010454163965384e+00, "-7.010454e+00", "%+e", -__LINE__, -7.011493550018082e-26, " -0", "%7.f", -__LINE__, -7.018018443394008e+21, "-7.0E+21", "%+#1.1E", -__LINE__, -7.027253777387243e-05, "-7.02725E-05", "%+G", -__LINE__, -7.043679213677740e-17, "-0", "%1.f", -__LINE__, -7.051690489227881e-16, "-7.052e-16", "%0.4g", -__LINE__, -7.063422475274161e-16, "-7.063422E-16", "%E", -__LINE__, -7.065069592235558e-30, "-7.06507e-30", "%+#g", -__LINE__, -7.068265283935834e-29, "-7e-29", "%+5.e", -__LINE__, -7.068748224536295e-13, "-0.000000", "%f", -__LINE__, -7.069621910708177e-04, "-0.000707", "%1.3g", -__LINE__, -7.079725450964823e-12, "-0.000000", "%f", -__LINE__, -7.087255464668218e+17, "-7.1e+17", "%.1e", -__LINE__, -7.088715102009605e-09, "-7e-09", "%6.0g", -__LINE__, -7.090414916270137e-15, "-0.00000", "%.5f", -__LINE__, -7.091868311008428e-03, " -0.0", "%5.1f", -__LINE__, -7.094242165237718e+21, "-7.09424e+21", "%+g", -__LINE__, -7.094324305740325e-05, "-7E-05", "%+3.G", -__LINE__, -7.104544752289144e+04, "-71045.4", "%#g", -__LINE__, -7.105164644813694e-29, "-0.000000", "%+f", -__LINE__, -7.114513164219487e-12, "-7.11451e-12", "%+g", -__LINE__, -7.115778236604137e-12, "-7.11578E-12", "%G", -__LINE__, -7.126217683410162e-27, "-7.126218e-27", "%e", -__LINE__, -7.136214260967733e+28, "-71362142609677334803564008325.338364", "%f", -__LINE__, -7.143452595522573e+19, "-7.14345e+19", "%g", -__LINE__, -7.156042088843537e+27, "-7156042088843537207765166385.7977837", "%4.7f", -__LINE__, -7.173687683710490e+24, "-7.17369e+24", "%6g", -__LINE__, -7.190531162598206e+25, "-71905311625982060164119503", "%4.f", -__LINE__, -7.201301831373747e-09, "-7.2013e-09", "%g", -__LINE__, -7.209601436737306e+10, "-7.2096e+10", "%g", -__LINE__, -7.211058997356655e-06, "-7.211059E-06", "%E", -__LINE__, -7.226756177676272e-09, "-7.22676E-09", "%+G", -__LINE__, -7.230870817566419e+19, "-72308708175664193618.1040364", "%#.7f", -__LINE__, -7.231355992133345e-05, "-7.231356E-05", "%#E", -__LINE__, -7.245999575278407e-12, "-7.246e-12", "%g", -__LINE__, -7.247426403040390e-09, "-7.2474E-09", "%+4.5G", -__LINE__, -7.257348680308567e-12, "-7.3E-12", "%1.2G", -__LINE__, -7.258184256387366e-26, "-7.25818E-26", "%+2G", -__LINE__, -7.262633672900126e+10, "-7.26263e+10", "%#g", -__LINE__, -7.268887462426250e+03, "-7.268887e+03", "%+#e", -__LINE__, -7.275284494682963e+08, "-7.27528e+08", "%g", -__LINE__, -7.276335846256479e-07, " -0", "%4.f", -__LINE__, -7.312556378294452e+15, "-7.31256e+15", "%+6g", -__LINE__, -7.334763752442417e-15, "-0.0000", "%#.4f", -__LINE__, -7.354627097325888e-18, "-7E-18", "%0.E", -__LINE__, -7.360087573342401e-25, "-7.4E-25", "%6.2G", -__LINE__, -7.368533563361098e-29, "-7.4E-29", "%3.1E", -__LINE__, -7.379267723540596e-06, "-0.000007", "%f", -__LINE__, -7.384525781709565e-19, "-0.000000", "%+#f", -__LINE__, -7.388940868679677e-09, "-7.388941E-09", "%E", -__LINE__, -7.391602149099698e+00, "-7.391602E+00", "%E", -__LINE__, -7.393159340196723e+22, "-7.39316e+22", "%#2.6g", -__LINE__, -7.399783260198277e-16, "-7.39978E-16", "%G", -__LINE__, -7.405609590448331e-06, "-7.40561e-06", "%g", -__LINE__, -7.407396977847794e-11, "-7.40740E-11", "%#G", -__LINE__, -7.433716848698637e+20, "-7.43372e+20", "%+g", -__LINE__, -7.444176062769411e-01, "-0.744418", "%#g", -__LINE__, -7.448314697244012e+12, "-7448314697244.011739", "%f", -__LINE__, -7.449533988369018e+08, "-7.449534e+08", "%+#7e", -__LINE__, -7.465682839758801e-01, "-7E-01", "%4.E", -__LINE__, -7.466517843126368e-26, "-7.5E-26", "%.1E", -__LINE__, -7.471385785539900e+24, "-7471385785539899515583783.795591", "%f", -__LINE__, -7.478345583780341e+00, "-7.478346e+00", "%e", -__LINE__, -7.524759284626724e-06, "-7.52476e-06", "%2g", -__LINE__, -7.534831049342539e-19, "-7.53483E-19", "%G", -__LINE__, -7.540546673179273e+15, "-8e+15", "%.1g", -__LINE__, -7.543440436184003e-08, "-7.54344E-08", "%6G", -__LINE__, -7.558224240835564e-06, "-7.55822e-06", "%g", -__LINE__, -7.564132915154469e+23, "-756413291515446850610260.298708", "%+f", -__LINE__, -7.566590720355392e+15, "-7.566591e+15", "%1.6e", -__LINE__, -7.568565927479741e-01, "-7.568566e-01", "%#6e", -__LINE__, -7.615574141973305e-17, "-7.6156e-17", "%+.5g", -__LINE__, -7.641297631509318e-28, "-8e-28", "%+.1g", -__LINE__, -7.661227834163450e+09, "-7661227834.1634497", "%+#.7f", -__LINE__, -7.665934364070126e+11, "-766593436407.0", "%.1f", -__LINE__, -7.682500068463102e-27, "-0.000000", "%+#f", -__LINE__, -7.709363160273798e+15, "-7.70936e+15", "%g", -__LINE__, -7.712596019255238e+26, "-7.7e+26", "%.2g", -__LINE__, -7.730213358437991e+25, "-7.7e+25", "%6.2g", -__LINE__, -7.744420019068976e+05, "-7.74442E+05", "%.5E", -__LINE__, -7.745813181942296e+11, "-7.7458132e+11", "%+.7e", -__LINE__, -7.751004379716307e+16, "-7.751004e+16", "%e", -__LINE__, -7.759862226564527e-28, "-7.75986e-28", "%g", -__LINE__, -7.767838880221207e-27, "-7.76784e-27", "%g", -__LINE__, -7.776301142157532e-19, "-0", "%2.f", -__LINE__, -7.783944257077553e-14, "-8e-14", "%3.g", -__LINE__, -7.801587579382377e+28, "-8e+28", "%+0.g", -__LINE__, -7.806685979552780e+25, "-7.806686E+25", "%E", -__LINE__, -7.825968891331719e-05, "-7.82597E-05", "%G", -__LINE__, -7.826834158664018e+12, "-7.826834E+12", "%+#E", -__LINE__, -7.832536798726886e+24, "-7.83254E+24", "%#1G", -__LINE__, -7.840485340202362e-18, "-0.000000", "%.6f", -__LINE__, -7.843236212099233e+21, "-7.84324e+21", "%g", -__LINE__, -7.906644052019278e-13, "-7.906644E-13", "%E", -__LINE__, -7.908090440678874e-20, "-7.90809E-20", "%#G", -__LINE__, -7.917588593012283e+08, "-7.917589E+08", "%+E", -__LINE__, -7.929100086742454e+29, "-792910008674245414539427656563.930213", "%f", -__LINE__, -7.933235286034290e+26, "-7.933235E+26", "%E", -__LINE__, -7.943431966567875e-03, "-0.0079434", "%+.5g", -__LINE__, -7.950872643572970e-22, "-7.95087e-22", "%2g", -__LINE__, -7.971225555313069e-01, "-0.797123", "%f", -__LINE__, -7.978310272676090e-12, "-0.000000", "%#f", -__LINE__, -8.006805393896414e-29, "-8.00681E-29", "%G", -__LINE__, -8.006906303018830e+25, "-8.00691E+25", "%+G", -__LINE__, -8.008484654476057e+18, "-8.008485e+18", "%5.6e", -__LINE__, -8.008943512904249e+27, "-8008943512904249217854157905.0943", "%+.4f", -__LINE__, -8.016539743121665e+27, "-8.01654E+27", "%G", -__LINE__, -8.018247227006128e-05, " -8E-05", "%7.G", -__LINE__, -8.044391842561705e+21, "-8.04439e+21", "%g", -__LINE__, -8.081902305002036e-02, "-8.081902E-02", "%E", -__LINE__, -8.084193011936438e-03, "-0.0080842", "%+5.5g", -__LINE__, -8.105813534846529e-27, "-0.000000", "%f", -__LINE__, -8.128116892989251e+00, "-8.12812", "%G", -__LINE__, -8.136119035731877e+05, "-8e+05", "%+0.g", -__LINE__, -8.140584224052606e+14, "-8E+14", "%5.G", -__LINE__, -8.145928897003907e+13, "-8.15E+13", "%.3G", -__LINE__, -8.164495905907508e-02, "-0.081645", "%G", -__LINE__, -8.169602113313905e+20, "-8.16960e+20", "%#g", -__LINE__, -8.179181640418333e+24, "-8.E+24", "%#.1G", -__LINE__, -8.184324492264231e-18, "-8.18432E-18", "%G", -__LINE__, -8.186480473850516e-28, "-0.000000", "%+f", -__LINE__, -8.196858948158896e+07, "-8.1969E+07", "%.4E", -__LINE__, -8.213138534699043e-30, "-0.000000", "%f", -__LINE__, -8.221181368676532e-21, "-8.221181E-21", "%#1E", -__LINE__, -8.222605734191438e+16, "-8.22261E+16", "%+G", -__LINE__, -8.223925661091432e-14, "-8.223926e-14", "%0e", -__LINE__, -8.232281541044777e-01, "-0.823228", "%f", -__LINE__, -8.245536794508725e+22, "-8E+22", "%6.G", -__LINE__, -8.270687365305925e+25, "-82706873653059247430974210.146815", "%f", -__LINE__, -8.288978945738204e+11, "-8.28898e+11", "%5g", -__LINE__, -8.290628698333139e+02, "-829.063", "%+G", -__LINE__, -8.292416206056451e-16, "-8.29242e-16", "%+g", -__LINE__, -8.296322623746486e-13, "-8.29632E-13", "%0.6G", -__LINE__, -8.298321941376933e-16, "-0.000000", "%+f", -__LINE__, -8.302331258878365e+29, "-8.30233E+29", "%0G", -__LINE__, -8.309022429255061e+06, "-8309022.429255", "%+f", -__LINE__, -8.312786829254646e-23, "-8.312787e-23", "%e", -__LINE__, -8.313852965178063e-15, "-8.313853e-15", "%#7e", -__LINE__, -8.317529094827869e+16, "-8.31753E+16", "%2G", -__LINE__, -8.322847660882248e-17, "-0.000000", "%f", -__LINE__, -8.324060602752638e-30, "-8.32406e-30", "%#g", -__LINE__, -8.325043500735461e+27, "-8325043500735461066142306663.095951", "%#f", -__LINE__, -8.332432016286935e-02, "-0.0833243", "%g", -__LINE__, -8.334251670232117e-09, "-8.33425e-09", "%g", -__LINE__, -8.338076225141778e+02, "-833.808", "%g", -__LINE__, -8.338349587571534e-23, "-8.33835e-23", "%+2g", -__LINE__, -8.342420812231939e+23, "-834242081223193920891390.00745", "%+0.5f", -__LINE__, -8.347404637940894e+17, "-8.347405e+17", "%+e", -__LINE__, -8.367002601133880e-12, "-0.000000", "%#2.6f", -__LINE__, -8.368579538210858e-17, "-8.36858e-17", "%5g", -__LINE__, -8.392398522472401e-10, "-0.0000", "%.4f", -__LINE__, -8.393029677635258e-29, " -8E-29", "%7.G", -__LINE__, -8.393843230819225e-11, "-8.393843E-11", "%E", -__LINE__, -8.397239871789148e-11, "-8.39724e-11", "%g", -__LINE__, -8.402316358199041e-29, "-0.000", "%3.3f", -__LINE__, -8.402910159034304e-14, "-8.4e-14", "%+0.3g", -__LINE__, -8.414960962391726e+09, "-8414960962.391726", "%#f", -__LINE__, -8.417512471384889e-28, "-8.417512e-28", "%e", -__LINE__, -8.418719240222911e+21, "-8418719240222911182058.851409", "%f", -__LINE__, -8.421210956044195e-09, "-0.00000", "%.5f", -__LINE__, -8.422001733529095e+24, "-8E+24", "%0.G", -__LINE__, -8.443614453772469e+21, "-8.44361E+21", "%+G", -__LINE__, -8.445883044175737e-19, "-0", "%+1.f", -__LINE__, -8.460545304711022e-01, "-0.846055", "%G", -__LINE__, -8.470462532754567e+12, "-8.47E+12", "%6.3G", -__LINE__, -8.478488782426476e-07, "-8.478489E-07", "%E", -__LINE__, -8.478657582923923e+09, "-8.5e+09", "%.2g", -__LINE__, -8.482732098043366e+12, "-8482732098043", "%5.f", -__LINE__, -8.489112373854447e+07, "-8.489e+07", "%#3.3e", -__LINE__, -8.494153144629106e+02, "-849.415", "%+g", -__LINE__, -8.496331191616493e+28, "-8E+28", "%+6.G", -__LINE__, -8.503711894495339e+05, "-850371", "%g", -__LINE__, -8.505271893964268e+14, "-8.505272E+14", "%E", -__LINE__, -8.509873985358741e+15, "-9.e+15", "%#7.g", -__LINE__, -8.518336897898081e-20, "-8.51834E-20", "%G", -__LINE__, -8.529588044136128e+21, "-8.529588E+21", "%E", -__LINE__, -8.539706586811079e-23, "-8.53971E-23", "%G", -__LINE__, -8.545924619642008e+10, "-8.545925e+10", "%6e", -__LINE__, -8.572893681637353e+09, "-8.57289E+09", "%G", -__LINE__, -8.585483717692345e+29, "-8.58548E+29", "%+G", -__LINE__, -8.586092014292309e+27, "-8.59e+27", "%.2e", -__LINE__, -8.604716827086833e-26, "-8.60472e-26", "%g", -__LINE__, -8.621349224186615e-04, "-0.000862", "%f", -__LINE__, -8.626097065201103e-21, " -0", "%5.f", -__LINE__, -8.631700514212522e-16, "-8.631701E-16", "%+E", -__LINE__, -8.634703359975640e-09, "-0.000000", "%+5f", -__LINE__, -8.639393025443855e-17, "-8.63939e-17", "%g", -__LINE__, -8.640641942556812e-11, "-8.64064e-11", "%#g", -__LINE__, -8.646260250525495e-09, "-0.000", "%.3f", -__LINE__, -8.667322015806242e+09, "-8667322015.806242", "%+#f", -__LINE__, -8.690705655554451e+10, "-8.690706E+10", "%#E", -__LINE__, -8.714299893763934e-07, "-8.7143E-07", "%.5G", -__LINE__, -8.715729756264988e+27, "-8.71573E+27", "%+.6G", -__LINE__, -8.716518487180945e+16, "-9e+16", "%3.e", -__LINE__, -8.744404488756237e+25, "-87444044887562366596966967.335902", "%4f", -__LINE__, -8.754720498369242e+13, "-8.75472e+13", "%g", -__LINE__, -8.763198097931010e-19, "-8.76320e-19", "%#g", -__LINE__, -8.779007408852458e+28, "-8.77901E+28", "%G", -__LINE__, -8.794576202907937e+11, "-8.79458E+11", "%#2.6G", -__LINE__, -8.799091520612418e-11, "-8.799E-11", "%3.4G", -__LINE__, -8.799246265524921e+11, "-8.79925E+11", "%G", -__LINE__, -8.809010508550436e-04, "-8.8090E-04", "%.4E", -__LINE__, -8.817389999872653e-10, "-8.81739e-10", "%g", -__LINE__, -8.842022428985267e-28, "-8.842022E-28", "%E", -__LINE__, -8.851265987586864e-07, "-0.000001", "%f", -__LINE__, -8.861985131432196e+03, "-8861.985", "%+.7G", -__LINE__, -8.874449013455113e-29, "-8.874449e-29", "%e", -__LINE__, -8.878752609483453e+18, "-8.87875E+18", "%G", -__LINE__, -8.882501665315313e-04, "-0.00088825", "%+G", -__LINE__, -8.892056241505784e-14, "-8.89206E-14", "%G", -__LINE__, -8.895327674961603e-30, "-8.89533E-30", "%G", -__LINE__, -8.900059462213669e-30, "-8.900059E-30", "%+#E", -__LINE__, -8.957100548759815e+18, "-9e+18", "%3.0e", -__LINE__, -8.961352369869012e-30, "-8.961352e-30", "%+#2e", -__LINE__, -8.962296474587800e+02, "-896", "%4.f", -__LINE__, -8.962536469328530e-12, "-8.96254E-12", "%G", -__LINE__, -8.963299420391932e+21, "-8.9633e+21", "%g", -__LINE__, -8.967736672941522e-11, "-8.96774e-11", "%g", -__LINE__, -8.994077362462679e+11, "-8.9940774e+11", "%+#.7e", -__LINE__, -9.000452862345622e+15, "-9e+15", "%2.e", -__LINE__, -9.007489135361462e+07, "-9.0075E+07", "%+2.4E", -__LINE__, -9.036271805879910e+16, "-9.03627E+16", "%G", -__LINE__, -9.036319073700248e+22, "-9.03632e+22", "%1g", -__LINE__, -9.043207635989237e+11, "-9.043208e+11", "%#e", -__LINE__, -9.043856598625815e-26, "-9e-26", "%+1.g", -__LINE__, -9.052760561065698e+14, "-9.052761E+14", "%E", -__LINE__, -9.066480297957160e-06, "-9E-06", "%+1.G", -__LINE__, -9.070971376440752e-01, "-0.907097", "%g", -__LINE__, -9.073301831888273e+09, "-9.07330E+09", "%#G", -__LINE__, -9.091228662702147e+28, "-9E+28", "%4.G", -__LINE__, -9.093652024983832e+04, "-9.093652E+04", "%7.6E", -__LINE__, -9.098945831139295e-04, "-9.098946E-04", "%+1.6E", -__LINE__, -9.124981449916591e+05, "-912498", "%G", -__LINE__, -9.132038703003394e-02, "-0.0913204", "%#G", -__LINE__, -9.138271437433964e-04, "-0.000913827", "%5g", -__LINE__, -9.158186427463699e-04, "-0.000915819", "%g", -__LINE__, -9.160846358172526e+16, "-9.160846E+16", "%#E", -__LINE__, -9.160884330810163e+17, "-9E+17", "%+5.G", -__LINE__, -9.190271387375542e+21, "-9.19027e+21", "%+g", -__LINE__, -9.191651872412619e-04, "-9.191652E-04", "%E", -__LINE__, -9.196426161984341e-10, "-9E-10", "%4.G", -__LINE__, -9.201074139774962e+09, "-9E+09", "%4.G", -__LINE__, -9.223294284802762e+09, "-9.22329E+09", "%G", -__LINE__, -9.224740266754996e+02, "-9E+02", "%6.0G", -__LINE__, -9.231583780512302e-01, " -0.9", "%6.g", -__LINE__, -9.241998826543689e+07, "-92419988", "%1.f", -__LINE__, -9.243603351372128e+27, "-9.243603e+27", "%#e", -__LINE__, -9.255922697415071e+11, "-9.25592e+11", "%g", -__LINE__, -9.265734968114124e-02, "-0.092657", "%f", -__LINE__, -9.273132068521061e+11, "-9.27313E+11", "%G", -__LINE__, -9.276017912826685e+27, "-9.E+27", "%+#5.G", -__LINE__, -9.279781279788505e+17, "-9.27978E+17", "%7G", -__LINE__, -9.305057549822465e-19, "-9.30506E-19", "%5G", -__LINE__, -9.313182384508469e+18, "-9.31318E+18", "%G", -__LINE__, -9.313350925182641e-12, "-9.31E-12", "%.3G", -__LINE__, -9.362202657509130e+08, "-9e+08", "%.1g", -__LINE__, -9.367344757598381e+19, "-9.36734e+19", "%g", -__LINE__, -9.374222399774300e+26, "-9.37422e+26", "%4g", -__LINE__, -9.385734023305105e+02, "-9.385734e+02", "%+0e", -__LINE__, -9.392042570618909e+17, "-9.39204E+17", "%G", -__LINE__, -9.395742939311926e+20, "-939574293931192627837.8451", "%.4f", -__LINE__, -9.409066155962469e+09, "-9.40907E+09", "%#G", -__LINE__, -9.412851077799790e+23, "-9.412851E+23", "%E", -__LINE__, -9.431808019049818e+08, "-9.43181e+08", "%g", -__LINE__, -9.465236900519924e-27, "-9.46524e-27", "%g", -__LINE__, -9.478330386415852e+17, "-9.478330e+17", "%e", -__LINE__, -9.510393719697428e+15, "-9.51039E+15", "%+G", -__LINE__, -9.534229599909890e-09, "-0.000000", "%f", -__LINE__, -9.541731189284823e-17, "-1.E-16", "%+#7.G", -__LINE__, -9.548861908445902e+24, "-9548861908445902102471336.547751", "%f", -__LINE__, -9.578447281451794e+14, "-957844728145179", "%5.f", -__LINE__, -9.580512736933464e+11, "-9.58051E+11", "%G", -__LINE__, -9.596838169770637e-28, "-1E-27", "%+6.G", -__LINE__, -9.597528852877852e-22, "-1e-21", "%2.1g", -__LINE__, -9.599943658427051e+02, "-9.599944E+02", "%E", -__LINE__, -9.603227991185260e-14, "-1E-13", "%+0.E", -__LINE__, -9.606818733892343e+08, "-960681873.389", "%1.3f", -__LINE__, -9.617442692720937e+16, "-9.61744E+16", "%G", -__LINE__, -9.628685516961109e+29, "-9.62869e+29", "%3g", -__LINE__, -9.638354750455226e-11, "-0.000000", "%f", -__LINE__, -9.644266379029137e+16, "-96442663790291369.707575", "%f", -__LINE__, -9.645563533575482e+06, "-1E+07", "%1.G", -__LINE__, -9.645993536742941e-29, "-9.64599e-29", "%+g", -__LINE__, -9.647147223548563e+00, "-9.647147e+00", "%e", -__LINE__, -9.671225879906396e-11, "-0", "%0.f", -__LINE__, -9.675000471729906e-09, "-9.675000E-09", "%E", -__LINE__, -9.683992878297159e-26, "-9.68e-26", "%2.2e", -__LINE__, -9.695491325144765e+10, "-9.69549E+10", "%#G", -__LINE__, -9.695661526907136e-24, " -0.", "%#6.f", -__LINE__, -9.703124881970338e+07, "-9.703e+07", "%0.4g", -__LINE__, -9.707701257031864e+26, "-970770125703186437249314622.022212", "%f", -__LINE__, -9.709879792694702e+09, "-9.709880E+09", "%E", -__LINE__, -9.736052226907940e+26, "-9.73605e+26", "%+#g", -__LINE__, -9.745037157520795e+07, "-9.74504e+07", "%#5.6g", -__LINE__, -9.757293950670832e-29, "-9.757E-29", "%0.4G", -__LINE__, -9.762126832689880e+12, "-9.76213E+12", "%G", -__LINE__, -9.801328150341989e-01, " -1", "%7.G", -__LINE__, -9.837332964629669e-20, "-9.83733E-20", "%0G", -__LINE__, -9.837790327283010e+23, "-1E+24", "%.1G", -__LINE__, -9.839636176463729e+23, "-9.83964E+23", "%#6.5E", -__LINE__, -9.841454250618272e+11, "-9.84E+11", "%+2.3G", -__LINE__, -9.852920805249280e-12, "-9.852921e-12", "%.7g", -__LINE__, -9.854092850182351e+12, "-9.85409e+12", "%0g", -__LINE__, -9.866796026839712e+02, "-9.9E+02", "%#.1E", -__LINE__, -9.867413260289803e-21, "-1e-20", "%.1g", -__LINE__, -9.882136052131983e-08, "-9.88214e-08", "%g", -__LINE__, -9.882755697941866e+20, "-9.882756E+20", "%E", -__LINE__, -9.897275811087050e+20, "-9.9E+20", "%0.3G", -__LINE__, -9.899860651812364e-04, "-9.899861e-04", "%e", -__LINE__, -9.906754113555550e-11, "-9.90675e-11", "%3g", -__LINE__, -9.926067557389940e+11, "-9.92607E+11", "%G", -__LINE__, -9.929638609014063e+17, "-992963860901406292.214233", "%1f", -__LINE__, -9.941214552193284e-24, "-0.000000", "%+#f", -__LINE__, -9.942875240256573e+14, "-9.942875e+14", "%+1e", -__LINE__, -9.944492909695798e-01, "-9.944E-01", "%.3E", -__LINE__, -9.954710507359939e-27, "-1e-26", "%+0.2g", -__LINE__, -9.955410507742851e+03, "-9955.41", "%+G", -__LINE__, -9.974437672251590e+02, "-997.444", "%#G", -__LINE__, -9.975683165288929e-26, "-9.97568E-26", "%6G", -__LINE__, 1.003827370583415e+06, "1003827.370583", "%3f", -__LINE__, 1.004189065268560e-27, "1.004189E-27", "%.7G", -__LINE__, 1.005840059175462e-28, "+1.00584E-28", "%+G", -__LINE__, 1.006586790090557e-12, "0.000000", "%#f", -__LINE__, 1.007598594773359e+18, "1.0076E+18", "%G", -__LINE__, 1.007902307001894e+29, "1.0079e+29", "%g", -__LINE__, 1.008607405036580e-15, "1.00861E-15", "%6G", -__LINE__, 1.008769102466771e+16, "+1.00877E+16", "%+G", -__LINE__, 1.009545698372534e-08, "+1E-08", "%+0.0G", -__LINE__, 1.010173673945099e-12, "+1.01017e-12", "%+#0g", -__LINE__, 1.011375000606627e+09, "1011375000.606627", "%f", -__LINE__, 1.011944652221650e+15, "1011944652221649.98", "%3.2f", -__LINE__, 1.013057788090379e-21, "0.000000", "%#f", -__LINE__, 1.014525729953198e+15, "1.01453e+15", "%3g", -__LINE__, 1.016760538234615e-21, "+1.016761E-21", "%+3E", -__LINE__, 1.017052611781237e-29, "0.000000", "%f", -__LINE__, 1.018471223361229e+14, "1.01847E+14", "%G", -__LINE__, 1.021646959220873e+15, "1021646959220872.6", "%4.1f", -__LINE__, 1.022304833976590e+27, "1.0223e+27", "%g", -__LINE__, 1.022500312067325e-12, "1.0225e-12", "%6g", -__LINE__, 1.023019285462627e-20, "0.000000", "%f", -__LINE__, 1.024192579400824e+06, "1.02419e+06", "%g", -__LINE__, 1.024517953555766e-28, "1.02452E-28", "%G", -__LINE__, 1.026673589339585e+21, "1.02667E+21", "%G", -__LINE__, 1.027231090958880e-19, "1.E-19", "%#3.G", -__LINE__, 1.028249904956487e-27, "1E-27", "%5.G", -__LINE__, 1.028570144661448e-28, "+1.02857E-28", "%+G", -__LINE__, 1.028934898454705e-13, "+1.028935E-13", "%+E", -__LINE__, 1.029071053545906e-26, "1.029071E-26", "%E", -__LINE__, 1.032672895881148e-30, "+1.032673E-30", "%+E", -__LINE__, 1.033502358979511e+06, "1.0335E+06", "%.5G", -__LINE__, 1.036790427717847e+19, "1e+19", "%4.g", -__LINE__, 1.037022928821648e+03, "1037.02", "%5g", -__LINE__, 1.040551683941284e+14, "1.04055E+14", "%G", -__LINE__, 1.044499252101308e-17, "1.044499E-17", "%E", -__LINE__, 1.045791899570889e+15, "+1.04579e+15", "%+g", -__LINE__, 1.048730383198703e+28, "1.049e+28", "%.4g", -__LINE__, 1.050654419882509e-18, "0.000000", "%f", -__LINE__, 1.052600569262127e-27, "+0.000", "%+2.3f", -__LINE__, 1.053213014784149e+15, "1E+15", "%4.G", -__LINE__, 1.057553916225948e-15, "+0.000000", "%+4f", -__LINE__, 1.058191244482453e+19, "1.058e+19", "%.3e", -__LINE__, 1.058746269793972e-26, "+1.1E-26", "%+.2G", -__LINE__, 1.058793271960762e-01, "+1.058793E-01", "%+4E", -__LINE__, 1.058869592738370e-19, "1.05887e-19", "%3g", -__LINE__, 1.060402312803008e+15, "1060402312803008.229025", "%f", -__LINE__, 1.061106284763095e+00, "1.061106", "%0f", -__LINE__, 1.061180160987467e+09, "1e+09", "%2.g", -__LINE__, 1.061181537176067e-06, "+1.06118e-06", "%+g", -__LINE__, 1.065021381771174e+20, "1.06502e+20", "%g", -__LINE__, 1.065464040401130e-16, "1.065464e-16", "%e", -__LINE__, 1.065573419819459e-05, "0.00001", "%.5f", -__LINE__, 1.066107764306644e+13, "1.066108e+13", "%#e", -__LINE__, 1.071318759598956e+12, "1.071319e+12", "%e", -__LINE__, 1.071564727222321e+10, "1.072E+10", "%3.4G", -__LINE__, 1.074652481218139e+14, "1.0747E+14", "%.4E", -__LINE__, 1.078453684911309e-02, "0.0107845", "%g", -__LINE__, 1.078550811446675e-05, "1.07855e-05", "%g", -__LINE__, 1.078780494515273e-04, "0.000107878", "%4G", -__LINE__, 1.079467488876157e-16, "+1.079467E-16", "%+E", -__LINE__, 1.080529722917934e-20, "0.000000", "%f", -__LINE__, 1.082169127709439e+01, "10.8217", "%#5g", -__LINE__, 1.087241285590951e+22, "1E+22", "%4.G", -__LINE__, 1.091049208406195e-14, "0.0000", "%.4f", -__LINE__, 1.095316064213237e+16, "+1e+16", "%+0.g", -__LINE__, 1.095349083237975e-04, "1.095349e-04", "%5e", -__LINE__, 1.098002465452836e+12, "1098002465452.836205", "%f", -__LINE__, 1.098445764138997e+13, "1.09845E+13", "%G", -__LINE__, 1.099968047892474e-13, "1.1e-13", "%2.5g", -__LINE__, 1.101017598311363e-04, "0.000110102", "%G", -__LINE__, 1.102776332077817e+18, "1.103e+18", "%.3e", -__LINE__, 1.103734053887830e-01, "0.110373", "%f", -__LINE__, 1.105730106869006e-03, "0.00110573", "%g", -__LINE__, 1.106366781854058e-10, "1.10637e-10", "%g", -__LINE__, 1.107354763213839e+15, "1.107355e+15", "%6e", -__LINE__, 1.108151709609825e-10, "+1.10815E-10", "%+G", -__LINE__, 1.110054501993647e+21, "+1.11005E+21", "%+G", -__LINE__, 1.111574814737873e-17, "+1.112E-17", "%+1.4G", -__LINE__, 1.111865512360108e-15, "1E-15", "%.0G", -__LINE__, 1.112281568330498e-03, "1.112282e-03", "%.6e", -__LINE__, 1.112625415174238e+21, "+1.11263e+21", "%+g", -__LINE__, 1.112744974910395e-02, "0.011127", "%f", -__LINE__, 1.114726566979885e-10, "1.11473e-10", "%g", -__LINE__, 1.115395843055731e-20, "+0.000000", "%+6f", -__LINE__, 1.115983414693121e+15, "1.11598e+15", "%5.6g", -__LINE__, 1.116118842074266e+27, "1.116119e+27", "%e", -__LINE__, 1.118386983012328e+19, "11183869830123276400.968280", "%1f", -__LINE__, 1.119344607892718e-22, "1.119345e-22", "%e", -__LINE__, 1.120560837110279e-19, "0.000000", "%f", -__LINE__, 1.123620157906291e-02, "0.0112362", "%G", -__LINE__, 1.126804857639478e+29, "1.1268E+29", "%#0.5G", -__LINE__, 1.128962199461581e+11, "1.12896e+11", "%g", -__LINE__, 1.129878714246809e-16, "1E-16", "%0.0G", -__LINE__, 1.130331982972407e-06, "+0.", "%+#1.f", -__LINE__, 1.134167332070028e-16, "0", "%0.0f", -__LINE__, 1.134248080053598e-28, "0.000000", "%f", -__LINE__, 1.136023160708119e-10, "+0.000000", "%+1f", -__LINE__, 1.136167141059036e+23, "113616714105903593434732.101741", "%f", -__LINE__, 1.136439499920164e+10, "+1.13644E+10", "%+G", -__LINE__, 1.136859734932182e+24, "1.13686e+24", "%g", -__LINE__, 1.138985939448731e+09, "1.13899e+09", "%2g", -__LINE__, 1.139287324790407e-25, "1e-25", "%.1g", -__LINE__, 1.140559912153251e+06, "1.14056e+06", "%g", -__LINE__, 1.141318036027086e-26, "1.14132E-26", "%G", -__LINE__, 1.142586049368452e-20, "+1.14259E-20", "%+7.5E", -__LINE__, 1.143283863993333e-17, "1.143284E-17", "%3E", -__LINE__, 1.144637911632432e-28, "1.144638E-28", "%#3E", -__LINE__, 1.145791416532065e-10, "1.14579e-10", "%g", -__LINE__, 1.146958047315780e-17, "1.146958e-17", "%e", -__LINE__, 1.147898346886569e-08, "1E-08", "%3.0E", -__LINE__, 1.149724744965608e-14, "1.14972e-14", "%5g", -__LINE__, 1.155383721940441e-10, "1e-10", "%1.g", -__LINE__, 1.157066617729094e-02, "0", "%1.f", -__LINE__, 1.157893614537215e+05, "1.157894E+05", "%E", -__LINE__, 1.160476344451928e-19, "1.2e-19", "%.1e", -__LINE__, 1.161610499315966e-26, "1.161610E-26", "%E", -__LINE__, 1.162345042181490e+29, "116234504218148981813385489658.685401", "%5.6f", -__LINE__, 1.162376053722862e+23, "1.16238e+23", "%g", -__LINE__, 1.162996084782483e+18, "+1e+18", "%+0.g", -__LINE__, 1.163544861478966e+26, "1.16354E+26", "%G", -__LINE__, 1.167300137450931e+06, "1E+06", "%.0G", -__LINE__, 1.168693829096401e-30, "+1.16869e-30", "%+g", -__LINE__, 1.172791369381396e+15, "1.173E+15", "%.4G", -__LINE__, 1.174427110782028e-29, " 1E-29", "%7.G", -__LINE__, 1.179498322112450e+27, "1179498322112449759657692993.641831", "%f", -__LINE__, 1.179555606293547e+27, "1.17956e+27", "%3g", -__LINE__, 1.180815814881269e+06, "1.180816e+06", "%e", -__LINE__, 1.181494870072805e+20, "1.181495e+20", "%5e", -__LINE__, 1.181524119225619e+12, "+1181524119225.61917", "%+5.5f", -__LINE__, 1.182111212289243e-20, "1e-20", "%4.g", -__LINE__, 1.184503315019769e-27, "1.1845e-27", "%7g", -__LINE__, 1.186413646767670e+29, "1.18641e+29", "%g", -__LINE__, 1.186852938885004e-13, "1.18685e-13", "%4g", -__LINE__, 1.188837612473914e+05, "1e+05", "%.0g", -__LINE__, 1.190317482928293e-29, "1.190317e-29", "%e", -__LINE__, 1.190527491143987e+02, "1.190527E+02", "%E", -__LINE__, 1.191823062060233e-30, "1.2E-30", "%6.2G", -__LINE__, 1.191926974812428e-23, "1.2e-23", "%.2g", -__LINE__, 1.193549622366544e-25, "1E-25", "%4.1G", -__LINE__, 1.195517368629765e-21, "1.195517e-21", "%1.7g", -__LINE__, 1.195573061651289e-27, "1.19557e-27", "%#g", -__LINE__, 1.195806681188325e-03, "+0.00120", "%+#.3G", -__LINE__, 1.196842275192189e-28, "1.19684e-28", "%g", -__LINE__, 1.197307550969576e+04, "1.1973E+04", "%.4E", -__LINE__, 1.197608525847607e+15, "1197608525847606.8062805", "%4.7f", -__LINE__, 1.197801338159407e+04, "11978", "%5G", -__LINE__, 1.197813329735025e+27, "1.19781E+27", "%7G", -__LINE__, 1.199483904123253e-12, "1.19948e-12", "%g", -__LINE__, 1.199535292169766e-09, "1.199535e-09", "%e", -__LINE__, 1.201478067515135e+05, "120147.806752", "%f", -__LINE__, 1.202054662662158e+17, "1.20205E+17", "%#G", -__LINE__, 1.202111922368321e+07, "+1.202112E+07", "%+#E", -__LINE__, 1.202536892743791e-01, "0.120254", "%#g", -__LINE__, 1.205698674119882e-29, "1.2057E-29", "%G", -__LINE__, 1.208091664701942e-13, " 0.", "%#3.f", -__LINE__, 1.208942413954872e-17, "1.20894E-17", "%G", -__LINE__, 1.209704891496613e+10, "1.210e+10", "%2.3e", -__LINE__, 1.211355639334831e+29, "1E+29", "%.0G", -__LINE__, 1.211447553804203e+17, " 1E+17", "%7.E", -__LINE__, 1.212481583429790e-16, "1.212482e-16", "%e", -__LINE__, 1.212849001551862e+26, "121284900155186181613942153.4899157", "%6.7f", -__LINE__, 1.213057538677801e+06, "1213057.538678", "%#.6f", -__LINE__, 1.214609592911893e+25, "1.214610e+25", "%#e", -__LINE__, 1.216086266251665e+01, "1e+01", "%5.e", -__LINE__, 1.216468565931026e-22, "1.216469E-22", "%1E", -__LINE__, 1.216503126598765e+14, "+1E+14", "%+0.E", -__LINE__, 1.216641013695553e-14, "0.000000", "%f", -__LINE__, 1.223142246779504e-23, "0.000000", "%f", -__LINE__, 1.223884786443274e+08, "122388479", "%5.f", -__LINE__, 1.224012562770076e+29, "1.22401e+29", "%0g", -__LINE__, 1.225098157528297e+14, "1.22510e+14", "%#g", -__LINE__, 1.226306848505242e-22, "1.22631E-22", "%G", -__LINE__, 1.227487485547996e-08, "+1.22749e-08", "%+g", -__LINE__, 1.237206486909689e+02, "+123.721", "%+#.6g", -__LINE__, 1.240281126177077e-02, "+0.01", "%+3.g", -__LINE__, 1.241197211306994e-06, "1.241197E-06", "%E", -__LINE__, 1.241776311097410e+07, "1.241776E+07", "%E", -__LINE__, 1.245995986024999e-03, "0.001246", "%g", -__LINE__, 1.246082428199607e+03, "1246.082428", "%f", -__LINE__, 1.247021567954220e+05, " 1e+05", "%7.g", -__LINE__, 1.248140089618390e-30, "+1.24814E-30", "%+G", -__LINE__, 1.248403361652064e-30, "+0.000000", "%+f", -__LINE__, 1.251098538918842e-26, "+1.251099E-26", "%+E", -__LINE__, 1.251952633022061e+25, "1.25195e+25", "%g", -__LINE__, 1.253029705843461e-04, "+1.E-04", "%+#4.E", -__LINE__, 1.259562132729488e-09, "1e-09", "%1.e", -__LINE__, 1.261702205492260e-27, "0.000000", "%f", -__LINE__, 1.265910361926660e-19, "+1.265910e-19", "%+e", -__LINE__, 1.267411912651087e+12, "1.26741E+12", "%1G", -__LINE__, 1.267830718285980e-10, "1.26783e-10", "%g", -__LINE__, 1.268238378987517e-23, "1E-23", "%5.E", -__LINE__, 1.275543253354167e+10, "1.27554E+10", "%G", -__LINE__, 1.277255234454465e-10, "1.27726E-10", "%5G", -__LINE__, 1.280590949834150e-21, "1.280591E-21", "%E", -__LINE__, 1.285570453788242e-02, "1.285570E-02", "%E", -__LINE__, 1.287712130719031e+09, "1287712130.719031", "%#f", -__LINE__, 1.290142876187105e+29, "+1.290143E+29", "%+E", -__LINE__, 1.293129213191961e+21, "1.29313E+21", "%G", -__LINE__, 1.293317101334714e-23, "+0.000000", "%+f", -__LINE__, 1.294506813069071e-13, "0.0", "%3.1f", -__LINE__, 1.295576232685739e-22, "+0.000000", "%+f", -__LINE__, 1.296010470431800e-19, "+0.000000", "%+6f", -__LINE__, 1.298798231947674e+19, "1.2988E+19", "%2G", -__LINE__, 1.299521114379381e+09, "1.29952E+09", "%G", -__LINE__, 1.299847637892712e+24, "1.299848e+24", "%e", -__LINE__, 1.301269777843698e+29, "130126977784369834978406288428.232074", "%f", -__LINE__, 1.302911786437618e-15, " 0", "%6.f", -__LINE__, 1.303863159906719e+27, "1303863159906719415559450681", "%0.f", -__LINE__, 1.304396472326846e-12, "+1E-12", "%+1.0G", -__LINE__, 1.306180443528427e-30, "+1e-30", "%+.1g", -__LINE__, 1.308469138968514e+22, "1.30847E+22", "%0G", -__LINE__, 1.312700156826057e-11, "1.3127e-11", "%g", -__LINE__, 1.315364075120764e+21, "+1.31536E+21", "%+G", -__LINE__, 1.320376485288444e-09, "+1.3204E-09", "%+6.5G", -__LINE__, 1.321434154364635e-08, "1.32143e-08", "%1g", -__LINE__, 1.322777272579176e+19, "+1e+19", "%+3.e", -__LINE__, 1.322861663428564e+00, "1.322862E+00", "%#E", -__LINE__, 1.323566013489230e+14, "+1.323566E+14", "%+1E", -__LINE__, 1.327446904132973e-20, "+1.32745E-20", "%+4.6G", -__LINE__, 1.328226362528158e+19, "1e+19", "%2.g", -__LINE__, 1.329167460803610e+08, "1e+08", "%3.g", -__LINE__, 1.335371420823160e+14, "1.33537E+14", "%7G", -__LINE__, 1.336116185095935e-21, "0.000000", "%f", -__LINE__, 1.338766774704671e-22, "+1.33877e-22", "%+g", -__LINE__, 1.339199373014647e-12, "1E-12", "%1.E", -__LINE__, 1.344293357481519e+26, "134429335748151945750805680.290796", "%#2f", -__LINE__, 1.344328188122843e+29, "1.34433e+29", "%g", -__LINE__, 1.344382581316972e-05, "1E-05", "%5.0E", -__LINE__, 1.349835616116184e+11, "134983561611.6", "%2.1f", -__LINE__, 1.349955669989707e+20, "134995566998970728533.890906", "%7f", -__LINE__, 1.350230411093841e+20, "135023041109384145386.229648", "%f", -__LINE__, 1.353391369565576e+10, " 1E+10", "%7.1G", -__LINE__, 1.356889483699471e+22, "+1.35689E+22", "%+G", -__LINE__, 1.358141775798243e+24, "+1358141775798242578687791.137781", "%+f", -__LINE__, 1.358547541975523e-15, "1.35855e-15", "%g", -__LINE__, 1.363402539800791e+11, "1.3634E+11", "%G", -__LINE__, 1.363676837988798e+16, "+13636768379887982.4053", "%+2.4f", -__LINE__, 1.364592026494839e-24, "1.36459e-24", "%g", -__LINE__, 1.366664212399413e-09, "+1E-09", "%+6.G", -__LINE__, 1.367446193117463e-17, "1.3674e-17", "%2.4e", -__LINE__, 1.368681648785823e-18, "1.36868E-18", "%3G", -__LINE__, 1.370635189583606e+05, "1.370635E+05", "%E", -__LINE__, 1.371395540772186e-18, "+1.371396e-18", "%+e", -__LINE__, 1.371945318043159e+10, "1E+10", "%0.E", -__LINE__, 1.373780604772988e-21, "1e-21", "%3.g", -__LINE__, 1.374244970441862e-28, "0.000000", "%7.6f", -__LINE__, 1.375874695067149e-25, "1.37587E-25", "%#3G", -__LINE__, 1.377165614832621e+20, "1.37717E+20", "%#G", -__LINE__, 1.381541864946684e-09, "1.38154E-09", "%G", -__LINE__, 1.382901694835415e+00, "1.382902E+00", "%E", -__LINE__, 1.384250577530184e-21, "1.384e-21", "%.4g", -__LINE__, 1.385322753374640e-03, " 1E-03", "%6.E", -__LINE__, 1.387026156054724e+19, "1.387026E+19", "%E", -__LINE__, 1.388726735790498e-27, "+1.388727E-27", "%+E", -__LINE__, 1.388819105742044e+16, "1.38882e+16", "%g", -__LINE__, 1.389941086024951e-19, "0.000000", "%f", -__LINE__, 1.390101174785536e+25, "1.3901E+25", "%G", -__LINE__, 1.392210785638597e+24, "+1.39221E+24", "%+G", -__LINE__, 1.396148856283474e-26, "1.4e-26", "%7.3g", -__LINE__, 1.398153728631994e-21, "1.39815E-21", "%G", -__LINE__, 1.398332446762342e-14, "+1.39833E-14", "%+5G", -__LINE__, 1.400250919607987e+10, "1.40025E+10", "%G", -__LINE__, 1.400662469019739e+03, "1.E+03", "%#0.0E", -__LINE__, 1.401720273747805e-12, "0.000000", "%#f", -__LINE__, 1.402151358748719e+22, "1.402151e+22", "%e", -__LINE__, 1.402351913752357e-28, "1.40235E-28", "%#1.6G", -__LINE__, 1.403285877973810e+13, "+14032858779738.097255", "%+4f", -__LINE__, 1.404540981735861e+04, "14045.409817", "%4f", -__LINE__, 1.406420622355064e+19, "1.40642E+19", "%G", -__LINE__, 1.412552725962301e-29, "+1e-29", "%+1.e", -__LINE__, 1.413266982485044e+10, "1.41327e+10", "%g", -__LINE__, 1.413627189411456e+21, "1.41363E+21", "%0G", -__LINE__, 1.416647216002592e-25, "+0.000000", "%+#f", -__LINE__, 1.417107155080584e-10, "1e-10", "%1.e", -__LINE__, 1.418829895346648e+19, "14188298953466484952.912197", "%f", -__LINE__, 1.419404559267523e-11, "1.4194e-11", "%g", -__LINE__, 1.422421321425472e+15, "1.422421E+15", "%E", -__LINE__, 1.424858902008998e+18, "1.42486E+18", "%2.5E", -__LINE__, 1.428863051254205e+22, "1.428863e+22", "%e", -__LINE__, 1.429533727936725e-02, "0.0142953", "%g", -__LINE__, 1.430982219743369e-19, " 1E-19", "%6.G", -__LINE__, 1.431974118434703e+17, "1E+17", "%3.G", -__LINE__, 1.432418341970152e+16, "+1.432418e+16", "%+5e", -__LINE__, 1.433470281650523e+04, "14334.7", "%g", -__LINE__, 1.434446243424653e+24, " +1e+24", "%+7.g", -__LINE__, 1.435118019241039e+24, "+1e+24", "%+4.g", -__LINE__, 1.435691648420278e-01, "0.1435692", "%#4.7g", -__LINE__, 1.437569598098744e+27, "1.437570E+27", "%#E", -__LINE__, 1.437633484061726e-25, "+1.43763e-25", "%+7g", -__LINE__, 1.437866591230707e-13, "1.43787e-13", "%g", -__LINE__, 1.440593154445915e-01, "+0.144059", "%+1G", -__LINE__, 1.441368205977342e+16, "1.441368E+16", "%#E", -__LINE__, 1.441825266684367e+28, "1.44183e+28", "%g", -__LINE__, 1.442374183199456e+20, "1.442374E+20", "%E", -__LINE__, 1.445101893951061e-24, "0", "%0.f", -__LINE__, 1.446037835160094e-20, "+1.44604E-20", "%+2G", -__LINE__, 1.449245376093616e+04, "1.449245e+04", "%e", -__LINE__, 1.454126845620100e+09, "1.45413E+09", "%G", -__LINE__, 1.455764608801107e+09, "1.5e+09", "%6.1e", -__LINE__, 1.457176183149955e-12, "1.45718e-12", "%#g", -__LINE__, 1.458821535020046e-05, "1.45882e-05", "%#g", -__LINE__, 1.460179141161202e-19, "1.460179E-19", "%#E", -__LINE__, 1.461701055446198e-20, "1.461701e-20", "%#2.7g", -__LINE__, 1.462408181482172e+10, "1.4624082E+10", "%3.7E", -__LINE__, 1.463706296748154e+24, "1e+24", "%2.g", -__LINE__, 1.464891255780761e-19, "+1.46489e-19", "%+g", -__LINE__, 1.467903978945872e+25, "1.4679E+25", "%G", -__LINE__, 1.468585992857062e+22, "14685859928570619281629.205943", "%f", -__LINE__, 1.469803528668286e+29, "+1E+29", "%+6.G", -__LINE__, 1.469883002609266e-23, "1.E-23", "%#2.E", -__LINE__, 1.469941481858809e+08, "+146994148.185881", "%+f", -__LINE__, 1.470744493304611e+13, "1.47074e+13", "%g", -__LINE__, 1.471857261085004e+23, "1E+23", "%2.G", -__LINE__, 1.474419778873037e+06, "1474419.7789", "%#.4f", -__LINE__, 1.483134762223381e-03, "0", "%0.0f", -__LINE__, 1.483575501240724e-13, "1.48358e-13", "%g", -__LINE__, 1.486068112294452e+20, "1.486068e+20", "%e", -__LINE__, 1.488665528787761e-03, " +0", "%+4.f", -__LINE__, 1.492145267536713e+07, "14921452.675367", "%f", -__LINE__, 1.492589762884761e-01, "0.149259", "%f", -__LINE__, 1.494784286168215e+01, "1.494784E+01", "%E", -__LINE__, 1.495945331501655e+04, "1.5e+04", "%.2g", -__LINE__, 1.501383201904700e+14, "2e+14", "%1.g", -__LINE__, 1.501387105011959e-02, "0.0150139", "%g", -__LINE__, 1.505784488562271e+26, "1.50578e+26", "%5g", -__LINE__, 1.506367986495534e+10, "1.50637e+10", "%2g", -__LINE__, 1.507421710226296e+19, "1.507422E+19", "%#E", -__LINE__, 1.507960881206134e+16, "2e+16", "%.0g", -__LINE__, 1.508974301049424e+14, "+1.508974E+14", "%+E", -__LINE__, 1.509204025111090e-18, "1.509204E-18", "%E", -__LINE__, 1.511351799767759e+21, "1511351799767759462866.93397", "%.5f", -__LINE__, 1.511712197184520e-06, "+1.51171e-06", "%+1g", -__LINE__, 1.514703727491400e+02, "151.47", "%.5g", -__LINE__, 1.514855355408287e+04, "15148.6", "%g", -__LINE__, 1.516256896575301e+06, "1.516257e+06", "%.6e", -__LINE__, 1.517712083681069e+14, "1.51771e+14", "%0g", -__LINE__, 1.522102209167607e-18, "1.52210e-18", "%#g", -__LINE__, 1.526264862895663e-12, "0.000000", "%f", -__LINE__, 1.527165480858125e+10, "1.527e+10", "%.4g", -__LINE__, 1.528363280308369e+00, "+1.52836", "%+0G", -__LINE__, 1.529108490733420e-22, "1.529108E-22", "%E", -__LINE__, 1.529783364474522e+19, "15297833644745216119.531506", "%7f", -__LINE__, 1.530698363199346e-01, "0.1531", "%#.4f", -__LINE__, 1.531520796537450e+22, "1.53152E+22", "%G", -__LINE__, 1.533314559644813e+06, "+1533314.559645", "%+f", -__LINE__, 1.534682791112854e+01, "+15.3468", "%+0G", -__LINE__, 1.534714026386730e-11, "0.000000", "%f", -__LINE__, 1.537145729498115e+00, "1.537146E+00", "%E", -__LINE__, 1.538740040875751e-23, "1.538740E-23", "%E", -__LINE__, 1.546248240596482e-03, "0.001546", "%f", -__LINE__, 1.546808012239302e-09, "+1.54681E-09", "%+G", -__LINE__, 1.546903877359107e+06, "1.5e+06", "%.2g", -__LINE__, 1.550153973747718e-18, "2e-18", "%.0g", -__LINE__, 1.551703460384378e+00, "+1.5517", "%+.4f", -__LINE__, 1.553995673101369e+29, "1.554E+29", "%G", -__LINE__, 1.555477017531899e+28, "1.55548e+28", "%g", -__LINE__, 1.555548963448462e+12, "1555548963448.46227", "%6.5f", -__LINE__, 1.558702451007712e+16, "2e+16", "%5.1g", -__LINE__, 1.561641587723724e+29, "1.561642e+29", "%e", -__LINE__, 1.561868589559509e-05, "1.56187E-05", "%G", -__LINE__, 1.565229056438949e+13, "1.56523e+13", "%1.6g", -__LINE__, 1.570074406600442e+14, "+1.57007E+14", "%+4G", -__LINE__, 1.570951909913194e+13, "1.57095E+13", "%.6G", -__LINE__, 1.572186421520727e-30, "+1.57219e-30", "%+g", -__LINE__, 1.574374582066945e+12, "1.57e+12", "%5.2e", -__LINE__, 1.577789404823585e+12, "1.577789E+12", "%E", -__LINE__, 1.579641278389186e+04, "15796.413", "%7.3f", -__LINE__, 1.581602330975388e+17, "1.5816E+17", "%#.5G", -__LINE__, 1.587809692297490e-18, "+1.58781e-18", "%+2g", -__LINE__, 1.588672954832388e-05, "1.58867E-05", "%G", -__LINE__, 1.594548954259978e+25, "+1.595e+25", "%+.3e", -__LINE__, 1.596653742160718e+10, "15966537421.6072", "%.4f", -__LINE__, 1.597416186584641e+25, "1.59742e+25", "%g", -__LINE__, 1.597810706039500e-04, "0.000159781", "%g", -__LINE__, 1.601425691153542e+01, "16.0143", "%G", -__LINE__, 1.601491150913706e-15, "+1.60149e-15", "%+g", -__LINE__, 1.609357026469645e+02, "160.936", "%0g", -__LINE__, 1.611064881461188e+06, "+1.611065E+06", "%+E", -__LINE__, 1.611324319640770e-03, "0.00161132", "%G", -__LINE__, 1.613202907940803e+19, "1.6E+19", "%#.1E", -__LINE__, 1.613883500056636e-12, "0.000000", "%5f", -__LINE__, 1.618254213010772e+07, "16182542.130108", "%6f", -__LINE__, 1.620441271211248e-08, "1.62044E-08", "%0G", -__LINE__, 1.622548435024803e-01, "+0.162255", "%+5G", -__LINE__, 1.623740394555269e+19, "16237403945552689066.289531", "%3f", -__LINE__, 1.625774250389937e+18, "1.625774e+18", "%1e", -__LINE__, 1.626300864432426e-02, "0.016263", "%G", -__LINE__, 1.626351146877694e-11, "1.6263511e-11", "%2.7e", -__LINE__, 1.626568757587995e+25, "16265687575879949733348439.62220", "%6.5f", -__LINE__, 1.626717482094360e-28, "+1.626717e-28", "%+3e", -__LINE__, 1.630801585998995e-28, "1.6308e-28", "%0g", -__LINE__, 1.631827173682962e+03, "1632", "%1.4g", -__LINE__, 1.631907571243379e+18, "1631907571243378818.337533", "%f", -__LINE__, 1.632058420447239e-14, " +2E-14", "%+7.G", -__LINE__, 1.632847882621240e+18, "+1.63285E+18", "%+2G", -__LINE__, 1.637329146233172e-09, "+1.63733e-09", "%+g", -__LINE__, 1.638315287442427e-16, "+1.63832E-16", "%+G", -__LINE__, 1.641284849351445e+15, "1641284849351445.096488", "%f", -__LINE__, 1.644871927486929e+10, "2e+10", "%1.e", -__LINE__, 1.645917293047431e-19, "1.64592e-19", "%.6g", -__LINE__, 1.649201265647819e-07, "0.000000", "%f", -__LINE__, 1.650169065733559e+23, "165016906573355903731226.135278", "%3f", -__LINE__, 1.651217291298196e-30, "2E-30", "%4.G", -__LINE__, 1.652680660160331e+08, "2.e+08", "%#3.g", -__LINE__, 1.654171892948767e-15, "1.65417e-15", "%g", -__LINE__, 1.655435863725412e+17, "+1.655436e+17", "%+#e", -__LINE__, 1.656015606204101e+28, "+1.7E+28", "%+3.2G", -__LINE__, 1.656814723110478e-21, "+0.000000", "%+f", -__LINE__, 1.658632655199721e-19, "2.E-19", "%#4.G", -__LINE__, 1.659915061311444e+27, "1.66E+27", "%.3G", -__LINE__, 1.664258574522914e-29, "+1.664259E-29", "%+E", -__LINE__, 1.667662840654469e-28, "+2e-28", "%+0.g", -__LINE__, 1.673124993246863e-25, "+0.000000", "%+f", -__LINE__, 1.677788498058833e-20, "1.678e-20", "%.4g", -__LINE__, 1.681211731173386e-07, "1.68121e-07", "%0.6g", -__LINE__, 1.686341560076196e+02, "169", "%.0f", -__LINE__, 1.686507685287281e+08, "1.686508E+08", "%E", -__LINE__, 1.689500448795801e+03, "+1689.500449", "%+0f", -__LINE__, 1.690639426041009e-13, "2e-13", "%5.0g", -__LINE__, 1.691554939595928e+16, "+1.6916e+16", "%+.5g", -__LINE__, 1.698597126229626e-09, "1.699e-09", "%3.4g", -__LINE__, 1.700093083173516e+16, "17000930831735159", "%5.f", -__LINE__, 1.703653732982710e+13, "+1.70365e+13", "%+g", -__LINE__, 1.705353380573352e-16, "0.000000", "%f", -__LINE__, 1.705973328700179e-26, "1.70597e-26", "%5g", -__LINE__, 1.717797289369145e+22, "+1.717797E+22", "%+7E", -__LINE__, 1.722819196705361e-28, "1.722819E-28", "%1.7G", -__LINE__, 1.723775772891202e+01, "17.237758", "%f", -__LINE__, 1.723787102325353e-23, "0.000000", "%2f", -__LINE__, 1.724551301171870e-13, "0.000000", "%f", -__LINE__, 1.726098078655758e-20, "0.0000000", "%7.7f", -__LINE__, 1.726302822039762e+18, "+2E+18", "%+1.G", -__LINE__, 1.726659209108151e+18, "+1.72666E+18", "%+6G", -__LINE__, 1.728324925097269e-25, "1.728325e-25", "%7e", -__LINE__, 1.728357491215602e+02, "172.836", "%G", -__LINE__, 1.729612227517587e+22, "1.729612e+22", "%e", -__LINE__, 1.731753104740805e-06, "1.73175e-06", "%2g", -__LINE__, 1.736066279733589e+18, "+1.736066E+18", "%+3E", -__LINE__, 1.736626769480182e-19, "2e-19", "%.0g", -__LINE__, 1.737445267713118e-13, " 2e-13", "%7.g", -__LINE__, 1.739264683023077e+05, "173926.468302", "%f", -__LINE__, 1.739423702667596e-16, "+1.73942e-16", "%+g", -__LINE__, 1.741053616961658e-14, "1.74105E-14", "%G", -__LINE__, 1.741085952255057e+29, "1.7e+29", "%#.1e", -__LINE__, 1.743673705633426e+03, "2E+03", "%5.0G", -__LINE__, 1.750940899205665e+27, "1.75094e+27", "%g", -__LINE__, 1.753871003884151e-26, "0.", "%#.0f", -__LINE__, 1.755237470854478e-14, "1.755237e-14", "%4e", -__LINE__, 1.757491419837315e-03, "0.002", "%1.G", -__LINE__, 1.758657797688126e+26, "+1.75866E+26", "%+#G", -__LINE__, 1.760491452270889e+08, "1.76049E+08", "%G", -__LINE__, 1.760816275862939e-10, "2e-10", "%.1g", -__LINE__, 1.760905893493003e-22, "1.76e-22", "%.2e", -__LINE__, 1.762101125986743e-12, "2e-12", "%.0g", -__LINE__, 1.763855968659571e+27, "1.763856E+27", "%E", -__LINE__, 1.764595217341348e-13, "1.764595E-13", "%E", -__LINE__, 1.766737296048445e+08, "+1.77e+08", "%+.3g", -__LINE__, 1.769916386969961e-05, "+1.76992e-05", "%+g", -__LINE__, 1.773873506344176e-01, "1.773874e-01", "%e", -__LINE__, 1.775392554371421e+03, "+1775.39", "%+3.2f", -__LINE__, 1.776007623006870e+24, "1776007623006870161930237.372871", "%f", -__LINE__, 1.777418921678653e-27, " 0", "%6.f", -__LINE__, 1.780967607234234e-18, "1.780968E-18", "%E", -__LINE__, 1.782510583486435e+24, "+2e+24", "%+3.g", -__LINE__, 1.784002921603004e+14, "1.784E+14", "%G", -__LINE__, 1.784231151778382e+11, "1.7842E+11", "%.5G", -__LINE__, 1.785589091453195e+02, " 179.", "%#5.f", -__LINE__, 1.786402639400039e+19, "2e+19", "%0.g", -__LINE__, 1.786506485794647e-25, "2E-25", "%.1G", -__LINE__, 1.787513971482493e-04, "+0.000178751", "%+G", -__LINE__, 1.799765409320039e+23, "179976540932003885586710", "%6.0f", -__LINE__, 1.800451864218989e+08, "+1.80045e+08", "%+g", -__LINE__, 1.800743538258572e+04, " +18007", "%+7.f", -__LINE__, 1.801583764453362e+25, "1.8016e+25", "%0.5g", -__LINE__, 1.804502093739547e+14, "2e+14", "%2.g", -__LINE__, 1.805600104488678e-17, "1.805600E-17", "%E", -__LINE__, 1.811342448081048e+17, "1.811342e+17", "%.6e", -__LINE__, 1.812252160066930e+19, "2e+19", "%0.e", -__LINE__, 1.816287564395273e+02, "182", "%2.f", -__LINE__, 1.817097386762552e-13, "2E-13", "%3.1G", -__LINE__, 1.817881381387254e+06, "1.81788E+06", "%G", -__LINE__, 1.818416380830953e-30, "1.81842E-30", "%G", -__LINE__, 1.824788290177454e-23, "1.82479e-23", "%g", -__LINE__, 1.827832506678437e-18, "1.82783E-18", "%G", -__LINE__, 1.828048053242609e+01, "18.2805", "%g", -__LINE__, 1.828939681844203e-21, "1.82894E-21", "%.6G", -__LINE__, 1.829763900251753e+12, "1829763900251.752773", "%1f", -__LINE__, 1.833100407114602e-05, "0.000018", "%#f", -__LINE__, 1.833672780034284e-07, "1.833673e-07", "%e", -__LINE__, 1.834307692387540e+21, "2E+21", "%5.G", -__LINE__, 1.835119931666753e+14, "+1.835120e+14", "%+e", -__LINE__, 1.835956566920861e-26, "0.000000", "%#f", -__LINE__, 1.837784131899354e+22, "1.83778E+22", "%G", -__LINE__, 1.842867094224664e-09, "1.84287e-09", "%g", -__LINE__, 1.844234823805319e+28, "2E+28", "%1.G", -__LINE__, 1.844877682008962e+12, "1.84488e+12", "%g", -__LINE__, 1.846530424340488e-22, "1.846530e-22", "%#.7g", -__LINE__, 1.849111603036448e-08, "0.00", "%.2f", -__LINE__, 1.850158752678734e+04, "+18502", "%+.5G", -__LINE__, 1.851431391104701e-06, " +2e-06", "%+7.e", -__LINE__, 1.851487430609031e-04, "0.000185149", "%G", -__LINE__, 1.853171650128773e+03, "1853.17", "%G", -__LINE__, 1.854743263740068e-16, "1.854743E-16", "%6.6E", -__LINE__, 1.864399020932753e-11, "+0.000000", "%+f", -__LINE__, 1.865028568072397e-22, "1.86503E-22", "%.6G", -__LINE__, 1.868128423759223e+14, "1.86813E+14", "%4G", -__LINE__, 1.868453558435480e+21, "1.86845E+21", "%G", -__LINE__, 1.870663011627498e-06, "1.87E-06", "%.3G", -__LINE__, 1.873273487748907e+17, "+1.873273E+17", "%+E", -__LINE__, 1.878885220839805e-04, "0.000187889", "%G", -__LINE__, 1.879102515623569e+17, "1.8791e+17", "%g", -__LINE__, 1.889343972100858e-10, "2E-10", "%2.E", -__LINE__, 1.891833282879762e-24, "+2e-24", "%+.1g", -__LINE__, 1.895148778941240e-07, "0.000000", "%0f", -__LINE__, 1.896950834067578e-28, "+1.89695e-28", "%+#g", -__LINE__, 1.898464546986629e-05, "1.898465e-05", "%.7g", -__LINE__, 1.900851427578321e-19, "1.90085e-19", "%6g", -__LINE__, 1.901171344577750e+27, "1.901171e+27", "%7.7g", -__LINE__, 1.903563335316359e+02, "190.356", "%0g", -__LINE__, 1.903817306004701e-16, "+1.90e-16", "%+#6.2e", -__LINE__, 1.910606410246797e+21, "1.91061E+21", "%2.5E", -__LINE__, 1.912537759564710e+29, "1.91254E+29", "%G", -__LINE__, 1.913606675894566e+27, "1.91361E+27", "%7.6G", -__LINE__, 1.916473734025505e-05, " 2e-05", "%7.g", -__LINE__, 1.916507511720523e+23, "+2E+23", "%+.0E", -__LINE__, 1.917688262248837e-28, "1.918e-28", "%.4g", -__LINE__, 1.921375594217083e-12, "1.92138E-12", "%G", -__LINE__, 1.923916000932815e-25, "1.92392E-25", "%G", -__LINE__, 1.926303652776462e-01, "+0.2", "%+0.G", -__LINE__, 1.929411084211293e+21, "1.92941E+21", "%6G", -__LINE__, 1.929996820297491e-26, "1.93e-26", "%.6g", -__LINE__, 1.937301472034748e-29, "1.9373E-29", "%G", -__LINE__, 1.937301660220894e-11, "+1.9373E-11", "%+G", -__LINE__, 1.939038538587083e-02, "0.0193904", "%g", -__LINE__, 1.940575489112444e-09, "1.94058E-09", "%G", -__LINE__, 1.946550455606677e-26, "1.946550E-26", "%#1E", -__LINE__, 1.954250777559491e-14, "1.95425E-14", "%G", -__LINE__, 1.955646327688473e-16, "1.956E-16", "%#.3E", -__LINE__, 1.956999911995683e+20, "2E+20", "%2.G", -__LINE__, 1.959125254298784e-21, "1.95913E-21", "%#G", -__LINE__, 1.960330340481290e+26, "1.96033e+26", "%.6g", -__LINE__, 1.964156478075422e+01, "+19.6416", "%+g", -__LINE__, 1.964702507676036e+19, "2.0e+19", "%2.1e", -__LINE__, 1.965762191674409e-30, "2E-30", "%1.G", -__LINE__, 1.967492699686803e-29, "+1.967493E-29", "%+#E", -__LINE__, 1.970072604062236e-11, "+1.97007E-11", "%+G", -__LINE__, 1.975631055550387e+05, "197563.105555", "%.6f", -__LINE__, 1.975722425389177e+28, "+1.975722e+28", "%+5.6e", -__LINE__, 1.977938328895365e-05, " 2e-05", "%6.e", -__LINE__, 1.981950849019640e+13, "1.981951E+13", "%E", -__LINE__, 1.982543168856985e-26, "1.98254e-26", "%4g", -__LINE__, 1.984873317384181e-20, "1.98487E-20", "%4G", -__LINE__, 1.986146420877074e+02, "+1.986146e+02", "%+0e", -__LINE__, 1.986465942785167e-28, "1.98647e-28", "%g", -__LINE__, 1.988250323235468e-05, " +0", "%+7.f", -__LINE__, 1.989966623080645e-09, "1.989967e-09", "%e", -__LINE__, 1.991243122514519e+11, "199124312251", "%5.f", -__LINE__, 1.993287894645908e+25, "+1.993288E+25", "%+E", -__LINE__, 1.995172329888890e-30, "+1.99517e-30", "%+3g", -__LINE__, 1.997075127236432e+05, "1.997E+05", "%#.4G", -__LINE__, 2.000651599487290e+04, "2E+04", "%2.E", -__LINE__, 2.001429412876339e-28, "0.000000", "%6f", -__LINE__, 2.003535646264196e+03, " 2E+03", "%7.G", -__LINE__, 2.011751504116246e+06, "2E+06", "%2.G", -__LINE__, 2.016361237694652e-30, "2.01636e-30", "%4g", -__LINE__, 2.018266414065554e-08, "0.00", "%2.2f", -__LINE__, 2.020706780608565e+03, "2E+03", "%.0G", -__LINE__, 2.025098418552005e-16, "+2.025098E-16", "%+2E", -__LINE__, 2.026100592518976e-11, "2.026101e-11", "%6e", -__LINE__, 2.026167291572980e+11, "2.02617E+11", "%G", -__LINE__, 2.026782170272331e+07, "2.026782E+07", "%E", -__LINE__, 2.029133469449347e-06, " 2e-06", "%6.g", -__LINE__, 2.031191570768443e-20, "2.031192E-20", "%2.7G", -__LINE__, 2.031884221862863e-16, "2.031884e-16", "%e", -__LINE__, 2.032992924118323e+29, "203299292411832333016263874014.84", "%#0.2f", -__LINE__, 2.035799610097827e+28, "+20357996100978272835391180706.2104344", "%+3.7f", -__LINE__, 2.038008183612069e+25, "20380081836120691463065668", "%7.0f", -__LINE__, 2.041632205119365e-22, "+2.04163e-22", "%+g", -__LINE__, 2.042769811159352e-10, "2e-10", "%.1g", -__LINE__, 2.043034975847005e-08, "2.043035e-08", "%e", -__LINE__, 2.045930666285880e+26, "2.04593e+26", "%g", -__LINE__, 2.048377276651386e-21, "0.00000", "%2.5f", -__LINE__, 2.051785787301292e-23, "0.000000", "%f", -__LINE__, 2.055085792048183e-10, "0.000000", "%f", -__LINE__, 2.055783028451040e-21, "+0", "%+1.f", -__LINE__, 2.057641607509489e-17, "+2E-17", "%+2.G", -__LINE__, 2.058348703001600e-15, "2.05835E-15", "%#G", -__LINE__, 2.059594758787322e+24, "2.05959E+24", "%1G", -__LINE__, 2.062710740295018e+01, "20.6271", "%G", -__LINE__, 2.063240676447750e-11, "0.000000", "%f", -__LINE__, 2.063799238238917e-09, "+0.000000", "%+f", -__LINE__, 2.064564135160425e-17, "2.06456E-17", "%G", -__LINE__, 2.066363476927650e-05, "2.07E-05", "%.3G", -__LINE__, 2.066871450514214e-02, "+2.066871e-02", "%+e", -__LINE__, 2.067258256169148e+07, "2.06726e+07", "%g", -__LINE__, 2.068466590729350e-22, "0.0000", "%.4f", -__LINE__, 2.068779510112540e-26, "2.06878e-26", "%g", -__LINE__, 2.069258770387493e+19, "20692587703874929516.700831", "%3f", -__LINE__, 2.069547778447951e+26, "2.069548e+26", "%6e", -__LINE__, 2.070479507710941e-23, "2.07048E-23", "%G", -__LINE__, 2.071809640061785e+22, "2.071810E+22", "%E", -__LINE__, 2.073364463564950e-06, "2.07336e-06", "%g", -__LINE__, 2.073478953644888e-10, "+2.07E-10", "%+.3G", -__LINE__, 2.076039194312519e+12, "2.07604E+12", "%G", -__LINE__, 2.081490398946229e-07, "+2.08149e-07", "%+g", -__LINE__, 2.084941170287895e-07, "2.084941E-07", "%7E", -__LINE__, 2.087035885023382e-18, "+0.000000", "%+f", -__LINE__, 2.091025884363342e-09, "2.09103E-09", "%G", -__LINE__, 2.091830555397864e+08, "209183056", "%0.f", -__LINE__, 2.091998109232084e-22, "0.000000", "%#f", -__LINE__, 2.093406473464940e-17, "2.09341e-17", "%g", -__LINE__, 2.094646724039720e-26, "2.094647e-26", "%0.7g", -__LINE__, 2.095218667083208e-22, "2.09522e-22", "%.5e", -__LINE__, 2.096932364992728e-27, "2.1E-27", "%.2G", -__LINE__, 2.097012452732083e+17, "2.09701E+17", "%G", -__LINE__, 2.102022216908102e-07, "0.000000", "%f", -__LINE__, 2.104648382618938e-04, "0.00021", "%.3G", -__LINE__, 2.109159578853690e-19, "2.10916e-19", "%6g", -__LINE__, 2.111732624641178e-13, "+2.111733E-13", "%+7.7G", -__LINE__, 2.112676138351330e+21, " 2e+21", "%6.g", -__LINE__, 2.117332904051741e-09, "+0.000000", "%+f", -__LINE__, 2.118001353767757e-14, "2.118E-14", "%4.3E", -__LINE__, 2.119413720893955e+12, "2.119414E+12", "%.7G", -__LINE__, 2.119610992647014e+07, "+21196109.9265", "%+.4f", -__LINE__, 2.120504022069221e+25, "21205040220692210617414730.223", "%#.3f", -__LINE__, 2.120634617123718e-16, "2.120635e-16", "%#e", -__LINE__, 2.128702437175385e+12, "2128702437175.385", "%.3f", -__LINE__, 2.131148830213536e-12, "2.131149e-12", "%e", -__LINE__, 2.132682622145255e+04, "+21326.83", "%+#5.7G", -__LINE__, 2.133864841676473e-01, " +0.2", "%+6.g", -__LINE__, 2.133939058496273e+16, "2E+16", "%4.G", -__LINE__, 2.135087006806302e-24, "0.000000", "%f", -__LINE__, 2.138983961194584e-20, "+2.138984e-20", "%+7e", -__LINE__, 2.146534189669224e+17, "+2.147E+17", "%+.4G", -__LINE__, 2.147375595676503e+09, "2.147376e+09", "%e", -__LINE__, 2.152994986418075e+02, "2E+02", "%0.E", -__LINE__, 2.154127135896811e+06, "2.15E+06", "%2.3G", -__LINE__, 2.154613053892588e-29, "2.1546E-29", "%.4E", -__LINE__, 2.160830430730653e-12, "2.16083E-12", "%#G", -__LINE__, 2.161740591663027e+28, "2.161741e+28", "%e", -__LINE__, 2.167181665934011e-06, "2e-06", "%1.e", -__LINE__, 2.167348761729060e-04, "2.167349e-04", "%#e", -__LINE__, 2.170270852816708e-10, "2.17027E-10", "%0G", -__LINE__, 2.173048229189370e-06, "2.173e-06", "%.5g", -__LINE__, 2.175554537855024e+10, "2.17555E+10", "%G", -__LINE__, 2.177447372527968e-30, "+0.000000", "%+.6f", -__LINE__, 2.178591661569858e+05, "2.1786e+05", "%1.5g", -__LINE__, 2.184700207174818e-29, "0.000000", "%f", -__LINE__, 2.190817031437247e+03, "2.E+03", "%#3.0E", -__LINE__, 2.191396212145558e-01, "2.191E-01", "%6.3E", -__LINE__, 2.191786353372880e-23, "2.19179e-23", "%.5e", -__LINE__, 2.193471126151079e+19, "2.1935E+19", "%.4E", -__LINE__, 2.194750177630526e-15, "2.194750e-15", "%e", -__LINE__, 2.196145170358973e+05, "+219615", "%+g", -__LINE__, 2.199602360934320e-09, "2.19960E-09", "%#6.6G", -__LINE__, 2.202913988776998e+17, "+2.20291e+17", "%+g", -__LINE__, 2.207094560707703e-10, "2.207095e-10", "%e", -__LINE__, 2.207557214621658e-13, " 0", "%4.f", -__LINE__, 2.209428206272229e+13, "2.20943e+13", "%g", -__LINE__, 2.212662463615175e-11, " 0", "%4.0f", -__LINE__, 2.215732710968468e-30, "2E-30", "%.1G", -__LINE__, 2.218490841936778e-10, "2.21849e-10", "%2g", -__LINE__, 2.218850610567959e-01, "+0.221885", "%+G", -__LINE__, 2.220796939261542e-03, "0.002221", "%#f", -__LINE__, 2.221819894808024e+24, "2.2e+24", "%5.1e", -__LINE__, 2.223804993235507e+27, "2.223805e+27", "%1e", -__LINE__, 2.224715386046563e-17, "0.00000", "%#.5f", -__LINE__, 2.224864709983882e-16, "+2.224865e-16", "%+e", -__LINE__, 2.225764510969505e+16, "2.E+16", "%#4.G", -__LINE__, 2.233229189161284e-07, "+2.23323e-07", "%+6g", -__LINE__, 2.236522807209868e+17, "2.23652e+17", "%g", -__LINE__, 2.236641620849775e+20, "2E+20", "%0.G", -__LINE__, 2.237089952728626e-13, "2E-13", "%5.E", -__LINE__, 2.238531255563381e-11, " 2E-11", "%7.1G", -__LINE__, 2.242782296436871e+12, "2242782296436.871103", "%f", -__LINE__, 2.249177852069393e-02, "+2.249178E-02", "%+5E", -__LINE__, 2.250735782732076e+29, "+2.25074e+29", "%+g", -__LINE__, 2.257455203557544e-11, "+2e-11", "%+4.0g", -__LINE__, 2.258002527939529e+24, "2.258e+24", "%g", -__LINE__, 2.266955929448160e+20, "226695592944815960123.6056915", "%.7f", -__LINE__, 2.269019719123250e-23, "0.000000", "%f", -__LINE__, 2.269022332502809e+02, "+226.902233", "%+f", -__LINE__, 2.271165222038591e-03, "0.002", "%1.1g", -__LINE__, 2.273965946408021e+14, "+227396594640802.085507", "%+f", -__LINE__, 2.277221153386242e+22, "22772211533862418697538.032575", "%#f", -__LINE__, 2.280214920187521e-01, "0.2", "%2.G", -__LINE__, 2.280762993019740e+06, "2.28076E+06", "%G", -__LINE__, 2.283479263040833e-24, "+0.000000", "%+f", -__LINE__, 2.283686319235123e-07, "2.2837E-07", "%5.5G", -__LINE__, 2.285842617231066e-26, "0.000000", "%f", -__LINE__, 2.293145864755873e-02, "0.02", "%.0g", -__LINE__, 2.293439381531532e+03, "+2.293439E+03", "%+#1E", -__LINE__, 2.297972500660698e-22, "2.29797e-22", "%g", -__LINE__, 2.298725366073681e+23, "2.29873E+23", "%G", -__LINE__, 2.303151535483950e-29, "2.30315E-29", "%G", -__LINE__, 2.308565313657699e-25, " 0", "%4.f", -__LINE__, 2.309305373760733e-07, "2.309305E-07", "%E", -__LINE__, 2.309693761334710e-19, "2.30969e-19", "%g", -__LINE__, 2.312218220995774e-20, "+2.31222E-20", "%+.6G", -__LINE__, 2.313115729670525e+24, "2.31312E+24", "%G", -__LINE__, 2.315325159866773e-21, "2.315325E-21", "%E", -__LINE__, 2.316932917620091e-19, "0.000000", "%f", -__LINE__, 2.317548394633895e+13, "2.31755E+13", "%0G", -__LINE__, 2.318951465093612e+02, "+2.32e+02", "%+1.2e", -__LINE__, 2.319151794905482e-17, "+0.000000", "%+0f", -__LINE__, 2.319708617851078e-27, "0.000000", "%f", -__LINE__, 2.320019976591725e+20, "2e+20", "%.1g", -__LINE__, 2.322859962551666e+06, "2.32286e+06", "%g", -__LINE__, 2.326474568074649e-29, "2.326e-29", "%.4g", -__LINE__, 2.328400844172053e-07, "2.3284E-07", "%G", -__LINE__, 2.333695247698112e+16, "2.3337e+16", "%g", -__LINE__, 2.333717120257130e-19, "+0.000000", "%+f", -__LINE__, 2.334711793234782e-19, "2.33471E-19", "%5G", -__LINE__, 2.335524987281242e+02, "+233.55", "%+7.5g", -__LINE__, 2.335556767836369e-30, "2.34e-30", "%.3g", -__LINE__, 2.337696964360052e-10, "2.3377e-10", "%1g", -__LINE__, 2.337858249184500e-14, "2.337858E-14", "%5.6E", -__LINE__, 2.339984354781169e-14, "2.339984E-14", "%E", -__LINE__, 2.340849041430089e-04, "0.00023", "%0.2G", -__LINE__, 2.342388410373363e-24, "2.34239E-24", "%G", -__LINE__, 2.343933106737237e-22, "2.34393e-22", "%g", -__LINE__, 2.344870855713960e-08, "0.000000", "%.6f", -__LINE__, 2.347368965433808e+24, "2347368965433808352116785", "%4.f", -__LINE__, 2.349417462171421e-02, "+0.0234942", "%+G", -__LINE__, 2.351071111431207e+11, "235107111143.12", "%.2f", -__LINE__, 2.352756222810670e+19, "+2.e+19", "%+#4.g", -__LINE__, 2.355862529217003e-22, "2.355863e-22", "%#4e", -__LINE__, 2.356804045401445e-30, "2.3568E-30", "%G", -__LINE__, 2.362100710185559e-26, "2.3621e-26", "%g", -__LINE__, 2.368330779173562e-12, " 0", "%4.f", -__LINE__, 2.383329784369796e+22, "2.38333E+22", "%G", -__LINE__, 2.386845229536477e+01, "+23.868452", "%+#f", -__LINE__, 2.388207830036780e-05, "0.000024", "%f", -__LINE__, 2.391809468802907e+21, "+2.391809e+21", "%+e", -__LINE__, 2.395172908564692e-09, "+0.000000", "%+f", -__LINE__, 2.395447167030886e-29, "2.39545e-29", "%g", -__LINE__, 2.397292973389182e+16, "23972929733891823", "%6.f", -__LINE__, 2.401749832237687e-30, "2.401750E-30", "%E", -__LINE__, 2.403610502544347e-03, "0.00240361", "%4G", -__LINE__, 2.404676421776132e+17, "240467642177613206", "%6.f", -__LINE__, 2.406327689091479e+25, "2.406328e+25", "%e", -__LINE__, 2.407341999590511e-02, "0.024073", "%f", -__LINE__, 2.407352797581004e+05, "240735.", "%#g", -__LINE__, 2.407903467439017e+13, "2.4079E+13", "%G", -__LINE__, 2.407979635013539e+21, " +2E+21", "%+7.G", -__LINE__, 2.409513517930790e+29, "240951351793079027174826478585.600853", "%f", -__LINE__, 2.412530651221551e+10, "+2.41253E+10", "%+G", -__LINE__, 2.419943224673811e+00, "2.41994", "%#g", -__LINE__, 2.422474399040258e-15, "0.000000", "%f", -__LINE__, 2.426060206689458e+18, "2.42606E+18", "%1G", -__LINE__, 2.439982659679872e+14, "+2.439983E+14", "%+E", -__LINE__, 2.440528851375447e+13, "24405288513754.466173", "%f", -__LINE__, 2.441340473292679e+19, "2.44134E+19", "%G", -__LINE__, 2.443521636943916e+19, " 2.e+19", "%#7.g", -__LINE__, 2.445925211597624e-27, "2.445925E-27", "%E", -__LINE__, 2.446966179060722e+25, "2.446966e+25", "%5e", -__LINE__, 2.447714218717278e+11, "2e+11", "%1.e", -__LINE__, 2.448339744613286e+06, "2.4483e+06", "%3.5g", -__LINE__, 2.448772993496189e+03, "2448.77", "%G", -__LINE__, 2.448857654325229e+22, "+2.44886e+22", "%+g", -__LINE__, 2.450082452098890e-27, "2.4501E-27", "%#3.5G", -__LINE__, 2.451293602221637e+05, "245129.360222", "%f", -__LINE__, 2.454531490229426e+02, "245.453", "%G", -__LINE__, 2.458958369944980e+14, "2.5E+14", "%6.1E", -__LINE__, 2.463666680775038e+14, "+246366668077503.80", "%+#.2f", -__LINE__, 2.471582990960795e+05, "2.471583e+05", "%e", -__LINE__, 2.474107179274687e+22, "2.47411e+22", "%g", -__LINE__, 2.474332114849132e-08, "+2.47433e-08", "%+g", -__LINE__, 2.476956762431716e+18, "+2476956762431715919.348107", "%+#f", -__LINE__, 2.479091221850607e-22, "0.000000", "%f", -__LINE__, 2.479819586598431e-24, "2.47982e-24", "%g", -__LINE__, 2.480006174601455e-05, "2.48001E-05", "%G", -__LINE__, 2.482672677638334e-26, "+0.000000", "%+f", -__LINE__, 2.492816492208918e-14, " 0", "%7.f", -__LINE__, 2.492964173197140e-12, " 2e-12", "%7.g", -__LINE__, 2.494646635961173e+02, "249.465", "%g", -__LINE__, 2.494687818780545e+11, "249468781878.054546", "%#7f", -__LINE__, 2.510083560147301e-13, "+2.510084e-13", "%+#e", -__LINE__, 2.511186607989480e-30, "2.51E-30", "%.3G", -__LINE__, 2.514164516133643e-11, "2.51416e-11", "%g", -__LINE__, 2.517242520804735e+11, "2.517243e+11", "%e", -__LINE__, 2.518526126400833e-26, "2.51853e-26", "%g", -__LINE__, 2.520313416401176e+09, "2520313416.401176", "%5f", -__LINE__, 2.521653160738683e-29, "2.52165e-29", "%#g", -__LINE__, 2.521941342615338e-16, "2.52194e-16", "%g", -__LINE__, 2.523554774354461e-03, "+3E-03", "%+.0E", -__LINE__, 2.525434130825058e+06, "+2.525434E+06", "%+E", -__LINE__, 2.527616380113364e+02, "2.527616E+02", "%E", -__LINE__, 2.531871347913505e+09, "+2.53187E+09", "%+#G", -__LINE__, 2.532167428661069e+06, "2532167.428661", "%f", -__LINE__, 2.545585718405995e+14, "+2.54559E+14", "%+G", -__LINE__, 2.546305097286406e+10, "2.546305e+10", "%e", -__LINE__, 2.547467156069069e-30, "+0.00", "%+3.2f", -__LINE__, 2.548728793004506e-14, "2.54873E-14", "%G", -__LINE__, 2.560375602395090e+11, "256037560239.509032", "%0f", -__LINE__, 2.560555687476687e+03, "2561", "%.4g", -__LINE__, 2.561709077363443e-24, "+0.000000", "%+f", -__LINE__, 2.563763849675242e+10, "2.5637638E+10", "%.7E", -__LINE__, 2.567482414574355e+11, "+2.567482e+11", "%+e", -__LINE__, 2.571575046303674e-17, "3E-17", "%2.0E", -__LINE__, 2.572997971296986e+11, "257299797129.698593", "%f", -__LINE__, 2.578625935900331e+22, "25786259359003311786295.853381", "%f", -__LINE__, 2.579663282966370e+12, "2.579663e+12", "%e", -__LINE__, 2.593141782397610e-08, "0.000000", "%f", -__LINE__, 2.594386109584196e+04, "3.E+04", "%#6.0E", -__LINE__, 2.598069318007816e-22, "2.59807e-22", "%g", -__LINE__, 2.600910462290091e+09, "2.600910E+09", "%6E", -__LINE__, 2.602580183614458e-03, "2.602580e-03", "%e", -__LINE__, 2.606540360440264e+09, "+2606540360.4", "%+#0.1f", -__LINE__, 2.610016419698116e-21, "+3.e-21", "%+#3.g", -__LINE__, 2.612279323574882e-20, "2.61228E-20", "%G", -__LINE__, 2.614157324336453e-14, "2.61416e-14", "%g", -__LINE__, 2.614688721873993e-09, "2.61e-09", "%6.2e", -__LINE__, 2.616661104472416e-15, " 0", "%5.f", -__LINE__, 2.616742079283195e-09, " +3E-09", "%+7.E", -__LINE__, 2.618075304717427e+24, "2.618075e+24", "%e", -__LINE__, 2.624118573335769e+26, "262411857333576925555007619.550452", "%1f", -__LINE__, 2.625718894274227e+24, "+2625718894274227110940955.753904", "%+f", -__LINE__, 2.627081999477812e+03, "2627.081999", "%f", -__LINE__, 2.631061062224705e+14, "263106106222470.481626", "%f", -__LINE__, 2.631545877128814e+27, "+2.63155e+27", "%+g", -__LINE__, 2.632694395848818e-11, "2.63269e-11", "%g", -__LINE__, 2.636728891022008e-22, "+2.63673e-22", "%+#4g", -__LINE__, 2.638495675008130e-28, "+2.638496e-28", "%+e", -__LINE__, 2.639704195859799e-11, "0.", "%#.0f", -__LINE__, 2.641645264652665e-20, "0", "%0.f", -__LINE__, 2.642012075064497e-20, "3E-20", "%0.E", -__LINE__, 2.648725869006487e-29, " 3E-29", "%6.G", -__LINE__, 2.649060724417770e+12, "3E+12", "%3.G", -__LINE__, 2.651188545120166e-17, "0.000", "%.3f", -__LINE__, 2.652302152621621e+14, "2.7E+14", "%.2G", -__LINE__, 2.653309718412604e-28, "0.000000", "%f", -__LINE__, 2.658344750491858e-21, " 3e-21", "%6.g", -__LINE__, 2.664625074612594e+15, "3e+15", "%1.g", -__LINE__, 2.666953728270800e-15, "3e-15", "%0.e", -__LINE__, 2.674515419678877e-11, " 3E-11", "%6.E", -__LINE__, 2.680054917256578e+15, "2680054917256577.5", "%#2.1f", -__LINE__, 2.680495609883415e-11, "2.68E-11", "%#.3G", -__LINE__, 2.685757893641070e+23, "268575789364107020418259.70809", "%1.5f", -__LINE__, 2.695551226058178e+16, "26955512260581775.407786", "%f", -__LINE__, 2.696346377519671e+04, "+26963.5", "%+G", -__LINE__, 2.714262310601257e+17, "+2.714262E+17", "%+E", -__LINE__, 2.719227450016317e-01, "0.271923", "%G", -__LINE__, 2.724135433346056e-30, "+2.72414e-30", "%+g", -__LINE__, 2.725143224130276e+14, "272514322413027.576530", "%6f", -__LINE__, 2.729355189648310e-03, "+0.00273", "%+.5f", -__LINE__, 2.732872167724945e+11, "2.73287E+11", "%G", -__LINE__, 2.737709476435412e+17, "273770947643541218.141650", "%f", -__LINE__, 2.739299356074967e-15, "2.7E-15", "%.2G", -__LINE__, 2.740793612304798e-27, "2.740794E-27", "%.7G", -__LINE__, 2.742030156175960e+20, "2.74203e+20", "%2.6g", -__LINE__, 2.744455324096085e+11, "2.74446E+11", "%G", -__LINE__, 2.745179546531160e+07, "2.7452E+07", "%.5G", -__LINE__, 2.747470562525333e+04, "3E+04", "%2.E", -__LINE__, 2.750243314674629e+21, "2.75024E+21", "%#G", -__LINE__, 2.750250224436030e+20, "+2.750250e+20", "%+0.6e", -__LINE__, 2.752712858561084e-22, "2.752713e-22", "%e", -__LINE__, 2.756982987656667e-03, "0.002756983", "%#.7G", -__LINE__, 2.761841188479590e+13, "3e+13", "%1.g", -__LINE__, 2.769498440434419e+00, "+3e+00", "%+0.e", -__LINE__, 2.769993785786379e+10, "27699937857.863794", "%f", -__LINE__, 2.772900256376753e-06, "+2.7729E-06", "%+7.6G", -__LINE__, 2.774401482467457e-06, "2.8e-06", "%3.2g", -__LINE__, 2.777691370374757e-02, "+0.027777", "%+f", -__LINE__, 2.779836227365899e-09, "3e-09", "%5.0g", -__LINE__, 2.780481651765741e+01, "2.780482E+01", "%E", -__LINE__, 2.782228478714809e-26, "2.782228E-26", "%4.7G", -__LINE__, 2.790457781719376e+13, "+2.8e+13", "%+.2g", -__LINE__, 2.792026581166417e-30, " 3.e-30", "%#7.0g", -__LINE__, 2.792396278299615e-08, "0.00", "%#.2f", -__LINE__, 2.793658047689995e-10, "2.794e-10", "%#0.4g", -__LINE__, 2.795707358229888e-25, "0.000000", "%f", -__LINE__, 2.796253091758523e-06, "2.796E-06", "%.4G", -__LINE__, 2.796756564788716e-24, "2.796757e-24", "%e", -__LINE__, 2.798730444798773e-14, "2.79873e-14", "%g", -__LINE__, 2.799108397670447e-24, "3E-24", "%.0G", -__LINE__, 2.799389008872835e+06, "2799389.", "%#0.f", -__LINE__, 2.800413998518039e-14, "0.000000", "%f", -__LINE__, 2.803237602587100e+15, "+2803237602587100.418816", "%+5f", -__LINE__, 2.803474415574551e-04, "0.0002803", "%.7f", -__LINE__, 2.804957468647181e+25, "2.80496e+25", "%g", -__LINE__, 2.809345112788226e+09, "2809345112.788226", "%.6f", -__LINE__, 2.811518239408899e+10, "3e+10", "%1.g", -__LINE__, 2.813188439967416e-16, "0.0000000", "%5.7f", -__LINE__, 2.813497118051755e+08, "2.8135e+08", "%.5g", -__LINE__, 2.815748256510577e-29, "0.000000", "%2f", -__LINE__, 2.816076365485207e-01, "0.281608", "%0G", -__LINE__, 2.816083345772131e+24, "2.8161e+24", "%6.4e", -__LINE__, 2.818686957605178e+12, "2.8187E+12", "%.5G", -__LINE__, 2.821903538737691e+20, "2.8219E+20", "%G", -__LINE__, 2.823659589845680e+26, "2.82366e+26", "%2g", -__LINE__, 2.823685630865012e+22, "2.82369E+22", "%G", -__LINE__, 2.828826386007914e+21, "2.828826E+21", "%7E", -__LINE__, 2.830997901034349e+04, "+3e+04", "%+0.e", -__LINE__, 2.833886731091353e-26, "+2.833887e-26", "%+4e", -__LINE__, 2.839965144893913e+28, "28399651448939131626048038015.1421", "%.4f", -__LINE__, 2.840651452049947e-09, "2.841E-09", "%#.3E", -__LINE__, 2.843388001911757e-01, "0.284339", "%g", -__LINE__, 2.846122151080671e+14, "2.84612E+14", "%.5E", -__LINE__, 2.851257828837595e+05, "+285126", "%+5.f", -__LINE__, 2.853823884459520e+07, "+2.85382E+07", "%+G", -__LINE__, 2.853870068368765e-06, "2.854E-06", "%4.3E", -__LINE__, 2.856687358149867e+01, "+28.567", "%+6.5G", -__LINE__, 2.858946600073752e+06, "2.8589466e+06", "%3.7e", -__LINE__, 2.861525727138818e+24, "2.8615257e+24", "%2.7e", -__LINE__, 2.865104175886071e-24, "0.000000", "%f", -__LINE__, 2.870678920363198e-14, "2.87068E-14", "%G", -__LINE__, 2.873298537233691e+09, "+2.8733e+09", "%+g", -__LINE__, 2.877939609444375e-02, "0.028779", "%f", -__LINE__, 2.878253985341728e+13, "2.87825E+13", "%G", -__LINE__, 2.879299244903946e+29, "287929924490394597569320467301", "%0.f", -__LINE__, 2.885516225515485e-26, "0.000000", "%f", -__LINE__, 2.886013724129579e+20, "+3e+20", "%+4.g", -__LINE__, 2.887032786975506e-30, "0.000000", "%f", -__LINE__, 2.890415456531026e-29, "2.89042E-29", "%G", -__LINE__, 2.893177360548214e-13, "2.893E-13", "%#6.3E", -__LINE__, 2.895265536458195e+26, "2.89527e+26", "%5g", -__LINE__, 2.903844533810152e+23, "290384453381015195105874.23", "%.2f", -__LINE__, 2.909060558287504e+27, "2.90906e+27", "%g", -__LINE__, 2.911615480973172e-05, "2.91162E-05", "%3G", -__LINE__, 2.912692297221896e+09, "2912692297.221896", "%#f", -__LINE__, 2.913595662485813e-24, "2.9136E-24", "%G", -__LINE__, 2.915960840341896e-27, "0.000000", "%f", -__LINE__, 2.920451095973991e-16, "2.92e-16", "%2.2e", -__LINE__, 2.920528295810925e+06, "2.92053E+06", "%#G", -__LINE__, 2.921564671017147e+20, "2.921565E+20", "%#6E", -__LINE__, 2.921628350942189e+01, "2.921628E+01", "%E", -__LINE__, 2.921843377455232e+20, "2.921843E+20", "%#E", -__LINE__, 2.930156950319384e+29, "2.930E+29", "%1.3E", -__LINE__, 2.931229858895071e-30, "2.9e-30", "%4.2g", -__LINE__, 2.931753029689166e+20, "2.93175e+20", "%g", -__LINE__, 2.933023693079342e+15, "3.E+15", "%#.1G", -__LINE__, 2.933078733225520e+26, "2.93308E+26", "%G", -__LINE__, 2.933528170896643e-14, "+2.93353e-14", "%+g", -__LINE__, 2.938648437428148e+00, "2.938648e+00", "%e", -__LINE__, 2.940752238221344e+26, "+2.94075E+26", "%+G", -__LINE__, 2.942836470459675e+20, "2.9428e+20", "%6.4e", -__LINE__, 2.943218333254941e+29, "294321833325494086608387078740.634024", "%f", -__LINE__, 2.943690574007512e-27, "0.000000", "%f", -__LINE__, 2.945452907046501e+09, "+2.9455E+09", "%+.5G", -__LINE__, 2.946648725966953e+16, "29466487259669534.637396", "%4f", -__LINE__, 2.955119322417825e+29, "2.95512E+29", "%G", -__LINE__, 2.966481197538973e+24, "2.96648e+24", "%#g", -__LINE__, 2.969362862661362e+08, "+2.969363e+08", "%+7e", -__LINE__, 2.970062459990078e+21, "+2.97006E+21", "%+G", -__LINE__, 2.971059959019791e+10, " 3E+10", "%7.G", -__LINE__, 2.973020205606034e-29, "0.000000", "%f", -__LINE__, 2.977223210301426e+04, "2.977223e+04", "%#e", -__LINE__, 2.977467832772786e-26, "0.000000", "%f", -__LINE__, 2.981433606423384e+18, "2981433606423384397.032805", "%f", -__LINE__, 2.981615513287404e-17, "2.98162e-17", "%g", -__LINE__, 2.983880743847276e+19, " 3e+19", "%7.e", -__LINE__, 2.983927792297305e-28, "2.983928e-28", "%e", -__LINE__, 2.984807359492058e-17, " 0", "%2.f", -__LINE__, 2.985123412933032e+09, "+2.98512e+09", "%+g", -__LINE__, 2.991132955408629e-27, "+2.99113e-27", "%+4g", -__LINE__, 2.992345635923643e+19, "3E+19", "%4.G", -__LINE__, 2.993024238285395e-05, "2.99302e-05", "%2g", -__LINE__, 2.995303406756363e+16, "+2.995303E+16", "%+E", -__LINE__, 2.995492577854335e+19, "+29954925778543346481.797016", "%+f", -__LINE__, 2.996856271675341e-25, "+3e-25", "%+0.e", -__LINE__, 2.997813968112619e+12, "2.99781e+12", "%#5g", -__LINE__, 3.002097486457961e-17, "3.00210e-17", "%5.5e", -__LINE__, 3.006538123158692e+28, "+3.00654E+28", "%+#G", -__LINE__, 3.007293721729544e+04, "30072.937217", "%f", -__LINE__, 3.008301791944493e-07, "3.008e-07", "%.3e", -__LINE__, 3.011742184603817e-17, "3.011742E-17", "%#E", -__LINE__, 3.024641547299177e-30, "3.02464e-30", "%g", -__LINE__, 3.026525135110198e-28, "3e-28", "%.0e", -__LINE__, 3.026768160756558e+20, "3.02677E+20", "%G", -__LINE__, 3.031928829940975e+18, "3031928829940975234.1", "%0.1f", -__LINE__, 3.039787705138620e+24, "+3.E+24", "%+#5.G", -__LINE__, 3.039803824423916e-02, "0.030398", "%5f", -__LINE__, 3.041236293199133e-26, "3.04124e-26", "%g", -__LINE__, 3.045634954037886e+04, "30456.3", "%g", -__LINE__, 3.047528114241850e+25, "3e+25", "%0.e", -__LINE__, 3.047958193737501e-24, "3.04796E-24", "%#G", -__LINE__, 3.049537324414302e-16, "3.04954E-16", "%G", -__LINE__, 3.050500637681798e-30, "3.0505E-30", "%G", -__LINE__, 3.051769626625307e-01, "0.305177", "%f", -__LINE__, 3.057280201971847e+11, "+3.05728E+11", "%+.5E", -__LINE__, 3.060046173306881e-10, "+3.060046e-10", "%+e", -__LINE__, 3.069732667347204e+27, "+3069732667347204291274920251.453295", "%+f", -__LINE__, 3.075060836786916e-14, "0.000000", "%f", -__LINE__, 3.078175179670964e+13, "3.07818E+13", "%G", -__LINE__, 3.080305344303183e-21, "3.08031e-21", "%6g", -__LINE__, 3.088881497064043e+27, "+3.088881E+27", "%+3E", -__LINE__, 3.089196877931209e-20, "3.089197e-20", "%e", -__LINE__, 3.091400888880487e-08, "3e-08", "%2.e", -__LINE__, 3.093410684178904e+16, "3.09341e+16", "%g", -__LINE__, 3.104225344208216e-21, "0.000000", "%f", -__LINE__, 3.105843728248599e+13, "3.e+13", "%#.0g", -__LINE__, 3.106463071390893e-07, "0.0000", "%.4f", -__LINE__, 3.107784123569379e+02, "+310.778", "%+G", -__LINE__, 3.110605148983672e-20, "3.1106051E-20", "%.7E", -__LINE__, 3.111702418162670e-04, "0.00031117", "%.5G", -__LINE__, 3.117610675303153e-17, "3.11761e-17", "%g", -__LINE__, 3.123620125717981e+07, "3.1236e+07", "%2.5g", -__LINE__, 3.125648558809832e-24, "+3.125649E-24", "%+#0.6E", -__LINE__, 3.129025163659283e+10, "31290251636.592825", "%#f", -__LINE__, 3.130689119412709e-29, "+3.131E-29", "%+#.4G", -__LINE__, 3.135681222132527e+13, "3.13568E+13", "%G", -__LINE__, 3.138290485073330e-10, "3.13829E-10", "%G", -__LINE__, 3.141255250155306e-12, "3.14126E-12", "%G", -__LINE__, 3.143224520918429e+25, "3.14322E+25", "%#1G", -__LINE__, 3.144746921366173e-16, " 0", "%7.f", -__LINE__, 3.151336678241994e+19, "+3.15134E+19", "%+G", -__LINE__, 3.161752935716549e+24, "3.2E+24", "%2.1E", -__LINE__, 3.167106521258172e-10, "+3.167107e-10", "%+e", -__LINE__, 3.167266522824146e-04, "3E-04", "%3.E", -__LINE__, 3.169995217131489e+27, "3169995217131488907114089670.358226", "%f", -__LINE__, 3.172117220467692e-21, "3.1721E-21", "%.5G", -__LINE__, 3.173824170351611e+02, " 3e+02", "%6.e", -__LINE__, 3.186291452544739e-28, " 0", "%2.f", -__LINE__, 3.194750094186063e+03, "+3.194750E+03", "%+E", -__LINE__, 3.195001037118137e-20, "0", "%0.0f", -__LINE__, 3.199271564719560e+02, "319.927", "%g", -__LINE__, 3.212803450638544e+20, "3.2128e+20", "%.6g", -__LINE__, 3.214502877263883e+24, "3214502877263882840708220", "%2.f", -__LINE__, 3.214658414074286e-01, "+0.321466", "%+#g", -__LINE__, 3.217627975823673e+00, "3.217628", "%f", -__LINE__, 3.218257328710536e-07, "3.21826e-07", "%6.5e", -__LINE__, 3.221949479347008e+02, "322.194948", "%f", -__LINE__, 3.222862935507443e-14, "3.222863E-14", "%E", -__LINE__, 3.223750247261608e+19, "3.22375e+19", "%g", -__LINE__, 3.236030335782375e+05, "3.236030e+05", "%e", -__LINE__, 3.241078803072735e+19, "3.24108e+19", "%g", -__LINE__, 3.248069569167045e-06, "0.000003", "%#f", -__LINE__, 3.248148973717269e-15, "3.24815E-15", "%G", -__LINE__, 3.251150704311790e+25, "+3.25115e+25", "%+5g", -__LINE__, 3.254498593372140e+15, "+3.2545e+15", "%+g", -__LINE__, 3.254949399612861e-13, "+3.255E-13", "%+7.3E", -__LINE__, 3.255490928554106e-17, "3.255491e-17", "%e", -__LINE__, 3.262333894422112e+17, "326233389442211185.738074", "%0f", -__LINE__, 3.263923577545217e-24, "0.0000000", "%.7f", -__LINE__, 3.267125289609703e+23, "3.26713e+23", "%#.5e", -__LINE__, 3.267906049108331e+27, "3.267906E+27", "%6E", -__LINE__, 3.269885039157328e+14, "326988503915732.797722", "%f", -__LINE__, 3.296011393609953e-27, " 3E-27", "%7.E", -__LINE__, 3.296452164568996e+29, "3.296452E+29", "%E", -__LINE__, 3.296544736555325e+10, "+3.29654E+10", "%+.6G", -__LINE__, 3.301861835798572e+03, "3301.862", "%4.7g", -__LINE__, 3.311292283423002e+21, " 3E+21", "%6.G", -__LINE__, 3.314868440076262e-10, "3.3149E-10", "%.5G", -__LINE__, 3.318057982247451e-13, "3.3181e-13", "%0.5g", -__LINE__, 3.318139218410071e-22, "0.000000", "%f", -__LINE__, 3.326769904839351e-11, "+3.3268e-11", "%+0.4e", -__LINE__, 3.327483659787219e+27, "+3.32748e+27", "%+g", -__LINE__, 3.332666889640198e+17, "333266688964019763.830038", "%f", -__LINE__, 3.333807449377253e+10, "+3.33e+10", "%+.3g", -__LINE__, 3.334572302792625e-09, "3.334572E-09", "%E", -__LINE__, 3.337567126586765e-17, "0.0000000", "%#3.7f", -__LINE__, 3.340512607683786e-04, "+3E-04", "%+1.E", -__LINE__, 3.344911557516870e+04, "33449.1", "%G", -__LINE__, 3.346464302017296e+26, "+3.E+26", "%+#3.G", -__LINE__, 3.348503166628953e+00, "+3.348503e+00", "%+e", -__LINE__, 3.350025157778138e-19, "3.35003e-19", "%6g", -__LINE__, 3.352826233035342e+11, "335282623303.534200", "%7f", -__LINE__, 3.357174089765502e+10, "3.35717E+10", "%G", -__LINE__, 3.369253166475501e+03, "+3369.25", "%+G", -__LINE__, 3.371385975046735e+02, "337.", "%#.0f", -__LINE__, 3.372532650462104e-04, "+0.000", "%+.3f", -__LINE__, 3.376498162710442e-26, "3.376498e-26", "%e", -__LINE__, 3.383510307689135e-12, " 3e-12", "%7.0e", -__LINE__, 3.388427914080631e-04, "0.0003", "%2.4f", -__LINE__, 3.390757423408097e+29, "3.3908E+29", "%.4E", -__LINE__, 3.393963140962879e-11, "3.39396e-11", "%g", -__LINE__, 3.399245742994444e+24, "3.399246E+24", "%E", -__LINE__, 3.417690405546708e-26, "0.00000", "%4.5f", -__LINE__, 3.421159360472045e-30, "3.42116E-30", "%G", -__LINE__, 3.421973947898887e-06, "3.42197E-06", "%4G", -__LINE__, 3.425949002482817e-10, "+3.42595E-10", "%+G", -__LINE__, 3.428355150377972e+08, "3.42836E+08", "%G", -__LINE__, 3.445035158951526e+15, "3445035158951526.454985", "%f", -__LINE__, 3.447363996077534e+28, "+3e+28", "%+2.e", -__LINE__, 3.451571062654907e-03, "0.00345157", "%G", -__LINE__, 3.452787236877688e+09, "3.45279e+09", "%g", -__LINE__, 3.454114826574939e-22, "3.e-22", "%#3.e", -__LINE__, 3.455241965974631e-03, "0.003455", "%#f", -__LINE__, 3.456190496554365e-18, "3.E-18", "%#5.E", -__LINE__, 3.456804565717233e-19, "+0.000", "%+2.3f", -__LINE__, 3.457077651539715e-28, "3.457078E-28", "%E", -__LINE__, 3.472025705376229e+22, "3.472e+22", "%7.4g", -__LINE__, 3.473308270919079e+03, "3.473308e+03", "%e", -__LINE__, 3.474468013243007e-30, "3.47447e-30", "%g", -__LINE__, 3.477976957097698e+22, "3.47798e+22", "%g", -__LINE__, 3.501174631980057e-06, "4e-06", "%4.g", -__LINE__, 3.501808481702140e+20, "3.50181E+20", "%G", -__LINE__, 3.511760000705324e+14, "351176000070532.357000", "%f", -__LINE__, 3.511870226306087e+29, "3.51187e+29", "%.5e", -__LINE__, 3.518846859147841e+02, "+351.885", "%+G", -__LINE__, 3.521659149753418e+25, "35216591497534182053641416", "%5.f", -__LINE__, 3.521721228178747e+21, "4e+21", "%2.e", -__LINE__, 3.526696007281458e+22, "3.5267e+22", "%g", -__LINE__, 3.535631031379084e-11, "4e-11", "%5.0g", -__LINE__, 3.537219665456759e-01, "0.353722", "%f", -__LINE__, 3.537252728287785e-09, "3.537253E-09", "%E", -__LINE__, 3.542561277796815e-19, "3.542561E-19", "%E", -__LINE__, 3.548942336915745e+13, "3.54894E+13", "%.5E", -__LINE__, 3.574385715121768e-24, "3.57439E-24", "%#G", -__LINE__, 3.578068067760211e-13, "3.578068E-13", "%E", -__LINE__, 3.583296432862266e-13, "3.5833e-13", "%g", -__LINE__, 3.591567367115590e+19, "3.59157e+19", "%1g", -__LINE__, 3.594902312287635e-24, "3.5949E-24", "%G", -__LINE__, 3.602929486764515e+12, "3602929486764.514522", "%#f", -__LINE__, 3.606699462631472e-01, "+0.360670", "%+f", -__LINE__, 3.608605968319811e+17, "3.60861e+17", "%g", -__LINE__, 3.608780761567885e+24, "4e+24", "%0.e", -__LINE__, 3.623857274715022e-15, "3.62386E-15", "%1G", -__LINE__, 3.627346251764432e-22, "3.627e-22", "%.4g", -__LINE__, 3.652610391698086e-16, "0.000000", "%3f", -__LINE__, 3.657463146689917e-19, " 0", "%4.0f", -__LINE__, 3.658538858712938e-15, "4E-15", "%5.G", -__LINE__, 3.660337267266058e+16, "+36603372672660579.034698", "%+f", -__LINE__, 3.661588742065142e-01, "0.366159", "%g", -__LINE__, 3.662296387211376e-25, "0.000000", "%f", -__LINE__, 3.668511100303393e-29, "0.000000", "%7f", -__LINE__, 3.669499303661920e+06, "3.6695e+06", "%1.5g", -__LINE__, 3.676856420121343e-23, "3.6769e-23", "%0.4e", -__LINE__, 3.677197473476901e-19, "+3.6772e-19", "%+g", -__LINE__, 3.677281754506453e+12, "+3677281754506.452671", "%+f", -__LINE__, 3.678420802401506e-19, "3.67842E-19", "%G", -__LINE__, 3.679970245325769e+07, "3.67997e+07", "%g", -__LINE__, 3.682528947621349e+05, "4.e+05", "%#5.e", -__LINE__, 3.688257471304210e+22, "36882574713042104441740.320908", "%f", -__LINE__, 3.689129734472166e-01, "0.368913", "%0.6G", -__LINE__, 3.693483801463324e+12, "4E+12", "%3.E", -__LINE__, 3.694612396584729e-21, "+3.69461E-21", "%+G", -__LINE__, 3.706150073392112e-19, "0.000000", "%2f", -__LINE__, 3.706824819530577e+21, "3706824819530576853310.321894", "%f", -__LINE__, 3.709583789659276e+19, "+3.709584E+19", "%+#E", -__LINE__, 3.711137503697284e+22, "3.7111E+22", "%.5G", -__LINE__, 3.717307412969522e-22, "3.717307E-22", "%#E", -__LINE__, 3.717434999853808e+24, " 4E+24", "%6.G", -__LINE__, 3.720761662524312e+14, "+372076166252431.2285", "%+1.4f", -__LINE__, 3.721613815237707e-10, "3.72161e-10", "%g", -__LINE__, 3.725086467464346e+14, "3.72509E+14", "%G", -__LINE__, 3.727427083626536e-15, "+4E-15", "%+.0G", -__LINE__, 3.731138322599465e-13, "3.73114e-13", "%5g", -__LINE__, 3.732248129614146e-04, " 4E-04", "%7.E", -__LINE__, 3.744422223926118e-24, "3.744422E-24", "%E", -__LINE__, 3.745595428897916e+21, "+3745595428897916079336.027906", "%+f", -__LINE__, 3.751308304055989e-08, "+3.751308e-08", "%+e", -__LINE__, 3.755395417696132e-02, "0.037554", "%f", -__LINE__, 3.769103881505159e+09, "3.7691e+09", "%g", -__LINE__, 3.769535572757430e+00, "3.769536", "%6.7G", -__LINE__, 3.770823872348274e-28, "+0.000000", "%+f", -__LINE__, 3.771160653578178e+29, "3.77116e+29", "%g", -__LINE__, 3.776563752716444e-12, "4E-12", "%.0E", -__LINE__, 3.777953798674786e-28, "3.77795e-28", "%g", -__LINE__, 3.785994690686598e+28, "4E+28", "%5.G", -__LINE__, 3.787487488835162e+01, "+37.874875", "%+5f", -__LINE__, 3.788249311173359e-18, "3.788249E-18", "%E", -__LINE__, 3.798728360791314e-08, "3.798728E-08", "%2E", -__LINE__, 3.799038238867092e+05, "3.79904E+05", "%.5E", -__LINE__, 3.799822564549600e+06, "3.79982E+06", "%.5E", -__LINE__, 3.804862840499834e-16, "0", "%1.f", -__LINE__, 3.805375156822481e+12, "3805375156822.4814861", "%.7f", -__LINE__, 3.821612790153376e-17, "3.821613e-17", "%e", -__LINE__, 3.825193659558693e+14, "3.82519E+14", "%#G", -__LINE__, 3.834180638680996e+17, "+383418063868099565.638659", "%+f", -__LINE__, 3.834759760605814e-12, "3.83476E-12", "%G", -__LINE__, 3.839786235582770e+16, "+3.84e+16", "%+0.3g", -__LINE__, 3.843164462248778e+28, "3.84316e+28", "%#g", -__LINE__, 3.845599697858050e+22, "3.8456E+22", "%G", -__LINE__, 3.850147271017228e-21, "3.85e-21", "%.4g", -__LINE__, 3.850283557812101e+07, "3.85028E+07", "%G", -__LINE__, 3.854235609725703e+03, "3854.24", "%G", -__LINE__, 3.864901885489405e-15, "3.8649E-15", "%G", -__LINE__, 3.868630187629983e-24, "3.868630e-24", "%e", -__LINE__, 3.876764606134972e-03, "+3.8767646e-03", "%+#0.7e", -__LINE__, 3.884553592855422e+08, "+3.8845536e+08", "%+4.7e", -__LINE__, 3.887417494351062e+03, "3887.42", "%0g", -__LINE__, 3.887561018972304e+03, "3887.56", "%G", -__LINE__, 3.888554801724658e-24, "3.888555e-24", "%e", -__LINE__, 3.892806891909861e-01, "0.389281", "%f", -__LINE__, 3.914459791345755e+15, "+3.914460E+15", "%+E", -__LINE__, 3.918383209642759e+01, "39.1838", "%#G", -__LINE__, 3.923970658741865e-10, "3.92397E-10", "%G", -__LINE__, 3.928163650272335e+18, "3928163650272335161.162118", "%f", -__LINE__, 3.933053127721002e-20, "3.933053e-20", "%e", -__LINE__, 3.939306552155218e-29, "3.93931E-29", "%G", -__LINE__, 3.953007066379472e+07, "3.953007E+07", "%E", -__LINE__, 3.954924824986267e-01, "3.954925E-01", "%E", -__LINE__, 3.956156072067987e+15, "3.956E+15", "%0.4G", -__LINE__, 3.957756196797224e+22, "4.0E+22", "%4.1E", -__LINE__, 3.960011413261009e+27, "+3960011413261008783592842519.283295", "%+f", -__LINE__, 3.961789076323378e+20, "396178907632337828914.614875", "%f", -__LINE__, 3.961985468081708e-28, "3.96199E-28", "%1G", -__LINE__, 3.975007582283812e-27, "0.000000", "%0.6f", -__LINE__, 3.987586813142132e+15, "+3.98759e+15", "%+g", -__LINE__, 3.992250836957379e+21, "3.99225E+21", "%0G", -__LINE__, 3.992985048620057e+00, "3.9930", "%.4f", -__LINE__, 4.000000000000000e+02, "400.00", "%.2f", -__LINE__, 4.000145414240556e+14, "4.00015e+14", "%#6g", -__LINE__, 4.000774453529974e-25, "4E-25", "%.0E", -__LINE__, 4.002041494804383e+17, "4.002041E+17", "%E", -__LINE__, 4.005505415013214e+17, " 4E+17", "%6.2G", -__LINE__, 4.008960306876491e-28, "0.000", "%.3f", -__LINE__, 4.032337828117640e+16, "4.03234E+16", "%G", -__LINE__, 4.035414597530057e+26, "403541459753005682387083652.429283", "%f", -__LINE__, 4.037065874793069e-01, "0.403707", "%f", -__LINE__, 4.047856284449970e-14, "4.04786E-14", "%#G", -__LINE__, 4.049037221323070e-04, "4.049037e-04", "%e", -__LINE__, 4.053458853142009e-07, "4E-07", "%2.0E", -__LINE__, 4.056455443275955e-22, "4.056455e-22", "%e", -__LINE__, 4.058158020771355e-22, "4.05816e-22", "%#2g", -__LINE__, 4.067283508945137e+02, "+4.07e+02", "%+5.2e", -__LINE__, 4.072155715199509e+11, "4.072e+11", "%.4g", -__LINE__, 4.074643403755990e-22, "4e-22", "%0.g", -__LINE__, 4.077450352325251e+08, "4.1e+08", "%3.2g", -__LINE__, 4.081492619284916e-08, "4.081493E-08", "%E", -__LINE__, 4.083271801996951e-10, "4.083272E-10", "%#E", -__LINE__, 4.090188547940879e-15, "4.090189E-15", "%#E", -__LINE__, 4.091167728938537e-11, "4e-11", "%1.g", -__LINE__, 4.091916745541154e+15, "4091916745541153.588306", "%f", -__LINE__, 4.092366122921161e+23, "4E+23", "%0.E", -__LINE__, 4.094638368212577e-11, "4.09464E-11", "%#G", -__LINE__, 4.097148443124199e-16, "0.000000", "%f", -__LINE__, 4.101057893946401e+06, "4e+06", "%4.g", -__LINE__, 4.101209521231476e+28, "41012095212314756409455185348.633677", "%f", -__LINE__, 4.105683659045903e+05, "+4.E+05", "%+#1.G", -__LINE__, 4.111553717385758e-16, "4.11155e-16", "%g", -__LINE__, 4.112186409918593e+14, "+4.11219e+14", "%+g", -__LINE__, 4.117782144860865e+25, "4.117782E+25", "%5E", -__LINE__, 4.119420921722146e-27, "4.11942e-27", "%g", -__LINE__, 4.134953783635018e+14, "+4.1349538e+14", "%+.7e", -__LINE__, 4.136990822648468e+11, "4.136991E+11", "%E", -__LINE__, 4.140475788523046e+14, "+4E+14", "%+5.G", -__LINE__, 4.149589679915584e+24, "4.14959E+24", "%2G", -__LINE__, 4.151240342256744e-22, " 0", "%2.f", -__LINE__, 4.155533104307272e-04, "+0.000416", "%+f", -__LINE__, 4.155890511880097e+25, "4.155891e+25", "%e", -__LINE__, 4.159907901074450e-19, "4.159908E-19", "%7E", -__LINE__, 4.171899783464252e+18, "4E+18", "%.0E", -__LINE__, 4.177920266276382e-17, "+0.0000", "%+1.4f", -__LINE__, 4.181728014477237e-20, "4.18173e-20", "%.6g", -__LINE__, 4.203600495086497e-30, " 4E-30", "%6.G", -__LINE__, 4.211166112605717e-08, "4E-08", "%5.1G", -__LINE__, 4.219513437404614e+18, "+4E+18", "%+.0E", -__LINE__, 4.221426315236785e+08, "4.221426E+08", "%#E", -__LINE__, 4.226224756005934e-13, " 4.e-13", "%#7.g", -__LINE__, 4.226979046489921e-01, "4.226979e-01", "%#.6e", -__LINE__, 4.236283521629158e-08, "+4.23628E-08", "%+G", -__LINE__, 4.239850628514233e-07, "4.23985E-07", "%.6G", -__LINE__, 4.241177358638621e+04, "42411.773586", "%2f", -__LINE__, 4.245306724398964e-13, "0.000000", "%#f", -__LINE__, 4.246194290300334e+16, "42461942903003340.177293", "%2f", -__LINE__, 4.251238996137952e-05, "4.25124E-05", "%3G", -__LINE__, 4.262432542017438e+13, "42624325420174.375978", "%1f", -__LINE__, 4.266383084300715e+16, "4E+16", "%4.G", -__LINE__, 4.292963398931474e-11, "4.292963E-11", "%E", -__LINE__, 4.296530271399131e-29, "0.000000", "%6f", -__LINE__, 4.303753949741171e+19, "4.30375E+19", "%2G", -__LINE__, 4.303767633827431e-28, "4.30377e-28", "%g", -__LINE__, 4.316181911403991e-30, "4.3162e-30", "%#7.5g", -__LINE__, 4.318654697213126e-18, "4.31865e-18", "%g", -__LINE__, 4.320618603119499e+05, "432061.860312", "%3f", -__LINE__, 4.322443609118441e+21, "4.32244E+21", "%7.5E", -__LINE__, 4.322522446810708e-15, "4.32252e-15", "%.6g", -__LINE__, 4.334728493589115e-18, "0.000000", "%f", -__LINE__, 4.335342531476346e-19, "4.33534E-19", "%G", -__LINE__, 4.340579325084176e-30, "4.34058e-30", "%#0.6g", -__LINE__, 4.340775659883185e+04, "43407.756599", "%6f", -__LINE__, 4.361131891528634e-14, " 4E-14", "%6.G", -__LINE__, 4.366662624371249e-02, "+0.04", "%+4.g", -__LINE__, 4.369919308458348e+28, "+4.36992e+28", "%+2g", -__LINE__, 4.369930393192433e-24, "4.369930e-24", "%e", -__LINE__, 4.376283118322521e-01, "0.437628", "%g", -__LINE__, 4.386868840825930e+19, "4.3869E+19", "%.5G", -__LINE__, 4.389349113395235e+05, "+4.389349e+05", "%+e", -__LINE__, 4.392447466753053e-08, "+4.392E-08", "%+.4G", -__LINE__, 4.394068619246889e-13, "4.39407e-13", "%6g", -__LINE__, 4.404889573700147e-09, "4.404890E-09", "%E", -__LINE__, 4.410531039373014e+05, "+4.41e+05", "%+.2e", -__LINE__, 4.412466606726400e-08, " 0.0", "%6.1f", -__LINE__, 4.414693719279123e+17, "4.414694e+17", "%e", -__LINE__, 4.417050329080679e-01, "+0.441705", "%+g", -__LINE__, 4.419509841929196e-10, "4.4195098E-10", "%.7E", -__LINE__, 4.421012777695611e+07, "+4.42101E+07", "%+0.6G", -__LINE__, 4.426387732151208e+11, "4.42639e+11", "%g", -__LINE__, 4.439567017550398e+26, "4.439567E+26", "%E", -__LINE__, 4.446479816166258e-21, "4.446480e-21", "%0e", -__LINE__, 4.453486178424380e+05, "445348.617842", "%f", -__LINE__, 4.455733696043438e+06, "4.45573e+06", "%3g", -__LINE__, 4.455870606312063e+16, "4.45587e+16", "%g", -__LINE__, 4.458776435431700e+22, "4e+22", "%1.g", -__LINE__, 4.466448605584151e-30, "0.000000", "%f", -__LINE__, 4.471063097005706e+16, "4.47106E+16", "%G", -__LINE__, 4.482001890035190e-22, "+4.482E-22", "%+G", -__LINE__, 4.493246870093631e+05, "449325", "%1G", -__LINE__, 4.496089639281023e+17, "4.49609e+17", "%g", -__LINE__, 4.515066070117557e+15, "4.51507e+15", "%g", -__LINE__, 4.518296460916194e+24, "+4.5183E+24", "%+G", -__LINE__, 4.526548719445596e+02, "452.655", "%6.3f", -__LINE__, 4.532756455106440e-26, "4.53e-26", "%4.2e", -__LINE__, 4.534466782633055e-14, "4.53447E-14", "%G", -__LINE__, 4.541313061854649e-14, "4.54131E-14", "%G", -__LINE__, 4.541848265404338e+02, " 5E+02", "%7.G", -__LINE__, 4.546603085406363e-26, "5E-26", "%3.G", -__LINE__, 4.557349604829375e+28, "+45573496048293753446500886639.", "%+#1.f", -__LINE__, 4.560736449944898e-27, "4.56074e-27", "%g", -__LINE__, 4.563726230559341e-15, "+0.0", "%+2.1f", -__LINE__, 4.572650965532532e-26, "+5E-26", "%+4.G", -__LINE__, 4.574369572115099e-10, "+0.000000", "%+2.6f", -__LINE__, 4.576480601519729e+28, "+4.576481e+28", "%+e", -__LINE__, 4.587487640650499e+02, "+458.75", "%+3.2f", -__LINE__, 4.598365231538559e-27, "4.59837E-27", "%G", -__LINE__, 4.599348244725009e-28, "+4.5993482e-28", "%+#3.7e", -__LINE__, 4.599897524047587e+22, "45998975240475870052136.997401", "%#f", -__LINE__, 4.605415604725077e-25, "0.000000", "%f", -__LINE__, 4.613055015797716e+28, "4.613055E+28", "%E", -__LINE__, 4.618715275814238e-10, "4.618715E-10", "%E", -__LINE__, 4.619044579489540e-14, "0.00", "%.2f", -__LINE__, 4.633693310095410e-20, "+0.000000", "%+f", -__LINE__, 4.648505395281916e-28, "0.000000", "%f", -__LINE__, 4.651232770446398e+21, "4.65e+21", "%.2e", -__LINE__, 4.659743589975352e+28, "+4.65974e+28", "%+g", -__LINE__, 4.660181457075208e-13, "4.66018e-13", "%g", -__LINE__, 4.669787018529686e+20, "4.66979e+20", "%g", -__LINE__, 4.672649286126732e-21, "4.6726E-21", "%4.5G", -__LINE__, 4.675431901120643e-11, " 0", "%3.f", -__LINE__, 4.684404068169945e+26, "468440406816994503458317922.2", "%6.1f", -__LINE__, 4.685438834234642e+19, "5.E+19", "%#6.G", -__LINE__, 4.688915890732712e+00, "+5e+00", "%+2.e", -__LINE__, 4.692999432046297e+00, "4.692999E+00", "%E", -__LINE__, 4.708690772584701e+11, "4.70869e+11", "%g", -__LINE__, 4.711821455782105e-11, "+4.71182e-11", "%+1g", -__LINE__, 4.712413965116830e-01, "4.712414E-01", "%E", -__LINE__, 4.719504715401049e-08, "0.000000", "%f", -__LINE__, 4.719767896031655e+27, "4.71977e+27", "%#g", -__LINE__, 4.722493017411588e-05, "0.000047", "%4f", -__LINE__, 4.729482386761477e+08, "4.72948e+08", "%1g", -__LINE__, 4.730102169800602e-06, "0.000005", "%f", -__LINE__, 4.743951614209393e+24, "4.743952E+24", "%#E", -__LINE__, 4.746077075605921e-16, "4.746E-16", "%.3E", -__LINE__, 4.747802537919248e+24, "4747802537919247889419694", "%4.f", -__LINE__, 4.754727690703025e-26, "0", "%0.f", -__LINE__, 4.756952432926979e-29, " 0.", "%#3.f", -__LINE__, 4.758335147956709e+03, "4758.335148", "%f", -__LINE__, 4.760141880810268e-25, "4.760142e-25", "%e", -__LINE__, 4.767079423650815e-07, "5.E-07", "%#0.G", -__LINE__, 4.785662728343338e-28, "4.78566e-28", "%g", -__LINE__, 4.787146245774150e-13, "+4.78715E-13", "%+G", -__LINE__, 4.787415449888824e-17, "4.78742e-17", "%3g", -__LINE__, 4.794589807429657e-05, "4.79459E-05", "%6G", -__LINE__, 4.794948299666205e+08, "4.79495e+08", "%g", -__LINE__, 4.802292865915992e-04, "4.802293e-04", "%e", -__LINE__, 4.802513688198601e+07, "+4.8e+07", "%+2.3g", -__LINE__, 4.810456746192536e+06, "5E+06", "%0.0G", -__LINE__, 4.820631660081696e+20, "+4.82063E+20", "%+G", -__LINE__, 4.827865857270075e-20, "4.82787e-20", "%g", -__LINE__, 4.835054268490970e+21, "4835054268490970308391.752042", "%#f", -__LINE__, 4.838136770808465e-18, "4.83814E-18", "%G", -__LINE__, 4.839342397882353e-26, "4.839342E-26", "%E", -__LINE__, 4.845130210072029e-16, "0", "%1.f", -__LINE__, 4.845161043167169e-12, "+4.845e-12", "%+.4g", -__LINE__, 4.857425142494964e+01, "48.574251", "%f", -__LINE__, 4.858118337285513e-10, "+4.8581e-10", "%+.5g", -__LINE__, 4.867478343525339e-15, "+4.867478E-15", "%+E", -__LINE__, 4.886137001331278e-11, "0.000000", "%f", -__LINE__, 4.886835850687998e-20, " 0", "%6.0f", -__LINE__, 4.886880737482383e+26, "488688073748238327453918827.814050", "%4f", -__LINE__, 4.888812049144075e-22, "4.888812E-22", "%E", -__LINE__, 4.895869618002905e+02, "+489.587", "%+.7g", -__LINE__, 4.902046593298549e+09, " 5e+09", "%7.g", -__LINE__, 4.907918627564751e-05, "4.91e-05", "%.3g", -__LINE__, 4.916048355579009e+19, "49160483555790088772", "%2.f", -__LINE__, 4.917197806128638e+14, "+5e+14", "%+5.g", -__LINE__, 4.918303274189911e+13, "4.918303e+13", "%e", -__LINE__, 4.922687970321108e+26, "492268797032110771993984599.2485", "%0.4f", -__LINE__, 4.929263362431195e+14, "4.92926e+14", "%g", -__LINE__, 4.933385398543267e-17, "0.000000", "%#f", -__LINE__, 4.942367126455025e+00, " +5", "%+6.f", -__LINE__, 4.947687486717652e-04, "0.000495", "%.6f", -__LINE__, 4.960855200003128e-08, "+4.960855e-08", "%+e", -__LINE__, 4.968485435774085e-21, "0.0000", "%#2.4f", -__LINE__, 4.972088381506133e+01, "49.7", "%.1f", -__LINE__, 4.977561524480392e-15, "4.977562E-15", "%7E", -__LINE__, 4.984592111249502e-13, "5.0e-13", "%.1e", -__LINE__, 4.997502335602838e-14, "4.998e-14", "%6.4g", -__LINE__, 5.001731554335935e-09, "5.00173e-09", "%g", -__LINE__, 5.006231697107042e-17, "5.0062e-17", "%1.5g", -__LINE__, 5.008035801093423e+24, "5.008036E+24", "%#E", -__LINE__, 5.008756965733827e-28, "5.009E-28", "%.4G", -__LINE__, 5.009774027622812e+20, "+5.00977E+20", "%+G", -__LINE__, 5.010576312346293e+29, "5.01058E+29", "%G", -__LINE__, 5.012335250996786e+29, "5.012335e+29", "%.7g", -__LINE__, 5.012404365186907e+20, "5E+20", "%3.2G", -__LINE__, 5.024670103250229e-01, "+5.024670E-01", "%+E", -__LINE__, 5.025765369164560e+03, "5025.77", "%g", -__LINE__, 5.027173841003918e+11, "+5.02717E+11", "%+G", -__LINE__, 5.032093817639893e-26, "5e-26", "%3.e", -__LINE__, 5.039636818525848e-02, "0.050396", "%#f", -__LINE__, 5.040626671307691e+23, "5.040627E+23", "%E", -__LINE__, 5.040788233368296e-11, "+5.04079e-11", "%+g", -__LINE__, 5.040903321336150e-28, "5.0409E-28", "%G", -__LINE__, 5.042078512958994e+12, "5.04208E+12", "%G", -__LINE__, 5.045957900223303e+15, "5045957900223303", "%0.f", -__LINE__, 5.048298764352134e-14, "5.048299e-14", "%1e", -__LINE__, 5.048827326763192e+28, "50488273267631917917697137454.524636", "%f", -__LINE__, 5.049714558347361e-23, "5e-23", "%5.0g", -__LINE__, 5.051509904923853e+16, "50515099049238534", "%5.f", -__LINE__, 5.052789863743305e-10, "5.05279E-10", "%6G", -__LINE__, 5.057429728861999e-29, "0.000", "%#1.3f", -__LINE__, 5.075313093968501e-13, "+5.07531e-13", "%+g", -__LINE__, 5.075874503501582e+29, "5e+29", "%2.e", -__LINE__, 5.079468079020803e+01, "50.795", "%.5G", -__LINE__, 5.086214826494080e-28, " 0.0", "%4.1f", -__LINE__, 5.096054881114421e+13, "5.096e+13", "%.4g", -__LINE__, 5.099045274853458e-23, "5.09905E-23", "%0G", -__LINE__, 5.100248195124433e+00, "5.100248", "%f", -__LINE__, 5.101016114276598e-20, "5e-20", "%4.1g", -__LINE__, 5.103213528670269e+07, "51032135.286703", "%6f", -__LINE__, 5.108373625126768e+08, "+510837362.512677", "%+f", -__LINE__, 5.113097157183416e+07, "5.1131E+07", "%#.4E", -__LINE__, 5.114452611789777e+08, "+5.11445E+08", "%+G", -__LINE__, 5.117099184715288e-16, "5.1171E-16", "%G", -__LINE__, 5.119910534665511e-13, "+5.11991E-13", "%+G", -__LINE__, 5.121320931953720e+23, "+5.121321e+23", "%+#e", -__LINE__, 5.121900318443998e+06, "5.121900e+06", "%e", -__LINE__, 5.135698679084286e+00, "5.1357", "%2g", -__LINE__, 5.146355903104154e-10, "+5.14636E-10", "%+.6G", -__LINE__, 5.148754210958986e-24, "+5.148754e-24", "%+e", -__LINE__, 5.156238368448428e+26, "5e+26", "%5.g", -__LINE__, 5.159924520667922e-19, "+5E-19", "%+0.1G", -__LINE__, 5.159938266135425e-27, "0.000000", "%f", -__LINE__, 5.165915205175676e-01, "5.165915e-01", "%e", -__LINE__, 5.190205499401547e-11, "5e-11", "%2.1g", -__LINE__, 5.193260005542003e+26, "5.19326e+26", "%#g", -__LINE__, 5.194732077318269e+08, "519473207.731827", "%f", -__LINE__, 5.196394616633798e-19, "0", "%.0f", -__LINE__, 5.206753628035638e+19, "5.20675e+19", "%6.6g", -__LINE__, 5.207364136540851e-23, " 0.000", "%6.3f", -__LINE__, 5.210672737132108e-09, "5.21067E-09", "%G", -__LINE__, 5.211423933057123e-20, "+5.21142E-20", "%+G", -__LINE__, 5.219749528363367e-27, "5.219750e-27", "%e", -__LINE__, 5.228031587478653e-06, "+5.2E-06", "%+3.1E", -__LINE__, 5.229303095005359e-25, "+0.000000", "%+#f", -__LINE__, 5.234703511938320e-06, " 0", "%7.f", -__LINE__, 5.235655046937822e-20, "5.235655E-20", "%.6E", -__LINE__, 5.237924986002288e-01, "+0.52379", "%+.5f", -__LINE__, 5.249148093603826e+20, "5.24915E+20", "%0G", -__LINE__, 5.262680920244596e+16, "5.26268E+16", "%G", -__LINE__, 5.267944704715845e-06, "5.e-06", "%#3.g", -__LINE__, 5.268543533730505e-08, "5.26854E-08", "%G", -__LINE__, 5.275727269515247e-02, "0.0527573", "%.6g", -__LINE__, 5.279215316873723e+24, "5279215316873722585455652.733799", "%f", -__LINE__, 5.284326985680811e+16, "52843269856808108.286828", "%6f", -__LINE__, 5.286192957344040e-10, "5.3E-10", "%.1E", -__LINE__, 5.289451976001091e-23, "5.28945E-23", "%G", -__LINE__, 5.289512908209300e+09, "+5.289513e+09", "%+e", -__LINE__, 5.295696957972123e+11, "5.296E+11", "%#.3E", -__LINE__, 5.303584684011050e+16, "53035846840110503.208621", "%f", -__LINE__, 5.310315581980172e+23, "531031558198017172855998", "%4.f", -__LINE__, 5.317492728410062e-14, "5.31749e-14", "%7g", -__LINE__, 5.324506949499409e+18, "5.3245E+18", "%.5G", -__LINE__, 5.329238068668336e-20, "5e-20", "%4.g", -__LINE__, 5.336050125161774e+14, "5.33605e+14", "%g", -__LINE__, 5.349921315003169e-17, "5.34992E-17", "%.6G", -__LINE__, 5.355648481782587e-20, "5.355648e-20", "%e", -__LINE__, 5.358945557589489e-26, "+5e-26", "%+0.g", -__LINE__, 5.359638846465574e+21, "5.359639E+21", "%E", -__LINE__, 5.377048469393900e+14, "5.377E+14", "%.5G", -__LINE__, 5.387471194156434e+23, "5.387471E+23", "%.7G", -__LINE__, 5.401622578962497e-03, "+0.0054", "%+5.2g", -__LINE__, 5.406882732497444e-16, "5.406883E-16", "%E", -__LINE__, 5.421474560523198e-11, "+5.42147e-11", "%+g", -__LINE__, 5.440249323479418e-26, "5.44025E-26", "%7G", -__LINE__, 5.440922682921101e-05, "5e-05", "%.1g", -__LINE__, 5.444400103673185e-01, "0.54444", "%G", -__LINE__, 5.449339470916152e+09, "5449339470.9162", "%.4f", -__LINE__, 5.451583259558706e-15, "5.e-15", "%#4.e", -__LINE__, 5.460153018660573e+26, "+546015301866057267687892817.775719", "%+f", -__LINE__, 5.477591210511918e+08, "+5.47759E+08", "%+0.5E", -__LINE__, 5.481665401407188e-02, "5.481665e-02", "%e", -__LINE__, 5.482670784411319e-16, "5E-16", "%4.G", -__LINE__, 5.487494580636099e+12, "5.48749e+12", "%g", -__LINE__, 5.508630369473937e-10, "5.508630e-10", "%e", -__LINE__, 5.528898001438273e+20, "6e+20", "%4.g", -__LINE__, 5.530331734443152e-24, " 6e-24", "%6.g", -__LINE__, 5.531704398969656e-24, "0.000000", "%f", -__LINE__, 5.539906569043238e+05, "+553990.656904", "%+f", -__LINE__, 5.554571854756323e-08, "+0.00000", "%+4.5f", -__LINE__, 5.555155069925145e-28, "5.55516e-28", "%g", -__LINE__, 5.555302705075539e-08, "+5.5553e-08", "%+g", -__LINE__, 5.563805076159055e-05, "5.563805e-05", "%e", -__LINE__, 5.565063508995002e+07, "5.565E+07", "%.3E", -__LINE__, 5.566281664807526e-08, "5.56628E-08", "%G", -__LINE__, 5.575245679736338e-08, "5.575246e-08", "%e", -__LINE__, 5.578254777281501e-21, "0.", "%#.0f", -__LINE__, 5.582389275770848e-01, " 0.6", "%5.G", -__LINE__, 5.592215029176133e-04, "0.00056", "%.2g", -__LINE__, 5.593536789867047e-25, "5.59354e-25", "%g", -__LINE__, 5.605652054074862e-03, " 0.006", "%8.G", -__LINE__, 5.606982382643258e+20, "+5.60698E+20", "%+G", -__LINE__, 5.614646821116853e-18, "5.6E-18", "%.2G", -__LINE__, 5.625586848606565e-11, "+5.62559E-11", "%+G", -__LINE__, 5.626300428046732e+26, " 6e+26", "%7.g", -__LINE__, 5.638236626881086e-17, " 6E-17", "%6.G", -__LINE__, 5.645744817075691e+04, "5.645745E+04", "%E", -__LINE__, 5.651410004691736e+06, "6.E+06", "%#3.E", -__LINE__, 5.659582345929256e-11, "+0.000000", "%+f", -__LINE__, 5.670968861413510e+16, "+5.67097E+16", "%+G", -__LINE__, 5.672476851235796e+01, "+56.724769", "%+0f", -__LINE__, 5.674563779921248e+28, " 6E+28", "%6.0G", -__LINE__, 5.675558529939025e+19, "5.67556e+19", "%3g", -__LINE__, 5.676326888314589e-08, " 6e-08", "%7.g", -__LINE__, 5.677928507840897e-30, "5.67793e-30", "%0g", -__LINE__, 5.686622552402630e-15, "5.69E-15", "%1.3G", -__LINE__, 5.710441686922142e-14, "5.710442E-14", "%E", -__LINE__, 5.713234603280163e-21, "0.00000", "%0.5f", -__LINE__, 5.714968959046963e+12, "5.71497e+12", "%g", -__LINE__, 5.722025141555638e-23, "5.72e-23", "%.2e", -__LINE__, 5.725398571007033e-09, "5.7254E-09", "%.6G", -__LINE__, 5.751604813862738e+18, "6E+18", "%.1G", -__LINE__, 5.761025444751985e+20, "5.76103e+20", "%g", -__LINE__, 5.762315767948593e+15, "5.76232e+15", "%4g", -__LINE__, 5.764528858586032e-15, "5.764529E-15", "%6.7G", -__LINE__, 5.766408541535810e-07, " 6E-07", "%6.1G", -__LINE__, 5.771831571087174e-01, "0.577183", "%f", -__LINE__, 5.790102497364865e-15, "+5.790102e-15", "%+e", -__LINE__, 5.790222335547785e-08, "5.79022e-08", "%0.6g", -__LINE__, 5.794082127091130e+21, "5794082127091130018925.468903", "%f", -__LINE__, 5.804568463644165e+28, "5.80457e+28", "%g", -__LINE__, 5.827356651901066e+20, "582735665190106555400.006982", "%f", -__LINE__, 5.837553387436408e+18, "5.837553E+18", "%3E", -__LINE__, 5.844458110907209e+22, "5.84446e+22", "%g", -__LINE__, 5.851672125746866e-19, "5.85167e-19", "%g", -__LINE__, 5.868843476784172e-12, "5.868843e-12", "%1.7g", -__LINE__, 5.870854146748864e-04, "0.000587", "%2.3g", -__LINE__, 5.877787821470433e+01, "+58.77788", "%+#3.5f", -__LINE__, 5.881333514866498e+04, "5.881334E+04", "%E", -__LINE__, 5.908427816128965e+28, "+5.908428E+28", "%+E", -__LINE__, 5.918139800007388e+07, "59181398.000074", "%f", -__LINE__, 5.925587467475260e+21, "5925587467475259551008.548442", "%f", -__LINE__, 5.930403502679683e-22, "5.9304E-22", "%.6G", -__LINE__, 5.961572644847521e+02, "+596.157", "%+G", -__LINE__, 5.968917715225198e-21, "5.96892e-21", "%4g", -__LINE__, 5.982184454670110e-08, "0", "%0.f", -__LINE__, 5.988414319040855e+09, "6E+09", "%0.G", -__LINE__, 5.996263783103995e-10, "5.996264e-10", "%e", -__LINE__, 6.004634162276014e-18, "6.00463e-18", "%g", -__LINE__, 6.018734975519166e-08, "6.01873E-08", "%G", -__LINE__, 6.029071822986717e-14, "0.0000000", "%.7f", -__LINE__, 6.030392278117406e+23, "6.030392e+23", "%e", -__LINE__, 6.034553399237175e-27, "+6.03455e-27", "%+g", -__LINE__, 6.034938873443862e+24, "6034938873443861595546877.651941", "%f", -__LINE__, 6.038929148003457e-16, "6.03893e-16", "%g", -__LINE__, 6.039149626573702e-13, "6.0391E-13", "%3.5G", -__LINE__, 6.041247664739301e+29, "6.041248E+29", "%3E", -__LINE__, 6.044220746789781e+20, "+6.04422e+20", "%+g", -__LINE__, 6.045775647107433e+19, "6E+19", "%2.G", -__LINE__, 6.051917010461611e-05, "6.05192E-05", "%G", -__LINE__, 6.059773181566425e+17, "+605977318156642486", "%+5.f", -__LINE__, 6.082239575475813e+01, "+6E+01", "%+.1G", -__LINE__, 6.093984174629151e+18, "6.093984e+18", "%e", -__LINE__, 6.102368380479137e+22, "6.1E+22", "%.2G", -__LINE__, 6.103097446204007e+25, "61030974462040070704915706.301108", "%#0f", -__LINE__, 6.105244994410556e-24, "0.0000000", "%2.7f", -__LINE__, 6.110828906801633e-14, "+6.110829e-14", "%+3e", -__LINE__, 6.124439072468681e-30, "6.12444e-30", "%g", -__LINE__, 6.127714703273447e-15, "0", "%0.f", -__LINE__, 6.128539582408870e-15, "6.12854e-15", "%g", -__LINE__, 6.145470264744349e+24, "6145470264744348654062378.045637", "%f", -__LINE__, 6.159177701667455e+26, "615917770166745537352426254.074089", "%#f", -__LINE__, 6.159348213337442e+17, "6.15935e+17", "%g", -__LINE__, 6.161953891020492e-21, "0.000000", "%f", -__LINE__, 6.169474192777305e+29, "+6.169E+29", "%+.4G", -__LINE__, 6.198519761010651e-15, "+0", "%+1.f", -__LINE__, 6.201381824304919e-27, " 0", "%5.f", -__LINE__, 6.204387065736372e-18, "6.204387E-18", "%7E", -__LINE__, 6.209270088144063e-24, "0.000000", "%f", -__LINE__, 6.209871738353546e-20, "6.20987E-20", "%G", -__LINE__, 6.222733191871026e+14, "+6.22273e+14", "%+g", -__LINE__, 6.234670085354310e+04, "+62346.700854", "%+f", -__LINE__, 6.258389346602224e-09, "6E-09", "%.0G", -__LINE__, 6.263326582587503e+12, "6263326582588.", "%#5.f", -__LINE__, 6.272768026763922e+03, "+6272.77", "%+g", -__LINE__, 6.287747868625765e+00, "6E+00", "%.0E", -__LINE__, 6.297724027388795e-17, "+6E-17", "%+3.G", -__LINE__, 6.309940679156400e+27, "6.30994e+27", "%6.5e", -__LINE__, 6.312960327030170e+06, "+6.312960E+06", "%+E", -__LINE__, 6.317658179632976e+02, "+631.766", "%+g", -__LINE__, 6.321255960699571e-27, "0.000000", "%f", -__LINE__, 6.323069932833900e+03, "6323", "%.4G", -__LINE__, 6.337027835933034e+21, "6.33703e+21", "%#g", -__LINE__, 6.343583177899838e-03, "0.00634358", "%7G", -__LINE__, 6.347464241733904e-03, "6.e-03", "%#0.e", -__LINE__, 6.352038720353924e+07, "63520387.203539", "%f", -__LINE__, 6.355292378565109e+23, "+635529237856510942350496.407016", "%+f", -__LINE__, 6.377901944439164e-29, "0.000", "%2.3f", -__LINE__, 6.378660255554053e-04, "6.37866E-04", "%.5E", -__LINE__, 6.382838195255167e-18, "0.000000", "%f", -__LINE__, 6.391046303581911e+22, "6E+22", "%.0G", -__LINE__, 6.404812348309621e+22, "6.404812E+22", "%.7G", -__LINE__, 6.406154091357119e+16, "6.40615E+16", "%G", -__LINE__, 6.419414726557980e+21, "+6.41941e+21", "%+g", -__LINE__, 6.432166563008504e+10, " +6e+10", "%+7.g", -__LINE__, 6.438463704193190e+19, "6.438464e+19", "%e", -__LINE__, 6.445270237908565e+15, "+6.445270E+15", "%+E", -__LINE__, 6.445536770502964e+09, "6.446e+09", "%.3e", -__LINE__, 6.446614224811444e+28, "64466142248114444157636171439.662576", "%f", -__LINE__, 6.457046289718297e+18, "6457046289718297416.015957", "%4f", -__LINE__, 6.457682856890173e+01, "6.457683E+01", "%2E", -__LINE__, 6.471026352792729e-16, "+6.47103e-16", "%+g", -__LINE__, 6.474527749567342e+19, "6E+19", "%.1G", -__LINE__, 6.481178401781131e-24, "+6.48E-24", "%+6.3G", -__LINE__, 6.490736647261461e-15, "+6.49074e-15", "%+g", -__LINE__, 6.493196535069719e+23, "+6.4932E+23", "%+G", -__LINE__, 6.500296992935538e-20, "+0.0", "%+.1f", -__LINE__, 6.502867735895890e-19, "+0.000000", "%+6f", -__LINE__, 6.506627529164683e+14, "650662752916468", "%5.f", -__LINE__, 6.511909298966434e-15, "+6.51191E-15", "%+G", -__LINE__, 6.514463062693312e+01, "65.1446", "%G", -__LINE__, 6.520721469484543e+16, "6.52072E+16", "%G", -__LINE__, 6.528064508731680e-05, "6.528065E-05", "%7E", -__LINE__, 6.529007214194039e-24, "0.000000", "%f", -__LINE__, 6.537822760557410e-23, "0.000000", "%f", -__LINE__, 6.552222096390805e+29, "+6.55222E+29", "%+G", -__LINE__, 6.554569862717104e+12, "6.55457E+12", "%G", -__LINE__, 6.563440840359989e-30, "7E-30", "%4.G", -__LINE__, 6.586246985535526e+17, "6.58625E+17", "%#4G", -__LINE__, 6.593339522442827e+16, "6.6E+16", "%#4.1E", -__LINE__, 6.611179030024350e+02, "7E+02", "%4.E", -__LINE__, 6.617541638586767e-10, "6.617542E-10", "%E", -__LINE__, 6.619147920886991e-28, "7e-28", "%.1g", -__LINE__, 6.622304444772819e-21, "6.62230E-21", "%#4G", -__LINE__, 6.634766655157910e+12, "6634766655158", "%2.f", -__LINE__, 6.635639771921218e+25, "+6.63564E+25", "%+G", -__LINE__, 6.644575305929087e+17, "+6.64458e+17", "%+g", -__LINE__, 6.648697591328432e+04, "6.648698E+04", "%3E", -__LINE__, 6.665426012448100e+09, "6.66543E+09", "%G", -__LINE__, 6.675222780441723e-23, "6.67522e-23", "%1g", -__LINE__, 6.689765053880623e+00, "6.6898", "%.5g", -__LINE__, 6.693874943680238e+25, "7.e+25", "%#1.g", -__LINE__, 6.695033453546435e+19, "6.695033E+19", "%E", -__LINE__, 6.720131534244976e+03, "+6720.132", "%+.3f", -__LINE__, 6.725287004784564e+19, "+6.72529e+19", "%+g", -__LINE__, 6.743599626906313e-18, "0.0000000", "%7.7f", -__LINE__, 6.755534260704152e+29, "7.e+29", "%#5.e", -__LINE__, 6.761855244766418e-18, "6.8E-18", "%.2G", -__LINE__, 6.764974143681080e-02, "6.765E-02", "%2.3E", -__LINE__, 6.766924477711975e-17, "0.000000", "%4f", -__LINE__, 6.772195434106330e-19, "6.7722E-19", "%G", -__LINE__, 6.779433073319225e-23, "0.00", "%.2f", -__LINE__, 6.790317710068964e+05, "6.8e+05", "%.1e", -__LINE__, 6.791378160292960e+02, "679.137816", "%f", -__LINE__, 6.798381262104190e-27, "0.000000", "%f", -__LINE__, 6.804165939424860e-14, "7e-14", "%4.g", -__LINE__, 6.810668670623699e+11, "681066867062.369852", "%f", -__LINE__, 6.838942637635821e-17, "+6.84e-17", "%+.2e", -__LINE__, 6.868523988329111e-09, "+6.868524e-09", "%+e", -__LINE__, 6.873228061403223e-15, "6.873228E-15", "%3E", -__LINE__, 6.879370500093334e-12, "+0.000000", "%+f", -__LINE__, 6.891525498686674e-10, "7e-10", "%0.g", -__LINE__, 6.923027319286220e+21, "7.e+21", "%#1.g", -__LINE__, 6.923565533024560e-11, "+6.92357e-11", "%+g", -__LINE__, 6.931415640770737e-24, "+6.93142e-24", "%+g", -__LINE__, 6.936582619246057e+09, "6.936583e+09", "%7e", -__LINE__, 6.938661496670582e+05, "693866.1496671", "%2.7f", -__LINE__, 6.946115378286550e-25, "0.000000", "%f", -__LINE__, 6.955823211921219e-09, "6.95582e-09", "%g", -__LINE__, 6.962365243425770e+29, "696236524342577034474288666388.019919", "%7f", -__LINE__, 6.970432274812882e+05, "+7e+05", "%+1.0e", -__LINE__, 6.975784942897122e-13, "6.975785e-13", "%e", -__LINE__, 6.976786489904214e-07, "6.97679E-07", "%3G", -__LINE__, 6.985245976357042e-05, "0.00", "%.2f", -__LINE__, 6.993402879410720e-21, "6.9934e-21", "%g", -__LINE__, 7.012183985341519e+28, "+70121839853415188770213717362", "%+2.f", -__LINE__, 7.028670648856025e-15, "7.028671e-15", "%.7g", -__LINE__, 7.034042985683665e-03, " 0", "%2.f", -__LINE__, 7.044054273278726e+18, "7.044e+18", "%7.4g", -__LINE__, 7.049706744250734e-06, "7E-06", "%0.E", -__LINE__, 7.061982657056197e+13, "+7.061983e+13", "%+e", -__LINE__, 7.066873668945899e+21, "7.06687E+21", "%G", -__LINE__, 7.087941418633258e+26, "7.08794E+26", "%G", -__LINE__, 7.108268134631547e+22, "7.108268E+22", "%E", -__LINE__, 7.112095848565475e-19, "7.1121e-19", "%g", -__LINE__, 7.116326241291862e+16, "7.116326e+16", "%e", -__LINE__, 7.118854843597607e-22, "0.000000", "%f", -__LINE__, 7.121423043456375e-27, "0.000000", "%f", -__LINE__, 7.131415427096460e-03, "0.007131", "%3f", -__LINE__, 7.132023279679892e+22, "7.e+22", "%#3.e", -__LINE__, 7.146250280189992e-18, "0.000000", "%f", -__LINE__, 7.150059058390724e+03, "7150.06", "%g", -__LINE__, 7.161081578177381e-02, "+0.0716108", "%+G", -__LINE__, 7.164935125149336e-27, "7.2E-27", "%#6.2G", -__LINE__, 7.173125717489549e-10, "7.173126e-10", "%e", -__LINE__, 7.174199549624193e+00, "7.1741995", "%.7f", -__LINE__, 7.192493588077649e+27, "7.19249e+27", "%g", -__LINE__, 7.215209568601445e-06, "7.215210e-06", "%e", -__LINE__, 7.238322284100497e+03, "7238.3", "%.1f", -__LINE__, 7.239203871123613e+06, "7239204", "%4.f", -__LINE__, 7.245809072577019e-09, "+7.245809E-09", "%+E", -__LINE__, 7.256275686433336e+03, "7.256276e+03", "%e", -__LINE__, 7.265774291605193e+27, "+7.26577E+27", "%+G", -__LINE__, 7.287968172227119e-21, "+7.287968e-21", "%+e", -__LINE__, 7.306020169678527e+12, "7E+12", "%2.E", -__LINE__, 7.315587463572568e-04, "0.", "%#.0f", -__LINE__, 7.324627764547963e+09, "7.324628E+09", "%#E", -__LINE__, 7.331904966719081e-06, "+7.3319E-06", "%+G", -__LINE__, 7.334448152798243e-02, "0.07", "%0.g", -__LINE__, 7.334487195961240e-01, "+0.733449", "%+#g", -__LINE__, 7.381283575515707e+13, "7.381284E+13", "%E", -__LINE__, 7.394854567245476e-11, "0.000000", "%7f", -__LINE__, 7.401950211415377e-08, " 7e-08", "%6.e", -__LINE__, 7.409023867864680e+03, "7409.023868", "%#3f", -__LINE__, 7.411912956257733e-20, "7e-20", "%0.g", -__LINE__, 7.445275019272160e+11, "744527501927.2159511", "%.7f", -__LINE__, 7.450279765616891e-16, "7.45028e-16", "%.6g", -__LINE__, 7.467047411334495e+14, "7.46705E+14", "%G", -__LINE__, 7.485628870972725e+28, "7E+28", "%.0G", -__LINE__, 7.495391782588563e+11, "749539178258.856253", "%f", -__LINE__, 7.495824101611911e+06, "7.49582e+06", "%.6g", -__LINE__, 7.499759867592402e+20, "+749975986759240154100.3", "%+.1f", -__LINE__, 7.508983397140368e+04, "75089.8", "%g", -__LINE__, 7.512585199581016e-27, "7.512585E-27", "%.6E", -__LINE__, 7.516831372212545e-29, "+7.516831e-29", "%+e", -__LINE__, 7.525789465978582e+00, "7.52579", "%G", -__LINE__, 7.528655653725963e+06, "7.5287e+06", "%3.4e", -__LINE__, 7.533217421035612e+28, "75332174210356122046050586504.861712", "%f", -__LINE__, 7.534147071756384e+03, "7534.15", "%g", -__LINE__, 7.542648637430919e-25, "+0.000000", "%+#f", -__LINE__, 7.554380140947798e-15, " 8e-15", "%7.g", -__LINE__, 7.557366996007743e+25, " 8E+25", "%7.G", -__LINE__, 7.579228950138068e+08, "8e+08", "%3.e", -__LINE__, 7.579773904052487e-13, "0.000000", "%3f", -__LINE__, 7.580377544554059e+27, "7.58038e+27", "%#g", -__LINE__, 7.589615147875915e-15, "7.59E-15", "%.3G", -__LINE__, 7.593317194045158e-12, "+0.", "%+#1.f", -__LINE__, 7.605535657484387e-07, "7.60554E-07", "%G", -__LINE__, 7.609171121278006e-08, " 0", "%5.f", -__LINE__, 7.612033900317304e-14, "7.61203e-14", "%g", -__LINE__, 7.628040858080326e+23, "+7.62804e+23", "%+g", -__LINE__, 7.632109382948695e-01, "0.763211", "%#f", -__LINE__, 7.633415922627254e+28, "76334159226272539910951309138.908982", "%#f", -__LINE__, 7.636190400774419e+22, "+7.636190E+22", "%+E", -__LINE__, 7.636228368661314e-23, "0.000000", "%f", -__LINE__, 7.653292362739654e-17, "7.65329E-17", "%#G", -__LINE__, 7.664044705231460e+03, "7.664045E+03", "%5E", -__LINE__, 7.664257283149626e-05, "7.66426E-05", "%0G", -__LINE__, 7.668996632821614e-19, " 0.0", "%4.1f", -__LINE__, 7.674502669497263e-24, "7.6745e-24", "%g", -__LINE__, 7.681870119755193e+12, "+7.68187e+12", "%+#g", -__LINE__, 7.693453198401315e+02, "769.3453198", "%5.7f", -__LINE__, 7.705080073293603e-29, "7.705080E-29", "%1E", -__LINE__, 7.707244083934683e-07, "7.71E-07", "%2.3G", -__LINE__, 7.749445584970652e-17, "7.75E-17", "%6.3G", -__LINE__, 7.755369447889403e+09, "7.8e+09", "%#4.2g", -__LINE__, 7.760378169707072e-06, "7.76038e-06", "%g", -__LINE__, 7.763518882114968e-10, "0.000000", "%f", -__LINE__, 7.764720069569677e-18, "0.000000", "%0f", -__LINE__, 7.768821339438552e-03, "0.00776882", "%g", -__LINE__, 7.774767835990679e-29, "7.774768E-29", "%7E", -__LINE__, 7.805567188246987e-04, "0.000780557", "%2G", -__LINE__, 7.825157442935941e-26, "0.000000", "%f", -__LINE__, 7.833373563161910e+29, "+783337356316190991378789476584.643126", "%+f", -__LINE__, 7.875872661746674e-16, "7.875873E-16", "%E", -__LINE__, 7.880664458920439e-28, "7.881E-28", "%#0.3E", -__LINE__, 7.893084198630288e+18, "7893084198630288206", "%1.f", -__LINE__, 7.912222737877417e+04, "79122.2", "%G", -__LINE__, 7.913004582748724e-26, "0.000000", "%f", -__LINE__, 7.913749944463836e+17, "791374994446383617.230367", "%f", -__LINE__, 7.923881665760883e-24, "0.000000", "%f", -__LINE__, 7.926699779993694e-03, "0.007927", "%5.6f", -__LINE__, 7.941991860623354e-20, "7.941992e-20", "%e", -__LINE__, 7.942700358097138e+17, "794270035809713803.587329", "%2f", -__LINE__, 7.945451569935757e-16, "7.94545E-16", "%#4.6G", -__LINE__, 7.948277588625241e-04, "0", "%.0f", -__LINE__, 7.952265062569124e+21, "+7.95227e+21", "%+#g", -__LINE__, 7.959953534668040e+11, "8e+11", "%2.e", -__LINE__, 7.962059154424500e-22, "7.96206E-22", "%G", -__LINE__, 7.962856142535673e-26, "7.9629E-26", "%#.5G", -__LINE__, 7.966528574505771e+12, "7.96653e+12", "%g", -__LINE__, 8.006496880305429e-21, "8.0065E-21", "%G", -__LINE__, 8.023374861440542e+06, "+8023375", "%+6.f", -__LINE__, 8.041139717082990e-20, "8.04114e-20", "%g", -__LINE__, 8.044201752824126e+15, "8.04420E+15", "%.5E", -__LINE__, 8.044262927409321e-10, "+8E-10", "%+2.2G", -__LINE__, 8.058285708061202e+02, "+8.058286e+02", "%+e", -__LINE__, 8.104422320765144e+10, "8.10442e+10", "%#4g", -__LINE__, 8.104572628022330e-11, "0.000000", "%f", -__LINE__, 8.112156369917432e+15, "+8.11216E+15", "%+G", -__LINE__, 8.114566569709531e-18, "8.11457E-18", "%G", -__LINE__, 8.114795069552519e+13, "8.114795E+13", "%E", -__LINE__, 8.121382719830660e+03, "8121.382720", "%f", -__LINE__, 8.125179335533733e-12, "+8.125179e-12", "%+e", -__LINE__, 8.126383949107055e+19, "81263839491070548604.056967", "%f", -__LINE__, 8.129961701307842e-04, "+0.00081", "%+5.2g", -__LINE__, 8.143780077390936e+15, "8.14378E+15", "%G", -__LINE__, 8.149891507777399e+16, "+8E+16", "%+1.G", -__LINE__, 8.167395708830107e+03, "8167", "%3.f", -__LINE__, 8.167703619221975e+01, "81.677", "%G", -__LINE__, 8.178463030771759e+06, "+8.17846E+06", "%+G", -__LINE__, 8.188188531273697e+12, "8.18819E+12", "%G", -__LINE__, 8.189094866416537e+11, "+8E+11", "%+.1G", -__LINE__, 8.205086844365809e-18, "+8.205087E-18", "%+#E", -__LINE__, 8.205762333408320e-26, "0.000000", "%f", -__LINE__, 8.212370598174696e-10, "8.2124E-10", "%.5G", -__LINE__, 8.228054316085489e-14, "0.000000", "%3f", -__LINE__, 8.244313484402404e-16, "8.24431e-16", "%g", -__LINE__, 8.244472235472472e+19, "8.24447E+19", "%G", -__LINE__, 8.245421473302411e-09, "+8.2454e-09", "%+1.5g", -__LINE__, 8.252286626634840e-22, "8E-22", "%3.G", -__LINE__, 8.259969177912707e-19, "0.000000", "%f", -__LINE__, 8.265769991725211e+18, "8.26577e+18", "%.5e", -__LINE__, 8.293986939496488e+25, "8.3E+25", "%.1E", -__LINE__, 8.310348813512608e-23, "+8.31035e-23", "%+g", -__LINE__, 8.316951996533247e-20, "0.000000", "%f", -__LINE__, 8.318818016883803e+05, " 8e+05", "%6.1g", -__LINE__, 8.324896920131877e-13, "+8.324897e-13", "%+e", -__LINE__, 8.325228630004624e-03, "0.0083252", "%5.7f", -__LINE__, 8.332538660129034e+14, "8.3e+14", "%5.2g", -__LINE__, 8.343325212751775e+07, "8.34333e+07", "%#4g", -__LINE__, 8.363117398136236e+20, "+8.36e+20", "%+.3g", -__LINE__, 8.364181324448165e+27, "8.36418e+27", "%#g", -__LINE__, 8.372159259848738e+10, "8.37216e+10", "%4g", -__LINE__, 8.379252006152759e-26, "8.37925e-26", "%g", -__LINE__, 8.392670395720252e+09, "8392670395.720252", "%f", -__LINE__, 8.423360059147756e+05, "+842336.", "%+#G", -__LINE__, 8.425921213167943e+09, "8.425921e+09", "%1.7g", -__LINE__, 8.431664412515776e-16, "8.43166E-16", "%#G", -__LINE__, 8.448608859842500e+02, "844.861", "%1.3f", -__LINE__, 8.456292247478771e-14, "8.45629E-14", "%G", -__LINE__, 8.460077225296853e-04, "0.000846008", "%G", -__LINE__, 8.478635925746218e-10, "0.000000", "%f", -__LINE__, 8.492455774427448e+06, "8.49246e+06", "%g", -__LINE__, 8.494450528380746e-07, "8.494451e-07", "%e", -__LINE__, 8.516435842947605e-23, "+0.000000", "%+1f", -__LINE__, 8.519057789029134e-18, "0.000000", "%0f", -__LINE__, 8.522602111109066e+18, " 9.e+18", "%#7.g", -__LINE__, 8.529176788022152e-24, "8.529E-24", "%0.4G", -__LINE__, 8.534979605642793e-07, "0.000001", "%f", -__LINE__, 8.546859563634342e-07, "8.546860E-07", "%E", -__LINE__, 8.552370027054106e+12, "9e+12", "%.0g", -__LINE__, 8.561781328234041e+10, "8.56178e+10", "%4g", -__LINE__, 8.562688793145107e-20, "8.562689e-20", "%1.7g", -__LINE__, 8.573130147270046e-07, " 9E-07", "%7.G", -__LINE__, 8.584571984387802e-18, "8.5846e-18", "%.5g", -__LINE__, 8.596407996491291e+11, "8.596408E+11", "%#E", -__LINE__, 8.604843726850381e+10, " 9E+10", "%6.G", -__LINE__, 8.626884271938994e-23, "8.62688e-23", "%g", -__LINE__, 8.631140282429168e+24, "8631140282429168308908629.", "%#.0f", -__LINE__, 8.635194331917948e-16, "8.63519E-16", "%G", -__LINE__, 8.641417311588688e-24, "+0.000000", "%+f", -__LINE__, 8.649120264278466e+26, "8.65E+26", "%1.3G", -__LINE__, 8.649745523383894e+06, "8.649746e+06", "%e", -__LINE__, 8.654720740091021e+16, "8.65472e+16", "%g", -__LINE__, 8.655445556834509e-08, "9e-08", "%4.g", -__LINE__, 8.658954696751902e+06, "8.65895E+06", "%G", -__LINE__, 8.665712368800818e-10, "+8.66571E-10", "%+G", -__LINE__, 8.666937057116442e-10, "8.666937e-10", "%e", -__LINE__, 8.670981239765155e+05, "867098", "%G", -__LINE__, 8.679631934294932e-25, "+9.E-25", "%+#0.G", -__LINE__, 8.683595173050962e-21, "8.68360E-21", "%#G", -__LINE__, 8.684938704958039e+25, "8.684939E+25", "%E", -__LINE__, 8.686745463281227e-12, "8.686745E-12", "%5.7G", -__LINE__, 8.700227628706534e-12, "8.700228e-12", "%#e", -__LINE__, 8.705101179577200e+04, "87051.011796", "%#2f", -__LINE__, 8.707824829984700e-24, "9e-24", "%.1g", -__LINE__, 8.717654041009233e+21, "+9E+21", "%+6.0E", -__LINE__, 8.741736299906572e-11, "8.74174E-11", "%#0G", -__LINE__, 8.742228350419966e+18, "+8742228350419965821.060941", "%+f", -__LINE__, 8.743045146087558e-17, "+8.74305E-17", "%+2G", -__LINE__, 8.747820269457588e+18, "8.74782E+18", "%G", -__LINE__, 8.756274717008537e-28, "8.756275E-28", "%E", -__LINE__, 8.769782309254687e-24, "+8.769782E-24", "%+2.6E", -__LINE__, 8.788151659193398e-16, " 9E-16", "%6.E", -__LINE__, 8.789514812202340e-07, "9E-07", "%0.G", -__LINE__, 8.792657843164822e-07, "8.79266e-07", "%0g", -__LINE__, 8.810976223440985e+05, "881097.622344", "%f", -__LINE__, 8.822553973113614e+10, "8.82255E+10", "%G", -__LINE__, 8.839440421530611e-04, "0.000883944", "%G", -__LINE__, 8.842539073558434e-12, "0", "%1.f", -__LINE__, 8.882818021261782e-13, "+8.9e-13", "%+4.2g", -__LINE__, 8.899833909201039e+05, "8.8998E+05", "%.5G", -__LINE__, 8.903167498000181e-13, "9e-13", "%0.g", -__LINE__, 8.933727737932164e+09, "+8933727738", "%+4.f", -__LINE__, 8.946226267100711e+06, "8.946E+06", "%1.4G", -__LINE__, 8.953203780849794e-21, "8.9532E-21", "%G", -__LINE__, 8.959934262635649e+28, "+8.959934e+28", "%+e", -__LINE__, 8.969485341781558e-25, "0.000000", "%#f", -__LINE__, 8.970058187654221e+02, "897.005819", "%f", -__LINE__, 8.979846508565979e+02, "8.979847E+02", "%E", -__LINE__, 8.984561117901212e+01, "8.984561E+01", "%E", -__LINE__, 8.992157765875611e-12, "8.99216e-12", "%g", -__LINE__, 9.004487016708012e+01, "9.004487e+01", "%#e", -__LINE__, 9.007306978283218e-24, "9.007307e-24", "%e", -__LINE__, 9.014546375043562e+17, "901454637504356171.007203", "%#3f", -__LINE__, 9.028177786002161e-12, "9.02818E-12", "%G", -__LINE__, 9.029635986381795e-02, "0.09", "%.1g", -__LINE__, 9.032389962233431e-07, "+0.000001", "%+f", -__LINE__, 9.038466945070887e+10, "+9.038467E+10", "%+E", -__LINE__, 9.040166964322772e-27, "9.04017e-27", "%g", -__LINE__, 9.044627673694681e-11, "9.04463E-11", "%G", -__LINE__, 9.045906217628948e+17, "904590621762894819.823941", "%1f", -__LINE__, 9.051764975661710e+11, "9.05176e+11", "%#g", -__LINE__, 9.053142913711405e+29, "9.053143e+29", "%#e", -__LINE__, 9.073185209160657e-19, "+9.07319e-19", "%+g", -__LINE__, 9.074372574441451e+02, "907.437", "%g", -__LINE__, 9.084624602048136e+08, "9.084625E+08", "%E", -__LINE__, 9.088839346363631e+18, "9.09e+18", "%.2e", -__LINE__, 9.091945159170871e-15, "9.09195e-15", "%5g", -__LINE__, 9.115304318083716e+10, "9.115304e+10", "%e", -__LINE__, 9.115978352902710e+28, "9.11598E+28", "%G", -__LINE__, 9.121415008221017e-17, "9.E-17", "%#6.G", -__LINE__, 9.127270978060388e+18, "9.E+18", "%#5.G", -__LINE__, 9.143941729069086e+08, "9.143942E+08", "%#E", -__LINE__, 9.162740105978580e-19, " 9.E-19", "%#7.G", -__LINE__, 9.221509957559626e-18, "9.22151e-18", "%g", -__LINE__, 9.227419774250317e-28, " 0.", "%#3.f", -__LINE__, 9.230846660807540e-21, "0.000000", "%f", -__LINE__, 9.238091727277130e-06, "+0.00001", "%+.5f", -__LINE__, 9.244337357684406e+10, "9E+10", "%5.G", -__LINE__, 9.259179793993285e-19, " 9E-19", "%7.0G", -__LINE__, 9.274068541525759e-17, "9.274069e-17", "%e", -__LINE__, 9.283833535882367e+16, "9.28383e+16", "%#g", -__LINE__, 9.295693096364605e+11, "+9.295693E+11", "%+E", -__LINE__, 9.301820438602407e+05, "930182", "%G", -__LINE__, 9.322805251555376e-29, "9e-29", "%1.e", -__LINE__, 9.358443042421307e-27, "9.35844e-27", "%g", -__LINE__, 9.372658444745124e-23, "9.372658e-23", "%e", -__LINE__, 9.380302971355292e+05, "938030.3", "%.7g", -__LINE__, 9.381976354968076e-26, "+9.382E-26", "%+5.4G", -__LINE__, 9.391072061980585e-15, "9.391072E-15", "%E", -__LINE__, 9.403554117166546e-06, "0.000009", "%f", -__LINE__, 9.403712900426614e-28, "9.40371e-28", "%g", -__LINE__, 9.419046629820578e+03, "9419.046630", "%f", -__LINE__, 9.422344695378412e+22, "94223446953784115720509.362291", "%f", -__LINE__, 9.433327680467576e+01, "9.433328e+01", "%e", -__LINE__, 9.443975205260596e+20, "9.44398e+20", "%g", -__LINE__, 9.445134851965593e-04, "+9.445135E-04", "%+E", -__LINE__, 9.448403585149890e+24, "9e+24", "%0.g", -__LINE__, 9.463149430113036e+18, "9.46315e+18", "%g", -__LINE__, 9.465735160722534e+27, "+9465735160722534402566452627.070248", "%+f", -__LINE__, 9.495210794344892e-04, "0.000950", "%f", -__LINE__, 9.501916506373814e-25, "9.50192E-25", "%#G", -__LINE__, 9.514641335897739e+29, "9.51464E+29", "%G", -__LINE__, 9.524633436992819e-04, " 0.001", "%6.G", -__LINE__, 9.530925101873022e-18, "9.530925e-18", "%2e", -__LINE__, 9.557903833216979e-22, "9.557904E-22", "%E", -__LINE__, 9.587709102390903e-01, " 1", "%2.f", -__LINE__, 9.592723000828453e-02, "9.592723E-02", "%5E", -__LINE__, 9.603430008794172e+27, "9.60343e+27", "%g", -__LINE__, 9.622648414989433e-18, "9.622648e-18", "%1e", -__LINE__, 9.633326171289319e-23, "9.633326e-23", "%e", -__LINE__, 9.662064616152408e+19, "96620646161524081918.5146393", "%1.7f", -__LINE__, 9.668544846563163e-23, "9.668545e-23", "%e", -__LINE__, 9.691014191346685e+28, "9.69101E+28", "%G", -__LINE__, 9.693075414840598e+02, "+969.308", "%+G", -__LINE__, 9.695013453291907e-30, "9.695013e-30", "%5e", -__LINE__, 9.705983477801926e-24, "9.70598e-24", "%g", -__LINE__, 9.709022568030226e-17, "0.000000", "%f", -__LINE__, 9.715194901854826e+20, "9.715195e+20", "%e", -__LINE__, 9.721011821337717e+16, "1E+17", "%0.G", -__LINE__, 9.734895542899672e+14, "9.734896e+14", "%e", -__LINE__, 9.741486438769710e-29, " 1e-28", "%6.g", -__LINE__, 9.766657482315475e-24, "9.76666E-24", "%7G", -__LINE__, 9.767283293054552e-02, "0.09767", "%5.5f", -__LINE__, 9.769553159146005e-20, "9.76955E-20", "%G", -__LINE__, 9.777220880605434e-10, "0.00", "%4.2f", -__LINE__, 9.790290569034575e+20, "979029056903457473027.", "%#6.f", -__LINE__, 9.793128245822718e-01, "0.979313", "%G", -__LINE__, 9.804758536498200e+08, "980475853.650", "%.3f", -__LINE__, 9.816883664191066e-02, "0.1", "%.0g", -__LINE__, 9.836109821010300e+25, "9.83611e+25", "%g", -__LINE__, 9.846197559631225e+03, "1E+04", "%2.G", -__LINE__, 9.863289416819924e+12, "9.86329e+12", "%g", -__LINE__, 9.865893798657353e+12, "9.866e+12", "%0.4g", -__LINE__, 9.868248446640862e-15, "0.000000", "%#f", -__LINE__, 9.869973080775134e+04, "98699.7", "%G", -__LINE__, 9.899444006312953e+20, "1E+21", "%.1G", -__LINE__, 9.904083146074285e-08, "9.904083e-08", "%6e", -__LINE__, 9.909790408255471e+15, "9909790408255471.305665", "%f", -__LINE__, 9.930297455798394e-13, "+9.930297E-13", "%+5.6E", -__LINE__, 9.933314448709083e-15, "9.93331E-15", "%#.6G", -__LINE__, 9.938714530509870e+29, "9.938715e+29", "%e", -__LINE__, 9.953892603540162e+07, "9.95389E+07", "%G", -__LINE__, 9.962084643867200e+14, "+996208464386720.038419", "%+f", -__LINE__, 9.977706708809947e-09, "9.9777E-09", "%#.4E", -#endif -__LINE__, 9.978034352999867e+15, "9.978034e+15", "%2.6e", -__LINE__, 9.998315286730175e-30, "9.998315e-30", "%6e", - -0 -}; - -/* matches(s1, s2) is true if s1 is "approximately" equal to s2. - Any digits after the first required_precision digits do not have to match. - */ - -int required_precision = 13; - -#if defined(__STDC__) || defined(__cplusplus) -int matches(register char *result, register char *desired) -#else -int matches(result, desired) - register char *result; register char *desired; -#endif -{ - int digits_seen = 0; - for (;; result++, desired++) { - if (*result == *desired) { - if (*result == 0) - return 1; - else if (*result >= '0' && *result <= '9') - digits_seen++; - } - else if (digits_seen >= required_precision - && *result >= '0' && *result <= '9' - && *desired >= '0' && *desired <= '9') - continue; - else - return 0; - } -} - -extern void dump_stats(); - -int main() -{ - int errcount = 0; - int testcount = 0; - double d; -#define BSIZE 1024 - char buffer[BSIZE]; - sprint_double_type *dptr; - - /* This test demands more precision than a 32bit floating - point format can provide. So only run it if doubles - are last least 64bits wide. */ - if (sizeof (double) < 8) - exit (0); - -#if defined(__cplusplus) && !defined(TEST_LIBIO) - - strstream sstr(buffer, BSIZE, ios::in|ios::out); - - for (dptr = sprint_doubles; dptr->line; dptr++) - { - -#ifdef SLOW_SIMULATOR - /* We only run half the tests if we have a slow simulator to - avoid dejagnu timeouts. */ - if (testcount % 2) - { - testcount++; - continue; - } -#endif - - sstr.seekp(0); - sstr.form(dptr->format_string, dptr->value); - sstr << ends; - if (!matches(buffer, dptr->result)) - { - errcount++; - cerr << "Error in line " << dptr->line; - cerr << " using \"" << dptr->format_string; - cerr << "\". Result is \"" << buffer << "\"; should be: \""; - cerr << dptr->result << "\".\n"; - } - -#ifdef TEST_EXACTNESS - sstr.seekp(0); - sstr.form("%.999g", dptr->value); - sstr << ends; - - sstr.seekg(0); - sstr.scan("%lg", &d); - - if (dptr->value != d) - { - errcount++; - cerr << "Error in line " << dptr->line; - cerr << ". String is \"" << buffer << "\", value is " << d << ".\n"; - } -#endif - testcount++; - } - -#ifdef SLOW_SIMULATOR - testcount /= 2; -#endif - - if (errcount == 0) - { - cerr << "Encountered no errors in " << testcount << " tests.\n"; - return 0; - } - else - { - cerr << "Encountered " << errcount << " errors in " - << testcount << " tests.\n"; - return 1; - } -#else - for (dptr = sprint_doubles; dptr->line; dptr++) - { -#ifdef SLOW_SIMULATOR - /* We only run half the tests if we have a slow simulator to - avoid dejagnu timeouts. */ - if (testcount % 2) - { - testcount++; - continue; - } -#endif - - sprintf (buffer, dptr->format_string, dptr->value); - if (!matches(buffer, dptr->result)) - { - errcount++; - fprintf(stderr, - "Error in line %d using \"%s\". Result is \"%s\"; should be: \"%s\".\n", - dptr->line, dptr->format_string, buffer, dptr->result); - } - -#ifdef TEST_EXACTNESS - sprintf (buffer, "%.999g", dptr->value); - sscanf (buffer, "%lg", &d); - if (dptr->value != d) - { - errcount++; - fprintf (stderr, - "Error in line %d. String is \"%s\", value is %g.\n", - dptr->line, buffer, d); - } -#endif - testcount++; - } - -#ifdef SLOW_SIMULATOR - testcount /= 2; -#endif - - if (errcount == 0) - { - fprintf(stderr, "Encountered no errors in %d tests.\n", testcount); - return 0; - } - else - { - fprintf(stderr, "Encountered %d errors in %d tests.\n", - errcount, testcount); - return 1; - } -#endif -} diff --git a/contrib/libio/tests/tiformat.c b/contrib/libio/tests/tiformat.c deleted file mode 100644 index 78d09cedc2..0000000000 --- a/contrib/libio/tests/tiformat.c +++ /dev/null @@ -1,5112 +0,0 @@ -#ifdef TEST_LIBIO -#include -#else -#ifdef __cplusplus -#include -#else -#include -#endif -#endif /* !TEST_LIBIO */ -#include - -/* Tests taken from Cygnus C library. */ -typedef struct { - int line; - long value; - char *result; - char *format_string; -} sprint_int_type; - -sprint_int_type sprint_ints[] = -{ -__LINE__, 0x000838d2L, "838d2", "%.4x", -__LINE__, 0x0063be46L, "63BE46", "%-6X", -__LINE__, -0x1b236c0L, "-28456640", "%#0.d", -__LINE__, -0x0000003L, "-3", "% 0d", -__LINE__, 0x0000ed51L, "ed51", "%2.x", -__LINE__, -0x00001f2L, "-498", "%1ld", -__LINE__, 0x0ea3e927L, "EA3E927", "%+X", -__LINE__, 0xffbef8daL, "FFBEF8DA", "%5X", -__LINE__, 0x62ff9f56L, "62ff9f56", "%0x", -__LINE__, 0x00000ad2L, "AD2", "%.0X", -__LINE__, 0x00000000L, " ", "% 6.ld", -__LINE__, 0xffffffffL, "FFFFFFFF", "%1.4X", -__LINE__, 0x0000208cL, " 208C", "%5X", -__LINE__, 0x0000003cL, "3c", "%x", -__LINE__, 0xffff6177L, "0xffff6177", "%+#x", -__LINE__, 0xffffdc8dL, "ffffdc8d", "%+x", -__LINE__, 0x00000000L, "0", "%X", -__LINE__, 0x00002434L, "9268", "%0d", -__LINE__, 0xd2c72cdbL, "d2c72cdb", "%-x", -__LINE__, 0xfe38012bL, "0xfe38012b", "%+#7x", -__LINE__, 0x00000001L, "0001", "%#.4d", -__LINE__, -0x008525aL, "-0545370", "%06.7ld", -__LINE__, 0xffffffacL, "ffffffac", "%3.7x", -__LINE__, 0x007424d2L, "+7611602", "%+ld", -__LINE__, 0x00001a85L, "1A85", "%.4X", -__LINE__, -0x0000019L, "-25", "%3.d", -__LINE__, 0xfffffffeL, "fffffffe", "%-x", -__LINE__, -0x34473b2L, "-54817714", "% d", -__LINE__, 0x000000eaL, "234", "%1.ld", -__LINE__, -0x0000004L, "-4 ", "%-7.ld", -__LINE__, 0x00006c94L, "27796", "%0d", -__LINE__, 0x00000001L, "1", "%ld", -__LINE__, 0x00000619L, "619", "%1x", -__LINE__, 0x0000209cL, "8348", "%ld", -__LINE__, -0x327f8ffL, "-52951295", "%-0ld", -__LINE__, 0xffffff0bL, "FFFFFF0B", "%2.X", -__LINE__, 0xf199d6aeL, "F199D6AE", "%X", -__LINE__, 0x3ca5602eL, "1017471022", "%-1.ld", -__LINE__, -0xfb2080bL, "-263325707", "%3.5d", -__LINE__, 0x00001cb8L, "7352", "%d", -__LINE__, 0x00000000L, "0000000", "%3.7d", -__LINE__, 0xffffff40L, "FFFFFF40", "%+X", -__LINE__, 0x14664450L, "0x14664450", "%#x", -__LINE__, 0x0000002eL, "2e", "%1x", -__LINE__, 0xffffffffL, "ffffffff", "%x", -__LINE__, 0xffff606aL, "0XFFFF606A", "%#X", -__LINE__, 0xffffff33L, "0XFFFFFF33", "%#X", -__LINE__, 0x00000000L, "0", "%d", -__LINE__, -0x0000012L, "-00018", "%-2.5d", -__LINE__, 0x0001fbe6L, "130022", "%1.d", -__LINE__, 0xfff59dd9L, "fff59dd9", "%+x", -__LINE__, 0x00000002L, "2", "%0.0d", -__LINE__, 0x00000fe1L, "fe1 ", "%-7.x", -__LINE__, 0x001f8f6aL, "1F8F6A", "%1.X", -__LINE__, 0x0000001bL, "000001B", "%04.7X", -__LINE__, 0x126a2609L, " 308946441", "% 4d", -__LINE__, 0xffffffe3L, "0XFFFFFFE3", "%+#.1X", -__LINE__, 0x1858f1c9L, "1858f1c9", "%.3x", -__LINE__, 0x003fc672L, "3fc672", "%1x", -__LINE__, 0x00c0bddcL, "12631516", "%#d", -__LINE__, 0x000006d6L, "1750", "%#d", -__LINE__, 0x000006a0L, "6A0", "%X", -__LINE__, 0x000007beL, "7BE", "%X", -__LINE__, -0x1c7cd1aL, "-29871386", "%ld", -__LINE__, 0x000000ccL, "204", "%ld", -__LINE__, 0x000002dbL, "731 ", "%-#5d", -__LINE__, 0xffff67adL, "FFFF67AD", "% X", -__LINE__, 0x00000008L, "8", "%d", -__LINE__, 0xffe07007L, "FFE07007", "%5X", -__LINE__, -0x0000001L, " -1", "% 7d", -__LINE__, 0xfffffffeL, "fffffffe", "%x", -__LINE__, 0x00027b68L, "+162664", "%+ld", -__LINE__, 0x0a7c1997L, "+175905175", "%+2ld", -__LINE__, 0xfe300896L, "fe300896", "%.4x", -__LINE__, 0x00000537L, "537", "%-0.x", -__LINE__, 0x3e981779L, "3e981779", "%.6x", -__LINE__, 0xfffff05eL, "FFFFF05E", "%1.0X", -__LINE__, -0x07bc0cfL, "-8110287", "%-7d", -__LINE__, -0x01371bcL, "-1274300", "%.7ld", -__LINE__, -0x0000013L, "-19", "%.2ld", -__LINE__, 0x000000d1L, "0xd1", "%#x", -__LINE__, -0x0000003L, "-3", "%-ld", -__LINE__, 0xfffffffcL, "FFFFFFFC", "%4.1X", -__LINE__, 0x00000000L, "0", "%ld", -__LINE__, 0x0001c8afL, "116911", "%d", -__LINE__, 0x000048c3L, "48C3", "%X", -__LINE__, 0x00000079L, "0x0000079", "%-#0.7x", -__LINE__, 0x0000615aL, " 24922", "% d", -__LINE__, 0xfffffff5L, "fffffff5", "%x", -__LINE__, 0x00000308L, "0000308", "%+07.7x", -__LINE__, 0xfcadc983L, "fcadc983", "%x", -__LINE__, 0x00000097L, "151", "%#d", -__LINE__, 0x000001c5L, "453", "%0.2ld", -__LINE__, 0x00000000L, "00", "%-1.2x", -__LINE__, 0x00000001L, "+1", "%+02.d", -__LINE__, 0x01eb4354L, "1EB4354", "% X", -__LINE__, 0xffffa7d1L, "ffffa7d1", "%5.x", -__LINE__, 0x0003170eL, "0x3170e", "%#x", -__LINE__, 0x000001ceL, "1CE", "% .2X", -__LINE__, 0x3a2991fbL, "975802875", "%d", -__LINE__, -0xcdad8e2L, "-215668962", "%-d", -__LINE__, 0xfe0261c3L, "fe0261c3", "%x", -__LINE__, -0x0006ea7L, "-28327", "% ld", -__LINE__, 0x032854a3L, "0X32854A3", "% #6X", -__LINE__, 0x0000004bL, "4b", "%x", -__LINE__, 0xffff6ca3L, "FFFF6CA3", "%4.X", -__LINE__, 0x00000000L, "0", "%X", -__LINE__, 0x00611f04L, "611F04", "%.1X", -__LINE__, 0x00000000L, " 0", "%#6d", -__LINE__, 0x0002c711L, "2c711", "%-02.x", -__LINE__, -0x07a2fe4L, "-8007652", "%d", -__LINE__, -0x0000547L, "-1351", "%ld", -__LINE__, 0x00013954L, "0x13954", "%#x", -__LINE__, -0x00523b7L, "-336823", "%ld", -__LINE__, -0x00f6c6eL, "-1010798", "%6.ld", -__LINE__, 0xffea6427L, "FFEA6427", "%3X", -__LINE__, -0x0000005L, "-5", "%d", -__LINE__, -0x04fe618L, "-5236248", "% .7d", -__LINE__, 0xffa80a28L, "ffa80a28", "%-0x", -__LINE__, 0x00000047L, "71", "%ld", -__LINE__, 0x001dc6bbL, "1951419", "%#4ld", -__LINE__, 0x00000868L, " 2152", "%#6d", -__LINE__, 0x000002fbL, "2fb", "%x", -__LINE__, 0x00607fa0L, "6324128", "%4d", -__LINE__, 0xfffed161L, "fffed161", "%x", -__LINE__, 0x0001c6e4L, " 116452", "% 2.5d", -__LINE__, 0x0003dda8L, "3DDA8", "%4X", -__LINE__, 0xfffffff8L, "fffffff8", "%x", -__LINE__, 0xfacf664aL, "facf664a", "%x", -__LINE__, 0x000000c1L, "C1", "% 1X", -__LINE__, 0x0000839cL, " 839C", "%6X", -__LINE__, 0xfffff69aL, "FFFFF69A", "%X", -__LINE__, 0x000e5c2eL, "+941102", "%+d", -__LINE__, -0x0000004L, "-4", "%#d", -__LINE__, 0x00000000L, "00000", "%#.5ld", -__LINE__, 0xfffffffeL, "fffffffe", "%3.1x", -__LINE__, 0x0010ed68L, "1109352", "%-ld", -__LINE__, 0xffffffe9L, "ffffffe9", "%.6x", -__LINE__, 0x00000007L, " 7", "% 4.ld", -__LINE__, 0x0000cabaL, "51898", "%ld", -__LINE__, -0x0000119L, "-281", "% d", -__LINE__, 0x0c3012a9L, "204477097", "%03.6ld", -__LINE__, -0x001c98fL, "-117135", "%ld", -__LINE__, 0x000017b1L, "+6065", "%+d", -__LINE__, 0x00000001L, "1", "%ld", -__LINE__, -0x0000019L, "-25", "% .2d", -__LINE__, 0x0009ae28L, "9AE28", "%X", -__LINE__, 0xe861c4feL, "e861c4fe", "%7.x", -__LINE__, 0xffac88d3L, "FFAC88D3", "%X", -__LINE__, -0x00005dfL, "-01503", "%-5.5ld", -__LINE__, 0x0000013eL, "318", "%-0d", -__LINE__, 0x04b6f58fL, "4b6f58f", "%x", -__LINE__, 0xfffe3978L, "fffe3978", "%+0.6x", -__LINE__, 0x57ee5244L, "57ee5244", "%+7.4x", -__LINE__, 0xfffb5610L, "fffb5610", "% 6x", -__LINE__, 0x00000006L, " 6", "%#7d", -__LINE__, 0x0000000cL, "0x0000c", "%#.5x", -__LINE__, -0xec59362L, "-247829346", "%1.7d", -__LINE__, -0x0000001L, "-1", "%ld", -__LINE__, -0x0007e4bL, "-32331", "% d", -__LINE__, 0x0ececa6fL, "248433263", "%0d", -__LINE__, 0x00000578L, " 578", "%+6.x", -__LINE__, -0x0000003L, "-3", "%ld", -__LINE__, 0x000002bbL, "2bb", "% 0x", -__LINE__, -0x0000006L, "-6", "%-ld", -__LINE__, 0x000002f9L, "761", "%d", -__LINE__, 0xffffd736L, "ffffd736", "%3.4x", -__LINE__, 0x0010ba79L, "1096313", "%7.4d", -__LINE__, -0x0001244L, "-4676", "%#.1d", -__LINE__, 0x00000dbeL, "DBE", "%1X", -__LINE__, -0x0000015L, "-21", "%-0.d", -__LINE__, 0xffffffffL, "0xffffffff", "%#x", -__LINE__, -0x6cdf4a3L, "-114160803", "%ld", -__LINE__, 0x00008ac9L, "8AC9", "%1X", -__LINE__, 0x00000000L, "00", "%.2X", -__LINE__, -0x2263dbaL, "-36060602", "%5.5d", -__LINE__, 0x00007da9L, "32169", "%0d", -__LINE__, 0xfffffff7L, "FFFFFFF7", "% 4.X", -__LINE__, 0xfbf36ccaL, "FBF36CCA", "%.1X", -__LINE__, 0x00000040L, "64", "%.0ld", -__LINE__, 0x0000001cL, " 28", "% d", -__LINE__, 0xfffffadbL, "0xfffffadb", "%#.5x", -__LINE__, 0x0eb95847L, "247027783", "%d", -__LINE__, 0xfffd7030L, "FFFD7030", "%+02X", -__LINE__, 0x00000005L, "00005", "%.5x", -__LINE__, 0xfffffffdL, "FFFFFFFD", "%X", -__LINE__, 0x98975b15L, "98975B15", "%02X", -__LINE__, -0x0000034L, " -52", "%6ld", -__LINE__, 0xffd7d0ccL, "ffd7d0cc", "% 5.6x", -__LINE__, 0xffffffa6L, "FFFFFFA6", "%X", -__LINE__, 0xfff27132L, "fff27132", "%x", -__LINE__, -0x065b74dL, "-6666061", "%+6ld", -__LINE__, 0xf6ac99d6L, "0XF6AC99D6", "%#X", -__LINE__, 0xfffff4bdL, "FFFFF4BD", "%X", -__LINE__, 0xfffffb62L, "FFFFFB62", "%6X", -__LINE__, 0xf8434543L, "f8434543", "%-0x", -__LINE__, 0x0002b374L, "0x2b374", "%-#6x", -__LINE__, 0x00000000L, "0", "%x", -__LINE__, 0xffb5751dL, "ffb5751d", "%-3.x", -__LINE__, 0x34ea7347L, "887780167", "%d", -__LINE__, -0x008f457L, "-586839", "%0ld", -__LINE__, 0x00000001L, " 1", "%#4d", -__LINE__, 0xc32d7ad4L, "c32d7ad4", "%0x", -__LINE__, 0xfffffb80L, "FFFFFB80", "%-.2X", -__LINE__, 0x00000756L, "756 ", "%-6x", -__LINE__, 0xfffb020fL, "FFFB020F", "%+.2X", -__LINE__, -0xe68619fL, "-241721759", "%#1.6ld", -__LINE__, 0x180166cdL, "402745037", "%3.7ld", -__LINE__, -0x0000001L, "-1", "%+00d", -__LINE__, 0xfdbc3611L, "fdbc3611", "%x", -__LINE__, -0x000005bL, "-91", "%d", -__LINE__, 0xffffe77fL, "ffffe77f", "%x", -__LINE__, -0x0000019L, "-25", "%ld", -__LINE__, 0x00000016L, "22", "%#d", -__LINE__, -0x0000025L, "-37", "%ld", -__LINE__, 0xffffe43fL, "ffffe43f", "%x", -__LINE__, 0x000050a5L, "00050a5", "%.7x", -__LINE__, 0x0000000cL, " 12", "% 5.ld", -__LINE__, -0x001faffL, "-129791", "%4d", -__LINE__, 0x239d7cf2L, "597523698", "%0.7ld", -__LINE__, 0x04092183L, "4092183", "% 7X", -__LINE__, -0x0043498L, "-275608", "%-ld", -__LINE__, -0x0018dbeL, "-101822", "%d", -__LINE__, 0xff3e09c3L, "FF3E09C3", "%X", -__LINE__, 0x00000000L, "0", "%d", -__LINE__, -0x15d57558L, "-366310744", "%+0.7ld", -__LINE__, 0x0004fb06L, "326406", "%0.0d", -__LINE__, 0x00000119L, "0X119", "%#X", -__LINE__, -0x14c53e19L, "-348470809", "%d", -__LINE__, 0x00000019L, "0000019", "% .7X", -__LINE__, -0x0000654L, "-1620", "%0.4ld", -__LINE__, -0xde5899bL, "-233146779", "%#.1d", -__LINE__, 0x0013c1f0L, "1294832", "%4.ld", -__LINE__, 0x0a9fe761L, "A9FE761", "%X", -__LINE__, -0x00000e5L, "-229", "%1ld", -__LINE__, 0x00000161L, "000353", "%.6ld", -__LINE__, 0x6b04e4bdL, "0x6b04e4bd", "%#7.0x", -__LINE__, -0x0000ef0L, "-3824 ", "%-6.ld", -__LINE__, -0x026306eL, "-2502766", "%ld", -__LINE__, 0x00000000L, "0", "%-X", -__LINE__, 0xfffffe1fL, "fffffe1f", "%-x", -__LINE__, 0x0003aecfL, " 241359", "% 2.1ld", -__LINE__, -0x0000014L, "-20", "%d", -__LINE__, 0x00000002L, "0002", "%-.4ld", -__LINE__, 0xfffff662L, "0XFFFFF662", "% #.6X", -__LINE__, 0x00000006L, "6", "%0x", -__LINE__, 0x0001f4c4L, " 128196", "% 0d", -__LINE__, 0xffffffffL, "FFFFFFFF", "%5X", -__LINE__, 0x05605e38L, "90201656", "%ld", -__LINE__, 0xffffffdeL, "0XFFFFFFDE", "% #X", -__LINE__, 0x000001e0L, " 1e0", "%7.x", -__LINE__, 0x00000007L, "7", "%X", -__LINE__, 0x00000001L, "+1", "%+d", -__LINE__, 0xffffffe0L, "FFFFFFE0", "% X", -__LINE__, 0xffd7f77aL, "FFD7F77A", "%+00.1X", -__LINE__, 0xfffffffeL, "0xfffffffe", "%-#x", -__LINE__, 0x01b0a63bL, "1b0a63b", "%x", -__LINE__, -0x06554b7L, "-6640823", "%d", -__LINE__, 0xfffffff8L, "fffffff8", "%x", -__LINE__, 0x00000b2dL, "b2d", "%x", -__LINE__, -0x2664ba2L, "-40258466", "%-d", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%X", -__LINE__, -0x0000552L, " -1362", "%6.2ld", -__LINE__, 0x00000009L, " 00009", "%6.5x", -__LINE__, 0x00035c72L, "220274", "%05.ld", -__LINE__, -0x014d09dL, "-1364125", "%d", -__LINE__, -0x0000002L, " -2", "% 4d", -__LINE__, 0x00000001L, "1", "%+X", -__LINE__, 0x00000028L, "28", "%X", -__LINE__, 0xf25c9eb2L, "F25C9EB2", "%7.X", -__LINE__, -0x7ae4b62L, "-128863074", "%d", -__LINE__, 0x00630d87L, "630D87", "%2X", -__LINE__, 0x000000f8L, "F8", "%-X", -__LINE__, 0xfffffff9L, "FFFFFFF9", "%X", -__LINE__, -0x0000007L, "-7", "%0d", -__LINE__, -0x2518fcdL, "-38899661", "% 3ld", -__LINE__, 0xfffff4b4L, "FFFFF4B4", "%-5X", -__LINE__, 0x01cc36c8L, "30160584", "%ld", -__LINE__, 0xffffffffL, "ffffffff", "%-x", -__LINE__, 0x0000000bL, " 11", "%6.ld", -__LINE__, 0x00010d55L, " 68949", "% d", -__LINE__, -0x0c01306L, "-12587782", "% 6.1ld", -__LINE__, 0x001719d7L, "1513943", "%.1ld", -__LINE__, -0x0000002L, " -2", "%+3.ld", -__LINE__, 0x0000018eL, "398", "%d", -__LINE__, 0x000000a6L, "0xa6", "%-#3x", -__LINE__, 0x00006f66L, " 28518", "% #d", -__LINE__, 0x0000032aL, "32A", "%X", -__LINE__, -0x0000145L, "-325", "%0d", -__LINE__, 0xffffffffL, "ffffffff", "%2.x", -__LINE__, 0x00287171L, "2650481", "%ld", -__LINE__, 0x0000004bL, "+75", "%+02.ld", -__LINE__, 0xfffffff8L, "fffffff8", "%-0x", -__LINE__, 0x00000064L, "64", "% X", -__LINE__, 0xfffffca2L, "fffffca2", "%0x", -__LINE__, 0x000010b6L, "10b6", "% .0x", -__LINE__, -0x003806fL, "-229487", "%7d", -__LINE__, -0x00000b7L, "-183", "%3ld", -__LINE__, 0xffffe5baL, "FFFFE5BA", "%0X", -__LINE__, 0x001f0da8L, "1f0da8", "%+x", -__LINE__, 0x000ce185L, "844165", "%0ld", -__LINE__, 0x00000c96L, "3222", "%0d", -__LINE__, -0x0013099L, "-77977", "%1.ld", -__LINE__, -0x5f3c47aL, "-99861626", "%.6ld", -__LINE__, 0x00000cbfL, " CBF", "%+5.X", -__LINE__, -0x0000001L, "-1", "%+ld", -__LINE__, 0x0d793bc3L, "d793bc3", "%6.x", -__LINE__, 0xfffffffdL, "0xfffffffd", "%+#x", -__LINE__, -0x0000070L, " -112", "%6.d", -__LINE__, 0xfffffb3fL, "FFFFFB3F", "%.7X", -__LINE__, 0x037dfc78L, "0X37DFC78", "%#X", -__LINE__, 0x00009ba5L, "39845", "%3ld", -__LINE__, 0x0000004aL, "4a", "%0x", -__LINE__, 0xffffff81L, "ffffff81", "%5.5x", -__LINE__, -0x86ef222L, "-141488674", "%ld", -__LINE__, -0xac5531eL, "-180704030", "% 4ld", -__LINE__, 0x00002493L, "2493", "%+X", -__LINE__, 0xffffffffL, "FFFFFFFF", "%1.3X", -__LINE__, 0x0005c875L, "378997", "%.0ld", -__LINE__, 0x0301d345L, "50451269", "%d", -__LINE__, 0xfff6b589L, "fff6b589", "%2.4x", -__LINE__, -0x00001dbL, "-475 ", "%-7.0d", -__LINE__, 0x0000d1e7L, "0x000d1e7", "%#2.7x", -__LINE__, 0xf4c4d2bbL, "f4c4d2bb", "%.6x", -__LINE__, 0x00c89f54L, "13147988", "%ld", -__LINE__, -0x6599253cL, "-1704535356", "%+ld", -__LINE__, 0xab7d61eaL, "ab7d61ea", "% x", -__LINE__, 0x00000006L, "6", "%1ld", -__LINE__, 0xffff5ab7L, "ffff5ab7", "%0x", -__LINE__, -0x1cfeca5bL, "-486459995", "%#ld", -__LINE__, 0x000000f3L, " f3", "% 6.x", -__LINE__, -0x0000021L, "-33", "%d", -__LINE__, 0xfe7246acL, "fe7246ac", "%-5.x", -__LINE__, 0x00000017L, "00017", "%-.5X", -__LINE__, -0x0cc250aL, "-13378826", "%0.0d", -__LINE__, -0x00010aeL, "-04270", "%#.5ld", -__LINE__, -0x7952c8bL, "-127216779", "% ld", -__LINE__, 0x0002a53eL, "173374", "%4.0d", -__LINE__, 0x03801bbfL, "3801BBF", "%0X", -__LINE__, 0x0368645fL, "+57173087", "%+#0.6ld", -__LINE__, 0x0000002fL, "47", "%d", -__LINE__, 0x00000003L, "3", "%x", -__LINE__, 0x000005f7L, "5F7", "%0X", -__LINE__, -0x06e5e76L, "-7233142", "% 0.1ld", -__LINE__, 0x053da936L, "53da936", "%1.4x", -__LINE__, -0x0df0c2fL, "-14617647", "%.5ld", -__LINE__, 0xfffffffdL, "FFFFFFFD", "%-0X", -__LINE__, 0x000104bfL, "104BF", "%X", -__LINE__, 0x000353fcL, "353FC", "%X", -__LINE__, 0x182a18dcL, "+405412060", "%+ld", -__LINE__, 0x0000000eL, " 14", "% 2d", -__LINE__, -0x0000091L, "-145", "%+ld", -__LINE__, 0x0029a9d6L, "2730454", "%d", -__LINE__, 0x00009d57L, "009d57", "% .6x", -__LINE__, 0x4c4d4f79L, "1280135033", "%5.ld", -__LINE__, -0x000075bL, "-1883", "% 03d", -__LINE__, -0x001b718L, "-112408", "%+d", -__LINE__, 0xfffaaf57L, "FFFAAF57", "%+1X", -__LINE__, 0x00f44e52L, "F44E52", "% 4X", -__LINE__, 0x00000002L, "0X2", "%#X", -__LINE__, 0x000a85e9L, "A85E9", "%+0X", -__LINE__, 0xffff70bbL, "ffff70bb", "%6x", -__LINE__, 0x00004e15L, "4e15", "%x", -__LINE__, 0x000eeb60L, " 977760", "% ld", -__LINE__, 0xfffffff1L, "fffffff1", "%0x", -__LINE__, -0x294d7e2L, "-43309026", "% 02.d", -__LINE__, 0x0001aaebL, "0109291", "%02.7ld", -__LINE__, 0x000a01fcL, "0xa01fc", "%-#.5x", -__LINE__, 0x002c3c30L, "+2898992", "%+#d", -__LINE__, 0x015667aeL, "+22439854", "%+5ld", -__LINE__, -0x05af42bL, "-5960747", "%+d", -__LINE__, 0x0000be36L, "be36", "%+2x", -__LINE__, 0x005e3f67L, "5e3f67", "% x", -__LINE__, -0x0000020L, "-32", "% ld", -__LINE__, -0x0003617L, "-13847", "% d", -__LINE__, 0x00000014L, "14 ", "%-4.X", -__LINE__, 0x00000001L, "001", "%0.3d", -__LINE__, 0xfffffea9L, "fffffea9", "%3.x", -__LINE__, 0xe447099eL, "E447099E", "%0X", -__LINE__, 0x00049c71L, "302193", "%d", -__LINE__, 0x76356ed3L, "0x76356ed3", "%#4.1x", -__LINE__, 0x00000005L, " 0X5", "%#5X", -__LINE__, 0x00004da2L, "0x004da2", "%#1.6x", -__LINE__, 0xffdfb36cL, "FFDFB36C", "%4X", -__LINE__, 0xffffe3c5L, "FFFFE3C5", "%+4.X", -__LINE__, 0x00000006L, "6", "%0x", -__LINE__, -0x914ff17L, "-152370967", "% .5ld", -__LINE__, -0x0000002L, "-2", "%0ld", -__LINE__, 0xffffff36L, "FFFFFF36", "% 2X", -__LINE__, -0x0bb1598L, "-12260760", "%-ld", -__LINE__, 0x00006db5L, "28085", "%0.5ld", -__LINE__, 0xffffffffL, "ffffffff", "%x", -__LINE__, -0x0000001L, "-1", "%0ld", -__LINE__, 0x0fa37e79L, "FA37E79", "%1.X", -__LINE__, -0x00000acL, "-172", "%.2d", -__LINE__, 0xffffffd8L, "ffffffd8", "%.7x", -__LINE__, -0x000a513L, "-42259", "%ld", -__LINE__, 0x00001294L, "4756", "%2ld", -__LINE__, -0x56bae0b4L, "-1455087796", "%.1ld", -__LINE__, 0x3b26d5faL, "3b26d5fa", "%x", -__LINE__, 0xff657013L, "ff657013", "%x", -__LINE__, -0x00005f5L, "-1525", "%0.0ld", -__LINE__, -0x0000001L, " -1", "% 7d", -__LINE__, -0x02396b2L, "-2332338", "%d", -__LINE__, -0x0000003L, "-000003", "%+7.6d", -__LINE__, 0xfd3ec7c1L, "fd3ec7c1", "% 3.4x", -__LINE__, -0x076e338L, "-7791416", "%0.d", -__LINE__, -0x000015eL, "-350", "%3ld", -__LINE__, 0x0a0f0b71L, "a0f0b71", "%x", -__LINE__, 0xfffe00baL, "FFFE00BA", "%X", -__LINE__, 0x00036bd8L, " 36bd8", "% 06.x", -__LINE__, 0xfffff2dfL, "0XFFFFF2DF", "%#2.6X", -__LINE__, 0x004687fbL, "4622331", "%ld", -__LINE__, -0x0000331L, " -817", "%+6.d", -__LINE__, 0xfcd5b090L, "fcd5b090", "%+0x", -__LINE__, 0x0334f94cL, "334F94C", "%.6X", -__LINE__, 0x00000bceL, "3022", "%.3ld", -__LINE__, 0xf28d9dddL, "f28d9ddd", "%x", -__LINE__, 0x00003a79L, " 14969", "% ld", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%.7X", -__LINE__, 0x0043d7feL, "43D7FE", "%X", -__LINE__, -0x0000b82L, "-2946", "%-ld", -__LINE__, -0x00e29d8L, "-928216", "%d", -__LINE__, 0xffffffecL, "ffffffec", "%-x", -__LINE__, 0x0aeaf557L, "0xaeaf557", "%-#x", -__LINE__, 0x00c07fe6L, "C07FE6", "%X", -__LINE__, 0x307414d8L, "307414d8", "% 0x", -__LINE__, -0x045ef67L, "-4583271", "%d", -__LINE__, 0x0000024aL, " 0000586", "% .7d", -__LINE__, 0xfffffc42L, "fffffc42", "%x", -__LINE__, 0xfc38c249L, "fc38c249", "%5.x", -__LINE__, -0x000d096L, "-53398", "%-d", -__LINE__, -0x213a345L, "-34841413", "%ld", -__LINE__, -0x0000130L, "-304", "%ld", -__LINE__, -0x000efd1L, "-61393", "%ld", -__LINE__, 0xfffff867L, "FFFFF867", "%2X", -__LINE__, 0x00113ed0L, "0x113ed0", "%-#7x", -__LINE__, 0x00000677L, " 1655", "% 3.ld", -__LINE__, 0x0000002fL, "2f", "%x", -__LINE__, 0xfffffd38L, "fffffd38", "%-4x", -__LINE__, -0x000b3ccL, "-46028", "%1.2d", -__LINE__, 0x45da719bL, "45DA719B", "%+0X", -__LINE__, -0x000a454L, " -42068", "%7.3ld", -__LINE__, 0x01cc7c30L, " 30178352", "% d", -__LINE__, -0x05ae80eL, "-5957646", "%#.4ld", -__LINE__, 0x000000b9L, "185", "%d", -__LINE__, 0x003fcaf4L, "4180724", "%1.ld", -__LINE__, 0x02da1b74L, "2DA1B74", "%X", -__LINE__, 0xffffffd9L, "FFFFFFD9", "%X", -__LINE__, 0x00064359L, "64359 ", "%-6X", -__LINE__, 0x000000f0L, "240", "%ld", -__LINE__, -0x01715e5L, "-1512933", "%ld", -__LINE__, 0xc8f6e118L, "0XC8F6E118", "%#X", -__LINE__, 0xfffffd8fL, "FFFFFD8F", "%X", -__LINE__, 0x0000176dL, "5997 ", "%-6d", -__LINE__, 0x00003cabL, "0x3cab", "%#0.3x", -__LINE__, 0x00000001L, " 1", "% d", -__LINE__, 0xfffff610L, "0XFFFFF610", "%#X", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%5.7X", -__LINE__, 0x00000001L, "1", "%0x", -__LINE__, 0x00000001L, "00001", "%.5ld", -__LINE__, -0x0000d51L, "-3409", "%d", -__LINE__, -0x08639eeL, "-8796654", "%ld", -__LINE__, 0x00003121L, "12577", "%#1.2ld", -__LINE__, 0x0000004eL, "78", "%d", -__LINE__, 0xfffff64fL, "fffff64f", "%-x", -__LINE__, 0x0000002aL, "2a", "%0x", -__LINE__, 0x00000020L, "20", "%x", -__LINE__, -0x00000b8L, "-184", "%#ld", -__LINE__, 0x0000000aL, "10", "%-#d", -__LINE__, 0x00000364L, "868", "%.1ld", -__LINE__, 0x00d1f9b6L, "D1F9B6", "%0.X", -__LINE__, 0x008cfda1L, "8CFDA1", "% 6.X", -__LINE__, 0xffd58cceL, "FFD58CCE", "%X", -__LINE__, 0x00000008L, "0000008", "%6.7ld", -__LINE__, 0x00000318L, " 318", "%4X", -__LINE__, 0x000172d8L, "94936", "%2ld", -__LINE__, -0x056ccbfL, "-5688511", "%ld", -__LINE__, 0x000000c7L, "+000199", "%+0.6d", -__LINE__, 0x00000002L, "0X2", "%-#X", -__LINE__, 0xfffff634L, "FFFFF634", "%.1X", -__LINE__, -0x00001f3L, "-499", "%-ld", -__LINE__, -0x000081bL, "-2075", "%-d", -__LINE__, 0x000000b5L, "181", "%0d", -__LINE__, 0xfe961ee8L, "fe961ee8", "%0x", -__LINE__, 0x000028a2L, "10402", "%d", -__LINE__, 0xffffffffL, "FFFFFFFF", "%.4X", -__LINE__, -0x000058aL, "-1418", "%.3ld", -__LINE__, 0x00001cebL, "1CEB", "%X", -__LINE__, 0x00000021L, "21", "% X", -__LINE__, 0x00000002L, "2", "%0d", -__LINE__, -0x2f9bbf5L, "-49921013", "%.4ld", -__LINE__, 0x00000e91L, "03729", "%#.5ld", -__LINE__, 0xf1116740L, "f1116740", "%2x", -__LINE__, 0x00014f72L, "14F72", "%X", -__LINE__, 0xfffffcedL, "FFFFFCED", "%X", -__LINE__, 0xffffffffL, "ffffffff", "%.5x", -__LINE__, 0x0017cf0cL, " 1560332", "% 0ld", -__LINE__, 0x0000000aL, "A", "% X", -__LINE__, 0xff3a39d4L, "ff3a39d4", "%x", -__LINE__, 0xfffef05fL, "FFFEF05F", "%X", -__LINE__, 0xfedfe708L, "fedfe708", "%03.0x", -__LINE__, 0x000345a0L, "345A0", "% X", -__LINE__, -0x1ed5b6f7L, "-517322487", "%d", -__LINE__, 0xd2d56c22L, "D2D56C22", "%0.X", -__LINE__, 0x00002cbfL, "2CBF", "%.2X", -__LINE__, 0x00000db4L, "db4", "%3x", -__LINE__, -0x000b154L, "-45396", "%d", -__LINE__, 0x002bf4c7L, "2BF4C7", "%X", -__LINE__, 0x6954abf4L, "+1767156724", "%+d", -__LINE__, 0xfffffffbL, "fffffffb", "%x", -__LINE__, -0x29e0050eL, "-702547214", "%-0ld", -__LINE__, -0x0014989L, "-84361", "%-#0.3ld", -__LINE__, 0x001a557cL, "+1725820", "%+6.5d", -__LINE__, -0x56689a81L, "-1449695873", "%.2d", -__LINE__, 0x00000016L, " 16", "%05.X", -__LINE__, 0x0001da1eL, " 121374", "% d", -__LINE__, -0x04deac7L, "-5106375", "%03.4d", -__LINE__, 0x000012b1L, "4785", "%d", -__LINE__, 0x0009a116L, "9a116", "%-x", -__LINE__, -0x0000003L, "-000003", "%4.6ld", -__LINE__, 0x00000000L, "", "%.0x", -__LINE__, 0x0000000aL, " A", "% 3X", -__LINE__, 0xfffffff0L, "0xfffffff0", "%-#0.1x", -__LINE__, 0x00000086L, "86", "%0X", -__LINE__, 0x0000001fL, "31", "%-d", -__LINE__, 0x0386f706L, "59176710", "%3.6ld", -__LINE__, 0xffe437aeL, "0XFFE437AE", "%#X", -__LINE__, 0x0e5405c6L, "e5405c6", "%-x", -__LINE__, 0xfffdee46L, "FFFDEE46", "%+X", -__LINE__, 0xff861e9dL, "FF861E9D", "%5.X", -__LINE__, 0xfffff570L, "FFFFF570", "%-X", -__LINE__, 0x045c90bdL, "45c90bd", "%0x", -__LINE__, 0x000000aaL, "AA", "%+X", -__LINE__, -0x747262eL, "-122103342", "%0ld", -__LINE__, 0xffffad89L, "FFFFAD89", "%X", -__LINE__, 0x00000018L, "18", "%0.2X", -__LINE__, 0x00057a2dL, " 358957", "% #7.d", -__LINE__, 0x73a0e21dL, "1939923485", "%ld", -__LINE__, -0x00021e1L, "-8673", "%0d", -__LINE__, 0x000000e9L, " 233", "% 06.3ld", -__LINE__, 0xffffcc0dL, "ffffcc0d", "%x", -__LINE__, 0x00000052L, "52", "%x", -__LINE__, 0x01c155afL, "1C155AF", "%.5X", -__LINE__, 0xffffffffL, "ffffffff", "%0.x", -__LINE__, -0x00400a4L, "-262308", "%-d", -__LINE__, -0x0000001L, "-0000001", "%#.7ld", -__LINE__, 0x01fb9c99L, "1fb9c99", "% 03.5x", -__LINE__, 0xffffffffL, "ffffffff", "%6.x", -__LINE__, 0xff5e5eeaL, "FF5E5EEA", "%X", -__LINE__, 0x0000000fL, "F", "%+0X", -__LINE__, 0xfffffe3aL, "fffffe3a", "% x", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%-X", -__LINE__, -0x0000007L, "-7", "%0ld", -__LINE__, -0x002f635L, "-194101", "%d", -__LINE__, -0x0000005L, "-5", "%ld", -__LINE__, -0x0000059L, "-89", "%0ld", -__LINE__, -0x1ccda96L, "-30202518", "%d", -__LINE__, -0x0000002L, "-2", "%-d", -__LINE__, 0xffffffdaL, "0XFFFFFFDA", "%#X", -__LINE__, 0x00036cc5L, "224453", "%#d", -__LINE__, 0x00000010L, "+16", "%+ld", -__LINE__, 0x0b6039c7L, "190855623", "%d", -__LINE__, -0x0000002L, "-002", "%#.3d", -__LINE__, 0xfff3e746L, "FFF3E746", "%-4X", -__LINE__, 0x0361b3deL, "361B3DE", "% 04X", -__LINE__, 0xffffe6a2L, "ffffe6a2", "%-x", -__LINE__, 0x00032790L, "0x0032790", "%#7.7x", -__LINE__, 0xffe33b4eL, "ffe33b4e", "%-0x", -__LINE__, -0x0094663L, "-607843", "%.3ld", -__LINE__, -0x00a3efaL, "-671482", "%4d", -__LINE__, 0x000000e6L, " 00E6", "%7.4X", -__LINE__, 0x000125cbL, "125CB", "%+X", -__LINE__, 0x0000b97eL, "b97e", "%x", -__LINE__, -0x0000039L, "-57", "%+ld", -__LINE__, 0xffffe39aL, "ffffe39a", "%5.4x", -__LINE__, 0xffffffffL, "ffffffff", "%6.1x", -__LINE__, -0xdee910cL, "-233738508", "%-#2d", -__LINE__, -0x14044930L, "-335825200", "%6.ld", -__LINE__, 0x00a81259L, "a81259", "%x", -__LINE__, 0x020e74c6L, "20E74C6", "%X", -__LINE__, -0x00000fbL, "-251", "%01.d", -__LINE__, 0x034ceb45L, "34CEB45", "%5.X", -__LINE__, 0xfeacb66aL, "feacb66a", "% x", -__LINE__, 0x00003eb6L, "3EB6", "% X", -__LINE__, 0x000009efL, "9ef", "% x", -__LINE__, 0xf9d9dd07L, "F9D9DD07", "%0X", -#ifndef __PCCNECV70__ - -__LINE__, 0x000154d7L, "087255", "%.6ld", -__LINE__, -0x000036eL, "-878", "%-ld", -__LINE__, -0x0007dccL, "-32204", "% d", -__LINE__, 0x000019dcL, "6620", "%d", -__LINE__, 0xffffff6eL, "FFFFFF6E", "%2X", -__LINE__, 0x00000016L, "0x16", "%-#x", -__LINE__, 0xffdb3e96L, "ffdb3e96", "%+.5x", -__LINE__, 0xffffffefL, "FFFFFFEF", "% 04.X", -__LINE__, 0xffffffffL, "FFFFFFFF", "%5X", -__LINE__, 0x000c08cdL, "C08CD", "%-X", -__LINE__, 0x18de71eeL, "18de71ee", "%x", -__LINE__, 0xffffffffL, "ffffffff", "% x", -__LINE__, -0x00025bdL, "-009661", "%#.6d", -__LINE__, 0x2f05de14L, " 788913684", "% 6.4ld", -__LINE__, 0x0c99cf86L, "211406726", "%.5d", -__LINE__, 0x09e6a21dL, " 166109725", "% 0d", -__LINE__, -0x013da65L, "-1301093", "%+ld", -__LINE__, 0x000003d0L, " 976", "% 4.2d", -__LINE__, -0xef9e3ccL, "-251257804", "%-7.0d", -__LINE__, 0x0000000cL, "+12", "%+00ld", -__LINE__, 0xffffffe2L, "ffffffe2", "%x", -__LINE__, 0x000000feL, "fe", "%-x", -__LINE__, 0xfffffc5fL, "fffffc5f", "%x", -__LINE__, -0x0005c55L, "-23637", "%d", -__LINE__, -0x0111ff2L, "-1122290", "% 7.d", -__LINE__, -0x1a1746e5L, "-437733093", "%.4ld", -__LINE__, 0x00001007L, "004103", "%00.6d", -__LINE__, 0xffffffe1L, "ffffffe1", "%x", -__LINE__, 0x0000d80fL, "55311", "%d", -__LINE__, 0x00000004L, "4", "%+X", -__LINE__, 0xfffffffdL, "fffffffd", "%6x", -__LINE__, -0x2afbcc3cL, "-721144892", "%4.6ld", -__LINE__, 0x00377f96L, "377F96", "%6.X", -__LINE__, 0xffffffc8L, "FFFFFFC8", "%0X", -__LINE__, 0x007ed9d1L, "8313297", "%-3d", -__LINE__, 0x00000000L, "0", "%-X", -__LINE__, 0x001e122dL, "1970733", "%01.d", -__LINE__, -0x000029bL, "-667", "%ld", -__LINE__, -0x002f563L, "-193891", "% 2.5d", -__LINE__, 0xfffffffeL, "fffffffe", "%+3.7x", -__LINE__, 0xfff7658cL, "fff7658c", "%x", -__LINE__, -0x0006d08L, "-0027912", "%7.7ld", -__LINE__, 0x00000080L, "80", "%X", -__LINE__, 0x0000078fL, " 1935", "% 6ld", -__LINE__, 0xfffffffbL, "FFFFFFFB", "% X", -__LINE__, 0x000000aeL, " AE", "%7.X", -__LINE__, -0x000d6aaL, "-54954", "%-ld", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%6.X", -__LINE__, 0x000003bfL, "+959", "%+d", -__LINE__, -0x7242d04bL, "-1916981323", "% ld", -__LINE__, 0xf0e6546fL, "F0E6546F", "% .7X", -__LINE__, 0x047e196aL, "75372906", "%ld", -__LINE__, 0x0240174eL, "240174E", "%+0X", -__LINE__, -0x0000006L, "-006", "%.3ld", -__LINE__, 0x00068aacL, "428716", "%#ld", -__LINE__, 0xffffffa1L, "ffffffa1", "%0x", -__LINE__, 0x000adab3L, "adab3", "%x", -__LINE__, -0x00000aeL, "-0000174", "%7.7ld", -__LINE__, 0x0f0a8f4bL, "f0a8f4b", "% x", -__LINE__, 0xfee229bcL, "fee229bc", "%x", -__LINE__, -0x275b8455L, "-660309077", "%.2ld", -__LINE__, -0xca4b2a5L, "-212120229", "%d", -__LINE__, 0x000000b5L, " 181", "%04.d", -__LINE__, 0xfff213f2L, "FFF213F2", "%X", -__LINE__, 0x00000003L, "3", "%-X", -__LINE__, 0x0ebb978bL, "247175051", "%.6ld", -__LINE__, 0xffffffcaL, "FFFFFFCA", "%X", -__LINE__, -0x0000003L, "-03", "%+0.2d", -__LINE__, -0x178ff86L, "-24706950", "%+d", -__LINE__, 0x0000003cL, " 60", "%7.ld", -__LINE__, -0x001012dL, "-65837", "%.5d", -__LINE__, 0x03673fd2L, "3673fd2", "%.5x", -__LINE__, -0x001fe74L, "-130676", "%#0.6ld", -__LINE__, 0x004f6226L, "4f6226", "%-0x", -__LINE__, 0xfffffa0fL, "fffffa0f", "%7x", -__LINE__, 0xfffffff8L, "fffffff8", "%-.6x", -__LINE__, -0x0000001L, "-1", "%#d", -__LINE__, 0xffffe43dL, "ffffe43d", "%7x", -__LINE__, 0x00009d47L, "0040263", "%7.7ld", -__LINE__, 0xff0fc79fL, "FF0FC79F", "%-4.X", -__LINE__, 0x2d610907L, "2d610907", "%x", -__LINE__, -0x00002deL, "-734", "%04d", -__LINE__, 0x0000036bL, " 36B", "%7.1X", -__LINE__, 0x00000002L, "2", "%.0x", -__LINE__, -0x1f577b3eL, "-525826878", "%d", -__LINE__, 0x0000002dL, "45", "%#ld", -__LINE__, 0xfffffffbL, "fffffffb", "%x", -__LINE__, -0x0000004L, "-4", "%-.0d", -__LINE__, 0x00016ba4L, "16ba4", "%x", -__LINE__, -0x1ad853d5L, "-450384853", "% 0ld", -__LINE__, 0x00366899L, "366899", "%2.x", -__LINE__, 0x1659158bL, "1659158B", "%X", -__LINE__, 0x000076c7L, "76c7", "%x", -__LINE__, 0x00000674L, "674", "%0x", -__LINE__, 0x016c9d8aL, "+23895434", "%+ld", -__LINE__, 0xfffffc43L, "FFFFFC43", "%0X", -__LINE__, 0xfff249d2L, "fff249d2", "%-2.x", -__LINE__, 0xffffffddL, "ffffffdd", "%5x", -__LINE__, 0xffffa7efL, "FFFFA7EF", "%0.3X", -__LINE__, 0x030d4d06L, "30d4d06", "%x", -__LINE__, -0x0e4694bL, "-14969163", "%d", -__LINE__, 0x00000078L, "120", "%.3ld", -__LINE__, -0x16c1273eL, "-381757246", "%0d", -__LINE__, 0xffffd183L, "FFFFD183", "% 0X", -__LINE__, -0x2dfdaddL, "-48224989", "%ld", -__LINE__, -0x5767fe5cL, "-1466433116", "%ld", -__LINE__, 0x01bea036L, "29270070", "%#4.3d", -__LINE__, 0x00000027L, "27", "%-x", -__LINE__, 0x0004d183L, "4D183", "%X", -__LINE__, 0xffdaf9c8L, "FFDAF9C8", "%.7X", -__LINE__, 0xfffffd95L, "fffffd95", "%x", -__LINE__, -0x0059acbL, "-367307", "%00.d", -__LINE__, 0x017d8db4L, "17d8db4", "% 05.x", -__LINE__, 0x0001f084L, "001F084", "%5.7X", -__LINE__, 0x00000006L, " 6", "% ld", -__LINE__, 0x011b0802L, "18548738", "%.3ld", -__LINE__, 0x00000006L, " 6", "%#3.d", -__LINE__, 0xffffffffL, "ffffffff", "%6x", -__LINE__, 0x00000001L, "1", "% x", -__LINE__, 0x00000750L, " 01872", "% .5d", -__LINE__, 0xfffffff9L, "fffffff9", "%x", -__LINE__, -0x00f842cL, "-1016876", "%+d", -__LINE__, -0x001dcf0L, "-122096", "%-0d", -__LINE__, 0x000000c9L, "0XC9", "% #3X", -__LINE__, 0x1e368e86L, "1e368e86", "%7x", -__LINE__, -0x0001157L, "-4439", "% 03.4d", -__LINE__, 0xfff91e87L, "FFF91E87", "%3.5X", -__LINE__, 0x00000006L, "6", "%x", -__LINE__, 0x00000bcaL, "3018", "%ld", -__LINE__, 0x00495ff6L, "495ff6", "%01.0x", -__LINE__, -0x0267f7aL, "-2523002", "% #5d", -__LINE__, 0x00000060L, "96", "%-d", -__LINE__, 0x000850c6L, "544966", "%#.1d", -__LINE__, 0x00231457L, "231457", "%-6.4X", -__LINE__, 0x0000000bL, "11", "%-d", -__LINE__, 0x000003bdL, "957", "%#d", -__LINE__, 0xfd51d970L, "FD51D970", "%+.7X", -__LINE__, 0x000007bfL, "1983", "%-ld", -__LINE__, 0x000034b2L, "34B2", "%0.X", -__LINE__, 0x0000c18dL, "C18D", "%0.X", -__LINE__, 0xffffbb83L, "ffffbb83", "% 3x", -__LINE__, 0x000001d0L, "0x1d0", "%#x", -__LINE__, -0x003c784L, "-247684", "%#ld", -__LINE__, 0x0210cffaL, "210CFFA", "%X", -__LINE__, -0x33093a1L, "-53515169", "% 0d", -__LINE__, 0x00000001L, " 1", "% #ld", -__LINE__, 0xffffaa53L, "ffffaa53", "%-4.5x", -__LINE__, 0x2935c056L, "691388502", "%1.d", -__LINE__, -0x0000001L, "-1", "%ld", -__LINE__, 0x000013d1L, "0X013D1", "%+#2.5X", -__LINE__, -0x000035cL, "-860", "%-.2d", -__LINE__, 0x00000000L, " ", "%-4.X", -__LINE__, -0x0000147L, "-327", "%d", -__LINE__, 0x0a317eb0L, "171015856", "%.7d", -__LINE__, 0x00000003L, "3", "%ld", -__LINE__, 0x000001d6L, "1d6", "%-x", -__LINE__, 0x18185214L, "404247060", "%-.2ld", -__LINE__, 0x00574140L, "0574140", "%.7X", -__LINE__, 0x00002ea5L, "02ea5", "%.5x", -__LINE__, 0x00000005L, "5", "% x", -__LINE__, 0xffc47ed6L, "ffc47ed6", "%-x", -__LINE__, 0x0001f5daL, "0X1F5DA", "%#X", -__LINE__, 0xfffffcc9L, "fffffcc9", "% x", -__LINE__, 0x02586c98L, "2586C98", "%X", -__LINE__, -0x0000036L, "-54", "% ld", -__LINE__, 0x00064b57L, "412503", "%1.5d", -__LINE__, -0x0000007L, "-7", "%#0.0ld", -__LINE__, 0x00023a03L, "145923", "%ld", -__LINE__, -0x0000065L, "-101", "%+#d", -__LINE__, 0x00000208L, "208", "%X", -__LINE__, 0x00e97728L, "15300392", "%-ld", -__LINE__, 0x0000030aL, "+778", "%+d", -__LINE__, 0xf4d7deeeL, "F4D7DEEE", "%+X", -__LINE__, -0x000009aL, "-154", "%+.3ld", -__LINE__, 0x000002c0L, "+704", "%+ld", -__LINE__, 0x0067ec23L, "67ec23", "%x", -__LINE__, 0x005ca7fcL, "+6072316", "%+d", -__LINE__, 0xfffff5f1L, "fffff5f1", "%x", -__LINE__, 0x00000601L, " 0X601", "%#7.2X", -__LINE__, -0x0000057L, "-87", "% ld", -__LINE__, -0x0000078L, " -120", "%7.d", -__LINE__, -0x000001fL, "-31 ", "%-6d", -__LINE__, 0x0160c000L, "23117824", "%ld", -__LINE__, -0x0000007L, "-7", "%0ld", -__LINE__, 0xfffffffeL, "fffffffe", "%+x", -__LINE__, 0x5b6ef898L, "5b6ef898", "%+0x", -__LINE__, 0x0009bfb6L, "638902", "%d", -__LINE__, -0x0000145L, " -325", "%#6.0d", -__LINE__, -0x508c048L, "-84459592", "%-5.ld", -__LINE__, 0x00000002L, " 0x2", "% #4x", -__LINE__, 0x0001486eL, "84078", "%#d", -__LINE__, 0x006ac76aL, "6997866", "%.6d", -__LINE__, 0xffffff98L, "FFFFFF98", "%X", -__LINE__, 0xfffffe08L, "fffffe08", "%6.x", -__LINE__, -0x24ef47eL, "-38728830", "%1.6ld", -__LINE__, 0x39d1b2dbL, "39D1B2DB", "% X", -__LINE__, 0xfffc9ce2L, "0xfffc9ce2", "%#x", -__LINE__, 0x59485e14L, "1497914900", "%#4ld", -__LINE__, 0x000022ebL, "22EB", "%3.X", -__LINE__, 0xfa410352L, "FA410352", "%-X", -__LINE__, -0x4a342f0L, "-77808368", "% ld", -__LINE__, 0xef5825a4L, "EF5825A4", "%.6X", -__LINE__, 0x01b0185aL, "0x1b0185a", "% #x", -__LINE__, -0x0004290L, "-17040", "%.3d", -__LINE__, -0x10f88659L, "-284722777", "%+6.2ld", -__LINE__, 0x00003216L, "12822", "%-d", -__LINE__, 0x4a31a219L, "1244766745", "%d", -__LINE__, 0xffffffb5L, "FFFFFFB5", "%-X", -__LINE__, 0x0000d586L, "D586", "%-2.X", -__LINE__, 0x00008496L, "33942", "%1.d", -__LINE__, -0x0000011L, "-17", "%1ld", -__LINE__, 0x0000003cL, "3C", "%2.X", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%.3X", -__LINE__, 0x0000152aL, "152A", "%X", -__LINE__, 0xfffe876eL, "FFFE876E", "%X", -__LINE__, -0x0003874L, "-14452", "%-ld", -__LINE__, -0x004918aL, "-299402", "%#.6d", -__LINE__, -0x000000cL, "-12", "%-d", -__LINE__, 0xffffd812L, "FFFFD812", "%+X", -__LINE__, -0x000000cL, "-12", "%0d", -__LINE__, -0x0000229L, "-553", "%0d", -__LINE__, 0x00002ab8L, "2AB8", "%4.X", -__LINE__, 0x0000004bL, "+75", "%+ld", -__LINE__, 0x001c3178L, " 1847672", "% ld", -__LINE__, -0x0000006L, "-6", "%.0ld", -__LINE__, 0x0003be65L, "245349", "%ld", -__LINE__, -0x0000001L, "-1", "%#1ld", -__LINE__, 0x0000007fL, "+127", "%+ld", -__LINE__, 0x0000020eL, "526 ", "%-5ld", -__LINE__, 0x00000002L, "2", "%d", -__LINE__, 0x03bd0873L, "0X3BD0873", "%#X", -__LINE__, 0x00093a52L, "604754", "%-2d", -__LINE__, -0x00823fcL, "-0533500", "%+.7ld", -__LINE__, 0x00000000L, " ", "%4.X", -__LINE__, -0x0000001L, "-1", "%ld", -__LINE__, 0xfff09edeL, "fff09ede", "%-x", -__LINE__, 0x01e28c24L, "31624228", "%ld", -__LINE__, 0x00001dccL, "1DCC", "%X", -__LINE__, -0x0f0ea0dL, "-15788557", "%-00.ld", -__LINE__, 0xffff73a1L, "FFFF73A1", "%X", -__LINE__, -0x0004040L, "-16448", "%+#d", -__LINE__, 0x0073b158L, "0x73b158", "%#7x", -__LINE__, 0xfffff8ffL, "FFFFF8FF", "% 5X", -__LINE__, -0x0000004L, "-4", "%0d", -__LINE__, 0xffff56a3L, "ffff56a3", "%1.6x", -__LINE__, -0x0000041L, "-65", "%0d", -__LINE__, 0x00000009L, "+0000009", "%+2.7d", -__LINE__, 0xffffe13dL, "0XFFFFE13D", "%+#2.X", -__LINE__, -0x00002ceL, "-00718", "%.5ld", -__LINE__, 0xffc53e28L, "ffc53e28", "%03.4x", -__LINE__, 0x00000005L, "0X5", "%#X", -__LINE__, 0x00000004L, "4", "%x", -__LINE__, 0xe21b35ebL, "e21b35eb", "%-x", -__LINE__, -0x0000098L, "-152", "%-ld", -__LINE__, 0xffffff81L, "FFFFFF81", "%2X", -__LINE__, 0x00000003L, "00003", "%.5ld", -__LINE__, 0xfffffffcL, "fffffffc", "%+x", -__LINE__, 0x000491f5L, "299509", "%1.ld", -__LINE__, 0xf06bfd7dL, "F06BFD7D", "%X", -__LINE__, -0x0000006L, "-6", "%0d", -__LINE__, -0x0a4af7dL, "-10792829", "%-0d", -__LINE__, -0x11a74efL, "-18511087", "%ld", -__LINE__, 0x2dc95e17L, "768171543", "%-1.d", -__LINE__, -0x0000001L, "-1", "%#ld", -__LINE__, 0x00000033L, "51", "%-#d", -__LINE__, 0x002d0219L, "2949657", "%ld", -__LINE__, 0xfffffffdL, "FFFFFFFD", "%2.4X", -__LINE__, 0x00000f20L, "+3872", "%+ld", -__LINE__, -0x0000047L, "-071", "%4.3ld", -__LINE__, 0x00000010L, " 16", "%6d", -__LINE__, 0x00000000L, "0", "%0d", -__LINE__, 0xffffff57L, "FFFFFF57", "%X", -__LINE__, -0x0000700L, "-1792", "%-#d", -__LINE__, -0x0000064L, "-100", "%-ld", -__LINE__, 0xff26d49aL, "FF26D49A", "%-0X", -__LINE__, -0x0000006L, "-6", "%.1ld", -__LINE__, 0x1391edc5L, "1391edc5", "%.1x", -__LINE__, 0x0000014aL, "330", "%-#ld", -__LINE__, 0x07ecd1e1L, "7ecd1e1", "%6x", -__LINE__, -0xa2b8898L, "-170625176", "%3.d", -__LINE__, 0x00035287L, "0x35287", "%#.0x", -__LINE__, 0x00000000L, "00000", "%0.5X", -__LINE__, -0x0000153L, "-339", "%d", -__LINE__, 0x0000ad6eL, " 44398", "% 0.d", -__LINE__, 0x00000001L, "1", "%-X", -__LINE__, -0x000000dL, "-13 ", "%-6.2d", -__LINE__, -0x01bff8aL, "-1834890", "%d", -__LINE__, 0x000a0fa8L, "+659368", "%+ld", -__LINE__, 0xac044dc0L, "ac044dc0", "%.0x", -__LINE__, 0x0003a729L, "239401", "%ld", -__LINE__, -0x00004f0L, "-1264", "%+ld", -__LINE__, 0x00000000L, "0", "%x", -__LINE__, 0x00000012L, "12", "% x", -__LINE__, 0xffff770bL, "ffff770b", "%7.1x", -__LINE__, 0xd7458572L, "d7458572", "%x", -__LINE__, 0x01f1b4f9L, "1f1b4f9", "% 0x", -__LINE__, 0xfffb2198L, "0XFFFB2198", "% #1.X", -__LINE__, 0x00ef6189L, " 15688073", "% ld", -__LINE__, -0x3f0ae63L, "-66104931", "% #d", -__LINE__, -0x0006075L, "-24693", "%ld", -__LINE__, 0x000000a1L, "161", "%d", -__LINE__, 0xfffffffcL, "fffffffc", "%3.2x", -__LINE__, 0xff6b4125L, "FF6B4125", "%+5.X", -__LINE__, 0x00000001L, " 1", "%6.d", -__LINE__, -0x0000001L, "-1", "%+0d", -__LINE__, -0x000096cL, "-2412", "%0.4d", -__LINE__, 0x00039c6fL, "236655", "%.0d", -__LINE__, 0x3625286cL, "908404844", "%.1d", -__LINE__, 0xfffffffaL, "fffffffa", "%x", -__LINE__, 0x00000000L, "0", "%X", -__LINE__, 0x00c34353L, "12796755", "%#.4d", -__LINE__, 0x000002dfL, "735", "%ld", -__LINE__, 0xffff38faL, "FFFF38FA", "%5.1X", -__LINE__, -0x000002aL, "-42", "%0.d", -__LINE__, 0x0000077eL, "1918", "%ld", -__LINE__, 0x000001f7L, "503", "%ld", -__LINE__, 0x00000004L, "4", "%ld", -__LINE__, 0x0021fb02L, "2226946", "%d", -__LINE__, 0x007c858dL, "8160653", "%-0d", -__LINE__, -0x0000109L, "-265", "%.0d", -__LINE__, 0xfffffffaL, "fffffffa", "% x", -__LINE__, 0x0097932dL, "97932d", "%+x", -__LINE__, 0xfffbbd03L, "fffbbd03", "%-.5x", -__LINE__, -0x0000005L, "-5", "%0d", -__LINE__, 0x03ee3a95L, "65944213", "%ld", -__LINE__, -0x0000002L, " -00002", "%7.5d", -__LINE__, 0xea1a4e54L, "EA1A4E54", "%X", -__LINE__, -0x000a9d6L, "-43478", "%+d", -__LINE__, -0x0fd8d65L, "-16616805", "%5ld", -__LINE__, 0x00000001L, "1", "%-d", -__LINE__, 0x00000072L, "72", "%2.X", -__LINE__, 0xffffff94L, "FFFFFF94", "%X", -__LINE__, 0x00000d2aL, "D2A", "%+X", -__LINE__, 0xffff614fL, "ffff614f", "%x", -__LINE__, -0x0000018L, "-24", "%ld", -__LINE__, 0x0000003bL, "059", "%2.3d", -__LINE__, 0x0000001aL, "1A", "%0X", -__LINE__, -0x0000109L, "-265", "%02ld", -__LINE__, 0x00000f9dL, "3997", "%#1d", -__LINE__, 0x0000001bL, "1b", "%x", -__LINE__, 0xffffff07L, "ffffff07", "%x", -__LINE__, 0xfff1a425L, "0xfff1a425", "%#x", -__LINE__, 0x00000005L, "5", "%-1d", -__LINE__, -0x53a6efdL, "-87715581", "%ld", -__LINE__, 0x042f37dbL, "42F37DB", "%6.X", -__LINE__, 0x00053bd5L, "+342997", "%+5ld", -__LINE__, 0xffffffffL, "ffffffff", "% x", -__LINE__, 0xffffffefL, "FFFFFFEF", "%6.X", -__LINE__, -0x10ec29aL, "-17744538", "%+2.d", -__LINE__, 0x01dcc901L, "1dcc901", "%x", -__LINE__, 0x0007dc68L, "515176", "%-3.d", -__LINE__, -0x0000062L, "-0098", "%#2.4d", -__LINE__, 0x00000000L, " ", "%3.0X", -__LINE__, -0x00000deL, "-222", "%ld", -__LINE__, 0x000c1fb8L, "C1FB8", "%0X", -__LINE__, 0x0005bf58L, "5BF58", "%X", -__LINE__, -0x000dd1bL, "-56603", "%-03.1d", -__LINE__, 0x00000b14L, "B14", "%+3.X", -__LINE__, 0x00000799L, "799", "%-x", -__LINE__, 0xfffffffaL, "fffffffa", "%x", -__LINE__, 0x00000003L, "0x00003", "% #7.5x", -__LINE__, -0x002b9f1L, "-178673", "%+d", -__LINE__, -0x001b817L, "-112663", "%0d", -__LINE__, 0xf6f98533L, "f6f98533", "%.1x", -__LINE__, 0x00338ffcL, "3379196", "%d", -__LINE__, 0x0409e9b5L, "0X409E9B5", "%#X", -__LINE__, 0x00b8e98eL, " 12118414", "% 0d", -__LINE__, -0x002a8f6L, "-174326", "%ld", -__LINE__, 0x13bb9722L, "331061026", "%0d", -__LINE__, 0x00063c71L, "63c71", "%x", -__LINE__, 0xfffffe37L, "FFFFFE37", "%.1X", -__LINE__, 0xffff7b3eL, "ffff7b3e", "%+.1x", -__LINE__, 0x005eeab1L, "5eeab1", "%+x", -__LINE__, 0xffc69e99L, "ffc69e99", "%x", -__LINE__, -0x000005cL, " -92", "%5ld", -__LINE__, 0x07d8fa8aL, "7d8fa8a", "%x", -__LINE__, 0x00030e0aL, "200202", "%-4.1d", -__LINE__, 0x00001dc1L, "1DC1", "%.0X", -__LINE__, 0x00000008L, "8", "%0ld", -__LINE__, -0x01b5397L, "-1790871", "%3.d", -__LINE__, 0x27fbb4b5L, "27fbb4b5", "%x", -__LINE__, -0xe3fdcfcL, "-239066364", "%4ld", -__LINE__, 0x0008bcb1L, "8bcb1", "%0x", -__LINE__, 0xffff039eL, "ffff039e", "%.6x", -__LINE__, 0x000d0bd4L, "d0bd4", "%-x", -__LINE__, 0x00000000L, "+0", "%+d", -__LINE__, -0x2a49ea4L, "-44342948", "%1d", -__LINE__, -0x0000055L, "-85", "%0d", -__LINE__, -0x0000a05L, "-2565", "%3.3ld", -__LINE__, -0x000000bL, "-11 ", "%-4d", -__LINE__, 0xfff30444L, "FFF30444", "%7.X", -__LINE__, 0x0000003fL, "63", "%-0d", -__LINE__, 0x00046779L, "46779", "%X", -__LINE__, 0x000028d7L, " 0X28D7", "%#7.X", -__LINE__, 0x00000019L, " 19", "%5x", -__LINE__, 0x0032291dL, "3287325", "%2.ld", -__LINE__, 0x00057afaL, "57AFA", "%X", -__LINE__, 0xfffe8c64L, "fffe8c64", "%3.4x", -__LINE__, -0x624110d6L, "-1648431318", "%+6d", -__LINE__, 0x0000001aL, " 26", "% 5.d", -__LINE__, 0xfffffffdL, "FFFFFFFD", "%6.X", -__LINE__, 0x00199490L, "1676432", "%-1d", -__LINE__, -0xfff8265L, "-268403301", "%-0ld", -__LINE__, 0x0000000eL, "e", "%-x", -__LINE__, 0x00c38aecL, "c38aec", "%x", -__LINE__, -0x00658f4L, "-415988", "%#ld", -__LINE__, 0x0066ac4eL, "6728782", "%0d", -__LINE__, 0xc4a808d5L, "c4a808d5", "%x", -__LINE__, 0x00000000L, " 0", "%6.1x", -__LINE__, 0x00066d24L, "66d24", "%x", -__LINE__, 0x00002117L, "2117", "%X", -__LINE__, 0xfe06fdf4L, "FE06FDF4", "%0X", -__LINE__, 0xfffffff9L, "fffffff9", "%x", -__LINE__, 0x1c6bb795L, "+476821397", "%+d", -__LINE__, 0xfffffba4L, "FFFFFBA4", "%X", -__LINE__, 0xfffd7d44L, "fffd7d44", "%0x", -__LINE__, 0x0019dd17L, "1694999", "%d", -__LINE__, 0x6475851eL, "0x6475851e", "% #7.x", -__LINE__, -0x00330d5L, "-209109", "%0ld", -__LINE__, 0x009f53f7L, "09F53F7", "%+6.7X", -__LINE__, -0x00172f9L, " -94969", "%7.5ld", -__LINE__, 0xffffffdcL, "FFFFFFDC", "%X", -__LINE__, -0x013bdecL, "-1293804", "%+#2ld", -__LINE__, 0xfff845c0L, "fff845c0", "%+7.x", -__LINE__, -0x0fbe712L, "-16508690", "%.7d", -__LINE__, 0xffffe13fL, "ffffe13f", "%x", -__LINE__, 0xbbc19951L, "BBC19951", "%-4X", -__LINE__, -0x28d6d1bL, "-42822939", "%#d", -__LINE__, -0x93cda6bL, "-154983019", "%-d", -__LINE__, 0xffc93342L, "FFC93342", "%7.X", -__LINE__, 0x072ac8b3L, " 120244403", "% ld", -__LINE__, 0xfff8d17bL, "FFF8D17B", "% X", -__LINE__, 0x00000da5L, "DA5", "%0.X", -__LINE__, 0x055ad3acL, "0x55ad3ac", "%#1x", -__LINE__, 0x00000e5aL, " 3674", "% .4ld", -__LINE__, 0xffffff79L, "FFFFFF79", "%+X", -__LINE__, 0xffffe167L, "ffffe167", "%+5x", -__LINE__, 0x0000fa50L, "0064080", "%.7ld", -__LINE__, 0x00000001L, "1", "%-d", -__LINE__, 0xfffffffeL, "fffffffe", "%x", -__LINE__, 0x000009acL, " 2476", "% #2.ld", -__LINE__, 0x00000e78L, "0003704", "%.7ld", -__LINE__, -0x000dfc3L, "-57283", "%6.d", -__LINE__, 0x00000ee0L, "EE0", "%0X", -__LINE__, -0x293703b3L, "-691471283", "%ld", -__LINE__, 0x000073e8L, " 73e8", "%6x", -__LINE__, 0xffffdffdL, "ffffdffd", "%5.5x", -__LINE__, 0x00000004L, "4", "%+00.x", -__LINE__, 0x00000008L, "0X8", "%#X", -__LINE__, 0x0003044cL, "3044c", "%0x", -__LINE__, 0xffc2095eL, "FFC2095E", "%0X", -__LINE__, 0x00000aacL, "0002732", "%-.7ld", -__LINE__, 0xffffff79L, "FFFFFF79", "%+1.X", -__LINE__, 0x53a0f94aL, " 1403058506", "% 2.4ld", -__LINE__, 0x000e928dL, "e928d", "%x", -__LINE__, 0x0024127aL, "2364026", "%5.d", -__LINE__, 0x000f7c1cL, " 1014812", "% 2.d", -__LINE__, -0x000003dL, "-61 ", "%-#4ld", -__LINE__, -0x0000122L, "-290", "%+ld", -__LINE__, 0x00000006L, "+6", "%+0d", -__LINE__, 0x00000129L, " 000129", "%7.6X", -__LINE__, 0x15d873e5L, " 366506981", "% 5.7d", -__LINE__, 0x00000001L, "1", "%d", -__LINE__, 0x038d6110L, "+59597072", "%+d", -__LINE__, 0x0f46ccc3L, "256298179", "%-1.4d", -__LINE__, 0xfe434d21L, "fe434d21", "%x", -__LINE__, -0x179797d7L, "-395810775", "%d", -__LINE__, 0xe35807bfL, "e35807bf", "%x", -__LINE__, 0x00000003L, " +3", "%+7d", -__LINE__, 0x017e699eL, "25061790", "%#ld", -__LINE__, -0x0000029L, "-41", "%d", -__LINE__, 0xffffff11L, "ffffff11", "%1.x", -__LINE__, -0x0001bf6L, "-7158", "%+0ld", -__LINE__, 0xffffff4bL, "FFFFFF4B", "%4X", -__LINE__, -0x0000040L, "-64", "%ld", -__LINE__, 0x000034d6L, "+13526", "%+ld", -__LINE__, 0xffffffa7L, "ffffffa7", "%x", -__LINE__, 0xfffffe8eL, "fffffe8e", "%+.3x", -__LINE__, 0x00000000L, "0", "%0.1d", -__LINE__, -0x007cdf1L, "-511473", "%ld", -__LINE__, 0xfffffeefL, "FFFFFEEF", "%-X", -__LINE__, 0x00002d91L, "2d91", "%x", -__LINE__, -0x000025bL, "-603", "%#ld", -__LINE__, -0x000001bL, "-27", "%-ld", -__LINE__, 0x042b6752L, "42B6752", "%+X", -__LINE__, -0x75afb0a6L, "-1974448294", "% ld", -__LINE__, -0x0000001L, "-1", "%ld", -__LINE__, 0x00000542L, " 1346", "%6d", -__LINE__, -0x0000010L, "-16", "%+0d", -__LINE__, 0xfffed8f7L, "FFFED8F7", "%5.X", -__LINE__, 0x0541852eL, "541852e", "% 2.x", -__LINE__, 0xff22aec3L, "ff22aec3", "% .1x", -__LINE__, 0x5e34b745L, "1580513093", "%ld", -__LINE__, 0xfffffff3L, "fffffff3", "%x", -__LINE__, 0x0eda7b86L, "+249199494", "%+.3d", -__LINE__, 0xffffe40fL, "ffffe40f", "%+x", -__LINE__, -0x0003484L, "-13444", "%-1.5ld", -__LINE__, 0x0000334bL, " 13131", "%6.ld", -__LINE__, -0x0000149L, "-329", "%ld", -__LINE__, 0x00000001L, " 001", "% 5.3x", -__LINE__, 0xffeaa035L, "ffeaa035", "%+3.5x", -__LINE__, 0x00211dffL, "2170367", "%ld", -__LINE__, 0x007e91f4L, "7e91f4", "%x", -__LINE__, 0xfffffffcL, "0xfffffffc", "%+#5x", -__LINE__, 0xfffffffcL, "FFFFFFFC", "%6.X", -__LINE__, 0x0156a9b5L, "156a9b5", "%x", -__LINE__, 0xfffffe58L, "fffffe58", "%+x", -__LINE__, 0xffff8c66L, "FFFF8C66", "%.0X", -__LINE__, 0x00000000L, "0", "%d", -__LINE__, 0x00000005L, " 5", "%7.d", -__LINE__, -0x0000002L, "-2", "%ld", -__LINE__, 0x000076b9L, " 30393", "% ld", -__LINE__, 0x00003824L, "3824", "%4X", -__LINE__, 0x00000cdfL, " CDF", "% 7X", -__LINE__, 0x017c9e8fL, "17C9E8F", "%-X", -__LINE__, -0x20f582dL, "-34560045", "%-.5d", -__LINE__, 0x0000732eL, " 29486", "% 7.ld", -__LINE__, 0xffffffffL, "FFFFFFFF", "%+0X", -__LINE__, 0xf379a4a2L, "F379A4A2", "% .7X", -__LINE__, -0x0000028L, "-40", "%-d", -__LINE__, 0xe73cf79eL, "e73cf79e", "%x", -__LINE__, 0x00000002L, " 2", "%7ld", -__LINE__, -0x00029b1L, "-10673", "%-#1.ld", -__LINE__, -0x0002a58L, "-10840", "%3.d", -__LINE__, 0x00000002L, "2", "%-X", -__LINE__, 0xfffffffcL, "FFFFFFFC", "%X", -__LINE__, -0x000003aL, " -58", "%5ld", -__LINE__, 0x0245ef3bL, "245ef3b", "%.3x", -__LINE__, 0x00026ccaL, "158922", "%-06.3ld", -__LINE__, 0x01016fd3L, "16871379", "%-d", -__LINE__, 0x000016fcL, "5884", "%0ld", -__LINE__, -0x00007fbL, " -2043", "%7.3d", -__LINE__, 0xfff73d3cL, "fff73d3c", "%0x", -__LINE__, -0x0000110L, "-272", "% 04.3d", -__LINE__, 0x0000000eL, " 014", "% 04ld", -__LINE__, -0x0000039L, "-57", "%.0ld", -__LINE__, 0x00000c95L, "c95", "%0x", -__LINE__, 0xffff3b2eL, "ffff3b2e", "%x", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%X", -__LINE__, 0x00000015L, "21", "%.1d", -__LINE__, 0x0000000cL, "+12", "%+ld", -__LINE__, 0x00000000L, "0", "%+X", -__LINE__, 0xfffc9a14L, "fffc9a14", "%-.5x", -__LINE__, 0x0000003cL, "60", "%.2ld", -__LINE__, -0x0000023L, " -35", "%6.d", -__LINE__, 0x00000740L, "1856", "%ld", -__LINE__, 0x00000160L, "160", "% 3.X", -__LINE__, 0x00000006L, " 6", "%5.X", -__LINE__, -0x0000677L, "-1655", "%.3ld", -__LINE__, 0x12709c7eL, "12709C7E", "%.7X", -__LINE__, 0x0000090fL, "+2319", "%+#d", -__LINE__, 0xffffffe0L, "0xffffffe0", "%#4.1x", -__LINE__, 0x00132ce0L, "1256672", "%ld", -__LINE__, 0x00000059L, "59", "%+X", -__LINE__, -0x0000017L, "-23", "%0d", -__LINE__, -0x01fade6L, "-2076134", "%-4.3ld", -__LINE__, 0x000df3faL, "914426", "%.5ld", -__LINE__, 0xfffffd0fL, "fffffd0f", "%7x", -__LINE__, -0x000c212L, "-49682", "%0.1ld", -__LINE__, 0xffff8bcbL, "FFFF8BCB", "%.3X", -__LINE__, 0x0000000aL, "a", "% x", -__LINE__, 0x00000021L, "21", "%x", -__LINE__, -0x0000040L, "-64", "% 1ld", -__LINE__, 0x00000009L, " 9", "%6.ld", -__LINE__, -0x0000d67L, "-3431", "% 5.3d", -__LINE__, 0x03a85f1bL, "61366043", "%ld", -__LINE__, 0x00000035L, "000053", "%0.6d", -__LINE__, 0xfffda5cbL, "fffda5cb", "%+x", -__LINE__, 0xffffff78L, "FFFFFF78", "%-7.0X", -__LINE__, 0xfffffd6dL, "fffffd6d", "%7.x", -__LINE__, 0xfffffc08L, "fffffc08", "%7.3x", -__LINE__, 0x00003335L, " 13109", "% #d", -__LINE__, -0x0000002L, " -2", "%5.d", -__LINE__, -0x13767a48L, "-326531656", "%+ld", -__LINE__, 0x00000be5L, "3045", "%4.0ld", -__LINE__, 0xfffdb28cL, "FFFDB28C", "%X", -__LINE__, 0x00127118L, "1208600", "%ld", -__LINE__, 0x00000086L, " 134", "% ld", -__LINE__, 0x0002214cL, "2214c", "%+x", -__LINE__, 0x0000a0c2L, " a0c2", "%5.0x", -__LINE__, -0x000007cL, "-124", "%ld", -__LINE__, 0x0000012aL, "00298", "%3.5d", -__LINE__, 0xfd4f1257L, "FD4F1257", "%+2.X", -__LINE__, 0xffffd8aaL, "ffffd8aa", "%5x", -__LINE__, -0x00000a7L, "-167", "%+ld", -__LINE__, -0x0009c69L, "-40041", "%0.0ld", -__LINE__, 0x02230418L, "35849240", "%-0.6ld", -__LINE__, 0x00000000L, " 0", "%6x", -__LINE__, 0xfffff184L, "fffff184", "%02.5x", -__LINE__, -0x0ae967bL, "-11441787", "%d", -__LINE__, 0x0015de3aL, "1433146", "%-5.3d", -__LINE__, -0x0071e93L, "-466579", "%1.ld", -__LINE__, 0xfffff8bdL, "fffff8bd", "%+x", -__LINE__, -0x00000e4L, "-228", "%+ld", -__LINE__, 0x000001d8L, " 472", "% .3ld", -__LINE__, 0x00315faaL, "315faa", "%-0x", -__LINE__, 0x00000e59L, "e59", "%0x", -__LINE__, -0x0000005L, "-5", "%ld", -__LINE__, 0x000018ecL, "6380", "%ld", -__LINE__, 0xfffffff9L, "fffffff9", "%5.2x", -__LINE__, -0xe7cfd39L, "-243072313", "%-d", -__LINE__, 0x0002c30bL, "2C30B", "%1.2X", -__LINE__, 0x0000007aL, "7A", "%X", -__LINE__, 0xf604ecb2L, "F604ECB2", "%2X", -__LINE__, -0x05f602cL, "-6250540", "%d", -__LINE__, 0xffff9c86L, "ffff9c86", "%2.x", -__LINE__, -0x00d7f55L, "-884565", "%#d", -__LINE__, 0xd2a37824L, "D2A37824", "%4X", -__LINE__, 0x00000000L, "", "%-.0x", -__LINE__, 0x000d4b51L, "0d4b51", "%3.6x", -__LINE__, 0x000ecd97L, "ecd97", "% x", -__LINE__, -0x0000018L, "-024", "%+04ld", -__LINE__, -0x009f292L, "-651922", "%ld", -__LINE__, -0x0002da9L, "-11689", "%-0ld", -__LINE__, -0x000a218L, "-41496", "%4.5d", -__LINE__, 0xffff85acL, "FFFF85AC", "% 04.X", -__LINE__, -0x0d9ffbeL, "-14286782", "%0d", -__LINE__, 0xfb18cc8eL, "fb18cc8e", "%x", -__LINE__, 0xffffe5d3L, "FFFFE5D3", "%-X", -__LINE__, 0x00000000L, "0", "%x", -__LINE__, -0x0000006L, "-6", "% d", -__LINE__, 0x0002fc62L, "2fc62", "% 03.x", -__LINE__, 0x00000000L, "00", "%.2d", -__LINE__, -0x00000fdL, " -253", "%6ld", -__LINE__, -0x000000bL, "-11", "%d", -__LINE__, -0x00042a3L, "-17059", "% 6d", -__LINE__, 0x00000002L, "2", "% X", -__LINE__, -0x61ead93eL, "-1642780990", "%-0d", -__LINE__, 0xf2e61f6dL, "f2e61f6d", "%-.4x", -__LINE__, 0xffd31b93L, "ffd31b93", "%x", -__LINE__, -0x0000008L, "-8", "%ld", -__LINE__, 0xffffffffL, "ffffffff", "%00x", -__LINE__, 0x000000fbL, "+000251", "%+2.6d", -__LINE__, 0x00000015L, " 15", "%4.X", -__LINE__, 0x06ec6d96L, "6EC6D96", "%+2.X", -__LINE__, 0xffff1df7L, "0xffff1df7", "% #1x", -__LINE__, -0x000004bL, "-75", "%-ld", -__LINE__, 0x00000008L, "8", "%#.0d", -__LINE__, 0x00001355L, "4949", "%3.4ld", -__LINE__, -0x00000f7L, "-247", "%d", -__LINE__, 0x0000001fL, "31", "%.2ld", -__LINE__, 0x0000d556L, "D556", "%-X", -__LINE__, 0xffffd5a5L, "ffffd5a5", "% x", -__LINE__, -0x0000e34L, "-3636", "%#d", -__LINE__, -0x0000007L, "-7", "%d", -__LINE__, 0x01ba10a4L, "1ba10a4", "%x", -__LINE__, 0xfffff759L, "FFFFF759", "% X", -__LINE__, -0x80d0adbL, "-135072475", "%d", -__LINE__, 0x0002bf61L, "2bf61", "%x", -__LINE__, 0xffff008bL, "FFFF008B", "%-7X", -__LINE__, 0x00000e72L, "E72", "%X", -__LINE__, -0x00000eaL, "-234", "%0ld", -__LINE__, -0x0007b9dL, "-0031645", "%0.7ld", -__LINE__, 0x0001baaaL, "0X1BAAA", "%#4X", -__LINE__, 0x0000a57fL, " a57f", "%6.x", -__LINE__, -0x21a73726L, "-564606758", "%ld", -__LINE__, 0x06f45c9fL, "0x6f45c9f", "%#.3x", -__LINE__, 0x00018e5dL, "101981", "%-d", -__LINE__, 0x0001e69aL, "124570", "%-d", -__LINE__, -0x0000d26L, " -3366", "% 07.d", -__LINE__, 0x00000000L, "+", "%+0.ld", -__LINE__, 0x00003916L, "14614", "%ld", -__LINE__, 0xfffffd8fL, "fffffd8f", "%-3.x", -__LINE__, 0x00000011L, "11", "%x", -__LINE__, 0x000000e7L, "E7", "%X", -__LINE__, 0xfdf9d89bL, "FDF9D89B", "%X", -__LINE__, 0x00000a7cL, "a7c", "%x", -__LINE__, 0x0000003fL, "00003F", "%.6X", -__LINE__, 0xffffe729L, "FFFFE729", "%X", -__LINE__, 0xfffffffeL, "fffffffe", "% .6x", -__LINE__, -0x0000a4bL, "-2635", "%+d", -__LINE__, 0xffffff50L, "ffffff50", "%0.7x", -__LINE__, 0xfaf57e8bL, "faf57e8b", "% 4.x", -__LINE__, -0x0000056L, "-86", "%ld", -__LINE__, 0x08ed2a4dL, "8ed2a4d", "%4x", -__LINE__, 0xff8d9081L, "FF8D9081", "%+0.X", -__LINE__, 0x002730a1L, "2568353", "%4d", -__LINE__, 0xffff9564L, "ffff9564", "%x", -__LINE__, -0x0000006L, " -6", "%4ld", -__LINE__, -0x19890310L, "-428409616", "%0ld", -__LINE__, 0xd2ce636cL, "d2ce636c", "%+x", -__LINE__, -0x00001feL, "-510", "%d", -__LINE__, 0x00000006L, "0000006", "%+0.7x", -__LINE__, 0xffffffc2L, "0XFFFFFFC2", "%-#.5X", -__LINE__, -0x00000fdL, "-253", "%+d", -__LINE__, 0x000216aaL, "0x216aa", "%#x", -__LINE__, 0xffe36c66L, "ffe36c66", "%x", -__LINE__, 0x00000002L, "2", "%x", -__LINE__, -0x0000025L, "-37", "% d", -__LINE__, 0x0000007eL, "126", "%d", -__LINE__, 0x0003c1f9L, "+246265", "%+ld", -__LINE__, 0x00000001L, "1", "%ld", -__LINE__, -0x0000001L, "-1", "%ld", -__LINE__, -0x00539e7L, "-342503", "%06.ld", -__LINE__, 0x00000d42L, " 3394", "%#6.ld", -__LINE__, 0xf73b7c4eL, "F73B7C4E", "%X", -__LINE__, 0x00000022L, "22", "%.1x", -__LINE__, 0xffffa883L, "FFFFA883", "%X", -__LINE__, 0x016ec247L, "16ec247", "%x", -__LINE__, 0x00000019L, "19", "%+X", -__LINE__, 0x0000665aL, "665A", "% 2.X", -__LINE__, 0xfffffffcL, "FFFFFFFC", "%-5.X", -__LINE__, 0x008e3fbcL, "8E3FBC", "%X", -__LINE__, 0xfffffffaL, "FFFFFFFA", "%X", -__LINE__, 0x1b806597L, "461399447", "%.2d", -__LINE__, 0x00000366L, "0000870", "%#1.7ld", -__LINE__, 0x0001d92eL, "1d92e", "%x", -__LINE__, 0x000104ceL, "104CE", "%-X", -__LINE__, 0xfffffe4cL, "fffffe4c", "%x", -__LINE__, 0x000000e9L, "E9", "%X", -__LINE__, 0x000a855cL, " 689500", "% d", -__LINE__, 0x00000075L, "75", "% X", -__LINE__, -0x0000026L, "-38", "%ld", -__LINE__, 0xfffff169L, "fffff169", "%-04.2x", -__LINE__, 0xffffff6fL, "ffffff6f", "%x", -__LINE__, 0x00000003L, "0x3", "%#x", -__LINE__, 0x00623babL, "6437803", "%.0d", -__LINE__, -0x2260224cL, "-576725580", "%ld", -__LINE__, 0xe7e7a998L, "E7E7A998", "%.1X", -__LINE__, 0x00000005L, "5", "%X", -__LINE__, 0x0000b560L, "0xb560", "%#x", -__LINE__, 0xfe11854dL, "fe11854d", "%-.5x", -__LINE__, 0x00190014L, "1638420", "%ld", -__LINE__, 0x0001d22aL, "0X1D22A", "%-#X", -__LINE__, 0x00000c16L, "c16", "%2x", -__LINE__, 0x00000d1aL, "3354", "%#d", -__LINE__, 0x000165f6L, "91638", "%d", -__LINE__, 0xfffff557L, "0XFFFFF557", "%#X", -__LINE__, 0x00000588L, " 588", "%07.X", -__LINE__, 0xf4a72708L, "f4a72708", "%x", -__LINE__, 0xfff1cba9L, "0xfff1cba9", "% #2.5x", -__LINE__, 0x000333a4L, "209828", "%d", -__LINE__, 0x0000179bL, "179B", "% 2.X", -__LINE__, 0x00000460L, "1120", "%0ld", -__LINE__, 0xffffff89L, "FFFFFF89", "%X", -__LINE__, -0x0000012L, "-18", "%ld", -__LINE__, 0x00004fe0L, "20448", "%0.d", -__LINE__, 0x00532e77L, "532e77", "%00.x", -__LINE__, 0xf7b92efeL, "f7b92efe", "%0x", -__LINE__, -0x0000243L, "-579", "%+1.d", -__LINE__, 0x34894bb7L, "+881413047", "%+d", -__LINE__, 0xfffaa189L, "FFFAA189", "% 6X", -__LINE__, -0x0000579L, "-1401", "%+ld", -__LINE__, 0x005acb12L, "5acb12", "%5.0x", -__LINE__, 0xffff890aL, "FFFF890A", "%X", -__LINE__, 0x010dff2fL, "10DFF2F", "%.7X", -__LINE__, 0x00005a7fL, "23167", "%#ld", -__LINE__, 0x000005e3L, "1507", "%#3d", -__LINE__, -0xa815bcbL, "-176249803", "%d", -__LINE__, 0xffffffffL, "ffffffff", "%+x", -__LINE__, 0xfffe0ff7L, "fffe0ff7", "%3x", -__LINE__, 0xffffffffL, "0XFFFFFFFF", "%#2.1X", -__LINE__, -0x1cc5ea52L, "-482732626", "%6.d", -__LINE__, 0x000425edL, "+0271853", "%+.7d", -__LINE__, 0x00000001L, "1", "%+x", -__LINE__, -0x48f2a72L, "-76491378", "%7.0d", -__LINE__, 0xfffffff7L, "FFFFFFF7", "% 0X", -__LINE__, 0xfd8ffc0aL, "fd8ffc0a", "%.1x", -__LINE__, 0x0001f56dL, " 1F56D", "%+7.2X", -__LINE__, 0x000000dbL, " DB", "%6.X", -__LINE__, 0xffffffc2L, "ffffffc2", "%x", -__LINE__, 0x00000001L, "001", "%03ld", -__LINE__, 0xffd89f58L, "ffd89f58", "% 0.x", -__LINE__, 0xfe1a72fcL, "fe1a72fc", "%x", -__LINE__, 0xfffff9b6L, "FFFFF9B6", "%X", -__LINE__, 0x00243633L, "243633", "%X", -__LINE__, 0x00821bc7L, "+8526791", "%+#0ld", -__LINE__, 0xfe63f348L, "0XFE63F348", "%#3X", -__LINE__, 0xff729f19L, "ff729f19", "%4x", -__LINE__, 0xffff570fL, "FFFF570F", "%+X", -__LINE__, 0x00a57a42L, "10844738", "%6.3d", -__LINE__, 0xfe4a3ed0L, "FE4A3ED0", "%6.X", -__LINE__, 0x00000000L, "0", "%d", -__LINE__, 0x000001bbL, "01bb", "% .4x", -__LINE__, 0x02b4a1e9L, "2b4a1e9", "%-7.x", -__LINE__, 0x31750683L, "31750683", "%x", -__LINE__, 0x00001cd7L, "7383", "%#ld", -__LINE__, 0x0000079dL, "1949", "%d", -__LINE__, 0xffb8ff3bL, "FFB8FF3B", "%X", -__LINE__, 0x00a768b6L, "0A768B6", "%-6.7X", -__LINE__, 0x1c665b48L, "0X1C665B48", "% #X", -__LINE__, -0x000037dL, "-000893", "%3.6d", -__LINE__, 0x29890443L, "29890443", "%+0x", -__LINE__, 0x000000e5L, "e5 ", "%-4x", -__LINE__, 0xfff2b5faL, "FFF2B5FA", "%X", -__LINE__, -0x5d32c2bL, "-97725483", "%05ld", -__LINE__, -0x00016c5L, " -05829", "%+#7.5ld", -__LINE__, 0x00000644L, "644", "%X", -__LINE__, -0x018c027L, "-1622055", "%+.1d", -__LINE__, 0x0000013cL, "0x13c", "%#x", -__LINE__, 0x00000009L, "+9", "%+#ld", -__LINE__, 0x00000000L, "0", "%ld", -__LINE__, -0x018eb19L, "-1633049", "%4.3ld", -__LINE__, 0xfffff429L, "FFFFF429", "% X", -__LINE__, 0x0032de67L, "32DE67", "%X", -__LINE__, 0x0016bdfaL, " 1490426", "% .2ld", -__LINE__, 0x00000065L, "65", "%+.0X", -__LINE__, 0x00000072L, " 72", "%+4.2X", -__LINE__, 0x00075119L, "75119", "%2x", -__LINE__, 0x000000b8L, "b8", "%x", -__LINE__, 0x000000d0L, "d0", "%x", -__LINE__, 0x000000b9L, "b9", "%x", -__LINE__, 0x003fda9dL, " 4184733", "% #3.d", -__LINE__, 0x00029a24L, "170532", "%4.d", -__LINE__, -0x132a337dL, "-321532797", "% ld", -__LINE__, 0x0000047aL, "0X47A", "%-#X", -__LINE__, 0x00000000L, "0", "%-ld", -__LINE__, -0x0d9750bL, "-14251275", "% ld", -__LINE__, 0x00029d6cL, "29d6c", "%x", -__LINE__, 0xfb060cc0L, "fb060cc0", "%x", -__LINE__, 0xffffd524L, "0XFFFFD524", "%#X", -__LINE__, 0xffffff30L, "ffffff30", "%-5x", -__LINE__, 0x00001650L, "0005712", "%#0.7d", -__LINE__, 0x0000b702L, "0B702", "%03.5X", -__LINE__, 0x000003c1L, "3c1", "% .1x", -__LINE__, -0x0290412L, "-2688018", "%d", -__LINE__, -0x00008bfL, "-2239", "%#d", -__LINE__, -0x0000001L, "-1", "%d", -__LINE__, 0x0001d750L, "1D750", "%-X", -__LINE__, 0x006eee92L, "6EEE92", "%-X", -__LINE__, 0xff812b02L, "ff812b02", "%0x", -__LINE__, 0xfffffeacL, "FFFFFEAC", "%+0X", -__LINE__, 0x000003a5L, "3a5", "%x", -__LINE__, -0x15270ceeL, "-354880750", "%2.ld", -__LINE__, 0x06b686d2L, "6b686d2", "%0x", -__LINE__, 0xffe9cdccL, "ffe9cdcc", "%x", -__LINE__, 0x0ecb168eL, "ecb168e", "%x", -__LINE__, 0x00000051L, "51", "%-X", -__LINE__, -0x0018860L, "-100448", "%-0d", -__LINE__, 0x8f08b82bL, "0x8f08b82b", "%-#.5x", -__LINE__, 0xffffffffL, "ffffffff", "%x", -__LINE__, 0x0000000eL, "e", "%+01x", -__LINE__, 0x04cf15bcL, " 80680380", "% #ld", -__LINE__, 0x50006e8aL, "50006e8a", "%x", -__LINE__, 0x0002f669L, "194153", "%0d", -__LINE__, 0x000000a6L, " 166", "% 5.ld", -__LINE__, -0x04036bbL, "-4208315", "%7.5d", -__LINE__, 0x00070deaL, "70DEA", "%+X", -__LINE__, 0x00000964L, "0x964", "%#x", -__LINE__, 0x0000004dL, "0x4d", "% #3.x", -__LINE__, -0x0000001L, "-1", "%-0d", -__LINE__, 0x0000043eL, "1086", "%ld", -__LINE__, -0x0000001L, "-1", "%-d", -__LINE__, 0x00000000L, "+0", "%+d", -__LINE__, 0xfffe68d9L, "FFFE68D9", "%7.X", -__LINE__, -0x0169199L, "-1479065", "%#.5ld", -__LINE__, -0x000003dL, "-61", "%ld", -__LINE__, 0x00000001L, "+1", "%+.1d", -__LINE__, 0x0001a65dL, "1a65d", "%.5x", -__LINE__, 0x00000141L, "+000321", "%+#5.6ld", -__LINE__, 0x00000000L, " 0", "%4x", -__LINE__, 0x00000408L, "1032", "%-2.3ld", -__LINE__, 0xffffffedL, "FFFFFFED", "%-X", -__LINE__, 0xfe832351L, "FE832351", "% .4X", -__LINE__, 0x003a421bL, "3A421B", "%-X", -__LINE__, -0x53ed7f25L, "-1408073509", "%ld", -__LINE__, -0x0000003L, "-0003", "%-5.4ld", -__LINE__, 0x00000ad0L, " 2768", "%7d", -__LINE__, 0xfffaf30bL, "FFFAF30B", "%X", -__LINE__, 0x006349d3L, " 6506963", "% 6.2ld", -__LINE__, 0x07f0146aL, "7f0146a", "%+3.4x", -__LINE__, -0x0000002L, " -2", "% 3.ld", -__LINE__, -0x26e94f3L, "-40801523", "%-#ld", -__LINE__, -0x0000004L, " -004", "%7.3d", -__LINE__, 0xfffe8cc9L, "FFFE8CC9", "%0X", -__LINE__, 0x00000018L, " 18", "%5.x", -__LINE__, -0x4941de83L, "-1229053571", "% 0.5ld", -__LINE__, 0x00000000L, " 0", "%6ld", -__LINE__, 0xfffffffeL, "0XFFFFFFFE", "%-#X", -__LINE__, -0x0142ae1L, "-1321697", "%4.ld", -__LINE__, -0x0319e7fL, "-3251839", "%0ld", -__LINE__, 0x000004ffL, " 4FF", "%7.2X", -__LINE__, -0x0001c3eL, "-7230", "%#.2ld", -__LINE__, 0xffffe522L, "ffffe522", "%x", -__LINE__, 0x0001d1cbL, "+119243", "%+.3ld", -__LINE__, 0xfad19d52L, "FAD19D52", "%+X", -__LINE__, 0x00002a7cL, " 10876", "% 0.ld", -__LINE__, 0x00001449L, "1449", "%X", -__LINE__, 0x000732b8L, "471736", "%d", -__LINE__, -0x211a496eL, "-555370862", "%ld", -__LINE__, -0x0000004L, "-4", "%1.d", -__LINE__, 0x0295c03dL, "43368509", "%5.ld", -__LINE__, 0x01fa5722L, "33183522", "%0ld", -__LINE__, 0xfffbff62L, "0xfffbff62", "%#x", -__LINE__, 0x000000f5L, " 245", "% 2.d", -__LINE__, 0x000000a0L, "160", "%-d", -__LINE__, 0x0000000fL, "15", "%.2ld", -__LINE__, 0x0bf5f077L, "+200667255", "%+ld", -__LINE__, -0x14d3e5aL, "-21839450", "%#2.3d", -__LINE__, -0x21cbe656L, "-567010902", "%ld", -__LINE__, 0x000002b9L, "697", "%ld", -__LINE__, 0xfffff9b0L, "FFFFF9B0", "%X", -__LINE__, 0x007fd9c7L, "8378823", "%3.4d", -__LINE__, 0x00036d06L, "36d06", "%x", -__LINE__, 0xffde8052L, "FFDE8052", "%4.6X", -__LINE__, 0x0000000dL, "13", "%#d", -__LINE__, 0x68157d93L, "68157d93", "%x", -__LINE__, 0x00000005L, "5", "%1x", -__LINE__, 0xfffffff4L, "FFFFFFF4", "%X", -__LINE__, 0xf5bbf7e9L, "f5bbf7e9", "%+.1x", -__LINE__, 0x0be98f98L, "BE98F98", "%X", -__LINE__, 0x00000122L, "00122", "%.5X", -__LINE__, -0x0000936L, "-2358", "%+#3.0ld", -__LINE__, 0xfd230f09L, "FD230F09", "%-7X", -__LINE__, 0x00000089L, "137", "%ld", -__LINE__, 0x00000078L, " 120", "%7d", -__LINE__, -0x68ef2b6bL, "-1760504683", "%-ld", -__LINE__, 0xc24480bbL, "C24480BB", "%+4X", -__LINE__, 0xfefe36a2L, "FEFE36A2", "%0X", -__LINE__, -0x35344baL, "-55788730", "%7.d", -__LINE__, 0xffffffffL, "FFFFFFFF", "%+.6X", -__LINE__, -0x0000f40L, "-3904", "% ld", -__LINE__, 0xfffffffbL, "FFFFFFFB", "%X", -__LINE__, 0x58b37c4bL, "58b37c4b", "%2.2x", -__LINE__, 0x000000e2L, "226", "%#ld", -__LINE__, 0xfff5ebdeL, "fff5ebde", "%-7.1x", -__LINE__, 0x0c6ea9beL, "208579006", "%-ld", -__LINE__, 0xff708c74L, "FF708C74", "% 4.X", -__LINE__, 0x00000000L, " 0", "% 3X", -__LINE__, 0x00000004L, " 4", "%03.d", -__LINE__, 0x0919be7cL, "+152682108", "%+6.d", -__LINE__, 0x00d4fd1eL, "13958430", "%0d", -__LINE__, 0xfe77a69eL, "fe77a69e", "%-7.x", -__LINE__, 0x284ded44L, "676195652", "%-#2ld", -__LINE__, -0x00006e6L, "-1766", "% ld", -__LINE__, -0x7dac7eaL, "-131778538", "%.0ld", -__LINE__, 0x0003c50fL, "247055", "%#d", -__LINE__, 0xfffffffcL, "fffffffc", "%-x", -__LINE__, 0xfe0f0d1fL, "fe0f0d1f", "% 5.1x", -__LINE__, 0x00000009L, "9", "%0ld", -__LINE__, -0x0175cc1L, "-1531073", "%-04.d", -__LINE__, 0x000e4da2L, " 937378", "% 4.ld", -__LINE__, 0x00000762L, "762", "%-0.X", -__LINE__, 0x005211bfL, "5211bf", "%-x", -__LINE__, 0xfffffffbL, "fffffffb", "%+2.6x", -__LINE__, 0x00008862L, "34914", "%ld", -__LINE__, 0xfffc9754L, "fffc9754", "%+x", -__LINE__, 0x0000716eL, "716E", "%X", -__LINE__, 0x000000a8L, "a8", "%x", -__LINE__, 0xffff84f5L, "ffff84f5", "%0x", -__LINE__, 0x00005032L, "5032", "%x", -__LINE__, 0xffe242b4L, "ffe242b4", "%6x", -__LINE__, 0x002df9bdL, "3013053", "%ld", -__LINE__, 0xffffe267L, "FFFFE267", "%.5X", -__LINE__, 0xffffffc7L, "0xffffffc7", "%#x", -__LINE__, -0x1727c38L, "-24280120", "%d", -__LINE__, 0x01308072L, "1308072", "%x", -__LINE__, -0x5883c7cL, "-92814460", "%+ld", -__LINE__, 0x000030adL, "30ad", "%x", -__LINE__, 0xffffffffL, "FFFFFFFF", "%X", -__LINE__, -0x2090a708L, "-546350856", "% d", -__LINE__, 0x0024e6b4L, "2418356", "%#ld", -__LINE__, 0x02db71acL, "2DB71AC", "% 6.3X", -__LINE__, 0xfffffffcL, "FFFFFFFC", "%2.7X", -__LINE__, -0x000074eL, " -1870", "%7.ld", -__LINE__, -0x0011d84L, "-73092", "%d", -__LINE__, 0x00160723L, "160723", "%1.3x", -__LINE__, 0x00412929L, "4270377", "%-d", -__LINE__, -0x0008fc6L, "-36806", "% d", -__LINE__, 0x00000002L, "2", "%d", -__LINE__, 0x0eb67ffaL, "eb67ffa", "%.4x", -__LINE__, 0x05b86c3cL, "95972412", "%4.4d", -__LINE__, 0xffffca9cL, "FFFFCA9C", "% 4.X", -__LINE__, 0x0007d571L, "7d571", "%-0x", -__LINE__, -0x000239bL, "-09115", "%5.5d", -__LINE__, -0x0000155L, " -341", "%5.3ld", -__LINE__, 0x00000034L, "34", "%x", -__LINE__, -0x0000051L, "-81", "%.1ld", -__LINE__, 0x309bbbe0L, "309bbbe0", "%x", -__LINE__, 0x0075be1eL, " 7716382", "% #ld", -__LINE__, 0x000002d5L, "2d5", "%x", -__LINE__, 0x006b466dL, "6B466D", "%-0X", -__LINE__, 0x01d6c30fL, "1D6C30F", "%4.X", -__LINE__, 0x00000003L, " 3", "%07.x", -__LINE__, 0xfffcc102L, "FFFCC102", "%6.X", -__LINE__, 0xffffffffL, "0XFFFFFFFF", "%#X", -__LINE__, 0xfffffffeL, "fffffffe", "%+x", -__LINE__, 0x00000005L, "5", "%ld", -__LINE__, 0xff060284L, "ff060284", "%x", -__LINE__, 0x007a3325L, "7A3325", "%-X", -__LINE__, 0xf5f595bdL, "F5F595BD", "%0X", -__LINE__, 0xfffa3a10L, "FFFA3A10", "%0X", -__LINE__, 0x00000000L, "0", "%x", -__LINE__, -0x15078f9L, "-22051065", "%7d", -__LINE__, -0x0000002L, "-000002", "%.6d", -__LINE__, 0x00000036L, "54", "%1.1ld", -__LINE__, -0xbbecf6aL, "-197054314", "%ld", -__LINE__, 0x0000043dL, "43D", "%X", -__LINE__, 0xfffffffaL, "0xfffffffa", "% #6.x", -__LINE__, 0x016759f8L, "23550456", "%0.ld", -__LINE__, 0x000052d2L, "+21202", "%+6.2d", -__LINE__, -0x007d232L, "-512562", "%ld", -__LINE__, 0x00240be0L, "2362336", "%.1d", -__LINE__, -0x0000001L, "-1", "%0d", -__LINE__, 0xfffffffaL, "FFFFFFFA", "%X", -__LINE__, -0x0000e88L, "-3720", "%ld", -__LINE__, 0xfffffa9bL, "FFFFFA9B", "%.5X", -__LINE__, 0x09296eebL, "153710315", "%-1.0d", -__LINE__, 0x001f46fcL, "0X1F46FC", "%#X", -__LINE__, 0x00000006L, "6", "%X", -__LINE__, 0xffffff87L, "0XFFFFFF87", "%+#X", -__LINE__, 0x00000469L, "0469", "%04X", -__LINE__, -0x0000001L, "-1", "%ld", -__LINE__, 0x00000000L, "", "%.0ld", -__LINE__, -0x52bc137L, "-86753591", "%-#3ld", -__LINE__, -0x2bddb08L, "-45996808", "%-3.d", -__LINE__, 0x041367f7L, "41367F7", "%+X", -__LINE__, -0x0018eb5L, "-102069", "%+ld", -__LINE__, -0x0000537L, "-1335", "%#ld", -__LINE__, -0x6f159ff4L, "-1863688180", "%+1.d", -__LINE__, 0x00112ac8L, "0X112AC8", "%#6.3X", -__LINE__, 0x00000000L, " ", "%3.d", -__LINE__, 0x0008afe8L, "08afe8", "%+3.6x", -__LINE__, 0x00000015L, "21", "%ld", -__LINE__, -0x02b7130L, "-2847024", "% #2.4d", -__LINE__, 0xffffffd0L, "FFFFFFD0", "%X", -__LINE__, -0x6970fa1L, "-110563233", "%+#.4ld", -__LINE__, 0x06387dccL, "0X6387DCC", "%-#X", -__LINE__, 0xffffd506L, "ffffd506", "%+6x", -__LINE__, -0x00fe5cdL, "-1041869", "%-#7d", -__LINE__, -0x0c35bf6L, "-12803062", "%-03d", -__LINE__, -0x0020d89L, "-134537", "%#d", -__LINE__, -0x0c7aed3L, "-13086419", "%-ld", -__LINE__, -0x000362aL, "-13866", "%#.4ld", -__LINE__, -0x02d05f0L, "-2950640", "%#ld", -__LINE__, 0x02de1321L, "0x2de1321", "%#7.x", -__LINE__, 0xffb56428L, "0xffb56428", "%#x", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%X", -__LINE__, 0xf072292dL, "F072292D", "%.5X", -__LINE__, -0x0f4b0f2L, "-16036082", "%.5ld", -__LINE__, 0x01b81885L, "28842117", "%5d", -__LINE__, -0x009cfa6L, "-642982", "%d", -__LINE__, 0xfffffffdL, "0XFFFFFFFD", "%-#.5X", -__LINE__, 0x0dc97a66L, "DC97A66", "%2.X", -__LINE__, 0x000000beL, "190", "%.0d", -__LINE__, 0xffffe1c7L, "FFFFE1C7", "% X", -__LINE__, 0x01883b9aL, "1883b9a", "%3x", -__LINE__, 0xffffdde1L, "ffffdde1", "%+x", -__LINE__, 0x2f1b4e32L, "+790318642", "%+ld", -__LINE__, 0x000129aaL, "129aa", "%x", -__LINE__, -0x00092c2L, "-37570", "%d", -__LINE__, 0x00070fbdL, "70fbd", "%x", -__LINE__, -0x00000eaL, "-234", "%+4ld", -__LINE__, 0xfffffffeL, "fffffffe", "%x", -__LINE__, 0x0091c7f7L, "91C7F7", "% .3X", -__LINE__, -0x0c14fe2L, "-12668898", "%d", -__LINE__, -0x0017c15L, "-97301", "%d", -__LINE__, -0x00005d0L, "-0001488", "%5.7d", -__LINE__, 0x0114c36eL, "18137966", "%0d", -__LINE__, 0xffffffffL, "ffffffff", "%+x", -__LINE__, 0x0ac76e78L, "180842104", "%d", -__LINE__, 0x001976cdL, " 1668813", "% 4.ld", -__LINE__, -0x0642319L, "-6562585", "% d", -__LINE__, 0xffffffffL, "FFFFFFFF", "%X", -__LINE__, -0x035019dL, "-3473821", "%.7d", -__LINE__, -0x0000061L, "-97", "%#3.d", -__LINE__, 0x0000001fL, " 31", "% 6.1ld", -__LINE__, -0x0000024L, "-36", "%d", -__LINE__, 0x000b3785L, "735109", "%ld", -__LINE__, 0xfffffda9L, "fffffda9", "%-x", -__LINE__, 0x00254832L, "2443314", "%-ld", -__LINE__, 0xfffffd40L, "FFFFFD40", "%0X", -__LINE__, -0x0006105L, "-24837", "%+#d", -__LINE__, 0x00000006L, "+6", "%+d", -__LINE__, 0xffd40fd8L, "ffd40fd8", "%3.x", -__LINE__, -0x000988eL, "-39054", "%03d", -__LINE__, 0x0005ad8bL, "5AD8B", "%0.0X", -__LINE__, 0x00000001L, "1", "%d", -__LINE__, 0xfe1f59b7L, "fe1f59b7", "%4.x", -__LINE__, -0x0000022L, "-34", "%#d", -__LINE__, 0x0018e3e9L, "18E3E9", "% X", -__LINE__, 0xffffff25L, "FFFFFF25", "%2.X", -__LINE__, -0x00002c6L, "-710", "%1.ld", -__LINE__, 0x00009765L, "38757", "%5ld", -__LINE__, 0xfe197646L, "FE197646", "%-X", -__LINE__, 0x00000001L, " 1", "%+5.x", -__LINE__, -0x0000002L, "-2", "%#ld", -__LINE__, 0x0072f6beL, "72F6BE", "%1X", -__LINE__, -0x000f06dL, "-61549", "%-d", -__LINE__, 0x00000001L, " 1", "%5X", -__LINE__, 0x328cba28L, " 848083496", "% 2.ld", -__LINE__, 0x0000cddcL, "cddc", "%.1x", -__LINE__, 0xfffffff9L, "fffffff9", "%7x", -__LINE__, 0x00baf511L, "BAF511", "%-5.6X", -__LINE__, 0x00000001L, " 1", "%4.ld", -__LINE__, 0x0001e4b0L, "+124080", "%+ld", -__LINE__, -0x07548f3L, "-7686387", "% 6.d", -__LINE__, -0x01b14eaL, "-1774826", "% #0d", -__LINE__, -0x000005cL, "-92 ", "%-04ld", -__LINE__, -0x00000aeL, "-174", "%+.3ld", -__LINE__, 0x0000008cL, "0X8C", "%+#X", -__LINE__, 0x14c02360L, "14C02360", "%.6X", -__LINE__, 0xfffffff6L, "FFFFFFF6", "%X", -__LINE__, 0x009f4ee5L, "9f4ee5", "%x", -__LINE__, 0x00000035L, "35", "%X", -__LINE__, -0x00000ebL, "-235", "%ld", -__LINE__, 0x1552ced8L, "1552CED8", "%04X", -__LINE__, 0x0000002aL, " 2A", "%5X", -__LINE__, 0xffffffffL, "ffffffff", "% x", -__LINE__, -0xdec0db2L, "-233573810", "%d", -__LINE__, 0x001e2ef0L, "1978096", "%2.d", -__LINE__, 0xffffef24L, "ffffef24", "%.5x", -__LINE__, 0xfffe6a6cL, "fffe6a6c", "%+x", -__LINE__, -0x0000004L, "-4", "% ld", -__LINE__, 0xfe3c6743L, "fe3c6743", "%.1x", -__LINE__, 0x0000033dL, "829", "%0ld", -__LINE__, -0x00006a0L, " -1696", "% 7.ld", -__LINE__, 0xffffffdbL, "ffffffdb", "%0.0x", -__LINE__, 0xfffffffcL, "FFFFFFFC", "%3.3X", -__LINE__, -0x0000004L, "-4", "%#ld", -__LINE__, 0x00b32b56L, "B32B56", "%X", -__LINE__, 0xffffffffL, "0xffffffff", "%+#x", -__LINE__, 0x01cd1a48L, "1cd1a48", "%+7x", -__LINE__, 0xffffffdaL, "ffffffda", "%x", -__LINE__, 0x1886509eL, "1886509E", "% X", -__LINE__, 0x000000ebL, "235", "%0d", -__LINE__, 0xfffffff4L, "fffffff4", "%0x", -__LINE__, 0x00000547L, "547", "% X", -__LINE__, 0x000017e6L, "17e6", "%-2.x", -__LINE__, 0x00001dc4L, "7620", "%d", -__LINE__, 0xffffffffL, "FFFFFFFF", "%3.0X", -__LINE__, 0xffff93faL, "0XFFFF93FA", "%#X", -__LINE__, 0xfffffe1cL, "FFFFFE1C", "%-X", -__LINE__, 0x00000000L, "", "% .0x", -__LINE__, 0x000000a1L, "A1", "%X", -__LINE__, 0xffffffffL, "0xffffffff", "%#x", -__LINE__, -0x0001460L, "-05216", "%+#.5d", -__LINE__, 0x00000001L, "1 ", "%-6.x", -__LINE__, 0xfffd5324L, "FFFD5324", "%+2.6X", -__LINE__, 0x00000007L, " 07", "%06.2d", -__LINE__, 0x00000003L, "3", "%-X", -__LINE__, 0xfffffdb7L, "0XFFFFFDB7", "%+#X", -__LINE__, 0xfffff4ccL, "fffff4cc", "%0x", -__LINE__, 0x00000000L, "0 ", "%-5X", -__LINE__, 0x00758c96L, "758C96", "%X", -__LINE__, -0x0000001L, "-1", "%-ld", -__LINE__, 0x00000001L, "1", "%ld", -__LINE__, 0x03f03cafL, "66075823", "%.2ld", -__LINE__, 0x0000a87cL, "a87c", "%1.x", -__LINE__, 0x00000034L, "34", "%X", -__LINE__, 0x00000000L, "0", "%x", -__LINE__, 0x00010167L, "10167", "%x", -__LINE__, -0x00007ceL, "-1998 ", "%-6ld", -__LINE__, 0x00000001L, "1", "%.0d", -__LINE__, 0x00d94ceeL, "14241006", "%ld", -__LINE__, -0x0000008L, "-8", "% d", -__LINE__, -0x71520839L, "-1901201465", "%+0d", -__LINE__, 0x0000035aL, "35a", "%-x", -__LINE__, 0xfffd2f68L, "FFFD2F68", "%-X", -__LINE__, 0x0006ea53L, "453203", "%1d", -__LINE__, 0x000000dfL, "DF", "% 1X", -__LINE__, 0xfffffffeL, "fffffffe", "% 7x", -__LINE__, 0x00000156L, "156", "% X", -__LINE__, 0x00037ac9L, " 228041", "% ld", -__LINE__, 0xffffffdeL, "FFFFFFDE", "%0.5X", -__LINE__, 0x00000025L, "37", "%-0.ld", -__LINE__, -0x4133686L, "-68368006", "%2ld", -__LINE__, -0x000003bL, "-59", "%.2ld", -__LINE__, 0xfffff910L, "fffff910", "% 00.0x", -__LINE__, 0xff9ec802L, "FF9EC802", "%2.6X", -__LINE__, 0x00000008L, "0X8", "%#1X", -__LINE__, 0xfffffff7L, "FFFFFFF7", "%-X", -__LINE__, 0x0029a4daL, "2729178", "%04.ld", -__LINE__, 0x007d1588L, "8197512", "%#d", -__LINE__, 0x0007e86dL, "518253", "%0d", -__LINE__, 0xfffffff9L, "fffffff9", "%x", -__LINE__, 0x00000002L, "002", "%.3d", -__LINE__, 0x00006ec1L, "6EC1", "%2X", -__LINE__, 0x0000300cL, "12300", "%-d", -__LINE__, -0x0000002L, "-2", "%+ld", -__LINE__, -0x0000002L, "-2", "%ld", -__LINE__, -0x00015d5L, "-005589", "%#.6ld", -__LINE__, 0x00000041L, "65", "%d", -__LINE__, 0x00000229L, "0000229", "% 0.7x", -__LINE__, 0xfffffffbL, "fffffffb", "%03.x", -__LINE__, 0x00093262L, "0602722", "%.7d", -__LINE__, -0x00037b4L, "-14260", "%-0ld", -__LINE__, 0xfffffffcL, "fffffffc", "%-x", -__LINE__, 0xf24cb3e6L, "f24cb3e6", "%1x", -__LINE__, 0x00000000L, "0", "%x", -__LINE__, 0xfffffffbL, "FFFFFFFB", "%0X", -__LINE__, 0x00000031L, "0000049", "%00.7ld", -__LINE__, 0x00000bb3L, "BB3", "%.1X", -__LINE__, -0x0000001L, "-0001", "%+#4.4ld", -__LINE__, -0x0000001L, "-1", "% d", -__LINE__, 0x00022c0cL, "22c0c", "%-x", -__LINE__, 0xffffffd4L, "ffffffd4", "%x", -__LINE__, 0x000729c6L, "469446", "%3.d", -__LINE__, 0xb180feaeL, "b180feae", "%3.x", -__LINE__, 0x124fac15L, "307211285", "%-0ld", -__LINE__, -0x0000004L, "-4", "%ld", -__LINE__, 0x0000006aL, "106", "%#d", -__LINE__, 0x0000297fL, "297F", "%+3X", -__LINE__, 0x0000000eL, "14", "%0ld", -__LINE__, 0x00000027L, "27", "%0.1X", -__LINE__, 0xffeb98ebL, "ffeb98eb", "% 05.2x", -__LINE__, 0xfffff19bL, "FFFFF19B", "%+X", -__LINE__, 0x00025992L, "154002", "%6.6d", -__LINE__, 0x00000040L, " 040", "%6.3X", -__LINE__, 0x00000a9eL, " 0a9e", "%5.4x", -__LINE__, 0x00c7f2ccL, "c7f2cc", "%x", -__LINE__, 0x000325e6L, " 325E6", "%6.X", -__LINE__, -0x69faad3L, "-111127251", "%d", -__LINE__, -0x059a307L, "-5874439", "% ld", -__LINE__, 0xfffffff6L, "0xfffffff6", "%#0.0x", -__LINE__, 0x0030fdf3L, "30fdf3", "%x", -__LINE__, 0x00007343L, "+29507", "%+#2d", -__LINE__, 0x0003cf4bL, "0X3CF4B", "% #.2X", -__LINE__, 0x00000433L, "+1075", "%+0ld", -__LINE__, 0xfffffffdL, "fffffffd", "%+.3x", -__LINE__, 0x0ae30c4eL, "ae30c4e", "%+00x", -__LINE__, 0x0002540fL, "02540f", "%-.6x", -__LINE__, -0x0000001L, " -01", "% #5.2ld", -__LINE__, 0xffffffe7L, "0xffffffe7", "% #5.x", -__LINE__, 0x0000005bL, "91", "%d", -__LINE__, 0x00001f9bL, "8091", "%.4ld", -__LINE__, 0xfffff315L, "fffff315", "%4.x", -__LINE__, -0x130eec41L, "-319745089", "% ld", -__LINE__, 0xfff8fe13L, "FFF8FE13", "%X", -__LINE__, -0x0000004L, "-00004", "%5.5d", -__LINE__, 0x00000669L, "669", "%0X", -__LINE__, -0x0000004L, "-4", "%d", -__LINE__, 0xf5e81496L, "F5E81496", "% 6X", -__LINE__, -0x0000001L, "-1", "% 0d", -__LINE__, 0xfffffff7L, "fffffff7", "%x", -__LINE__, 0x000001deL, "478", "%d", -__LINE__, 0x0000623eL, "25150", "%5.0d", -__LINE__, 0xffffffa8L, "FFFFFFA8", "%+X", -__LINE__, -0x0000117L, "-279", "% ld", -__LINE__, -0x0000517L, "-1303", "%d", -__LINE__, 0xfffff9d5L, "fffff9d5", "% x", -__LINE__, 0x000001ccL, "1CC", "%-X", -__LINE__, 0x0000019aL, "0000410", "%.7d", -__LINE__, 0x00000003L, "3 ", "%-06X", -__LINE__, 0x00000009L, "0x9", "%#0x", -__LINE__, 0xfd544610L, "0XFD544610", "% #X", -__LINE__, 0xfffffffcL, "fffffffc", "%+x", -__LINE__, 0x00009437L, "37943", "%ld", -__LINE__, -0x00b5ea6L, "-745126", "%d", -__LINE__, 0xffffffd8L, "ffffffd8", "%6x", -__LINE__, 0x00002a2dL, "10797", "%.3ld", -__LINE__, 0x00275238L, "2576952", "%0ld", -__LINE__, 0xfff90a34L, "FFF90A34", "%-7X", -__LINE__, 0xfffffffeL, "FFFFFFFE", "% .7X", -__LINE__, -0xb3b673eL, "-188442430", "% ld", -__LINE__, 0xfffff67aL, "0xfffff67a", "%#0.x", -__LINE__, 0x0000dff6L, " dff6", "%+7.x", -__LINE__, 0xffee46e3L, "ffee46e3", "%x", -__LINE__, 0x00001a66L, " 0006758", "% 7.7d", -__LINE__, 0x0002b475L, "2B475", "%.4X", -__LINE__, 0x0002090dL, "002090d", "%.7x", -__LINE__, -0x0057838L, "-358456", "%#ld", -__LINE__, 0x00000004L, "0x4", "%#x", -__LINE__, 0x0574cb62L, "91540322", "%#7d", -__LINE__, -0x0054388L, "-344968", "% #d", -__LINE__, 0x000421c2L, "421C2", "% X", -__LINE__, 0x00000003L, "3", "%0d", -__LINE__, 0xffffe2e2L, "ffffe2e2", "% 5.x", -__LINE__, 0x00000021L, "+33", "%+d", -__LINE__, -0x0020033L, "-131123", "%ld", -__LINE__, -0x0000001L, " -1", "%4.ld", -__LINE__, 0x000000fdL, "000fd", "%3.5x", -__LINE__, 0x023e4337L, "37634871", "%1d", -__LINE__, 0x6e823d96L, "6E823D96", "% X", -__LINE__, 0xfff0e133L, "fff0e133", "%x", -__LINE__, -0x000deccL, "-57036", "%3d", -__LINE__, 0x004397b8L, "4429752", "%0d", -__LINE__, -0x0000023L, " -35", "%6d", -__LINE__, 0xffe701caL, "FFE701CA", "%3X", -__LINE__, 0x000c0319L, "+787225", "%+.6d", -__LINE__, 0x00000000L, "0", "%x", -__LINE__, 0xfffffe1dL, "FFFFFE1D", "%X", -__LINE__, 0xfffffb33L, "fffffb33", "%x", -__LINE__, 0x02b5e30aL, "45474570", "%d", -__LINE__, 0x000074ebL, "29931", "%03.ld", -__LINE__, -0x4e42e310L, "-1313006352", "%-0.d", -__LINE__, -0x000007bL, "-123", "%d", -__LINE__, 0x00000160L, " 352", "% d", -__LINE__, -0x16af31ecL, "-380580332", "%#ld", -__LINE__, -0x000006eL, "-000110", "%07ld", -__LINE__, 0x232699a0L, "232699a0", "%7.x", -__LINE__, 0x00f9b8e5L, "+16365797", "%+0d", -__LINE__, 0x0000000cL, "C", "%X", -__LINE__, 0xfffffd4fL, "FFFFFD4F", "%X", -__LINE__, 0xffffe7bbL, "FFFFE7BB", "%.7X", -__LINE__, -0x0000163L, "-355", "%d", -__LINE__, 0x00070315L, " 459541", "% #2.d", -__LINE__, -0x7d5c12aL, "-131449130", "% 6.ld", -__LINE__, 0xffffffb2L, "FFFFFFB2", "%X", -__LINE__, -0x0004aadL, "-19117", "%+6.4ld", -__LINE__, 0x00115586L, "1136006", "%0d", -__LINE__, -0x0000021L, "-33", "%d", -__LINE__, 0x093ce01eL, "93ce01e", "% 5x", -__LINE__, 0x00672135L, "672135", "% x", -__LINE__, 0x05f4abd5L, "0x5f4abd5", "%+#6.x", -__LINE__, -0x0448b03L, "-4492035", "%-0.2ld", -__LINE__, 0x00000000L, "0", "%#x", -__LINE__, 0x1987217eL, "428286334", "%d", -__LINE__, 0x000010f6L, "10f6", "%-x", -__LINE__, 0x0000177aL, "177a", "%1x", -__LINE__, 0xfffffefdL, "FFFFFEFD", "%7X", -__LINE__, -0x095cbf8L, "-9817080", "%-5ld", -__LINE__, 0x0000008aL, "138", "%2.0ld", -__LINE__, 0xfffe80adL, "fffe80ad", "%0x", -__LINE__, -0x1a4c8f7L, "-27576567", "%d", -__LINE__, 0x00000000L, "0", "%-x", -__LINE__, 0x0000a82bL, "43051", "%-ld", -__LINE__, 0x000000ebL, "235", "%2.3ld", -__LINE__, -0x0002747L, "-10055", "%d", -__LINE__, 0x00000319L, "0X319", "%#X", -__LINE__, 0xfffffcfeL, "FFFFFCFE", "% X", -__LINE__, 0x00050f0eL, "50f0e", "%-1x", -__LINE__, -0x398e09eL, "-60350622", "%0.7ld", -__LINE__, 0x00000000L, " ", "%2.ld", -__LINE__, 0x00000049L, "00049", "% .5X", -__LINE__, -0x00000ddL, " -221", "%+#5ld", -__LINE__, 0xf6db2facL, "f6db2fac", "%-07x", -__LINE__, 0x0000004fL, "4F", "% .0X", -__LINE__, 0x00000000L, "0", "%x", -__LINE__, 0xfd07f692L, "fd07f692", "%x", -__LINE__, 0xdb98bde0L, "db98bde0", "%x", -__LINE__, 0x00000271L, "0271", "% 3.4x", -__LINE__, -0x000115aL, "-4442", "%#1.ld", -__LINE__, 0x0002f5f2L, "194034", "%ld", -__LINE__, -0x0000152L, " -338", "%+7ld", -__LINE__, 0x00059336L, "365366", "%d", -__LINE__, 0xfffffff6L, "fffffff6", "%-7x", -__LINE__, 0xfb916c51L, "fb916c51", "%-x", -__LINE__, 0xffff413dL, "FFFF413D", "%-X", -__LINE__, 0xf2576910L, "F2576910", "%-4.X", -__LINE__, 0xfffc7730L, "fffc7730", "%5.x", -__LINE__, 0x000002e6L, "+742", "%+1d", -__LINE__, -0x00001bfL, "-447", "%3d", -__LINE__, 0x000002e1L, "2E1", "%-X", -__LINE__, 0x00000096L, "150", "%#0ld", -__LINE__, 0x000002bdL, "701", "%d", -__LINE__, -0x0053386L, "-340870", "%#d", -__LINE__, 0xfffdb076L, "FFFDB076", "%X", -__LINE__, 0x00004dc5L, " +19909", "%+07.ld", -__LINE__, 0x00000f7aL, " F7A", "%4X", -__LINE__, 0x02405000L, " 37769216", "% ld", -__LINE__, 0xfffce68dL, "fffce68d", "%0x", -__LINE__, -0x35b3af2L, "-56310514", "%-ld", -__LINE__, -0x0238631L, "-2328113", "%.4d", -__LINE__, -0x000001eL, "-030", "%.3ld", -__LINE__, 0xffffffddL, "FFFFFFDD", "%.4X", -__LINE__, 0x0013f6acL, "13f6ac", "%02.x", -__LINE__, 0xfffffffaL, "fffffffa", "%+07.x", -__LINE__, -0x000192bL, " -6443", "%6.d", -__LINE__, 0x0000058bL, "+1419", "%+d", -__LINE__, 0x00001391L, "5009", "%ld", -__LINE__, -0x0041a57L, "-268887", "%1ld", -__LINE__, 0xfffff266L, "0xfffff266", "%+#6.6x", -__LINE__, 0x0000018bL, " 395", "%6.ld", -__LINE__, 0x009ae24dL, "+10150477", "%+ld", -__LINE__, 0x0000007eL, "7E", "%X", -__LINE__, 0xfffffd53L, "FFFFFD53", "% 0X", -__LINE__, 0x000002faL, "2FA", "%-1.3X", -__LINE__, 0x000000a4L, "164", "%0d", -__LINE__, 0x00001833L, "6195", "%ld", -__LINE__, -0x0000001L, "-1", "%d", -__LINE__, 0xf2fcbd9bL, "F2FCBD9B", "%+0.2X", -__LINE__, 0x00004a8aL, "4A8A", "%X", -__LINE__, -0x10695cdaL, "-275340506", "%d", -__LINE__, 0x00000037L, "37", "%X", -__LINE__, 0x00082d5cL, "82D5C", "%+0.5X", -__LINE__, 0xfffffe01L, "fffffe01", "% 5.3x", -__LINE__, 0x000005eaL, "05EA", "% 1.4X", -__LINE__, 0x0e0b8826L, "e0b8826", "%2x", -__LINE__, -0x0000161L, "-353", "%+d", -__LINE__, 0x19e3014aL, "19E3014A", "%+5X", -__LINE__, 0x00000140L, "140", "%x", -__LINE__, 0xffff84b9L, "FFFF84B9", "%X", -__LINE__, -0x0005776L, "-22390", "%+5ld", -__LINE__, 0x0162ad61L, "162AD61", "% X", -__LINE__, 0x00002395L, "2395", "%X", -__LINE__, 0x003702ecL, "3605228", "%5.2d", -__LINE__, 0xffffffffL, "FFFFFFFF", "%7X", -__LINE__, 0x00001778L, "0x1778", "%#5.x", -__LINE__, 0xc52bef7fL, "C52BEF7F", "%X", -__LINE__, 0xfffffec4L, "FFFFFEC4", "%X", -__LINE__, 0x00000006L, "6", "%X", -__LINE__, 0x00000000L, "000", "%03.3x", -__LINE__, 0x00000000L, "0", "%x", -__LINE__, 0xffff6c46L, "FFFF6C46", "% 2.2X", -__LINE__, -0x1506098L, "-22044824", "%01.d", -__LINE__, 0x03415cafL, "3415caf", "%x", -__LINE__, -0x00007b4L, "-1972", "%#4.4d", -__LINE__, -0x00158c9L, "-88265", "%03.4d", -__LINE__, 0x6947c336L, "1766310710", "%.6d", -__LINE__, 0x0000017cL, "17C", "% 0X", -__LINE__, -0x00001b7L, "-439", "% 0ld", -__LINE__, 0x06a7575aL, "6A7575A", "%-.0X", -__LINE__, 0x000b3459L, "734297", "%ld", -__LINE__, -0x395d8ddL, "-60152029", "%ld", -__LINE__, 0x00036bb3L, "224179", "%-6.d", -__LINE__, 0xffff14ffL, "FFFF14FF", "%X", -__LINE__, -0x15910e4fL, "-361827919", "%-0d", -__LINE__, -0x0000004L, "-4", "%#d", -__LINE__, 0xf7f7adacL, "F7F7ADAC", "% 3.X", -__LINE__, 0xffffff74L, "FFFFFF74", "%0X", -__LINE__, 0x00000000L, "0", "%d", -__LINE__, -0x000007bL, "-123 ", "%-7.d", -__LINE__, -0x000002cL, "-44", "%d", -__LINE__, -0x000002bL, " -43", "%5d", -__LINE__, 0x0000ae5fL, "44639", "%d", -__LINE__, 0x003cbc63L, "3CBC63", "%X", -__LINE__, 0xfffffffcL, "0XFFFFFFFC", "%#5.7X", -__LINE__, 0x0003e044L, "3E044", "%X", -__LINE__, -0x0000c46L, "-3142", "%.1d", -__LINE__, 0xff18f4bbL, "FF18F4BB", "%0X", -__LINE__, 0xfffffffdL, "FFFFFFFD", "%.1X", -__LINE__, -0x01c0f27L, "-1838887", "%0d", -__LINE__, -0x1242901fL, "-306352159", "%.4ld", -__LINE__, 0x1775c10aL, "393593098", "%6.ld", -__LINE__, 0x00000001L, " 1", "%03.d", -__LINE__, 0xfff1fd30L, "0xfff1fd30", "%#x", -__LINE__, 0x00000191L, "191", "%0.X", -__LINE__, 0x2e597178L, "777613688", "%2.ld", -__LINE__, -0x4ef0cf3L, "-82775283", "%+.6ld", -__LINE__, -0x0000085L, " -133", "%6.d", -__LINE__, 0x0000014dL, "333 ", "%-5ld", -__LINE__, -0xc03bd74L, "-201571700", "%07.6ld", -__LINE__, -0x000000aL, "-10", "%d", -__LINE__, 0x01f5e86eL, "32893038", "%#2.ld", -__LINE__, 0x00000033L, "0X33", "% #X", -__LINE__, 0x0087c797L, " 8898455", "% 7.d", -__LINE__, -0x0001205L, "-4613", "%5d", -__LINE__, 0x00000192L, " 192", "%7.X", -__LINE__, 0x000e6c00L, "945152", "%6.1ld", -__LINE__, 0x00018629L, " 99881", "% d", -__LINE__, -0x04739c6L, "-4667846", "%-01.3ld", -__LINE__, 0x00001f42L, "8002", "%d", -__LINE__, 0x00000cafL, "3247", "%d", -__LINE__, -0x4992e24L, "-77147684", "%#.6d", -__LINE__, 0x0000001dL, "1d", "%-0x", -__LINE__, 0x14d79f03L, "349675267", "%0ld", -__LINE__, 0x00000dd4L, " 03540", "%#6.5ld", -__LINE__, 0x0005f30eL, "0X5F30E", "%#X", -__LINE__, 0x00000157L, "157", "%X", -__LINE__, -0x9281698L, "-153622168", "%d", -__LINE__, -0x000004aL, "-74", "%d", -__LINE__, -0x0010c9eL, "-68766", "%-0d", -__LINE__, 0x00000059L, "00089", "%.5ld", -__LINE__, -0x06959e3L, "-6904291", "% 4.d", -__LINE__, 0xfbea12b1L, "0XFBEA12B1", "%+#X", -__LINE__, 0xffffdfb1L, "FFFFDFB1", "%2.6X", -__LINE__, 0x0434faacL, "434faac", "%.5x", -__LINE__, 0xffffffffL, "ffffffff", "% x", -__LINE__, 0x00000b32L, "B32", "%0X", -__LINE__, 0x00000047L, "71", "%.1d", -__LINE__, 0x00070befL, " 0461807", "% .7d", -__LINE__, 0x00000038L, "38", "% 0x", -__LINE__, 0x00000000L, " 0", "%6X", -__LINE__, 0xfff9c011L, "FFF9C011", "%2X", -__LINE__, 0xfffffffeL, "fffffffe", "%7x", -__LINE__, 0xfffffff9L, "FFFFFFF9", "%X", -__LINE__, -0x016a095L, "-1482901", "%4.0ld", -__LINE__, -0x000001cL, "-28", "% ld", -__LINE__, 0xfffd6133L, "0xfffd6133", "%#x", -__LINE__, 0x000004a4L, "0x4a4", "%#x", -__LINE__, 0x000003c2L, "0962", "%.4d", -__LINE__, -0x000323bL, "-12859", "%+#d", -__LINE__, 0x0f620237L, "F620237", "%X", -__LINE__, 0x00007863L, "007863", "%.6X", -__LINE__, 0x0000002cL, " 44", "% #ld", -__LINE__, 0xfffffff0L, "fffffff0", "%03.6x", -__LINE__, 0xffff6346L, "FFFF6346", "%1.X", -__LINE__, 0x00063188L, "63188", "% x", -__LINE__, 0xfffff91cL, "fffff91c", "%-.3x", -__LINE__, 0x004cd0b4L, "4CD0B4", "%-2.X", -__LINE__, 0x06b4d739L, "112514873", "%0.1d", -__LINE__, -0x0009bebL, "-39915", "%.2d", -__LINE__, 0x0000831bL, "33563", "%d", -__LINE__, 0x00000001L, "1", "%X", -__LINE__, -0x942d76bL, "-155375467", "% #0ld", -__LINE__, 0xffff2a95L, "FFFF2A95", "%2X", -__LINE__, 0x00548d5eL, "5541214", "%.3ld", -__LINE__, 0x0b5e1a01L, "B5E1A01", "% .7X", -__LINE__, 0xfffffc22L, "fffffc22", "%6x", -__LINE__, -0x0000dd7L, "-3543", "%-.3ld", -__LINE__, 0xfffff834L, "FFFFF834", "%X", -__LINE__, 0x0365f762L, "57014114", "%ld", -__LINE__, -0x0000003L, "-3", "%d", -__LINE__, 0x3bd998a3L, "1004116131", "%d", -__LINE__, 0xfffff6c9L, "FFFFF6C9", "%+X", -__LINE__, 0xffffded9L, "FFFFDED9", "%-.1X", -__LINE__, -0x00fbb5aL, "-1031002", "% 1.0d", -__LINE__, 0xffffffb7L, "ffffffb7", "%6.x", -__LINE__, 0xff1b8ac3L, "FF1B8AC3", "%-X", -__LINE__, 0xfffffff2L, "FFFFFFF2", "%00.X", -__LINE__, -0x000013dL, " -317", "%05.d", -__LINE__, 0x0000f5e2L, "+62946", "%+0.2ld", -__LINE__, 0x16ac6358L, "16ac6358", "%x", -__LINE__, 0xffff8728L, "FFFF8728", "%+X", -__LINE__, -0x0014a6dL, "-084589", "%0.6ld", -__LINE__, 0xfc904514L, "FC904514", "%+0X", -__LINE__, 0x00000004L, "4", "%ld", -__LINE__, 0xffffffe0L, "ffffffe0", "%+x", -__LINE__, -0x0a0ffddL, "-10551261", "%+02d", -__LINE__, -0x0000bbcL, "-3004", "%+d", -__LINE__, 0x00000006L, " +6", "%+7ld", -__LINE__, 0x17afa6e5L, "397387493", "%ld", -__LINE__, 0xfffff6bfL, "fffff6bf", "%+04.4x", -__LINE__, 0x000001dcL, "01dc", "% 02.4x", -__LINE__, 0x0000000eL, " 14", "% d", -__LINE__, 0xfffffff9L, "0XFFFFFFF9", "%#4.X", -__LINE__, 0x0000005dL, "93", "%0d", -__LINE__, -0x004fa05L, "-0326149", "%.7d", -__LINE__, -0x0000018L, "-24", "%ld", -__LINE__, 0xfffff7ebL, "FFFFF7EB", "%X", -__LINE__, 0x0072b044L, " 7516228", "% .7ld", -__LINE__, 0xffffffedL, "0xffffffed", "%#x", -__LINE__, 0x0010364dL, "10364D", "%X", -__LINE__, 0xfff90469L, "0XFFF90469", "%#X", -__LINE__, 0x000001b4L, " 436", "% 0d", -__LINE__, 0x00000000L, "0", "% X", -__LINE__, 0xfffffff3L, "fffffff3", "%x", -__LINE__, 0x19335d40L, "19335d40", "%6x", -__LINE__, 0x00039c24L, "236580", "%ld", -__LINE__, 0x000021f7L, "8695", "%0.4ld", -__LINE__, -0x057b406L, "-5747718", "%d", -__LINE__, -0x017b371L, "-1553265", "%#ld", -__LINE__, 0x0003e405L, "254981", "%2.d", -__LINE__, 0x00000001L, "1", "%-.1x", -__LINE__, 0x000000aeL, "AE", "%.1X", -__LINE__, 0xffd85825L, "ffd85825", "%-7.x", -__LINE__, 0xfffad763L, "fffad763", "%x", -__LINE__, 0x002431d4L, "2372052", "%6.ld", -__LINE__, 0x00000003L, "000003", "%-05.6d", -__LINE__, 0xffffffebL, "0xffffffeb", "%#x", -__LINE__, 0xff8cf3b0L, "ff8cf3b0", "%x", -__LINE__, 0xfe88d2ffL, "0xfe88d2ff", "%+#.2x", -__LINE__, 0xffffff6bL, "ffffff6b", "%6.3x", -__LINE__, 0xfffffffeL, "fffffffe", "%-x", -__LINE__, 0xe998945aL, "e998945a", "%2.x", -__LINE__, 0x03b9c50fL, "3B9C50F", "%+X", -__LINE__, 0xffffffffL, "FFFFFFFF", "%3.7X", -__LINE__, 0x000024efL, "24ef", "%+x", -__LINE__, 0xfffffc04L, "FFFFFC04", "%X", -__LINE__, 0x0d4bef7cL, " 223080316", "% .1ld", -__LINE__, -0xc33f3bcL, "-204731324", "%.5ld", -__LINE__, 0xffffffffL, "0XFFFFFFFF", "%#2X", -__LINE__, 0x0000e493L, "e493", "%x", -__LINE__, 0x000001b4L, "1b4", "%x", -__LINE__, 0xffffffd6L, "0xffffffd6", "% #1x", -__LINE__, 0x00000001L, "1", "%d", -__LINE__, -0x0000f28L, "-3880", "%ld", -__LINE__, 0x00000277L, "631", "%-1ld", -__LINE__, 0x00000001L, " 1", "%2x", -__LINE__, -0x0ff4d2cL, "-16731436", "%#ld", -__LINE__, 0x0bb80344L, "196608836", "%00ld", -__LINE__, 0xffffffdcL, "FFFFFFDC", "%X", -__LINE__, 0x00000484L, "1156", "%ld", -__LINE__, 0x00000341L, "341", "%-.2x", -__LINE__, 0x0000ee62L, "ee62", "%x", -__LINE__, 0xfffffe20L, "fffffe20", "%+x", -__LINE__, -0x00076ebL, "-30443", "%.2d", -__LINE__, 0x2c4a7407L, "2c4a7407", "% x", -__LINE__, 0x00000000L, " ", "%3.X", -__LINE__, 0xffffff60L, "ffffff60", "% 4.x", -__LINE__, 0x000e4cf2L, "+937202", "%+.5ld", -__LINE__, 0x00000008L, " 00008", "%06.5X", -__LINE__, 0x0002f612L, "194066", "%d", -__LINE__, 0xfffffc96L, "fffffc96", "%-3.3x", -__LINE__, -0x0000001L, "-1", "% ld", -__LINE__, 0x00000000L, " ", "% 6.0X", -__LINE__, 0xfffffff5L, "fffffff5", "%3.x", -__LINE__, 0x0bfd63a1L, "201155489", "%d", -__LINE__, -0x1547c214L, "-357024276", "%ld", -__LINE__, 0x00000004L, "4", "%#0.d", -__LINE__, -0x000f2f3L, "-62195", "%.2d", -__LINE__, 0xfff843ddL, "FFF843DD", "%X", -__LINE__, 0x00966e36L, "9858614", "%.0ld", -__LINE__, 0x0000782eL, "0X782E", "% #X", -__LINE__, 0x00bd36c0L, "12400320", "%ld", -__LINE__, 0x00000000L, "00", "% .2X", -__LINE__, 0x00000000L, "0", "%1X", -__LINE__, 0x0003f416L, "3f416 ", "%-6.x", -__LINE__, -0x00b74bdL, "-750781", "% ld", -__LINE__, 0x0000138aL, "138a", "% x", -__LINE__, 0x024df7f0L, "24DF7F0", "% 0.6X", -__LINE__, 0xfffffffcL, "FFFFFFFC", "%X", -__LINE__, -0x0003284L, "-12932 ", "%-07.ld", -__LINE__, 0x000094d3L, "94d3", "%x", -__LINE__, 0x000000bfL, "bf", "%.2x", -__LINE__, 0x00000000L, "00000", "%-1.5X", -__LINE__, -0x04899b8L, "-4757944", "%d", -__LINE__, 0x2b51bf20L, "+726777632", "%+d", -__LINE__, -0x000000dL, "-13", "%.2d", -__LINE__, 0x04f78fbdL, "4F78FBD", "% 7.X", -__LINE__, 0x00011684L, "71300", "%5.d", -__LINE__, 0x0000539dL, "21405", "%0d", -__LINE__, 0x00000008L, "000008", "%-3.6X", -__LINE__, 0xfc7a2cdcL, "fc7a2cdc", "%2.3x", -__LINE__, 0xffc21da1L, "ffc21da1", "%x", -__LINE__, 0x00000273L, "273", "%x", -__LINE__, 0x00000000L, "0", "%#X", -__LINE__, -0x31cd6b9L, "-52221625", "% d", -__LINE__, 0xfffffff8L, "FFFFFFF8", "%.0X", -__LINE__, 0x00000002L, "2", "%#ld", -__LINE__, 0x00e8922cL, "15241772", "%d", -__LINE__, 0xfeb19ea7L, "FEB19EA7", "%0.1X", -__LINE__, 0x00003931L, "014641", "%06ld", -__LINE__, 0x00000015L, "0X00015", "%#.5X", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%1.X", -__LINE__, 0xfff17103L, "0XFFF17103", "% #X", -__LINE__, 0xfffffffcL, "FFFFFFFC", "%+X", -__LINE__, 0x00000002L, "00002", "%.5x", -__LINE__, 0x00001617L, " 5655", "% 7.d", -__LINE__, -0x0000010L, "-000016", "%00.6d", -__LINE__, 0x000000b0L, "B0", "% X", -__LINE__, 0xfc9362b2L, "FC9362B2", "%-X", -__LINE__, 0xfc3d8276L, "fc3d8276", "% 1x", -__LINE__, 0x00001405L, "5125", "%#d", -__LINE__, 0x02250183L, " 35979651", "% ld", -__LINE__, 0xffc9b007L, "ffc9b007", "% 4.x", -__LINE__, 0x00000311L, "785", "%0d", -__LINE__, 0x0004d273L, " 316019", "% d", -__LINE__, 0x00000001L, "1", "%1.x", -__LINE__, 0xffff240fL, "FFFF240F", "%4.X", -__LINE__, 0x0049cfdaL, "+4837338", "%+ld", -__LINE__, 0x012f6dd5L, "12F6DD5", "% 6.2X", -__LINE__, 0x00000002L, "0x2", "%#2.0x", -__LINE__, 0xfffd834aL, "FFFD834A", "%.6X", -__LINE__, 0xfe2a40f8L, "0XFE2A40F8", "%#X", -__LINE__, 0xffffffebL, "ffffffeb", "%x", -__LINE__, -0x00ac5cbL, "-705995", "%d", -__LINE__, -0x3021108cL, "-807473292", "% .4d", -__LINE__, -0x0000035L, "-53", "%-ld", -__LINE__, -0x1a36475L, "-27485301", "% d", -__LINE__, -0x0000011L, "-17", "%d", -__LINE__, 0x000001a3L, "000419", "%.6ld", -__LINE__, 0x0030a0a8L, "3186856", "%.5ld", -__LINE__, 0x00000019L, "25", "%d", -__LINE__, 0xf32deac1L, "F32DEAC1", "%06.2X", -__LINE__, -0x0000004L, " -00004", "%7.5ld", -__LINE__, 0x00000000L, "0", "%ld", -__LINE__, 0x0006bf19L, "442137", "%#0.d", -__LINE__, 0x566f6c44L, "1450142788", "%1.6d", -__LINE__, 0xfffffc10L, "fffffc10", "%.2x", -__LINE__, -0x000e04dL, "-57421", "%+0d", -__LINE__, 0x00000000L, "0000000", "%+.7X", -__LINE__, 0x00b5c74dL, " 11913037", "% ld", -__LINE__, -0x028dfe2L, "-2678754", "%05.1d", -__LINE__, 0xfffffee0L, "fffffee0", "%0x", -__LINE__, -0x030c077L, "-3194999", "%-.6d", -__LINE__, 0x00055ca1L, "055ca1", "%-.6x", -__LINE__, 0x00000000L, " ", "%7.X", -__LINE__, 0xfffffe3bL, "FFFFFE3B", "%X", -__LINE__, 0xffffffffL, "FFFFFFFF", "% 3X", -__LINE__, 0x00000857L, "2135", "%-#1.d", -__LINE__, -0x00546a2L, "-345762", "%0.5d", -__LINE__, 0x0000000bL, "0xb ", "%-#6x", -__LINE__, 0x00000d2bL, "d2b ", "%-4.0x", -__LINE__, 0x0ae02b9eL, "AE02B9E", "%X", -__LINE__, 0xfffffa7bL, "fffffa7b", "%-2.x", -__LINE__, 0x00000001L, "1", "%X", -__LINE__, 0x000006adL, "01709", "%05.5ld", -__LINE__, -0x0000102L, "-258", "%-0.ld", -__LINE__, 0x00000000L, "0", "%.1X", -__LINE__, -0x01daa95L, "-1944213", "%-1ld", -__LINE__, 0x02b99040L, "2B99040", "%2.X", -__LINE__, 0x1b3d5621L, "1B3D5621", "%X", -__LINE__, 0x0312d16bL, "51564907", "%-1.7ld", -__LINE__, 0x000aa76cL, " 698220", "% 2d", -__LINE__, 0x00000000L, "0", "%ld", -__LINE__, 0xfff8a4ecL, "FFF8A4EC", "%-X", -__LINE__, 0xffffe06dL, "ffffe06d", "%x", -__LINE__, 0x00000003L, "3", "% x", -__LINE__, 0x00000000L, "0", "%x", -__LINE__, 0xd3e244ddL, "D3E244DD", "%+5X", -__LINE__, 0x000028b3L, " 28b3", "% 5.x", -__LINE__, 0x0001acebL, "109803", "%6d", -__LINE__, 0xfffbc5caL, "0xfffbc5ca", "%-#5x", -__LINE__, 0x00000097L, " 151", "% 7ld", -__LINE__, 0x00001fccL, "+8140", "%+d", -__LINE__, 0xffffffffL, "ffffffff", "%0x", -__LINE__, -0x00052a9L, "-21161", "%ld", -__LINE__, 0xfffffc76L, "FFFFFC76", "%.1X", -__LINE__, -0x2acb012L, "-44871698", "%0.1ld", -__LINE__, 0xffffff81L, "ffffff81", "%x", -__LINE__, -0x0018394L, "-99220", "%-ld", -__LINE__, 0x0000001bL, "1B", "%X", -__LINE__, 0x00000033L, "51", "%1d", -__LINE__, 0xffec37e5L, "FFEC37E5", "%-1X", -__LINE__, -0x000000aL, " -10", "%#5.d", -__LINE__, -0x0000412L, "-1042", "%ld", -__LINE__, 0x000cd0b1L, "cd0b1 ", "%-7.5x", -__LINE__, 0x0b445370L, "B445370", "%+2.0X", -__LINE__, 0xfffffff3L, "0XFFFFFFF3", "%-#X", -__LINE__, 0xffff9f33L, "FFFF9F33", "%5.X", -__LINE__, 0x00010a1eL, "10A1E", "%-2X", -__LINE__, -0xede156fL, "-249435503", "% 7.1ld", -__LINE__, 0xfc6d63aaL, "fc6d63aa", "% .6x", -__LINE__, 0x0000311cL, " 12572", "% ld", -__LINE__, 0x00001f8aL, "8074", "%00.d", -__LINE__, 0x00000199L, "199", "%-X", -__LINE__, 0xfffffc60L, "FFFFFC60", "%+3X", -__LINE__, -0x000022cL, "-556", "%+0ld", -__LINE__, 0x021d8407L, "35488775", "%-#.7ld", -__LINE__, 0x0000020fL, "527", "%d", -__LINE__, -0x000064bL, "-1611", "%#ld", -__LINE__, -0x0c15aefL, "-12671727", "%d", -__LINE__, -0x1f1a6881L, "-521824385", "%ld", -__LINE__, 0xffffc115L, "ffffc115", "% x", -__LINE__, 0x00000017L, " 23", "% #ld", -__LINE__, 0x00000dc1L, "DC1 ", "%-4X", -__LINE__, 0x000002caL, "2CA", "%X", -__LINE__, 0x000f052cL, " 984364", "%7.d", -__LINE__, 0x0000005aL, "0090", "%0.4d", -__LINE__, -0x001e463L, "-124003", "% 4.ld", -__LINE__, 0x00000001L, "0000001", "%+.7X", -__LINE__, 0x00000bfbL, "0000bfb", "%5.7x", -__LINE__, 0x0002484bL, "149579", "%#1d", -__LINE__, 0x0043ba18L, "4438552", "%-ld", -__LINE__, 0x000078f8L, "0X78F8", "%#X", -__LINE__, 0x00000001L, " 1", "%4d", -__LINE__, 0x0cedaeedL, "CEDAEED", "%X", -__LINE__, 0x00000003L, "+3", "%+ld", -__LINE__, 0xfffffffbL, "FFFFFFFB", "%7.4X", -__LINE__, 0x00000169L, "361", "%ld", -__LINE__, 0x00003c7aL, "+15482", "%+ld", -__LINE__, -0x0159d93L, "-1416595", "% 0.0d", -__LINE__, 0x0000775cL, "+30556", "%+3.d", -__LINE__, 0x10284768L, "+271075176", "%+0.0ld", -__LINE__, -0xf8b610eL, "-260792590", "%0d", -__LINE__, 0xfdd8d369L, "fdd8d369", "%-.3x", -__LINE__, 0x000c9495L, "+824469", "%+ld", -__LINE__, -0x000003fL, " -063", "%7.3d", -__LINE__, -0x000073bL, "-1851", "%+03.ld", -__LINE__, 0xfffe4e23L, "0xfffe4e23", "%#.5x", -__LINE__, 0x0081788cL, "81788c", "%5x", -__LINE__, -0x015f888L, "-1439880", "%+1d", -__LINE__, -0x31d64b4L, "-52257972", "%0.2d", -__LINE__, 0xffffffffL, "FFFFFFFF", "%6.5X", -__LINE__, -0x0000072L, "-114", "%+.1d", -__LINE__, -0x00000e1L, "-225", "%ld", -__LINE__, 0x000006a8L, "0x6a8", "%+#x", -__LINE__, 0xfffe673aL, "fffe673a", "%01.x", -__LINE__, 0xfff2ee0dL, "FFF2EE0D", "%-X", -__LINE__, 0x0290320aL, "43004426", "%0ld", -__LINE__, -0xeb7a832L, "-246917170", "% ld", -__LINE__, 0x02ae9265L, "2ae9265", "%1.x", -__LINE__, 0xffffffd2L, "ffffffd2", "%+2.x", -__LINE__, 0x00e6e858L, "0xe6e858", "%#0.x", -__LINE__, 0x00000c4aL, "+3146", "%+3.1d", -__LINE__, -0x6943c1aL, "-110378010", "% 0ld", -__LINE__, 0x0167b119L, "167b119", "%0x", -__LINE__, 0xfffffffeL, "fffffffe", "%+x", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%X", -__LINE__, 0x000b861eL, "755230", "%ld", -__LINE__, 0x0000015bL, "347", "%-#ld", -__LINE__, 0xfffffffaL, "0XFFFFFFFA", "%#X", -__LINE__, 0x000de9e5L, "911845", "%d", -__LINE__, 0x00000001L, "01", "%.2d", -__LINE__, 0x000007a5L, "1957", "%0d", -__LINE__, 0x0000000fL, "f", "%x", -__LINE__, 0x00c38cbfL, " 12815551", "% .2d", -__LINE__, -0x7bd1b6eL, "-129833838", "% d", -__LINE__, -0x000013cL, "-316", "%0d", -__LINE__, 0x00001aadL, "1AAD", "%-0X", -__LINE__, 0x0034f903L, "3471619", "%00d", -__LINE__, 0xff925717L, "ff925717", "%4x", -__LINE__, 0x00000002L, "02", "%.2d", -__LINE__, 0x00000f34L, "F34", "%+X", -__LINE__, 0xffffeefeL, "FFFFEEFE", "%X", -__LINE__, 0xfffeecb4L, "FFFEECB4", "% 2.X", -__LINE__, 0x00034421L, "214049", "%0ld", -__LINE__, 0x00000000L, " 0", "%+6X", -__LINE__, -0x0000062L, "-98", "%-#2d", -__LINE__, -0x0000557L, "-1367", "%-4.4d", -__LINE__, 0xffffe17cL, "FFFFE17C", "%X", -__LINE__, 0x00000097L, "00097", "%.5X", -__LINE__, 0xfffcb278L, "FFFCB278", "%0.7X", -__LINE__, -0x0000001L, "-0001 ", "%-7.4d", -__LINE__, -0x0000001L, "-1", "%ld", -__LINE__, 0x000002c4L, "708", "%d", -__LINE__, 0x04946f45L, "4946F45", "%-2.X", -__LINE__, 0x000000ffL, "00ff", "% 2.4x", -__LINE__, 0x00073307L, "471815", "%3ld", -__LINE__, 0x0085b7b6L, "+8763318", "%+ld", -__LINE__, -0x0000002L, "-2", "%1ld", -__LINE__, -0x0000001L, "-1", "%-2d", -__LINE__, -0x00000b5L, " -181", "%7ld", -__LINE__, -0x0412486L, "-4269190", "%+2.1ld", -__LINE__, 0xffffffffL, "ffffffff", "%0x", -__LINE__, 0x0000006dL, "6d", "%x", -__LINE__, 0x000000daL, "218", "%-.3ld", -__LINE__, 0xfffffcfeL, "fffffcfe", "%x", -__LINE__, 0x652e60c7L, "652E60C7", "%7.7X", -__LINE__, 0x00000035L, " 53", "% #2d", -__LINE__, 0x000000fcL, "FC", "%-X", -__LINE__, 0x00000019L, " 25", "% ld", -__LINE__, 0xfffffcf4L, "fffffcf4", "%6x", -__LINE__, 0xffffff41L, "ffffff41", "%x", -__LINE__, 0x00000034L, " 52", "%3.ld", -__LINE__, 0xffffffb2L, "ffffffb2", "%-x", -__LINE__, -0x6dc43e7cL, "-1841577596", "% .2ld", -__LINE__, 0x00000004L, "4", "%d", -__LINE__, -0x000023bL, "-571", "%ld", -__LINE__, -0x000004dL, "-77", "%ld", -__LINE__, 0x0000e3baL, "58298", "%.0ld", -__LINE__, 0xfffffff2L, "fffffff2", "%0.0x", -__LINE__, -0x0000020L, "-32", "%ld", -__LINE__, 0xffffb33eL, "0XFFFFB33E", "%-#X", -__LINE__, 0x00000000L, " ", "% 4.x", -__LINE__, 0xffd96f92L, "FFD96F92", "%X", -__LINE__, 0x0000002eL, " 46", "% 0ld", -__LINE__, 0xffffffffL, "ffffffff", "%x", -__LINE__, -0x5008ba3L, "-83921827", "%+d", -__LINE__, 0xfdc1df3dL, "FDC1DF3D", "%0X", -__LINE__, 0xfc7410e5L, "fc7410e5", "%7x", -__LINE__, 0xfffffffaL, "FFFFFFFA", "% 6.X", -__LINE__, 0x00000000L, "0", "%X", -__LINE__, -0x040fd4eL, "-4259150", "% 05.d", -__LINE__, 0x0000003bL, " 59", "%3.2d", -__LINE__, 0xff776dd8L, "ff776dd8", "%x", -__LINE__, 0x0000055bL, "+1371", "%+#2d", -__LINE__, 0x00004841L, "4841", "%.1x", -__LINE__, 0x0229d710L, "36296464", "%-.2ld", -__LINE__, 0x00000000L, "0", "%x", -__LINE__, 0xfffe8376L, "fffe8376", "%0x", -__LINE__, 0x000a7b83L, "a7b83", "%x", -__LINE__, 0x0000000dL, " 013", "%#7.3d", -__LINE__, 0xffffffffL, "FFFFFFFF", "%5.0X", -__LINE__, 0x00000704L, " 0x704", "%#7.0x", -__LINE__, 0xfff970b9L, "FFF970B9", "%.1X", -__LINE__, -0x000b60aL, "-46602", "%+d", -__LINE__, 0x00000000L, " 00000", "%6.5x", -__LINE__, 0x00000003L, "3", "%X", -__LINE__, 0x0000c14bL, "c14b", "%0x", -__LINE__, 0x066d7860L, "107837536", "%-d", -__LINE__, 0x00000013L, " 13", "%4.x", -__LINE__, 0xfff96f18L, "FFF96F18", "%4X", -__LINE__, 0xffffff30L, "FFFFFF30", "%X", -__LINE__, 0xffffffffL, "FFFFFFFF", "% .7X", -__LINE__, -0x72a9e985L, "-1923737989", "%2.d", -__LINE__, 0x00000002L, "0x2", "%#x", -__LINE__, 0x0000050eL, "50e", "%2.3x", -__LINE__, 0x0000605cL, "24668", "%4.1d", -__LINE__, 0xffffff3eL, "ffffff3e", "%x", -__LINE__, -0x0000010L, "-16", "%-2d", -__LINE__, 0x000061aaL, "61AA", "%X", -__LINE__, 0x000c2ec3L, "C2EC3", "%0X", -__LINE__, -0x0000001L, "-1", "%-0d", -__LINE__, 0x00130e17L, "+1248791", "%+.6ld", -__LINE__, 0x000000efL, "EF", "%-X", -__LINE__, -0x0000001L, " -1", "%+5ld", -__LINE__, 0x0000989dL, "39069", "%d", -__LINE__, 0x00000000L, "0", "%-x", -__LINE__, 0x00000417L, "417", "%X", -__LINE__, 0x00005e86L, "5E86", "%+X", -__LINE__, -0x0007c08L, "-31752", "%ld", -__LINE__, 0x00da8e0fL, "DA8E0F", "%2.2X", -__LINE__, -0x3ee095ecL, "-1054905836", "% 0d", -__LINE__, 0xfffdb5a3L, "fffdb5a3", "%x", -__LINE__, 0xffffff83L, "FFFFFF83", "%X", -__LINE__, 0xfff8efd7L, "0xfff8efd7", "%#x", -__LINE__, 0x00000020L, " 32", "% d", -__LINE__, 0xfff7c002L, "fff7c002", "%.7x", -__LINE__, -0x0000001L, "-1", "%ld", -__LINE__, 0x00000000L, " 000", "%05.3X", -__LINE__, 0xfff190eeL, "FFF190EE", "%X", -__LINE__, 0x00000a6cL, " 2668", "%#6.ld", -__LINE__, 0x00037024L, "37024", "%x", -__LINE__, 0xfffec37fL, "FFFEC37F", "%X", -__LINE__, 0x007ee9bbL, "8317371", "%#0.ld", -__LINE__, 0x00000122L, "290", "%ld", -__LINE__, -0x0013b5fL, "-80735", "%ld", -__LINE__, 0xfffffff6L, "FFFFFFF6", "%X", -__LINE__, -0x0000c16L, "-0003094", "%-00.7d", -__LINE__, -0x00010edL, "-4333", "%ld", -__LINE__, 0x00000007L, " 0X007", "%#6.3X", -__LINE__, 0x0053781eL, " 5470238", "% 2d", -__LINE__, 0xffff03e9L, "0XFFFF03E9", "%+#7.3X", -__LINE__, 0xfffffdc2L, "0xfffffdc2", "% #4.x", -__LINE__, -0x00018e1L, "-6369", "%d", -__LINE__, 0xf3a4abc6L, "F3A4ABC6", "%-.2X", -__LINE__, 0xfff64a27L, "FFF64A27", "%7.7X", -__LINE__, 0x00195ae5L, "195AE5", "%+03.X", -__LINE__, 0xfff8849aL, "fff8849a", "%.1x", -__LINE__, -0x001b045L, "-110661", "%+ld", -__LINE__, 0x01e8a106L, "32022790", "%7.ld", -__LINE__, 0x0008ee94L, "8EE94", "%X", -__LINE__, 0xfffcdabcL, "FFFCDABC", "%X", -__LINE__, 0xfda75cd2L, "fda75cd2", "%x", -__LINE__, 0x00fd505aL, "fd505a", "%x", -__LINE__, 0x00003748L, "3748", "%+x", -__LINE__, 0xffffffe5L, "ffffffe5", "% 3.6x", -__LINE__, -0x1d1c4045L, "-488390725", "%d", -__LINE__, 0xfffffff9L, "0xfffffff9", "%#x", -__LINE__, -0x0000001L, "-1", "%-#ld", -__LINE__, 0x00000191L, "191", "%X", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%-X", -__LINE__, -0x0000006L, "-6", "%ld", -__LINE__, 0x00000033L, " 33", "% 4x", -__LINE__, -0x0159a14L, "-1415700", "% ld", -__LINE__, 0x000001c3L, "00001c3", "%07x", -__LINE__, 0xffffe9e2L, "ffffe9e2", "%-x", -__LINE__, 0x5b19abd9L, "0x5b19abd9", "%-#x", -__LINE__, 0xffff1baeL, "0xffff1bae", "%#x", -__LINE__, 0x00000001L, "+1", "%+d", -__LINE__, 0x006a23c7L, "6A23C7", "%2.X", -__LINE__, 0x000008a4L, " 8a4", "% 4.1x", -__LINE__, 0xfffffcd9L, "fffffcd9", "%.1x", -__LINE__, 0x0000121bL, "121B", "%X", -__LINE__, 0x001231aaL, "1192362", "%7.d", -__LINE__, -0x008026dL, "-524909", "%4.2d", -__LINE__, 0x192ea594L, "422487444", "%ld", -__LINE__, 0x0001a800L, "108544", "%0d", -__LINE__, 0x000062f1L, "62f1", "%.4x", -__LINE__, 0xff8b39b0L, "ff8b39b0", "% x", -__LINE__, 0x00000001L, "0x1", "%+#x", -__LINE__, 0x0000144aL, "5194", "%ld", -__LINE__, 0x00002599L, "9625", "%d", -__LINE__, 0xffa0a2efL, "ffa0a2ef", "%0x", -__LINE__, 0xff6712e1L, "FF6712E1", "%0X", -__LINE__, 0x0007ebb3L, "519091", "%1ld", -__LINE__, 0x0000000fL, "15 ", "%-4.ld", -__LINE__, -0x0000096L, "-150", "%2.ld", -__LINE__, 0x0000004fL, "4F", "%.2X", -__LINE__, 0xfffffc29L, "fffffc29", "%-4.x", -__LINE__, 0x00000019L, "19", "%x", -__LINE__, 0x00000c4eL, "c4e", "%x", -__LINE__, 0x0000006bL, " 0006B", "%6.5X", -__LINE__, 0x00c8d2c6L, "c8d2c6", "%.0x", -__LINE__, -0x256fb8deL, "-628078814", "%ld", -__LINE__, 0x4f51fcf4L, "4F51FCF4", "%+X", -__LINE__, 0x000f000eL, "983054", "%1.ld", -__LINE__, 0xfffff03fL, "fffff03f", "%x", -__LINE__, 0x0000001dL, " 1D", "%05.X", -__LINE__, 0x0072ea14L, "72ea14", "%x", -__LINE__, -0xc6098b9L, "-207657145", "%-7d", -__LINE__, 0x00000a76L, "2678", "%3ld", -__LINE__, 0xfff84db3L, "FFF84DB3", "%X", -__LINE__, 0x0fb52870L, "fb52870", "%+x", -__LINE__, 0x08bc170aL, "0x8bc170a", "%#x", -__LINE__, 0xfffeeb00L, "fffeeb00", "%0.5x", -__LINE__, 0x000ece95L, "970389", "%d", -__LINE__, 0x00000000L, "0", "%0X", -__LINE__, 0x07f98e8aL, "7f98e8a", "% x", -__LINE__, 0x000499ebL, " 499eb", "% 6.x", -__LINE__, 0xffffffffL, "FFFFFFFF", "%-X", -__LINE__, 0x0aa45e86L, "178544262", "%#.2d", -__LINE__, 0xff73387dL, "FF73387D", "%03.X", -__LINE__, 0xfffffb51L, "FFFFFB51", "%.3X", -__LINE__, 0xffffffdcL, "ffffffdc", "%6.x", -__LINE__, 0xffffffedL, "FFFFFFED", "%-X", -__LINE__, 0x0001c4c2L, "1c4c2", "%0.3x", -__LINE__, -0x0000001L, "-0000001", "%-#.7d", -__LINE__, 0x00000007L, "7", "%0.x", -__LINE__, 0x00000001L, "1", "%ld", -__LINE__, 0xffffd000L, "ffffd000", "%4.3x", -__LINE__, 0x00000030L, "48", "%2.d", -__LINE__, -0x6c121ceL, "-113320398", "%.5ld", -__LINE__, 0x000001edL, "1ED", "% 3.X", -__LINE__, 0xfffff0f3L, "FFFFF0F3", "%+.6X", -__LINE__, 0xffffffecL, "ffffffec", "%x", -__LINE__, 0x002d5ab8L, "0x2d5ab8", "%-#x", -__LINE__, 0x0026acffL, "2534655", "%0ld", -__LINE__, 0x01d90cd7L, "+31001815", "%+.2ld", -__LINE__, -0x1f7abc0L, "-33008576", "%7.6d", -__LINE__, 0xfc5babccL, "fc5babcc", "%x", -__LINE__, -0x9b74892L, "-163006610", "% .6d", -__LINE__, 0x03931d84L, "59972996", "%0.d", -__LINE__, 0x07d261ceL, "131228110", "%#ld", -__LINE__, 0x00000000L, "0", "%x", -__LINE__, 0x00000002L, "2", "%+X", -__LINE__, -0x0000604L, "-1540", "%+d", -__LINE__, 0x00000000L, " ", "%7.x", -__LINE__, 0x00000001L, "1", "%.0X", -__LINE__, -0x0005a8eL, "-23182", "% d", -__LINE__, 0x03fb2730L, "3fb2730", "%7.x", -__LINE__, 0xffffff03L, "ffffff03", "%x", -__LINE__, 0x00000000L, " ", "%-#3.d", -__LINE__, 0x04025a4bL, "0X4025A4B", "%+#X", -__LINE__, -0x0000001L, " -1", "%4.d", -__LINE__, 0xfffe00a3L, "FFFE00A3", "%+X", -__LINE__, -0x1b26e3c8L, "-455533512", "% ld", -__LINE__, 0x000017e5L, "6117", "%d", -__LINE__, -0x0e4f3b6L, "-15004598", "%0ld", -__LINE__, 0x00000034L, "52", "%ld", -__LINE__, 0x0000024cL, " 24C", "%4X", -__LINE__, 0xfffedf65L, "FFFEDF65", "%-0X", -__LINE__, -0x000ff1fL, "-65311", "%+#d", -__LINE__, 0x00000007L, " 7", "%7.x", -__LINE__, 0x018656aeL, "18656ae", "%3.7x", -__LINE__, -0x0000004L, "-4", "%d", -__LINE__, 0x7081292dL, "1887512877", "%d", -__LINE__, 0x87d3e48cL, "87d3e48c", "%-x", -__LINE__, 0xf99c516eL, "0xf99c516e", "% #7.4x", -__LINE__, 0xfffffffaL, "FFFFFFFA", "%-1X", -__LINE__, -0x000001dL, "-29", "%#ld", -__LINE__, -0x0000001L, "-1", "%+ld", -__LINE__, 0x28ab3350L, " 682308432", "% 1d", -__LINE__, -0x0000006L, "-6", "%ld", -__LINE__, 0xfffffffbL, "FFFFFFFB", "%.5X", -__LINE__, -0x0000007L, "-7", "%#d", -__LINE__, -0x0000328L, " -808", "%6.ld", -__LINE__, -0x29386f00L, "-691564288", "%.3d", -__LINE__, -0x059f38aL, "-5895050", "%.4ld", -__LINE__, 0xfffff888L, "FFFFF888", "%3X", -__LINE__, 0xffffffdfL, "ffffffdf", "%0.0x", -__LINE__, -0xb4fc354L, "-189776724", "%2d", -__LINE__, 0x00058c07L, "363527", "%1.d", -__LINE__, 0x0a256162L, "a256162", "%x", -__LINE__, -0x05c87b0L, "-6064048", "%0ld", -__LINE__, 0xfffffda1L, "fffffda1", "%x", -__LINE__, 0x000034b7L, "13495", "%d", -__LINE__, -0x6d1a8918L, "-1830455576", "%.1d", -__LINE__, 0x00022290L, "139920", "%05ld", -__LINE__, 0x00000000L, "0", "%-x", -__LINE__, -0x1f8eafceL, "-529444814", "%4.d", -__LINE__, -0x7bf32808L, "-2079533064", "% ld", -__LINE__, 0x0000023cL, "23c", "% x", -__LINE__, 0x00000039L, "39", "%X", -__LINE__, -0x000556dL, "-21869", "%ld", -__LINE__, -0x00000caL, "-202", "%ld", -__LINE__, 0x00002e28L, "11816", "%-d", -__LINE__, 0x00000011L, "17", "%-ld", -__LINE__, 0xfffffffbL, "FFFFFFFB", "%-X", -__LINE__, 0xfffdd67fL, "0XFFFDD67F", "%#X", -__LINE__, -0x000003dL, "-61", "%d", -__LINE__, 0x0000bfceL, "0XBFCE", "%-#5.2X", -__LINE__, 0xfffffffcL, "fffffffc", "%x", -__LINE__, -0x00aea17L, "-715287", "%.5d", -__LINE__, -0x02fce89L, "-3133065", "%0d", -__LINE__, 0x007f6ed1L, "7F6ED1", "%6X", -__LINE__, 0xffffffffL, "FFFFFFFF", "%X", -__LINE__, -0x0002761L, "-10081", "%#6.2d", -__LINE__, 0x003be8d8L, "3BE8D8", "%-X", -__LINE__, 0x00000901L, " 2305", "%6.d", -__LINE__, 0x00049916L, "0301334", "%3.7ld", -__LINE__, 0x0678ffeaL, "0X678FFEA", "%#4X", -__LINE__, 0xffffffffL, "ffffffff", "%+.0x", -__LINE__, -0x31d2ec61L, "-835906657", "%.0d", -__LINE__, 0xfffffffcL, "FFFFFFFC", "%0X", -__LINE__, -0x0015588L, "-87432", "%d", -__LINE__, 0xffffff3eL, "ffffff3e", "%.4x", -__LINE__, 0x0000000aL, "10", "%d", -__LINE__, -0x0000003L, "-3", "%2.1ld", -__LINE__, -0x000d29aL, "-53914", "%ld", -__LINE__, -0x04ccbe0L, "-5032928", "%2.2ld", -__LINE__, 0x0357c2a5L, "357c2a5", "% 7.x", -__LINE__, 0x00000009L, " 9", "% 1.ld", -__LINE__, -0x005908dL, "-364685", "%0d", -__LINE__, -0x0000de6L, "-3558", "%0ld", -__LINE__, 0x2d395e6bL, "+758734443", "%+6d", -__LINE__, 0x001aba58L, "1ABA58", "% X", -__LINE__, 0x0ceba5abL, "0XCEBA5AB", "%#.1X", -__LINE__, -0x01a8575L, "-1738101", "% 2ld", -__LINE__, 0x0000000dL, "13", "%#ld", -__LINE__, 0x00000000L, "0", "%d", -__LINE__, 0x4b856407L, "4b856407", "%5x", -__LINE__, 0x006f333cL, "6F333C", "%-X", -__LINE__, 0x000000d0L, "d0", "%x", -__LINE__, 0x2ecf0d4eL, "2ecf0d4e", "%0x", -__LINE__, -0x0000188L, "-0000392", "%#1.7ld", -__LINE__, -0x0000037L, "-55", "%d", -__LINE__, 0xfffffff1L, "FFFFFFF1", "% .1X", -__LINE__, 0x00000001L, "0x1", "%#3x", -__LINE__, 0x000005edL, "5ED", "%3X", -__LINE__, 0x031183a3L, "31183A3", "%X", -__LINE__, 0xffffffffL, "ffffffff", "%x", -__LINE__, -0x0018695L, "-99989", "%-0.5ld", -__LINE__, -0x0000001L, "-01", "%0.2ld", -__LINE__, 0x00007822L, "7822", "%+x", -__LINE__, 0x00000000L, "0", "% x", -__LINE__, 0xfda2461aL, "FDA2461A", "%X", -__LINE__, 0x065c50efL, "106713327", "%2.ld", -__LINE__, 0x00000a81L, "a81", "% 0x", -__LINE__, -0x000022eL, "-558", "%.0ld", -__LINE__, 0x00013d2fL, "81199", "%.2ld", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%+X", -__LINE__, 0x000015f9L, "5625", "%04.ld", -__LINE__, 0x0ab575a2L, "179664290", "%0d", -__LINE__, 0x0024d07fL, "0X24D07F", "%#X", -__LINE__, 0x07ee35e1L, "7EE35E1", "%+X", -__LINE__, -0x00c114cL, "-790860", "%#ld", -__LINE__, 0x00003be3L, " 15331", "%07.d", -__LINE__, 0xfff87570L, "FFF87570", "%4.0X", -__LINE__, -0x14eab419L, "-350925849", "%-ld", -__LINE__, -0x000001bL, "-27", "%ld", -__LINE__, 0x167ce2eaL, "0x167ce2ea", "%#0.x", -__LINE__, -0x00009bcL, "-002492", "% 3.6d", -__LINE__, 0xfffffdb9L, "0XFFFFFDB9", "%#7.X", -__LINE__, 0x008b2b9dL, "8B2B9D", "% X", -__LINE__, 0x000cfec3L, "CFEC3", "% 05X", -__LINE__, 0x05970be6L, "5970be6", "%x", -__LINE__, 0x00002780L, "010112", "%2.6d", -__LINE__, 0x00000005L, "+5", "%+d", -__LINE__, 0xfffffffbL, "0xfffffffb", "%#3.x", -__LINE__, 0x00000001L, "1 ", "%-#5.ld", -__LINE__, -0x0000017L, "-23", "%ld", -__LINE__, -0x023b943L, "-2341187", "%d", -__LINE__, 0x0000000dL, "13", "%ld", -__LINE__, 0x00025a03L, "25a03", "% .5x", -__LINE__, 0x3e1ebe24L, "3e1ebe24", "% x", -__LINE__, 0x0000013aL, "0x13a", "%#5.0x", -__LINE__, 0xfff6f5b3L, "FFF6F5B3", "%4.X", -__LINE__, -0x0000a8aL, "-2698", "%.3d", -__LINE__, 0x0009dd5fL, "9dd5f", "%x", -__LINE__, 0x000003c7L, " 3C7", "%04.2X", -__LINE__, 0x1bcfa2f2L, "1bcfa2f2", "%+1.x", -__LINE__, 0x0001b4f4L, "1b4f4", "%+1.x", -__LINE__, 0x1bc19a90L, "465672848", "%#d", -__LINE__, 0xffffffffL, "ffffffff", "%+06x", -__LINE__, -0x0000a88L, "-2696", "%3.d", -__LINE__, 0x00084a19L, "84A19", "%-X", -__LINE__, 0xffe1fc8fL, "FFE1FC8F", "%0.1X", -__LINE__, -0x0000a3aL, "-2618", "%5d", -__LINE__, -0x0000001L, "-1", "%ld", -__LINE__, -0x5c6183dL, "-96868413", "%+ld", -__LINE__, -0x0000001L, "-1", "%-d", -__LINE__, 0x0000faa8L, "64168", "%05.d", -__LINE__, 0x003913efL, "3740655", "%ld", -__LINE__, 0x0dde330aL, "232665866", "%#ld", -__LINE__, 0xfcfb1a7bL, "FCFB1A7B", "%+X", -__LINE__, 0x07b1a81fL, " 129083423", "% 0d", -__LINE__, 0x00000001L, "1", "%d", -__LINE__, 0x00000070L, " 112", "%5ld", -__LINE__, 0xffff74d9L, "ffff74d9", "%x", -__LINE__, -0x001ab93L, "-109459", "%03.d", -__LINE__, 0x0eb6b497L, "EB6B497", "%+X", -__LINE__, 0x07adbac2L, "128826050", "%#0.4d", -__LINE__, 0xff747068L, "FF747068", "%6.X", -__LINE__, -0x190ce98fL, "-420276623", "%06.6ld", -__LINE__, -0x0000007L, "-7", "%.0d", -__LINE__, 0x0001240fL, "1240f", "% 3x", -__LINE__, 0x267ae4a0L, "645588128", "%-#ld", -__LINE__, -0x0000001L, "-1", "% ld", -__LINE__, -0x0000066L, "-00102", "%.5ld", -__LINE__, 0x868fa035L, "868fa035", "%x", -__LINE__, 0x00000000L, " ", "%-4.ld", -__LINE__, 0xfffffe72L, "FFFFFE72", "%4.4X", -__LINE__, 0x00a6b4f4L, "10925300", "%#ld", -__LINE__, -0x0000002L, "-2", "%00.1d", -__LINE__, -0x00000a3L, "-163", "%ld", -__LINE__, 0xfffffffeL, "fffffffe", "% 3.x", -__LINE__, 0xffe25941L, "ffe25941", "% x", -__LINE__, 0x0000a20fL, "41487", "%ld", -__LINE__, -0x000009bL, "-155", "%#.3ld", -__LINE__, 0x000c5dc1L, "810433", "%4.ld", -__LINE__, 0x00003ec4L, "16068", "%ld", -__LINE__, 0x000002f3L, "0755", "%04ld", -__LINE__, 0xffffff28L, "FFFFFF28", "%.5X", -__LINE__, -0x08450ffL, "-8671487", "%-3.0ld", -__LINE__, 0x00000092L, "92", "%x", -__LINE__, -0x0000317L, "-791", "%d", -__LINE__, 0x0000000dL, "d", "%x", -__LINE__, 0x00000036L, "36", "%x", -__LINE__, -0x112693fL, "-17983807", "%ld", -__LINE__, 0x00004226L, "16934", "%0.d", -__LINE__, 0x000001baL, " 442", "% ld", -__LINE__, 0xfffffffcL, "0XFFFFFFFC", "%#4X", -__LINE__, 0xffdb3d23L, "0xffdb3d23", "% #x", -__LINE__, 0x039eb84dL, "39EB84D", "%+.6X", -__LINE__, 0xffffc7daL, "ffffc7da", "%0x", -__LINE__, 0xfffffdb6L, "FFFFFDB6", "%6X", -__LINE__, 0x001b75b0L, "1799600", "%ld", -__LINE__, 0xfffffca2L, "FFFFFCA2", "%-X", -__LINE__, 0xffffffbaL, "ffffffba", "%7.4x", -__LINE__, -0x000124eL, "-4686", "%3.ld", -__LINE__, -0x000bec0L, "-48832", "% 0d", -__LINE__, 0xfffffca0L, "fffffca0", "%2.x", -__LINE__, 0x00b2a462L, "11707490", "%ld", -__LINE__, 0x0745a647L, "745a647", "%+4.x", -__LINE__, 0xfffffbacL, "0XFFFFFBAC", "%#3.X", -__LINE__, -0x0000002L, "-2", "%-0.1d", -__LINE__, 0x0006cfdbL, "446427", "%#5.d", -__LINE__, -0x0000001L, "-1", "%d", -__LINE__, 0x043b134eL, "43B134E", "%X", -__LINE__, -0x0000015L, "-21", "%ld", -__LINE__, -0x0000114L, "-276", "%0d", -__LINE__, -0x0004d4aL, "-19786", "%-d", -__LINE__, -0x000001cL, "-28", "%ld", -__LINE__, -0x0cb89fcL, "-13339132", "%ld", -__LINE__, 0xffffffcfL, "ffffffcf", "%x", -__LINE__, 0xf6d2387aL, "f6d2387a", "%-x", -__LINE__, -0x00000cdL, "-205", "%#ld", -__LINE__, 0x00000000L, "0", "%#x", -__LINE__, 0xfffffc81L, "fffffc81", "%x", -__LINE__, 0x00000000L, " 0", "% ld", -__LINE__, 0x00024fb5L, "24fb5", "%x", -__LINE__, 0x000012faL, "12FA", "%X", -__LINE__, 0x0318ce7cL, "51957372", "%0d", -__LINE__, 0x02280a99L, "2280a99", "%-x", -__LINE__, 0xffffff5cL, "FFFFFF5C", "%2.X", -__LINE__, -0x000002eL, " -46", "%7ld", -__LINE__, -0x04a73e8L, "-4879336", "%4ld", -__LINE__, 0x000007f3L, "7f3", "% 1.3x", -__LINE__, 0x00000114L, "0x114", "%#x", -__LINE__, 0x0000030cL, "30c", "%-x", -__LINE__, 0x001dd0ddL, "0x1dd0dd", "%+#5.5x", -__LINE__, 0xfff23de3L, "fff23de3", "%-x", -__LINE__, -0x0178f9cL, "-1544092", "%d", -__LINE__, 0x02ded8daL, "2DED8DA", "%X", -__LINE__, -0x0991672L, "-10032754", "%3.d", -__LINE__, 0x6943c150L, "6943c150", "%x", -__LINE__, 0xffffc25dL, "FFFFC25D", "%4X", -__LINE__, 0x00000c9cL, " 0003228", "% .7d", -__LINE__, 0xffffffdfL, "FFFFFFDF", "% 6.X", -__LINE__, 0x0001a145L, " 1a145", "%6.0x", -__LINE__, 0xffdc832fL, "0xffdc832f", "%#.1x", -__LINE__, 0x00699f7bL, "699f7b", "%x", -__LINE__, 0xf9575268L, "F9575268", "%+0X", -__LINE__, 0x04eb4783L, "82528131", "%-ld", -__LINE__, -0x0000023L, "-35", "%0ld", -__LINE__, -0x012b08aL, "-1224842", "%0d", -__LINE__, 0xffffb587L, "FFFFB587", "%X", -__LINE__, 0xffffffe9L, "ffffffe9", "%x", -__LINE__, 0x006b5596L, " 7034262", "% 0d", -__LINE__, 0x004d0d2aL, "+5049642", "%+ld", -__LINE__, -0x002a099L, "-172185", "%d", -__LINE__, 0x00000224L, "548", "%ld", -__LINE__, 0x03e0cca8L, "65064104", "%d", -__LINE__, -0x7bb389dL, "-129710237", "%.3ld", -__LINE__, 0xffc630f5L, "ffc630f5", "%-07.0x", -__LINE__, 0xfffffff8L, "FFFFFFF8", "%X", -__LINE__, 0x0030225bL, "3154523", "%#d", -__LINE__, 0xff7f4e28L, "ff7f4e28", "%+4.x", -__LINE__, 0x14ee154dL, "+351147341", "%+ld", -__LINE__, 0x00000003L, "03", "%.2d", -__LINE__, 0xfe0359d6L, "fe0359d6", "%x", -__LINE__, 0x002b71c3L, "2847171", "%d", -__LINE__, 0x055c4d4aL, "55C4D4A", "%-X", -__LINE__, 0xfffb17d2L, "fffb17d2", "% .0x", -__LINE__, 0x00000002L, "2", "%x", -__LINE__, 0x000018e1L, "18E1", "%1.1X", -__LINE__, 0x00000331L, "817", "%0d", -__LINE__, -0x0000982L, "-2434 ", "%-06.ld", -__LINE__, -0x0000168L, "-0000360", "%.7ld", -__LINE__, 0xffffffe9L, "FFFFFFE9", "%-0.4X", -__LINE__, 0xe42084efL, "E42084EF", "%X", -__LINE__, 0x000000aaL, "aa", "%x", -__LINE__, -0xe8b98b5L, "-244029621", "%+d", -__LINE__, -0x00000d9L, "-217", "%+2.d", -__LINE__, 0x0000027bL, "27B", "%+.0X", -__LINE__, 0x002e52dbL, "3035867", "%-ld", -__LINE__, -0x00e2ba8L, "-928680", "%0.2ld", -__LINE__, 0x003b74d8L, "3B74D8", "%X", -__LINE__, -0x000006fL, "-111", "%+ld", -__LINE__, 0xf8507e22L, "0XF8507E22", "%-#X", -__LINE__, 0x0629f4c0L, "103412928", "%-ld", -__LINE__, -0x000002dL, "-45", "%0d", -__LINE__, -0x0001db0L, "-7600", "%d", -__LINE__, -0x00001bbL, " -443", "%5.ld", -__LINE__, 0xffffd2b9L, "ffffd2b9", "%+x", -__LINE__, 0xffffe685L, "0XFFFFE685", "%#0.7X", -__LINE__, 0x0000a4ceL, "A4CE", "% X", -__LINE__, 0xffffffffL, "FFFFFFFF", "%X", -__LINE__, 0x0000000cL, "C", "% X", -__LINE__, 0xfff59369L, "FFF59369", "%7X", -__LINE__, 0x00000156L, " 156", "%5.X", -__LINE__, 0x02833aa9L, "+42154665", "%+2d", -__LINE__, 0x0004a8f3L, "+305395", "%+d", -__LINE__, 0x01a09267L, "1A09267", "%0.3X", -__LINE__, 0x000004f1L, "4f1", "%x", -__LINE__, 0x00000005L, "5", "%x", -__LINE__, 0x00000119L, " 0281", "% #2.4ld", -__LINE__, -0x0001a2aL, "-6698", "%ld", -__LINE__, 0xa3633a57L, "A3633A57", "%7X", -__LINE__, -0x10bd2970L, "-280832368", "%-d", -__LINE__, 0xffff9c38L, "ffff9c38", "%x", -__LINE__, 0xffdbe81eL, "ffdbe81e", "%+6.7x", -__LINE__, 0xffffffe7L, "FFFFFFE7", "%-3.0X", -__LINE__, 0x0002f6d6L, "2f6d6", "%5.x", -__LINE__, 0xffffffffL, "ffffffff", "% x", -__LINE__, 0xffc2c07aL, "ffc2c07a", "%0.x", -__LINE__, 0xfcc0e13aL, "FCC0E13A", "%X", -__LINE__, 0x0000000dL, "d", "% x", -__LINE__, 0x0016cac8L, "16CAC8", "%-0.3X", -__LINE__, 0x00945dc1L, "9723329", "%2d", -__LINE__, 0xf19a1cd1L, "F19A1CD1", "%-X", -__LINE__, 0x00000003L, "+3", "%+ld", -__LINE__, 0x00000773L, "1907", "%ld", -__LINE__, 0x000263e6L, "263e6", "%-x", -__LINE__, -0x0238b55L, "-2329429", "%d", -__LINE__, 0x00006c56L, "6C56", "%X", -__LINE__, 0x0000f34bL, "62283", "%#.0ld", -__LINE__, -0x1620e21L, "-23203361", "%0ld", -__LINE__, 0xf9257d6aL, "f9257d6a", "%2x", -__LINE__, -0x00ed463L, "-971875", "%03.d", -__LINE__, 0x02bb94c6L, "45847750", "%d", -__LINE__, 0xffffd20cL, "0XFFFFD20C", "%#X", -__LINE__, 0x000087d8L, "34776", "%.0d", -__LINE__, 0xfffffffcL, "FFFFFFFC", "%+7.X", -__LINE__, -0x0009cd5L, "-40149", "%-ld", -__LINE__, 0xfffff85eL, "FFFFF85E", "% 0.7X", -__LINE__, -0x0000006L, " -6", "%+#6.ld", -__LINE__, 0x007ff453L, "0x7ff453", "%-#1.x", -__LINE__, 0xffffffe6L, "FFFFFFE6", "%2X", -__LINE__, 0x0000001fL, "0X1F", "%#4X", -__LINE__, -0x001c157L, "-115031", "%.3ld", -__LINE__, 0x00096e06L, "617990", "%3.1ld", -__LINE__, 0x0f77271dL, "259467037", "%d", -__LINE__, -0x0001403L, "-5123", "%d", -__LINE__, 0xffffff8aL, "ffffff8a", "%x", -__LINE__, -0x000010fL, "-271", "%1.ld", -__LINE__, 0xe573cc4aL, "E573CC4A", "%0X", -__LINE__, -0x0000d88L, "-3464", "%-d", -__LINE__, 0x0000000eL, "14", "%#ld", -__LINE__, -0x000345bL, "-13403", "%#d", -__LINE__, 0x00000602L, "602", "%+x", -__LINE__, 0x00000011L, "17", "%#d", -__LINE__, -0x0000002L, "-2", "%+d", -__LINE__, 0x030fe6e6L, "51373798", "%d", -__LINE__, 0x00000007L, "007", "%.3X", -__LINE__, 0x0001abe0L, "0X1ABE0", "%+#.4X", -__LINE__, 0xfffffdb7L, "fffffdb7", "%-6x", -__LINE__, 0xffffff8dL, "FFFFFF8D", "% 02.2X", -__LINE__, 0xfff12126L, "FFF12126", "%X", -__LINE__, 0x0208e32dL, "34136877", "%.2d", -__LINE__, 0x11c04b55L, "297814869", "%ld", -__LINE__, 0xff1e5ca3L, "0xff1e5ca3", "%#x", -__LINE__, 0xf9643f09L, "f9643f09", "%x", -__LINE__, -0x003c6daL, "-247514", "%4d", -__LINE__, 0xff69d0e7L, "FF69D0E7", "%-X", -__LINE__, 0x00006ae9L, "0x6ae9", "%#x", -__LINE__, -0x005aefeL, "-372478", "%d", -__LINE__, 0x0000000dL, "00013", "%3.5ld", -__LINE__, 0x00cc185cL, "CC185C", "%X", -__LINE__, 0x3dd14d9fL, "3DD14D9F", "%1.4X", -__LINE__, -0x4cc2ad3L, "-80489171", "%1.d", -__LINE__, 0xfffff79eL, "fffff79e", "%x", -__LINE__, 0xfffeeb03L, "fffeeb03", "%-1x", -__LINE__, -0x0b1b15cL, "-11645276", "%0ld", -__LINE__, -0x06b558dL, "-7034253", "%ld", -__LINE__, 0xfffffe61L, "fffffe61", "%x", -__LINE__, -0x0000002L, "-2", "%d", -__LINE__, -0x0000162L, "-000354", "%-5.6d", -__LINE__, 0x01a23780L, "27408256", "%d", -__LINE__, 0xffff3a9bL, "ffff3a9b", "% x", -__LINE__, 0xfffffdc7L, "0xfffffdc7", "%#4.5x", -__LINE__, 0x00000000L, "00", "%.2X", -__LINE__, -0x0000006L, "-6", "%0ld", -__LINE__, -0x16072c6L, "-23098054", "%#5ld", -__LINE__, -0x07152b8L, "-7426744", "%01ld", -__LINE__, 0x0000d6c6L, "0x0d6c6", "%#1.5x", -__LINE__, 0x00000f7cL, "000f7c", "%+04.6x", -__LINE__, 0x00000bd0L, "3024", "%4ld", -__LINE__, 0x0000295eL, "0x295e", "%#x", -__LINE__, 0x00002e38L, "11832", "%.5d", -__LINE__, -0xa2f5de4L, "-170876388", "%#d", -__LINE__, -0x001aa36L, "-109110", "%-#d", -__LINE__, 0x03012091L, "3012091", "%+2.5X", -__LINE__, -0x00009edL, "-002541", "%-0.6ld", -__LINE__, 0x0000001dL, "1d", "%x", -__LINE__, 0xffffe315L, "FFFFE315", "%+4X", -__LINE__, 0x0000716bL, "716B", "%X", -__LINE__, 0xfffb8315L, "0xfffb8315", "%+#x", -__LINE__, 0x00000132L, "132 ", "%-7.3x", -__LINE__, 0x00000000L, "+0000000", "%+1.7d", -__LINE__, 0xe16d27abL, "E16D27AB", "%X", -__LINE__, 0xffffffe5L, "ffffffe5", "%+x", -__LINE__, -0x000ab9dL, "-43933", "%ld", -__LINE__, 0xffd042d6L, "ffd042d6", "%2x", -__LINE__, 0xffffff9bL, "ffffff9b", "%x", -__LINE__, 0x000000fbL, "0xfb", "% #1.x", -__LINE__, 0x0000000fL, " 15", "%#3ld", -__LINE__, 0xfffba2d8L, "0XFFFBA2D8", "%-#0.X", -__LINE__, 0xfffffff8L, "0XFFFFFFF8", "% #X", -__LINE__, 0x00000000L, " ", "%4.ld", -__LINE__, 0x00000002L, "2", "%+x", -__LINE__, 0xfffff314L, "FFFFF314", "%-X", -__LINE__, 0x00000000L, " 0", "% ld", -__LINE__, -0x0000007L, "-07", "%3.2ld", -__LINE__, 0xffffdd80L, "FFFFDD80", "%.6X", -__LINE__, -0x000001bL, "-27", "%-ld", -__LINE__, -0x0000258L, "-600", "%-0d", -__LINE__, 0x00016377L, "16377", "%3X", -__LINE__, 0x00000001L, "1", "%X", -__LINE__, -0xac5d314L, "-180736788", "%d", -__LINE__, -0x000036eL, "-878", "% ld", -__LINE__, 0xfe346af4L, "fe346af4", "%.5x", -__LINE__, 0xffffffe1L, "ffffffe1", "%-7.6x", -__LINE__, -0x0a1df07L, "-10608391", "%#.5d", -__LINE__, 0x000000c9L, " 0XC9", "%+#5.X", -__LINE__, 0xfffffffeL, "fffffffe", "%x", -__LINE__, 0xfffffff8L, "fffffff8", "%+x", -__LINE__, -0x4517255L, "-72446549", "%.6ld", -__LINE__, 0xfffa3670L, "FFFA3670", "%-6X", -__LINE__, 0xffffffe0L, "ffffffe0", "%2.x", -__LINE__, 0xffffffffL, "ffffffff", "%0x", -__LINE__, 0x0000230dL, "8973", "%#.1d", -__LINE__, 0x00000238L, "238", "%0X", -__LINE__, 0xfffce5abL, "FFFCE5AB", "%-X", -__LINE__, 0x0000002cL, "2C", "%X", -__LINE__, 0x00000001L, " 1", "%4.ld", -__LINE__, 0xffffff8dL, "FFFFFF8D", "%-X", -__LINE__, 0x00069c69L, "433257", "%06d", -__LINE__, 0xfffffb8dL, "0xfffffb8d", "%#x", -__LINE__, 0x000d6a2dL, "879149", "%5.5d", -__LINE__, -0x0001fcbL, " -8139", "%7.ld", -__LINE__, 0xfff86937L, "fff86937", "%-0x", -__LINE__, 0x00059cf9L, "367865", "%#.0ld", -__LINE__, 0x02c5d87aL, "46520442", "%3.ld", -__LINE__, 0x00000571L, "1393", "%ld", -__LINE__, 0x0003c73fL, "+247615", "%+4ld", -__LINE__, 0x0000004fL, "4f", "% 0x", -__LINE__, 0x00000000L, "0", "%-ld", -__LINE__, -0x0e5850fL, "-15041807", "% ld", -__LINE__, -0x0000002L, " -0002", "%7.4d", -__LINE__, 0xfffffd1bL, "fffffd1b", "%05x", -__LINE__, 0x0000041cL, " 1052", "% #0.ld", -__LINE__, -0x0000030L, "-48", "%d", -__LINE__, -0x0013593L, "-79251", "% #d", -__LINE__, 0x00000001L, "1", "%+X", -__LINE__, 0x0000056bL, " 56b", "%4.x", -__LINE__, -0x0000004L, "-4 ", "%-3d", -__LINE__, -0x0000003L, "-3", "% ld", -__LINE__, 0xffff7c14L, "0XFFFF7C14", "%#X", -__LINE__, 0x02f63dd8L, "49692120", "%.7ld", -__LINE__, -0x03c51c9L, "-3953097", "%+d", -__LINE__, 0x00ded685L, "14603909", "%5.ld", -__LINE__, 0xffffffbaL, "ffffffba", "%x", -__LINE__, 0x000370e8L, "225512", "%#ld", -__LINE__, 0x00000003L, "3", "%X", -__LINE__, -0x0024a64L, "-150116", "%7.d", -__LINE__, 0xff486ca1L, "ff486ca1", "%x", -__LINE__, 0x000001cfL, "1CF", "% X", -__LINE__, -0x0002d7eL, "-11646", "%-0d", -__LINE__, 0x0a594c65L, "a594c65", "%.4x", -__LINE__, -0x0000002L, "-0002", "%-5.4ld", -__LINE__, 0x00000000L, "", "%00.ld", -__LINE__, 0x00058bc4L, "58BC4", "%3X", -__LINE__, 0x0002cf8eL, " 184206", "% 0ld", -__LINE__, 0x000009c7L, "+2503", "%+4.ld", -__LINE__, 0xed0c984dL, "ED0C984D", "%X", -__LINE__, -0x0000058L, "-088", "%#.3ld", -__LINE__, 0x0076083dL, "0X76083D", "%#6X", -__LINE__, -0x0000001L, "-1", "%#d", -__LINE__, -0x6bf1777L, "-113186679", "%#ld", -__LINE__, -0x000011fL, "-287", "%ld", -__LINE__, 0x001b0e7dL, "1B0E7D", "%-4X", -__LINE__, 0x000007acL, " 1964", "%5.ld", -__LINE__, 0x00000005L, "5", "%0.d", -__LINE__, -0x00003baL, "-954", "%4.0ld", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%X", -__LINE__, 0x00000019L, "19", "%x", -__LINE__, 0xffffffe0L, "ffffffe0", "%-.6x", -__LINE__, 0x0000012aL, " 298", "% d", -__LINE__, 0x00002c74L, "2c74", "% 4.3x", -__LINE__, 0x000002d5L, "725", "%d", -__LINE__, 0x0001c9a9L, "1c9a9", "%-02x", -__LINE__, 0xffc928c8L, "ffc928c8", "%x", -__LINE__, -0x03ae51fL, "-3859743", "% #ld", -__LINE__, 0x0000526dL, "526d", "%x", -__LINE__, -0x00028f0L, "-10480", "%5ld", -__LINE__, -0x49b4262L, "-77283938", "%+02.0d", -__LINE__, 0x028d37f0L, "0x28d37f0", "%+#x", -__LINE__, 0xd66e0af9L, "D66E0AF9", "%03.X", -__LINE__, -0x00c7707L, "-816903", "%0d", -__LINE__, -0x00000d0L, "-208", "%-.1ld", -__LINE__, 0x0000c328L, "49960", "%d", -__LINE__, 0x34cb86f1L, "34CB86F1", "%X", -__LINE__, 0x000000f6L, "F6", "%+X", -__LINE__, 0x0a3407ecL, "0xa3407ec", "%-#x", -__LINE__, 0x00007ebcL, "32444", "%#3.d", -__LINE__, 0xfffd3d65L, "fffd3d65", "%x", -__LINE__, 0x0007bc82L, "0507010", "%0.7d", -__LINE__, 0x0005bb93L, "375699", "%ld", -__LINE__, 0x0ec11cc8L, "0XEC11CC8", "%+#6.2X", -__LINE__, 0xfffff9c6L, "fffff9c6", "%.5x", -__LINE__, 0xff05ab70L, "0XFF05AB70", "%-#.3X", -__LINE__, 0x2328b716L, "589870870", "%d", -__LINE__, 0x00001a79L, "6777", "%.1d", -__LINE__, 0xfffee573L, "fffee573", "%0.1x", -__LINE__, -0x0000929L, " -2345", "%7.d", -__LINE__, 0xffffff9aL, "FFFFFF9A", "%2.X", -__LINE__, 0xfffffe60L, "fffffe60", "%.5x", -__LINE__, 0xfffffcd2L, "fffffcd2", "%.7x", -__LINE__, 0x00000001L, " 001", "%6.3X", -__LINE__, 0x00011e9cL, "+73372", "%+0ld", -__LINE__, 0x0000002aL, "2a", "% x", -__LINE__, 0xffffffffL, "ffffffff", "%.7x", -__LINE__, -0x0008ee8L, "-36584", "%ld", -__LINE__, 0x0000001cL, "28", "%-d", -__LINE__, 0x000abedaL, "704218", "%d", -__LINE__, 0x001347f7L, "1347f7", "%3.0x", -__LINE__, 0x0000023eL, "574", "%3.3ld", -__LINE__, 0x00000000L, "0", "%-ld", -__LINE__, -0x0016de0L, "-93664", "%0ld", -__LINE__, 0xffffff45L, "FFFFFF45", "% X", -__LINE__, 0x02dfb08cL, "48214156", "%#ld", -__LINE__, 0x003d73a2L, "3d73a2", "%6.x", -__LINE__, 0x00147da7L, "1342887", "%#d", -__LINE__, -0x5ff0f1eL, "-100601630", "%-01ld", -__LINE__, -0x000000bL, "-11", "%ld", -__LINE__, 0x00000168L, " 168", "%+6.x", -__LINE__, 0xffffc28eL, "ffffc28e", "%0x", -__LINE__, -0x00003a2L, "-930", "%ld", -__LINE__, 0x0002e56fL, " 189807", "% 1.ld", -__LINE__, 0x51abf44fL, "0x51abf44f", "%#.7x", -__LINE__, 0x00000000L, "0", "%d", -__LINE__, 0x9581268fL, "9581268F", "%+X", -__LINE__, 0xffffff3bL, "FFFFFF3B", "%X", -__LINE__, 0x000083d4L, " 33748", "% #d", -__LINE__, 0x00000001L, "1", "%x", -__LINE__, -0x000e51fL, "-58655", "%.0ld", -__LINE__, 0x0003eacbL, "256715", "%6ld", -__LINE__, 0x02be09dbL, " 46008795", "% 0.ld", -__LINE__, 0xfffffffbL, "FFFFFFFB", "% X", -__LINE__, 0x000084f5L, " 34037", "%6ld", -__LINE__, -0x1127f99L, "-17989529", "%#d", -__LINE__, 0x5f6512deL, "5f6512de", "%.7x", -__LINE__, 0x00000001L, "1", "%x", -__LINE__, 0xfff74ab5L, "fff74ab5", "%x", -__LINE__, 0x0eebeb94L, "250342292", "%4.ld", -__LINE__, 0x0001b846L, "0x1b846", "%#1x", -__LINE__, 0x001e8c32L, "1E8C32", "%2X", -__LINE__, -0x0dae932L, "-14346546", "%5.1d", -__LINE__, 0x00000001L, "1", "%ld", -__LINE__, -0x0000042L, "-66", "%ld", -__LINE__, 0xffffff51L, "FFFFFF51", "%0.1X", -__LINE__, 0x00000043L, "43", "%x", -__LINE__, 0x04c21f39L, " 79830841", "% 0ld", -__LINE__, 0x0000061eL, "1566", "%03.3d", -__LINE__, -0x0000003L, "-3", "%+d", -__LINE__, 0x015b32dbL, " 22754011", "% .4d", -__LINE__, 0xfffff181L, "FFFFF181", "%-X", -__LINE__, 0x000017ecL, "0X17EC", "%#X", -__LINE__, 0x000d703eL, "880702", "%#ld", -__LINE__, -0x6d7533a0L, "-1836397472", "%ld", -__LINE__, 0x0000008aL, " 138", "% d", -__LINE__, -0x7368794bL, "-1936226635", "%+#d", -__LINE__, 0x0000000dL, "0XD", "%#X", -__LINE__, 0x0000030dL, "30D", "% X", -__LINE__, 0xfffff9feL, "FFFFF9FE", "%5X", -__LINE__, 0x00001bb2L, "7090", "%d", -__LINE__, 0x041d2a0cL, "41D2A0C", "%0X", -__LINE__, 0x00012aeeL, " 76526", "% d", -__LINE__, 0x0000055fL, "55f", "%.1x", -__LINE__, 0xffffffffL, "0XFFFFFFFF", "%#1X", -__LINE__, 0x07b0a971L, "+129018225", "%+.2ld", -__LINE__, 0xfffffff8L, "FFFFFFF8", "%4X", -__LINE__, 0x00000001L, "1", "%d", -__LINE__, 0x00000038L, "+56", "%+2ld", -__LINE__, 0xfffffc2fL, "fffffc2f", "%+7.x", -__LINE__, 0x00004477L, "0x4477", "% #x", -__LINE__, 0x0000000dL, "0XD", "%+#3X", -__LINE__, 0xf5bf37b1L, "F5BF37B1", "%1.X", -__LINE__, 0x1a96f431L, "446100529", "%d", -__LINE__, 0x0037edf3L, "+3665395", "%+#4.5ld", -__LINE__, 0x0007f2aaL, "520874", "%0ld", -__LINE__, -0x00051a3L, "-20899", "%+#1.ld", -__LINE__, 0x0000037fL, "37F", "%0X", -__LINE__, 0xffffffb4L, "ffffffb4", "%x", -__LINE__, -0xd984c00L, "-228084736", "%+06ld", -__LINE__, 0xffffe1beL, "FFFFE1BE", "%X", -__LINE__, 0xfff20d48L, "FFF20D48", "%+6.0X", -__LINE__, 0x000028b7L, "0x028b7", "%-#7.5x", -__LINE__, -0x0000001L, "-1", "%ld", -__LINE__, 0x03f37945L, "66287941", "%d", -__LINE__, 0xffffffedL, "0XFFFFFFED", "%+#6.4X", -__LINE__, 0x0000f046L, "f046", "%x", -__LINE__, 0xe9772b51L, "E9772B51", "%-1.X", -__LINE__, 0xfffffffeL, "fffffffe", "% x", -__LINE__, 0xfffffffaL, "0xfffffffa", "%#x", -__LINE__, 0x00000015L, "15", "%-X", -__LINE__, 0x0000003cL, "60", "%#ld", -__LINE__, 0x3103952dL, "822318381", "%0.ld", -__LINE__, 0x17ba68bbL, "398092475", "%2d", -__LINE__, 0x000006c4L, "+1732", "%+.2d", -__LINE__, 0x00000043L, "67", "%#d", -__LINE__, 0x0043fb55L, "4455253", "%.1ld", -__LINE__, 0x00004b76L, "4b76", "% 0x", -__LINE__, 0xfff4c56bL, "FFF4C56B", "%7X", -__LINE__, 0x00766055L, "766055", "%+5x", -__LINE__, -0x000009fL, "-159", "%+d", -__LINE__, 0xffff063fL, "ffff063f", "%-2x", -__LINE__, 0x00808fc8L, "808fc8", "%x", -__LINE__, 0xffffffffL, "ffffffff", "%x", -__LINE__, 0x000000f1L, "00000f1", "%+02.7x", -__LINE__, 0x00000002L, "2", "%X", -__LINE__, 0x00000000L, "000", "%03d", -__LINE__, 0xe63f73b2L, "E63F73B2", "% 1X", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%5.1X", -__LINE__, 0x0d3fa38bL, "222274443", "%1d", -__LINE__, 0x00000000L, "0", "% X", -__LINE__, 0x00000001L, " 1", "%04.ld", -__LINE__, 0x00000046L, "46", "%0X", -__LINE__, 0x0000761fL, " 30239", "% ld", -__LINE__, -0x0002517L, "-9495", "%+d", -__LINE__, 0x00000156L, "156", "% 0x", -__LINE__, 0x1c55eba2L, "1c55eba2", "%.6x", -__LINE__, 0x005af80dL, "5af80d", "%.6x", -__LINE__, 0x0000002eL, "46", "%d", -__LINE__, -0x0007c0fL, "-31759", "%ld", -__LINE__, 0xffffe924L, "FFFFE924", "%7X", -__LINE__, 0x00000174L, "372", "%ld", -__LINE__, 0xffffffc9L, "0xffffffc9", "%-#x", -__LINE__, 0x00000020L, "+000032", "%+07d", -__LINE__, 0xffffe5d9L, "FFFFE5D9", "%4.5X", -__LINE__, 0xffffffa3L, "FFFFFFA3", "%+.3X", -__LINE__, 0x00000a03L, "+2563", "%+2d", -__LINE__, 0x001b58caL, "+1792202", "%+4d", -__LINE__, 0xffffffc9L, "0xffffffc9", "%+#5x", -__LINE__, -0x0000003L, "-3", "% d", -__LINE__, 0xfffffffcL, "fffffffc", "%+0x", -__LINE__, -0x0000002L, "-02", "%.2d", -__LINE__, 0x000243fbL, "148475", "%-ld", -__LINE__, 0x00000001L, "1", "%0d", -__LINE__, -0x0000672L, "-1650", "%ld", -__LINE__, -0x0005413L, "-0021523", "% 7.7d", -__LINE__, 0x00000017L, "0X17", "%#X", -__LINE__, 0x00000e48L, "3656", "%0d", -__LINE__, 0xffe79b38L, "ffe79b38", "%-x", -__LINE__, 0xffffff15L, "FFFFFF15", "%+6.1X", -__LINE__, 0xfff0272cL, "fff0272c", "%-.5x", -__LINE__, -0x00b706fL, "-749679", "%1.ld", -__LINE__, 0x0176aeecL, "176AEEC", "%.1X", -__LINE__, -0x00005a1L, "-1441", "% 0ld", -__LINE__, -0x0000002L, "-00002", "%.5d", -__LINE__, -0xd2e6f5dL, "-221146973", "%1ld", -__LINE__, -0x0000001L, " -001", "%5.3ld", -__LINE__, 0x00000001L, " 1", "%05.ld", -__LINE__, 0x0000749eL, "+29854", "%+#d", -__LINE__, 0x00000005L, "5", "%d", -__LINE__, 0xfa7128b0L, "fa7128b0", "%1.x", -__LINE__, 0xffffbbb4L, "0XFFFFBBB4", "%#.1X", -__LINE__, 0x0006862fL, "427567", "%d", -__LINE__, 0x00000002L, "2", "%X", -__LINE__, 0x000005d4L, "5d4", "% x", -__LINE__, 0x001387e1L, "1279969", "%-05.0ld", -__LINE__, -0x0035a56L, "-219734", "%ld", -__LINE__, -0x4064ecc6L, "-1080356038", "%ld", -__LINE__, 0x0000360dL, "13837", "%0ld", -__LINE__, -0xea1a85bL, "-245475419", "%-.2ld", -__LINE__, 0xffffff2dL, "FFFFFF2D", "%X", -__LINE__, 0x00000004L, " 0004", "%7.4x", -__LINE__, 0x00f72ffdL, "F72FFD", "%-X", -__LINE__, 0x00000fa2L, "fa2 ", "%-5x", -__LINE__, 0x05ae1f9aL, "95297434", "%#ld", -__LINE__, 0x0000bf2eL, "48942", "%3.d", -__LINE__, 0x00000000L, " ", "%1.X", -__LINE__, 0x01bcb097L, "29143191", "%ld", -__LINE__, 0x0000009cL, "156 ", "%-4.0d", -__LINE__, 0xfffffffeL, "fffffffe", "% x", -__LINE__, 0x00000001L, "1 ", "%-6.d", -__LINE__, 0xffffffefL, "ffffffef", "%7.x", -__LINE__, 0xfffffec1L, "fffffec1", "%.5x", -__LINE__, -0x000000fL, "-15", "%-1d", -__LINE__, -0x0008426L, "-33830", "%0ld", -__LINE__, 0x005be0aeL, "5BE0AE", "% X", -__LINE__, 0x00000009L, " 9", "%+7X", -__LINE__, -0x0007e18L, "-32280", "%+0.d", -__LINE__, 0x01697ba1L, " 23690145", "% 5.ld", -__LINE__, -0x0012042L, "-073794", "%7.6d", -__LINE__, 0x04e9bd0dL, "4e9bd0d", "%-2x", -__LINE__, 0xffffffd9L, "FFFFFFD9", "%.2X", -__LINE__, -0x01b9632L, "-1807922", "%.6ld", -__LINE__, 0x000000cdL, "205", "%1.ld", -__LINE__, 0x00000000L, " ", "% .0d", -__LINE__, 0xff17bbb1L, "ff17bbb1", "%x", -__LINE__, -0x00146d7L, "-83671", "%+1.ld", -__LINE__, 0xfffff144L, "fffff144", "%x", -__LINE__, 0x000f8dbeL, "F8DBE", "%3.X", -__LINE__, -0x000381cL, "-14364", "%d", -__LINE__, 0x0000001eL, " 30", "%4.1d", -__LINE__, 0x00000016L, "22", "%-0d", -__LINE__, 0x00000002L, "+02", "%+1.2ld", -__LINE__, 0x0000e803L, "59395", "%d", -__LINE__, 0xb4c2448dL, "b4c2448d", "%-7x", -__LINE__, 0x000e697dL, "944509", "%ld", -__LINE__, 0xfffe6e32L, "0XFFFE6E32", "%#X", -__LINE__, 0x00000190L, " 190", "%+5.X", -__LINE__, -0x03a2219L, "-3809817", "%#6.ld", -__LINE__, -0x000003cL, "-60 ", "%-#4.ld", -__LINE__, 0x00000000L, " ", "% 03.ld", -__LINE__, -0x074f922L, "-7665954", "%ld", -__LINE__, -0x00000f0L, "-240", "%-ld", -__LINE__, 0xfffe42d2L, "0XFFFE42D2", "%#X", -__LINE__, 0x000000ddL, "DD", "%X", -__LINE__, 0x00359abeL, "359ABE", "%.1X", -__LINE__, 0xffec7bdfL, "FFEC7BDF", "%0.1X", -__LINE__, 0x0ecddcbaL, "248372410", "%-#3.d", -__LINE__, 0x00ad0dbcL, "11341244", "%ld", -__LINE__, -0x0000001L, "-1", "%-d", -__LINE__, 0x00050841L, "50841", "% .5x", -__LINE__, 0x01d359e7L, "1d359e7", "%1.x", -__LINE__, 0xff9efaa3L, "FF9EFAA3", "%X", -__LINE__, 0x0007ea10L, "+518672", "%+ld", -__LINE__, -0x000671cL, "-26396", "%1d", -__LINE__, 0xffffff91L, "0xffffff91", "%#4.4x", -__LINE__, 0x00000000L, "+", "%+0.0ld", -__LINE__, -0x002c53eL, "-181566", "%3.d", -__LINE__, 0xffffff56L, "ffffff56", "%x", -__LINE__, 0xfffff589L, "FFFFF589", "%+X", -__LINE__, 0x00024d13L, "24D13", "%-5.2X", -__LINE__, 0x00000000L, " 0", "%6.1d", -__LINE__, 0x00a64f33L, "A64F33", "%4.4X", -__LINE__, 0xffebb57aL, "FFEBB57A", "%5.4X", -__LINE__, 0xfff3b4a0L, "fff3b4a0", "%2.x", -__LINE__, 0xffffffd9L, "FFFFFFD9", "%.2X", -__LINE__, 0x00d37b84L, "13859716", "%d", -__LINE__, 0x00001e85L, "0001E85", "%0.7X", -__LINE__, -0x756148fL, "-123081871", "% 7.d", -__LINE__, -0x0319339L, "-3248953", "%+#.4d", -__LINE__, -0x00798b8L, "-497848", "%#5ld", -__LINE__, -0x0000039L, "-57", "%0d", -__LINE__, -0x000b1d7L, "-45527", "%+0.ld", -__LINE__, 0xff811fbaL, "FF811FBA", "%+X", -__LINE__, 0x00000042L, " 66", "% ld", -__LINE__, 0xfffffe31L, "0XFFFFFE31", "%#X", -__LINE__, 0x00000073L, "115", "%ld", -__LINE__, 0x45091a39L, "0x45091a39", "%+#3.x", -__LINE__, 0x001270f5L, "1270f5", "%-5.6x", -__LINE__, 0xfffd91fdL, "fffd91fd", "%x", -__LINE__, -0x0817badL, "-8485805", "%#ld", -__LINE__, -0x32ad55fL, "-53138783", "%0d", -__LINE__, 0x00003e57L, "15959", "%0ld", -__LINE__, -0x0048756L, "-296790", "%2.6d", -__LINE__, 0xff90f45fL, "FF90F45F", "% X", -__LINE__, 0x0000e454L, "0e454", "% .5x", -__LINE__, 0xfffffffcL, "fffffffc", "%x", -__LINE__, 0xfffffff7L, "FFFFFFF7", "%-2X", -__LINE__, 0xffdabf0eL, "FFDABF0E", "%+X", -__LINE__, 0xffffffffL, "0XFFFFFFFF", "%#1X", -__LINE__, 0x01516650L, "1516650", "% x", -__LINE__, 0xffffff51L, "FFFFFF51", "%X", -__LINE__, 0x000000eaL, "234", "%00.d", -__LINE__, 0x06db60caL, "115040458", "%5.d", -__LINE__, 0x00000f01L, " 3841", "% d", -__LINE__, 0x00000009L, "9", "%x", -__LINE__, 0x299b3ba0L, "299b3ba0", "%6.7x", -__LINE__, 0x0067f298L, "67f298", "%-2.6x", -__LINE__, 0xfffffff5L, "FFFFFFF5", "% 2X", -__LINE__, 0x00102ff9L, "102FF9", "%-.0X", -__LINE__, 0xffc22393L, "0xffc22393", "% #6x", -__LINE__, 0x00007db5L, "32181", "%-2ld", -__LINE__, 0x0000b0a3L, "0xb0a3", "%#0x", -__LINE__, 0x001ceebbL, "1CEEBB", "%-3.4X", -__LINE__, 0x00025101L, "0x25101", "%#x", -__LINE__, -0x0000001L, "-1", "%0ld", -__LINE__, 0xffffd846L, "FFFFD846", "%+2.3X", -__LINE__, 0x00001d79L, " 7545", "% 0.1ld", -__LINE__, -0x0000002L, " -2", "%5d", -__LINE__, 0xf93b9fdcL, "f93b9fdc", "%5x", -__LINE__, 0xffff0021L, "FFFF0021", "%6X", -__LINE__, 0x00007cf9L, "7cf9", "%3.1x", -__LINE__, -0x0000002L, "-2", "%d", -__LINE__, 0x00001d84L, "1d84", "%0x", -__LINE__, -0x033201eL, "-3350558", "%-2.0d", -__LINE__, 0xfff8a6fbL, "FFF8A6FB", "%+.7X", -__LINE__, 0x00006fffL, " 28671", "% ld", -__LINE__, -0x02a274aL, "-2762570", "%d", -__LINE__, -0x0006628L, "-26152", "%00ld", -__LINE__, 0x00000011L, "11", "%-x", -__LINE__, -0x0000ed9L, "-3801", "%0.ld", -__LINE__, 0xfc5b725dL, "FC5B725D", "%X", -__LINE__, 0x3530bd4eL, "892386638", "%7.d", -__LINE__, 0x03bb4ff7L, "62607351", "%#4.7ld", -__LINE__, 0x00009f86L, "9f86", "%x", -__LINE__, 0x0000e727L, "59175", "%1d", -__LINE__, 0xfffffdf2L, "0XFFFFFDF2", "%#X", -__LINE__, 0x00e60dbfL, "0XE60DBF", "% #1.X", -__LINE__, 0xffffffffL, "FFFFFFFF", "%+X", -__LINE__, 0x0a16f44eL, "0XA16F44E", "%#.0X", -__LINE__, 0x0001f97cL, "1f97c", "% x", -__LINE__, 0x0000000dL, "13", "%#0ld", -__LINE__, 0x0000002aL, "42", "%0ld", -__LINE__, 0x00000007L, " +7", "%+5ld", -__LINE__, 0xffffff7fL, "FFFFFF7F", "%-X", -__LINE__, 0x000006a6L, "1702", "%ld", -__LINE__, 0xfaff2fb1L, "faff2fb1", "% x", -__LINE__, 0xffff94abL, "ffff94ab", "%x", -__LINE__, 0x011d611bL, "0X11D611B", "%#2.3X", -__LINE__, 0x00000000L, " +000", "%+#5.3ld", -__LINE__, -0x87fcc37L, "-142593079", "%+d", -__LINE__, -0x0417424L, "-4289572", "%+d", -__LINE__, 0x03fabc0cL, "3fabc0c", "%x", -__LINE__, 0xfffff880L, "fffff880", "%-x", -__LINE__, 0x000002d7L, "2d7", "%-02.x", -__LINE__, 0x00003e82L, "16002", "%#d", -__LINE__, -0x0003713L, "-14099", "% 5d", -__LINE__, -0x0000027L, "-39", "%ld", -__LINE__, 0x00013098L, "0077976", "%01.7d", -__LINE__, -0x000000cL, "-12", "%ld", -__LINE__, -0x00000c0L, "-192", "% ld", -__LINE__, 0xffbe9285L, "FFBE9285", "%3.X", -__LINE__, 0x00000046L, "46", "%x", -__LINE__, 0x00000000L, " ", "%+4.x", -__LINE__, 0x00011e72L, "73330", "%2.3d", -__LINE__, -0x5276dd7L, "-86470103", "%d", -__LINE__, 0x00000013L, "19", "%-02.ld", -__LINE__, 0x384118a7L, "0X384118A7", "%-#X", -__LINE__, 0x00000000L, "0", "% #X", -__LINE__, 0x00000009L, "9", "%#ld", -__LINE__, 0x00021145L, "135493", "%-ld", -__LINE__, 0xff188a0cL, "FF188A0C", "%1.X", -__LINE__, 0xffffffd5L, "ffffffd5", "%0x", -__LINE__, 0xfffffffeL, "FFFFFFFE", "% 0X", -__LINE__, 0xffff74a3L, "ffff74a3", "%x", -__LINE__, 0x01d5a2f8L, "1d5a2f8", "%-0.x", -__LINE__, 0xfffffef6L, "fffffef6", "%+06.x", -__LINE__, 0x00000001L, "1", "%ld", -__LINE__, 0x00000000L, "+0", "%+ld", -__LINE__, 0xfffffffcL, "fffffffc", "%4.x", -__LINE__, -0x0000344L, "-0836", "% .4d", -__LINE__, 0xfffffffdL, "FFFFFFFD", "%0X", -__LINE__, 0x000a3121L, "667937", "%#4.4ld", -__LINE__, 0x0001e211L, "0X1E211", "%#X", -__LINE__, 0x00000c8bL, "00C8B", "%05X", -__LINE__, 0xfffffffeL, "fffffffe", "%+0x", -__LINE__, 0x001a53ceL, "1725390", "%d", -__LINE__, 0x0000057fL, "57f ", "%-7.x", -__LINE__, -0x0073e4dL, "-474701", "%#ld", -__LINE__, -0x0000002L, " -2", "% 3.d", -__LINE__, 0x482dc404L, "482DC404", "%X", -__LINE__, 0x0000011cL, "11c", "%-.1x", -__LINE__, 0x00000c12L, " 3090", "%5.3ld", -__LINE__, 0xfffe1068L, "FFFE1068", "%-.4X", -__LINE__, -0x0055e88L, "-351880", "%ld", -__LINE__, 0x000c9cefL, "+826607", "%+d", -__LINE__, 0xffffffe3L, "ffffffe3", "%0x", -__LINE__, -0x0000ee9L, "-3817", "%#ld", -__LINE__, 0xff1f6daaL, "FF1F6DAA", "%X", -__LINE__, 0xfffffc4eL, "FFFFFC4E", "%5.2X", -__LINE__, -0x000040aL, "-1034", "%d", -__LINE__, -0x0000085L, "-00133", "% 01.5d", -__LINE__, -0x126c797cL, "-309098876", "%5.ld", -__LINE__, 0x00000039L, " 57", "% d", -__LINE__, 0xfffffff6L, "0xfffffff6", "%#5.x", -__LINE__, 0xfffffff4L, "fffffff4", "%7.6x", -__LINE__, 0x00000003L, "3", "%ld", -__LINE__, 0x0000f8aeL, "f8ae", "%.0x", -__LINE__, 0x003ca1cfL, "3973583", "%#3.7d", -__LINE__, 0x14687009L, "0x14687009", "%+#3x", -__LINE__, 0xfffff1f7L, "0xfffff1f7", "%#4.5x", -__LINE__, 0xfffff17aL, "fffff17a", "%3.x", -__LINE__, 0x0011ea18L, "1174040", "%ld", -__LINE__, -0x0000019L, "-25", "%03.d", -__LINE__, 0x00015d72L, "0X15D72", "%-#X", -__LINE__, 0xffde4a41L, "ffde4a41", "%x", -__LINE__, 0x00006f1fL, "28447", "%d", -__LINE__, 0xffffffbdL, "0xffffffbd", "%#.1x", -__LINE__, 0x000013b9L, "13B9", "%0X", -__LINE__, -0x00001b9L, "-00441", "%1.5d", -__LINE__, 0x00000001L, "000001", "%-.6d", -__LINE__, 0x7b602d8fL, "+2069900687", "%+0ld", -__LINE__, 0x0005e323L, "+385827", "%+ld", -__LINE__, 0x00002fceL, "2FCE", "%+0X", -__LINE__, 0x0000000eL, "0014", "%.4d", -__LINE__, 0xffffffd6L, "0XFFFFFFD6", "%#4.X", -__LINE__, 0x037bf361L, "58454881", "%5.ld", -__LINE__, 0xffffffffL, "FFFFFFFF", "%-7.5X", -__LINE__, -0x016d4dcL, "-1496284", "%6ld", -__LINE__, 0x0005be9aL, "0x5be9a", "%-#.5x", -__LINE__, 0xffffffffL, "ffffffff", "%1x", -__LINE__, 0x00000055L, " 85", "% 7.d", -__LINE__, 0xffffffffL, "ffffffff", "%x", -__LINE__, -0x0135392L, "-1266578", "% ld", -__LINE__, 0x00850f26L, "8720166", "%d", -__LINE__, 0xffffee39L, "ffffee39", "%0x", -__LINE__, 0x000000ddL, "221", "%ld", -__LINE__, 0x00000000L, " ", "%6.d", -__LINE__, 0x000000d8L, "d8", "%x", -__LINE__, 0x000007ecL, "002028", "%4.6ld", -__LINE__, 0x0dab4e67L, "0XDAB4E67", "%#X", -__LINE__, 0xfffd7c95L, "FFFD7C95", "% 4X", -__LINE__, 0x0009302dL, "9302D", "%3.1X", -__LINE__, 0x00000003L, " 3", "% d", -__LINE__, 0x0000082fL, "82f", "%-x", -__LINE__, 0x0652517fL, "652517F", "%-.2X", -__LINE__, -0x1fd8f4e3L, "-534312163", "%d", -__LINE__, 0x00000176L, "176", "%-x", -__LINE__, 0x00000001L, "1", "%ld", -__LINE__, 0x0000001aL, "1A", "%X", -__LINE__, -0x0005740L, "-22336", "% 0ld", -__LINE__, 0xffffffffL, "ffffffff", "%6x", -__LINE__, 0x1b273b80L, "0x1b273b80", "%#x", -__LINE__, 0x00000065L, "65", "%X", -__LINE__, 0x6a62138aL, "1784812426", "%2ld", -__LINE__, 0x000001a2L, "1A2", "%X", -__LINE__, -0x002aafdL, "-174845", "%02.ld", -__LINE__, 0x00000014L, "20", "%d", -__LINE__, -0x00000c7L, " -199", "%7.0ld", -__LINE__, 0xff545bfdL, "ff545bfd", "%-x", -__LINE__, -0x002beb9L, "-179897", "%02.2ld", -__LINE__, -0x00000dfL, "-223", "% 02.d", -__LINE__, -0x000d569L, "-54633", "%1.ld", -__LINE__, 0x0000000eL, "14", "%d", -__LINE__, -0x0077407L, "-488455", "% ld", -__LINE__, 0x0001be09L, "114185", "%ld", -__LINE__, -0x0000514L, "-01300", "%+05.5d", -__LINE__, 0xf1fb397fL, "f1fb397f", "%+x", -__LINE__, 0xfdb6707cL, "FDB6707C", "%X", -__LINE__, 0x03cad111L, "3cad111", "%5.x", -__LINE__, -0x022e72fL, "-2287407", "%d", -__LINE__, -0xda35f48L, "-228810568", "%d", -__LINE__, -0x02d1fd4L, "-2957268", "%1.3d", -__LINE__, 0x0000005fL, "+95", "%+2d", -__LINE__, 0xfffbf8a1L, "FFFBF8A1", "%4.2X", -__LINE__, 0x0000071eL, " 71e", "%6.x", -__LINE__, 0x000cc8a5L, "+837797", "%+03ld", -__LINE__, 0x000eebe9L, " EEBE9", "%6.X", -__LINE__, -0x2896b204L, "-680964612", "%d", -__LINE__, -0x09553f8L, "-9786360", "%d", -__LINE__, 0x000015d3L, "5587", "%0d", -__LINE__, 0x0000056dL, " 56d", "%+4.x", -__LINE__, -0x00624adL, "-402605", "% ld", -__LINE__, 0xfea64ba5L, "0xfea64ba5", "%#1x", -__LINE__, 0x004f35c6L, "5191110", "%-ld", -__LINE__, -0x1441fe4L, "-21241828", "%d", -__LINE__, 0xffffff95L, "FFFFFF95", "%X", -__LINE__, 0xfffecf81L, "FFFECF81", "%-2.X", -__LINE__, -0x00002bbL, "-699", "%-d", -__LINE__, -0x0000c29L, "-3113", "% 02ld", -__LINE__, 0x000026a3L, " 9891", "% .4d", -__LINE__, 0x00000003L, "3", "%-x", -__LINE__, 0x000007dbL, "+02011", "%+.5ld", -__LINE__, 0xfff99558L, "FFF99558", "%.1X", -__LINE__, 0x0000fce6L, "64742", "%4.0d", -__LINE__, 0x000b7ea2L, "753314", "%ld", -__LINE__, 0x13e5df30L, "0X13E5DF30", "%#2.X", -__LINE__, 0x006761c4L, "06761C4", "%6.7X", -__LINE__, 0xffffff78L, "FFFFFF78", "%0.X", -__LINE__, 0xfffff1c0L, "0xfffff1c0", "% #x", -__LINE__, -0x034af1cL, "-3452700", "% 06.1d", -__LINE__, 0x000000deL, "0000222", "%2.7ld", -__LINE__, 0x000003d8L, "0x3d8", "%#4.x", -__LINE__, -0x001a1d1L, "-106961", "%3.1d", -__LINE__, -0x0000002L, "-2", "% d", -__LINE__, 0x00001de6L, "+7654", "%+0ld", -__LINE__, 0x00000001L, "001", "%#.3d", -__LINE__, -0x53dacf9fL, "-1406848927", "%ld", -__LINE__, 0xfffffffcL, "fffffffc", "%3.3x", -__LINE__, -0x00950e8L, "-610536", "%3.6ld", -__LINE__, 0xff14ade9L, "FF14ADE9", "%6X", -__LINE__, 0x012f5284L, "0X12F5284", "% #5X", -__LINE__, 0x00005a21L, " 5a21", "%5x", -__LINE__, 0x00000638L, "1592", "%2.4ld", -__LINE__, -0x063017bL, "-6488443", "%ld", -__LINE__, 0x00000000L, "0", "% X", -__LINE__, 0xfffe8ef2L, "FFFE8EF2", "%+0X", -__LINE__, -0x0001c96L, "-7318", "%.3d", -__LINE__, 0x0000ca7dL, "51837", "%ld", -__LINE__, 0x00000001L, "1", "%+1x", -__LINE__, 0xfffff7bcL, "FFFFF7BC", "%X", -__LINE__, -0x03d15e2L, "-4003298", "%ld", -__LINE__, 0xfffffffeL, "fffffffe", "% x", -__LINE__, 0x00066183L, "+418179", "%+7.1ld", -__LINE__, 0xffffef2eL, "ffffef2e", "%-2.x", -__LINE__, 0x00000000L, " 000", "%04.3x", -__LINE__, -0x000000fL, "-15", "% d", -__LINE__, -0x00001f5L, "-501", "%d", -__LINE__, 0x0c67f159L, "c67f159", "%6.2x", -__LINE__, -0x0000006L, "-6", "%.1d", -__LINE__, 0x00000005L, "0X5", "%+#1X", -__LINE__, -0x0000002L, " -2", "%6.ld", -__LINE__, 0xeb2183ecL, "eb2183ec", "% x", -__LINE__, -0x5e12a322L, "-1578279714", "%d", -__LINE__, 0x00000001L, "0x1", "%#x", -__LINE__, -0x0001ea4L, "-7844", "%0d", -__LINE__, -0x19955a3L, "-26826147", "%d", -__LINE__, 0x000002a6L, "2A6", "%2.X", -__LINE__, 0x00000002L, "2", "%X", -__LINE__, 0xfffffeecL, "fffffeec", "%0.4x", -__LINE__, 0xfffffffcL, "fffffffc", "%0x", -__LINE__, 0xffdfe740L, "FFDFE740", "% X", -__LINE__, -0x0b0b3e7L, "-11580391", "%.1d", -__LINE__, 0x8e01077cL, "8E01077C", "%5.7X", -__LINE__, 0x3b6b6d55L, "996896085", "%1.1d", -__LINE__, 0x000016afL, "5807", "%ld", -__LINE__, -0x0004900L, "-18688", "%d", -__LINE__, 0xfffd77bcL, "FFFD77BC", "%X", -__LINE__, 0x004cbd74L, "5029236", "%0d", -__LINE__, 0x00000003L, " 00003", "%6.5d", -__LINE__, 0x0004720fL, "4720f", "% x", -__LINE__, 0x0e44535dL, "e44535d", "%4x", -__LINE__, 0xfffffff9L, "FFFFFFF9", "%3.3X", -__LINE__, -0x0000005L, "-5", "%-d", -__LINE__, 0x000001a6L, "00001A6", "%1.7X", -__LINE__, 0x0000004aL, "4A", "%-2.X", -__LINE__, 0xfffff249L, "FFFFF249", "%X", -__LINE__, 0x00004345L, "4345", "%x", -__LINE__, 0x0197041dL, "197041d", "%+0x", -__LINE__, 0x0000019aL, " 19a", "% 6.x", -__LINE__, 0xfff98376L, "FFF98376", "%X", -__LINE__, 0xfc536c41L, "FC536C41", "%X", -__LINE__, -0x0008d91L, "-36241", "% d", -__LINE__, 0xf058d69dL, "f058d69d", "%4.x", -__LINE__, -0x00013efL, "-5103", "%d", -__LINE__, -0x0000003L, "-3", "%00ld", -__LINE__, -0x09e80f0L, "-10387696", "%+07ld", -__LINE__, -0x0222c15L, "-2239509", "%#0.4ld", -__LINE__, 0x00000004L, "4", "%0ld", -__LINE__, -0x02c6b0dL, "-2910989", "% 0ld", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%-4X", -__LINE__, 0xffffff3dL, "FFFFFF3D", "%-.0X", -__LINE__, -0x0000015L, "-21", "%0d", -__LINE__, 0x131dfc90L, "+320732304", "%+d", -__LINE__, 0xffffffffL, "ffffffff", "%+x", -__LINE__, 0x000035c8L, "13768", "%0ld", -__LINE__, 0x00000033L, "0x0033", "%#.4x", -__LINE__, 0x0ce7e8c1L, "0xce7e8c1", "%#.7x", -__LINE__, 0xfc18b5d2L, "FC18B5D2", "%+.3X", -__LINE__, 0x00000015L, "21", "%d", -__LINE__, 0x001a5e7cL, "1a5e7c", "%05x", -__LINE__, -0x000fbf0L, "-64496", "%ld", -__LINE__, -0x000a4f7L, "-042231", "%+2.6d", -__LINE__, -0x0000002L, "-002", "%3.3ld", -__LINE__, 0x00728878L, "728878", "%0X", -__LINE__, -0x0000002L, "-2", "%#.1ld", -__LINE__, -0x00002efL, "-751", "%-0ld", -__LINE__, 0xfffffff7L, "fffffff7", "%.3x", -__LINE__, 0x00491867L, "0491867", "%.7X", -__LINE__, 0x00000d4dL, "3405", "%-ld", -__LINE__, 0x00234e86L, "234E86", "%0X", -__LINE__, -0x000001bL, "-27", "%ld", -__LINE__, 0x00275255L, "2576981", "%.5ld", -__LINE__, 0xfeacc214L, "0XFEACC214", "%-#3.X", -__LINE__, -0x0001ce5L, "-7397", "%+#2.2ld", -__LINE__, 0x089ddb6aL, "144563050", "%d", -__LINE__, 0x003d5a95L, "3D5A95", "%1X", -__LINE__, 0x002f0b6dL, "3083117", "%d", -__LINE__, 0x1e79e228L, "511304232", "%ld", -__LINE__, 0xfffffe6bL, "FFFFFE6B", "%+0X", -__LINE__, -0x5104ff3L, "-84955123", "%.4ld", -__LINE__, 0xfffff1deL, "FFFFF1DE", "%X", -__LINE__, 0x000000cfL, "+207", "%+.1ld", -__LINE__, -0x16ad0164L, "-380436836", "%+5.d", -__LINE__, 0x001fefa6L, "2092966", "%ld", -__LINE__, 0x00000000L, "00", "%-.2d", -__LINE__, 0x00195f45L, "195f45", "%+0x", -__LINE__, 0x00000001L, " 1", "%3.ld", -__LINE__, -0x00001c9L, "-457", "% ld", -__LINE__, 0x0002479eL, "149406", "%#ld", -__LINE__, 0x001ab18bL, "1749387", "%04d", -__LINE__, 0x00000045L, "69", "%ld", -__LINE__, 0xfbb13f7dL, "fbb13f7d", "%.2x", -__LINE__, 0x03ddc208L, "3ddc208", "%x", -__LINE__, 0x00000007L, "000007", "%#.6d", -__LINE__, 0x00000000L, "0", "%01X", -__LINE__, -0x0023110L, "-143632", "%+0.3d", -__LINE__, 0x00000006L, "06", "%#.2d", -__LINE__, 0xffff9ec9L, "ffff9ec9", "%7x", -__LINE__, -0x08afb12L, "-9108242", "% #0.ld", -__LINE__, 0x00000004L, "4", "%X", -__LINE__, 0x00059684L, "59684", "%x", -__LINE__, 0xfff8d8f5L, "FFF8D8F5", "%X", -__LINE__, 0x00b7027dL, "+11993725", "%+0.7ld", -__LINE__, 0x0000d814L, "55316", "%0ld", -__LINE__, 0x03c95a08L, "3c95a08", "%3x", -__LINE__, -0x0b65f9aL, "-11952026", "%d", -__LINE__, 0xfd956021L, "fd956021", "%0x", -__LINE__, 0x000000edL, "ed", "%0x", -__LINE__, -0x006a80cL, "-436236", "%.6ld", -__LINE__, 0xfedb109dL, "fedb109d", "%x", -__LINE__, 0x00000001L, "1", "%X", -__LINE__, 0x00b3eb71L, " 11791217", "% d", -__LINE__, 0x00000016L, "16", "%0X", -__LINE__, 0x000001dbL, " 475", "% ld", -__LINE__, 0x00465eafL, "4611759", "%0d", -__LINE__, 0x0001b423L, "1B423", "%0X", -__LINE__, 0x05df95eaL, "5df95ea", "%+.5x", -__LINE__, 0x0000000eL, " 14", "%7ld", -__LINE__, 0xffffb89eL, "ffffb89e", "%+x", -__LINE__, 0x01259918L, " 19241240", "% d", -__LINE__, -0x0000f8dL, "-003981", "%+#.6d", -__LINE__, 0x00054ae0L, "54AE0", "%X", -__LINE__, -0x4589ed4L, "-72916692", "% ld", -__LINE__, 0x01017516L, "1017516", "%6X", -__LINE__, 0xfffb9f15L, "FFFB9F15", "%.2X", -__LINE__, 0x005f8394L, "5F8394", "%.2X", -__LINE__, 0xffffffffL, "ffffffff", "%x", -__LINE__, -0x0000001L, " -1", "%7.1ld", -__LINE__, 0x004367afL, "4417455", "%4.ld", -__LINE__, 0xffffff86L, "ffffff86", "%4.5x", -__LINE__, -0x0000d17L, "-3351", "%2.0ld", -__LINE__, 0xffffff31L, "ffffff31", "%.6x", -__LINE__, -0x0000001L, "-1", "%ld", -__LINE__, -0x3d785fabL, "-1031298987", "%d", -__LINE__, -0x0000002L, "-2", "%-0ld", -__LINE__, 0x0000019cL, "412", "%d", -__LINE__, -0x0006f54L, "-28500", "%d", -__LINE__, 0xfffe3524L, "FFFE3524", "% 6.2X", -__LINE__, -0x128d3c00L, "-311245824", "%2d", -__LINE__, -0x3be71293L, "-1004999315", "%d", -__LINE__, 0x0000659dL, "26013", "%d", -__LINE__, 0x2d947538L, "+764704056", "%+5d", -__LINE__, 0xffa2a420L, "FFA2A420", "%0X", -__LINE__, 0x00000001L, "1", "%d", -__LINE__, 0x04477c14L, "4477c14", "%.6x", -__LINE__, -0x06e145bL, "-7214171", "%d", -__LINE__, 0x00009c01L, "39937", "%-.1d", -__LINE__, 0xffde174bL, "ffde174b", "% 0x", -__LINE__, 0x0001fbaeL, "1FBAE", "%01.X", -__LINE__, -0x06b8406L, "-7046150", "%d", -__LINE__, 0x000005b8L, "005b8", "%05x", -__LINE__, -0x02d780bL, "-2979851", "%1d", -__LINE__, 0x00209e26L, "2137638", "%2d", -__LINE__, 0x0000041aL, "41A", "%0X", -__LINE__, 0x2a77f42cL, "2A77F42C", "%02X", -__LINE__, 0x13b6ee14L, "+330755604", "%+0d", -__LINE__, -0x0000002L, "-2 ", "%-6.d", -__LINE__, -0x0001eeeL, "-7918", "% #2.ld", -__LINE__, 0xffffffffL, "FFFFFFFF", "% .5X", -__LINE__, 0x20d11927L, "20d11927", "% 0.x", -__LINE__, -0x0018690L, "-99984", "% ld", -__LINE__, 0x000002a0L, "2A0", "%-0X", -__LINE__, -0x0000511L, "-1297", "%+d", -__LINE__, 0x0e782f31L, "242757425", "%-0.ld", -__LINE__, 0x2ce06da0L, "752905632", "%#0ld", -__LINE__, 0x00000062L, "62 ", "%-07x", -__LINE__, -0x015d9d8L, "-1432024", "% 7d", -__LINE__, 0xc9125ea8L, "c9125ea8", "%x", -__LINE__, 0x00000006L, "6", "%.0ld", -__LINE__, 0x0000019cL, "19c", "%x", -__LINE__, 0x00000000L, " ", "%6.d", -__LINE__, 0x00043e89L, "278153", "%0ld", -__LINE__, 0x3e422abdL, "1044523709", "%ld", -__LINE__, 0x0220a75dL, "35694429", "%#7.6d", -__LINE__, 0x0000c21cL, "C21C", "% X", -__LINE__, 0x000074abL, "29867", "%d", -__LINE__, 0x056b22aaL, "56B22AA", "%+0.X", -__LINE__, 0xfffffff9L, "FFFFFFF9", "%X", -__LINE__, 0x00000000L, "0", "%X", -__LINE__, 0xf094a4f4L, "f094a4f4", "%+4.x", -__LINE__, -0x1dad0244L, "-497877572", "%d", -__LINE__, 0xffffffffL, "FFFFFFFF", "%.1X", -__LINE__, 0xfffffe2dL, "fffffe2d", "%7.x", -__LINE__, 0x0000042bL, "0x42b", "%#x", -__LINE__, -0x0000001L, "-1", "% d", -__LINE__, 0x00e77ef5L, " 15171317", "% 7.ld", -__LINE__, 0x00006210L, " 25104", "% 06d", -__LINE__, 0x0011187aL, "1120378", "%-ld", -__LINE__, -0x000000bL, "-11", "% #ld", -__LINE__, 0x14cfaff0L, "14cfaff0", "%-2.3x", -__LINE__, 0xffff74eaL, "FFFF74EA", "%3.X", -__LINE__, 0x000bfb9dL, "bfb9d", "%x", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%X", -__LINE__, 0x00014500L, "0X14500", "%#4.X", -__LINE__, -0x0000001L, "-1", "%#1d", -__LINE__, -0x0000024L, "-36", "%-0d", -__LINE__, -0x6528828L, "-106072104", "%d", -__LINE__, 0x00000075L, " 117", "% #d", -__LINE__, 0xff027d67L, "ff027d67", "%0x", -__LINE__, 0x0012b8b3L, "12b8b3", "%0.1x", -__LINE__, 0x1070147bL, "275780731", "%.6ld", -__LINE__, 0xffffe88eL, "FFFFE88E", "%1.3X", -__LINE__, 0xfffffc0dL, "fffffc0d", "%00.6x", -__LINE__, 0xffd889f5L, "ffd889f5", "%x", -__LINE__, 0x00000470L, "1136", "%0ld", -__LINE__, 0x000297f8L, "169976", "%ld", -__LINE__, 0xfffffffeL, "fffffffe", "%+1x", -__LINE__, 0x0000064aL, "64a", "%x", -__LINE__, -0x3d71e43bL, "-1030874171", "%1.d", -__LINE__, -0x0000004L, "-4 ", "%-3.d", -__LINE__, 0xfffff132L, "FFFFF132", "%0.0X", -__LINE__, 0x37b6356fL, "37b6356f", "%-x", -__LINE__, 0xffffff7aL, "FFFFFF7A", "%.0X", -__LINE__, 0x00023553L, "23553", "%x", -__LINE__, 0x39a4c29fL, "39a4c29f", "%+5.x", -__LINE__, 0xffffffccL, "ffffffcc", "%x", -__LINE__, 0x0003a83bL, "239675", "%#6ld", -__LINE__, 0x00000002L, "2", "%0x", -__LINE__, -0x09b4e8cL, "-10178188", "%+03.ld", -__LINE__, 0x00000002L, "0000002", "%-#.7ld", -__LINE__, 0x00000b5eL, "2910", "%-04ld", -__LINE__, -0x0000254L, "-596", "%+0d", -__LINE__, 0x00000001L, "1", "%+1.x", -__LINE__, 0xf8290d3eL, "0XF8290D3E", "% #X", -__LINE__, 0x00000035L, "035", "%3.3X", -__LINE__, 0x00131d7dL, "131D7D ", "%-7.6X", -__LINE__, 0xffdbb36aL, "0xffdbb36a", "%#.6x", -__LINE__, 0xc7275816L, "c7275816", "%04.x", -__LINE__, 0x00bae994L, "12249492", "%0ld", -__LINE__, 0x00000002L, "+2", "%+0.0ld", -__LINE__, 0xffffffffL, "ffffffff", "%0x", -__LINE__, 0xffffffe0L, "ffffffe0", "%x", -__LINE__, 0x00000036L, "36", "%.0X", -__LINE__, 0xfffffffdL, "FFFFFFFD", "%1X", -__LINE__, 0xffffffc8L, "ffffffc8", "%+x", -__LINE__, 0xe71c3689L, "e71c3689", "%x", -__LINE__, 0x00000007L, "7 ", "%-3.ld", -__LINE__, 0xffffffffL, "ffffffff", "%x", -__LINE__, 0x00030400L, "030400", "%-4.6x", -__LINE__, 0xbd8c6fa7L, "BD8C6FA7", "%-6X", -__LINE__, 0x00000233L, "0000563", "%.7ld", -__LINE__, 0xfef92e35L, "fef92e35", "%x", -__LINE__, 0xffff2172L, "ffff2172", "%3x", -__LINE__, 0x00001233L, "1233", "% X", -__LINE__, -0x000d2e1L, "-53985", "%-0d", -__LINE__, -0x3ba8cb5bL, "-1000917851", "%0d", -__LINE__, -0x4fefb9aL, "-83819418", "%5.ld", -__LINE__, 0xffffe9ebL, "FFFFE9EB", "%X", -__LINE__, 0x1e472dc3L, "507981251", "%ld", -__LINE__, -0x0077046L, "-487494", "%0d", -__LINE__, 0x0002c4c9L, "+181449", "%+7.d", -__LINE__, 0xfffffe63L, "fffffe63", "%x", -__LINE__, 0xfff5a6dbL, "FFF5A6DB", "%X", -__LINE__, 0x00174442L, "174442", "%-5.0X", -__LINE__, 0x017891d9L, "17891D9", "%+5.X", -__LINE__, 0x0261966bL, "261966B", "%-X", -__LINE__, -0x3e58614dL, "-1045979469", "%ld", -__LINE__, 0x002c4c41L, "+2903105", "%+01ld", -__LINE__, 0x0000000cL, "012", "%#.3d", -__LINE__, 0x0380f73aL, "58783546", "%ld", -__LINE__, 0x000002c7L, "0000711", "%2.7ld", -__LINE__, 0x00000002L, " 002", "% 04ld", -__LINE__, 0x00687ca0L, "687CA0", "%X", -__LINE__, 0x0000058aL, "1418", "%0ld", -__LINE__, -0x0000642L, "-1602", "% ld", -__LINE__, 0x0001f4f1L, "1F4F1", "%X", -__LINE__, 0x0026d6fcL, "+2545404", "%+4.ld", -__LINE__, 0x05dd423cL, "+98386492", "%+#ld", -__LINE__, 0x0000782cL, "0782C", "%3.5X", -__LINE__, 0xf67d91f8L, "f67d91f8", "%-x", -__LINE__, 0xffffcf2dL, "ffffcf2d", "%+0x", -__LINE__, -0x00af8a6L, "-719014", "%0ld", -__LINE__, -0xe606ef9L, "-241200889", "%ld", -__LINE__, 0xfe9d87f7L, "fe9d87f7", "%+x", -__LINE__, 0x00000d44L, "d44", "% 1.x", -__LINE__, 0x008716f5L, "8716f5", "%2x", -__LINE__, 0x000027d4L, "27D4", "% X", -__LINE__, 0xfdfd92eaL, "FDFD92EA", "%-.4X", -__LINE__, 0xfffe764fL, "FFFE764F", "%X", -__LINE__, 0xff699032L, "ff699032", "%3.x", -__LINE__, 0xffffffffL, "FFFFFFFF", "%-3X", -__LINE__, -0x368ba995L, "-915122581", "%+#.6ld", -__LINE__, 0xffffffffL, "ffffffff", "%0x", -__LINE__, 0x0000035eL, " 862", "% 1d", -__LINE__, 0xfe703e67L, "fe703e67", "%07.0x", -__LINE__, 0xfffffffeL, "fffffffe", "%4.x", -__LINE__, 0x000e20cfL, "e20cf", "%0x", -__LINE__, 0x000063b5L, "0X63B5", "%-#X", -__LINE__, 0xfffffffaL, "fffffffa", "%+2.x", -__LINE__, 0xffffffffL, "FFFFFFFF", "%2.X", -__LINE__, 0xfdfd69daL, "FDFD69DA", "%.0X", -__LINE__, 0x00002f61L, "0x2f61", "%#3.x", -__LINE__, 0x00000009L, "9", "%x", -__LINE__, 0xffffff86L, "ffffff86", "%6x", -__LINE__, 0xffffffe4L, "ffffffe4", "%0x", -__LINE__, 0x0062e73bL, "+6481723", "%+0ld", -__LINE__, -0x2b059130L, "-721785136", "%+d", -__LINE__, -0x0000073L, "-115", "%d", -__LINE__, 0xf596efcfL, "f596efcf", "%x", -__LINE__, 0x0002f1cbL, "2F1CB", "%0X", -__LINE__, -0x0000635L, "-01589", "%.5ld", -__LINE__, 0xfffa011aL, "FFFA011A", "%0X", -__LINE__, 0x00000047L, " 47", "%4X", -__LINE__, 0xfffffbc0L, "FFFFFBC0", "%5.2X", -__LINE__, 0x00000015L, "15", "% X", -__LINE__, 0x002a87a6L, "2a87a6", "%.1x", -__LINE__, -0x000069cL, "-1692", "%+ld", -__LINE__, 0xfffffffdL, "fffffffd", "%+x", -__LINE__, 0xfeda51f5L, "FEDA51F5", "%0X", -__LINE__, 0x001781a4L, "1781a4", "%-0x", -__LINE__, 0xe77358d4L, "e77358d4", "%+0x", -__LINE__, 0x00000084L, " 84", "%3.x", -__LINE__, 0xffff0cb2L, "FFFF0CB2", "%+5.X", -__LINE__, 0x0009fa17L, "653847", "%0.0ld", -__LINE__, -0x0000c92L, "-3218", "%d", -__LINE__, 0x0004ebbbL, "4ebbb", "%x", -__LINE__, 0x2e72568cL, "+779245196", "%+#ld", -__LINE__, 0xffae86a7L, "ffae86a7", "%.7x", -__LINE__, 0xffdf3f04L, "ffdf3f04", "%x", -__LINE__, 0x000000c7L, "199", "%2.d", -__LINE__, -0x0004a55L, "-19029", "%ld", -__LINE__, 0x00564ef9L, "5656313", "%.6ld", -__LINE__, 0xffffc205L, "ffffc205", "%+.0x", -__LINE__, -0x135085d0L, "-324044240", "%#.5d", -__LINE__, 0xfffffffeL, "fffffffe", "%-7x", -__LINE__, -0x0000003L, "-3", "%.1ld", -__LINE__, 0xffda9e0bL, "ffda9e0b", "%+0x", -__LINE__, 0x00000001L, "1", "%d", -__LINE__, 0xffffffdaL, "ffffffda", "%.6x", -__LINE__, 0x5efdb3d1L, "+1593684945", "%+0d", -__LINE__, -0x00000caL, "-202", "% 4.d", -__LINE__, -0x0014433L, "-82995", "%.3d", -__LINE__, -0x0000002L, "-000002", "% .6ld", -__LINE__, 0x24aac879L, "615172217", "%.7d", -__LINE__, -0x1db3c1dL, "-31144989", "%+#4ld", -__LINE__, 0x000945adL, "0x945ad", "%#1x", -__LINE__, 0x0000000aL, "10", "%#.1ld", -__LINE__, -0x002a2e5L, "-172773", "%d", -__LINE__, 0xfffffff3L, "FFFFFFF3", "%5X", -__LINE__, 0x0000000eL, "e", "%+x", -__LINE__, 0x335333dcL, "861090780", "%6.d", -__LINE__, 0xfffa16f4L, "FFFA16F4", "%6X", -__LINE__, 0xffffc727L, "ffffc727", "%+2.x", -__LINE__, 0x00000273L, "273", "%x", -__LINE__, -0x000000fL, "-15", "%-0d", -__LINE__, 0x00065fbdL, "417725", "%5.1d", -__LINE__, 0x00000ed5L, "3797", "%d", -__LINE__, 0x30a40024L, "30A40024", "%3.7X", -__LINE__, 0x00000054L, "84", "%ld", -__LINE__, 0x00000515L, "01301", "%.5ld", -__LINE__, 0x00000897L, "+02199", "%+.5d", -__LINE__, -0x0001bccL, "-7116", "% ld", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%7X", -__LINE__, 0x00000013L, "0X13", "%#X", -__LINE__, 0xffffffffL, "0xffffffff", "% #x", -__LINE__, 0x00000006L, "6", "%ld", -__LINE__, -0x00000c3L, "-195", "%1.ld", -__LINE__, -0x005291eL, "-338206", "%+d", -__LINE__, 0xffb437a7L, "FFB437A7", "%-0X", -__LINE__, 0xff8335cbL, "ff8335cb", "%x", -__LINE__, 0x0000006aL, "6A", "%2X", -__LINE__, -0x004f629L, "-325161", "% .4d", -__LINE__, 0x003698efL, "3578095", "%0ld", -__LINE__, 0x6b5cdf3aL, "6b5cdf3a", "%-x", -__LINE__, 0xe9bc5c21L, "e9bc5c21", "%+x", -__LINE__, -0x0000001L, " -1", "%+6.ld", -__LINE__, 0xfffeffc8L, "FFFEFFC8", "%6.X", -__LINE__, 0xff070a73L, "ff070a73", "%+.7x", -__LINE__, 0x0023f8aeL, "2357422", "%07.4ld", -__LINE__, 0x00000000L, "0", "%X", -__LINE__, 0x00000016L, "16", "%0X", -__LINE__, -0x000005aL, " -90", "%4d", -__LINE__, 0x00000116L, "116", "% .3x", -__LINE__, 0xfffed024L, "fffed024", "%-x", -__LINE__, 0xfb907950L, "fb907950", "%.0x", -__LINE__, 0x0101a1e5L, "101a1e5", "%x", -__LINE__, -0x09e7684L, "-10385028", "%-#ld", -__LINE__, 0xffffffffL, "ffffffff", "%1x", -__LINE__, 0xfffffff6L, "fffffff6", "%x", -__LINE__, 0x00000078L, "78", "%x", -__LINE__, 0xe6bca9c9L, "0XE6BCA9C9", "%#.5X", -__LINE__, -0x0000010L, "-16", "%d", -__LINE__, -0x1348f685L, "-323548805", "%d", -__LINE__, 0x4dd85797L, "1306023831", "%ld", -__LINE__, -0x0000080L, "-128", "%.2d", -__LINE__, -0xaed13a7L, "-183309223", "%+ld", -__LINE__, -0x000002fL, "-47", "% d", -__LINE__, -0x679911fL, "-108630303", "%ld", -__LINE__, 0xfffff221L, "FFFFF221", "% .7X", -__LINE__, 0x0007476cL, "7476c", "%x", -__LINE__, 0xffffe02aL, "0xffffe02a", "%#7x", -__LINE__, 0x00000ebbL, "0XEBB", "%#X", -__LINE__, 0xffffffffL, "0XFFFFFFFF", "%-#X", -__LINE__, 0x00281896L, "281896", "%+1.x", -__LINE__, 0x0000085dL, " 0X85D", "%#6.3X", -__LINE__, 0x000112bfL, "112BF", "%X", -__LINE__, 0xf5518fbfL, "F5518FBF", "% X", -__LINE__, -0x00c945bL, "-824411", "%ld", -__LINE__, 0x00001b43L, "0x1b43", "%-#x", -__LINE__, -0x5872a246L, "-1483907654", "%#7.7ld", -__LINE__, 0x00001f96L, "8086", "%#d", -__LINE__, 0xfffffff9L, "FFFFFFF9", "%X", -__LINE__, -0x006e244L, "-451140", "% .3d", -__LINE__, -0x0382188L, "-3678600", "%0.2ld", -__LINE__, 0x00000006L, "6", "%-x", -__LINE__, 0x00000036L, "54 ", "%-5.d", -__LINE__, -0x0000439L, " -1081", "%#6.3ld", -__LINE__, 0xfff911c6L, "FFF911C6", "%X", -__LINE__, -0x03454dcL, "-3429596", "%d", -__LINE__, -0x0363e8dL, "-3554957", "%-.2ld", -__LINE__, 0x00000000L, "000", "%.3X", -__LINE__, -0x59bb030fL, "-1505428239", "%0ld", -__LINE__, 0x073c94d8L, "121410776", "%-d", -__LINE__, -0x001ef94L, "-126868", "%5.1ld", -__LINE__, 0xfff65fc5L, "FFF65FC5", "%0X", -__LINE__, 0xfffffff4L, "fffffff4", "%-x", -__LINE__, 0x00001d83L, "07555", "%5.5d", -__LINE__, 0x0012b40aL, "1225738", "%ld", -__LINE__, -0x0000006L, "-6", "%0ld", -__LINE__, 0xfffffffcL, "fffffffc", "%06.0x", -__LINE__, -0x0000002L, "-00002", "%#.5ld", -__LINE__, 0xf9932c1dL, "f9932c1d", "%-x", -__LINE__, -0x46a31d9L, "-74068441", "%.3ld", -__LINE__, 0x000987e9L, "987E9", "%1X", -__LINE__, 0x0000000fL, "15", "%-ld", -__LINE__, -0x0001c4dL, "-7245", "%ld", -__LINE__, -0x007deeeL, "-515822", "%2.6d", -__LINE__, 0xffffffa2L, "FFFFFFA2", "%.6X", -__LINE__, 0x00000001L, "1", "%-ld", -__LINE__, 0xfc106bdeL, "fc106bde", "%.4x", -__LINE__, 0x0002f1f8L, "0x2f1f8", "%#7.x", -__LINE__, -0x06a290bL, "-6957323", "%-ld", -__LINE__, -0x0000037L, " -55", "%4ld", -__LINE__, 0x0000152eL, "5422", "%2.d", -__LINE__, 0xfffffcb2L, "0XFFFFFCB2", "%#3.X", -__LINE__, 0x1b7ca086L, "1b7ca086", "%+x", -__LINE__, 0x00000001L, "1", "%ld", -__LINE__, 0x006775fcL, "6775fc", "%3.2x", -__LINE__, 0x0000000eL, "0XE", "%#3.X", -__LINE__, 0xffffffffL, "0xffffffff", "%+#4.x", -__LINE__, 0x00001246L, "1246", "%X", -__LINE__, 0xffffaed6L, "ffffaed6", "%2x", -__LINE__, -0x3a2dec78L, "-976088184", "% 0ld", -__LINE__, 0x0001423bL, "1423b", "%01x", -__LINE__, 0x00000007L, " 0X7", "%#4.X", -__LINE__, 0x01a7ff5aL, "27787098", "%.4ld", -__LINE__, -0x0020d05L, "-134405", "%-d", -__LINE__, 0xffffff9aL, "ffffff9a", "%-.1x", -__LINE__, 0xffff3557L, "ffff3557", "%x", -__LINE__, 0x08828e35L, "8828e35", "%+.1x", -__LINE__, 0x000006b2L, "001714", "%04.6ld", -__LINE__, 0x00000013L, "19", "%.0ld", -__LINE__, -0x00341a5L, "-213413", "%#d", -__LINE__, -0x0000043L, "-67", "%d", -__LINE__, -0x074dce3L, "-7658723", "%.1d", -__LINE__, -0x16de2df3L, "-383659507", "% ld", -__LINE__, 0x00000000L, "0", "%x", -__LINE__, 0x00000ce7L, "ce7", "% 2.1x", -__LINE__, 0xffecd377L, "ffecd377", "% 0x", -__LINE__, 0xa4e8465cL, "a4e8465c", "% x", -__LINE__, 0x000005e8L, "1512", "%d", -__LINE__, 0x00000513L, "1299", "%d", -__LINE__, 0xffffffb8L, "FFFFFFB8", "%X", -__LINE__, 0x00000003L, "00003", "%3.5x", -__LINE__, -0x0000003L, "-3 ", "%-3.ld", -__LINE__, 0xad53f01dL, "ad53f01d", "%0x", -__LINE__, 0x0f1c1daeL, "253500846", "%-#.0d", -__LINE__, 0xff1753c0L, "0xff1753c0", "%#3.x", -__LINE__, -0x00389c5L, "-231877", "%d", -__LINE__, 0x0000016eL, "00016E", "%.6X", -__LINE__, -0x54d3310fL, "-1423126799", "%-d", -__LINE__, 0x00000005L, "0X5", "%#.1X", -__LINE__, 0xfffffffdL, "0XFFFFFFFD", "%#5.3X", -__LINE__, 0xfffffe0eL, "fffffe0e", "%-x", -__LINE__, 0xa3c02157L, "a3c02157", "%.5x", -__LINE__, 0x00005765L, "22373", "%d", -__LINE__, -0x12668cdL, "-19294413", "%+ld", -__LINE__, -0x66544daL, "-107300058", "%2d", -__LINE__, 0x8646c605L, "0X8646C605", "% #X", -__LINE__, 0x000001f5L, "1F5", "%X", -__LINE__, 0x01b33ae4L, "28523236", "%5ld", -__LINE__, 0x000007ceL, "7ce", "%3.x", -__LINE__, 0x00000355L, "355", "%X", -__LINE__, 0x000001ceL, "1CE", "% X", -__LINE__, 0xfffffccdL, "fffffccd", "%7.0x", -__LINE__, -0x0000001L, "-1", "%0ld", -__LINE__, 0x000640b6L, "640b6", "%5.x", -__LINE__, 0x0038c4ecL, "3720428", "%5.4d", -__LINE__, -0x0f10b5eL, "-15797086", "%2ld", -__LINE__, 0x256c815fL, "256c815f", "%4.x", -__LINE__, 0x00000682L, " 1666", "%6ld", -__LINE__, -0x00000abL, "-171", "%2ld", -__LINE__, 0x00000003L, "3", "%0d", -__LINE__, 0x063f5075L, "63F5075", "%X", -__LINE__, 0xff83b5d0L, "FF83B5D0", "%7.X", -__LINE__, 0xffffffecL, "ffffffec", "%x", -__LINE__, 0xffb551c4L, "0XFFB551C4", "% #4.X", -__LINE__, -0x071f057L, "-7467095", "%3.7d", -__LINE__, 0x00634879L, "6506617", "%#ld", -__LINE__, 0x000001d7L, "471", "%d", -__LINE__, 0x00a7da92L, "A7DA92", "% .4X", -__LINE__, 0x00000003L, "3 ", "%-2.ld", -__LINE__, -0x0000004L, "-0004", "%.4d", -__LINE__, -0x01dea32L, "-1960498", "% #7.d", -__LINE__, 0x53c4159fL, "53C4159F", "%1.7X", -__LINE__, -0x1ad7904L, "-28145924", "%#d", -__LINE__, -0x0000a85L, "-2693", "%ld", -__LINE__, -0x0000c7dL, "-3197", "%d", -__LINE__, 0xfffffffcL, "FFFFFFFC", "%+0X", -__LINE__, 0x00000004L, "00004", "%1.5d", -__LINE__, 0x0000b761L, "46945", "%5ld", -__LINE__, -0x0ee3b2cL, "-15612716", "%.6d", -__LINE__, 0x0677a73dL, "677a73d", "% x", -__LINE__, -0x5f96020L, "-100229152", "% d", -__LINE__, 0x00000000L, " 0", "%#7X", -__LINE__, -0x5d1cb5bL, "-97635163", "% ld", -__LINE__, -0x00a8d8bL, "-691595", "%-0ld", -__LINE__, 0xffffffa2L, "FFFFFFA2", "%X", -__LINE__, 0xffffffc9L, "FFFFFFC9", "%X", -__LINE__, 0x0b180d35L, "B180D35", "%X", -__LINE__, 0xfc0b94ceL, "fc0b94ce", "%.1x", -__LINE__, 0x0012cd7bL, "12CD7B", "% X", -__LINE__, -0x02f1da8L, "-3087784", "%ld", -__LINE__, -0x000a6f9L, "-42745", "%-ld", -__LINE__, -0x000006dL, "-109 ", "%-6d", -__LINE__, 0x00000001L, "+1", "%+0d", -__LINE__, 0x00000001L, "1", "%1d", -__LINE__, 0xfffffff8L, "fffffff8", "%5.x", -__LINE__, -0x00fc4d7L, "-1033431", "%+0.5ld", -__LINE__, 0xffff41b4L, "0xffff41b4", "%#x", -__LINE__, -0x0000d37L, "-3383", "%ld", -__LINE__, 0xffc4e405L, "ffc4e405", "%7x", -__LINE__, 0xffffffb0L, "FFFFFFB0", "%04X", -__LINE__, -0x0054477L, "-345207", "%01.ld", -__LINE__, 0x00512778L, "0x512778", "%#3.0x", -__LINE__, 0x00000007L, " 7", "%7.d", -__LINE__, 0x00000008L, " 00008", "% .5ld", -__LINE__, 0x000053fdL, "21501", "%.4ld", -__LINE__, 0x0000370cL, "370c", "%2x", -__LINE__, -0x44670a7L, "-71725223", "%3d", -__LINE__, 0x00000064L, " 64", "%+5x", -__LINE__, 0xfffffffcL, "FFFFFFFC", "%X", -__LINE__, 0xf7bbf094L, "f7bbf094", "%3x", -__LINE__, 0xfffeb268L, "FFFEB268", "%X", -__LINE__, 0x00001ef0L, "1ef0", "%4.x", -__LINE__, 0x05ad9aa4L, " 95263396", "% 0.ld", -__LINE__, 0xf294dca7L, "F294DCA7", "% 4.X", -__LINE__, -0x0000003L, "-000003", "%.6d", -__LINE__, 0xfff57471L, "fff57471", "% x", -__LINE__, 0x0a848cfdL, "176459005", "%d", -__LINE__, -0x000002eL, "-46", "%.0d", -__LINE__, 0x00000051L, " +81", "%+5d", -__LINE__, -0x000072bL, "-0001835", "%06.7d", -__LINE__, -0x0000002L, " -2", "%+#6ld", -__LINE__, 0x00000003L, "3", "%x", -__LINE__, 0xfffd1799L, "FFFD1799", "%6.X", -__LINE__, 0x00000005L, "5", "%ld", -__LINE__, 0x0052138bL, "5378955", "%#7.7ld", -__LINE__, 0x000000c0L, " 192", "% 7ld", -__LINE__, 0x005b26cdL, "5B26CD", "%X", -__LINE__, -0x008df17L, "-581399", "%.4ld", -__LINE__, 0xfffffad8L, "fffffad8", "%-x", -__LINE__, 0x000006a9L, "6a9", "%.0x", -__LINE__, -0x003b7f9L, "-243705", "%+0ld", -__LINE__, 0x005d7ea4L, "6127268", "%ld", -__LINE__, -0x003cceaL, "-249066", "%+.0ld", -__LINE__, 0x0000846fL, "846F", "%X", -__LINE__, 0x00004f79L, "4F79", "%4.X", -__LINE__, 0xe3e1409cL, "E3E1409C", "%-X", -__LINE__, 0x07cce2f4L, "7CCE2F4", "%2.X", -__LINE__, 0x004bcc8bL, "4967563", "%-.5ld", -__LINE__, 0x7d49665eL, "2101962334", "%ld", -__LINE__, 0xfffffffcL, "FFFFFFFC", "%.5X", -__LINE__, 0x0000019eL, "+000414", "%+.6d", -__LINE__, 0x000027efL, "10223", "%d", -__LINE__, -0x0000261L, "-609", "%3ld", -__LINE__, -0x000000eL, "-14", "% 2.ld", -__LINE__, 0xff3ba3c7L, "ff3ba3c7", "%+5.7x", -__LINE__, 0xffffffc4L, "FFFFFFC4", "%-1.X", -__LINE__, 0xfffc5a70L, "0xfffc5a70", "%#4.4x", -__LINE__, 0x0000d156L, " 53590", "% d", -__LINE__, -0x0486258L, "-4743768", "%0ld", -__LINE__, 0x00000000L, " ", "% 2.d", -__LINE__, 0x04a0ef9fL, "77655967", "%0.6ld", -__LINE__, 0xffffffffL, "FFFFFFFF", "%X", -__LINE__, 0x00000019L, "0000019", "%.7x", -__LINE__, -0x0058d3aL, "-363834", "%ld", -__LINE__, 0xfffff6b3L, "fffff6b3", "%x", -__LINE__, 0xfffffff5L, "FFFFFFF5", "%.0X", -__LINE__, 0x005e1fcbL, "5E1FCB", "%+6X", -__LINE__, 0xffc3c866L, "0xffc3c866", "%-#.4x", -__LINE__, 0x00000003L, "3", "%X", -__LINE__, 0xffa2e961L, "FFA2E961", "%7.4X", -__LINE__, 0x00000029L, "41", "%d", -__LINE__, -0x0000035L, "-53", "%d", -__LINE__, 0x0001b033L, "110643", "%ld", -__LINE__, 0x004dd51bL, "5100827", "%-2ld", -__LINE__, -0x000252dL, "-9517", "% d", -__LINE__, 0xffffdeb2L, "ffffdeb2", "%4.x", -__LINE__, 0xffe94eabL, "0xffe94eab", "%#x", -__LINE__, 0xf921edf6L, "f921edf6", "%4.2x", -__LINE__, 0x0007df97L, "515991", "%4.ld", -__LINE__, 0x00709bc5L, "709BC5", "%0X", -__LINE__, -0x0000001L, "-1", "%d", -__LINE__, 0xfffffffbL, "FFFFFFFB", "%7.3X", -__LINE__, -0x0063f74L, "-409460", "%+05.0d", -__LINE__, 0xfffffe9aL, "FFFFFE9A", "%.2X", -__LINE__, -0x0001ce2L, "-7394", "%.4d", -__LINE__, 0x000038c5L, "14533", "%ld", -__LINE__, 0x000000adL, "000ad", "% 5.5x", -__LINE__, 0xffffbcc4L, "ffffbcc4", "%-5x", -__LINE__, 0x00000000L, "0", "% X", -__LINE__, 0x00372877L, "372877", "%.6X", -__LINE__, 0xffffffd7L, "FFFFFFD7", "%1.X", -__LINE__, 0xfa58b14bL, "fa58b14b", "%x", -__LINE__, 0xfffffd9fL, "FFFFFD9F", "%0.7X", -__LINE__, 0x00000710L, "+1808", "%+#.2ld", -__LINE__, 0x00000006L, " 6", "%5.0ld", -__LINE__, 0x0fba9706L, "263886598", "%-6.3d", -__LINE__, 0xffff420aL, "ffff420a", "%-2x", -__LINE__, 0x14b9a825L, "14b9a825", "%x", -__LINE__, 0x0077ffe4L, "77FFE4", "%+.2X", -__LINE__, 0x00067108L, "422152 ", "%-7.ld", -__LINE__, 0x00000001L, " 00001", "%6.5X", -__LINE__, 0x00000000L, "0", "%ld", -__LINE__, -0x0000001L, " -1", "% 7ld", -__LINE__, 0x01ddc7a3L, "31311779", "%d", -__LINE__, -0x2a92f9bL, "-44642203", "% 3ld", -__LINE__, 0xfffffff9L, "fffffff9", "%4.6x", -__LINE__, 0x0279a274L, "279a274", "%x", -__LINE__, 0x2e37ed8eL, "775417230", "%d", -__LINE__, 0x5ba59f58L, "1537580888", "%-ld", -__LINE__, 0xffffffe0L, "ffffffe0", "%x", -__LINE__, 0x3110ae47L, "0X3110AE47", "%+#X", -__LINE__, 0x000e00b9L, "917689", "%d", -__LINE__, 0x0000002eL, " 0046", "% 7.4d", -__LINE__, 0x00000363L, " 867", "%7.d", -__LINE__, -0x000000bL, "-0011", "% 0.4d", -__LINE__, 0x000349c8L, " 349C8", "% 7.X", -__LINE__, -0x01358f1L, "-1267953", "%d", -__LINE__, -0x0039d3cL, "-236860", "%-.3d", -__LINE__, 0xffd6de19L, "ffd6de19", "%04.0x", -__LINE__, -0x0003c54L, "-0015444", "%1.7d", -__LINE__, -0x0000e17L, "-3607", "%d", -__LINE__, 0xff0fa3a9L, "ff0fa3a9", "%+3x", -__LINE__, 0x00000009L, "0000009", "%1.7x", -__LINE__, 0xfffffc81L, "FFFFFC81", "% X", -__LINE__, -0x4ef2df5L, "-82783733", "%ld", -__LINE__, 0x00000013L, "19", "%-ld", -__LINE__, 0x00000000L, " 0", "%#7x", -__LINE__, -0x3b9485fdL, "-999589373", "%1.d", -__LINE__, -0x0000006L, "-00006", "%6.5d", -__LINE__, 0x0000003fL, "+63", "%+ld", -__LINE__, 0x000004c5L, "1221", "%1.d", -__LINE__, 0x003f8a8cL, "4164236", "%d", -__LINE__, -0x000001eL, "-30", "%-#3d", -__LINE__, 0xfff9d230L, "FFF9D230", "%+07.3X", -__LINE__, 0x0147cf17L, "147cf17", "% x", -__LINE__, 0xffffffebL, "ffffffeb", "%x", -__LINE__, 0x0000007dL, "00125", "%.5ld", -__LINE__, 0x000fff56L, "1048406", "%#3d", -__LINE__, 0x064307a0L, " 105056160", "% 0.3ld", -__LINE__, 0x007d2860L, "8202336", "%-.2d", -__LINE__, 0x00a05711L, "a05711", "%x", -__LINE__, 0x179a7f9eL, "0x179a7f9e", "%+#.3x", -__LINE__, 0x00000003L, "3", "%X", -__LINE__, -0x0001d7dL, "-7549", "%#5d", -__LINE__, 0x0025d3f2L, "+2479090", "%+2.d", -__LINE__, -0x0000001L, "-1", "%#ld", -__LINE__, 0xfffffdd5L, "fffffdd5", "%.7x", -__LINE__, 0x003462b9L, "3433145", "%d", -__LINE__, 0x00005a81L, "23169", "%d", -__LINE__, 0xfffffcdbL, "fffffcdb", "%-x", -__LINE__, 0x00000000L, "0", "%d", -__LINE__, 0xfff22085L, "fff22085", "%x", -__LINE__, 0x00016d72L, " 93554", "% d", -__LINE__, -0x0000002L, "-2", "%0ld", -__LINE__, 0xfffffd21L, "fffffd21", "% 0x", -__LINE__, 0x00000931L, "2353", "%ld", -__LINE__, 0x00010021L, "10021", "%5.1X", -__LINE__, -0x000007eL, "-126", "%1.0ld", -__LINE__, 0xfffffff8L, "fffffff8", "%01.x", -__LINE__, -0x001d148L, "-119112", "%d", -__LINE__, -0x0000008L, "-8", "%ld", -__LINE__, -0x000038eL, "-910", "% ld", -__LINE__, 0x0039e3e5L, "3793893", "%0.1d", -__LINE__, 0x0038fb8eL, "38FB8E", "%.2X", -__LINE__, -0x002dafaL, "-187130", "%ld", -__LINE__, -0xbec275bL, "-200025947", "%ld", -__LINE__, 0x1a32f999L, "1A32F999", "%05.4X", -__LINE__, 0x0000002fL, "2f", "%x", -__LINE__, -0x0001a5bL, "-6747", "%+3.ld", -__LINE__, 0x00000762L, " 1890", "%7.ld", -__LINE__, 0x000000c2L, "000194", "%0.6ld", -__LINE__, 0xffff002bL, "FFFF002B", "%.4X", -__LINE__, -0x0019daeL, "-105902", "% .2d", -__LINE__, 0x0000125fL, "125f", "%+1x", -__LINE__, -0x000b688L, " -46728", "%#7.d", -__LINE__, 0x000401caL, "401ca", "%0x", -__LINE__, 0x00000192L, "402", "%#ld", -__LINE__, 0xffffffffL, "ffffffff", "%x", -__LINE__, 0x1e505a0cL, "0X1E505A0C", "%#1.3X", -__LINE__, 0x000f8f6cL, "1019756", "%d", -__LINE__, 0x0004a296L, "4a296", "%5.2x", -__LINE__, 0x00000003L, "3", "% x", -__LINE__, -0x000d44cL, "-54348", "%#ld", -__LINE__, 0x00009ae2L, "39650", "%-d", -__LINE__, 0xffffff3aL, "FFFFFF3A", "% .7X", -__LINE__, 0x0042350bL, "4338955", "%d", -__LINE__, 0x000071afL, "71af", "%+.4x", -__LINE__, 0x00000001L, "0x1", "%#0x", -__LINE__, 0x00000033L, "00051", "%3.5d", -__LINE__, 0x00000001L, "1", "%X", -__LINE__, -0xebfb0e7L, "-247443687", "%+3ld", -__LINE__, 0x00000027L, "27 ", "%-07.X", -__LINE__, -0x0004837L, "-18487", "%01d", -__LINE__, 0x1a8c53daL, "1A8C53DA", "%X", -__LINE__, -0x0bdb8a9L, "-12433577", "%d", -__LINE__, -0x0000098L, "-152", "%#ld", -__LINE__, -0x003b554L, "-243028", "%d", -__LINE__, 0x000000cbL, "00000CB", "%+.7X", -__LINE__, 0xfffffedaL, "FFFFFEDA", "%X", -__LINE__, -0x0000010L, "-16", "%-#d", -__LINE__, 0x00000006L, "+6", "%+d", -__LINE__, 0x003c294aL, "+3942730", "%+4.ld", -__LINE__, 0x00000009L, "9", "%ld", -__LINE__, 0xfbbdd2bcL, "FBBDD2BC", "% X", -__LINE__, 0x71c86678L, "+1908958840", "%+0.6ld", -__LINE__, -0x0b49bffL, "-11836415", "% 6.ld", -__LINE__, 0xfff416beL, "fff416be", "%3.x", -__LINE__, 0x00000077L, "+119", "%+d", -__LINE__, 0xfff1cfaaL, "FFF1CFAA", "% 0.2X", -__LINE__, 0xfffffffbL, "fffffffb", "% x", -__LINE__, 0x0000127eL, "4734", "%d", -__LINE__, 0x00107ad2L, "107ad2", "%+2.6x", -__LINE__, 0x0006b8e9L, "440553", "%-#d", -__LINE__, 0x0000eb6fL, "eb6f", "% x", -__LINE__, 0x00001f18L, "7960", "%0d", -__LINE__, 0xfffff225L, "fffff225", "%1.5x", -__LINE__, 0xfffffff9L, "fffffff9", "%+6.x", -__LINE__, 0x000005b9L, "01465", "%.5ld", -__LINE__, 0xfffc26b8L, "FFFC26B8", "% X", -__LINE__, 0x540d580dL, "0X540D580D", "%+#X", -__LINE__, 0x05ad7094L, "5AD7094", "% 4.7X", -__LINE__, -0x000019bL, "-411", "% d", -__LINE__, 0x00000006L, "000006", "%6.6ld", -__LINE__, 0x0000026aL, "+618", "%+ld", -__LINE__, 0x0000000bL, "11", "%ld", -__LINE__, -0x26985d5L, "-40469973", "%#.0ld", -__LINE__, 0x0000007dL, "7D", "%+02.0X", -__LINE__, -0x0079ddfL, "-0499167", "%+.7ld", -__LINE__, 0x0000375fL, "14175", "%0d", -__LINE__, -0x18de7f99L, "-417234841", "%ld", -__LINE__, -0x00507ccL, "-329676", "%.0d", -__LINE__, 0x000029d5L, "29D5", "%-2.1X", -__LINE__, 0x0000328cL, "328C", "%-3.X", -__LINE__, 0x016f6234L, "24076852", "%3.ld", -__LINE__, 0xfffffffcL, "0XFFFFFFFC", "%#.5X", -__LINE__, 0xfe6163caL, "FE6163CA", "%5.X", -__LINE__, 0xffffffc2L, "FFFFFFC2", "%X", -__LINE__, 0x00000087L, "+135", "%+ld", -__LINE__, 0x00310166L, "310166", "% x", -__LINE__, 0x00e8c871L, "15255665", "%d", -__LINE__, 0x000005eeL, "1518", "%ld", -__LINE__, 0xfcb24306L, "FCB24306", "%X", -__LINE__, 0x0000000bL, " 11", "%5ld", -__LINE__, 0x006d11d0L, "0x6d11d0", "%#.0x", -__LINE__, 0x0010d416L, "1102870", "%#6.5d", -__LINE__, -0x0047cb3L, "-294067", "%.3d", -__LINE__, 0x000000c0L, "c0", "%x", -__LINE__, 0xffffffffL, "FFFFFFFF", "%+X", -__LINE__, -0x000000aL, "-10", "%d", -__LINE__, -0x0000007L, "-7", "% ld", -__LINE__, 0xfffffffeL, "FFFFFFFE", "%-X", -__LINE__, 0x00000014L, "0x14", "%-#3.1x", -__LINE__, 0x00003319L, "3319", "% x", -__LINE__, 0x00000000L, "00", "%+#.2X", -__LINE__, -0x0000009L, "-9", "% ld", -__LINE__, -0x0000001L, "-1 ", "%-3ld", -__LINE__, 0x00262909L, "2500873", "%.5ld", -__LINE__, 0x33e76560L, "33e76560", "%7.0x", -__LINE__, -0x0000002L, "-2", "%ld", -__LINE__, 0x00035ee9L, "35EE9", "%-3.X", -__LINE__, -0x0000235L, "-565", "%+4.ld", -__LINE__, -0x3ea63c5L, "-65692613", "%d", -__LINE__, 0x00000003L, "3", "%ld", -__LINE__, -0x003362fL, "-210479", "% d", -__LINE__, -0x1a819f8aL, "-444702602", "%.7d", -__LINE__, 0x027a4668L, "41567848", "%d", -__LINE__, 0x0002b025L, "2b025", "%x", -__LINE__, -0x0000001L, "-001", "%.3ld", -__LINE__, 0xfffffff0L, "fffffff0", "%-0x", -__LINE__, -0x0000d4fL, "-3407", "%-ld", -__LINE__, 0x00000146L, " 326", "% 1.d", -__LINE__, -0x0000006L, "-6", "%d", -__LINE__, 0xffffffffL, "FFFFFFFF", "%06.4X", -__LINE__, 0x376fddaeL, "+930078126", "%+#0ld", -__LINE__, 0x006d9da3L, "6d9da3", "%1.x", -__LINE__, -0x0000f28L, "-3880", "%3.2ld", -__LINE__, 0x0006962cL, " 431660", "% 5d", -__LINE__, 0x000011dbL, " 4571", "%6.ld", -__LINE__, 0xffffffa8L, "ffffffa8", "%+x", -__LINE__, 0x0d886db3L, "D886DB3", "%.7X", -__LINE__, 0x00000000L, "000000", "%2.6ld", -__LINE__, 0xfffff6b6L, "FFFFF6B6", "% X", -__LINE__, -0x0739068L, "-7573608", "%+6.ld", -__LINE__, 0xfba62553L, "0XFBA62553", "%#X", -__LINE__, -0x4474bc5L, "-71781317", "%-2ld", -__LINE__, 0xffffff95L, "FFFFFF95", "% 2.X", -__LINE__, -0x1d0e1caL, "-30466506", "%+.0d", -__LINE__, -0x000f3aaL, "-62378", "%ld", -__LINE__, 0x00000026L, "26", "%1x", -__LINE__, 0x001c5400L, "1856512", "%-#d", -__LINE__, 0x03808442L, "3808442", "%X", -__LINE__, -0x0000081L, "-129", "%+#ld", -__LINE__, 0x000004aeL, " 1198", "% 3.4d", -__LINE__, -0x7f4ed54L, "-133492052", "%d", -__LINE__, 0x00000000L, "+0", "%+ld", -__LINE__, 0x00000000L, "0", "%+x", -__LINE__, 0x004c7e46L, "5013062", "%.0d", -__LINE__, -0x647d7a65L, "-1685944933", "%0.2d", -__LINE__, 0x00003b59L, "15193", "%-#1d", -__LINE__, 0xfff3e64dL, "FFF3E64D", "%-X", -__LINE__, 0x00007022L, "28706", "%-d", -__LINE__, 0xc28d0ad8L, "c28d0ad8", "%+x", -__LINE__, -0x005c208L, "-377352", "% ld", -__LINE__, 0x00cfbadcL, "13613788", "%d", -__LINE__, 0x000016eaL, "5866", "%0d", -__LINE__, 0x00000029L, "29", "%X", -__LINE__, 0xffe16813L, "0XFFE16813", "%+#X", -__LINE__, 0x00000004L, "4", "%0X", -__LINE__, -0x0000096L, " -150", "%5d", -__LINE__, 0x00027ac7L, "162503", "%ld", -__LINE__, -0x0075de0L, "-482784", "%d", -__LINE__, 0x005fcff6L, "6279158", "%d", -__LINE__, 0xffffffefL, "FFFFFFEF", "%3X", -__LINE__, 0x267b05ecL, "645596652", "%4ld", -__LINE__, 0xa487b724L, "a487b724", "%x", -__LINE__, 0x01da2a11L, "31074833", "%-.0ld", -__LINE__, 0xffffffffL, "FFFFFFFF", "%X", -__LINE__, 0x0000037aL, "37a", "%x", -__LINE__, 0x003d0314L, "+3998484", "%+#1d", -__LINE__, 0x0000011bL, " 283", "%5.2d", -__LINE__, 0x094f6066L, "94f6066", "%x", -__LINE__, 0x00000004L, "4", "%X", -__LINE__, -0x102e14bdL, "-271455421", "% 7.ld", -__LINE__, 0x000048daL, "0018650", "%07ld", -__LINE__, -0x24ae0390L, "-615383952", "%0.6d", -__LINE__, 0xffff5159L, "0XFFFF5159", "%#0X", -__LINE__, 0xfffd38c3L, "fffd38c3", "%x", -__LINE__, 0xfffff9eaL, "FFFFF9EA", "%-X", -__LINE__, -0x000fd28L, "-64808", "% ld", -__LINE__, 0x002c1bf4L, "2890740", "%-.1d", -__LINE__, 0x00d00ee7L, "D00EE7", "%0.4X", -__LINE__, 0x00000cf9L, "3321", "%0d", -__LINE__, -0x0000001L, "-1", "%-#ld", -__LINE__, 0xfffffd75L, "FFFFFD75", "%.2X", -__LINE__, 0x00000012L, "18", "%-d", -__LINE__, 0xfd44b4b2L, "fd44b4b2", "%+5.x", -__LINE__, -0x001c53fL, "-116031", "%-#6.d", -__LINE__, 0x000ff6fdL, "ff6fd", "%2x", -__LINE__, 0x00000001L, "1", "%0d", -__LINE__, 0x0120b478L, "120B478", "%.7X", -__LINE__, 0x0145591eL, "145591E", "%1.4X", -__LINE__, 0x001f99b9L, "1F99B9", "%.1X", -__LINE__, 0xffffd078L, "ffffd078", "%-1.5x", -__LINE__, 0xffffff1aL, "FFFFFF1A", "%-4.6X", -__LINE__, 0xfffffffaL, "fffffffa", "%x", -__LINE__, -0x00000b9L, "-185", "%3ld", -__LINE__, 0x00001cf0L, "7408", "%-ld", -__LINE__, 0xffffffffL, "FFFFFFFF", "%X", -__LINE__, 0x00151f30L, "151F30", "%X", -__LINE__, -0x0000103L, "-259", "%d", -__LINE__, -0x000303fL, "-12351", "%d", -__LINE__, 0x000002caL, "714", "%ld", -__LINE__, -0x0000c55L, "-3157", "%1d", -__LINE__, 0x00000691L, "01681", "%#.5ld", -__LINE__, 0x00230537L, "2295095", "%#d", -__LINE__, 0x032a1faaL, "53092266", "%.4d", -__LINE__, 0x000050d7L, "20695", "%d", -__LINE__, -0x0c7ad4cL, "-13086028", "%#.4ld", -__LINE__, -0x00009d9L, "-2521", "%+d", -__LINE__, 0xfffffffeL, "fffffffe", "%0x", -__LINE__, 0xffdec2d9L, "FFDEC2D9", "%5.1X", -__LINE__, -0x000563cL, "-22076", "%-.2ld", -__LINE__, 0x0073b36aL, "0x73b36a", "%-#x", -__LINE__, 0xfffffffdL, "fffffffd", "%x", -__LINE__, 0x0193ba5aL, "193ba5a", "%1.x", -__LINE__, 0x00d147b5L, "13715381", "%2.d", -__LINE__, 0xffffff10L, "ffffff10", "%4x", -__LINE__, 0x000648d5L, "648d5", "%1.3x", -__LINE__, 0x00000011L, "11", "%X", -__LINE__, 0xff259f5bL, "0xff259f5b", "% #.1x", -__LINE__, 0x00000175L, "175", "%x", -__LINE__, 0x00000000L, "0", "%ld", -__LINE__, 0x00000015L, "21", "%#ld", -__LINE__, 0xfffffffeL, "fffffffe", "%-x", -__LINE__, 0x00000013L, " 19", "% 0ld", -__LINE__, -0x0000001L, "-0000001", "% 5.7ld", -__LINE__, 0x0000139dL, "139D", "%X", -__LINE__, 0x0041ad18L, "41ad18", "%-.6x", -__LINE__, -0x00000f9L, "-249", "% 3.d", -__LINE__, 0x00000076L, "118", "%ld", -__LINE__, 0x000006f8L, "1784", "%d", -__LINE__, -0x0000005L, "-5", "%ld", -__LINE__, -0x00008e7L, "-2279", "%+ld", -__LINE__, 0x00003f77L, "3F77", "%+0X", -__LINE__, 0x000ca3f8L, "0XCA3F8", "%+#X", -__LINE__, -0x00004bfL, "-001215", "%#5.6ld", -__LINE__, 0x319129abL, "0x319129ab", "%+#x", -__LINE__, -0x0000002L, "-2", "%ld", -__LINE__, -0x0f6686eL, "-16148590", "%.6ld", -__LINE__, 0x0329576bL, "53041003", "%2.d", -__LINE__, -0x000179eL, "-6046", "%d", -__LINE__, 0x000002ccL, "+716", "%+1.3ld", -__LINE__, 0xfffffff7L, "0xfffffff7", "% #x", -__LINE__, 0x0016eb40L, "1502016", "%ld", -__LINE__, 0x00000003L, "3", "%-0ld", -__LINE__, 0x0023e0d6L, "23E0D6", "%-05.X", -__LINE__, 0xffffa6a4L, "0XFFFFA6A4", "%#X", -__LINE__, 0x00087664L, "87664", "% .2x", -__LINE__, -0x0000002L, " -2", "%3.ld", -__LINE__, 0x003ad85dL, "3AD85D", "%X", -__LINE__, 0x00002f20L, "12064", "%ld", -__LINE__, 0x02030bfcL, "2030BFC", "%02.3X", -__LINE__, 0xfffff36aL, "FFFFF36A", "%X", -__LINE__, 0xfe0729ffL, "0xfe0729ff", "% #.0x", -__LINE__, 0xfec15164L, "FEC15164", "%0.2X", -__LINE__, -0x00169ecL, "-92652", "%+d", -__LINE__, 0x006d7990L, "0x6d7990", "%#x", -__LINE__, 0xffcc89e6L, "ffcc89e6", "%x", -__LINE__, 0x002d7ccaL, "2981066", "%7.7ld", -__LINE__, -0x1649692bL, "-373909803", "%#ld", -__LINE__, 0x00664f47L, "664f47", "%+6.x", -__LINE__, 0x00000000L, "0", "% X", -__LINE__, 0x00000047L, "000047", "%.6X", -__LINE__, 0x00000007L, "0000007", "%.7ld", -__LINE__, 0x00000030L, "30", "%-x", -__LINE__, -0x25bcbabbL, "-633125563", "% ld", -__LINE__, 0xfe11c031L, "FE11C031", "%4.6X", -__LINE__, -0x0000001L, "-0000001", "%.7d", -__LINE__, 0x00b56d84L, "11890052", "%ld", -__LINE__, -0x0000b01L, "-0002817", "%+07.7ld", -__LINE__, 0xffffe4adL, "ffffe4ad", "% 0.0x", -__LINE__, 0x007760fcL, "7760fc", "%+x", -__LINE__, 0xffef44d8L, "FFEF44D8", "%X", -__LINE__, 0xfcb6862eL, "fcb6862e", "%+x", -__LINE__, -0x0000001L, "-1", "%0d", -__LINE__, 0xffffffe6L, "FFFFFFE6", "%3.1X", -__LINE__, 0xff816e27L, "FF816E27", "% 6.X", -__LINE__, 0x00006415L, "25621", "%ld", -__LINE__, -0xfae5449L, "-263083081", "%0ld", -__LINE__, 0x00000001L, " 1", "% 0d", -__LINE__, 0x00000009L, " 9", "%2.X", -__LINE__, 0x002d7e18L, "2981400", "%7d", -__LINE__, -0x00000fcL, "-0000252", "%-#.7d", -__LINE__, 0x00000003L, "3", "%0x", -__LINE__, 0x0d46e47fL, "222749823", "%ld", -__LINE__, 0xfffcbc52L, "FFFCBC52", "%+X", -__LINE__, 0x00000000L, "0", "%-X", -__LINE__, 0xfffff0e5L, "fffff0e5", "%x", -__LINE__, 0xffffffd9L, "FFFFFFD9", "%07X", -__LINE__, 0x000004eeL, "4ee", "%0x", -__LINE__, 0xffffffffL, "ffffffff", "%0x", -__LINE__, -0x0008cb4L, "-036020", "%+3.6ld", -__LINE__, 0x0000dadaL, "0xdada", "%#0.x", -__LINE__, 0x0000001aL, "26 ", "%-4d", -__LINE__, -0x000000cL, " -12", "%04.d", -__LINE__, 0x0000025cL, " 25c", "%7.x", -__LINE__, 0xfe9b091eL, "FE9B091E", "%X", -__LINE__, 0x00000002L, " 2", "%07.ld", -__LINE__, -0x0004930L, "-18736", "% 6.d", -__LINE__, 0xffffffe9L, "FFFFFFE9", "%X", -__LINE__, 0x00000003L, " 3", "%2.ld", -__LINE__, 0x00000e00L, "3584", "%.4d", -__LINE__, 0xffff38c2L, "ffff38c2", "%0.x", -__LINE__, 0xffffffffL, "FFFFFFFF", "% .3X", -__LINE__, 0xff7c1b2fL, "FF7C1B2F", "%-3.2X", -__LINE__, -0x0000005L, "-5", "%2d", -__LINE__, 0x00098775L, "98775", "%x", -__LINE__, 0x000015ffL, " 15FF", "%6.X", -__LINE__, 0xfffbe3efL, "FFFBE3EF", "%0.3X", -__LINE__, -0x0000048L, "-72", "%ld", -__LINE__, 0x0001488aL, "84106", "%d", -__LINE__, 0x00000001L, "1", "%x", -__LINE__, -0x0000002L, "-2", "%-0.0ld", -__LINE__, -0x0000001L, "-1", "%-d", -__LINE__, 0x0006616fL, "6616f", "%x", -__LINE__, 0x3657856dL, "911705453", "%6.d", -__LINE__, -0x0007222L, "-0029218", "%.7d", -__LINE__, 0x00041606L, "267782", "%04.5d", -__LINE__, 0x00000001L, " 1", "%2.ld", -__LINE__, 0x00000219L, "219", "%0x", -__LINE__, 0x0ae0184cL, "ae0184c", "%x", -__LINE__, 0x00003a7dL, " 14973", "%7.ld", -__LINE__, 0xffffffffL, "0XFFFFFFFF", "%#X", -__LINE__, -0x0000002L, "-2", "%0ld", -__LINE__, 0x00002cdfL, "11487", "%0ld", -__LINE__, -0x000000cL, "-12", "%d", -__LINE__, -0x000000eL, "-14", "%-#2d", -__LINE__, 0x00000371L, "881", "%#ld", -__LINE__, 0x000015beL, " 5566", "%5.ld", -__LINE__, 0x01525b91L, "22174609", "%#0.0ld", -__LINE__, 0xff8fc22fL, "FF8FC22F", "% X", -__LINE__, -0x0007f7bL, "-32635", "%4.ld", -__LINE__, 0x00007bcaL, "7bca", "%x", -__LINE__, -0x0000582L, "-1410", "%ld", -__LINE__, 0x00000047L, " +71", "%+04.2d", -__LINE__, 0xf8a8dce2L, "f8a8dce2", "%+.6x", -__LINE__, -0x000de2eL, "-56878", "%.0d", -__LINE__, 0x019c03c1L, "0X19C03C1", "%#X", -__LINE__, -0x0f3a43eL, "-15967294", "%ld", -__LINE__, 0x00009e87L, "40583", "%#5.1d", -__LINE__, 0x000000b8L, "184", "%0ld", -__LINE__, -0x000befeL, "-48894", "%2ld", -__LINE__, -0x002ee1aL, "-192026", "%.2d", -__LINE__, 0x00004fd8L, "4fd8", "%x", -__LINE__, 0x0006d57bL, "447867", "%2d", -__LINE__, 0xfffffa9cL, "FFFFFA9C", "%-X", -__LINE__, 0x0000000fL, "15", "%ld", -__LINE__, 0x0005deb2L, "5DEB2", "% X", -__LINE__, 0x00000007L, "7", "%X", -__LINE__, 0xffffffc8L, "0XFFFFFFC8", "% #.1X", -__LINE__, 0xfffff62fL, "FFFFF62F", "%X", -__LINE__, -0x1a935bbaL, "-445864890", "% 3.5d", -__LINE__, 0x000b34b4L, "0x0b34b4", "%-#3.6x", -__LINE__, 0xfffff430L, "FFFFF430", "%X", -__LINE__, 0x00000b5fL, "+0002911", "%+#.7d", -__LINE__, 0x00000007L, " 7", "%3ld", -__LINE__, 0xffffffd8L, "FFFFFFD8", "% .7X", -__LINE__, 0xfffff544L, "FFFFF544", "%0X", -__LINE__, -0x353667b9L, "-892757945", "%d", -__LINE__, 0x00000058L, "0x00058", "%+#.5x", -__LINE__, 0x39dbcc4aL, "+970705994", "%+0.6ld", -__LINE__, 0xfffffffdL, "fffffffd", "% 01x", -__LINE__, 0x00b1c28eL, "+11649678", "%+0ld", -__LINE__, 0x000066c2L, "0X66C2", "%-#4X", -__LINE__, 0x007171a2L, "+7434658", "%+07.ld", -__LINE__, -0x0000001L, "-1", "%-d", -__LINE__, 0x00000ae0L, "+2784", "%+0d", -__LINE__, 0x13786a57L, "326658647", "%#5d", -__LINE__, -0x0000001L, "-1", "%2.ld", -__LINE__, -0x0168a16L, "-1477142", "%d", -__LINE__, 0x12df7dd6L, "316636630", "%ld", -__LINE__, 0x00000000L, "000000", "%1.6d", -__LINE__, 0x266da2a9L, "644719273", "%ld", -__LINE__, 0x0000004aL, "74", "%d", -__LINE__, 0x000102ffL, "00102FF", "%+06.7X", -__LINE__, 0x17916237L, "0x17916237", "%#5x", -__LINE__, -0x0003cbbL, "-0015547", "%-.7d", -__LINE__, 0xe7da2010L, "e7da2010", "%2.4x", -__LINE__, 0xfffffff3L, "fffffff3", "% .7x", -__LINE__, 0xfc9b64f8L, "FC9B64F8", "% 7.X", -__LINE__, 0x000001afL, "431", "%0d", -__LINE__, 0xffc81796L, "0xffc81796", "%#.5x", -__LINE__, 0x057a1fbcL, "+91889596", "%+04d", -__LINE__, 0x00001ae1L, "6881", "%ld", -__LINE__, 0xfffffff6L, "fffffff6", "%3.0x", -__LINE__, -0x6b7d5dbL, "-112711131", "%-06.1d", -__LINE__, 0x008e8a5cL, " 8e8a5c", "%7.0x", -__LINE__, 0xfe07a9bdL, "fe07a9bd", "%.1x", -__LINE__, -0x00278e6L, "-162022", "%0ld", -__LINE__, 0xf98709f5L, "F98709F5", "%X", -__LINE__, -0x00000c9L, "-201", "% 1.d", -__LINE__, -0x000001dL, "-00029", "%+2.5ld", -__LINE__, 0x00000030L, " 48", "% d", -__LINE__, 0xffd753f4L, "FFD753F4", "%0X", -__LINE__, 0xfffffffdL, "FFFFFFFD", "%X", -__LINE__, 0x0000a765L, "a765", "%x", -__LINE__, 0x0026e2c8L, "26E2C8", "%-0X", -__LINE__, -0x00003ebL, "-1003", "%3.1ld", -__LINE__, 0x015d53caL, "22893514", "%0ld", -__LINE__, -0x0000020L, "-32", "%ld", -__LINE__, -0x03558ddL, "-3496157", "%1.0ld", -__LINE__, -0x000007fL, "-127", "%1.d", -__LINE__, 0xffffc737L, "0xffffc737", "%+#x", -__LINE__, 0x0000a70dL, " a70d", "%6.x", -__LINE__, 0x01ea0e31L, "0X1EA0E31", "% #1.X", -__LINE__, 0x00b5f406L, "0X0B5F406", "%-#.7X", -__LINE__, 0x0e58fa9aL, "240712346", "%.2d", -__LINE__, 0xf43ff8a9L, "f43ff8a9", "%+0.6x", -__LINE__, -0x5d0d3d3L, "-97571795", "%.3ld", -__LINE__, -0x000027aL, "-634", "%0d", -__LINE__, 0xffcef248L, "FFCEF248", "%07.X", -__LINE__, 0x000002dcL, "2dc", "%0x", -__LINE__, -0x31fa6c1L, "-52405953", "%.2d", -__LINE__, 0x00000014L, "14", "%X", -__LINE__, -0x0282f98L, "-2633624", "%ld", -__LINE__, 0x00005f55L, "24405", "%#d", -__LINE__, -0x0000004L, "-4", "%d", -__LINE__, 0x00000001L, "1", "%+x", -__LINE__, 0x013f47ceL, "13f47ce", "%0.x", -__LINE__, 0x00143fceL, "1327054", "%.3d", -__LINE__, 0x00000000L, "0", "%d", -__LINE__, 0x00001f9aL, "1F9A", "% X", -__LINE__, 0x00000cf5L, "cf5", "%x", -__LINE__, 0xffea9c24L, "ffea9c24", "%x", -__LINE__, 0xf09f85a7L, "F09F85A7", "%X", -__LINE__, 0x00001e04L, "7684", "%ld", -__LINE__, 0xffffc82aL, "ffffc82a", "%7x", -__LINE__, -0x0000a77L, "-2679", "% d", -__LINE__, 0x0019a859L, "+1681497", "%+2.6ld", -__LINE__, -0x00002d7L, "-727", "%ld", -__LINE__, 0x00011b82L, "72578", "%-#ld", -__LINE__, 0x00000c32L, "3122", "%ld", -__LINE__, -0x0000337L, "-823", "%1.d", -__LINE__, 0x00000004L, "4", "%1ld", -__LINE__, 0x0000062cL, "1580", "%.1ld", -__LINE__, 0xffffffd3L, "FFFFFFD3", "% X", -__LINE__, -0x07b1bf8L, "-8068088", "%#d", -__LINE__, 0xfffffff9L, "fffffff9", "%x", -__LINE__, 0x159e6cfbL, "159e6cfb", "%0.x", -__LINE__, 0x0001148dL, "1148d", "%-.1x", -__LINE__, 0x003373b7L, "3371959", "%#.0d", -__LINE__, 0x00001af2L, "1af2", "%.4x", -__LINE__, -0x0000001L, "-000001", "%+.6ld", -__LINE__, -0x00001a3L, "-419", "%d", -__LINE__, 0xfdb232e7L, "fdb232e7", "%5.4x", -__LINE__, -0x000000dL, "-13", "%d", -__LINE__, 0x98ec1c74L, "98ec1c74", "% 3x", -__LINE__, 0xfffffff8L, "fffffff8", "%+1.4x", -__LINE__, -0x0000d58L, "-3416", "%+#0ld", -__LINE__, -0x65d1973L, "-106764659", "%.6d", -__LINE__, -0x0737641L, "-7566913", "%-d", -__LINE__, 0x0000037cL, "37c", "%+0x", -__LINE__, 0x0000012cL, "0000300", "%#3.7d", -__LINE__, 0x00c12d9bL, "12660123", "%1.5ld", -__LINE__, 0xe7e5e77dL, "e7e5e77d", "%6x", -__LINE__, 0x1fe0e820L, "1FE0E820", "%-4X", -__LINE__, 0xc85a793aL, "C85A793A", "%X", -__LINE__, 0x05f9fe2cL, "100269612", "%#ld", -__LINE__, 0x00000032L, "0X32", "%+#4.1X", -__LINE__, 0xfab4ce81L, "fab4ce81", "%3.x", -__LINE__, -0x0000009L, "-9", "%2.d", -__LINE__, 0xffff8d2eL, "ffff8d2e", "% 6x", -__LINE__, 0xfffffffeL, "0xfffffffe", "%#x", -__LINE__, 0x02960f60L, "2960f60", "%1.x", -__LINE__, 0x34cf3cbcL, " 885996732", "% 5ld", -__LINE__, -0x000006eL, "-110", "% d", -__LINE__, -0x0000001L, "-1", "%-.0d", -__LINE__, 0x000000b1L, " B1", "%+7X", -__LINE__, 0xfffff5b4L, "FFFFF5B4", "%01.7X", -__LINE__, 0x00000086L, "86", "%0X", -__LINE__, 0x00074367L, " 74367", "% 6x", -__LINE__, 0x001000d7L, "+1048791", "%+ld", -__LINE__, 0x00000f35L, " 3893", "% d", -__LINE__, -0x00000e1L, "-225", "%d", -__LINE__, 0xffff6694L, "FFFF6694", "%6.X", -__LINE__, 0x00019cf7L, "19cf7", "%0.x", -__LINE__, 0x00000046L, "0046", "%+.4X", -__LINE__, -0x000001fL, "-31", "%ld", -__LINE__, 0xfff25859L, "fff25859", "%6x", -__LINE__, 0x21884061L, "562577505", "%#ld", -__LINE__, 0x01448b7aL, "1448B7A", "%0.1X", -__LINE__, 0xffffffc0L, "ffffffc0", "%x", -__LINE__, 0xfffffed5L, "fffffed5", "% 1.0x", -__LINE__, 0x0e349767L, "E349767", "%.5X", -__LINE__, 0x00000330L, "816", "%0d", -__LINE__, -0x0000016L, "-22", "%d", -__LINE__, 0xffff9babL, "FFFF9BAB", "%X", -__LINE__, 0xffffee4eL, "ffffee4e", "%x", -__LINE__, 0x0026beebL, "2539243", "%6.d", -__LINE__, 0x00002c6cL, "11372", "%.2d", -__LINE__, -0x000002cL, "-44", "%ld", -__LINE__, -0x001dcfaL, "-122106", "% d", -__LINE__, 0x0001683cL, "92220", "%#4.ld", -__LINE__, 0x09b51fc9L, "9b51fc9", "%+.7x", -__LINE__, 0x0000001dL, "29", "%0ld", -__LINE__, -0x83f17e5L, "-138352613", "%ld", -__LINE__, 0xfa4e2c1bL, "fa4e2c1b", "%x", -__LINE__, 0x000001f3L, "499", "%0ld", -__LINE__, 0xffff03e4L, "ffff03e4", "%x", -__LINE__, 0x000000acL, "+0172", "%+.4ld", -__LINE__, 0x03c3903bL, "63148091", "%00d", -__LINE__, 0x0000000dL, "13", "%#d", -__LINE__, 0x0000002eL, "0X2E", "%#X", -__LINE__, 0x00006b2dL, "6B2D", "%X", -__LINE__, 0x0000010bL, " 0010b", "%7.5x", -__LINE__, 0x0000017aL, " 17a", "%4x", -__LINE__, 0xfffffffbL, "fffffffb", "%+x", -__LINE__, 0xffffac6aL, "ffffac6a", "%-.3x", -__LINE__, -0x0005870L, "-22640", "%0d", -__LINE__, 0x189c17bcL, "189c17bc", "%x", -__LINE__, -0x01bbc38L, "-1817656", "%#6.ld", -__LINE__, -0x3382b55L, "-54012757", "%d", -__LINE__, -0x0000007L, "-7", "%-ld", -__LINE__, -0x000c74bL, "-51019", "%ld", -__LINE__, 0x0001a6f2L, "+108274", "%+#1.ld", -__LINE__, 0x00077448L, "77448", "%x", -__LINE__, 0x00000000L, "0", "%x", -__LINE__, 0xfffff056L, "FFFFF056", "%.3X", -__LINE__, -0x6f3f9451L, "-1866437713", "%-#3.0ld", -__LINE__, 0x000000acL, "AC", "%X", -__LINE__, 0xffc8752fL, "ffc8752f", "%-x", -__LINE__, 0xfffffe6dL, "FFFFFE6D", "%2.X", -__LINE__, -0x377f1a5L, "-58192293", "% .2d", -__LINE__, -0x0000294L, "-660", "%d", -__LINE__, 0xfffffffeL, "fffffffe", "%-x", -__LINE__, 0xfffcbbe8L, "0xfffcbbe8", "%-#4.x", -__LINE__, 0x0022e510L, "+2286864", "%+ld", -__LINE__, 0xfffffe2aL, "FFFFFE2A", "%0.3X", -__LINE__, 0xfe29f7c0L, "fe29f7c0", "%x", -__LINE__, 0xfffe957eL, "FFFE957E", "%X", -__LINE__, 0x000080f8L, "33016", "%ld", -__LINE__, 0x0003ee2cL, " 257580", "%7d", -__LINE__, 0x000003a1L, "929", "%d", -__LINE__, 0x0000021fL, "21f", "%+x", -__LINE__, 0xffffffffL, "ffffffff", "%.5x", -__LINE__, -0x040a988L, "-4237704", "%-d", -__LINE__, 0x027c8b69L, "41716585", "%ld", -__LINE__, 0x00000003L, "3", "%-X", -__LINE__, -0x0000368L, " -872", "%7.d", -__LINE__, 0x00000d3cL, "3388", "%0.2d", -__LINE__, -0x33734ccL, "-53949644", "%2ld", -__LINE__, 0x000003dbL, "3DB", "%X", -__LINE__, -0x00f154dL, "-988493", "%5d", -__LINE__, 0x0000000bL, " 11", "%4.ld", -__LINE__, 0x00000067L, "103", "%-ld", -__LINE__, -0x0199fceL, "-1679310", "%4d", -__LINE__, 0x02b6266bL, "2b6266b", "% x", -__LINE__, -0x006b39dL, "-439197", "%+d", -__LINE__, 0x00000007L, "7", "%ld", -__LINE__, 0x0141fc98L, "21101720", "%0ld", -__LINE__, -0x0008420L, "-33824", "%d", -__LINE__, 0x0011622bL, "1139243", "%6ld", -__LINE__, 0x0000001bL, "27", "%-d", -__LINE__, -0x0030935L, "-198965", "%3d", -__LINE__, 0x0000001fL, " 1f", "%4.x", -__LINE__, -0x10782a19L, "-276310553", "%#ld", -__LINE__, -0x007eac4L, "-518852", "%06.ld", -__LINE__, 0x0bc4c681L, "197445249", "%6ld", -__LINE__, 0x000000f5L, "245", "%.3ld", -__LINE__, 0x00000197L, "197", "%X", -__LINE__, 0xfffffeabL, "FFFFFEAB", "% X", -__LINE__, 0x00000f05L, "F05", "%+X", -__LINE__, 0xffe1b785L, "0xffe1b785", "%#x", -__LINE__, -0x02d3581L, "-2962817", "%05d", -__LINE__, 0xffffb994L, "FFFFB994", "%X", -__LINE__, 0x03d139a3L, "64043427", "%ld", -__LINE__, -0x0000002L, " -2", "%+4.d", -__LINE__, -0x043da83L, "-4446851", "%#ld", -__LINE__, -0x6aad891L, "-111859857", "%7.ld", -__LINE__, 0x00003e68L, "15976", "%-4.5ld", -__LINE__, 0xffe4d3eeL, "FFE4D3EE", "%X", -__LINE__, 0x00000002L, "000002", "%4.6ld", -__LINE__, 0xffffee32L, "ffffee32", "%4x", -__LINE__, 0x0cb7dd25L, "cb7dd25", "%3x", -__LINE__, 0xf773d422L, "F773D422", "%X", -__LINE__, -0x0b590f7L, "-11899127", "%#d", -__LINE__, -0x0002c45L, "-11333", "%-#5ld", -__LINE__, -0x1efc9e4L, "-32492004", "%ld", -__LINE__, -0x0003b9cL, "-15260", "%d", -__LINE__, 0x000001b6L, "0X1B6", "%#4X", -__LINE__, 0x3ce93ec3L, "1021918915", "%.6d", -__LINE__, 0xffffffffL, "ffffffff", "%-x", -__LINE__, 0xfffaf0e4L, "fffaf0e4", "%2.x", -__LINE__, 0x00000002L, "0x2", "%#x", -__LINE__, 0x0000e806L, "e806", "%4x", -__LINE__, 0xfffffff0L, "fffffff0", "% 2.x", -__LINE__, 0xfffffc0eL, "fffffc0e", "%+.4x", -__LINE__, 0xfd45716eL, "FD45716E", "%.4X", -__LINE__, 0xfff96fdaL, "FFF96FDA", "%-X", -__LINE__, 0xff99d08aL, "FF99D08A", "%.5X", -__LINE__, 0x00000002L, "2", "%-00.d", -__LINE__, -0x000000fL, " -15", "%6.ld", -__LINE__, -0x00d321cL, "-864796", "%#1ld", -__LINE__, 0xff19ff8dL, "ff19ff8d", "%1.5x", -__LINE__, 0x00000000L, "0000000", "%-.7x", -__LINE__, 0x0000f50dL, " F50D", "%5X", -__LINE__, 0x00001688L, " 5768", "%7.ld", -__LINE__, 0x00000157L, "343", "%2ld", -__LINE__, 0xfffffffdL, "0xfffffffd", "%+#3x", -__LINE__, 0x00000d52L, "3410", "%ld", -__LINE__, 0x00000003L, "3", "%d", -__LINE__, 0x0001c6d2L, "01c6d2", "%.6x", -__LINE__, 0x242d65d2L, "606954962", "%#7.ld", -__LINE__, 0x00000e9fL, "0000E9F", "%5.7X", -__LINE__, 0x0002d785L, "2D785", "%0X", -__LINE__, 0x00000167L, "167", "%0X", -__LINE__, 0xfffff5e5L, "fffff5e5", "% x", -__LINE__, 0xffb69a04L, "0xffb69a04", "%#0.x", -__LINE__, 0xfffa012eL, "FFFA012E", "%X", -__LINE__, 0x0000001aL, "0x1a", "% #x", -__LINE__, 0xfffb26d3L, "fffb26d3", "%+x", -__LINE__, -0x00003e6L, " -998", "%7ld", -__LINE__, 0x00000004L, "4", "%-d", -__LINE__, 0xfffffd76L, "0XFFFFFD76", "%#7X", -__LINE__, 0x00000035L, "53", "%ld", -__LINE__, 0xffc6c190L, "0XFFC6C190", "%#X", -__LINE__, 0xffffffe2L, "ffffffe2", "%7.0x", -__LINE__, 0x03ff1b87L, "67050375", "%2.d", -__LINE__, 0x00020c47L, "0X20C47", "%#X", -__LINE__, 0x00000000L, "0", "%d", -__LINE__, 0x0000000eL, "0X000E", "% #.4X", -__LINE__, -0x00035cdL, "-13773", "%+2.d", -__LINE__, 0x00005eecL, "5eec", "%1x", -__LINE__, 0x001da0ffL, "1941759", "%0d", -__LINE__, 0xf8a9e96aL, "f8a9e96a", "%+x", -__LINE__, -0x0000120L, "-288 ", "%-#6.d", -__LINE__, 0x00000000L, "0", "%-X", -__LINE__, 0x0000152eL, "152E", "%+X", -__LINE__, -0x0001077L, "-4215", "% 0d", -__LINE__, 0xffffffd7L, "FFFFFFD7", "%0X", -__LINE__, 0xfffe097dL, "FFFE097D", "%2X", -__LINE__, 0xcb982712L, "cb982712", "%x", -__LINE__, 0xfff39f2eL, "FFF39F2E", "%.5X", -__LINE__, -0x0058caeL, "-363694", "%+.1d", -__LINE__, -0x000002bL, "-043", "%#1.3d", -__LINE__, -0x001e989L, "-125321", "%1d", -__LINE__, 0x00959ecdL, "9805517", "%d", -__LINE__, 0xf49df846L, "F49DF846", "%+3X", -__LINE__, 0xfffffffdL, "fffffffd", "%+.5x", -__LINE__, -0x000ac76L, "-44150", "%3.ld", -__LINE__, 0x00000028L, " 0028", "%06.4x", -__LINE__, 0x000003e8L, "3E8", "%-02X", -__LINE__, 0x00000012L, "012", "%.3X", -__LINE__, 0x00000006L, "0X6", "%#X", -__LINE__, 0x00ef8479L, "+15697017", "%+0.6d", -__LINE__, 0xffffffe8L, "FFFFFFE8", "%-X", -__LINE__, 0x773a90f7L, "773a90f7", "%3.5x", -__LINE__, 0x00096d44L, "96D44", "%-X", -__LINE__, -0x08a3d96L, "-9059734", "%ld", -__LINE__, -0x000001aL, "-26", "%00.ld", -__LINE__, 0x32f57585L, "32f57585", "% x", -__LINE__, 0x2825f175L, "2825F175", "%X", -__LINE__, 0x000054ffL, "21759", "%-2d", -__LINE__, -0x0266cdcL, "-2518236", "%ld", -__LINE__, 0x0000031dL, "0X31D", "%+#4X", -__LINE__, 0x0003fc99L, "3fc99", "%x", -__LINE__, -0x0064624L, "-411172", "%-#d", -__LINE__, 0x0001b2d9L, "111321", "%-ld", -__LINE__, -0x000007cL, "-124", "%#d", -__LINE__, 0xfffffffaL, "FFFFFFFA", "%+X", -__LINE__, -0x007a5b8L, "-501176", "%+ld", -__LINE__, 0x0213b583L, "213B583", "%2.X", -__LINE__, 0xfff12e51L, "FFF12E51", "%+X", -__LINE__, 0x00052403L, "0336899", "%-0.7d", -__LINE__, 0xffffffffL, "ffffffff", "%-04.4x", -__LINE__, 0x00000010L, "0010", "%0.4X", -__LINE__, 0xffffffb5L, "FFFFFFB5", "%-1.3X", -__LINE__, -0x0000001L, "-1", "%d", -__LINE__, 0x0003a2d1L, "3a2d1", "% x", -__LINE__, 0x00000424L, "1060", "%0ld", -__LINE__, -0x0000078L, "-120", "%1d", -__LINE__, 0x00000000L, "0", "%ld", -__LINE__, 0x00000414L, "1044", "%ld", -__LINE__, 0x00000072L, "0x072", "%#5.3x", -__LINE__, 0x0000007aL, "7A", "% X", -__LINE__, 0x081542a3L, "135611043", "%0d", -__LINE__, 0xfffb4ce6L, "fffb4ce6", "%4.6x", -__LINE__, 0x00002ab2L, "2ab2", "%-1x", -__LINE__, 0x00000000L, " 0", "% 2x", -__LINE__, 0xfffffa59L, "FFFFFA59", "%2.X", -__LINE__, 0xffffe22bL, "ffffe22b", "%-x", -__LINE__, 0xfffffd52L, "FFFFFD52", "%+.2X", -__LINE__, 0x0000039fL, "927", "%-d", -__LINE__, 0x0002dea6L, "2dea6", "%0x", -__LINE__, 0x000216dbL, "136923", "%ld", -__LINE__, 0x00000013L, "19", "%0d", -__LINE__, 0x000047ccL, "18380", "%2.2ld", -__LINE__, -0x0007d10L, "-32016", "%d", -__LINE__, 0xff9af906L, "FF9AF906", "%0X", -__LINE__, 0x02cfa224L, "+47161892", "%+0.7d", -__LINE__, -0x0000022L, "-34", "%1.d", -__LINE__, 0xfffffff0L, "FFFFFFF0", "%-4X", -__LINE__, 0x00000029L, " 41", "%6.ld", -__LINE__, 0xffffff76L, "ffffff76", "%x", -__LINE__, 0x00000000L, "0", "%+X", -__LINE__, 0x00000001L, "1", "%d", -__LINE__, 0xfff6de5aL, "FFF6DE5A", "%X", -__LINE__, 0x00000002L, "2", "%ld", -__LINE__, 0x00000025L, "25", "%+x", -__LINE__, 0xfffffffbL, "FFFFFFFB", "%5.0X", -__LINE__, 0x0011bbb5L, "1162165", "%0.0ld", -__LINE__, 0xfffcdc96L, "0XFFFCDC96", "%#X", -__LINE__, 0x00008f5fL, "8f5f", "%3.1x", -__LINE__, 0xffa0fa5dL, "0XFFA0FA5D", "%#X", -__LINE__, 0x00004534L, "4534", "% 0X", -__LINE__, 0xfffffff9L, "fffffff9", "%.2x", -__LINE__, 0xffeeae50L, "ffeeae50", "%-x", -__LINE__, 0x00002964L, " 0010596", "% 0.7d", -__LINE__, 0x000021c9L, " 21c9", "%6x", -__LINE__, 0x00000001L, " 1", "% d", -__LINE__, 0x0002abd8L, "+175064", "%+d", -__LINE__, 0xffffffadL, "FFFFFFAD", "%+0X", -__LINE__, 0x00000003L, "3", "%ld", -__LINE__, 0x0c036da3L, " 201551267", "% .3d", -__LINE__, -0x004343cL, "-275516", "%+ld", -__LINE__, 0x00000003L, "003", "% .3x", -__LINE__, 0xffffe34eL, "ffffe34e", "%x", -__LINE__, 0x0000e118L, "e118", "%x", -__LINE__, -0x007d945L, "-514373", "%+#0ld", -__LINE__, 0x277f1cc5L, "277f1cc5", "% x", -__LINE__, 0x00003befL, "03bef", "% 0.5x", -__LINE__, 0xfffffcb9L, "fffffcb9", "%x", -__LINE__, 0x0003311aL, "209178", "%ld", -__LINE__, 0x00000000L, " ", "%3.ld", -__LINE__, 0x05942225L, "5942225", "%x", -__LINE__, 0xfffceb4cL, "FFFCEB4C", "%-X", -__LINE__, 0xffd08633L, "ffd08633", "%2.x", -__LINE__, -0x0000001L, " -1", "%6d", -__LINE__, 0x000fdb12L, "1039122", "%d", -__LINE__, 0x00000003L, "3", "% 0X", -__LINE__, -0x2fd5bf1L, "-50158577", "% 5.ld", -__LINE__, -0x0089a03L, "-563715", "%-d", -__LINE__, 0xfffffffeL, "FFFFFFFE", "% X", -__LINE__, 0x29fdb2baL, "29fdb2ba", "% 0x", -__LINE__, 0x0000008fL, "8F", "% X", -__LINE__, 0x00000003L, "3", "%ld", -__LINE__, 0xffc58445L, "FFC58445", "%.2X", -__LINE__, -0x00023f6L, "-9206", "%+d", -__LINE__, 0x00000011L, "11", "%X", -__LINE__, -0x0000003L, "-0000003", "%-.7d", -__LINE__, -0x0000003L, "-3", "%#ld", -__LINE__, 0x001242d9L, "1242D9", "%X", -__LINE__, -0x48d0c81L, "-76352641", "%7.d", -__LINE__, -0x001b675L, "-112245", "%#ld", -__LINE__, 0x00000003L, "3", "%-d", -__LINE__, 0xfff93fdfL, "0XFFF93FDF", "% #X", -__LINE__, 0x001a9414L, "1741844", "%#ld", -__LINE__, 0x0001fd86L, "130438", "%ld", -__LINE__, 0x010f37a8L, "17774504", "%4.7d", -__LINE__, 0x00382838L, "0382838", "%3.7X", -__LINE__, -0x47fd56c2L, "-1207785154", "%ld", -__LINE__, 0x001981ddL, "1981dd", "%x", -__LINE__, 0xffffefbaL, "ffffefba", "% 06.x", -__LINE__, -0x3f402b29L, "-1061169961", "%+#ld", -__LINE__, -0x395aae44L, "-962244164", "%-1d", -__LINE__, 0x1fa39f42L, "530816834", "%#d", -__LINE__, -0x000358dL, "-13709", "%d", -__LINE__, -0xdc17b8fL, "-230783887", "%ld", -__LINE__, -0x23c41583L, "-600053123", "%+3.d", -__LINE__, 0xfffffc16L, "fffffc16", "%x", -__LINE__, 0x003f1364L, "4133732", "%7.ld", -__LINE__, 0xffffe691L, "FFFFE691", "%07X", -__LINE__, 0x07b31d71L, "129178993", "%.7d", -__LINE__, -0x0019732L, "-104242", "% ld", -__LINE__, 0x02428167L, "0x2428167", "%#x", -__LINE__, -0x06c1ecdL, "-7085773", "%.7ld", -__LINE__, 0xfb01cb4eL, "fb01cb4e", "%x", -__LINE__, 0x00005a41L, "+23105", "%+ld", -__LINE__, 0xfffffff4L, "FFFFFFF4", "%-5.X", -__LINE__, 0x00000005L, " 5", "%4.ld", -__LINE__, 0xf4ab4b2dL, "F4AB4B2D", "%0.X", -__LINE__, -0x000fce3L, "-64739", "%+#3.ld", -__LINE__, 0x000076eaL, " 30442", "%6.2ld", -__LINE__, 0x00000cb9L, " cb9", "%4.x", -__LINE__, 0x002f43efL, "3097583", "%1.1ld", -__LINE__, 0xf5bd0105L, "F5BD0105", "%+X", -__LINE__, 0x0037954aL, "3642698", "%d", -__LINE__, 0xfffffff7L, "0XFFFFFFF7", "%-#X", -__LINE__, 0xffffcedfL, "0xffffcedf", "%#6.7x", -__LINE__, 0xfffffde4L, "FFFFFDE4", "%2.4X", -__LINE__, 0x01a6f103L, "1a6f103", "%5.x", -__LINE__, 0x00000191L, " 191", "%7.0X", -__LINE__, 0x00000003L, "03", "% .2X", -__LINE__, -0xd4e3219L, "-223228441", "%6.ld", -__LINE__, 0x00b0efbdL, "11595709", "%d", -__LINE__, -0x00000eaL, "-234", "%#3d", -__LINE__, 0x00000be8L, "BE8 ", "%-5X", -__LINE__, 0xffffffffL, "ffffffff", "%5.3x", -__LINE__, -0x267f8c6L, "-40368326", "%d", -__LINE__, 0x000006edL, "6ED", "%X", -__LINE__, 0xfdd6c9b6L, "FDD6C9B6", "%X", -__LINE__, 0x0007ac29L, "7ac29", "%-x", -__LINE__, 0x00000014L, "14", "%2x", -__LINE__, 0x123ca563L, "+305964387", "%+ld", -__LINE__, 0x00000004L, " 4", "%5.d", -__LINE__, 0xffff877aL, "ffff877a", "%x", -__LINE__, -0x00003e7L, "-999", "%+0.3d", -__LINE__, 0x0a68ba6eL, "a68ba6e", "%3.1x", -__LINE__, 0xfe29c810L, "FE29C810", "%+X", -#endif - -__LINE__, 0x00000000L, "0", "%o", -__LINE__, 0000000123L, "123", "%o", -__LINE__, 0000123456L, "0123456", "%#o", -__LINE__, 0000123456L, "00123456", "%#.8o", -__LINE__, 0000123456L, " 00123456", "%#10.8o", -__LINE__, 0x00000123L, "0x00123", "%#07x", - -0, -}; - -int main() -{ - int errcount = 0; - int testcount = 0; -#define BSIZE 1024 - char buffer[BSIZE]; - sprint_int_type *iptr; -#if defined(__cplusplus) && !defined(TEST_LIBIO) - - ostrstream sstr(buffer, BSIZE); - - for (iptr = sprint_ints; iptr->line; iptr++) { - sstr.seekp(0); - sstr.form(iptr->format_string, iptr->value); - sstr << ends; - if (strcmp(buffer, iptr->result) != 0) { - errcount++; - cerr << "Error in line " << iptr->line; - cerr << " using \"" << iptr->format_string; - cerr << "\". Result is \"" << buffer << "\"; should be: \""; - cerr << iptr->result << "\".\n"; - } - testcount++; - } - - - if (errcount == 0) { - cerr << "Encountered no errors in " << testcount << " tests.\n"; - return 0; - } - else { - cerr << "Encountered " << errcount << " errors in " - << testcount << " tests.\n"; - return 1; - } -#else - for (iptr = sprint_ints; iptr->line; iptr++) - { - if (sizeof(int)==2) - { - /* Cheezy, but effective. */ - char buf[30]; - int len = strlen(iptr->format_string); - - strcpy(buf, iptr->format_string); - if(buf[len-2] != 'l') { - buf[len] = buf[len-1]; - buf[len-1] = 'l'; - buf[len+1] = 0; - } - sprintf(buffer, buf, iptr->value); - } - else - { - sprintf(buffer, iptr->format_string, iptr->value); - } - if (strcmp(buffer, iptr->result) != 0) { - errcount++; - fprintf(stderr, - "Error in line %d using \"%s\". Result is \"%s\"; should be: \"%s\".\n", - iptr->line, iptr->format_string, buffer, iptr->result); - fprintf(stderr,"%ld\n",iptr->value); - } - testcount++; - } - - if (errcount == 0) { - fprintf(stderr, "Encountered no errors in %d tests.\n", testcount); - return 0; - } - else { - fprintf(stderr, "Encountered %d errors in %d tests.\n", - errcount, testcount); - return 1; - } -#endif -} diff --git a/contrib/libio/tests/tiomanip.cc b/contrib/libio/tests/tiomanip.cc deleted file mode 100644 index b7dd08a461..0000000000 --- a/contrib/libio/tests/tiomanip.cc +++ /dev/null @@ -1,35 +0,0 @@ -// test the parametrized manipulators - -#include -#include - -main() -{ -#ifdef _G_NO_TEMPLATES - cerr << "(IO manipulators are not supported with this compiler)\n"); - exit(-1); -#else - - cout << dec << 1234 << ' ' - << hex << 1234 << ' ' - << oct << 1234 << endl; - - //SMANIP x = setw(4); - //operator<<(cout, x); - - cout - << "(" - << dec << setw(4) << setfill('*') - << 12 << ")\n"; - - cout << "(" << 12 << ")\n"; - - cout << setiosflags(ios::internal); - cout << "(" << setw(6) << -12 << ")\n"; - - exit(0); -#endif -} - - - diff --git a/contrib/libio/tests/tiomanip.exp b/contrib/libio/tests/tiomanip.exp deleted file mode 100644 index 7a0a7ea5cb..0000000000 --- a/contrib/libio/tests/tiomanip.exp +++ /dev/null @@ -1,4 +0,0 @@ -1234 4d2 2322 -(**12) -(12) -(-***12) diff --git a/contrib/libio/tests/tiomisc.cc b/contrib/libio/tests/tiomisc.cc deleted file mode 100644 index 207a3f16e2..0000000000 --- a/contrib/libio/tests/tiomisc.cc +++ /dev/null @@ -1,236 +0,0 @@ -/* Random regression tests etc. */ - -#include -#include -#include -#include -#include -#include -#include - -#define BUF_SIZE 4096 - -void -test1 () -{ - fstream f; - char buf[BUF_SIZE]; - - f.setbuf( buf, BUF_SIZE ); -} - -void -test2 ( ) -{ - char string[BUF_SIZE]; - ostrstream s( string, BUF_SIZE ); - - s << "Bla bla bla " << 55 << ' ' << 3.23 << '\0' << endl; - cout << "Test2: " << string << endl; -} - - -/* Test case from Joe Buck . */ - -class special_ofstream : public ofstream { -public: - special_ofstream() : ofstream() {} - special_ofstream(int fd) : ofstream(fd) {} - special_ofstream(const char *name, int mode=ios::out, int prot=0664) { - open(name,mode,prot); - } - void open(const char *name, int mode=ios::out, int prot=0664); -}; - -void special_ofstream::open(const char* name, int mode, int prot) { - if (strcmp(name, "") == 0) { - rdbuf()->attach(1); - } - else if (strcmp(name, "") == 0) { - rdbuf()->attach(2); - setf(unitbuf); - } - else ofstream::open(name,mode,prot); -} - -void -test3 () -{ - { - special_ofstream o(""); - o << "Hello\n"; - // o is destructed now. This should not close cout - } - { - special_ofstream o(""); - o << "Line 2\n"; - } -} - -void -getline_test1 () -{ - char buf[1000]; - char data[] = "#include \n#include \n"; - istrstream infile(data, strlen(data)); - infile.getline(buf,1000); - infile.getline(buf,1000); - - cout << buf << '\n'; -} - -// test istream::getline on readng overlong lines. -void -getline_test2 () -{ - char data[] = "Line one.\nline 2.\n"; - char line[100]; - istrstream strin(data, strlen(data)); - strin.getline(line, 10); - cout << "line: " << line << ", count: " << strin.gcount () << "\n"; -} - -void -getline_test3 () -{ - char data[] = "123456789\nabcdefghijkl.\n"; - char line[10]; - istrstream strin(data, strlen(data)); - strin.getline(line, 10); - cout << "line: " << line << ", count: " << strin.gcount () << "\n"; - strin.getline(line, 10); - cout << "line: " << line << ", count: " << strin.gcount () << "\n"; - assert (!strin.good()); - strin.clear (); - strin.getline(line, 10); - cout << "line: " << line << ", count: " << strin.gcount () << "\n"; -} - -class A : private ostream -{ -public: - A(streambuf* s); - ostream::flush; -}; -A::A(streambuf* s) -: ostream(s) -{ -} - -void -flush1_test() -{ - A os(cout.rdbuf()); - os.flush(); -} - -void -reread_test () -{ // This is PR 5486. - int tag_char; - char *fname = "Makefile"; - int mode = O_RDONLY; - filebuf file_p; - - int fd = ::open(fname, mode, 0666); - file_p.attach(fd); - - istream d_istream(&file_p); - - // Read a character from the stream, save it and put it back. - tag_char = d_istream.get(); - int save_char = tag_char; - d_istream.putback((char) tag_char); - - // Uncomment then next statement and the next get will be EOF. - streampos pos = d_istream.tellg(); - - // Re-read the first character - tag_char = d_istream.get(); - - cout << "reread_test: " << (char)save_char << " " << (char)tag_char << "\n"; - cout.flush(); - -} - -void *danger_pointer; -void operator delete (void *p) throw() -{ - if (p) - { - if (p == danger_pointer) - fprintf (stderr, "maybe deleted\n"); - - free (p); - } -} - -struct my_ostream: virtual public ios, public ostream -{ - my_ostream (ostream &s): ios (s.rdbuf()) { } -}; - -void -test_destroy () -{ - ofstream fstr ("foo.dat"); - my_ostream wa (fstr); - - /* Check that sure wa.rdbuf() is only freed once. */ - danger_pointer = wa.rdbuf (); - - wa << "Hi there" << endl; -#ifdef _IO_NEW_STREAMS - fprintf (stderr, "maybe deleted\n"); -#endif -} - -/* Submitted by Luke Blanshard . - - In certain circumstances, the library will write past the end of the - buffer it has allocated for a file: You must read from the file, - exactly enough bytes that the read pointer is at the end of the - buffer. Then you must write to the file, at the same place you just - finished reading from. - - "Your patch looks great, and you're welcome to use the test code for any - purpose whatever. I hereby renounce my implicit copyright on it." */ - -void -test_read_write_flush () -{ - fstream f; - char buf[8192]; - - for ( int index=0; index < sizeof buf; ++index ) - buf[index] = (index+1)&63? 'x' : '\n'; - - f.open( "foo.dat", ios::in|ios::out|ios::trunc ); - f.write( buf, sizeof buf ); - - f.seekg( 0, ios::beg ); - f.read( buf, sizeof buf ); - -// f.seekp( sizeof buf, ios::beg ); // Present or absent, bug still happens. - f.write( "a", 1 ); - - if ( f.rdbuf()->_IO_write_ptr > f.rdbuf()->_IO_buf_end ) - cerr << "test_read_write_flush: it's broken.\n"; - else - cout << "test_read_write_flush: the problem isn't showing itself.\n"; -} - -int main( ) -{ - test1 (); - test2 (); - test3 (); - getline_test1 (); - getline_test2 (); - getline_test3 (); - flush1_test (); - reread_test (); - test_destroy (); - test_read_write_flush (); - return 0; -} diff --git a/contrib/libio/tests/tiomisc.exp b/contrib/libio/tests/tiomisc.exp deleted file mode 100644 index 26a3acd33f..0000000000 --- a/contrib/libio/tests/tiomisc.exp +++ /dev/null @@ -1,11 +0,0 @@ -Test2: Bla bla bla 55 3.23 -Hello -Line 2 -#include -line: Line one., count: 10 -line: 123456789, count: 10 -line: abcdefghi, count: 9 -line: jkl., count: 5 -reread_test: # # -maybe deleted -test_read_write_flush: the problem isn't showing itself. diff --git a/contrib/libio/tests/tstdiomisc.c b/contrib/libio/tests/tstdiomisc.c deleted file mode 100644 index cd8e88fd6c..0000000000 --- a/contrib/libio/tests/tstdiomisc.c +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef STDIO_H -#define STDIO_H -#endif -#include STDIO_H - -void -t1 () -{ - int n = -1; - sscanf ("abc ", "abc %n", &n); - printf ("t1: count=%d\n", n); -} - -void -t2 () -{ - int n; - long N; - int retval; -#define SCAN(INPUT, FORMAT, VAR) \ - VAR = -1; \ - retval = sscanf (INPUT, FORMAT, &VAR); \ - printf ("sscanf (\"%s\", \"%s\", &x) => %d, x = %ld\n", \ - INPUT, FORMAT, retval, (long)VAR); - - SCAN ("12345", "%ld", N); - SCAN ("12345", "%llllld", N); - SCAN ("12345", "%LLLLLd", N); - SCAN ("test ", "%*s%n", n); - SCAN ("test ", "%2*s%n", n); - SCAN ("12 ", "%l2d", n); - SCAN ("12 ", "%2ld", N); -} - -int -main () -{ - t1 (); - t2 (); - - fflush (stdout); - return 0; -} diff --git a/contrib/libio/tests/tstdiomisc.exp b/contrib/libio/tests/tstdiomisc.exp deleted file mode 100644 index b8ee02dcd6..0000000000 --- a/contrib/libio/tests/tstdiomisc.exp +++ /dev/null @@ -1,8 +0,0 @@ -t1: count=5 -sscanf ("12345", "%ld", &x) => 1, x = 12345 -sscanf ("12345", "%llllld", &x) => 0, x = -1 -sscanf ("12345", "%LLLLLd", &x) => 0, x = -1 -sscanf ("test ", "%*s%n", &x) => 0, x = 4 -sscanf ("test ", "%2*s%n", &x) => 0, x = -1 -sscanf ("12 ", "%l2d", &x) => 0, x = -1 -sscanf ("12 ", "%2ld", &x) => 1, x = 12 diff --git a/contrib/libio/testsuite/ChangeLog b/contrib/libio/testsuite/ChangeLog deleted file mode 100644 index ead33b2e1b..0000000000 --- a/contrib/libio/testsuite/ChangeLog +++ /dev/null @@ -1,99 +0,0 @@ -Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com) - - * gcc-2.95.3 Released. - -Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.2 Released. - -Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.1 Released. - -Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -Wed Nov 25 01:00:07 1998 Marc Espie - - * Makefile.in (just-check): Ignore errors. - -Sat Jun 27 23:59:35 1998 Carlo Wood - - * lib/libio.exp (test_libio): Reset ld_library_path before appending - the same path(s) again. - -Tue Jun 9 11:23:42 1998 Gavin Koch - - * Makefile.in (EXPECT) : Look for "expect" in the correct - place. - -Sat Sep 6 00:49:31 1997 Brendan Kehoe - - * lib/libio.exp (test_libio): Lose -L.. before -lio, may as well - require things be fully usable. Not ideal, but...also no longer - have the -liostream approach. - -Fri Sep 5 15:38:37 1997 Jeffrey A Law (law@cygnus.com) - - * lib/libio.exp (test_libio): Use libstdc++_{include,link}_flags - instead of g++_{include,link}_flags. - -Thu Sep 4 15:22:46 1997 Brendan Kehoe - - * lib/libio.exp (test_libio): Add `-L..' before -lio. - Use `-L.. -liostream' for now. - -Fri Jun 27 18:19:21 1997 Bob Manson - - * lib/libio.exp(libio_init): New procedure. - (test_libio): Link with a status wrapper if necessary. Strip - leading newlines before comparing output. Look for a multilib - libiberty directory. - -Tue Jun 3 15:17:31 1997 Bob Manson - - * lib/libio.exp: Don't use global exec_output variable; the output - is returned from remote_load instead. - -Tue May 20 17:59:31 1997 Jeffrey A Law (law@cygnus.com) - - * lib/libio.exp: If "slow_simulator" is set, then add - -DSLOW_SIMULATOR to the compiler's arguments. - -Fri May 16 19:33:39 1997 Bob Manson - - * lib/libio.exp: Name the executables after the testcases. - - * libio.tests/tiomisc.exp: Turn off warnings when conpiling. - -Thu May 1 17:01:47 1997 Bob Manson - - * lib/libio.exp: Link in libiberty.a. - -Tue Apr 29 16:34:37 1997 Mike Stump - - * testsuite/lib/libio.exp: Fixup so that we always have the same - number of testcases, and so that we have meaningful testcase - names. - -Tue Apr 29 13:08:41 1997 Bob Manson - - * lib/libio.exp: Add support for --tool_opts. - -Mon Apr 28 11:26:06 1997 Bob Manson - - * Makefile.in: Removed clean rule, as it is added by configure. - Remove a lot of unused rules. - -Sun Apr 27 15:02:48 1997 Brendan Kehoe - - * Makefile.in (clean): Add empty rule for now. - -Sat Apr 26 13:41:44 1997 Bob Manson - - * New DejaGnu-style testsuite. diff --git a/contrib/libio/testsuite/Makefile.in b/contrib/libio/testsuite/Makefile.in deleted file mode 100644 index d1795d00df..0000000000 --- a/contrib/libio/testsuite/Makefile.in +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright (C) 1997 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 GNU CC; see the file COPYING. If not, write to -# the Free Software Foundation, 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. */ - -srcdir = libio.tests - -CFLAGS = -g -C_FLAGS = $(CFLAGS) -I. -I.. -I$(srcdir) -I$(srcdir)/.. -CXXFLAGS = -g -CC = gcc -CXX = gcc - -EXPECT = `if [ -f $${rootme}/../../../expect/expect ] ; then \ - echo $${rootme}/../../../expect/expect ; \ - else echo expect ; fi` - -RUNTEST = $(RUNTEST_FOR_TARGET) - -RUNTESTFLAGS = - -RUNTEST_FOR_TARGET = `\ - if [ -f $${srcdir}/../../dejagnu/runtest ]; then \ - echo $${srcdir}/../../dejagnu/runtest; \ - else \ - if [ "$(host_canonical)" = "$(target_canonical)" ]; then \ - echo runtest; \ - else \ - t='$(program_transform_name)'; echo runtest | sed -e '' $$t; \ - fi; \ - fi` - -#### package, host, target, and site dependent Makefile fragments come in here. -## - -# See ${MOSTLYCLEAN} in configure.in -JUNK_TO_CLEAN = tFile tiomisc hounddog putbackdog tiomanip \ - t?format *.out streamfile ftmp* tstdiomisc foo.dat - -.PHONY: info -info: -.PHONY: clean-info -clean-info: -.PHONY: install-info -install-info: - -check: all just-check - -site.exp: ./config.status Makefile - @echo "Making a new config file..." - -@rm -f ./tmp? - @touch site.exp - -@mv site.exp site.bak - @echo "## these variables are automatically generated by make ##" > ./tmp0 - @echo "# Do not edit here. If you wish to override these values" >> ./tmp0 - @echo "# add them to the last section" >> ./tmp0 - @echo "set host_alias $(host_alias)" >> ./tmp0 - @echo "set host_triplet ${host_canonical}" >> ./tmp0 - @echo "set target_alias $(target_alias)" >> ./tmp0 - @echo "set target_triplet ${target_canonical}" >> ./tmp0 - @echo "set build_triplet ${build_canonical}" >> ./tmp0 - @echo "set srcdir ${srcdir}" >> ./tmp0 - @echo "set tool libio" >> ./tmp0 - @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0 - @cat ./tmp0 > site.exp - @cat site.bak | sed \ - -e '1,/^## All variables above are.*##/ d' >> site.exp - -@rm -f ./tmp? - -just-check: site.exp - -rootme=`pwd`; export rootme; \ - srcdir=${srcdir} ; export srcdir ; \ - EXPECT=${EXPECT} ; export EXPECT ; \ - if [ -f $${rootme}/../../../expect/expect ] ; then \ - TCL_LIBRARY=$${srcdir}/../../tcl/library ; \ - export TCL_LIBRARY ; fi ; \ - $(RUNTEST) $(RUNTESTFLAGS) diff --git a/contrib/libio/testsuite/config/default.exp b/contrib/libio/testsuite/config/default.exp deleted file mode 100644 index 90967cccc1..0000000000 --- a/contrib/libio/testsuite/config/default.exp +++ /dev/null @@ -1 +0,0 @@ -load_lib "standard.exp" diff --git a/contrib/libio/testsuite/configure.in b/contrib/libio/testsuite/configure.in deleted file mode 100644 index cd400c84ba..0000000000 --- a/contrib/libio/testsuite/configure.in +++ /dev/null @@ -1,22 +0,0 @@ -# This file is a shell script fragment that supplies the information -# necessary for a configure script to process the program in -# this directory. For more information, look at ../../configure. - -configdirs= -srctrigger=libio.tests/hounddog.exp -srcname="test C++ input/output library, dejagnu style" -package_makefile_frag=Make.pack -package_makefile_rules_frag=Make.pack.r - -# per-host: - -# per-target: - -TO_TOPDIR=../../ -ALL=' ' -XCINCLUDES='-I. -I.. -I$(srcdir) -I$(srcdir)/..' -XCXXINCLUDES='-I. -I.. -I$(srcdir) -I$(srcdir)/..' -MOSTLYCLEAN='*.o core $(JUNK_TO_CLEAN)' -(. ${srcdir}/../config.shared) >${package_makefile_frag} 2>${package_makefile_rules_frag} - -# post-target: diff --git a/contrib/libio/testsuite/lib/libio.exp b/contrib/libio/testsuite/lib/libio.exp deleted file mode 100644 index d9f01b449f..0000000000 --- a/contrib/libio/testsuite/lib/libio.exp +++ /dev/null @@ -1,167 +0,0 @@ -# Copyright (C) 1997 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-lib-g++@prep.ai.mit.edu - -# This file was written by Bob Manson. (manson@cygnus.com) - -load_lib "libgloss.exp" - -global base_dir - -proc libio_init { args } { - global wrapper_file; - global wrap_compile_flags; - set wrapper_file ""; - set wrap_compile_flags ""; - if [target_info exists needs_status_wrapper] { - set result [build_wrapper "testglue.o"]; - if { $result != "" } { - set wrapper_file [lindex $result 0]; - set wrap_compile_flags [lindex $result 1]; - } else { - warning "Status wrapper failed to build." - } - } -} -# -# Run the test specified by srcfile and resultfile. compile_args and -# exec_args are additional arguments to be passed in when compiling and -# running the testcase, respectively. -# - -proc test_libio { srcfile compile_args inpfile resultfile exec_args } { - global LIBIO - global srcdir subdir objdir - global TOOL_OPTIONS - global wrapper_file wrap_compile_flags - global ld_library_path - - if { $inpfile != "" } { - set inpfile "$srcdir/../tests/$inpfile" - } - - set args "" - set ld_library_path "" - lappend args "additional_flags=-O3"; - lappend args "additional_flags=-I.. -I$srcdir/.." - lappend args "additional_flags=$wrap_compile_flags"; - lappend args "libs=$wrapper_file"; - if { $compile_args != "" } { - lappend args "additional_flags=$compile_args" - } - - if [regexp "\.cc$" $srcfile] { - lappend args "additional_flags=-nostdinc++" - lappend args "additional_flags=[libstdc++_include_flags]"; - lappend args "additional_flags=[libstdc++_link_flags]"; - lappend args "libs=-lstdc++" - } else { - if [info exists LIBIO] { - lappend args "libdir=$LIBIO" - } else { - lappend args "additional_flags=[libio_link_flags]"; - } - lappend args "additional_flags=[libio_link_flags]"; - lappend args "libs=-lio" - } - - if [target_info exists slow_simulator] then { - lappend args "additional_flags=-DSLOW_SIMULATOR" - } - - if [info exists TOOL_OPTIONS] { - lappend args "additional_options=$TOOL_OPTIONS" - } - - set gp [get_multilibs]; - if { $gp != "" } { - if [file exists $gp/libiberty/libiberty.a] { - lappend args "libdir=$gp/libiberty"; - set found_libiberty 1; - } - } - if ![info exists found_libiberty] { - set lib [lookfor_file "$objdir" "libiberty/libiberty.a"]; - if { $lib != "" } { - lappend args "libdir=[file dirname $lib]"; - } - } - lappend args "libs=-liberty" - lappend args "debug"; - - set errname "$srcfile" - set srcfile "$srcdir/../tests/$srcfile" - regsub "\\..*$" "[file tail $srcfile]" "" executable - set executable "$objdir/$executable" - - if { [target_compile $srcfile $executable executable $args] != "" } { - fail "$errname compilation $exec_args"; - setup_xfail "*-*-*" - fail "$errname execution $exec_args" - if { $resultfile != "" } { - setup_xfail "*-*-*" - fail "$errname output $exec_args" - } - return; - } - pass "$errname compilation $exec_args" - - set result [libio_load $executable $exec_args $inpfile]; - set status [lindex $result 0]; - set output [lindex $result 1]; - if { $status == "unsupported" } { - unsupported "target does not support loading $srcfile" - return; - } - if { $status != "pass" } { - $status "$errname execution $exec_args" - setup_xfail "*-*-*" - fail "$errname output $exec_args" - return; - } - pass "$errname execution $exec_args" - - if { $resultfile != "" } { - set id [open $srcdir/../tests/$resultfile r]; - set expected "" - append expected [read $id]; - verbose "expected is $expected" - verbose "actual is $output" - regsub -all "\r" $output "" output - regsub "\n+$" $expected "" expected - regsub "\n+$" $output "" output - regsub "^\n+" $expected "" expected - regsub "^\n+" $output "" output - if { $expected == $output } { - pass "$errname output $exec_args" - } else { - fail "$errname output $exec_args" - } - close $id; - } -} - -# -# libio_version -- extract and print the version number of libio -# -proc default_libio_version {} { - global LIBIO -} - -proc default_libio_start { } { -} diff --git a/contrib/libio/testsuite/libio.tests/hounddog.exp b/contrib/libio/testsuite/libio.tests/hounddog.exp deleted file mode 100644 index b51f9f0a4d..0000000000 --- a/contrib/libio/testsuite/libio.tests/hounddog.exp +++ /dev/null @@ -1,3 +0,0 @@ -test_libio hounddog.cc "" hounddog.inp hounddog.exp "" -test_libio hounddog.cc "" hounddog.inp hounddog.exp "-b0" -test_libio hounddog.cc "" hounddog.inp hounddog.exp "-b2" diff --git a/contrib/libio/testsuite/libio.tests/putbackdog.exp b/contrib/libio/testsuite/libio.tests/putbackdog.exp deleted file mode 100644 index 30d91a8a5b..0000000000 --- a/contrib/libio/testsuite/libio.tests/putbackdog.exp +++ /dev/null @@ -1,3 +0,0 @@ -test_libio putbackdog.cc "" hounddog.inp hounddog.exp "" -test_libio putbackdog.cc "" hounddog.inp hounddog.exp "-b0" -test_libio putbackdog.cc "" hounddog.inp hounddog.exp "-b2" diff --git a/contrib/libio/testsuite/libio.tests/tFile.exp b/contrib/libio/testsuite/libio.tests/tFile.exp deleted file mode 100644 index f190916d86..0000000000 --- a/contrib/libio/testsuite/libio.tests/tFile.exp +++ /dev/null @@ -1,3 +0,0 @@ -test_libio tFile.cc "" tFile.inp tFile.exp "" -test_libio tFile.cc "" tFile.inp tFile.exp "-b0" -test_libio tFile.cc "" tFile.inp tFile.exp "-b3" diff --git a/contrib/libio/testsuite/libio.tests/tfformat.exp b/contrib/libio/testsuite/libio.tests/tfformat.exp deleted file mode 100644 index f0f7113c31..0000000000 --- a/contrib/libio/testsuite/libio.tests/tfformat.exp +++ /dev/null @@ -1 +0,0 @@ -test_libio tfformat.c "-DTEST_LIBIO -DTEST_EXACTNESS" "" "" "" diff --git a/contrib/libio/testsuite/libio.tests/tiformat.exp b/contrib/libio/testsuite/libio.tests/tiformat.exp deleted file mode 100644 index f2d14db523..0000000000 --- a/contrib/libio/testsuite/libio.tests/tiformat.exp +++ /dev/null @@ -1 +0,0 @@ -test_libio tiformat.c "-DTEST_LIBIO" "" "" "" diff --git a/contrib/libio/testsuite/libio.tests/tiomanip.exp b/contrib/libio/testsuite/libio.tests/tiomanip.exp deleted file mode 100644 index 856cefc3cd..0000000000 --- a/contrib/libio/testsuite/libio.tests/tiomanip.exp +++ /dev/null @@ -1 +0,0 @@ -test_libio tiomanip.cc "" "" tiomanip.exp "" diff --git a/contrib/libio/testsuite/libio.tests/tiomisc.exp b/contrib/libio/testsuite/libio.tests/tiomisc.exp deleted file mode 100644 index 71309951bb..0000000000 --- a/contrib/libio/testsuite/libio.tests/tiomisc.exp +++ /dev/null @@ -1 +0,0 @@ -test_libio tiomisc.cc "-w" "" tiomisc.exp "" diff --git a/contrib/libio/testsuite/libio.tests/tstdiomisc.exp b/contrib/libio/testsuite/libio.tests/tstdiomisc.exp deleted file mode 100644 index 01dae9ffe1..0000000000 --- a/contrib/libio/testsuite/libio.tests/tstdiomisc.exp +++ /dev/null @@ -1 +0,0 @@ -test_libio tstdiomisc.c "" "" tstdiomisc.exp "" diff --git a/contrib/libobjc/ChangeLog b/contrib/libobjc/ChangeLog deleted file mode 100644 index 7b7e7da783..0000000000 --- a/contrib/libobjc/ChangeLog +++ /dev/null @@ -1,174 +0,0 @@ -Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com) - - * gcc-2.95.3 Released. - -2001-01-11 Joseph S. Myers - - * sendmsg.c (__objc_print_dtable_stats): Don't use #ifdef inside - printf. - -2000-03-29 Zack Weinberg - - * objc/Protocol.h, objc/objc-list.h: Change #endif labels to - comments. - -Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.2 Released. - -Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.1 Released. - -Fri Aug 6 23:32:29 1999 Daniel Jacobowitz - - * Makefile.in (FLAGS_TO_PASS): Include prefix, exec_prefix, - libdir, libsubdir and tooldir. - -Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -Mon Jun 21 05:40:15 1999 John David Anglin - - * init.c (__objc_force_linking): Make global. - -Thu May 20 03:20:59 1999 Jeffrey A Law (law@cygnus.com) - - * configure.in (AC_EXEEXT): Remove call. - (compiler_name): Explicitly check with no extension and .exe - extension. - * configure: Regenerate. - -Sun Apr 25 01:15:34 1999 Mumit Khan - - * Makefile.in (CC1OBJ): Define in terms of CC. - (runtime-info.h): Use. - -Fri April 8 08:21:07 1999 Ovidiu Predescu - - * objc-features.texi: Updated the URL to Boehm's GC page. - -Fri Mar 26 23:41:07 1999 Ovidiu Predescu - - * archive.c (__objc_code_char, __objc_write_char): Explicitly specify - the char as being signed (patch from Daniel Jacobowitz - ). - -Wed Mar 24 22:41:28 1999 Mumit Khan - - * configure.in (AC_PREREQ): Update to 2.13. - (AC_EXEEXT): Call to find possible file extension. - (compiler_name): Use. - * configure: Regenerate. - -Wed Jan 27 02:31:01 1999 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (ALL_CFLAGS): Add -DIN_GCC. - -Tue Jan 5 01:38:53 1999 Jeffrey A Law (law@cygnus.com) - - * configure.in (thread_file): Correct and simplify code to find - the thread file. - * configure: Rebuilt. - -1998-11-26 Manfred Hollstein - - * configure.in (compiler_name): Add check to detect if this - language's compiler has been built. - * configure: Regenerate. - -Mon Nov 23 16:50:28 1998 Kaveh R. Ghazi - - * configure.in: Use AC_PREREQ(2.12.1). - -Thu Nov 19 20:33:37 1998 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (runtime-info.h): Avoid GNU make extensions. - -Sun Nov 8 17:46:14 1998 Kaveh R. Ghazi - - * Makefile.in (INCLUDES): Add -I$(srcdir)/$(MULTISRCTOP)../include. - -Thu Oct 22 14:34:06 1998 Kaveh R. Ghazi - - * configure.in: Use AC_CONFIG_AUX_DIR($topsrcdir). - -Sat Oct 17 05:21:31 1998 Ovidiu Predescu - - * objc-features.texi (Top): Changed the email address. - * objc-features.texi (Garbage Collection): Use @uref instead of @url. - -Mon Oct 11 21:25:27 1998 Ovidiu Predescu - - * encoding.c: Redefine get_inner_array_type to get the first entry - in the structure. - -Thu Oct 8 12:21:14 1998 Richard Frith-Macdonald - - * encoding.c (objc_skip_type_qualifiers): Handle _C_BYREF. - (objc_get_type_qualifiers): Similarly. - * objc/encoding.h (_C_BYREF): Define. - (_F_BYREF): Define. - -1998-10-07 David S. Miller - - * objc/sarray.h: Make boffset be an unsigned long when sparc so it - works out on 64-bit systems. - -Tue Oct 6 20:32:06 1998 Alexandre Oliva - - * Makefile.in (INCLUDES): Make it multilib-friendly. - -Fri Oct 2 07:12:14 1998 H.J. Lu (hjl@gnu.org) - - * Makefile.in (INCLUDES): Add -I$(srcdir)/../gcc. - -Thu Oct 1 22:33:03 1998 Robert Lipe - Jeffrey A Law (law@cygnus.com) - - * Makefile.in (INCLUDES): Reference gcc via $MULTIBUILDTOP. - (FLAGS_TO_PASS): Added. - (runtime-info.h): Reference cc1ibj via $MULTIBUILDTOP. - - * archive.c: Change config.h to tconfig.h. - - * configure.in: Find gcc's object directory even for multilibs. - -Wed Sep 30 18:17:17 1998 Robert Lipe - - * configure.in: Escape ^ in grep string. - * configure: Rebuilt. - -Wed Sep 30 09:14:52 1998 Jeffrey A Law (law@cygnus.com) - - * All .h files pushed down into the objc/ subdirectory. - * Makefile.in (copy_headers): Corresponding changes. - * configure.in (AC_INIT): Corresponding changes. - * configure: Rebuilt. - -1998-09-30 Ben Elliston - Jeff Law - - * Makefile.in: Rewrite. - - * configure.in: Likewise. - - * configure: Regenerate. - - * All .c files. Remove "objc" prefix when including objc header - files. Include tconfig.h, not ../tconfig.h. - -Mon Sep 21 23:27:10 1998 Ovidiu Predescu - - * encoding.c (TREE_TYPE, ARRAY_TYPE): Define. - (get_inner_array_type): Define. - -1998-09-21 Ben Elliston - - * New directory. Moved files from ../gcc/objc. - diff --git a/contrib/libobjc/Makefile.in b/contrib/libobjc/Makefile.in deleted file mode 100644 index e1de9aeee8..0000000000 --- a/contrib/libobjc/Makefile.in +++ /dev/null @@ -1,322 +0,0 @@ -#Makefile for GNU Objective C runtime library. -#Copyright (C) 1993, 95-97, 1998 Free Software Foundation, Inc. - -#This file is part of GNU CC. - -#GNU CC is free software; you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation; either version 2, or (at your option) -#any later version. - -#GNU CC is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. - -#You should have received a copy of the GNU General Public License -#along with GNU CC; see the file COPYING. If not, write to -#the Free Software Foundation, 59 Temple Place - Suite 330, -#Boston, MA 02111-1307, USA. */ - -#This was cribbed from the libchill, libiberty and libstdc++ -#Makefile.in files. Some of this stuff may be unnecessary and -#worthless. - -SHELL = /bin/sh - -#### Start of system configuration section. #### - -srcdir = @srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -target_alias = @target_alias@ -gcc_version = @gcc_version@ -gcc_version_trigger = @gcc_version_trigger@ - -libdir = $(exec_prefix)/lib -libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version) -incinstalldir = $(libsubdir)/include - -# Multilib support variables. -MULTISRCTOP = -MULTIBUILDTOP = -MULTIDIRS = -MULTISUBDIR = -MULTIDO = true -MULTICLEAN = true - -# Not configured per top-level version, since that doesn't get passed -# down at configure time, but overrridden by the top-level install -# target. -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ - -AR = @AR@ -AR_FLAGS = rc - -RANLIB = @RANLIB@ - -CC = @CC@ -CFLAGS = @CFLAGS@ -ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) -DIN_GCC - -# -# Define the cc1obj in terms of the CC that is passed on from higher -# level make. This is needed to make sure we can create runtime-info.h -# when doing canadian cross builds where running ../../gcc/cc1obj -# does not make any sense. -# -CC1OBJ = `$(CC) -print-prog-name=cc1obj` - -INCLUDES = -I$(srcdir)/objc -I$(srcdir)/$(MULTISRCTOP)../gcc \ - -I$(srcdir)/$(MULTISRCTOP)../gcc/config -I$(MULTIBUILDTOP)../../gcc \ - -I$(srcdir)/$(MULTISRCTOP)../include - -OBJC_GCFLAGS=-DOBJC_WITH_GC=1 -OBJC_THREAD_FILE=thr-@OBJC_THREAD_FILE@ - -.SUFFIXES: -.SUFFIXES: .c .m .o - -.c.o: - $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $< - -.m.o: - $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $< - -# Flags to pass to a recursive make. -FLAGS_TO_PASS = \ - "AR=$(AR)" \ - "AR_FLAGS=$(AR_FLAGS)" \ - "CC=$(CC)" \ - "CFLAGS=$(CFLAGS)" \ - "LIBCFLAGS=$(LIBCFLAGS)" \ - "EXTRA_OFILES=$(EXTRA_OFILES)" \ - "HDEFINES=$(HDEFINES)" \ - "INSTALL=$(INSTALL)" \ - "INSTALL_DATA=$(INSTALL_DATA)" \ - "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ - "LDFLAGS=$(LDFLAGS)" \ - "LOADLIBES=$(LOADLIBES)" \ - "PICFLAG=$(PICFLAG)" \ - "RANLIB=$(RANLIB)" \ - "SHELL=$(SHELL)" \ - "prefix=$(prefix)" \ - "exec_prefix=$(exec_prefix)" \ - "libdir=$(libdir)" \ - "libsubdir=$(libsubdir)" \ - "tooldir=$(tooldir)" - -all: libobjc.a @OBJC_BOEHM_GC@ - $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all - -# User-visible header files. - -OBJC_H = hash.h objc-list.h sarray.h objc.h objc-api.h \ - NXConstStr.h Object.h Protocol.h encoding.h typedstream.h \ - thr.h - -# Modules that comprise the runtime library. - -OBJS = archive.o class.o encoding.o gc.o hash.o init.o linking.o \ - misc.o nil_method.o NXConstStr.o Object.o objects.o \ - Protocol.o sarray.o selector.o sendmsg.o thr.o \ - $(OBJC_THREAD_FILE).o - -OBJS_GC = archive_gc.o class_gc.o encoding_gc.o gc_gc.o hash_gc.o \ - init_gc.o linking_gc.o misc_gc.o nil_method_gc.o \ - NXConstStr_gc.o Object_gc.o objects_gc.o Protocol_gc.o \ - sarray_gc.o selector_gc.o sendmsg_gc.o thr_gc.o \ - $(OBJC_THREAD_FILE)_gc.o - -runtime-info.h: - echo "" > tmp-runtime - echo "/* This file is automatically generated */" > $@ - $(CC1OBJ) -print-objc-runtime-info tmp-runtime >> $@ - rm -f tmp-runtime - -archive_gc.o: archive.c - $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< - -class_gc.o: class.c - $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< - -encoding_gc.o: encoding.c - $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< - -gc.o: gc.c - $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $< - -gc_gc.o: gc.c - $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ - $(INCLUDES) $< - -hash_gc.o: hash.c - $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< - -init_gc.o: init.c - $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< - -linking.o: linking.m - $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $< - -linking_gc.o: linking.m - $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ - $(INCLUDES) $< - -misc_gc.o: misc.c - $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< - -nil_method_gc.o: nil_method.c - $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< - -NXConstStr.o: NXConstStr.m - $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $< - -NXConstStr_gc.o: NXConstStr.m - $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ - $(INCLUDES) $< - -Object.o: Object.m - $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $< - -Object_gc.o: Object.m - $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ - $(INCLUDES) $< - -objects_gc.o: objects.c - $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< - -Protocol.o: Protocol.m - $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $< - -Protocol_gc.o: Protocol.m - $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ - $(INCLUDES) $< - -sarray_gc.o: sarray.c - $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< - -selector_gc.o: selector.c - $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< - -sendmsg.o: sendmsg.c runtime-info.h - $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $< - -sendmsg_gc.o: sendmsg.c runtime-info.h - $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< - -thr_gc.o: thr.c - $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< - -$(OBJC_THREAD_FILE)_gc.o: $(OBJC_THREAD_FILE).c - $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< - -doc: info dvi html - -libobjc.a: $(OBJS) - $(AR) $(AR_FLAGS) $@ $(OBJS) - $(RANLIB) $@ - -libobjc_gc.a: $(OBJS_GC) - $(AR) $(AR_FLAGS) $@ $(OBJS_GC) - $(RANLIB) $@ - -libobjc_s.a: libobjc.a - mv libobjc.a libobjc_s.a - -# Create a relocatable DLL -libobjc.dll: libobjc_s.a libobjc_entry.o - $(CC) -mdll -Wl,--base-file -Wl,libobjc.base \ - -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32 - $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \ - --base-file libobjc.base --output-exp libobjc.exp - $(GCC_FOR_TARGET) -mdll -Wl,--base-file libobjc.base libobjc.exp \ - -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32 - $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \ - --base-file libobjc.base --output-exp libobjc.exp - $(GCC_FOR_TARGET) libobjc.exp -mdll \ - -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32 - $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \ - --output-lib libobjc.a - -info: objc-features.info -dvi: objc-features.dvi -html: objc-features_toc.html - -objc-features.info: $(srcdir)/objc-features.texi - makeinfo $(srcdir)/objc-features.texi - -objc-features.dvi: $(srcdir)/objc-features.texi - texi2dvi $(srcdir)/objc-features.texi - -objc-features_toc.html: objc-features.texi - texi2html -split_node $(srcdir)/objc-features.texi - -Makefile: Makefile.in config.status - $(SHELL) config.status - -config.status: configure - rm -f config.cache - CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \ - CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck - -${srcdir}/configure: configure.in - rm -f config.cache - cd ${srcdir} && autoconf - -install: install-libs copy-headers - -install-libs: installdirs - -if test -f libobjc.a ; then \ - rm -f $(libsubdir)/libobjc.a; \ - $(INSTALL_DATA) libobjc.a $(libsubdir)/libobjc.a; \ - chmod a-x $(libsubdir)/libobjc.a; \ - else true; fi - -if test -f libobjc_gc.a ; then \ - rm -f $(libsubdir)/libobjc_gc.a; \ - $(INSTALL_DATA) libobjc_gc.a $(libsubdir)/libobjc_gc.a; \ - chmod a-x $(libsubdir)/libobjc_gc.a; \ - else true; fi - -if test -f libobjc_s.a ; then \ - rm -f $(libsubdir)/libobjc_s.a; \ - $(INSTALL_DATA) libobjc_s.a $(libsubdir)/libobjc_s.a; \ - chmod a-x $(libsubdir)/libobjc_s.a; \ - else true; fi - -if test -f libobjc.dll ; then \ - rm -f $(bindir)/libobjc.dll; \ - $(INSTALL_DATA) libobjc.dll $(bindir)/libobjc.dll; \ - else true; fi - -# Copy Objective C headers to installation include directory. -copy-headers: - -rm -rf $(incinstalldir)/objc - -mkdir $(incinstalldir)/objc - for file in $(OBJC_H); do \ - realfile=$(srcdir)/objc/$${file}; \ - cp $${realfile} $(incinstalldir)/objc; \ - chmod a+r $(incinstalldir)/objc/$${file}; \ - done - -check uninstall install-strip dist installcheck installdirs: - -mostlyclean: - -rm -f runtime-info.h tmp-runtime.s *.o libobjc* xforward \ - fflags *.aux *.cp *.dvi *.fn *.info *.ky *.log *.pg \ - *.toc *.tp *.vr *.html libobj.exp - @$(MULTICLEAN) multi-clean DO=mostlyclean - -clean: mostlyclean - rm -f config.log - @$(MULTICLEAN) multi-clean DO=clean - -distclean: clean - @$(MULTICLEAN) multi-clean DO=distclean - rm -f config.cache config.status Makefile configure - -maintainer-clean realclean: distclean - -.PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \ - install-strip dist installcheck installdirs diff --git a/contrib/libobjc/NXConstStr.m b/contrib/libobjc/NXConstStr.m deleted file mode 100644 index 4d2f3e1d7f..0000000000 --- a/contrib/libobjc/NXConstStr.m +++ /dev/null @@ -1,42 +0,0 @@ -/* Implementation of the NXConstantString class for Objective-C. - Copyright (C) 1995 Free Software Foundation, Inc. - Contributed by Pieter J. Schoenmakers - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC 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 "objc/NXConstStr.h" - -@implementation NXConstantString - --(const char *) cString -{ - return (c_string); -} /* -cString */ - --(unsigned int) length -{ - return (len); -} /* -length */ - -@end diff --git a/contrib/libobjc/Object.m b/contrib/libobjc/Object.m deleted file mode 100644 index 64b52f4836..0000000000 --- a/contrib/libobjc/Object.m +++ /dev/null @@ -1,387 +0,0 @@ -/* The implementation of class Object for Objective-C. - Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled - with GCC 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 -#include "objc/Object.h" -#include "objc/Protocol.h" -#include "objc/objc-api.h" - -extern int errno; - -#define MAX_CLASS_NAME_LEN 256 - -@implementation Object - -+ initialize -{ - return self; -} - -- init -{ - return self; -} - -+ new -{ - return [[self alloc] init]; -} - -+ alloc -{ - return class_create_instance(self); -} - -- free -{ - return object_dispose(self); -} - -- copy -{ - return [[self shallowCopy] deepen]; -} - -- shallowCopy -{ - return object_copy(self); -} - -- deepen -{ - return self; -} - -- deepCopy -{ - return [self copy]; -} - -- (Class)class -{ - return object_get_class(self); -} - -- (Class)superClass -{ - return object_get_super_class(self); -} - -- (MetaClass)metaClass -{ - return object_get_meta_class(self); -} - -- (const char *)name -{ - return object_get_class_name(self); -} - -- self -{ - return self; -} - -- (unsigned int)hash -{ - return (size_t)self; -} - -- (BOOL)isEqual:anObject -{ - return self==anObject; -} - -- (int)compare:anotherObject; -{ - if ([self isEqual:anotherObject]) - return 0; - // Ordering objects by their address is pretty useless, - // so subclasses should override this is some useful way. - else if (self > anotherObject) - return 1; - else - return -1; -} - -- (BOOL)isMetaClass -{ - return NO; -} - -- (BOOL)isClass -{ - return object_is_class(self); -} - -- (BOOL)isInstance -{ - return object_is_instance(self); -} - -- (BOOL)isKindOf:(Class)aClassObject -{ - Class class; - - for (class = self->isa; class!=Nil; class = class_get_super_class(class)) - if (class==aClassObject) - return YES; - return NO; -} - -- (BOOL)isMemberOf:(Class)aClassObject -{ - return self->isa==aClassObject; -} - -- (BOOL)isKindOfClassNamed:(const char *)aClassName -{ - Class class; - - if (aClassName!=NULL) - for (class = self->isa; class!=Nil; class = class_get_super_class(class)) - if (!strcmp(class_get_class_name(class), aClassName)) - return YES; - return NO; -} - -- (BOOL)isMemberOfClassNamed:(const char *)aClassName -{ - return ((aClassName!=NULL) - &&!strcmp(class_get_class_name(self->isa), aClassName)); -} - -+ (BOOL)instancesRespondTo:(SEL)aSel -{ - return class_get_instance_method(self, aSel)!=METHOD_NULL; -} - -- (BOOL)respondsTo:(SEL)aSel -{ - return ((object_is_instance(self) - ?class_get_instance_method(self->isa, aSel) - :class_get_class_method(self->isa, aSel))!=METHOD_NULL); -} - -+ (IMP)instanceMethodFor:(SEL)aSel -{ - return method_get_imp(class_get_instance_method(self, aSel)); -} - -// Indicates if the receiving class or instance conforms to the given protocol -// not usually overridden by subclasses -// -// Modified 9/5/94 to always search the class object's protocol list, rather -// than the meta class. - -+ (BOOL) conformsTo: (Protocol*)aProtocol -{ - int i; - struct objc_protocol_list* proto_list; - id parent; - - for (proto_list = ((Class)self)->protocols; - proto_list; proto_list = proto_list->next) - { - for (i=0; i < proto_list->count; i++) - { - if ([proto_list->list[i] conformsTo: aProtocol]) - return YES; - } - } - - if ((parent = [self superClass])) - return [parent conformsTo: aProtocol]; - else - return NO; -} - -- (BOOL) conformsTo: (Protocol*)aProtocol -{ - return [[self class] conformsTo:aProtocol]; -} - -- (IMP)methodFor:(SEL)aSel -{ - return (method_get_imp(object_is_instance(self) - ?class_get_instance_method(self->isa, aSel) - :class_get_class_method(self->isa, aSel))); -} - -+ (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel -{ - return ((struct objc_method_description *) - class_get_instance_method(self, aSel)); -} - -- (struct objc_method_description *)descriptionForMethod:(SEL)aSel -{ - return ((struct objc_method_description *) - (object_is_instance(self) - ?class_get_instance_method(self->isa, aSel) - :class_get_class_method(self->isa, aSel))); -} - -- perform:(SEL)aSel -{ - IMP msg = objc_msg_lookup(self, aSel); - if (!msg) - return [self error:"invalid selector passed to %s", sel_get_name(_cmd)]; - return (*msg)(self, aSel); -} - -- perform:(SEL)aSel with:anObject -{ - IMP msg = objc_msg_lookup(self, aSel); - if (!msg) - return [self error:"invalid selector passed to %s", sel_get_name(_cmd)]; - return (*msg)(self, aSel, anObject); -} - -- perform:(SEL)aSel with:anObject1 with:anObject2 -{ - IMP msg = objc_msg_lookup(self, aSel); - if (!msg) - return [self error:"invalid selector passed to %s", sel_get_name(_cmd)]; - return (*msg)(self, aSel, anObject1, anObject2); -} - -- (retval_t)forward:(SEL)aSel :(arglist_t)argFrame -{ - return (retval_t)[self doesNotRecognize: aSel]; -} - -- (retval_t)performv:(SEL)aSel :(arglist_t)argFrame -{ - return objc_msg_sendv(self, aSel, argFrame); -} - -+ poseAs:(Class)aClassObject -{ - return class_pose_as(self, aClassObject); -} - -- (Class)transmuteClassTo:(Class)aClassObject -{ - if (object_is_instance(self)) - if (class_is_class(aClassObject)) - if (class_get_instance_size(aClassObject)==class_get_instance_size(isa)) - if ([self isKindOf:aClassObject]) - { - Class old_isa = isa; - isa = aClassObject; - return old_isa; - } - return nil; -} - -- subclassResponsibility:(SEL)aSel -{ - return [self error:"subclass should override %s", sel_get_name(aSel)]; -} - -- notImplemented:(SEL)aSel -{ - return [self error:"method %s not implemented", sel_get_name(aSel)]; -} - -- shouldNotImplement:(SEL)aSel -{ - return [self error:"%s should not implement %s", - object_get_class_name(self), sel_get_name(aSel)]; -} - -- doesNotRecognize:(SEL)aSel -{ - return [self error:"%s does not recognize %s", - object_get_class_name(self), sel_get_name(aSel)]; -} - -#ifdef __alpha__ -extern size_t strlen(const char*); -#endif - -- error:(const char *)aString, ... -{ -#define FMT "error: %s (%s)\n%s\n" - char fmt[(strlen((char*)FMT)+strlen((char*)object_get_class_name(self)) - +((aString!=NULL)?strlen((char*)aString):0)+8)]; - va_list ap; - - sprintf(fmt, FMT, object_get_class_name(self), - object_is_instance(self)?"instance":"class", - (aString!=NULL)?aString:""); - va_start(ap, aString); - objc_verror(self, OBJC_ERR_UNKNOWN, fmt, ap); - va_end(ap); - return nil; -#undef FMT -} - -+ (int)version -{ - return class_get_version(self); -} - -+ setVersion:(int)aVersion -{ - class_set_version(self, aVersion); - return self; -} - -+ (int)streamVersion: (TypedStream*)aStream -{ - if (aStream->mode == OBJC_READONLY) - return objc_get_stream_class_version (aStream, self); - else - return class_get_version (self); -} - -// These are used to write or read the instance variables -// declared in this particular part of the object. Subclasses -// should extend these, by calling [super read/write: aStream] -// before doing their own archiving. These methods are private, in -// the sense that they should only be called from subclasses. - -- read: (TypedStream*)aStream -{ - // [super read: aStream]; - return self; -} - -- write: (TypedStream*)aStream -{ - // [super write: aStream]; - return self; -} - -- awake -{ - // [super awake]; - return self; -} - -@end diff --git a/contrib/libobjc/Protocol.m b/contrib/libobjc/Protocol.m deleted file mode 100644 index 43ba44eaf4..0000000000 --- a/contrib/libobjc/Protocol.m +++ /dev/null @@ -1,128 +0,0 @@ -/* This file contains the implementation of class Protocol. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC 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 "objc/Protocol.h" -#include "objc/objc-api.h" - -/* Method description list */ -struct objc_method_description_list { - int count; - struct objc_method_description list[1]; -}; - - -@implementation Protocol -{ -@private - char *protocol_name; - struct objc_protocol_list *protocol_list; - struct objc_method_description_list *instance_methods, *class_methods; -} - -/* Obtaining attributes intrinsic to the protocol */ - -- (const char *)name -{ - return protocol_name; -} - -/* Testing protocol conformance */ - -- (BOOL) conformsTo: (Protocol *)aProtocolObject -{ - int i; - struct objc_protocol_list* proto_list; - - if (!strcmp(aProtocolObject->protocol_name, self->protocol_name)) - return YES; - - for (proto_list = protocol_list; proto_list; proto_list = proto_list->next) - { - for (i=0; i < proto_list->count; i++) - { - if ([proto_list->list[i] conformsTo: aProtocolObject]) - return YES; - } - } - - return NO; -} - -/* Looking up information specific to a protocol */ - -- (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel -{ - int i; - struct objc_protocol_list* proto_list; - const char* name = sel_get_name (aSel); - struct objc_method_description *result; - - for (i = 0; i < instance_methods->count; i++) - { - if (!strcmp ((char*)instance_methods->list[i].name, name)) - return &(instance_methods->list[i]); - } - - for (proto_list = protocol_list; proto_list; proto_list = proto_list->next) - { - for (i=0; i < proto_list->count; i++) - { - if ((result = [proto_list->list[i] - descriptionForInstanceMethod: aSel])) - return result; - } - } - - return NULL; -} - -- (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel; -{ - int i; - struct objc_protocol_list* proto_list; - const char* name = sel_get_name (aSel); - struct objc_method_description *result; - - for (i = 0; i < class_methods->count; i++) - { - if (!strcmp ((char*)class_methods->list[i].name, name)) - return &(class_methods->list[i]); - } - - for (proto_list = protocol_list; proto_list; proto_list = proto_list->next) - { - for (i=0; i < proto_list->count; i++) - { - if ((result = [proto_list->list[i] - descriptionForClassMethod: aSel])) - return result; - } - } - - return NULL; -} - -@end diff --git a/contrib/libobjc/README b/contrib/libobjc/README deleted file mode 100644 index f478d67dec..0000000000 --- a/contrib/libobjc/README +++ /dev/null @@ -1,97 +0,0 @@ - -GNU Objective C notes -********************* - -This document is to explain what has been done, and a little about how -specific features differ from other implementations. The runtime has -been completely rewritten in gcc 2.4. The earlier runtime had several -severe bugs and was rather incomplete. The compiler has had several -new features added as well. - -This is not documentation for Objective C, it is usable to someone -who knows Objective C from somewhere else. - - -Runtime API functions -===================== - -The runtime is modeled after the NeXT Objective C runtime. That is, -most functions have semantics as it is known from the NeXT. The -names, however, have changed. All runtime API functions have names -of lowercase letters and underscores as opposed to the -`traditional' mixed case names. - The runtime api functions are not documented as of now. -Someone offered to write it, and did it, but we were not allowed to -use it by his university (Very sad story). We have started writing -the documentation over again. This will be announced in appropriate -places when it becomes available. - - -Protocols -========= - -Protocols are now fully supported. The semantics is exactly as on the -NeXT. There is a flag to specify how protocols should be typechecked -when adopted to classes. The normal typechecker requires that all -methods in a given protocol must be implemented in the class that -adopts it -- it is not enough to inherit them. The flag -`-Wno-protocol' causes it to allow inherited methods, while -`-Wprotocols' is the default which requires them defined. - - -+initialize -=========== - -This method, if defined, is called before any other instance or class -methods of that particular class. This method is not inherited, and -is thus not called as initializer for a subclass that doesn't define -it itself. Thus, each +initialize method is called exactly once (or -never if no methods of that particular class is never called). -Besides this, it is allowed to have several +initialize methods, one -for each category. The order in which these (multiple methods) are -called is not well defined. I am not completely certain what the -semantics of this method is for other implementations, but this is -how it works for GNU Objective C. - - -Passivation/Activation/Typedstreams -=================================== - -This is supported in the style of NeXT TypedStream's. Consult the -headerfile Typedstreams.h for api functions. I (Kresten) have -rewritten it in Objective C, but this implementation is not part of -2.4, it is available from the GNU Objective C prerelease archive. - There is one difference worth noting concerning objects stored with -objc_write_object_reference (aka NXWriteObjectReference). When these -are read back in, their object is not guaranteed to be available until -the `-awake' method is called in the object that requests that object. -To objc_read_object you must pass a pointer to an id, which is valid -after exit from the function calling it (like e.g. an instance -variable). In general, you should not use objects read in until the --awake method is called. - - -Acknowledgements -================ - -The GNU Objective C team: Geoffrey Knauth (manager), -Tom Wood (compiler) and Kresten Krab Thorup - (runtime) would like to thank a some people for -participating in the development of the present GNU Objective C. - -Paul Burchard and Andrew McCallum - has been very helpful debugging the -runtime. Eric Herring has been very helpful -cleaning up after the documentation-copyright disaster and is now -helping with the new documentation. - -Steve Naroff and Richard Stallman - has been very helpful with implementation details -in the compiler. - - -Bug Reports -=========== - -Please read the section `Submitting Bugreports' of the gcc manual -before you submit any bugs. diff --git a/contrib/libobjc/README.threads b/contrib/libobjc/README.threads deleted file mode 100644 index 5f15bd9cb4..0000000000 --- a/contrib/libobjc/README.threads +++ /dev/null @@ -1,50 +0,0 @@ -============================================================================== -README.threads - Wed Nov 29 15:16:24 EST 1995 ------------------------------------------------------------------------------- - -Limited documentation is available in the THREADS file. - -This version has been tested on Sun Solaris, SGI Irix, and Windows NT. -It should also work on any single threaded system. - -Thanks go to the following people for help test and debug the library: - - Scott Christley, scottc@ocbi.com - Andrew McCallum, mccallum@cs.rochester.edu - -galen -gchunt@cs.rochester.edu - -Any questions, bug reports, etc should be directed to: - -Scott Christley, scottc@ocbi.com - -Please do not bug Galen with email as he no longer supports the code. - -============================================================================== -Changes from prior releases (in revered chronological order): ------------------------------------------------------------------------------- - -* Fixed bug in copy part of sarray_realloc. I had an < which should - have been <=. (Bug report from Scott). - ------------------------------------------------------------------------------- - -* Support for DEC OSF/1 is definitely broken. My programs always - seg-fault when I link with libpthreads.a. - -* Thread id's are no longer int's, but are instead of type - _objc_thread_t which is typedef'ed from a void *. An invalid thread - id is denoted by NULL and not -1 as before. - ------------------------------------------------------------------------------- - -* Renamed thread-winnt.c to thread-win32.c to better reflect support - for the API on both Windows NT and Windows 95 platforms. - (Who knows, maybe even Win32s :-). - -* Fixed bugs in Win32 support as per report from Scott Christley. - -* Fixed bug in sarray_get as per report from Scott Christley. - - diff --git a/contrib/libobjc/THREADS b/contrib/libobjc/THREADS deleted file mode 100644 index 9dfbbed97a..0000000000 --- a/contrib/libobjc/THREADS +++ /dev/null @@ -1,374 +0,0 @@ -This file describes in little detail the modifications to the -Objective-C runtime needed to make it thread safe. - -First off, kudos to Galen Hunt who is the author of this great work. - -If you have an comments or just want to know where to -send me money to express your undying gratitude for threading the -Objective-C runtime you can reach Galen at: - - gchunt@cs.rochester.edu - -Any questions, comments, bug reports, etc. should send email either to the -GCC bug account or to: - - Scott Christley - -* Sarray Threading: - -The most critical component of the Objective-C runtime is the sparse array -structure (sarray). Sarrays store object selectors and implementations. -Following in the tradition of the Objective-C runtime, my threading -support assumes that fast message dispatching is far more important -than *ANY* and *ALL* other operations. The message dispatching thus -uses *NO* locks on any kind. In fact, if you look in sarray.h, you -will notice that the message dispatching has not been modified. -Instead, I have modified the sarray management functions so that all -updates to the sarray data structure can be made in parallel will -message dispatching. - -To support concurrent message dispatching, no dynamically allocated -sarray data structures are freed while more than one thread is -operational. Sarray data structures that are no longer in use are -kept in a linked list of garbage and are released whenever the program -is operating with a single thread. The programmer can also flush the -garbage list by calling sarray_remove_garbage when the programmer can -ensure that no message dispatching is taking place concurrently. The -amount of un-reclaimed sarray garbage should normally be extremely -small in a real program as sarray structures are freed only when using -the "poseAs" functionality and early in program initialization, which -normally occurs while the program is single threaded. - -****************************************************************************** -* Static Variables: - -The following variables are either statically or globally defined. This list -does not include variables which are internal to implementation dependent -versions of thread-*.c. - -The following threading designations are used: - SAFE : Implicitly thread safe. - SINGLE : Must only be used in single thread mode. - MUTEX : Protected by single global mutex objc_runtime_mutex. - UNUSED : Not used in the runtime. - -Variable Name: Usage: Defined: Also used in: -=========================== ====== ============ ===================== -__objc_class_hash MUTEX class.c -__objc_class_links_resolved UNUSED class.c runtime.h -__objc_class_number MUTEX class.c -__objc_dangling_categories UNUSED init.c -__objc_module_list MUTEX init.c -__objc_selector_array MUTEX selector.c -__objc_selector_hash MUTEX selector.c -__objc_selector_max_index MUTEX selector.c sendmsg.c runtime.h -__objc_selector_names MUTEX selector.c -__objc_thread_exit_status SAFE thread.c -__objc_uninstalled_dtable MUTEX sendmsg.c selector.c -_objc_load_callback SAFE init.c objc-api.h -_objc_lookup_class SAFE class.c objc-api.h -_objc_object_alloc SINGLE objects.c objc-api.h -_objc_object_copy SINGLE objects.c objc-api.h -_objc_object_dispose SINGLE objects.c objc-api.h -frwd_sel SAFE2 sendmsg.c -idxsize MUTEX sarray.c sendmsg.c sarray.h -initialize_sel SAFE2 sendmsg.c -narrays MUTEX sarray.c sendmsg.c sarray.h -nbuckets MUTEX sarray.c sendmsg.c sarray.h -nindices MUTEX sarray.c sarray.h -previous_constructors SAFE1 init.c -proto_class SAFE1 init.c -unclaimed_categories MUTEX init.c -unclaimed_proto_list MUTEX init.c -uninitialized_statics MUTEX init.c - -Notes: -1) Initialized once in unithread mode. -2) Initialized value will always be same, guaranteed by lock on selector - hash table. - - -****************************************************************************** -* Frontend/Backend design: - -The design of the Objective-C runtime thread and mutex functions utilizes a -frontend/backend implementation. - -The frontend, as characterized by the files thr.h and thr.c, is a set -of platform independent structures and functions which represent the -user interface. Objective-C programs should use these structures and -functions for their thread and mutex work if they wish to maintain a -high degree of portability across platforms. - -The backend is composed of a file with the necessary code to map the ObjC -thread and mutex to a platform specific implementation. For example, the -file thr-solaris.c contains the implementation for Solaris. When you -configure GCC, it attempts to pick an appropriate backend file for the -target platform; however, you can override this choice by assign the -OBJC_THREAD_FILE make variable to the basename of the backend file. This -is especially useful on platforms which have multiple thread libraries. -For example: - - make OBJC_THREAD_FILE=thr-posix - -would indicate that the generic posix backend file, thr-posix.c, should be -compiled with the ObjC runtime library. If your platform does not support -threads then you should specify the OBJC_THREAD_FILE=thr-single backend file -to compile the ObjC runtime library without thread or mutex support; note -that programs which rely upon the ObjC thread and mutex functions will -compile and link correctly but attempting to create a thread or mutex will -result in an error. - -It is questionable whether it is really necessary to have both a -frontend and backend function for all available functionality. On the -one hand, it provides a clear, consistent differentiation between what -is public and what is private with the downside of having the overhead -of multiple functions calls. For example, the function to have a thread -yield the processor is objc_thread_yield; in the current implementation -this produces a function call set: - -objc_thread_yield() -> __objc_thread_yield() -> system yield function - -This has two extra function calls over calling the platform specific function -explicitly, but the issue is whether only the overhead of a single function -is necessary. - -objc_thread_yield() -> system yield function - -This breaks the public/private dichotomy between the frontend/backend -for the sake of efficiency. It is possible to just use a preprocessor -define so as to eliminate the extra function call: - -#define objc_thread_yield() __objc_thread_yield() - -This has the undesirable effect that if objc_thread_yield is actually -turned into a function based upon future need; then ObjC programs which -access the thread functions would need to be recompiled versus just -being relinked. - -****************************************************************************** -* Threads: - -The thread system attempts to create multiple threads using whatever -operating system or library thread support is available. It does -assume that all system functions are thread safe. Notably this means -that the system implementation of malloc and free must be thread safe. -If a system has multiple processors, the threads are configured for -full parallel processing. - -* Backend initialization functions - -__objc_init_thread_system(void), int - Initialize the thread subsystem. Called once by __objc_exec_class. - Return -1 if error otherwise return 0. - -__objc_close_thread_system(void), int - Closes the thread subsystem, not currently guaranteed to be called. - Return -1 if error otherwise return 0. - -***** -* Frontend thread functions -* User programs should use these functions. - -objc_thread_detach(SEL selector, id object, id argument), objc_thread_t - Creates and detaches a new thread. The new thread starts by - sending the given selector with a single argument to the - given object. - -objc_thread_set_priority(int priority), int - Sets a thread's relative priority within the program. Valid - options are: - - OBJC_THREAD_INTERACTIVE_PRIORITY - OBJC_THREAD_BACKGROUND_PRIORITY - OBJC_THREAD_LOW_PRIORITY - -objc_thread_get_priority(void), int - Query a thread's priority. - -objc_thread_yield(void), void - Yields processor to another thread with equal or higher - priority. It is up to the system scheduler to determine if - the processor is taken or not. - -objc_thread_exit(void), int - Terminates a thread. If this is the last thread executing - then the program will terminate. - -objc_thread_id(void), int - Returns the current thread's id. - -objc_thread_set_data(void *value), int - Set a pointer to the thread's local storage. Local storage is - thread specific. - -objc_thread_get_data(void), void * - Returns the pointer to the thread's local storage. - -***** -* Backend thread functions -* User programs should *NOT* directly call these functions. - -__objc_thread_detach(void (*func)(void *arg), void *arg), objc_thread_t - Spawns a new thread executing func, called by objc_thread_detach. - Return NULL if error otherwise return thread id. - -__objc_thread_set_priority(int priority), int - Set the thread's priority, called by objc_thread_set_priority. - Return -1 if error otherwise return 0. - -__objc_thread_get_priority(void), int - Query a thread's priority, called by objc_thread_get_priority. - Return -1 if error otherwise return the priority. - -__objc_thread_yield(void), void - Yields the processor, called by objc_thread_yield. - -__objc_thread_exit(void), int - Terminates the thread, called by objc_thread_exit. - Return -1 if error otherwise function does not return. - -__objc_thread_id(void), objc_thread_t - Returns the current thread's id, called by objc_thread_id. - Return -1 if error otherwise return thread id. - -__objc_thread_set_data(void *value), int - Set pointer for thread local storage, called by objc_thread_set_data. - Returns -1 if error otherwise return 0. - -__objc_thread_get_data(void), void * - Returns the pointer to the thread's local storage. - Returns NULL if error, called by objc_thread_get_data. - - -****************************************************************************** -* Mutexes: - -Mutexes can be locked recursively. Each locked mutex remembers -its owner (by thread id) and how many times it has been locked. The -last unlock on a mutex removes the system lock and allows other -threads to access the mutex. - -***** -* Frontend mutex functions -* User programs should use these functions. - -objc_mutex_allocate(void), objc_mutex_t - Allocates a new mutex. Mutex is initially unlocked. - Return NULL if error otherwise return mutex pointer. - -objc_mutex_deallocate(objc_mutex_t mutex), int - Free a mutex. Before freeing the mutex, makes sure that no - one else is using it. - Return -1 if error otherwise return 0. - -objc_mutex_lock(objc_mutex_t mutex), int - Locks a mutex. As mentioned earlier, the same thread may call - this routine repeatedly. - Return -1 if error otherwise return 0. - -objc_mutex_trylock(objc_mutex_t mutex), int - Attempts to lock a mutex. If lock on mutex can be acquired - then function operates exactly as objc_mutex_lock. - Return -1 if failed to acquire lock otherwise return 0. - -objc_mutex_unlock(objc_mutex_t mutex), int - Unlocks the mutex by one level. Other threads may not acquire - the mutex until this thread has released all locks on it. - Return -1 if error otherwise return 0. - -***** -* Backend mutex functions -* User programs should *NOT* directly call these functions. - -__objc_mutex_allocate(objc_mutex_t mutex), int - Allocates a new mutex, called by objc_mutex_allocate. - Return -1 if error otherwise return 0. - -__objc_mutex_deallocate(objc_mutex_t mutex), int - Free a mutex, called by objc_mutex_deallocate. - Return -1 if error otherwise return 0. - -__objc_mutex_lock(objc_mutex_t mutex), int - Locks a mutex, called by objc_mutex_lock. - Return -1 if error otherwise return 0. - -__objc_mutex_trylock(objc_mutex_t mutex), int - Attempts to lock a mutex, called by objc_mutex_trylock. - Return -1 if failed to acquire lock or error otherwise return 0. - -__objc_mutex_unlock(objc_mutex_t mutex), int - Unlocks the mutex, called by objc_mutex_unlock. - Return -1 if error otherwise return 0. - -****************************************************************************** -* Condition Mutexes: - -Mutexes can be locked recursively. Each locked mutex remembers -its owner (by thread id) and how many times it has been locked. The -last unlock on a mutex removes the system lock and allows other -threads to access the mutex. - -* -* Frontend condition mutex functions -* User programs should use these functions. -* - -objc_condition_allocate(void), objc_condition_t - Allocate a condition mutex. - Return NULL if error otherwise return condition pointer. - -objc_condition_deallocate(objc_condition_t condition), int - Deallocate a condition. Note that this includes an implicit - condition_broadcast to insure that waiting threads have the - opportunity to wake. It is legal to dealloc a condition only - if no other thread is/will be using it. Does NOT check for - other threads waiting but just wakes them up. - Return -1 if error otherwise return 0. - -objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex), int - Wait on the condition unlocking the mutex until objc_condition_signal() - or objc_condition_broadcast() are called for the same condition. The - given mutex *must* have the depth 1 so that it can be unlocked - here, for someone else can lock it and signal/broadcast the condition. - The mutex is used to lock access to the shared data that make up the - "condition" predicate. - Return -1 if error otherwise return 0. - -objc_condition_broadcast(objc_condition_t condition), int - Wake up all threads waiting on this condition. It is recommended that - the called would lock the same mutex as the threads in - objc_condition_wait before changing the "condition predicate" - and make this call and unlock it right away after this call. - Return -1 if error otherwise return 0. - -objc_condition_signal(objc_condition_t condition), int - Wake up one thread waiting on this condition. - Return -1 if error otherwise return 0. - -* -* Backend condition mutex functions -* User programs should *NOT* directly call these functions. -* - -__objc_condition_allocate(objc_condition_t condition), int - Allocate a condition mutex, called by objc_condition_allocate. - Return -1 if error otherwise return 0. - -__objc_condition_deallocate(objc_condition_t condition), int - Deallocate a condition, called by objc_condition_deallocate. - Return -1 if error otherwise return 0. - -__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex), int - Wait on the condition, called by objc_condition_wait. - Return -1 if error otherwise return 0 when condition is met. - -__objc_condition_broadcast(objc_condition_t condition), int - Wake up all threads waiting on this condition. - Called by objc_condition_broadcast. - Return -1 if error otherwise return 0. - -__objc_condition_signal(objc_condition_t condition), int - Wake up one thread waiting on this condition. - Called by objc_condition_signal. - Return -1 if error otherwise return 0. diff --git a/contrib/libobjc/THREADS.MACH b/contrib/libobjc/THREADS.MACH deleted file mode 100644 index 55de663786..0000000000 --- a/contrib/libobjc/THREADS.MACH +++ /dev/null @@ -1,23 +0,0 @@ -This readme refers to the file thr-mach.c. - -Under mach, thread priorities are kinda strange-- any given thread has -a MAXIMUM priority and a BASE priority. The BASE priority is the -current priority of the thread and the MAXIMUM is the maximum possible -priority the thread can assume. The developer can lower, but never -raise the maximum priority. - -The gcc concept of thread priorities is that they run at one of three -levels; interactive, background, and low. - -Under mach, this is translated to: - -interactive -- set priority to maximum -background -- set priority to 2/3 of maximum -low -- set priority to 1/3 of maximum - -This means that it is possible for a thread with the priority of -interactive to actually run at a lower priority than another thread -with a background, or even low, priority if the developer has modified -the maximum priority. - - diff --git a/contrib/libobjc/archive.c b/contrib/libobjc/archive.c deleted file mode 100644 index 10106c1145..0000000000 --- a/contrib/libobjc/archive.c +++ /dev/null @@ -1,1651 +0,0 @@ -/* GNU Objective C Runtime archiving - Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 "tconfig.h" -#include "runtime.h" -#include "typedstream.h" -#include "encoding.h" - -#ifdef HAVE_STDLIB_H -#include -#endif - -extern int fflush(FILE*); - -#define ROUND(V, A) \ - ({ typeof(V) __v=(V); typeof(A) __a=(A); \ - __a*((__v+__a-1)/__a); }) - -#define PTR2LONG(P) (((char*)(P))-(char*)0) -#define LONG2PTR(L) (((char*)0)+(L)) - -/* Declare some functions... */ - -static int -objc_read_class (struct objc_typed_stream* stream, Class* class); - -int objc_sizeof_type(const char* type); - -static int -objc_write_use_common (struct objc_typed_stream* stream, unsigned long key); - -static int -objc_write_register_common (struct objc_typed_stream* stream, - unsigned long key); - -static int -objc_write_class (struct objc_typed_stream* stream, - struct objc_class* class); - -const char* objc_skip_type (const char* type); - -static void __objc_finish_write_root_object(struct objc_typed_stream*); -static void __objc_finish_read_root_object(struct objc_typed_stream*); - -static __inline__ int -__objc_code_unsigned_char (unsigned char* buf, unsigned char val) -{ - if ((val&_B_VALUE) == val) - { - buf[0] = val|_B_SINT; - return 1; - } - else - { - buf[0] = _B_NINT|0x01; - buf[1] = val; - return 2; - } -} - -int -objc_write_unsigned_char (struct objc_typed_stream* stream, - unsigned char value) -{ - unsigned char buf[sizeof (unsigned char)+1]; - int len = __objc_code_unsigned_char (buf, value); - return (*stream->write)(stream->physical, buf, len); -} - -static __inline__ int -__objc_code_char (unsigned char* buf, signed char val) -{ - if (val >= 0) - return __objc_code_unsigned_char (buf, val); - else - { - buf[0] = _B_NINT|_B_SIGN|0x01; - buf[1] = -val; - return 2; - } -} - -int -objc_write_char (struct objc_typed_stream* stream, signed char value) -{ - unsigned char buf[sizeof (char)+1]; - int len = __objc_code_char (buf, value); - return (*stream->write)(stream->physical, buf, len); -} - -static __inline__ int -__objc_code_unsigned_short (unsigned char* buf, unsigned short val) -{ - if ((val&_B_VALUE) == val) - { - buf[0] = val|_B_SINT; - return 1; - } - else - { - int c, b; - - buf[0] = _B_NINT; - - for (c= sizeof(short); c != 0; c -= 1) - if (((val>>(8*(c-1)))%0x100) != 0) - break; - - buf[0] |= c; - - for (b = 1; c != 0; c--, b++) - { - buf[b] = (val >> (8*(c-1)))%0x100; - } - - return b; - } -} - -int -objc_write_unsigned_short (struct objc_typed_stream* stream, - unsigned short value) -{ - unsigned char buf[sizeof (unsigned short)+1]; - int len = __objc_code_unsigned_short (buf, value); - return (*stream->write)(stream->physical, buf, len); -} - -static __inline__ int -__objc_code_short (unsigned char* buf, short val) -{ - int sign = (val < 0); - int size = __objc_code_unsigned_short (buf, sign ? -val : val); - if (sign) - buf[0] |= _B_SIGN; - return size; -} - -int -objc_write_short (struct objc_typed_stream* stream, short value) -{ - unsigned char buf[sizeof (short)+1]; - int len = __objc_code_short (buf, value); - return (*stream->write)(stream->physical, buf, len); -} - - -static __inline__ int -__objc_code_unsigned_int (unsigned char* buf, unsigned int val) -{ - if ((val&_B_VALUE) == val) - { - buf[0] = val|_B_SINT; - return 1; - } - else - { - int c, b; - - buf[0] = _B_NINT; - - for (c= sizeof(int); c != 0; c -= 1) - if (((val>>(8*(c-1)))%0x100) != 0) - break; - - buf[0] |= c; - - for (b = 1; c != 0; c--, b++) - { - buf[b] = (val >> (8*(c-1)))%0x100; - } - - return b; - } -} - -int -objc_write_unsigned_int (struct objc_typed_stream* stream, unsigned int value) -{ - unsigned char buf[sizeof(unsigned int)+1]; - int len = __objc_code_unsigned_int (buf, value); - return (*stream->write)(stream->physical, buf, len); -} - -static __inline__ int -__objc_code_int (unsigned char* buf, int val) -{ - int sign = (val < 0); - int size = __objc_code_unsigned_int (buf, sign ? -val : val); - if (sign) - buf[0] |= _B_SIGN; - return size; -} - -int -objc_write_int (struct objc_typed_stream* stream, int value) -{ - unsigned char buf[sizeof(int)+1]; - int len = __objc_code_int (buf, value); - return (*stream->write)(stream->physical, buf, len); -} - -static __inline__ int -__objc_code_unsigned_long (unsigned char* buf, unsigned long val) -{ - if ((val&_B_VALUE) == val) - { - buf[0] = val|_B_SINT; - return 1; - } - else - { - int c, b; - - buf[0] = _B_NINT; - - for (c= sizeof(long); c != 0; c -= 1) - if (((val>>(8*(c-1)))%0x100) != 0) - break; - - buf[0] |= c; - - for (b = 1; c != 0; c--, b++) - { - buf[b] = (val >> (8*(c-1)))%0x100; - } - - return b; - } -} - -int -objc_write_unsigned_long (struct objc_typed_stream* stream, - unsigned long value) -{ - unsigned char buf[sizeof(unsigned long)+1]; - int len = __objc_code_unsigned_long (buf, value); - return (*stream->write)(stream->physical, buf, len); -} - -static __inline__ int -__objc_code_long (unsigned char* buf, long val) -{ - int sign = (val < 0); - int size = __objc_code_unsigned_long (buf, sign ? -val : val); - if (sign) - buf[0] |= _B_SIGN; - return size; -} - -int -objc_write_long (struct objc_typed_stream* stream, long value) -{ - unsigned char buf[sizeof(long)+1]; - int len = __objc_code_long (buf, value); - return (*stream->write)(stream->physical, buf, len); -} - - -int -objc_write_string (struct objc_typed_stream* stream, - const unsigned char* string, unsigned int nbytes) -{ - unsigned char buf[sizeof(unsigned int)+1]; - int len = __objc_code_unsigned_int (buf, nbytes); - - if ((buf[0]&_B_CODE) == _B_SINT) - buf[0] = (buf[0]&_B_VALUE)|_B_SSTR; - - else /* _B_NINT */ - buf[0] = (buf[0]&_B_VALUE)|_B_NSTR; - - if ((*stream->write)(stream->physical, buf, len) != 0) - return (*stream->write)(stream->physical, string, nbytes); - else - return 0; -} - -int -objc_write_string_atomic (struct objc_typed_stream* stream, - unsigned char* string, unsigned int nbytes) -{ - unsigned long key; - if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, string)))) - return objc_write_use_common (stream, key); - else - { - int length; - hash_add (&stream->stream_table, LONG2PTR(key=PTR2LONG(string)), string); - if ((length = objc_write_register_common (stream, key))) - return objc_write_string (stream, string, nbytes); - return length; - } -} - -static int -objc_write_register_common (struct objc_typed_stream* stream, - unsigned long key) -{ - unsigned char buf[sizeof (unsigned long)+2]; - int len = __objc_code_unsigned_long (buf+1, key); - if (len == 1) - { - buf[0] = _B_RCOMM|0x01; - buf[1] &= _B_VALUE; - return (*stream->write)(stream->physical, buf, len+1); - } - else - { - buf[1] = (buf[1]&_B_VALUE)|_B_RCOMM; - return (*stream->write)(stream->physical, buf+1, len); - } -} - -static int -objc_write_use_common (struct objc_typed_stream* stream, unsigned long key) -{ - unsigned char buf[sizeof (unsigned long)+2]; - int len = __objc_code_unsigned_long (buf+1, key); - if (len == 1) - { - buf[0] = _B_UCOMM|0x01; - buf[1] &= _B_VALUE; - return (*stream->write)(stream->physical, buf, 2); - } - else - { - buf[1] = (buf[1]&_B_VALUE)|_B_UCOMM; - return (*stream->write)(stream->physical, buf+1, len); - } -} - -static __inline__ int -__objc_write_extension (struct objc_typed_stream* stream, unsigned char code) -{ - if (code <= _B_VALUE) - { - unsigned char buf = code|_B_EXT; - return (*stream->write)(stream->physical, &buf, 1); - } - else - { - objc_error(nil, OBJC_ERR_BAD_OPCODE, - "__objc_write_extension: bad opcode %c\n", code); - return -1; - } -} - -__inline__ int -__objc_write_object (struct objc_typed_stream* stream, id object) -{ - unsigned char buf = '\0'; - SEL write_sel = sel_get_any_uid ("write:"); - if (object) - { - __objc_write_extension (stream, _BX_OBJECT); - objc_write_class (stream, object->class_pointer); - (*objc_msg_lookup(object, write_sel))(object, write_sel, stream); - return (*stream->write)(stream->physical, &buf, 1); - } - else - return objc_write_use_common(stream, 0); -} - -int -objc_write_object_reference (struct objc_typed_stream* stream, id object) -{ - unsigned long key; - if ((key = PTR2LONG(hash_value_for_key (stream->object_table, object)))) - return objc_write_use_common (stream, key); - - __objc_write_extension (stream, _BX_OBJREF); - return objc_write_unsigned_long (stream, PTR2LONG (object)); -} - -int -objc_write_root_object (struct objc_typed_stream* stream, id object) -{ - int len = 0; - if (stream->writing_root_p) - objc_error (nil, OBJC_ERR_RECURSE_ROOT, - "objc_write_root_object called recursively"); - else - { - stream->writing_root_p = 1; - __objc_write_extension (stream, _BX_OBJROOT); - if((len = objc_write_object (stream, object))) - __objc_finish_write_root_object(stream); - stream->writing_root_p = 0; - } - return len; -} - -int -objc_write_object (struct objc_typed_stream* stream, id object) -{ - unsigned long key; - if ((key = PTR2LONG(hash_value_for_key (stream->object_table, object)))) - return objc_write_use_common (stream, key); - - else if (object == nil) - return objc_write_use_common(stream, 0); - - else - { - int length; - hash_add (&stream->object_table, LONG2PTR(key=PTR2LONG(object)), object); - if ((length = objc_write_register_common (stream, key))) - return __objc_write_object (stream, object); - return length; - } -} - -__inline__ int -__objc_write_class (struct objc_typed_stream* stream, struct objc_class* class) -{ - __objc_write_extension (stream, _BX_CLASS); - objc_write_string_atomic(stream, (char*)class->name, - strlen((char*)class->name)); - return objc_write_unsigned_long (stream, class->version); -} - - -static int -objc_write_class (struct objc_typed_stream* stream, - struct objc_class* class) -{ - unsigned long key; - if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, class)))) - return objc_write_use_common (stream, key); - else - { - int length; - hash_add (&stream->stream_table, LONG2PTR(key=PTR2LONG(class)), class); - if ((length = objc_write_register_common (stream, key))) - return __objc_write_class (stream, class); - return length; - } -} - - -__inline__ int -__objc_write_selector (struct objc_typed_stream* stream, SEL selector) -{ - const char* sel_name; - __objc_write_extension (stream, _BX_SEL); - /* to handle NULL selectors */ - if ((SEL)0 == selector) - return objc_write_string (stream, "", 0); - sel_name = sel_get_name (selector); - return objc_write_string (stream, sel_name, strlen ((char*)sel_name)); -} - -int -objc_write_selector (struct objc_typed_stream* stream, SEL selector) -{ - const char* sel_name; - unsigned long key; - - /* to handle NULL selectors */ - if ((SEL)0 == selector) - return __objc_write_selector (stream, selector); - - sel_name = sel_get_name (selector); - if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, sel_name)))) - return objc_write_use_common (stream, key); - else - { - int length; - hash_add (&stream->stream_table, - LONG2PTR(key=PTR2LONG(sel_name)), (char*)sel_name); - if ((length = objc_write_register_common (stream, key))) - return __objc_write_selector (stream, selector); - return length; - } -} - - - -/* -** Read operations -*/ - -__inline__ int -objc_read_char (struct objc_typed_stream* stream, char* val) -{ - unsigned char buf; - int len; - len = (*stream->read)(stream->physical, &buf, 1); - if (len != 0) - { - if ((buf & _B_CODE) == _B_SINT) - (*val) = (buf & _B_VALUE); - - else if ((buf & _B_NUMBER) == 1) - { - len = (*stream->read)(stream->physical, val, 1); - if (buf&_B_SIGN) - (*val) = -1*(*val); - } - - else - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected 8bit signed int, got %dbit int", - (int)(buf&_B_NUMBER)*8); - } - return len; -} - - -__inline__ int -objc_read_unsigned_char (struct objc_typed_stream* stream, unsigned char* val) -{ - unsigned char buf; - int len; - if ((len = (*stream->read)(stream->physical, &buf, 1))) - { - if ((buf & _B_CODE) == _B_SINT) - (*val) = (buf & _B_VALUE); - - else if ((buf & _B_NUMBER) == 1) - len = (*stream->read)(stream->physical, val, 1); - - else - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected 8bit unsigned int, got %dbit int", - (int)(buf&_B_NUMBER)*8); - } - return len; -} - -__inline__ int -objc_read_short (struct objc_typed_stream* stream, short* value) -{ - unsigned char buf[sizeof(short)+1]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - if ((buf[0] & _B_CODE) == _B_SINT) - (*value) = (buf[0] & _B_VALUE); - - else - { - int pos = 1; - int nbytes = buf[0] & _B_NUMBER; - if (nbytes > sizeof (short)) - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected short, got bigger (%dbits)", nbytes*8); - len = (*stream->read)(stream->physical, buf+1, nbytes); - (*value) = 0; - while (pos <= nbytes) - (*value) = ((*value)*0x100) + buf[pos++]; - if (buf[0] & _B_SIGN) - (*value) = -(*value); - } - } - return len; -} - -__inline__ int -objc_read_unsigned_short (struct objc_typed_stream* stream, - unsigned short* value) -{ - unsigned char buf[sizeof(unsigned short)+1]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - if ((buf[0] & _B_CODE) == _B_SINT) - (*value) = (buf[0] & _B_VALUE); - - else - { - int pos = 1; - int nbytes = buf[0] & _B_NUMBER; - if (nbytes > sizeof (short)) - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected short, got int or bigger"); - len = (*stream->read)(stream->physical, buf+1, nbytes); - (*value) = 0; - while (pos <= nbytes) - (*value) = ((*value)*0x100) + buf[pos++]; - } - } - return len; -} - - -__inline__ int -objc_read_int (struct objc_typed_stream* stream, int* value) -{ - unsigned char buf[sizeof(int)+1]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - if ((buf[0] & _B_CODE) == _B_SINT) - (*value) = (buf[0] & _B_VALUE); - - else - { - int pos = 1; - int nbytes = buf[0] & _B_NUMBER; - if (nbytes > sizeof (int)) - objc_error(nil, OBJC_ERR_BAD_DATA, "expected int, got bigger"); - len = (*stream->read)(stream->physical, buf+1, nbytes); - (*value) = 0; - while (pos <= nbytes) - (*value) = ((*value)*0x100) + buf[pos++]; - if (buf[0] & _B_SIGN) - (*value) = -(*value); - } - } - return len; -} - -__inline__ int -objc_read_long (struct objc_typed_stream* stream, long* value) -{ - unsigned char buf[sizeof(long)+1]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - if ((buf[0] & _B_CODE) == _B_SINT) - (*value) = (buf[0] & _B_VALUE); - - else - { - int pos = 1; - int nbytes = buf[0] & _B_NUMBER; - if (nbytes > sizeof (long)) - objc_error(nil, OBJC_ERR_BAD_DATA, "expected long, got bigger"); - len = (*stream->read)(stream->physical, buf+1, nbytes); - (*value) = 0; - while (pos <= nbytes) - (*value) = ((*value)*0x100) + buf[pos++]; - if (buf[0] & _B_SIGN) - (*value) = -(*value); - } - } - return len; -} - -__inline__ int -__objc_read_nbyte_uint (struct objc_typed_stream* stream, - unsigned int nbytes, unsigned int* val) -{ - int len, pos = 0; - unsigned char buf[sizeof(unsigned int)+1]; - - if (nbytes > sizeof (int)) - objc_error(nil, OBJC_ERR_BAD_DATA, "expected int, got bigger"); - - len = (*stream->read)(stream->physical, buf, nbytes); - (*val) = 0; - while (pos < nbytes) - (*val) = ((*val)*0x100) + buf[pos++]; - return len; -} - - -__inline__ int -objc_read_unsigned_int (struct objc_typed_stream* stream, - unsigned int* value) -{ - unsigned char buf[sizeof(unsigned int)+1]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - if ((buf[0] & _B_CODE) == _B_SINT) - (*value) = (buf[0] & _B_VALUE); - - else - len = __objc_read_nbyte_uint (stream, (buf[0] & _B_VALUE), value); - - } - return len; -} - -int -__objc_read_nbyte_ulong (struct objc_typed_stream* stream, - unsigned int nbytes, unsigned long* val) -{ - int len, pos = 0; - unsigned char buf[sizeof(unsigned long)+1]; - - if (nbytes > sizeof (long)) - objc_error(nil, OBJC_ERR_BAD_DATA, "expected long, got bigger"); - - len = (*stream->read)(stream->physical, buf, nbytes); - (*val) = 0; - while (pos < nbytes) - (*val) = ((*val)*0x100) + buf[pos++]; - return len; -} - - -__inline__ int -objc_read_unsigned_long (struct objc_typed_stream* stream, - unsigned long* value) -{ - unsigned char buf[sizeof(unsigned long)+1]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - if ((buf[0] & _B_CODE) == _B_SINT) - (*value) = (buf[0] & _B_VALUE); - - else - len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), value); - - } - return len; -} - -__inline__ int -objc_read_string (struct objc_typed_stream* stream, - char** string) -{ - unsigned char buf[sizeof(unsigned int)+1]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - unsigned long key = 0; - - if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */ - { - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - len = (*stream->read)(stream->physical, buf, 1); - } - - switch (buf[0]&_B_CODE) { - case _B_SSTR: - { - int length = buf[0]&_B_VALUE; - (*string) = (char*)objc_malloc(length+1); - if (key) - hash_add (&stream->stream_table, LONG2PTR(key), *string); - len = (*stream->read)(stream->physical, *string, length); - (*string)[length] = '\0'; - } - break; - - case _B_UCOMM: - { - char *tmp; - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - tmp = hash_value_for_key (stream->stream_table, LONG2PTR (key)); - *string = objc_malloc (strlen(tmp) + 1); - strcpy (*string, tmp); - } - break; - - case _B_NSTR: - { - unsigned int nbytes = buf[0]&_B_VALUE; - len = __objc_read_nbyte_uint(stream, nbytes, &nbytes); - if (len) { - (*string) = (char*)objc_malloc(nbytes+1); - if (key) - hash_add (&stream->stream_table, LONG2PTR(key), *string); - len = (*stream->read)(stream->physical, *string, nbytes); - (*string)[nbytes] = '\0'; - } - } - break; - - default: - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected string, got opcode %c\n", (buf[0]&_B_CODE)); - } - } - - return len; -} - - -int -objc_read_object (struct objc_typed_stream* stream, id* object) -{ - unsigned char buf[sizeof (unsigned int)]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - SEL read_sel = sel_get_any_uid ("read:"); - unsigned long key = 0; - - if ((buf[0]&_B_CODE) == _B_RCOMM) /* register common */ - { - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - len = (*stream->read)(stream->physical, buf, 1); - } - - if (buf[0] == (_B_EXT | _BX_OBJECT)) - { - Class class; - - /* get class */ - len = objc_read_class (stream, &class); - - /* create instance */ - (*object) = class_create_instance(class); - - /* register? */ - if (key) - hash_add (&stream->object_table, LONG2PTR(key), *object); - - /* send -read: */ - if (__objc_responds_to (*object, read_sel)) - (*get_imp(class, read_sel))(*object, read_sel, stream); - - /* check null-byte */ - len = (*stream->read)(stream->physical, buf, 1); - if (buf[0] != '\0') - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected null-byte, got opcode %c", buf[0]); - } - - else if ((buf[0]&_B_CODE) == _B_UCOMM) - { - if (key) - objc_error(nil, OBJC_ERR_BAD_KEY, "cannot register use upcode..."); - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - (*object) = hash_value_for_key (stream->object_table, LONG2PTR(key)); - } - - else if (buf[0] == (_B_EXT | _BX_OBJREF)) /* a forward reference */ - { - struct objc_list* other; - len = objc_read_unsigned_long (stream, &key); - other = (struct objc_list*)hash_value_for_key (stream->object_refs, - LONG2PTR(key)); - hash_add (&stream->object_refs, LONG2PTR(key), - (void*)list_cons(object, other)); - } - - else if (buf[0] == (_B_EXT | _BX_OBJROOT)) /* a root object */ - { - if (key) - objc_error(nil, OBJC_ERR_BAD_KEY, - "cannot register root object..."); - len = objc_read_object (stream, object); - __objc_finish_read_root_object (stream); - } - - else - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected object, got opcode %c", buf[0]); - } - return len; -} - -static int -objc_read_class (struct objc_typed_stream* stream, Class* class) -{ - unsigned char buf[sizeof (unsigned int)]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - unsigned long key = 0; - - if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */ - { - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - len = (*stream->read)(stream->physical, buf, 1); - } - - if (buf[0] == (_B_EXT | _BX_CLASS)) - { - char* class_name; - unsigned long version; - - /* get class */ - len = objc_read_string (stream, &class_name); - (*class) = objc_get_class(class_name); - objc_free(class_name); - - /* register */ - if (key) - hash_add (&stream->stream_table, LONG2PTR(key), *class); - - objc_read_unsigned_long(stream, &version); - hash_add (&stream->class_table, (*class)->name, (void*)version); - } - - else if ((buf[0]&_B_CODE) == _B_UCOMM) - { - if (key) - objc_error(nil, OBJC_ERR_BAD_KEY, "cannot register use upcode..."); - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - (*class) = hash_value_for_key (stream->stream_table, LONG2PTR(key)); - if (!*class) - objc_error(nil, OBJC_ERR_BAD_CLASS, - "cannot find class for key %lu", key); - } - - else - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected class, got opcode %c", buf[0]); - } - return len; -} - -int -objc_read_selector (struct objc_typed_stream* stream, SEL* selector) -{ - unsigned char buf[sizeof (unsigned int)]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - unsigned long key = 0; - - if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */ - { - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - len = (*stream->read)(stream->physical, buf, 1); - } - - if (buf[0] == (_B_EXT|_BX_SEL)) /* selector! */ - { - char* selector_name; - - /* get selector */ - len = objc_read_string (stream, &selector_name); - /* To handle NULL selectors */ - if (0 == strlen(selector_name)) - { - (*selector) = (SEL)0; - return 0; - } - else - (*selector) = sel_get_any_uid(selector_name); - objc_free(selector_name); - - /* register */ - if (key) - hash_add (&stream->stream_table, LONG2PTR(key), (void*)*selector); - } - - else if ((buf[0]&_B_CODE) == _B_UCOMM) - { - if (key) - objc_error(nil, OBJC_ERR_BAD_KEY, "cannot register use upcode..."); - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - (*selector) = hash_value_for_key (stream->stream_table, - LONG2PTR(key)); - } - - else - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected selector, got opcode %c", buf[0]); - } - return len; -} - -/* -** USER LEVEL FUNCTIONS -*/ - -/* -** Write one object, encoded in TYPE and pointed to by DATA to the -** typed stream STREAM. -*/ - -int -objc_write_type(TypedStream* stream, const char* type, const void* data) -{ - switch(*type) { - case _C_ID: - return objc_write_object (stream, *(id*)data); - break; - - case _C_CLASS: - return objc_write_class (stream, *(Class*)data); - break; - - case _C_SEL: - return objc_write_selector (stream, *(SEL*)data); - break; - - case _C_CHR: - return objc_write_char(stream, *(signed char*)data); - break; - - case _C_UCHR: - return objc_write_unsigned_char(stream, *(unsigned char*)data); - break; - - case _C_SHT: - return objc_write_short(stream, *(short*)data); - break; - - case _C_USHT: - return objc_write_unsigned_short(stream, *(unsigned short*)data); - break; - - case _C_INT: - return objc_write_int(stream, *(int*)data); - break; - - case _C_UINT: - return objc_write_unsigned_int(stream, *(unsigned int*)data); - break; - - case _C_LNG: - return objc_write_long(stream, *(long*)data); - break; - - case _C_ULNG: - return objc_write_unsigned_long(stream, *(unsigned long*)data); - break; - - case _C_CHARPTR: - return objc_write_string (stream, *(char**)data, strlen(*(char**)data)); - break; - - case _C_ATOM: - return objc_write_string_atomic (stream, *(char**)data, - strlen(*(char**)data)); - break; - - case _C_ARY_B: - { - int len = atoi(type+1); - while (isdigit(*++type)) - ; - return objc_write_array (stream, type, len, data); - } - break; - - case _C_STRUCT_B: - { - int acc_size = 0; - int align; - while (*type != _C_STRUCT_E && *type++ != '=') - ; /* skip "=" */ - while (*type != _C_STRUCT_E) - { - align = objc_alignof_type (type); /* padd to alignment */ - acc_size += ROUND (acc_size, align); - objc_write_type (stream, type, ((char*)data)+acc_size); - acc_size += objc_sizeof_type (type); /* add component size */ - type = objc_skip_typespec (type); /* skip component */ - } - return 1; - } - - default: - { - objc_error(nil, OBJC_ERR_BAD_TYPE, - "objc_write_type: cannot parse typespec: %s\n", type); - return 0; - } - } -} - -/* -** Read one object, encoded in TYPE and pointed to by DATA to the -** typed stream STREAM. DATA specifies the address of the types to -** read. Expected type is checked against the type actually present -** on the stream. -*/ - -int -objc_read_type(TypedStream* stream, const char* type, void* data) -{ - char c; - switch(c = *type) { - case _C_ID: - return objc_read_object (stream, (id*)data); - break; - - case _C_CLASS: - return objc_read_class (stream, (Class*)data); - break; - - case _C_SEL: - return objc_read_selector (stream, (SEL*)data); - break; - - case _C_CHR: - return objc_read_char (stream, (char*)data); - break; - - case _C_UCHR: - return objc_read_unsigned_char (stream, (unsigned char*)data); - break; - - case _C_SHT: - return objc_read_short (stream, (short*)data); - break; - - case _C_USHT: - return objc_read_unsigned_short (stream, (unsigned short*)data); - break; - - case _C_INT: - return objc_read_int (stream, (int*)data); - break; - - case _C_UINT: - return objc_read_unsigned_int (stream, (unsigned int*)data); - break; - - case _C_LNG: - return objc_read_long (stream, (long*)data); - break; - - case _C_ULNG: - return objc_read_unsigned_long (stream, (unsigned long*)data); - break; - - case _C_CHARPTR: - case _C_ATOM: - return objc_read_string (stream, (char**)data); - break; - - case _C_ARY_B: - { - int len = atoi(type+1); - while (isdigit(*++type)) - ; - return objc_read_array (stream, type, len, data); - } - break; - - case _C_STRUCT_B: - { - int acc_size = 0; - int align; - while (*type != _C_STRUCT_E && *type++ != '=') - ; /* skip "=" */ - while (*type != _C_STRUCT_E) - { - align = objc_alignof_type (type); /* padd to alignment */ - acc_size += ROUND (acc_size, align); - objc_read_type (stream, type, ((char*)data)+acc_size); - acc_size += objc_sizeof_type (type); /* add component size */ - type = objc_skip_typespec (type); /* skip component */ - } - return 1; - } - - default: - { - objc_error(nil, OBJC_ERR_BAD_TYPE, - "objc_read_type: cannot parse typespec: %s\n", type); - return 0; - } - } -} - -/* -** Write the object specified by the template TYPE to STREAM. Last -** arguments specify addresses of values to be written. It might -** seem surprising to specify values by address, but this is extremely -** convenient for copy-paste with objc_read_types calls. A more -** down-to-the-earth cause for this passing of addresses is that values -** of arbitrary size is not well supported in ANSI C for functions with -** variable number of arguments. -*/ - -int -objc_write_types (TypedStream* stream, const char* type, ...) -{ - va_list args; - const char *c; - int res = 0; - - va_start(args, type); - - for (c = type; *c; c = objc_skip_typespec (c)) - { - switch(*c) { - case _C_ID: - res = objc_write_object (stream, *va_arg (args, id*)); - break; - - case _C_CLASS: - res = objc_write_class (stream, *va_arg(args, Class*)); - break; - - case _C_SEL: - res = objc_write_selector (stream, *va_arg(args, SEL*)); - break; - - case _C_CHR: - res = objc_write_char (stream, *va_arg (args, char*)); - break; - - case _C_UCHR: - res = objc_write_unsigned_char (stream, - *va_arg (args, unsigned char*)); - break; - - case _C_SHT: - res = objc_write_short (stream, *va_arg(args, short*)); - break; - - case _C_USHT: - res = objc_write_unsigned_short (stream, - *va_arg(args, unsigned short*)); - break; - - case _C_INT: - res = objc_write_int(stream, *va_arg(args, int*)); - break; - - case _C_UINT: - res = objc_write_unsigned_int(stream, *va_arg(args, unsigned int*)); - break; - - case _C_LNG: - res = objc_write_long(stream, *va_arg(args, long*)); - break; - - case _C_ULNG: - res = objc_write_unsigned_long(stream, *va_arg(args, unsigned long*)); - break; - - case _C_CHARPTR: - { - char** str = va_arg(args, char**); - res = objc_write_string (stream, *str, strlen(*str)); - } - break; - - case _C_ATOM: - { - char** str = va_arg(args, char**); - res = objc_write_string_atomic (stream, *str, strlen(*str)); - } - break; - - case _C_ARY_B: - { - int len = atoi(c+1); - const char* t = c; - while (isdigit(*++t)) - ; - res = objc_write_array (stream, t, len, va_arg(args, void*)); - t = objc_skip_typespec (t); - if (*t != _C_ARY_E) - objc_error(nil, OBJC_ERR_BAD_TYPE, "expected `]', got: %s", t); - } - break; - - default: - objc_error(nil, OBJC_ERR_BAD_TYPE, - "objc_write_types: cannot parse typespec: %s\n", type); - } - } - va_end(args); - return res; -} - - -/* -** Last arguments specify addresses of values to be read. Expected -** type is checked against the type actually present on the stream. -*/ - -int -objc_read_types(TypedStream* stream, const char* type, ...) -{ - va_list args; - const char *c; - int res = 0; - - va_start(args, type); - - for (c = type; *c; c = objc_skip_typespec(c)) - { - switch(*c) { - case _C_ID: - res = objc_read_object(stream, va_arg(args, id*)); - break; - - case _C_CLASS: - res = objc_read_class(stream, va_arg(args, Class*)); - break; - - case _C_SEL: - res = objc_read_selector(stream, va_arg(args, SEL*)); - break; - - case _C_CHR: - res = objc_read_char(stream, va_arg(args, char*)); - break; - - case _C_UCHR: - res = objc_read_unsigned_char(stream, va_arg(args, unsigned char*)); - break; - - case _C_SHT: - res = objc_read_short(stream, va_arg(args, short*)); - break; - - case _C_USHT: - res = objc_read_unsigned_short(stream, va_arg(args, unsigned short*)); - break; - - case _C_INT: - res = objc_read_int(stream, va_arg(args, int*)); - break; - - case _C_UINT: - res = objc_read_unsigned_int(stream, va_arg(args, unsigned int*)); - break; - - case _C_LNG: - res = objc_read_long(stream, va_arg(args, long*)); - break; - - case _C_ULNG: - res = objc_read_unsigned_long(stream, va_arg(args, unsigned long*)); - break; - - case _C_CHARPTR: - case _C_ATOM: - { - char** str = va_arg(args, char**); - res = objc_read_string (stream, str); - } - break; - - case _C_ARY_B: - { - int len = atoi(c+1); - const char* t = c; - while (isdigit(*++t)) - ; - res = objc_read_array (stream, t, len, va_arg(args, void*)); - t = objc_skip_typespec (t); - if (*t != _C_ARY_E) - objc_error(nil, OBJC_ERR_BAD_TYPE, "expected `]', got: %s", t); - } - break; - - default: - objc_error(nil, OBJC_ERR_BAD_TYPE, - "objc_read_types: cannot parse typespec: %s\n", type); - } - } - va_end(args); - return res; -} - -/* -** Write an array of COUNT elements of TYPE from the memory address DATA. -** This is equivalent of objc_write_type (stream, "[N]", data) -*/ - -int -objc_write_array (TypedStream* stream, const char* type, - int count, const void* data) -{ - int off = objc_sizeof_type(type); - const char* where = data; - - while (count-- > 0) - { - objc_write_type(stream, type, where); - where += off; - } - return 1; -} - -/* -** Read an array of COUNT elements of TYPE into the memory address -** DATA. The memory pointed to by data is supposed to be allocated -** by the callee. This is equivalent of -** objc_read_type (stream, "[N]", data) -*/ - -int -objc_read_array (TypedStream* stream, const char* type, - int count, void* data) -{ - int off = objc_sizeof_type(type); - char* where = (char*)data; - - while (count-- > 0) - { - objc_read_type(stream, type, where); - where += off; - } - return 1; -} - -static int -__objc_fread(FILE* file, char* data, int len) -{ - return fread(data, len, 1, file); -} - -static int -__objc_fwrite(FILE* file, char* data, int len) -{ - return fwrite(data, len, 1, file); -} - -static int -__objc_feof(FILE* file) -{ - return feof(file); -} - -static int -__objc_no_write(FILE* file, char* data, int len) -{ - objc_error (nil, OBJC_ERR_NO_WRITE, "TypedStream not open for writing"); - return 0; -} - -static int -__objc_no_read(FILE* file, char* data, int len) -{ - objc_error (nil, OBJC_ERR_NO_READ, "TypedStream not open for reading"); - return 0; -} - -static int -__objc_read_typed_stream_signature (TypedStream* stream) -{ - char buffer[80]; - int pos = 0; - do - (*stream->read)(stream->physical, buffer+pos, 1); - while (buffer[pos++] != '\0') - ; - sscanf (buffer, "GNU TypedStream %d", &stream->version); - if (stream->version != OBJC_TYPED_STREAM_VERSION) - objc_error (nil, OBJC_ERR_STREAM_VERSION, - "cannot handle TypedStream version %d", stream->version); - return 1; -} - -static int -__objc_write_typed_stream_signature (TypedStream* stream) -{ - char buffer[80]; - sprintf(buffer, "GNU TypedStream %d", OBJC_TYPED_STREAM_VERSION); - stream->version = OBJC_TYPED_STREAM_VERSION; - (*stream->write)(stream->physical, buffer, strlen(buffer)+1); - return 1; -} - -static void __objc_finish_write_root_object(struct objc_typed_stream* stream) -{ - hash_delete (stream->object_table); - stream->object_table = hash_new(64, - (hash_func_type)hash_ptr, - (compare_func_type)compare_ptrs); -} - -static void __objc_finish_read_root_object(struct objc_typed_stream* stream) -{ - node_ptr node; - SEL awake_sel = sel_get_any_uid ("awake"); - cache_ptr free_list = hash_new (64, - (hash_func_type) hash_ptr, - (compare_func_type) compare_ptrs); - - /* resolve object forward references */ - for (node = hash_next (stream->object_refs, NULL); node; - node = hash_next (stream->object_refs, node)) - { - struct objc_list* reflist = node->value; - const void* key = node->key; - id object = hash_value_for_key (stream->object_table, key); - while(reflist) - { - *((id*)reflist->head) = object; - if (hash_value_for_key (free_list,reflist) == NULL) - hash_add (&free_list,reflist,reflist); - - reflist = reflist->tail; - } - } - - /* apply __objc_free to all objects stored in free_list */ - for (node = hash_next (free_list, NULL); node; - node = hash_next (free_list, node)) - objc_free ((void *) node->key); - - hash_delete (free_list); - - /* empty object reference table */ - hash_delete (stream->object_refs); - stream->object_refs = hash_new(8, (hash_func_type)hash_ptr, - (compare_func_type)compare_ptrs); - - /* call -awake for all objects read */ - if (awake_sel) - { - for (node = hash_next (stream->object_table, NULL); node; - node = hash_next (stream->object_table, node)) - { - id object = node->value; - if (__objc_responds_to (object, awake_sel)) - (*objc_msg_lookup(object, awake_sel))(object, awake_sel); - } - } - - /* empty object table */ - hash_delete (stream->object_table); - stream->object_table = hash_new(64, - (hash_func_type)hash_ptr, - (compare_func_type)compare_ptrs); -} - -/* -** Open the stream PHYSICAL in MODE -*/ - -TypedStream* -objc_open_typed_stream (FILE* physical, int mode) -{ - TypedStream* s = (TypedStream*)objc_malloc(sizeof(TypedStream)); - - s->mode = mode; - s->physical = physical; - s->stream_table = hash_new(64, - (hash_func_type)hash_ptr, - (compare_func_type)compare_ptrs); - s->object_table = hash_new(64, - (hash_func_type)hash_ptr, - (compare_func_type)compare_ptrs); - s->eof = (objc_typed_eof_func)__objc_feof; - s->flush = (objc_typed_flush_func)fflush; - s->writing_root_p = 0; - if (mode == OBJC_READONLY) - { - s->class_table = hash_new(8, (hash_func_type)hash_string, - (compare_func_type)compare_strings); - s->object_refs = hash_new(8, (hash_func_type)hash_ptr, - (compare_func_type)compare_ptrs); - s->read = (objc_typed_read_func)__objc_fread; - s->write = (objc_typed_write_func)__objc_no_write; - __objc_read_typed_stream_signature (s); - } - else if (mode == OBJC_WRITEONLY) - { - s->class_table = 0; - s->object_refs = 0; - s->read = (objc_typed_read_func)__objc_no_read; - s->write = (objc_typed_write_func)__objc_fwrite; - __objc_write_typed_stream_signature (s); - } - else - { - objc_close_typed_stream (s); - return NULL; - } - s->type = OBJC_FILE_STREAM; - return s; -} - -/* -** Open the file named by FILE_NAME in MODE -*/ - -TypedStream* -objc_open_typed_stream_for_file (const char* file_name, int mode) -{ - FILE* file = NULL; - TypedStream* s; - - if (mode == OBJC_READONLY) - file = fopen (file_name, "r"); - else - file = fopen (file_name, "w"); - - if (file) - { - s = objc_open_typed_stream (file, mode); - if (s) - s->type |= OBJC_MANAGED_STREAM; - return s; - } - else - return NULL; -} - -/* -** Close STREAM freeing the structure it self. If it was opened with -** objc_open_typed_stream_for_file, the file will also be closed. -*/ - -void -objc_close_typed_stream (TypedStream* stream) -{ - if (stream->mode == OBJC_READONLY) - { - __objc_finish_read_root_object (stream); /* Just in case... */ - hash_delete (stream->class_table); - hash_delete (stream->object_refs); - } - - hash_delete (stream->stream_table); - hash_delete (stream->object_table); - - if (stream->type == (OBJC_MANAGED_STREAM | OBJC_FILE_STREAM)) - fclose ((FILE*)stream->physical); - - objc_free(stream); -} - -BOOL -objc_end_of_typed_stream (TypedStream* stream) -{ - return (*stream->eof)(stream->physical); -} - -void -objc_flush_typed_stream (TypedStream* stream) -{ - (*stream->flush)(stream->physical); -} - -long -objc_get_stream_class_version (TypedStream* stream, Class class) -{ - if (stream->class_table) - return PTR2LONG(hash_value_for_key (stream->class_table, class->name)); - else - return class_get_version (class); -} - diff --git a/contrib/libobjc/class.c b/contrib/libobjc/class.c deleted file mode 100644 index 44aa1b9f98..0000000000 --- a/contrib/libobjc/class.c +++ /dev/null @@ -1,358 +0,0 @@ -/* GNU Objective C Runtime class related functions - Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup and Dennis Glatting. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 "runtime.h" /* the kitchen sink */ -#include "sarray.h" - -/* The table of classname->class. Used for objc_lookup_class and friends */ -static cache_ptr __objc_class_hash = 0; /* !T:MUTEX */ - -/* This is a hook which is called by objc_get_class and - objc_lookup_class if the runtime is not able to find the class. - This may e.g. try to load in the class using dynamic loading */ -Class (*_objc_lookup_class)(const char* name) = 0; /* !T:SAFE */ - - -/* True when class links has been resolved */ -BOOL __objc_class_links_resolved = NO; /* !T:UNUSED */ - - -/* Initial number of buckets size of class hash table. */ -#define CLASS_HASH_SIZE 32 - -void __objc_init_class_tables() -{ - /* Allocate the class hash table */ - - if(__objc_class_hash) - return; - - objc_mutex_lock(__objc_runtime_mutex); - - __objc_class_hash - = hash_new (CLASS_HASH_SIZE, - (hash_func_type) hash_string, - (compare_func_type) compare_strings); - - objc_mutex_unlock(__objc_runtime_mutex); -} - -/* This function adds a class to the class hash table, and assigns the - class a number, unless it's already known */ -void -__objc_add_class_to_hash(Class class) -{ - Class h_class; - - objc_mutex_lock(__objc_runtime_mutex); - - /* make sure the table is there */ - assert(__objc_class_hash); - - /* make sure it's not a meta class */ - assert(CLS_ISCLASS(class)); - - /* Check to see if the class is already in the hash table. */ - h_class = hash_value_for_key (__objc_class_hash, class->name); - if (!h_class) - { - /* The class isn't in the hash table. Add the class and assign a class - number. */ - static unsigned int class_number = 1; - - CLS_SETNUMBER(class, class_number); - CLS_SETNUMBER(class->class_pointer, class_number); - - ++class_number; - hash_add (&__objc_class_hash, class->name, class); - } - - objc_mutex_unlock(__objc_runtime_mutex); -} - -/* Get the class object for the class named NAME. If NAME does not - identify a known class, the hook _objc_lookup_class is called. If - this fails, nil is returned */ -Class objc_lookup_class (const char* name) -{ - Class class; - - objc_mutex_lock(__objc_runtime_mutex); - - /* Make sure the class hash table exists. */ - assert (__objc_class_hash); - - class = hash_value_for_key (__objc_class_hash, name); - - objc_mutex_unlock(__objc_runtime_mutex); - - if (class) - return class; - - if (_objc_lookup_class) - return (*_objc_lookup_class)(name); - else - return 0; -} - -/* Get the class object for the class named NAME. If NAME does not - identify a known class, the hook _objc_lookup_class is called. If - this fails, an error message is issued and the system aborts */ -Class -objc_get_class (const char *name) -{ - Class class; - - objc_mutex_lock(__objc_runtime_mutex); - - /* Make sure the class hash table exists. */ - assert (__objc_class_hash); - - class = hash_value_for_key (__objc_class_hash, name); - - objc_mutex_unlock(__objc_runtime_mutex); - - if (class) - return class; - - if (_objc_lookup_class) - class = (*_objc_lookup_class)(name); - - if(class) - return class; - - objc_error(nil, OBJC_ERR_BAD_CLASS, - "objc runtime: cannot find class %s\n", name); - return 0; -} - -MetaClass -objc_get_meta_class(const char *name) -{ - return objc_get_class(name)->class_pointer; -} - -/* This function provides a way to enumerate all the classes in the - executable. Pass *ENUM_STATE == NULL to start the enumeration. The - function will return 0 when there are no more classes. - For example: - id class; - void *es = NULL; - while ((class = objc_next_class(&es))) - ... do something with class; -*/ -Class -objc_next_class(void **enum_state) -{ - objc_mutex_lock(__objc_runtime_mutex); - - /* make sure the table is there */ - assert(__objc_class_hash); - - *(node_ptr*)enum_state = - hash_next(__objc_class_hash, *(node_ptr*)enum_state); - - objc_mutex_unlock(__objc_runtime_mutex); - - if (*(node_ptr*)enum_state) - return (*(node_ptr*)enum_state)->value; - return (Class)0; -} - -/* Resolve super/subclass links for all classes. The only thing we - can be sure of is that the class_pointer for class objects point - to the right meta class objects */ -void __objc_resolve_class_links() -{ - node_ptr node; - Class object_class = objc_get_class ("Object"); - - assert(object_class); - - objc_mutex_lock(__objc_runtime_mutex); - - /* Assign subclass links */ - for (node = hash_next (__objc_class_hash, NULL); node; - node = hash_next (__objc_class_hash, node)) - { - Class class1 = node->value; - - /* Make sure we have what we think we have. */ - assert (CLS_ISCLASS(class1)); - assert (CLS_ISMETA(class1->class_pointer)); - - /* The class_pointer of all meta classes point to Object's meta class. */ - class1->class_pointer->class_pointer = object_class->class_pointer; - - if (!(CLS_ISRESOLV(class1))) - { - CLS_SETRESOLV(class1); - CLS_SETRESOLV(class1->class_pointer); - - if(class1->super_class) - { - Class a_super_class - = objc_get_class ((char *) class1->super_class); - - assert (a_super_class); - - DEBUG_PRINTF ("making class connections for: %s\n", - class1->name); - - /* assign subclass links for superclass */ - class1->sibling_class = a_super_class->subclass_list; - a_super_class->subclass_list = class1; - - /* Assign subclass links for meta class of superclass */ - if (a_super_class->class_pointer) - { - class1->class_pointer->sibling_class - = a_super_class->class_pointer->subclass_list; - a_super_class->class_pointer->subclass_list - = class1->class_pointer; - } - } - else /* a root class, make its meta object */ - /* be a subclass of Object */ - { - class1->class_pointer->sibling_class - = object_class->subclass_list; - object_class->subclass_list = class1->class_pointer; - } - } - } - - /* Assign superclass links */ - for (node = hash_next (__objc_class_hash, NULL); node; - node = hash_next (__objc_class_hash, node)) - { - Class class1 = node->value; - Class sub_class; - for (sub_class = class1->subclass_list; sub_class; - sub_class = sub_class->sibling_class) - { - sub_class->super_class = class1; - if(CLS_ISCLASS(sub_class)) - sub_class->class_pointer->super_class = class1->class_pointer; - } - } - - objc_mutex_unlock(__objc_runtime_mutex); -} - - - -#define CLASSOF(c) ((c)->class_pointer) - -Class -class_pose_as (Class impostor, Class super_class) -{ - node_ptr node; - Class class1; - - if (!CLS_ISRESOLV (impostor)) - __objc_resolve_class_links (); - - /* preconditions */ - assert (impostor); - assert (super_class); - assert (impostor->super_class == super_class); - assert (CLS_ISCLASS (impostor)); - assert (CLS_ISCLASS (super_class)); - assert (impostor->instance_size == super_class->instance_size); - - { - Class *subclass = &(super_class->subclass_list); - - /* move subclasses of super_class to impostor */ - while (*subclass) - { - Class nextSub = (*subclass)->sibling_class; - - if (*subclass != impostor) - { - Class sub = *subclass; - - /* classes */ - sub->sibling_class = impostor->subclass_list; - sub->super_class = impostor; - impostor->subclass_list = sub; - - /* It will happen that SUB is not a class object if it is - the top of the meta class hierarchy chain. (root - meta-class objects inherit their class object) If that is - the case... don't mess with the meta-meta class. */ - if (CLS_ISCLASS (sub)) - { - /* meta classes */ - CLASSOF (sub)->sibling_class = - CLASSOF (impostor)->subclass_list; - CLASSOF (sub)->super_class = CLASSOF (impostor); - CLASSOF (impostor)->subclass_list = CLASSOF (sub); - } - } - - *subclass = nextSub; - } - - /* set subclasses of superclass to be impostor only */ - super_class->subclass_list = impostor; - CLASSOF (super_class)->subclass_list = CLASSOF (impostor); - - /* set impostor to have no sibling classes */ - impostor->sibling_class = 0; - CLASSOF (impostor)->sibling_class = 0; - } - - /* check relationship of impostor and super_class is kept. */ - assert (impostor->super_class == super_class); - assert (CLASSOF (impostor)->super_class == CLASSOF (super_class)); - - /* This is how to update the lookup table. Regardless of - what the keys of the hashtable is, change all values that are - superclass into impostor. */ - - objc_mutex_lock(__objc_runtime_mutex); - - for (node = hash_next (__objc_class_hash, NULL); node; - node = hash_next (__objc_class_hash, node)) - { - class1 = (Class)node->value; - if (class1 == super_class) - { - node->value = impostor; /* change hash table value */ - } - } - - objc_mutex_unlock(__objc_runtime_mutex); - - /* next, we update the dispatch tables... */ - __objc_update_dispatch_table_for_class (CLASSOF (impostor)); - __objc_update_dispatch_table_for_class (impostor); - - return impostor; -} - - diff --git a/contrib/libobjc/configure b/contrib/libobjc/configure deleted file mode 100755 index 0469252015..0000000000 --- a/contrib/libobjc/configure +++ /dev/null @@ -1,1459 +0,0 @@ -#! /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 - --enable-objc-gc enable the use of Boehm's garbage collector with - the GNU Objective-C runtime." - -# 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=objc/objc.h - -# 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_CONFIG_HEADER(config.h) - -if test "${srcdir}" = "." ; then - if test "${with_target_subdir}" != "." ; then - topsrcdir=${with_multisrctop}../.. - else - topsrcdir=${with_multisrctop}.. - fi -else - topsrcdir=${srcdir}/.. -fi -ac_aux_dir= -for ac_dir in $topsrcdir $srcdir/$topsrcdir; 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 $topsrcdir $srcdir/$topsrcdir" 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. - - -# If the language specific compiler does not exist, but the "gcc" directory -# does, we do not build anything. Note, $r is set by the top-level Makefile. -# Note that when we look for the compiler, we search both with and without -# extension to handle cross and canadian cross builds. -compiler_name=cc1obj -rm -f skip-this-dir -echo $ac_n "checking if compiler $compiler_name has been built""... $ac_c" 1>&6 -echo "configure:566: checking if compiler $compiler_name has been built" >&5 -if eval "test \"`echo '$''{'objc_cv_compiler_exists'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - objc_cv_compiler_exists=yes -if test -n "$r"; then - if test -d "$r"/gcc; then - if test -f "$r"/gcc/$compiler_name \ - || test -f "$r"/gcc/$compiler_name.exe; then - true - else - objc_cv_compiler_exists=no - echo "rm -f config.cache config.log multilib.out" > skip-this-dir - fi - fi -fi - -fi - -echo "$ac_t""$objc_cv_compiler_exists" 1>&6 -if test x$objc_cv_compiler_exists = xno -then - rm -f Makefile conftest* confdefs* core - exit 0 -fi - -# For ObjC we'll set CC to point at the built gcc, but this will get it into -# the makefiles -# 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:597: 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:627: 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 - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:678: 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="cl" - 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 - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:710: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -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 - -cat > conftest.$ac_ext << EOF - -#line 721 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr 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 - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:752: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:757: 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 <&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 -else - GCC= -fi - -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:785: 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 - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi - - -test "$AR" || AR=ar - -if test "$RANLIB"; then : - -else - # 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:825: 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 - -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:865: 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' - - - -# Sanity check for the cross-compilation case: -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:921: 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 < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:942: \"$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 < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:959: \"$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 < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:976: \"$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 - -ac_safe=`echo "stdio.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for stdio.h""... $ac_c" 1>&6 -echo "configure:1002: checking for stdio.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 -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1012: \"$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 - : -else - echo "$ac_t""no" 1>&6 -{ echo "configure: error: Can't find stdio.h. -You must have a usable C system for the target already installed, at least -including headers and, preferably, the library, before you can configure -the Objective C runtime system. If necessary, install gcc now with -\`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'." 1>&2; exit 1; } -fi - - -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1040: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -#include -#include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1053: \"$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* - ac_cv_header_stdc=yes -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then - : -else - cat > conftest.$ac_ext < -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } - -EOF -if { (eval echo configure:1120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no -fi -rm -fr conftest* -fi - -fi -fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 -if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF -#define STDC_HEADERS 1 -EOF - -fi - - -# Determine the name of the GCC thread file. - -echo $ac_n "checking for thread file""... $ac_c" 1>&6 -echo "configure:1147: checking for thread file" >&5 -if eval "test \"`echo '$''{'objc_cv_thread_file'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -f "$r"/gcc/Makefile -then - objc_cv_thread_file=`grep \^GCC_THREAD_FILE "$r"/gcc/Makefile | awk -F= '{ print $2 }'` -else - { echo "configure: error: not found" 1>&2; exit 1; } -fi -fi - -echo "$ac_t""$objc_cv_thread_file" 1>&6 -OBJC_THREAD_FILE=$objc_cv_thread_file - - -# Check whether --enable-objc-gc or --disable-objc-gc was given. -if test "${enable_objc_gc+set}" = set; then - enableval="$enable_objc_gc" - if [ x$enable_objc_gc = xno ]; then - OBJC_BOEHM_GC='' -else - OBJC_BOEHM_GC=libobjc_gc.a -fi -else - OBJC_BOEHM_GC='' -fi - - - - -# We need multilib support, but only if configuring for the target. -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 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# 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 </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 "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS < 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%@CC@%$CC%g -s%@AR@%$AR%g -s%@RANLIB@%$RANLIB%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@CPP@%$CPP%g -s%@OBJC_THREAD_FILE@%$OBJC_THREAD_FILE%g -s%@OBJC_BOEHM_GC@%$OBJC_BOEHM_GC%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 <> $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* - -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h -if test -n "$CONFIG_FILES"; then - if test -n "${with_target_subdir}"; then - # FIXME: We shouldn't need to set ac_file - ac_file=Makefile - . ${topsrcdir}/config-ml.in - fi -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 - - diff --git a/contrib/libobjc/configure.in b/contrib/libobjc/configure.in deleted file mode 100644 index 821dcd2a9d..0000000000 --- a/contrib/libobjc/configure.in +++ /dev/null @@ -1,142 +0,0 @@ -# Process this file with autoconf to produce a configure script. -# Copyright (C) 1995, 1997, 1998, 1999 Free Software Foundation, Inc. -# Contributed by Dave Love (d.love@dl.ac.uk). -# -#This file is part of GNU Objective C. -# -#GNU Objective C is free software; you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation; either version 2, or (at your option) -#any later version. -# -#GNU Objective C is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. -# -#You should have received a copy of the GNU General Public License -#along with GNU Objective C; see the file COPYING. If not, write to -#the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -#02111-1307, USA. - -AC_PREREQ(2.13) -AC_INIT(objc/objc.h) -#AC_CONFIG_HEADER(config.h) - -if test "${srcdir}" = "." ; then - if test "${with_target_subdir}" != "." ; then - topsrcdir=${with_multisrctop}../.. - else - topsrcdir=${with_multisrctop}.. - fi -else - topsrcdir=${srcdir}/.. -fi -dnl This is needed for a multilibbed build in the source tree so -dnl that install-sh and config.sub get found. -AC_CONFIG_AUX_DIR($topsrcdir) - -# If the language specific compiler does not exist, but the "gcc" directory -# does, we do not build anything. Note, $r is set by the top-level Makefile. -# Note that when we look for the compiler, we search both with and without -# extension to handle cross and canadian cross builds. -compiler_name=cc1obj -rm -f skip-this-dir -AC_MSG_CHECKING(if compiler $compiler_name has been built) -AC_CACHE_VAL(objc_cv_compiler_exists, -[objc_cv_compiler_exists=yes -if test -n "$r"; then - if test -d "$r"/gcc; then - if test -f "$r"/gcc/$compiler_name \ - || test -f "$r"/gcc/$compiler_name.exe; then - true - else - objc_cv_compiler_exists=no - echo "rm -f config.cache config.log multilib.out" > skip-this-dir - fi - fi -fi -]) -AC_MSG_RESULT($objc_cv_compiler_exists) -if test x$objc_cv_compiler_exists = xno -then - rm -f Makefile conftest* confdefs* core - exit 0 -fi - -dnl Checks for programs. -# For ObjC we'll set CC to point at the built gcc, but this will get it into -# the makefiles -AC_PROG_CC - -test "$AR" || AR=ar -AC_SUBST(AR) -if test "$RANLIB"; then : - AC_SUBST(RANLIB) -else - AC_PROG_RANLIB -fi -AC_PROG_INSTALL - -dnl Checks for libraries. - -dnl Checks for header files. -# Sanity check for the cross-compilation case: -AC_CHECK_HEADER(stdio.h,:, - [AC_MSG_ERROR([Can't find stdio.h. -You must have a usable C system for the target already installed, at least -including headers and, preferably, the library, before you can configure -the Objective C runtime system. If necessary, install gcc now with -\`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])]) - -AC_HEADER_STDC - -# Determine the name of the GCC thread file. - -AC_CACHE_CHECK([for thread file],objc_cv_thread_file, -[if test -f "$r"/gcc/Makefile -then - objc_cv_thread_file=`grep \^GCC_THREAD_FILE "$r"/gcc/Makefile | awk -F= '{ print $2 }'` -else - AC_MSG_ERROR([not found]) -fi]) -OBJC_THREAD_FILE=$objc_cv_thread_file -AC_SUBST(OBJC_THREAD_FILE) - -AC_ARG_ENABLE(objc-gc, -[ --enable-objc-gc enable the use of Boehm's garbage collector with - the GNU Objective-C runtime.], -if [[[ x$enable_objc_gc = xno ]]]; then - OBJC_BOEHM_GC='' -else - OBJC_BOEHM_GC=libobjc_gc.a -fi, -OBJC_BOEHM_GC='') -AC_SUBST(OBJC_BOEHM_GC) - - -# We need multilib support, but only if configuring for the target. -AC_OUTPUT(Makefile, -[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h -if test -n "$CONFIG_FILES"; then - if test -n "${with_target_subdir}"; then - # FIXME: We shouldn't need to set ac_file - ac_file=Makefile - . ${topsrcdir}/config-ml.in - fi -fi], -srcdir=${srcdir} -host=${host} -target=${target} -with_target_subdir=${with_target_subdir} -with_multisubdir=${with_multisubdir} -ac_configure_args="--enable-multilib ${ac_configure_args}" -CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} -topsrcdir=${topsrcdir} -) - -dnl Local Variables: -dnl comment-start: "dnl " -dnl comment-end: "" -dnl comment-start-skip: "\\bdnl\\b\\s *" -dnl End: diff --git a/contrib/libobjc/encoding.c b/contrib/libobjc/encoding.c deleted file mode 100644 index 4749ba026e..0000000000 --- a/contrib/libobjc/encoding.c +++ /dev/null @@ -1,918 +0,0 @@ -/* Encoding of types for Objective C. - Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup - Bitfield support by Ovidiu Predescu - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC 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 "tconfig.h" -#include "objc-api.h" -#include "encoding.h" - -#define MAX(X, Y) \ - ({ typeof(X) __x = (X), __y = (Y); \ - (__x > __y ? __x : __y); }) - -#define MIN(X, Y) \ - ({ typeof(X) __x = (X), __y = (Y); \ - (__x < __y ? __x : __y); }) - -#define ROUND(V, A) \ - ({ typeof(V) __v=(V); typeof(A) __a=(A); \ - __a*((__v+__a-1)/__a); }) - - -/* Various hacks for objc_layout_record. These are used by the target - macros. */ - -#define TREE_CODE(TYPE) *TYPE -#define TREE_TYPE(TREE) TREE - -#define RECORD_TYPE _C_STRUCT_B -#define UNION_TYPE _C_UNION_B -#define QUAL_UNION_TYPE _C_UNION_B -#define ARRAY_TYPE _C_ARY_B - -#define TYPE_FIELDS(TYPE) objc_skip_typespec (TYPE) - -#define DECL_MODE(TYPE) *(TYPE) - -#define DFmode _C_DBL - -#define get_inner_array_type(TYPE) ((TYPE) + 1) - - -static inline int -atoi (const char* str) -{ - int res = 0; - - while (isdigit (*str)) - res *= 10, res += (*str++ - '0'); - - return res; -} - -/* - return the size of an object specified by type -*/ - -int -objc_sizeof_type (const char* type) -{ - /* Skip the variable name if any */ - if (*type == '"') - { - for (type++; *type++ != '"';) - /* do nothing */; - } - - switch(*type) { - case _C_ID: - return sizeof(id); - break; - - case _C_CLASS: - return sizeof(Class); - break; - - case _C_SEL: - return sizeof(SEL); - break; - - case _C_CHR: - return sizeof(char); - break; - - case _C_UCHR: - return sizeof(unsigned char); - break; - - case _C_SHT: - return sizeof(short); - break; - - case _C_USHT: - return sizeof(unsigned short); - break; - - case _C_INT: - return sizeof(int); - break; - - case _C_UINT: - return sizeof(unsigned int); - break; - - case _C_LNG: - return sizeof(long); - break; - - case _C_ULNG: - return sizeof(unsigned long); - break; - - case _C_LNG_LNG: - return sizeof(long long); - break; - - case _C_ULNG_LNG: - return sizeof(unsigned long long); - break; - - case _C_FLT: - return sizeof(float); - break; - - case _C_DBL: - return sizeof(double); - break; - - case _C_VOID: - return sizeof(void); - break; - case _C_PTR: - case _C_ATOM: - case _C_CHARPTR: - return sizeof(char*); - break; - - case _C_ARY_B: - { - int len = atoi(type+1); - while (isdigit(*++type)); - return len*objc_aligned_size (type); - } - break; - - case _C_BFLD: - { - /* The new encoding of bitfields is: b 'position' 'type' 'size' */ - int position, size; - int startByte, endByte; - - position = atoi (type + 1); - while (isdigit (*++type)); - size = atoi (type + 1); - - startByte = position / BITS_PER_UNIT; - endByte = (position + size) / BITS_PER_UNIT; - return endByte - startByte; - } - - case _C_STRUCT_B: - { - struct objc_struct_layout layout; - unsigned int size; - - objc_layout_structure (type, &layout); - while (objc_layout_structure_next_member (&layout)) - /* do nothing */ ; - objc_layout_finish_structure (&layout, &size, NULL); - - return size; - } - - case _C_UNION_B: - { - int max_size = 0; - while (*type != _C_UNION_E && *type++ != '=') /* do nothing */; - while (*type != _C_UNION_E) - { - /* Skip the variable name if any */ - if (*type == '"') - { - for (type++; *type++ != '"';) - /* do nothing */; - } - max_size = MAX (max_size, objc_sizeof_type (type)); - type = objc_skip_typespec (type); - } - return max_size; - } - - default: - { - objc_error(nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type); - return 0; - } - } -} - - -/* - Return the alignment of an object specified by type -*/ - -int -objc_alignof_type(const char* type) -{ - /* Skip the variable name if any */ - if (*type == '"') - { - for (type++; *type++ != '"';) - /* do nothing */; - } - switch(*type) { - case _C_ID: - return __alignof__(id); - break; - - case _C_CLASS: - return __alignof__(Class); - break; - - case _C_SEL: - return __alignof__(SEL); - break; - - case _C_CHR: - return __alignof__(char); - break; - - case _C_UCHR: - return __alignof__(unsigned char); - break; - - case _C_SHT: - return __alignof__(short); - break; - - case _C_USHT: - return __alignof__(unsigned short); - break; - - case _C_INT: - return __alignof__(int); - break; - - case _C_UINT: - return __alignof__(unsigned int); - break; - - case _C_LNG: - return __alignof__(long); - break; - - case _C_ULNG: - return __alignof__(unsigned long); - break; - - case _C_LNG_LNG: - return __alignof__(long long); - break; - - case _C_ULNG_LNG: - return __alignof__(unsigned long long); - break; - - case _C_FLT: - return __alignof__(float); - break; - - case _C_DBL: - return __alignof__(double); - break; - - case _C_PTR: - case _C_ATOM: - case _C_CHARPTR: - return __alignof__(char*); - break; - - case _C_ARY_B: - while (isdigit(*++type)) /* do nothing */; - return objc_alignof_type (type); - - case _C_STRUCT_B: - { - struct objc_struct_layout layout; - unsigned int align; - - objc_layout_structure (type, &layout); - while (objc_layout_structure_next_member (&layout)) - /* do nothing */; - objc_layout_finish_structure (&layout, NULL, &align); - - return align; - } - - case _C_UNION_B: - { - int maxalign = 0; - while (*type != _C_UNION_E && *type++ != '=') /* do nothing */; - while (*type != _C_UNION_E) - { - /* Skip the variable name if any */ - if (*type == '"') - { - for (type++; *type++ != '"';) - /* do nothing */; - } - maxalign = MAX (maxalign, objc_alignof_type (type)); - type = objc_skip_typespec (type); - } - return maxalign; - } - - default: - { - objc_error(nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type); - return 0; - } - } -} - -/* - The aligned size if the size rounded up to the nearest alignment. -*/ - -int -objc_aligned_size (const char* type) -{ - int size, align; - - /* Skip the variable name */ - if (*type == '"') - { - for (type++; *type++ != '"';) - /* do nothing */; - } - - size = objc_sizeof_type (type); - align = objc_alignof_type (type); - - return ROUND (size, align); -} - -/* - The size rounded up to the nearest integral of the wordsize, taken - to be the size of a void*. -*/ - -int -objc_promoted_size (const char* type) -{ - int size, wordsize; - - /* Skip the variable name */ - if (*type == '"') - { - for (type++; *type++ != '"';) - /* do nothing */; - } - - size = objc_sizeof_type (type); - wordsize = sizeof (void*); - - return ROUND (size, wordsize); -} - -/* - Skip type qualifiers. These may eventually precede typespecs - occurring in method prototype encodings. -*/ - -inline const char* -objc_skip_type_qualifiers (const char* type) -{ - while (*type == _C_CONST - || *type == _C_IN - || *type == _C_INOUT - || *type == _C_OUT - || *type == _C_BYCOPY - || *type == _C_BYREF - || *type == _C_ONEWAY - || *type == _C_GCINVISIBLE) - { - type += 1; - } - return type; -} - - -/* - Skip one typespec element. If the typespec is prepended by type - qualifiers, these are skipped as well. -*/ - -const char* -objc_skip_typespec (const char* type) -{ - /* Skip the variable name if any */ - if (*type == '"') - { - for (type++; *type++ != '"';) - /* do nothing */; - } - - type = objc_skip_type_qualifiers (type); - - switch (*type) { - - case _C_ID: - /* An id may be annotated by the actual type if it is known - with the @"ClassName" syntax */ - - if (*++type != '"') - return type; - else - { - while (*++type != '"') /* do nothing */; - return type + 1; - } - - /* The following are one character type codes */ - case _C_CLASS: - case _C_SEL: - case _C_CHR: - case _C_UCHR: - case _C_CHARPTR: - case _C_ATOM: - case _C_SHT: - case _C_USHT: - case _C_INT: - case _C_UINT: - case _C_LNG: - case _C_ULNG: - case _C_LNG_LNG: - case _C_ULNG_LNG: - case _C_FLT: - case _C_DBL: - case _C_VOID: - case _C_UNDEF: - return ++type; - break; - - case _C_ARY_B: - /* skip digits, typespec and closing ']' */ - - while(isdigit(*++type)); - type = objc_skip_typespec(type); - if (*type == _C_ARY_E) - return ++type; - else - { - objc_error(nil, OBJC_ERR_BAD_TYPE, "bad array type %s\n", type); - return 0; - } - - case _C_BFLD: - /* The new encoding of bitfields is: b 'position' 'type' 'size' */ - while (isdigit (*++type)); /* skip position */ - while (isdigit (*++type)); /* skip type and size */ - return type; - - case _C_STRUCT_B: - /* skip name, and elements until closing '}' */ - - while (*type != _C_STRUCT_E && *type++ != '='); - while (*type != _C_STRUCT_E) { type = objc_skip_typespec (type); } - return ++type; - - case _C_UNION_B: - /* skip name, and elements until closing ')' */ - - while (*type != _C_UNION_E && *type++ != '='); - while (*type != _C_UNION_E) { type = objc_skip_typespec (type); } - return ++type; - - case _C_PTR: - /* Just skip the following typespec */ - - return objc_skip_typespec (++type); - - default: - { - objc_error(nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type); - return 0; - } - } -} - -/* - Skip an offset as part of a method encoding. This is prepended by a - '+' if the argument is passed in registers. -*/ -inline const char* -objc_skip_offset (const char* type) -{ - if (*type == '+') type++; - while(isdigit(*++type)); - return type; -} - -/* - Skip an argument specification of a method encoding. -*/ -const char* -objc_skip_argspec (const char* type) -{ - type = objc_skip_typespec (type); - type = objc_skip_offset (type); - return type; -} - -/* - Return the number of arguments that the method MTH expects. - Note that all methods need two implicit arguments `self' and - `_cmd'. -*/ -int -method_get_number_of_arguments (struct objc_method* mth) -{ - int i = 0; - const char* type = mth->method_types; - while (*type) - { - type = objc_skip_argspec (type); - i += 1; - } - return i - 1; -} - -/* - Return the size of the argument block needed on the stack to invoke - the method MTH. This may be zero, if all arguments are passed in - registers. -*/ - -int -method_get_sizeof_arguments (struct objc_method* mth) -{ - const char* type = objc_skip_typespec (mth->method_types); - return atoi (type); -} - -/* - Return a pointer to the next argument of ARGFRAME. type points to - the last argument. Typical use of this look like: - - { - char *datum, *type; - for (datum = method_get_first_argument (method, argframe, &type); - datum; datum = method_get_next_argument (argframe, &type)) - { - unsigned flags = objc_get_type_qualifiers (type); - type = objc_skip_type_qualifiers (type); - if (*type != _C_PTR) - [portal encodeData: datum ofType: type]; - else - { - if ((flags & _F_IN) == _F_IN) - [portal encodeData: *(char**)datum ofType: ++type]; - } - } - } -*/ - -char* -method_get_next_argument (arglist_t argframe, - const char **type) -{ - const char *t = objc_skip_argspec (*type); - - if (*t == '\0') - return 0; - - *type = t; - t = objc_skip_typespec (t); - - if (*t == '+') - return argframe->arg_regs + atoi (++t); - else - return argframe->arg_ptr + atoi (t); -} - -/* - Return a pointer to the value of the first argument of the method - described in M with the given argumentframe ARGFRAME. The type - is returned in TYPE. type must be passed to successive calls of - method_get_next_argument. -*/ -char* -method_get_first_argument (struct objc_method* m, - arglist_t argframe, - const char** type) -{ - *type = m->method_types; - return method_get_next_argument (argframe, type); -} - -/* - Return a pointer to the ARGth argument of the method - M from the frame ARGFRAME. The type of the argument - is returned in the value-result argument TYPE -*/ - -char* -method_get_nth_argument (struct objc_method* m, - arglist_t argframe, int arg, - const char **type) -{ - const char* t = objc_skip_argspec (m->method_types); - - if (arg > method_get_number_of_arguments (m)) - return 0; - - while (arg--) - t = objc_skip_argspec (t); - - *type = t; - t = objc_skip_typespec (t); - - if (*t == '+') - return argframe->arg_regs + atoi (++t); - else - return argframe->arg_ptr + atoi (t); -} - -unsigned -objc_get_type_qualifiers (const char* type) -{ - unsigned res = 0; - BOOL flag = YES; - - while (flag) - switch (*type++) - { - case _C_CONST: res |= _F_CONST; break; - case _C_IN: res |= _F_IN; break; - case _C_INOUT: res |= _F_INOUT; break; - case _C_OUT: res |= _F_OUT; break; - case _C_BYCOPY: res |= _F_BYCOPY; break; - case _C_BYREF: res |= _F_BYREF; break; - case _C_ONEWAY: res |= _F_ONEWAY; break; - case _C_GCINVISIBLE: res |= _F_GCINVISIBLE; break; - default: flag = NO; - } - - return res; -} - - -/* The following three functions can be used to determine how a - structure is laid out by the compiler. For example: - - struct objc_struct_layout layout; - int i; - - objc_layout_structure (type, &layout); - while (objc_layout_structure_next_member (&layout)) - { - int position, align; - const char *type; - - objc_layout_structure_get_info (&layout, &position, &align, &type); - printf ("element %d has offset %d, alignment %d\n", - i++, position, align); - } - - These functions are used by objc_sizeof_type and objc_alignof_type - functions to compute the size and alignment of structures. The - previous method of computing the size and alignment of a structure - was not working on some architectures, particulary on AIX, and in - the presence of bitfields inside the structure. */ -void -objc_layout_structure (const char *type, - struct objc_struct_layout *layout) -{ - const char *ntype; - - if (*type++ != _C_STRUCT_B) - { - objc_error(nil, OBJC_ERR_BAD_TYPE, - "record type expected in objc_layout_structure, got %s\n", - type); - } - - layout->original_type = type; - - /* Skip "=" if any. Avoid embedded structures and unions. */ - ntype = type; - while (*ntype != _C_STRUCT_E && *ntype != _C_STRUCT_B && *ntype != _C_UNION_B - && *ntype++ != '=') - /* do nothing */; - - /* If there's a "=", ntype - 1 points to '='; skip the the name */ - if (*(ntype - 1) == '=') - type = ntype; - - layout->type = type; - layout->prev_type = NULL; - layout->record_size = 0; - layout->record_align = BITS_PER_UNIT; - -#ifdef STRUCTURE_SIZE_BOUNDARY - layout->record_align = MAX (layout->record_align, STRUCTURE_SIZE_BOUNDARY); -#endif -} - - -BOOL -objc_layout_structure_next_member (struct objc_struct_layout *layout) -{ - register int known_align = layout->record_size; - register int desired_align = 0; - - /* The following are used only if the field is a bitfield */ - register const char *bfld_type; - register int bfld_type_size, bfld_type_align, bfld_field_size; - - /* The current type without the type qualifiers */ - const char *type; - -#if 1 - if (layout->prev_type == NULL) - { - layout->prev_type = layout->type; - layout->type = objc_skip_typespec (layout->prev_type); - return YES; - } -#endif - - /* Add the size of the previous field to the size of the record. */ - if (layout->prev_type) - { - type = objc_skip_type_qualifiers (layout->prev_type); - - if (*type != _C_BFLD) - layout->record_size += objc_sizeof_type (type) * BITS_PER_UNIT; - else { - desired_align = 1; - /* Get the bitfield's type */ - for (bfld_type = type + 1; - isdigit(*bfld_type); - bfld_type++) - /* do nothing */; - - bfld_type_size = objc_sizeof_type (bfld_type) * BITS_PER_UNIT; - bfld_type_align = objc_alignof_type (bfld_type) * BITS_PER_UNIT; - bfld_field_size = atoi (objc_skip_typespec (bfld_type)); - layout->record_size += bfld_field_size; - } - } - - if (*layout->type == _C_STRUCT_E) - return NO; - - /* Skip the variable name if any */ - if (*layout->type == '"') - { - for (layout->type++; *layout->type++ != '"';) - /* do nothing */; - } - - type = objc_skip_type_qualifiers (layout->type); - - if (*type != _C_BFLD) - desired_align = objc_alignof_type(type) * BITS_PER_UNIT; - else - { - desired_align = 1; - /* Skip the bitfield's offset */ - for (bfld_type = type + 1; isdigit(*bfld_type); bfld_type++) - /* do nothing */; - - bfld_type_size = objc_sizeof_type (bfld_type) * BITS_PER_UNIT; - bfld_type_align = objc_alignof_type (bfld_type) * BITS_PER_UNIT; - bfld_field_size = atoi (objc_skip_typespec (bfld_type)); - } - -#ifdef BIGGEST_FIELD_ALIGNMENT - desired_align = MIN (desired_align, BIGGEST_FIELD_ALIGNMENT); -#endif -#ifdef ADJUST_FIELD_ALIGN - desired_align = ADJUST_FIELD_ALIGN (type, desired_align); -#endif - - /* Record must have at least as much alignment as any field. - Otherwise, the alignment of the field within the record - is meaningless. */ -#ifndef PCC_BITFIELD_TYPE_MATTERS - layout->record_align = MAX (layout->record_align, desired_align); -#else - if (*type == _C_BFLD) - { - /* For these machines, a zero-length field does not - affect the alignment of the structure as a whole. - It does, however, affect the alignment of the next field - within the structure. */ - if (bfld_field_size) - layout->record_align = MAX (layout->record_align, desired_align); - else - desired_align = objc_alignof_type (bfld_type) * BITS_PER_UNIT; - - /* A named bit field of declared type `int' - forces the entire structure to have `int' alignment. - Q1: How is encoded this thing and how to check for it? - Q2: How to determine maximum_field_alignment at runtime? */ - -/* if (DECL_NAME (field) != 0) */ - { - int type_align = bfld_type_align; -#if 0 - if (maximum_field_alignment != 0) - type_align = MIN (type_align, maximum_field_alignment); - else if (DECL_PACKED (field)) - type_align = MIN (type_align, BITS_PER_UNIT); -#endif - - layout->record_align = MAX (layout->record_align, type_align); - } - } - else - layout->record_align = MAX (layout->record_align, desired_align); -#endif - - /* Does this field automatically have alignment it needs - by virtue of the fields that precede it and the record's - own alignment? */ - - if (*type == _C_BFLD) - layout->record_size = atoi (type + 1); - else if (layout->record_size % desired_align != 0) - { - /* No, we need to skip space before this field. - Bump the cumulative size to multiple of field alignment. */ - layout->record_size = ROUND (layout->record_size, desired_align); - } - - /* Jump to the next field in record. */ - - layout->prev_type = layout->type; - layout->type = objc_skip_typespec (layout->type); /* skip component */ - - return YES; -} - - -void objc_layout_finish_structure (struct objc_struct_layout *layout, - unsigned int *size, - unsigned int *align) -{ - if (layout->type && *layout->type == _C_STRUCT_E) - { - /* Work out the alignment of the record as one expression and store - in the record type. Round it up to a multiple of the record's - alignment. */ - -#ifdef ROUND_TYPE_ALIGN - layout->record_align = ROUND_TYPE_ALIGN (layout->original_type, - 1, - layout->record_align); -#else - layout->record_align = MAX (1, layout->record_align); -#endif - -#ifdef ROUND_TYPE_SIZE - layout->record_size = ROUND_TYPE_SIZE (layout->original_type, - layout->record_size, - layout->record_align); -#else - /* Round the size up to be a multiple of the required alignment */ - layout->record_size = ROUND (layout->record_size, layout->record_align); -#endif - - layout->type = NULL; - } - if (size) - *size = layout->record_size / BITS_PER_UNIT; - if (align) - *align = layout->record_align / BITS_PER_UNIT; -} - - -void objc_layout_structure_get_info (struct objc_struct_layout *layout, - unsigned int *offset, - unsigned int *align, - const char **type) -{ - if (offset) - *offset = layout->record_size / BITS_PER_UNIT; - if (align) - *align = layout->record_align / BITS_PER_UNIT; - if (type) - *type = layout->prev_type; -} diff --git a/contrib/libobjc/gc.c b/contrib/libobjc/gc.c deleted file mode 100644 index 8ca6de8e94..0000000000 --- a/contrib/libobjc/gc.c +++ /dev/null @@ -1,458 +0,0 @@ -/* Basic data types for Objective C. - Copyright (C) 1998 Free Software Foundation, Inc. - Contributed by Ovidiu Predescu. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC 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 "tconfig.h" -#include "objc.h" -#include "encoding.h" - -#include -#include - -#if OBJC_WITH_GC - -#include - -/* gc_typed.h uses the following but doesn't declare them */ -typedef GC_word word; -typedef GC_signed_word signed_word; - -#if BITS_PER_WORD == 32 -# define LOGWL 5 -# define modWORDSZ(n) ((n) & 0x1f) /* n mod size of word */ -#endif - -#if BITS_PER_WORD == 64 -# define LOGWL 6 -# define modWORDSZ(n) ((n) & 0x3f) /* n mod size of word */ -#endif - -#define divWORDSZ(n) ((n) >> LOGWL) /* divide n by size of word */ - -#include - -/* The following functions set up in `mask` the corresponding pointers. - The offset is incremented with the size of the type. */ - -#define ROUND(V, A) \ - ({ typeof(V) __v=(V); typeof(A) __a=(A); \ - __a*((__v+__a-1)/__a); }) - -#define SET_BIT_FOR_OFFSET(mask, offset) \ - GC_set_bit(mask, offset / sizeof (void*)) - -/* Some prototypes */ -static void -__objc_gc_setup_struct (GC_bitmap mask, const char *type, int offset); -static void -__objc_gc_setup_union (GC_bitmap mask, const char *type, int offset); - - -static void -__objc_gc_setup_array (GC_bitmap mask, const char *type, int offset) -{ - int i, len = atoi(type + 1); - - while (isdigit(*++type)) - /* do nothing */; /* skip the size of the array */ - - switch (*type) { - case _C_ARY_B: - for (i = 0; i < len; i++) - __objc_gc_setup_array (mask, type, offset); - break; - - case _C_STRUCT_B: - for (i = 0; i < len; i++) - __objc_gc_setup_struct (mask, type, offset); - break; - - case _C_UNION_B: - for (i = 0; i < len; i++) - __objc_gc_setup_union (mask, type, offset); - break; - - default: - break; - } -} - -static void -__objc_gc_setup_struct (GC_bitmap mask, const char *type, int offset) -{ - struct objc_struct_layout layout; - unsigned int position; - const char *mtype; - - objc_layout_structure (type, &layout); - - while (objc_layout_structure_next_member (&layout)) - { - BOOL gc_invisible = NO; - - objc_layout_structure_get_info (&layout, &position, NULL, &mtype); - - /* Skip the variable name */ - if (*mtype == '"') - { - for (mtype++; *mtype++ != '"';) - /* do nothing */; - } - - if (*mtype == _C_GCINVISIBLE) - { - gc_invisible = YES; - mtype++; - } - - /* Add to position the offset of this structure */ - position += offset; - - switch (*mtype) { - case _C_ID: - case _C_CLASS: - case _C_SEL: - case _C_PTR: - case _C_CHARPTR: - case _C_ATOM: - if (!gc_invisible) - SET_BIT_FOR_OFFSET(mask, position); - break; - - case _C_ARY_B: - __objc_gc_setup_array (mask, mtype, position); - break; - - case _C_STRUCT_B: - __objc_gc_setup_struct (mask, mtype, position); - break; - - case _C_UNION_B: - __objc_gc_setup_union (mask, mtype, position); - break; - - default: - break; - } - } -} - -static void -__objc_gc_setup_union (GC_bitmap mask, const char *type, int offset) -{ - /* Sub-optimal, quick implementation: assume the union is made of - pointers, set up the mask accordingly. */ - - int i, size, align; - - /* Skip the variable name */ - if (*type == '"') - { - for (type++; *type++ != '"';) - /* do nothing */; - } - - size = objc_sizeof_type (type); - align = objc_alignof_type (type); - - offset = ROUND(offset, align); - for (i = 0; i < size; i += sizeof (void*)) - { - SET_BIT_FOR_OFFSET(mask, offset); - offset += sizeof (void*); - } -} - - -/* Iterates over the types in the structure that represents the class - encoding and sets the bits in mask according to each ivar type. */ -static void -__objc_gc_type_description_from_type (GC_bitmap mask, const char *type) -{ - struct objc_struct_layout layout; - unsigned int offset, align; - const char *ivar_type; - - objc_layout_structure (type, &layout); - - while (objc_layout_structure_next_member (&layout)) - { - BOOL gc_invisible = NO; - - objc_layout_structure_get_info (&layout, &offset, &align, &ivar_type); - - /* Skip the variable name */ - if (*ivar_type == '"') - { - for (ivar_type++; *ivar_type++ != '"';) - /* do nothing */; - } - - if (*ivar_type == _C_GCINVISIBLE) - { - gc_invisible = YES; - ivar_type++; - } - - switch (*ivar_type) { - case _C_ID: - case _C_CLASS: - case _C_SEL: - case _C_PTR: - case _C_CHARPTR: - if (!gc_invisible) - SET_BIT_FOR_OFFSET(mask, offset); - break; - - case _C_ARY_B: - __objc_gc_setup_array (mask, ivar_type, offset); - break; - - case _C_STRUCT_B: - __objc_gc_setup_struct (mask, ivar_type, offset); - break; - - case _C_UNION_B: - __objc_gc_setup_union (mask, ivar_type, offset); - break; - - default: - break; - } - } -} - -/* Computes in *type the full type encoding of this class including - its super classes. '*size' gives the total number of bytes allocated - into *type, '*current' the number of bytes used so far by the - encoding. */ -static void -__objc_class_structure_encoding (Class class, char **type, int *size, - int *current) -{ - int i, ivar_count; - struct objc_ivar_list* ivars; - - if (!class) - { - strcat (*type, "{"); - *current++; - return; - } - - /* Add the type encodings of the super classes */ - __objc_class_structure_encoding (class->super_class, type, size, current); - - ivars = class->ivars; - if (!ivars) - return; - - ivar_count = ivars->ivar_count; - - for (i = 0; i < ivar_count; i++) - { - struct objc_ivar *ivar = &(ivars->ivar_list[i]); - const char *ivar_type = ivar->ivar_type; - int len = strlen (ivar_type); - - if (*current + len + 1 >= *size) - { - /* Increase the size of the encoding string so that it - contains this ivar's type. */ - *size = ROUND(*current + len + 1, 10); - *type = objc_realloc (*type, *size); - } - strcat (*type + *current, ivar_type); - *current += len; - } -} - - -/* Allocates the memory that will hold the type description for class - and calls the __objc_class_structure_encoding that generates this - value. */ -void -__objc_generate_gc_type_description (Class class) -{ - GC_bitmap mask; - int bits_no, size; - int type_size = 10, current; - char *class_structure_type; - - if (!CLS_ISCLASS(class)) - return; - - /* We have to create a mask in which each bit counts for a pointer member. - We take into consideration all the non-pointer instance variables and we - round them up to the alignment. */ - - /* The number of bits in the mask is the size of an instance in bytes divided - by the size of a pointer. */ - bits_no = (ROUND(class_get_instance_size (class), sizeof(void*)) - / sizeof (void*)); - size = ROUND(bits_no, BITS_PER_WORD) / BITS_PER_WORD; - mask = objc_atomic_malloc (size * sizeof (int)); - memset (mask, 0, size * sizeof (int)); - - class_structure_type = objc_atomic_malloc (type_size); - *class_structure_type = current = 0; - __objc_class_structure_encoding (class, &class_structure_type, - &type_size, ¤t); - if (current + 1 == type_size) - class_structure_type = objc_realloc (class_structure_type, ++type_size); - strcat (class_structure_type + current, "}"); -// printf ("type description for '%s' is %s\n", class->name, class_structure_type); - - __objc_gc_type_description_from_type (mask, class_structure_type); - objc_free (class_structure_type); - -#define DEBUG 1 -#ifdef DEBUG - printf (" mask for '%s', type '%s' (bits %d, mask size %d) is:", - class_structure_type, class->name, bits_no, size); - { - int i; - for (i = 0; i < size; i++) - printf (" %lx", mask[i]); - } - puts (""); -#endif - - class->gc_object_type = (void*)GC_make_descriptor (mask, bits_no); -} - - -/* Returns YES if type denotes a pointer type, NO otherwise */ -static inline BOOL -__objc_ivar_pointer (const char *type) -{ - type = objc_skip_type_qualifiers (type); - - return (*type == _C_ID - || *type == _C_CLASS - || *type == _C_SEL - || *type == _C_PTR - || *type == _C_CHARPTR - || *type == _C_ATOM); -} - - -/* Mark the instance variable whose name is given by ivarname as a - weak pointer (a pointer hidden to the garbage collector) if - gc_invisible is true. If gc_invisible is false it unmarks the - instance variable and makes it a normal pointer, visible to the - garbage collector. - - This operation only makes sense on instance variables that are - pointers. */ -void -class_ivar_set_gcinvisible (Class class, const char* ivarname, - BOOL gc_invisible) -{ - int i, ivar_count; - struct objc_ivar_list* ivars; - - if (!class || !ivarname) - return; - - ivars = class->ivars; - if (!ivars) - return; - - ivar_count = ivars->ivar_count; - - for (i = 0; i < ivar_count; i++) - { - struct objc_ivar *ivar = &(ivars->ivar_list[i]); - const char *type; - - if (!ivar->ivar_name || strcmp (ivar->ivar_name, ivarname)) - continue; - - assert (ivar->ivar_type); - type = ivar->ivar_type; - - /* Skip the variable name */ - if (*type == '"') - { - for (type++; *type++ != '"';) - /* do nothing */; - } - - if (*type == _C_GCINVISIBLE) - { - char *new_type; - - if (gc_invisible || !__objc_ivar_pointer (type)) - return; /* The type of the variable already matches the - requested gc_invisible type */ - - /* The variable is gc_invisible and we have to reverse it */ - new_type = objc_atomic_malloc (strlen (ivar->ivar_type)); - strncpy (new_type, ivar->ivar_type, - (size_t)(type - ivar->ivar_type)); - strcat (new_type, type + 1); - ivar->ivar_type = new_type; - } - else - { - char *new_type; - - if (!gc_invisible || !__objc_ivar_pointer (type)) - return; /* The type of the variable already matches the - requested gc_invisible type */ - - /* The variable is gc visible and we have to make it gc_invisible */ - new_type = objc_malloc (strlen (ivar->ivar_type) + 2); - strncpy (new_type, ivar->ivar_type, - (size_t)(type - ivar->ivar_type)); - strcat (new_type, "!"); - strcat (new_type, type); - ivar->ivar_type = new_type; - } - - __objc_generate_gc_type_description (class); - return; - } - - /* Search the instance variable in the superclasses */ - class_ivar_set_gcinvisible (class->super_class, ivarname, gc_invisible); -} - -#else /* !OBJC_WITH_GC */ - -void -__objc_generate_gc_type_description (Class class) -{ -} - -void class_ivar_set_gcinvisible (Class class, - const char* ivarname, - BOOL gc_invisible) -{ -} - -#endif /* OBJC_WITH_GC */ diff --git a/contrib/libobjc/hash.c b/contrib/libobjc/hash.c deleted file mode 100644 index 223991f97f..0000000000 --- a/contrib/libobjc/hash.c +++ /dev/null @@ -1,283 +0,0 @@ -/* Hash tables for Objective C internal structures - Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC to produce an executable, this does not cause - the resulting executable to be covered by the GNU General Public License. - This exception does not however invalidate any other reasons why - the executable file might be covered by the GNU General Public License. */ - -#include "assert.h" - -#include "hash.h" - -#include "runtime.h" /* for DEBUG_PRINTF */ - -/* These two macros determine when a hash table is full and - by how much it should be expanded respectively. - - These equations are percentages. */ -#define FULLNESS(cache) \ - ((((cache)->size * 75) / 100) <= (cache)->used) -#define EXPANSION(cache) \ - ((cache)->size * 2) - -cache_ptr -hash_new (unsigned int size, hash_func_type hash_func, - compare_func_type compare_func) -{ - cache_ptr cache; - - /* Pass me a value greater than 0 and a power of 2. */ - assert (size); - assert (!(size & (size - 1))); - - /* Allocate the cache structure. calloc insures - its initialization for default values. */ - cache = (cache_ptr) objc_calloc (1, sizeof (struct cache)); - assert (cache); - - /* Allocate the array of buckets for the cache. - calloc initializes all of the pointers to NULL. */ - cache->node_table - = (node_ptr *) objc_calloc (size, sizeof (node_ptr)); - assert (cache->node_table); - - cache->size = size; - - /* This should work for all processor architectures? */ - cache->mask = (size - 1); - - /* Store the hashing function so that codes can be computed. */ - cache->hash_func = hash_func; - - /* Store the function that compares hash keys to - determine if they are equal. */ - cache->compare_func = compare_func; - - return cache; -} - - -void -hash_delete (cache_ptr cache) -{ - node_ptr node; - node_ptr next_node; - unsigned int i; - - /* Purge all key/value pairs from the table. */ - /* Step through the nodes one by one and remove every node WITHOUT - using hash_next. this makes hash_delete much more efficient. */ - for (i = 0;i < cache->size;i++) { - if ((node = cache->node_table[i])) { - /* an entry in the hash table has been found, now step through the - nodes next in the list and free them. */ - while ((next_node = node->next)) { - hash_remove (cache,node->key); - node = next_node; - } - - hash_remove (cache,node->key); - } - } - - /* Release the array of nodes and the cache itself. */ - objc_free(cache->node_table); - objc_free(cache); -} - - -void -hash_add (cache_ptr *cachep, const void *key, void *value) -{ - size_t indx = (*(*cachep)->hash_func)(*cachep, key); - node_ptr node = (node_ptr) objc_calloc (1, sizeof (struct cache_node)); - - - assert (node); - - /* Initialize the new node. */ - node->key = key; - node->value = value; - node->next = (*cachep)->node_table[indx]; - - /* Debugging. - Check the list for another key. */ -#ifdef DEBUG - { node_ptr node1 = (*cachep)->node_table[indx]; - - while (node1) { - - assert (node1->key != key); - node1 = node1->next; - } - } -#endif - - /* Install the node as the first element on the list. */ - (*cachep)->node_table[indx] = node; - - /* Bump the number of entries in the cache. */ - ++(*cachep)->used; - - /* Check the hash table's fullness. We're going - to expand if it is above the fullness level. */ - if (FULLNESS (*cachep)) { - - /* The hash table has reached its fullness level. Time to - expand it. - - I'm using a slow method here but is built on other - primitive functions thereby increasing its - correctness. */ - node_ptr node1 = NULL; - cache_ptr new = hash_new (EXPANSION (*cachep), - (*cachep)->hash_func, - (*cachep)->compare_func); - - DEBUG_PRINTF ("Expanding cache %#x from %d to %d\n", - *cachep, (*cachep)->size, new->size); - - /* Copy the nodes from the first hash table to the new one. */ - while ((node1 = hash_next (*cachep, node1))) - hash_add (&new, node1->key, node1->value); - - /* Trash the old cache. */ - hash_delete (*cachep); - - /* Return a pointer to the new hash table. */ - *cachep = new; - } -} - - -void -hash_remove (cache_ptr cache, const void *key) -{ - size_t indx = (*cache->hash_func)(cache, key); - node_ptr node = cache->node_table[indx]; - - - /* We assume there is an entry in the table. Error if it is not. */ - assert (node); - - /* Special case. First element is the key/value pair to be removed. */ - if ((*cache->compare_func)(node->key, key)) { - cache->node_table[indx] = node->next; - objc_free(node); - } else { - - /* Otherwise, find the hash entry. */ - node_ptr prev = node; - BOOL removed = NO; - - do { - - if ((*cache->compare_func)(node->key, key)) { - prev->next = node->next, removed = YES; - objc_free(node); - } else - prev = node, node = node->next; - } while (!removed && node); - assert (removed); - } - - /* Decrement the number of entries in the hash table. */ - --cache->used; -} - - -node_ptr -hash_next (cache_ptr cache, node_ptr node) -{ - /* If the scan is being started then reset the last node - visitied pointer and bucket index. */ - if (!node) - cache->last_bucket = 0; - - /* If there is a node visited last then check for another - entry in the same bucket; Otherwise step to the next bucket. */ - if (node) { - if (node->next) - /* There is a node which follows the last node - returned. Step to that node and retun it. */ - return node->next; - else - ++cache->last_bucket; - } - - /* If the list isn't exhausted then search the buckets for - other nodes. */ - if (cache->last_bucket < cache->size) { - /* Scan the remainder of the buckets looking for an entry - at the head of the list. Return the first item found. */ - while (cache->last_bucket < cache->size) - if (cache->node_table[cache->last_bucket]) - return cache->node_table[cache->last_bucket]; - else - ++cache->last_bucket; - - /* No further nodes were found in the hash table. */ - return NULL; - } else - return NULL; -} - - -/* Given KEY, return corresponding value for it in CACHE. - Return NULL if the KEY is not recorded. */ - -void * -hash_value_for_key (cache_ptr cache, const void *key) -{ - node_ptr node = cache->node_table[(*cache->hash_func)(cache, key)]; - void *retval = NULL; - - if (node) - do { - if ((*cache->compare_func)(node->key, key)) { - retval = node->value; - break; - } else - node = node->next; - } while (!retval && node); - - return retval; -} - -/* Given KEY, return YES if it exists in the CACHE. - Return NO if it does not */ - -BOOL -hash_is_key_in_hash (cache_ptr cache, const void *key) -{ - node_ptr node = cache->node_table[(*cache->hash_func)(cache, key)]; - - if (node) - do { - if ((*cache->compare_func)(node->key, key)) - return YES; - else - node = node->next; - } while (node); - - return NO; -} diff --git a/contrib/libobjc/init.c b/contrib/libobjc/init.c deleted file mode 100644 index 954fc9240a..0000000000 --- a/contrib/libobjc/init.c +++ /dev/null @@ -1,834 +0,0 @@ -/* GNU Objective C Runtime initialization - Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup - +load support contributed by Ovidiu Predescu - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 "runtime.h" - -/* The version number of this runtime. This must match the number - defined in gcc (objc-act.c) */ -#define OBJC_VERSION 8 -#define PROTOCOL_VERSION 2 - -/* This list contains all modules currently loaded into the runtime */ -static struct objc_list* __objc_module_list = 0; /* !T:MUTEX */ - -/* This list contains all proto_list's not yet assigned class links */ -static struct objc_list* unclaimed_proto_list = 0; /* !T:MUTEX */ - -/* List of unresolved static instances. */ -static struct objc_list *uninitialized_statics = 0; /* !T:MUTEX */ - -/* Global runtime "write" mutex. */ -objc_mutex_t __objc_runtime_mutex = 0; - -/* Number of threads that are alive. */ -int __objc_runtime_threads_alive = 1; /* !T:MUTEX */ - -/* Check compiler vs runtime version */ -static void init_check_module_version (Module_t); - -/* Assign isa links to protos */ -static void __objc_init_protocols (struct objc_protocol_list* protos); - -/* Add protocol to class */ -static void __objc_class_add_protocols (Class, struct objc_protocol_list*); - -/* This is a hook which is called by __objc_exec_class every time a class - or a category is loaded into the runtime. This may e.g. help a - dynamic loader determine the classes that have been loaded when - an object file is dynamically linked in */ -void (*_objc_load_callback)(Class class, Category* category); /* !T:SAFE */ - -/* Is all categories/classes resolved? */ -BOOL __objc_dangling_categories = NO; /* !T:UNUSED */ - -extern SEL -__sel_register_typed_name (const char *name, const char *types, - struct objc_selector *orig, BOOL is_const); - -/* Sends +load to all classes and categories in certain situations. */ -static void objc_send_load (void); - -/* Inserts all the classes defined in module in a tree of classes that - resembles the class hierarchy. This tree is traversed in preorder and the - classes in its nodes receive the +load message if these methods were not - executed before. The algorithm ensures that when the +load method of a class - is executed all the superclasses have been already received the +load - message. */ -static void __objc_create_classes_tree (Module_t module); - -static void __objc_call_callback (Module_t module); - -/* A special version that works only before the classes are completely - installed in the runtime. */ -static BOOL class_is_subclass_of_class (Class class, Class superclass); - -typedef struct objc_class_tree { - Class class; - struct objc_list *subclasses; /* `head' is pointer to an objc_class_tree */ -} objc_class_tree; - -/* This is a linked list of objc_class_tree trees. The head of these trees - are root classes (their super class is Nil). These different trees - represent different class hierarchies. */ -static struct objc_list *__objc_class_tree_list = NULL; - -/* Keeps the +load methods who have been already executed. This hash should - not be destroyed during the execution of the program. */ -static cache_ptr __objc_load_methods = NULL; - -/* Creates a tree of classes whose topmost class is directly inherited from - `upper' and the bottom class in this tree is `bottom_class'. The classes - in this tree are super classes of `bottom_class'. `subclasses' member - of each tree node point to the next subclass tree node. */ -static objc_class_tree * -create_tree_of_subclasses_inherited_from (Class bottom_class, Class upper) -{ - Class superclass = bottom_class->super_class ? - objc_lookup_class ((char*)bottom_class->super_class) - : Nil; - - objc_class_tree *tree, *prev; - - DEBUG_PRINTF ("create_tree_of_subclasses_inherited_from:"); - DEBUG_PRINTF ("bottom_class = %s, upper = %s\n", - (bottom_class ? bottom_class->name : NULL), - (upper ? upper->name : NULL)); - - tree = prev = objc_calloc (1, sizeof (objc_class_tree)); - prev->class = bottom_class; - - while (superclass != upper) - { - tree = objc_calloc (1, sizeof (objc_class_tree)); - tree->class = superclass; - tree->subclasses = list_cons (prev, tree->subclasses); - superclass = (superclass->super_class ? - objc_lookup_class ((char*)superclass->super_class) - : Nil); - prev = tree; - } - - return tree; -} - -/* Insert the `class' into the proper place in the `tree' class hierarchy. This - function returns a new tree if the class has been successfully inserted into - the tree or NULL if the class is not part of the classes hierarchy described - by `tree'. This function is private to objc_tree_insert_class(), you should - not call it directly. */ -static objc_class_tree * -__objc_tree_insert_class (objc_class_tree *tree, Class class) -{ - DEBUG_PRINTF ("__objc_tree_insert_class: tree = %x, class = %s\n", - tree, class->name); - - if (tree == NULL) - return create_tree_of_subclasses_inherited_from (class, NULL); - else if (class == tree->class) - { - /* `class' has been already inserted */ - DEBUG_PRINTF ("1. class %s was previously inserted\n", class->name); - return tree; - } - else if ((class->super_class ? - objc_lookup_class ((char*)class->super_class) - : Nil) - == tree->class) - { - /* If class is a direct subclass of tree->class then add class to the - list of subclasses. First check to see if it wasn't already - inserted. */ - struct objc_list *list = tree->subclasses; - objc_class_tree *node; - - while (list) - { - /* Class has been already inserted; do nothing just return - the tree. */ - if (((objc_class_tree*)list->head)->class == class) - { - DEBUG_PRINTF ("2. class %s was previously inserted\n", - class->name); - return tree; - } - list = list->tail; - } - - /* Create a new node class and insert it into the list of subclasses */ - node = objc_calloc (1, sizeof (objc_class_tree)); - node->class = class; - tree->subclasses = list_cons (node, tree->subclasses); - DEBUG_PRINTF ("3. class %s inserted\n", class->name); - return tree; - } - else - { - /* The class is not a direct subclass of tree->class. Search for class's - superclasses in the list of subclasses. */ - struct objc_list *subclasses = tree->subclasses; - - /* Precondition: the class must be a subclass of tree->class; otherwise - return NULL to indicate our caller that it must take the next tree. */ - if (!class_is_subclass_of_class (class, tree->class)) - return NULL; - - for (; subclasses != NULL; subclasses = subclasses->tail) - { - Class aClass = ((objc_class_tree*)(subclasses->head))->class; - - if (class_is_subclass_of_class (class, aClass)) - { - /* If we found one of class's superclasses we insert the class - into its subtree and return the original tree since nothing - has been changed. */ - subclasses->head - = __objc_tree_insert_class (subclasses->head, class); - DEBUG_PRINTF ("4. class %s inserted\n", class->name); - return tree; - } - } - - /* We haven't found a subclass of `class' in the `subclasses' list. - Create a new tree of classes whose topmost class is a direct subclass - of tree->class. */ - { - objc_class_tree *new_tree - = create_tree_of_subclasses_inherited_from (class, tree->class); - tree->subclasses = list_cons (new_tree, tree->subclasses); - DEBUG_PRINTF ("5. class %s inserted\n", class->name); - return tree; - } - } -} - -/* This function inserts `class' in the right tree hierarchy classes. */ -static void -objc_tree_insert_class (Class class) -{ - struct objc_list *list_node; - objc_class_tree *tree; - - list_node = __objc_class_tree_list; - while (list_node) - { - tree = __objc_tree_insert_class (list_node->head, class); - if (tree) - { - list_node->head = tree; - break; - } - else - list_node = list_node->tail; - } - - /* If the list was finished but the class hasn't been inserted, insert it - here. */ - if (!list_node) - { - __objc_class_tree_list = list_cons (NULL, __objc_class_tree_list); - __objc_class_tree_list->head = __objc_tree_insert_class (NULL, class); - } -} - -/* Traverse tree in preorder. Used to send +load. */ -static void -objc_preorder_traverse (objc_class_tree *tree, - int level, - void (*function)(objc_class_tree*, int)) -{ - struct objc_list *node; - - (*function) (tree, level); - for (node = tree->subclasses; node; node = node->tail) - objc_preorder_traverse (node->head, level + 1, function); -} - -/* Traverse tree in postorder. Used to destroy a tree. */ -static void -objc_postorder_traverse (objc_class_tree *tree, - int level, - void (*function)(objc_class_tree*, int)) -{ - struct objc_list *node; - - for (node = tree->subclasses; node; node = node->tail) - objc_postorder_traverse (node->head, level + 1, function); - (*function) (tree, level); -} - -/* Used to print a tree class hierarchy. */ -#ifdef DEBUG -static void -__objc_tree_print (objc_class_tree *tree, int level) -{ - int i; - - for (i = 0; i < level; i++) - printf (" "); - printf ("%s\n", tree->class->name); -} -#endif - -/* Walks on a linked list of methods in the reverse order and executes all - the methods corresponding to `op' selector. Walking in the reverse order - assures the +load of class is executed first and then +load of categories - because of the way in which categories are added to the class methods. */ -static void -__objc_send_message_in_list (MethodList_t method_list, Class class, SEL op) -{ - int i; - - if (!method_list) - return; - - /* First execute the `op' message in the following method lists */ - __objc_send_message_in_list (method_list->method_next, class, op); - - /* Search the method list. */ - for (i = 0; i < method_list->method_count; i++) - { - Method_t mth = &method_list->method_list[i]; - - if (mth->method_name && sel_eq (mth->method_name, op) - && !hash_is_key_in_hash (__objc_load_methods, mth->method_name)) - { - /* The method was found and wasn't previously executed. */ - (*mth->method_imp) ((id)class, mth->method_name); - - /* Add this method into the +load hash table */ - hash_add (&__objc_load_methods, mth->method_imp, mth->method_imp); - - DEBUG_PRINTF ("sending +load in class: %s\n", class->name); - - break; - } - } -} - -static void -__objc_send_load (objc_class_tree *tree, int level) -{ - static SEL load_sel = 0; - Class class = tree->class; - MethodList_t method_list = class->class_pointer->methods; - - if (!load_sel) - load_sel = sel_register_name ("load"); - - __objc_send_message_in_list (method_list, class, load_sel); -} - -static void -__objc_destroy_class_tree_node (objc_class_tree *tree, int level) -{ - objc_free (tree); -} - -/* This is used to check if the relationship between two classes before the - runtime completely installs the classes. */ -static BOOL -class_is_subclass_of_class (Class class, Class superclass) -{ - for (; class != Nil;) - { - if (class == superclass) - return YES; - class = (class->super_class ? - objc_lookup_class ((char*)class->super_class) - : Nil); - } - - return NO; -} - -/* This list contains all the classes in the runtime system for whom their - superclasses are not yet know to the runtime. */ -static struct objc_list* unresolved_classes = 0; - -/* Extern function used to reference the Object and NXConstantString classes. - */ - -extern void __objc_force_linking (void); - -void -__objc_force_linking (void) -{ - extern void __objc_linking (void); - __objc_linking (); -} - -/* Run through the statics list, removing modules as soon as all its statics - have been initialized. */ -static void -objc_init_statics (void) -{ - struct objc_list **cell = &uninitialized_statics; - struct objc_static_instances **statics_in_module; - - objc_mutex_lock(__objc_runtime_mutex); - - while (*cell) - { - int module_initialized = 1; - - for (statics_in_module = (*cell)->head; - *statics_in_module; statics_in_module++) - { - struct objc_static_instances *statics = *statics_in_module; - Class class = objc_lookup_class (statics->class_name); - - if (!class) - module_initialized = 0; - /* Actually, the static's class_pointer will be NULL when we - haven't been here before. However, the comparison is to be - reminded of taking into account class posing and to think about - possible semantics... */ - else if (class != statics->instances[0]->class_pointer) - { - id *inst; - - for (inst = &statics->instances[0]; *inst; inst++) - { - (*inst)->class_pointer = class; - - /* ??? Make sure the object will not be freed. With - refcounting, invoke `-retain'. Without refcounting, do - nothing and hope that `-free' will never be invoked. */ - - /* ??? Send the object an `-initStatic' or something to - that effect now or later on? What are the semantics of - statically allocated instances, besides the trivial - NXConstantString, anyway? */ - } - } - } - if (module_initialized) - { - /* Remove this module from the uninitialized list. */ - struct objc_list *this = *cell; - *cell = this->tail; - objc_free(this); - } - else - cell = &(*cell)->tail; - } - - objc_mutex_unlock(__objc_runtime_mutex); -} /* objc_init_statics */ - -/* This function is called by constructor functions generated for each - module compiled. (_GLOBAL_$I$...) The purpose of this function is to - gather the module pointers so that they may be processed by the - initialization routines as soon as possible */ - -void -__objc_exec_class (Module_t module) -{ - /* Have we processed any constructors previously? This flag is used to - indicate that some global data structures need to be built. */ - static BOOL previous_constructors = 0; - - static struct objc_list* unclaimed_categories = 0; - - /* The symbol table (defined in objc-api.h) generated by gcc */ - Symtab_t symtab = module->symtab; - - /* The statics in this module */ - struct objc_static_instances **statics - = symtab->defs[symtab->cls_def_cnt + symtab->cat_def_cnt]; - - /* Entry used to traverse hash lists */ - struct objc_list** cell; - - /* The table of selector references for this module */ - SEL selectors = symtab->refs; - - /* dummy counter */ - int i; - - DEBUG_PRINTF ("received module: %s\n", module->name); - - /* check gcc version */ - init_check_module_version(module); - - /* On the first call of this routine, initialize some data structures. */ - if (!previous_constructors) - { - /* Initialize thread-safe system */ - __objc_init_thread_system(); - __objc_runtime_threads_alive = 1; - __objc_runtime_mutex = objc_mutex_allocate(); - - __objc_init_selector_tables(); - __objc_init_class_tables(); - __objc_init_dispatch_tables(); - __objc_class_tree_list = list_cons (NULL, __objc_class_tree_list); - __objc_load_methods - = hash_new (128, (hash_func_type)hash_ptr, compare_ptrs); - previous_constructors = 1; - } - - /* Save the module pointer for later processing. (not currently used) */ - objc_mutex_lock(__objc_runtime_mutex); - __objc_module_list = list_cons(module, __objc_module_list); - - /* Replace referenced selectors from names to SEL's. */ - if (selectors) - { - for (i = 0; selectors[i].sel_id; ++i) - { - const char *name, *type; - name = (char*)selectors[i].sel_id; - type = (char*)selectors[i].sel_types; - /* Constructors are constant static data so we can safely store - pointers to them in the runtime structures. is_const == YES */ - __sel_register_typed_name (name, type, - (struct objc_selector*)&(selectors[i]), - YES); - } - } - - /* Parse the classes in the load module and gather selector information. */ - DEBUG_PRINTF ("gathering selectors from module: %s\n", module->name); - for (i = 0; i < symtab->cls_def_cnt; ++i) - { - Class class = (Class) symtab->defs[i]; - const char* superclass = (char*)class->super_class; - - /* Make sure we have what we think. */ - assert (CLS_ISCLASS(class)); - assert (CLS_ISMETA(class->class_pointer)); - DEBUG_PRINTF ("phase 1, processing class: %s\n", class->name); - - /* Initialize the subclass list to be NULL. - In some cases it isn't and this crashes the program. */ - class->subclass_list = NULL; - - /* Store the class in the class table and assign class numbers. */ - __objc_add_class_to_hash (class); - - /* Register all of the selectors in the class and meta class. */ - __objc_register_selectors_from_class (class); - __objc_register_selectors_from_class ((Class) class->class_pointer); - - /* Install the fake dispatch tables */ - __objc_install_premature_dtable(class); - __objc_install_premature_dtable(class->class_pointer); - - /* Register the instance methods as class methods, this is - only done for root classes. */ - __objc_register_instance_methods_to_class(class); - - if (class->protocols) - __objc_init_protocols (class->protocols); - - /* Check to see if the superclass is known in this point. If it's not - add the class to the unresolved_classes list. */ - if (superclass && !objc_lookup_class (superclass)) - unresolved_classes = list_cons (class, unresolved_classes); - } - - /* Process category information from the module. */ - for (i = 0; i < symtab->cat_def_cnt; ++i) - { - Category_t category = symtab->defs[i + symtab->cls_def_cnt]; - Class class = objc_lookup_class (category->class_name); - - /* If the class for the category exists then append its methods. */ - if (class) - { - - DEBUG_PRINTF ("processing categories from (module,object): %s, %s\n", - module->name, - class->name); - - /* Do instance methods. */ - if (category->instance_methods) - class_add_method_list (class, category->instance_methods); - - /* Do class methods. */ - if (category->class_methods) - class_add_method_list ((Class) class->class_pointer, - category->class_methods); - - if (category->protocols) - { - __objc_init_protocols (category->protocols); - __objc_class_add_protocols (class, category->protocols); - } - - /* Register the instance methods as class methods, this is - only done for root classes. */ - __objc_register_instance_methods_to_class(class); - } - else - { - /* The object to which the category methods belong can't be found. - Save the information. */ - unclaimed_categories = list_cons(category, unclaimed_categories); - } - } - - if (statics) - uninitialized_statics = list_cons (statics, uninitialized_statics); - if (uninitialized_statics) - objc_init_statics (); - - /* Scan the unclaimed category hash. Attempt to attach any unclaimed - categories to objects. */ - for (cell = &unclaimed_categories; - *cell; - ({ if (*cell) cell = &(*cell)->tail; })) - { - Category_t category = (*cell)->head; - Class class = objc_lookup_class (category->class_name); - - if (class) - { - DEBUG_PRINTF ("attaching stored categories to object: %s\n", - class->name); - - list_remove_head (cell); - - if (category->instance_methods) - class_add_method_list (class, category->instance_methods); - - if (category->class_methods) - class_add_method_list ((Class) class->class_pointer, - category->class_methods); - - if (category->protocols) - { - __objc_init_protocols (category->protocols); - __objc_class_add_protocols (class, category->protocols); - } - - /* Register the instance methods as class methods, this is - only done for root classes. */ - __objc_register_instance_methods_to_class(class); - } - } - - if (unclaimed_proto_list && objc_lookup_class ("Protocol")) - { - list_mapcar (unclaimed_proto_list,(void(*)(void*))__objc_init_protocols); - list_free (unclaimed_proto_list); - unclaimed_proto_list = 0; - } - - objc_send_load (); - - objc_mutex_unlock(__objc_runtime_mutex); -} - -static void objc_send_load (void) -{ - if (!__objc_module_list) - return; - - /* Try to find out if all the classes loaded so far also have their - superclasses known to the runtime. We suppose that the objects that are - allocated in the +load method are in general of a class declared in the - same module. */ - if (unresolved_classes) - { - Class class = unresolved_classes->head; - - while (objc_lookup_class ((char*)class->super_class)) - { - list_remove_head (&unresolved_classes); - if (unresolved_classes) - class = unresolved_classes->head; - else - break; - } - - /* - * If we still have classes for whom we don't have yet their super - * classes known to the runtime we don't send the +load messages. - */ - if (unresolved_classes) - return; - } - - /* Special check to allow creating and sending messages to constant strings - in +load methods. If these classes are not yet known, even if all the - other classes are known, delay sending of +load. */ - if (!objc_lookup_class ("NXConstantString") || - !objc_lookup_class ("Object")) - return; - - /* Iterate over all modules in the __objc_module_list and call on them the - __objc_create_classes_tree function. This function creates a tree of - classes that resembles the class hierarchy. */ - list_mapcar (__objc_module_list, (void(*)(void*))__objc_create_classes_tree); - - while (__objc_class_tree_list) - { -#ifdef DEBUG - objc_preorder_traverse (__objc_class_tree_list->head, - 0, __objc_tree_print); -#endif - objc_preorder_traverse (__objc_class_tree_list->head, - 0, __objc_send_load); - objc_postorder_traverse (__objc_class_tree_list->head, - 0, __objc_destroy_class_tree_node); - list_remove_head (&__objc_class_tree_list); - } - - list_mapcar (__objc_module_list, (void(*)(void*))__objc_call_callback); - list_free (__objc_module_list); - __objc_module_list = NULL; -} - -static void -__objc_create_classes_tree (Module_t module) -{ - /* The runtime mutex is locked in this point */ - - Symtab_t symtab = module->symtab; - int i; - - /* Iterate thru classes defined in this module and insert them in the classes - tree hierarchy. */ - for (i = 0; i < symtab->cls_def_cnt; i++) - { - Class class = (Class) symtab->defs[i]; - - objc_tree_insert_class (class); - } -} - -static void -__objc_call_callback (Module_t module) -{ - /* The runtime mutex is locked in this point */ - - Symtab_t symtab = module->symtab; - int i; - - /* Iterate thru classes defined in this module and call the callback for - each one. */ - for (i = 0; i < symtab->cls_def_cnt; i++) - { - Class class = (Class) symtab->defs[i]; - - /* Call the _objc_load_callback for this class. */ - if (_objc_load_callback) - _objc_load_callback(class, 0); - } - - /* Call the _objc_load_callback for categories. Don't register the instance - methods as class methods for categories to root classes since they were - already added in the class. */ - for (i = 0; i < symtab->cat_def_cnt; i++) - { - Category_t category = symtab->defs[i + symtab->cls_def_cnt]; - Class class = objc_lookup_class (category->class_name); - - if (_objc_load_callback) - _objc_load_callback(class, category); - } -} - -/* Sanity check the version of gcc used to compile `module'*/ -static void init_check_module_version(Module_t module) -{ - if ((module->version != OBJC_VERSION) || (module->size != sizeof (Module))) - { - int code; - - if(module->version > OBJC_VERSION) - code = OBJC_ERR_OBJC_VERSION; - else if (module->version < OBJC_VERSION) - code = OBJC_ERR_GCC_VERSION; - else - code = OBJC_ERR_MODULE_SIZE; - - objc_error(nil, code, "Module %s version %d doesn't match runtime %d\n", - module->name, (int)module->version, OBJC_VERSION); - } -} - -static void -__objc_init_protocols (struct objc_protocol_list* protos) -{ - int i; - static Class proto_class = 0; - - if (! protos) - return; - - objc_mutex_lock(__objc_runtime_mutex); - - if (!proto_class) - proto_class = objc_lookup_class("Protocol"); - - if (!proto_class) - { - unclaimed_proto_list = list_cons (protos, unclaimed_proto_list); - objc_mutex_unlock(__objc_runtime_mutex); - return; - } - -#if 0 - assert (protos->next == 0); /* only single ones allowed */ -#endif - - for(i = 0; i < protos->count; i++) - { - struct objc_protocol* aProto = protos->list[i]; - if (((size_t)aProto->class_pointer) == PROTOCOL_VERSION) - { - /* assign class pointer */ - aProto->class_pointer = proto_class; - - /* init super protocols */ - __objc_init_protocols (aProto->protocol_list); - } - else if (protos->list[i]->class_pointer != proto_class) - { - objc_error(nil, OBJC_ERR_PROTOCOL_VERSION, - "Version %d doesn't match runtime protocol version %d\n", - (int)((char*)protos->list[i]->class_pointer-(char*)0), - PROTOCOL_VERSION); - } - } - - objc_mutex_unlock(__objc_runtime_mutex); -} - -static void __objc_class_add_protocols (Class class, - struct objc_protocol_list* protos) -{ - /* Well... */ - if (! protos) - return; - - /* Add it... */ - protos->next = class->protocols; - class->protocols = protos; -} diff --git a/contrib/libobjc/libobjc.def b/contrib/libobjc/libobjc.def deleted file mode 100644 index a4a6049e81..0000000000 --- a/contrib/libobjc/libobjc.def +++ /dev/null @@ -1,161 +0,0 @@ -; GNU Objective C Runtime DLL Export Definitions -; Copyright (C) 1997 Free Software Foundation, Inc. -; Contributed by Scott Christley -; -; This file is part of GNU CC. -; -; GNU CC is free software; you can redistribute it and/or modify it under the -; terms of the GNU General Public License as published by the Free Software -; Foundation; either version 2, or (at your option) any later version. -; -; GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -; details. -; -; You should have received a copy of the GNU General Public License along with -; GNU CC; see the file COPYING. If not, write to the Free Software -; Foundation, 59 Temple Place - Suite 330, -; Boston, MA 02111-1307, USA. - -LIBRARY libobjc -EXPORTS -search_for_method_in_list -objc_get_uninstalled_dtable -hash_is_key_in_hash -objc_verror -_objc_load_callback -objc_malloc -objc_atomic_malloc -objc_valloc -objc_realloc -objc_calloc -objc_free -__objc_init_thread_system -objc_mutex_allocate -objc_mutex_deallocate -objc_mutex_lock -objc_mutex_trylock -objc_mutex_unlock -objc_thread_detach -objc_thread_exit -objc_thread_get_data -objc_thread_get_priority -objc_thread_id -objc_thread_set_data -objc_thread_set_priority -objc_thread_yield -__objc_class_name_Object -__objc_class_name_Protocol -__objc_class_name_NXConstantString -objc_error -__objc_object_alloc -__objc_object_copy -__objc_object_dispose -class_create_instance -object_copy -object_dispose -__objc_init_selector_tables -__objc_register_selectors_from_class -__sel_register_typed_name -sel_get_any_typed_uid -sel_get_any_uid -sel_get_name -sel_get_type -sel_get_typed_uid -sel_get_uid -sel_is_mapped -sel_register_name -sel_register_typed_name -sel_types_match -method_get_first_argument -method_get_next_argument -method_get_nth_argument -method_get_number_of_arguments -method_get_sizeof_arguments -objc_aligned_size -objc_alignof_type -objc_get_type_qualifiers -objc_promoted_size -objc_sizeof_type -objc_skip_argspec -objc_skip_offset -objc_skip_type_qualifiers -objc_skip_typespec -__objc_read_nbyte_uint -__objc_read_nbyte_ulong -__objc_write_class -__objc_write_object -__objc_write_selector -objc_close_typed_stream -objc_end_of_typed_stream -objc_flush_typed_stream -objc_get_stream_class_version -objc_open_typed_stream -objc_open_typed_stream_for_file -objc_read_array -objc_read_char -objc_read_int -objc_read_long -objc_read_object -objc_read_selector -objc_read_short -objc_read_string -objc_read_type -objc_read_types -objc_read_unsigned_char -objc_read_unsigned_int -objc_read_unsigned_long -objc_read_unsigned_short -objc_write_array -objc_write_char -objc_write_int -objc_write_long -objc_write_object -objc_write_object_reference -objc_write_root_object -objc_write_selector -objc_write_short -objc_write_string -objc_write_string_atomic -objc_write_type -objc_write_types -objc_write_unsigned_char -objc_write_unsigned_int -objc_write_unsigned_long -objc_write_unsigned_short -__objc_exec_class -__objc_init_dispatch_tables -__objc_install_premature_dtable -__objc_print_dtable_stats -__objc_responds_to -__objc_update_dispatch_table_for_class -class_add_method_list -class_get_class_method -class_get_instance_method -get_imp -nil_method -objc_msg_lookup -objc_msg_lookup_super -objc_msg_sendv -__objc_add_class_to_hash -__objc_init_class_tables -__objc_resolve_class_links -class_pose_as -objc_get_class -objc_get_meta_class -objc_lookup_class -objc_next_class -sarray_at_put -sarray_at_put_safe -sarray_free -sarray_lazy_copy -sarray_new -sarray_realloc -sarray_remove_garbage -hash_add -hash_delete -hash_new -hash_next -hash_remove -hash_value_for_key diff --git a/contrib/libobjc/libobjc_entry.c b/contrib/libobjc/libobjc_entry.c deleted file mode 100644 index 2d584ab3c1..0000000000 --- a/contrib/libobjc/libobjc_entry.c +++ /dev/null @@ -1,55 +0,0 @@ -/* GNU Objective C Runtime DLL Entry - Copyright (C) 1997 Free Software Foundation, Inc. - Contributed by Scott Christley - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 - -/* - DLL entry function for Objective-C Runtime library - This function gets called everytime a process/thread attaches to DLL - */ -WINBOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, - LPVOID lpReserved) -{ - switch(ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - break; - case DLL_PROCESS_DETACH: - break; - case DLL_THREAD_ATTACH: - break; - case DLL_THREAD_DETACH: - break; - } - return TRUE; -} - -/* - This section terminates the list of imports under GCC. If you do not - include this then you will have problems when linking with DLLs. - */ -asm (".section .idata$3\n" ".long 0,0,0,0,0,0,0,0"); diff --git a/contrib/libobjc/linking.m b/contrib/libobjc/linking.m deleted file mode 100644 index 8ecca02811..0000000000 --- a/contrib/libobjc/linking.m +++ /dev/null @@ -1,40 +0,0 @@ -/* Force linking of classes required by Objective C runtime. - Copyright (C) 1997 Free Software Foundation, Inc. - Contributed by Ovidiu Predescu (ovidiu@net-community.com). - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 -#include - -/* Generate references to Object and NXConstanstString classes since they are - needed by the runtime system to run correctly. */ - - -void __objc_linking (void) -{ - [Object name]; - [NXConstantString name]; -} - diff --git a/contrib/libobjc/makefile.dos b/contrib/libobjc/makefile.dos deleted file mode 100644 index 3e1b1871e4..0000000000 --- a/contrib/libobjc/makefile.dos +++ /dev/null @@ -1,56 +0,0 @@ -# GNU Objective C Runtime Makefile for compiling with djgpp -# Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc. -# -# This file is part of GNU CC. -# -# GNU CC is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2, or (at your option) any later version. -# -# GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# GNU CC; see the file COPYING. If not, write to the Free Software -# Foundation, 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -# This Makefile is configured for GnuMAKE - -GCC_FOR_TARGET=gcc - -.SUFFIXES: .o .m - -OPTIMIZE = -O2 - -# Always search these dirs when compiling. -SUBDIR_INCLUDES = -I. -I.. -I../config - -.c.o: - $(GCC_FOR_TARGET) $(OPTIMIZE) \ - -c $(GCC_CFLAGS) $(SUBDIR_INCLUDES) $< - -.m.o: - $(GCC_FOR_TARGET) $(OPTIMIZE) -fgnu-runtime \ - -c $(GCC_CFLAGS) $(SUBDIR_INCLUDES) $< - -OBJC_O = hash.o sarray.o class.o sendmsg.o init.o archive.o \ - selector.o objects.o misc.o object.o protocol.o encoding.o thread.o - -libobjc.a: $(OBJC_O) - -rm -f libobjc.a - ar rc libobjc.a $(OBJC_O) - ranlib libobjc.a - -OBJC_H = hash.h objc-list.h sarray.h objc.h \ - objc-api.h \ - object.h protocol.h mutex.h \ - typedstream.h thread.h - -mostlyclean: - -rm -f *.o libobjc.a xforward fflags -clean: mostlyclean -distclean: mostlyclean -extraclean: mostlyclean diff --git a/contrib/libobjc/misc.c b/contrib/libobjc/misc.c deleted file mode 100644 index 7339888dc2..0000000000 --- a/contrib/libobjc/misc.c +++ /dev/null @@ -1,180 +0,0 @@ -/* GNU Objective C Runtime Miscellaneous - Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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. */ - -#define __USE_FIXED_PROTOTYPES__ -#include -#include "runtime.h" - -/* -** Error handler function -** NULL so that default is to just print to stderr -*/ -static objc_error_handler _objc_error_handler = NULL; - -/* Trigger an objc error */ -void -objc_error(id object, int code, const char* fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - objc_verror(object, code, fmt, ap); - va_end(ap); -} - -/* Trigger an objc error */ -void -objc_verror(id object, int code, const char* fmt, va_list ap) -{ - BOOL result = NO; - - /* Call the error handler if its there - Otherwise print to stderr */ - if (_objc_error_handler) - result = (*_objc_error_handler)(object, code, fmt, ap); - else - vfprintf (stderr, fmt, ap); - - /* Continue if the error handler says its ok - Otherwise abort the program */ - if (result) - return; - else - abort(); -} - -/* Set the error handler */ -objc_error_handler -objc_set_error_handler(objc_error_handler func) -{ - objc_error_handler temp = _objc_error_handler; - _objc_error_handler = func; - return temp; -} - -/* -** Standard functions for memory allocation and disposal. -** Users should use these functions in their ObjC programs so -** that they work properly with garbage collectors as well as -** can take advantage of the exception/error handling available. -*/ - -void * -objc_malloc(size_t size) -{ - void* res = (void*) (*_objc_malloc)(size); - if(!res) - objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n"); - return res; -} - -void * -objc_atomic_malloc(size_t size) -{ - void* res = (void*) (*_objc_atomic_malloc)(size); - if(!res) - objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n"); - return res; -} - -void * -objc_valloc(size_t size) -{ - void* res = (void*) (*_objc_valloc)(size); - if(!res) - objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n"); - return res; -} - -void * -objc_realloc(void *mem, size_t size) -{ - void* res = (void*) (*_objc_realloc)(mem, size); - if(!res) - objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n"); - return res; -} - -void * -objc_calloc(size_t nelem, size_t size) -{ - void* res = (void*) (*_objc_calloc)(nelem, size); - if(!res) - objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n"); - return res; -} - -void -objc_free(void *mem) -{ - (*_objc_free)(mem); -} - -/* -** Hook functions for memory allocation and disposal. -** This makes it easy to substitute garbage collection systems -** such as Boehm's GC by assigning these function pointers -** to the GC's allocation routines. By default these point -** to the ANSI standard malloc, realloc, free, etc. -** -** Users should call the normal objc routines above for -** memory allocation and disposal within their programs. -*/ - -#if OBJC_WITH_GC -#include - -static void *GC_calloc (size_t nelem, size_t size) -{ - void* p = GC_malloc (nelem * size); - if (!p) - objc_error (nil, OBJC_ERR_MEMORY, "Virtual memory exhausted!\n"); - - memset (p, 0, nelem * size); - return p; -} - -static void noFree (void* p) {} - -void *(*_objc_malloc)(size_t) = GC_malloc; -void *(*_objc_atomic_malloc)(size_t) = GC_malloc_atomic; -void *(*_objc_valloc)(size_t) = GC_malloc; -void *(*_objc_realloc)(void *, size_t) = GC_realloc; -void *(*_objc_calloc)(size_t, size_t) = GC_calloc; -void (*_objc_free)(void *) = noFree; - -#else - -void *(*_objc_malloc)(size_t) = malloc; -void *(*_objc_atomic_malloc)(size_t) = malloc; -void *(*_objc_valloc)(size_t) = malloc; -void *(*_objc_realloc)(void *, size_t) = realloc; -void *(*_objc_calloc)(size_t, size_t) = calloc; -void (*_objc_free)(void *) = free; - - -#endif diff --git a/contrib/libobjc/nil_method.c b/contrib/libobjc/nil_method.c deleted file mode 100644 index 1b6212826b..0000000000 --- a/contrib/libobjc/nil_method.c +++ /dev/null @@ -1,40 +0,0 @@ -/* GNU Objective C Runtime nil receiver function - Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 is the nil method, the function that is called when the receiver - of a method is nil */ - -#include "runtime.h" - -id -nil_method(id receiver, SEL op, ...) -{ - return receiver; -} - - - - diff --git a/contrib/libobjc/objc-features.texi b/contrib/libobjc/objc-features.texi deleted file mode 100644 index 819caf6cff..0000000000 --- a/contrib/libobjc/objc-features.texi +++ /dev/null @@ -1,392 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@c %**start of header -@setfilename objc-features.info -@settitle GNU Objective-C runtime features -@setchapternewpage odd -@c %**end of header - -@node Top, Executing code before main, , (dir), (dir) -@comment node-name, next, previous, up - -@chapter GNU Objective-C runtime features - -This document is meant to describe some of the GNU Objective-C runtime -features. It is not intended to teach you Objective-C, there are several -resources on the Internet that present the language. Questions and -comments about this document to Ovidiu Predescu -@code{}. - -@menu -* Executing code before main:: -* Type encoding:: -* Garbage Collection:: -@end menu - - -@node Executing code before main, What you can and what you cannot do in +load, Top, Top -@section @code{+load}: Executing code before main - - -The GNU Objective-C runtime provides a way that allows you to execute -code before the execution of the program enters the @code{main} -function. The code is executed on a per-class and a per-category basis, -through a special class method @code{+load}. - -This facility is very useful if you want to initialize global variables -which can be accessed by the program directly, without sending a message -to the class first. The usual way to initialize global variables, in the -@code{+initialize} method, might not be useful because -@code{+initialize} is only called when the first message is sent to a -class object, which in some cases could be too late. - -Suppose for example you have a @code{FileStream} class that declares -@code{Stdin}, @code{Stdout} and @code{Stderr} as global variables, like -below: - -@example - -FileStream *Stdin = nil; -FileStream *Stdout = nil; -FileStream *Stderr = nil; - -@@implementation FileStream - -+ (void)initialize -@{ - Stdin = [[FileStream new] initWithFd:0]; - Stdout = [[FileStream new] initWithFd:1]; - Stderr = [[FileStream new] initWithFd:2]; -@} - -/* Other methods here */ -@@end - -@end example - -In this example, the initialization of @code{Stdin}, @code{Stdout} and -@code{Stderr} in @code{+initialize} occurs too late. The programmer can -send a message to one of these objects before the variables are actually -initialized, thus sending messages to the @code{nil} object. The -@code{+initialize} method which actually initializes the global -variables is not invoked until the first message is sent to the class -object. The solution would require these variables to be initialized -just before entering @code{main}. - -The correct solution of the above problem is to use the @code{+load} -method instead of @code{+initialize}: - -@example - -@@implementation FileStream - -+ (void)load -@{ - Stdin = [[FileStream new] initWithFd:0]; - Stdout = [[FileStream new] initWithFd:1]; - Stderr = [[FileStream new] initWithFd:2]; -@} - -/* Other methods here */ -@@end - -@end example - -The @code{+load} is a method that is not overridden by categories. If a -class and a category of it both implement @code{+load}, both methods are -invoked. This allows some additional initializations to be performed in -a category. - -This mechanism is not intended to be a replacement for @code{+initialize}. -You should be aware of its limitations when you decide to use it -instead of @code{+initialize}. - -@menu -* What you can and what you cannot do in +load:: -@end menu - - -@node What you can and what you cannot do in +load, Type encoding, Executing code before main, Executing code before main -@subsection What you can and what you cannot do in @code{+load} - -The +load implementation in the GNU runtime guarantees you the following -things: - -@itemize @bullet - -@item -you can write whatever C code you like; - -@item -you can send messages to Objective-C constant strings (@@"this is a -constant string"); - -@item -you can allocate and send messages to objects whose class is implemented -in the same file; - -@item -the @code{+load} implementation of all super classes of a class are executed before the @code{+load} of that class is executed; - -@item -the @code{+load} implementation of a class is executed before the -@code{+load} implementation of any category. - -@end itemize - -In particular, the following things, even if they can work in a -particular case, are not guaranteed: - -@itemize @bullet - -@item -allocation of or sending messages to arbitrary objects; - -@item -allocation of or sending messages to objects whose classes have a -category implemented in the same file; - -@end itemize - -You should make no assumptions about receiving @code{+load} in sibling -classes when you write @code{+load} of a class. The order in which -sibling classes receive @code{+load} is not guaranteed. - -The order in which @code{+load} and @code{+initialize} are called could -be problematic if this matters. If you don't allocate objects inside -@code{+load}, it is guaranteed that @code{+load} is called before -@code{+initialize}. If you create an object inside @code{+load} the -@code{+initialize} method of object's class is invoked even if -@code{+load} was not invoked. Note if you explicitly call @code{+load} -on a class, @code{+initialize} will be called first. To avoid possible -problems try to implement only one of these methods. - -The @code{+load} method is also invoked when a bundle is dynamically -loaded into your running program. This happens automatically without any -intervening operation from you. When you write bundles and you need to -write @code{+load} you can safely create and send messages to objects whose -classes already exist in the running program. The same restrictions as -above apply to classes defined in bundle. - - - -@node Type encoding, Garbage Collection, What you can and what you cannot do in +load, Top -@section Type encoding - -The Objective-C compiler generates type encodings for all the -types. These type encodings are used at runtime to find out information -about selectors and methods and about objects and classes. - -The types are encoded in the following way: - -@c @sp 1 - -@multitable @columnfractions .25 .75 -@item @code{char} -@tab @code{c} -@item @code{unsigned char} -@tab @code{C} -@item @code{short} -@tab @code{s} -@item @code{unsigned short} -@tab @code{S} -@item @code{int} -@tab @code{i} -@item @code{unsigned int} -@tab @code{I} -@item @code{long} -@tab @code{l} -@item @code{unsigned long} -@tab @code{L} -@item @code{long long} -@tab @code{q} -@item @code{unsigned long long} -@tab @code{Q} -@item @code{float} -@tab @code{f} -@item @code{double} -@tab @code{d} -@item @code{void} -@tab @code{v} -@item @code{id} -@tab @code{@@} -@item @code{Class} -@tab @code{#} -@item @code{SEL} -@tab @code{:} -@item @code{char*} -@tab @code{*} -@item unknown type -@tab @code{?} -@item bitfields -@tab @code{b} followed by the starting position of the bitfield, the type of the bitfield and the size of the bitfield (the bitfields encoding was changed from the NeXT's compiler encoding, see below) -@end multitable - -@c @sp 1 - -The encoding of bitfields has changed to allow bitfields to be properly -handled by the runtime functions that compute sizes and alignments of -types that contain bitfields. The previous encoding contained only the -size of the bitfield. Using only this information it is not possible to -reliably compute the size occupied by the bitfield. This is very -important in the presence of the Boehm's garbage collector because the -objects are allocated using the typed memory facility available in this -collector. The typed memory allocation requires information about where -the pointers are located inside the object. - -The position in the bitfield is the position, counting in bits, of the -bit closest to the beginning of the structure. - -The non-atomic types are encoded as follows: - -@c @sp 1 - -@multitable @columnfractions .2 .8 -@item pointers -@tab @code{'^'} followed by the pointed type. -@item arrays -@tab @code{'['} followed by the number of elements in the array followed by the type of the elements followed by @code{']'} -@item structures -@tab @code{'@{'} followed by the name of the structure (or '?' if the structure is unnamed), the '=' sign, the type of the members and by @code{'@}'} -@item unions -@tab @code{'('} followed by the name of the structure (or '?' if the union is unnamed), the '=' sign, the type of the members followed by @code{')'} -@end multitable - -Here are some types and their encodings, as they are generated by the -compiler on a i386 machine: - -@sp 1 - -@multitable @columnfractions .25 .75 -@item Objective-C type -@tab Compiler encoding -@item -@example -int a[10]; -@end example -@tab @code{[10i]} -@item -@example -struct @{ - int i; - float f[3]; - int a:3; - int b:2; - char c; -@} -@end example -@tab @code{@{?=i[3f]b128i3b131i2c@}} -@end multitable - -@sp 1 - -In addition to the types the compiler also encodes the type -specifiers. The table below describes the encoding of the current -Objective-C type specifiers: - -@sp 1 - -@multitable @columnfractions .25 .75 -@item Specifier -@tab Encoding -@item @code{const} -@tab @code{r} -@item @code{in} -@tab @code{n} -@item @code{inout} -@tab @code{N} -@item @code{out} -@tab @code{o} -@item @code{bycopy} -@tab @code{O} -@item @code{oneway} -@tab @code{V} -@end multitable - -@sp 1 - -The type specifiers are encoded just before the type. Unlike types -however, the type specifiers are only encoded when they appear in method -argument types. - - -@node Garbage Collection, , Type encoding, Top - -@page -@section Garbage Collection - -Support for a new memory management policy has been added by using a -powerful conservative garbage collector, known as the -Boehm-Demers-Weiser conservative garbage collector. It is available from -@w{@uref{http://reality.sgi.com/boehm_mti/gc.html}}. - -To enable the support for it you have to configure the compiler using an -additional argument, @w{@kbd{--enable-objc-gc}}. You need to have -garbage collector installed before building the compiler. This will -build an additional runtime library which has several enhancements to -support the garbage collector. The new library has a new name, -@kbd{libobjc_gc.a} to not conflict with the non-garbage-collected -library. - -When the garbage collector is used, the objects are allocated using the -so-called typed memory allocation mechanism available in the -Boehm-Demers-Weiser collector. This mode requires precise information on -where pointers are located inside objects. This information is computed -once per class, immediately after the class has been initialized. - -There is a new runtime function @code{class_ivar_set_gcinvisible()} -which can be used to declare a so-called @strong{weak pointer} -reference. Such a pointer is basically hidden for the garbage collector; -this can be useful in certain situations, especially when you want to -keep track of the allocated objects, yet allow them to be -collected. This kind of pointers can only be members of objects, you -cannot declare a global pointer as a weak reference. Every type which is -a pointer type can be declared a weak pointer, including @code{id}, -@code{Class} and @code{SEL}. - -Here is an example of how to use this feature. Suppose you want to -implement a class whose instances hold a weak pointer reference; the -following class does this: - -@example - -@@interface WeakPointer : Object -@{ - const void* weakPointer; -@} - -- initWithPointer:(const void*)p; -- (const void*)weakPointer; -@@end - - -@@implementation WeakPointer - -+ (void)initialize -@{ - class_ivar_set_gcinvisible (self, "weakPointer", YES); -@} - -- initWithPointer:(const void*)p -@{ - weakPointer = p; - return self; -@} - -- (const void*)weakPointer -@{ - return weakPointer; -@} - -@@end - -@end example - -Weak pointers are supported through a new type character specifier -represented by the @code{'!'} character. The -@code{class_ivar_set_gcinvisible()} function adds or removes this -specifier to the string type description of the instance variable named -as argument. - - -@bye - diff --git a/contrib/libobjc/objc/NXConstStr.h b/contrib/libobjc/objc/NXConstStr.h deleted file mode 100644 index c9799544a0..0000000000 --- a/contrib/libobjc/objc/NXConstStr.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Interface for the NXConstantString class for Objective-C. - Copyright (C) 1995 Free Software Foundation, Inc. - Contributed by Pieter J. Schoenmakers - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC 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 __nxconstantstring_INCLUDE_GNU -#define __nxconstantstring_INCLUDE_GNU - -#include "objc/Object.h" - -@interface NXConstantString: Object -{ - char *c_string; - unsigned int len; -} - --(const char *) cString; --(unsigned int) length; - -@end - -#endif diff --git a/contrib/libobjc/objc/Object.h b/contrib/libobjc/objc/Object.h deleted file mode 100644 index a762acc3f7..0000000000 --- a/contrib/libobjc/objc/Object.h +++ /dev/null @@ -1,124 +0,0 @@ -/* Interface for the Object class for Objective-C. - Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled - with GCC 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 __object_INCLUDE_GNU -#define __object_INCLUDE_GNU - -#include -#include - -/* - * All classes are derived from Object. As such, - * this is the overhead tacked onto those objects. - */ -@interface Object -{ - Class isa; /* A pointer to the instance's class structure */ -} - - /* Initializing classes and instances */ -+ initialize; -- init; - - /* Creating, freeing, and copying instances */ -+ new; -+ alloc; -- free; -- copy; -- shallowCopy; -- deepen; -- deepCopy; - - /* Identifying classes */ -- (Class)class; -- (Class)superClass; -- (MetaClass)metaClass; -- (const char *)name; - - /* Identifying and comparing objects */ -- self; -- (unsigned int)hash; -- (BOOL)isEqual:anObject; -- (int)compare:anotherObject; - - /* Testing object type */ -- (BOOL)isMetaClass; -- (BOOL)isClass; -- (BOOL)isInstance; - - /* Testing inheritance relationships */ -- (BOOL)isKindOf:(Class)aClassObject; -- (BOOL)isMemberOf:(Class)aClassObject; -- (BOOL)isKindOfClassNamed:(const char *)aClassName; -- (BOOL)isMemberOfClassNamed:(const char *)aClassName; - - /* Testing class functionality */ -+ (BOOL)instancesRespondTo:(SEL)aSel; -- (BOOL)respondsTo:(SEL)aSel; - - /* Testing protocol conformance */ -- (BOOL)conformsTo:(Protocol*)aProtocol; - - /* Introspection */ -+ (IMP)instanceMethodFor:(SEL)aSel; -- (IMP)methodFor:(SEL)aSel; -+ (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel; -- (struct objc_method_description *)descriptionForMethod:(SEL)aSel; - - /* Sending messages determined at run time */ -- perform:(SEL)aSel; -- perform:(SEL)aSel with:anObject; -- perform:(SEL)aSel with:anObject1 with:anObject2; - - /* Forwarding */ -- (retval_t)forward:(SEL)aSel :(arglist_t)argFrame; -- (retval_t)performv:(SEL)aSel :(arglist_t)argFrame; - - /* Posing */ -+ poseAs:(Class)aClassObject; -- (Class)transmuteClassTo:(Class)aClassObject; - - /* Enforcing intentions */ -- subclassResponsibility:(SEL)aSel; -- notImplemented:(SEL)aSel; -- shouldNotImplement:(SEL)aSel; - - /* Error handling */ -- doesNotRecognize:(SEL)aSel; -- error:(const char *)aString, ...; - - /* Archiving */ -+ (int)version; -+ setVersion:(int)aVersion; -+ (int)streamVersion: (TypedStream*)aStream; - -- read: (TypedStream*)aStream; -- write: (TypedStream*)aStream; -- awake; - -@end - -#endif diff --git a/contrib/libobjc/objc/Protocol.h b/contrib/libobjc/objc/Protocol.h deleted file mode 100644 index f54b7cd239..0000000000 --- a/contrib/libobjc/objc/Protocol.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Declare the class Protocol for Objective C programs. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC 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 __Protocol_INCLUDE_GNU -#define __Protocol_INCLUDE_GNU - -#include "objc/Object.h" - -@interface Protocol : Object -{ -@private - char *protocol_name; - struct objc_protocol_list *protocol_list; - struct objc_method_description_list *instance_methods, *class_methods; -} - -/* Obtaining attributes intrinsic to the protocol */ - -- (const char *)name; - -/* Testing protocol conformance */ - -- (BOOL) conformsTo: (Protocol *)aProtocolObject; - -/* Looking up information specific to a protocol */ - -- (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel; -- (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel; - -@end - - - - -#endif /* not __Protocol_INCLUDE_GNU */ diff --git a/contrib/libobjc/objc/encoding.h b/contrib/libobjc/objc/encoding.h deleted file mode 100644 index b4def4302b..0000000000 --- a/contrib/libobjc/objc/encoding.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Encoding of types for Objective C. - Copyright (C) 1993, 1997 Free Software Foundation, Inc. - -Author: Kresten Krab Thorup - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC 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 __encoding_INCLUDE_GNU -#define __encoding_INCLUDE_GNU - -#include -#include "objc/objc-api.h" - -#define _C_CONST 'r' -#define _C_IN 'n' -#define _C_INOUT 'N' -#define _C_OUT 'o' -#define _C_BYCOPY 'O' -#define _C_BYREF 'R' -#define _C_ONEWAY 'V' -#define _C_GCINVISIBLE '!' - -#define _F_CONST 0x01 -#define _F_IN 0x01 -#define _F_OUT 0x02 -#define _F_INOUT 0x03 -#define _F_BYCOPY 0x04 -#define _F_BYREF 0x08 -#define _F_ONEWAY 0x10 -#define _F_GCINVISIBLE 0x20 - -int objc_aligned_size (const char* type); -int objc_sizeof_type (const char* type); -int objc_alignof_type (const char* type); -int objc_aligned_size (const char* type); -int objc_promoted_size (const char* type); - -const char* objc_skip_type_qualifiers (const char* type); -const char* objc_skip_typespec (const char* type); -const char* objc_skip_offset (const char* type); -const char* objc_skip_argspec (const char* type); -int method_get_number_of_arguments (struct objc_method*); -int method_get_sizeof_arguments (struct objc_method*); - -char* method_get_first_argument (struct objc_method*, - arglist_t argframe, - const char** type); -char* method_get_next_argument (arglist_t argframe, - const char **type); -char* method_get_nth_argument (struct objc_method* m, - arglist_t argframe, - int arg, - const char **type); - -unsigned objc_get_type_qualifiers (const char* type); - - -struct objc_struct_layout -{ - const char *original_type; - const char *type; - const char *prev_type; - unsigned int record_size; - unsigned int record_align; -}; - -void objc_layout_structure (const char *type, - struct objc_struct_layout *layout); -BOOL objc_layout_structure_next_member (struct objc_struct_layout *layout); -void objc_layout_finish_structure (struct objc_struct_layout *layout, - unsigned int *size, - unsigned int *align); -void objc_layout_structure_get_info (struct objc_struct_layout *layout, - unsigned int *offset, - unsigned int *align, - const char **type); - -#endif /* __encoding_INCLUDE_GNU */ diff --git a/contrib/libobjc/objc/hash.h b/contrib/libobjc/objc/hash.h deleted file mode 100644 index bddb791c82..0000000000 --- a/contrib/libobjc/objc/hash.h +++ /dev/null @@ -1,206 +0,0 @@ -/* Hash tables for Objective C method dispatch. - Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC 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 __hash_INCLUDE_GNU -#define __hash_INCLUDE_GNU - -#include -#include - -/* - * This data structure is used to hold items - * stored in a hash table. Each node holds - * a key/value pair. - * - * Items in the cache are really of type void *. - */ -typedef struct cache_node -{ - struct cache_node *next; /* Pointer to next entry on the list. - NULL indicates end of list. */ - const void *key; /* Key used to locate the value. Used - to locate value when more than one - key computes the same hash - value. */ - void *value; /* Value stored for the key. */ -} *node_ptr; - - -/* - * This data type is the function that computes a hash code given a key. - * Therefore, the key can be a pointer to anything and the function specific - * to the key type. - * - * Unfortunately there is a mutual data structure reference problem with this - * typedef. Therefore, to remove compiler warnings the functions passed to - * hash_new will have to be casted to this type. - */ -typedef unsigned int (*hash_func_type)(void *, const void *); - -/* - * This data type is the function that compares two hash keys and returns an - * integer greater than, equal to, or less than 0, according as the first - * parameter is lexicographically greater than, equal to, or less than the - * second. - */ - -typedef int (*compare_func_type)(const void *, const void *); - - -/* - * This data structure is the cache. - * - * It must be passed to all of the hashing routines - * (except for new). - */ -typedef struct cache -{ - /* Variables used to implement the hash itself. */ - node_ptr *node_table; /* Pointer to an array of hash nodes. */ - /* Variables used to track the size of the hash table so to determine - when to resize it. */ - unsigned int size; /* Number of buckets allocated for the hash table - (number of array entries allocated for - "node_table"). Must be a power of two. */ - unsigned int used; /* Current number of entries in the hash table. */ - unsigned int mask; /* Precomputed mask. */ - - /* Variables used to implement indexing through the hash table. */ - - unsigned int last_bucket; /* Tracks which entry in the array where - the last value was returned. */ - /* Function used to compute a hash code given a key. - This function is specified when the hash table is created. */ - hash_func_type hash_func; - /* Function used to compare two hash keys to see if they are equal. */ - compare_func_type compare_func; -} *cache_ptr; - - -/* Two important hash tables. */ -extern cache_ptr module_hash_table, class_hash_table; - -/* Allocate and initialize a hash table. */ - -cache_ptr hash_new (unsigned int size, - hash_func_type hash_func, - compare_func_type compare_func); - -/* Deallocate all of the hash nodes and the cache itself. */ - -void hash_delete (cache_ptr cache); - -/* Add the key/value pair to the hash table. If the - hash table reaches a level of fullness then it will be resized. - - assert if the key is already in the hash. */ - -void hash_add (cache_ptr *cachep, const void *key, void *value); - -/* Remove the key/value pair from the hash table. - assert if the key isn't in the table. */ - -void hash_remove (cache_ptr cache, const void *key); - -/* Used to index through the hash table. Start with NULL - to get the first entry. - - Successive calls pass the value returned previously. - ** Don't modify the hash during this operation *** - - Cache nodes are returned such that key or value can - be extracted. */ - -node_ptr hash_next (cache_ptr cache, node_ptr node); - -/* Used to return a value from a hash table using a given key. */ - -void *hash_value_for_key (cache_ptr cache, const void *key); - -/* Used to determine if the given key exists in the hash table */ - -BOOL hash_is_key_in_hash (cache_ptr cache, const void *key); - -/************************************************ - - Useful hashing functions. - - Declared inline for your pleasure. - -************************************************/ - -/* Calculate a hash code by performing some - manipulation of the key pointer. (Use the lowest bits - except for those likely to be 0 due to alignment.) */ - -static inline unsigned int -hash_ptr (cache_ptr cache, const void *key) -{ - return ((size_t)key / sizeof (void *)) & cache->mask; -} - - -/* Calculate a hash code by iterating over a NULL - terminate string. */ -static inline unsigned int -hash_string (cache_ptr cache, const void *key) -{ - unsigned int ret = 0; - unsigned int ctr = 0; - - - while (*(char*)key) { - ret ^= *(char*)key++ << ctr; - ctr = (ctr + 1) % sizeof (void *); - } - - return ret & cache->mask; -} - - -/* Compare two pointers for equality. */ -static inline int -compare_ptrs (const void *k1, const void *k2) -{ - return !(k1 - k2); -} - - -/* Compare two strings. */ -static inline int -compare_strings (const void *k1, const void *k2) -{ - if (k1 == k2) - return 1; - else if (k1 == 0 || k2 == 0) - return 0; - else - return !strcmp (k1, k2); -} - - -#endif /* not __hash_INCLUDE_GNU */ diff --git a/contrib/libobjc/objc/objc-api.h b/contrib/libobjc/objc/objc-api.h deleted file mode 100644 index fe34dafb89..0000000000 --- a/contrib/libobjc/objc/objc-api.h +++ /dev/null @@ -1,597 +0,0 @@ -/* GNU Objective-C Runtime API. - Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled - with GCC 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 __objc_api_INCLUDE_GNU -#define __objc_api_INCLUDE_GNU - -#include "objc/objc.h" -#include "objc/hash.h" -#include "objc/thr.h" -#include -#include - -/* For functions which return Method_t */ -#define METHOD_NULL (Method_t)0 - /* Boolean typedefs */ -/* -** Method descriptor returned by introspective Object methods. -** This is really just the first part of the more complete objc_method -** structure defined below and used internally by the runtime. -*/ -struct objc_method_description -{ - SEL name; /* this is a selector, not a string */ - char *types; /* type encoding */ -}; - -/* Filer types used to describe Ivars and Methods. */ -#define _C_ID '@' -#define _C_CLASS '#' -#define _C_SEL ':' -#define _C_CHR 'c' -#define _C_UCHR 'C' -#define _C_SHT 's' -#define _C_USHT 'S' -#define _C_INT 'i' -#define _C_UINT 'I' -#define _C_LNG 'l' -#define _C_ULNG 'L' -#define _C_LNG_LNG 'q' -#define _C_ULNG_LNG 'Q' -#define _C_FLT 'f' -#define _C_DBL 'd' -#define _C_BFLD 'b' -#define _C_VOID 'v' -#define _C_UNDEF '?' -#define _C_PTR '^' -#define _C_CHARPTR '*' -#define _C_ATOM '%' -#define _C_ARY_B '[' -#define _C_ARY_E ']' -#define _C_UNION_B '(' -#define _C_UNION_E ')' -#define _C_STRUCT_B '{' -#define _C_STRUCT_E '}' - - -/* -** Error handling -** -** Call objc_error() or objc_verror() to record an error; this error -** routine will generally exit the program but not necessarily if the -** user has installed his own error handler. -** -** Call objc_set_error_handler to assign your own function for -** handling errors. The function should return YES if it is ok -** to continue execution, or return NO or just abort if the -** program should be stopped. The default error handler is just to -** print a message on stderr. -** -** The error handler function should be of type objc_error_handler -** The first parameter is an object instance of relevance. -** The second parameter is an error code. -** The third parameter is a format string in the printf style. -** The fourth parameter is a variable list of arguments. -*/ -extern void objc_error(id object, int code, const char* fmt, ...); -extern void objc_verror(id object, int code, const char* fmt, va_list ap); -typedef BOOL (*objc_error_handler)(id, int code, const char *fmt, va_list ap); -objc_error_handler objc_set_error_handler(objc_error_handler func); - -/* -** Error codes -** These are used by the runtime library, and your -** error handling may use them to determine if the error is -** hard or soft thus whether execution can continue or abort. -*/ -#define OBJC_ERR_UNKNOWN 0 /* Generic error */ - -#define OBJC_ERR_OBJC_VERSION 1 /* Incorrect runtime version */ -#define OBJC_ERR_GCC_VERSION 2 /* Incorrect compiler version */ -#define OBJC_ERR_MODULE_SIZE 3 /* Bad module size */ -#define OBJC_ERR_PROTOCOL_VERSION 4 /* Incorrect protocol version */ - -#define OBJC_ERR_MEMORY 10 /* Out of memory */ - -#define OBJC_ERR_RECURSE_ROOT 20 /* Attempt to archive the root - object more than once. */ -#define OBJC_ERR_BAD_DATA 21 /* Didn't read expected data */ -#define OBJC_ERR_BAD_KEY 22 /* Bad key for object */ -#define OBJC_ERR_BAD_CLASS 23 /* Unknown class */ -#define OBJC_ERR_BAD_TYPE 24 /* Bad type specification */ -#define OBJC_ERR_NO_READ 25 /* Cannot read stream */ -#define OBJC_ERR_NO_WRITE 26 /* Cannot write stream */ -#define OBJC_ERR_STREAM_VERSION 27 /* Incorrect stream version */ -#define OBJC_ERR_BAD_OPCODE 28 /* Bad opcode */ - -#define OBJC_ERR_UNIMPLEMENTED 30 /* Method is not implemented */ - -#define OBJC_ERR_BAD_STATE 40 /* Bad thread state */ - -/* -** Set this variable nonzero to print a line describing each -** message that is sent. (this is currently disabled) -*/ -extern BOOL objc_trace; - - -/* For every class which happens to have statically allocated instances in - this module, one OBJC_STATIC_INSTANCES is allocated by the compiler. - INSTANCES is NULL terminated and points to all statically allocated - instances of this class. */ -struct objc_static_instances -{ - char *class_name; - id instances[0]; -}; - -/* -** Whereas a Module (defined further down) is the root (typically) of a file, -** a Symtab is the root of the class and category definitions within the -** module. -** -** A Symtab contains a variable length array of pointers to classes and -** categories defined in the module. -*/ -typedef struct objc_symtab { - unsigned long sel_ref_cnt; /* Unknown. */ - SEL refs; /* Unknown. */ - unsigned short cls_def_cnt; /* Number of classes compiled - (defined) in the module. */ - unsigned short cat_def_cnt; /* Number of categories - compiled (defined) in the - module. */ - - void *defs[1]; /* Variable array of pointers. - cls_def_cnt of type Class - followed by cat_def_cnt of - type Category_t, followed - by a NULL terminated array - of objc_static_instances. */ -} Symtab, *Symtab_t; - - -/* -** The compiler generates one of these structures for each module that -** composes the executable (eg main.m). -** -** This data structure is the root of the definition tree for the module. -** -** A collect program runs between ld stages and creates a ObjC ctor array. -** That array holds a pointer to each module structure of the executable. -*/ -typedef struct objc_module { - unsigned long version; /* Compiler revision. */ - unsigned long size; /* sizeof(Module). */ - const char* name; /* Name of the file where the - module was generated. The - name includes the path. */ - - Symtab_t symtab; /* Pointer to the Symtab of - the module. The Symtab - holds an array of - pointers to - the classes and categories - defined in the module. */ -} Module, *Module_t; - - -/* -** The compiler generates one of these structures for a class that has -** instance variables defined in its specification. -*/ -typedef struct objc_ivar* Ivar_t; -typedef struct objc_ivar_list { - int ivar_count; /* Number of structures (Ivar) - contained in the list. One - structure per instance - variable defined in the - class. */ - struct objc_ivar { - const char* ivar_name; /* Name of the instance - variable as entered in the - class definition. */ - const char* ivar_type; /* Description of the Ivar's - type. Useful for - debuggers. */ - int ivar_offset; /* Byte offset from the base - address of the instance - structure to the variable. */ - - } ivar_list[1]; /* Variable length - structure. */ -} IvarList, *IvarList_t; - - -/* -** The compiler generates one (or more) of these structures for a class that -** has methods defined in its specification. -** -** The implementation of a class can be broken into separate pieces in a file -** and categories can break them across modules. To handle this problem is a -** singly linked list of methods. -*/ -typedef struct objc_method Method; -typedef Method* Method_t; -typedef struct objc_method_list { - struct objc_method_list* method_next; /* This variable is used to link - a method list to another. It - is a singly linked list. */ - int method_count; /* Number of methods defined in - this structure. */ - struct objc_method { - SEL method_name; /* This variable is the method's - name. It is a char*. - The unique integer passed to - objc_msg_send is a char* too. - It is compared against - method_name using strcmp. */ - const char* method_types; /* Description of the method's - parameter list. Useful for - debuggers. */ - IMP method_imp; /* Address of the method in the - executable. */ - } method_list[1]; /* Variable length - structure. */ -} MethodList, *MethodList_t; - -struct objc_protocol_list { - struct objc_protocol_list *next; - int count; - Protocol *list[1]; -}; - -/* -** This is used to assure consistent access to the info field of -** classes -*/ -#ifndef HOST_BITS_PER_LONG -#define HOST_BITS_PER_LONG (sizeof(long)*8) -#endif - -#define __CLS_INFO(cls) ((cls)->info) -#define __CLS_ISINFO(cls, mask) ((__CLS_INFO(cls)&mask)==mask) -#define __CLS_SETINFO(cls, mask) (__CLS_INFO(cls) |= mask) - -/* The structure is of type MetaClass */ -#define _CLS_META 0x2L -#define CLS_ISMETA(cls) ((cls)&&__CLS_ISINFO(cls, _CLS_META)) - - -/* The structure is of type Class */ -#define _CLS_CLASS 0x1L -#define CLS_ISCLASS(cls) ((cls)&&__CLS_ISINFO(cls, _CLS_CLASS)) - -/* -** The class is initialized within the runtime. This means that -** it has had correct super and sublinks assigned -*/ -#define _CLS_RESOLV 0x8L -#define CLS_ISRESOLV(cls) __CLS_ISINFO(cls, _CLS_RESOLV) -#define CLS_SETRESOLV(cls) __CLS_SETINFO(cls, _CLS_RESOLV) - -/* -** The class has been send a +initialize message or a such is not -** defined for this class -*/ -#define _CLS_INITIALIZED 0x04L -#define CLS_ISINITIALIZED(cls) __CLS_ISINFO(cls, _CLS_INITIALIZED) -#define CLS_SETINITIALIZED(cls) __CLS_SETINFO(cls, _CLS_INITIALIZED) - -/* -** The class number of this class. This must be the same for both the -** class and its meta class object -*/ -#define CLS_GETNUMBER(cls) (__CLS_INFO(cls) >> (HOST_BITS_PER_LONG/2)) -#define CLS_SETNUMBER(cls, num) \ - ({ (cls)->info <<= (HOST_BITS_PER_LONG/2); \ - (cls)->info >>= (HOST_BITS_PER_LONG/2); \ - __CLS_SETINFO(cls, (((unsigned long)num) << (HOST_BITS_PER_LONG/2))); }) - -/* -** The compiler generates one of these structures for each category. A class -** may have many categories and contain both instance and factory methods. -*/ -typedef struct objc_category { - const char* category_name; /* Name of the category. Name - contained in the () of the - category definition. */ - const char* class_name; /* Name of the class to which - the category belongs. */ - MethodList_t instance_methods; /* Linked list of instance - methods defined in the - category. NULL indicates no - instance methods defined. */ - MethodList_t class_methods; /* Linked list of factory - methods defined in the - category. NULL indicates no - class methods defined. */ - struct objc_protocol_list *protocols; /* List of Protocols - conformed to */ -} Category, *Category_t; - -/* -** Structure used when a message is send to a class's super class. The -** compiler generates one of these structures and passes it to -** objc_msg_super. -*/ -typedef struct objc_super { - id self; /* Id of the object sending - the message. */ - Class class; /* Object's super class. */ -} Super, *Super_t; - -IMP objc_msg_lookup_super(Super_t super, SEL sel); - -retval_t objc_msg_sendv(id, SEL, arglist_t); - - - -/* -** This is a hook which is called by objc_lookup_class and -** objc_get_class if the runtime is not able to find the class. -** This may e.g. try to load in the class using dynamic loading. -** The function is guaranteed to be passed a non-NULL name string. -*/ -extern Class (*_objc_lookup_class)(const char *name); - -/* -** This is a hook which is called by __objc_exec_class every time a class -** or a category is loaded into the runtime. This may e.g. help a -** dynamic loader determine the classes that have been loaded when -** an object file is dynamically linked in. -*/ -extern void (*_objc_load_callback)(Class class, Category* category); - -/* -** Hook functions for allocating, copying and disposing of instances -*/ -extern id (*_objc_object_alloc)(Class class); -extern id (*_objc_object_copy)(id object); -extern id (*_objc_object_dispose)(id object); - -/* -** Standard functions for memory allocation and disposal. -** Users should use these functions in their ObjC programs so -** that they work properly with garbage collectors as well as -** can take advantage of the exception/error handling available. -*/ -void * -objc_malloc(size_t size); - -void * -objc_atomic_malloc(size_t size); - -void * -objc_valloc(size_t size); - -void * -objc_realloc(void *mem, size_t size); - -void * -objc_calloc(size_t nelem, size_t size); - -void -objc_free(void *mem); - -/* -** Hook functions for memory allocation and disposal. -** This makes it easy to substitute garbage collection systems -** such as Boehm's GC by assigning these function pointers -** to the GC's allocation routines. By default these point -** to the ANSI standard malloc, realloc, free, etc. -** -** Users should call the normal objc routines above for -** memory allocation and disposal within their programs. -*/ -extern void *(*_objc_malloc)(size_t); -extern void *(*_objc_atomic_malloc)(size_t); -extern void *(*_objc_valloc)(size_t); -extern void *(*_objc_realloc)(void *, size_t); -extern void *(*_objc_calloc)(size_t, size_t); -extern void (*_objc_free)(void *); - -Method_t class_get_class_method(MetaClass class, SEL aSel); - -Method_t class_get_instance_method(Class class, SEL aSel); - -Class class_pose_as(Class impostor, Class superclass); - -Class objc_get_class(const char *name); - -Class objc_lookup_class(const char *name); - -Class objc_next_class(void **enum_state); - -const char *sel_get_name(SEL selector); - -const char *sel_get_type(SEL selector); - -SEL sel_get_uid(const char *name); - -SEL sel_get_any_uid(const char *name); - -SEL sel_get_any_typed_uid(const char *name); - -SEL sel_get_typed_uid(const char *name, const char*); - -SEL sel_register_name(const char *name); - -SEL sel_register_typed_name(const char *name, const char*type); - - -BOOL sel_is_mapped (SEL aSel); - -extern id class_create_instance(Class class); - -static inline const char * -class_get_class_name(Class class) -{ - return CLS_ISCLASS(class)?class->name:((class==Nil)?"Nil":0); -} - -static inline long -class_get_instance_size(Class class) -{ - return CLS_ISCLASS(class)?class->instance_size:0; -} - -static inline MetaClass -class_get_meta_class(Class class) -{ - return CLS_ISCLASS(class)?class->class_pointer:Nil; -} - -static inline Class -class_get_super_class(Class class) -{ - return CLS_ISCLASS(class)?class->super_class:Nil; -} - -static inline int -class_get_version(Class class) -{ - return CLS_ISCLASS(class)?class->version:-1; -} - -static inline BOOL -class_is_class(Class class) -{ - return CLS_ISCLASS(class); -} - -static inline BOOL -class_is_meta_class(Class class) -{ - return CLS_ISMETA(class); -} - - -static inline void -class_set_version(Class class, long version) -{ - if (CLS_ISCLASS(class)) - class->version = version; -} - -static inline void * -class_get_gc_object_type (Class class) -{ - return CLS_ISCLASS(class) ? class->gc_object_type : NULL; -} - -/* Mark the instance variable as innaccessible to the garbage collector */ -extern void class_ivar_set_gcinvisible (Class class, - const char* ivarname, - BOOL gcInvisible); - -static inline IMP -method_get_imp(Method_t method) -{ - return (method!=METHOD_NULL)?method->method_imp:(IMP)0; -} - -IMP get_imp (Class class, SEL sel); - -/* Redefine on NeXTSTEP so as not to conflict with system function */ -#ifdef __NeXT__ -#define object_copy gnu_object_copy -#define object_dispose gnu_object_dispose -#endif - -id object_copy(id object); - -id object_dispose(id object); - -static inline Class -object_get_class(id object) -{ - return ((object!=nil) - ? (CLS_ISCLASS(object->class_pointer) - ? object->class_pointer - : (CLS_ISMETA(object->class_pointer) - ? (Class)object - : Nil)) - : Nil); -} - -static inline const char * -object_get_class_name(id object) -{ - return ((object!=nil)?(CLS_ISCLASS(object->class_pointer) - ?object->class_pointer->name - :((Class)object)->name) - :"Nil"); -} - -static inline MetaClass -object_get_meta_class(id object) -{ - return ((object!=nil)?(CLS_ISCLASS(object->class_pointer) - ?object->class_pointer->class_pointer - :(CLS_ISMETA(object->class_pointer) - ?object->class_pointer - :Nil)) - :Nil); -} - -static inline Class -object_get_super_class -(id object) -{ - return ((object!=nil)?(CLS_ISCLASS(object->class_pointer) - ?object->class_pointer->super_class - :(CLS_ISMETA(object->class_pointer) - ?((Class)object)->super_class - :Nil)) - :Nil); -} - -static inline BOOL -object_is_class(id object) -{ - return CLS_ISCLASS((Class)object); -} - -static inline BOOL -object_is_instance(id object) -{ - return (object!=nil)&&CLS_ISCLASS(object->class_pointer); -} - -static inline BOOL -object_is_meta_class(id object) -{ - return CLS_ISMETA((Class)object); -} - -struct sarray* -objc_get_uninstalled_dtable(void); - -#endif /* not __objc_api_INCLUDE_GNU */ - - - diff --git a/contrib/libobjc/objc/objc-list.h b/contrib/libobjc/objc/objc-list.h deleted file mode 100644 index de083a5861..0000000000 --- a/contrib/libobjc/objc/objc-list.h +++ /dev/null @@ -1,147 +0,0 @@ -/* Generic single linked list to keep various information - Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 __GNU_OBJC_LIST_H -#define __GNU_OBJC_LIST_H - -struct objc_list { - void *head; - struct objc_list *tail; -}; - -/* Return a cons cell produced from (head . tail) */ - -static inline struct objc_list* -list_cons(void* head, struct objc_list* tail) -{ - struct objc_list* cell; - - cell = (struct objc_list*)objc_malloc(sizeof(struct objc_list)); - cell->head = head; - cell->tail = tail; - return cell; -} - -/* Return the length of a list, list_length(NULL) returns zero */ - -static inline int -list_length(struct objc_list* list) -{ - int i = 0; - while(list) - { - i += 1; - list = list->tail; - } - return i; -} - -/* Return the Nth element of LIST, where N count from zero. If N - larger than the list length, NULL is returned */ - -static inline void* -list_nth(int index, struct objc_list* list) -{ - while(index-- != 0) - { - if(list->tail) - list = list->tail; - else - return 0; - } - return list->head; -} - -/* Remove the element at the head by replacing it by its successor */ - -static inline void -list_remove_head(struct objc_list** list) -{ - if ((*list)->tail) - { - struct objc_list* tail = (*list)->tail; /* fetch next */ - *(*list) = *tail; /* copy next to list head */ - objc_free(tail); /* free next */ - } - else /* only one element in list */ - { - objc_free(*list); - (*list) = 0; - } -} - - -/* Remove the element with `car' set to ELEMENT */ - -static inline void -list_remove_elem(struct objc_list** list, void* elem) -{ - while (*list) { - if ((*list)->head == elem) - list_remove_head(list); - list = &((*list)->tail); - } -} - -/* Map FUNCTION over all elements in LIST */ - -static inline void -list_mapcar(struct objc_list* list, void(*function)(void*)) -{ - while(list) - { - (*function)(list->head); - list = list->tail; - } -} - -/* Return element that has ELEM as car */ - -static inline struct objc_list** -list_find(struct objc_list** list, void* elem) -{ - while(*list) - { - if ((*list)->head == elem) - return list; - list = &((*list)->tail); - } - return NULL; -} - -/* Free list (backwards recursive) */ - -static void -list_free(struct objc_list* list) -{ - if(list) - { - list_free(list->tail); - objc_free(list); - } -} -#endif /* not __GNU_OBJC_LIST_H */ diff --git a/contrib/libobjc/objc/objc.h b/contrib/libobjc/objc/objc.h deleted file mode 100644 index 79b2519e57..0000000000 --- a/contrib/libobjc/objc/objc.h +++ /dev/null @@ -1,158 +0,0 @@ -/* Basic data types for Objective C. - Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC 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 __objc_INCLUDE_GNU -#define __objc_INCLUDE_GNU - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* -** Definition of the boolean type. -*/ -#ifdef __vxworks -typedef int BOOL; -#else -typedef unsigned char BOOL; -#endif -#define YES (BOOL)1 -#define NO (BOOL)0 - -/* -** Definition of a selector. Selectors themselves are not unique, but -** the sel_id is a unique identifier. -*/ -typedef const struct objc_selector -{ - void *sel_id; - const char *sel_types; -} *SEL; - -inline static BOOL -sel_eq (SEL s1, SEL s2) -{ - if (s1 == 0 || s2 == 0) - return s1 == s2; - else - return s1->sel_id == s2->sel_id; -} - - -/* -** ObjC uses this typedef for untyped instances. -*/ -typedef struct objc_object { - struct objc_class* class_pointer; -} *id; - -/* -** Definition of method type. When retrieving the implementation of a -** method, this is type of the pointer returned -*/ -typedef id (*IMP)(id, SEL, ...); - -/* -** More simple types... -*/ -#define nil (id)0 /* id of Nil instance */ -#define Nil (Class)0 /* id of Nil class */ -typedef char *STR; /* String alias */ - -/* -** The compiler generates one of these structures for each class. -** -** This structure is the definition for classes. -** -** This structure is generated by the compiler in the executable and used by -** the run-time during normal messaging operations. Therefore some members -** change type. The compiler generates "char* const" and places a string in -** the following member variables: super_class. -*/ -typedef struct objc_class *MetaClass; -typedef struct objc_class *Class; -struct objc_class { - MetaClass class_pointer; /* Pointer to the class's - meta class. */ - struct objc_class* super_class; /* Pointer to the super - class. NULL for class - Object. */ - const char* name; /* Name of the class. */ - long version; /* Unknown. */ - unsigned long info; /* Bit mask. See class masks - defined above. */ - long instance_size; /* Size in bytes of the class. - The sum of the class - definition and all super - class definitions. */ - struct objc_ivar_list* ivars; /* Pointer to a structure that - describes the instance - variables in the class - definition. NULL indicates - no instance variables. Does - not include super class - variables. */ - struct objc_method_list* methods; /* Linked list of instance - methods defined for the - class. */ - struct sarray * dtable; /* Pointer to instance - method dispatch table. */ - struct objc_class* subclass_list; /* Subclasses */ - struct objc_class* sibling_class; - - struct objc_protocol_list *protocols; /* Protocols conformed to */ - void* gc_object_type; -}; - -#ifndef __OBJC__ -typedef struct objc_protocol { - struct objc_class* class_pointer; - char *protocol_name; - struct objc_protocol_list *protocol_list; - struct objc_method_description_list *instance_methods, *class_methods; -} Protocol; - -#else /* __OBJC__ */ -@class Protocol; -#endif - -typedef void* retval_t; /* return value */ -typedef void(*apply_t)(void); /* function pointer */ -typedef union { - char *arg_ptr; - char arg_regs[sizeof (char*)]; -} *arglist_t; /* argument frame */ - - -IMP objc_msg_lookup(id receiver, SEL op); - -#ifdef __cplusplus -} -#endif - -#endif /* not __objc_INCLUDE_GNU */ diff --git a/contrib/libobjc/objc/runtime.h b/contrib/libobjc/objc/runtime.h deleted file mode 100644 index b0eae4a222..0000000000 --- a/contrib/libobjc/objc/runtime.h +++ /dev/null @@ -1,88 +0,0 @@ -/* GNU Objective C Runtime internal declarations - Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 __objc_runtime_INCLUDE_GNU -#define __objc_runtime_INCLUDE_GNU - -#include /* for varargs and va_list's */ - -#include -#include - -#include /* so noone else will get system versions */ -#include "assert.h" - -#include "objc/objc.h" /* core data types */ -#include "objc/objc-api.h" /* runtime api functions */ - -#include "objc/thr.h" /* thread and mutex support */ - -#include "objc/hash.h" /* hash structures */ -#include "objc/objc-list.h" /* linear lists */ - -extern void __objc_add_class_to_hash(Class); /* (objc-class.c) */ -extern void __objc_init_selector_tables(void); /* (objc-sel.c) */ -extern void __objc_init_class_tables(void); /* (objc-class.c) */ -extern void __objc_init_dispatch_tables(void); /* (objc-dispatch.c) */ -extern void __objc_install_premature_dtable(Class); /* (objc-dispatch.c) */ -extern void __objc_resolve_class_links(void); /* (objc-class.c) */ -extern void __objc_register_selectors_from_class(Class); /* (objc-sel.c) */ -extern void __objc_update_dispatch_table_for_class (Class);/* (objc-msg.c) */ - -extern int __objc_init_thread_system(void); /* thread.c */ -extern int __objc_fini_thread_system(void); /* thread.c */ -extern void __objc_print_dtable_stats(void); /* sendmsg.c */ - -extern void class_add_method_list(Class, MethodList_t); - -/* Registering instance methods as class methods for root classes */ -extern void __objc_register_instance_methods_to_class(Class); -extern Method_t search_for_method_in_list(MethodList_t list, SEL op); - -/* True when class links has been resolved */ -extern BOOL __objc_class_links_resolved; - -/* Number of selectors stored in each of the selector tables */ -extern int __objc_selector_max_index; - -/* Mutex locking __objc_selector_max_index and its arrays. */ -extern objc_mutex_t __objc_runtime_mutex; - -/* Number of threads which are alive. */ -extern int __objc_runtime_threads_alive; - -#ifdef DEBUG -#define DEBUG_PRINTF(format, args...) printf (format, ## args) -#else -#define DEBUG_PRINTF(format, args...) -#endif - -BOOL __objc_responds_to (id object, SEL sel); /* for internal use only! */ -SEL __sel_register_typed_name (const char*, const char*, - struct objc_selector*, BOOL is_const); - -#endif /* not __objc_runtime_INCLUDE_GNU */ - - diff --git a/contrib/libobjc/objc/sarray.h b/contrib/libobjc/objc/sarray.h deleted file mode 100644 index 17da272036..0000000000 --- a/contrib/libobjc/objc/sarray.h +++ /dev/null @@ -1,237 +0,0 @@ -/* Sparse Arrays for Objective C dispatch tables - Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC 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 __sarray_INCLUDE_GNU -#define __sarray_INCLUDE_GNU - -#define OBJC_SPARSE2 /* 2-level sparse array */ -/* #define OBJC_SPARSE3 */ /* 3-level sparse array */ - -#ifdef OBJC_SPARSE2 -extern const char* __objc_sparse2_id; -#endif - -#ifdef OBJC_SPARSE3 -extern const char* __objc_sparse3_id; -#endif - -#include - -#include "objc/thr.h" - -extern int nbuckets; /* for stats */ -extern int nindices; -extern int narrays; -extern int idxsize; - -#include - -/* An unsigned integer of same size as a pointer */ -#define SIZET_BITS (sizeof(size_t)*8) - -#if defined(__sparc__) || defined(OBJC_SPARSE2) -#define PRECOMPUTE_SELECTORS -#endif - -#ifdef OBJC_SPARSE3 - -/* Buckets are 8 words each */ -#define BUCKET_BITS 3 -#define BUCKET_SIZE (1< - indices[x.off.ioffset]-> - buckets[x.off.boffset]-> - elems[x.off.eoffset]; -#else /* OBJC_SPARSE2 */ - return array->buckets[x.off.boffset]->elems[x.off.eoffset]; -#endif /* OBJC_SPARSE2 */ -#else /* not PRECOMPUTE_SELECTORS */ -#ifdef OBJC_SPARSE3 - return array-> - indices[index/INDEX_CAPACITY]-> - buckets[(index/BUCKET_SIZE)%INDEX_SIZE]-> - elems[index%BUCKET_SIZE]; -#else /* OBJC_SPARSE2 */ - return array->buckets[index/BUCKET_SIZE]->elems[index%BUCKET_SIZE]; -#endif /* not OBJC_SPARSE3 */ -#endif /* not PRECOMPUTE_SELECTORS */ -} - -static inline void* sarray_get_safe(struct sarray* array, sidx index) -{ - if(soffset_decode(index) < array->capacity) - return sarray_get(array, index); - else - return (array->empty_bucket->elems[0]); -} - -#endif /* __sarray_INCLUDE_GNU */ diff --git a/contrib/libobjc/objc/thr.h b/contrib/libobjc/objc/thr.h deleted file mode 100644 index f904733695..0000000000 --- a/contrib/libobjc/objc/thr.h +++ /dev/null @@ -1,143 +0,0 @@ -/* Thread and mutex controls for Objective C. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC 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 __thread_INCLUDE_GNU -#define __thread_INCLUDE_GNU - -#include "objc/objc.h" - -/************************************************************************* - * Universal static variables: - */ -extern int __objc_thread_exit_status; /* Global exit status. */ - -/******** - * Thread safe implementation types and functions. - */ - -/* Thread priorities */ -#define OBJC_THREAD_INTERACTIVE_PRIORITY 2 -#define OBJC_THREAD_BACKGROUND_PRIORITY 1 -#define OBJC_THREAD_LOW_PRIORITY 0 - -/* A thread */ -typedef void * objc_thread_t; - -/* This structure represents a single mutual exclusion lock. */ -struct objc_mutex -{ - volatile objc_thread_t owner; /* Id of thread that owns. */ - volatile int depth; /* # of acquires. */ - void * backend; /* Specific to backend */ -}; -typedef struct objc_mutex *objc_mutex_t; - -/* This structure represents a single condition mutex */ -struct objc_condition -{ - void * backend; /* Specific to backend */ -}; -typedef struct objc_condition *objc_condition_t; - -/* Frontend mutex functions */ -objc_mutex_t objc_mutex_allocate(void); -int objc_mutex_deallocate(objc_mutex_t mutex); -int objc_mutex_lock(objc_mutex_t mutex); -int objc_mutex_unlock(objc_mutex_t mutex); -int objc_mutex_trylock(objc_mutex_t mutex); - -/* Frontend condition mutex functions */ -objc_condition_t objc_condition_allocate(void); -int objc_condition_deallocate(objc_condition_t condition); -int objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex); -int objc_condition_signal(objc_condition_t condition); -int objc_condition_broadcast(objc_condition_t condition); - -/* Frontend thread functions */ -objc_thread_t objc_thread_detach(SEL selector, id object, id argument); -void objc_thread_yield(void); -int objc_thread_exit(void); -int objc_thread_set_priority(int priority); -int objc_thread_get_priority(void); -void * objc_thread_get_data(void); -int objc_thread_set_data(void *value); -objc_thread_t objc_thread_id(void); - -/* - Use this to set the hook function that will be called when the - runtime initially becomes multi threaded. - The hook function is only called once, meaning only when the - 2nd thread is spawned, not for each and every thread. - - It returns the previous hook function or NULL if there is none. - - A program outside of the runtime could set this to some function so - it can be informed; for example, the GNUstep Base Library sets it - so it can implement the NSBecomingMultiThreaded notification. - */ -typedef void (*objc_thread_callback)(); -objc_thread_callback objc_set_thread_callback(objc_thread_callback func); - -/* Backend initialization functions */ -int __objc_init_thread_system(void); -int __objc_fini_thread_system(void); - -/* Backend mutex functions */ -int __objc_mutex_allocate(objc_mutex_t mutex); -int __objc_mutex_deallocate(objc_mutex_t mutex); -int __objc_mutex_lock(objc_mutex_t mutex); -int __objc_mutex_trylock(objc_mutex_t mutex); -int __objc_mutex_unlock(objc_mutex_t mutex); - -/* Backend condition mutex functions */ -int __objc_condition_allocate(objc_condition_t condition); -int __objc_condition_deallocate(objc_condition_t condition); -int __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex); -int __objc_condition_broadcast(objc_condition_t condition); -int __objc_condition_signal(objc_condition_t condition); - -/* Backend thread functions */ -objc_thread_t __objc_thread_detach(void (*func)(void *arg), void *arg); -int __objc_thread_set_priority(int priority); -int __objc_thread_get_priority(void); -void __objc_thread_yield(void); -int __objc_thread_exit(void); -objc_thread_t __objc_thread_id(void); -int __objc_thread_set_data(void *value); -void * __objc_thread_get_data(void); - -#endif /* not __thread_INCLUDE_GNU */ diff --git a/contrib/libobjc/objc/typedstream.h b/contrib/libobjc/objc/typedstream.h deleted file mode 100644 index eb4642f344..0000000000 --- a/contrib/libobjc/objc/typedstream.h +++ /dev/null @@ -1,132 +0,0 @@ -/* GNU Objective-C Typed Streams interface. - Copyright (C) 1993, 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled - with GCC 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 __typedstream_INCLUDE_GNU -#define __typedstream_INCLUDE_GNU - -#include "objc/objc.h" -#include "objc/hash.h" -#include - -typedef int (*objc_typed_read_func)(void*, char*, int); -typedef int (*objc_typed_write_func)(void*, const char*, int); -typedef int (*objc_typed_flush_func)(void*); -typedef int (*objc_typed_eof_func)(void*); - -#define OBJC_READONLY 0x01 -#define OBJC_WRITEONLY 0x02 - -#define OBJC_MANAGED_STREAM 0x01 -#define OBJC_FILE_STREAM 0x02 -#define OBJC_MEMORY_STREAM 0x04 - -#define OBJC_TYPED_STREAM_VERSION 0x01 - -typedef struct objc_typed_stream { - void* physical; - cache_ptr object_table; /* read/written objects */ - cache_ptr stream_table; /* other read/written but shared things.. */ - cache_ptr class_table; /* class version mapping */ - cache_ptr object_refs; /* forward references */ - int mode; /* OBJC_READONLY or OBJC_WRITEONLY */ - int type; /* MANAGED, FILE, MEMORY etc bit string */ - int version; /* version used when writing */ - int writing_root_p; - objc_typed_read_func read; - objc_typed_write_func write; - objc_typed_eof_func eof; - objc_typed_flush_func flush; -} TypedStream; - -/* opcode masks */ -#define _B_VALUE 0x1fU -#define _B_CODE 0xe0U -#define _B_SIGN 0x10U -#define _B_NUMBER 0x0fU - -/* standard opcodes */ -#define _B_INVALID 0x00U -#define _B_SINT 0x20U -#define _B_NINT 0x40U -#define _B_SSTR 0x60U -#define _B_NSTR 0x80U -#define _B_RCOMM 0xa0U -#define _B_UCOMM 0xc0U -#define _B_EXT 0xe0U - -/* eXtension opcodes */ -#define _BX_OBJECT 0x00U -#define _BX_CLASS 0x01U -#define _BX_SEL 0x02U -#define _BX_OBJREF 0x03U -#define _BX_OBJROOT 0x04U -#define _BX_EXT 0x1fU - -/* -** Read and write objects as specified by TYPE. All the `last' -** arguments are pointers to the objects to read/write. -*/ - -int objc_write_type (TypedStream* stream, const char* type, const void* data); -int objc_read_type (TypedStream* stream, const char* type, void* data); - -int objc_write_types (TypedStream* stream, const char* type, ...); -int objc_read_types (TypedStream* stream, const char* type, ...); - -int objc_write_object_reference (TypedStream* stream, id object); -int objc_write_root_object (TypedStream* stream, id object); - -long objc_get_stream_class_version (TypedStream* stream, Class class); - - -/* -** Convenience functions -*/ - -int objc_write_array (TypedStream* stream, const char* type, - int count, const void* data); -int objc_read_array (TypedStream* stream, const char* type, - int count, void* data); - -int objc_write_object (TypedStream* stream, id object); -int objc_read_object (TypedStream* stream, id* object); - - - -/* -** Open a typed stream for reading or writing. MODE may be either of -** OBJC_READONLY or OBJC_WRITEONLY. -*/ - -TypedStream* objc_open_typed_stream (FILE* physical, int mode); -TypedStream* objc_open_typed_stream_for_file (const char* file_name, int mode); - -void objc_close_typed_stream (TypedStream* stream); - -BOOL objc_end_of_typed_stream (TypedStream* stream); -void objc_flush_typed_stream (TypedStream* stream); - -#endif /* not __typedstream_INCLUDE_GNU */ diff --git a/contrib/libobjc/objects.c b/contrib/libobjc/objects.c deleted file mode 100644 index df74b85de8..0000000000 --- a/contrib/libobjc/objects.c +++ /dev/null @@ -1,105 +0,0 @@ -/* GNU Objective C Runtime class related functions - Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 "tconfig.h" /* include defs of bzero for target */ -#include "objc.h" -#include "runtime.h" /* the kitchen sink */ - -#if OBJC_WITH_GC -# include -#endif - -id __objc_object_alloc(Class); -id __objc_object_dispose(id); -id __objc_object_copy(id); - -id (*_objc_object_alloc)(Class) = __objc_object_alloc; /* !T:SINGLE */ -id (*_objc_object_dispose)(id) = __objc_object_dispose; /* !T:SINGLE */ -id (*_objc_object_copy)(id) = __objc_object_copy; /* !T:SINGLE */ - -id -class_create_instance(Class class) -{ - id new = nil; - -#if OBJC_WITH_GC - if (CLS_ISCLASS(class)) - new = (id)GC_malloc_explicitly_typed (class->instance_size, - class->gc_object_type); -#else - if (CLS_ISCLASS(class)) - new = (*_objc_object_alloc)(class); -#endif - - if (new!=nil) - { - memset (new, 0, class->instance_size); - new->class_pointer = class; - } - return new; -} - -id -object_copy(id object) -{ - if ((object!=nil)&&CLS_ISCLASS(object->class_pointer)) - return (*_objc_object_copy)(object); - else - return nil; -} - -id -object_dispose(id object) -{ - if ((object!=nil)&&CLS_ISCLASS(object->class_pointer)) - { - if (_objc_object_dispose) - (*_objc_object_dispose)(object); - else - objc_free(object); - } - return nil; -} - -id __objc_object_alloc(Class class) -{ - return (id)objc_malloc(class->instance_size); -} - -id __objc_object_dispose(id object) -{ - objc_free(object); - return 0; -} - -id __objc_object_copy(id object) -{ - id copy = class_create_instance(object->class_pointer); - memcpy(copy, object, object->class_pointer->instance_size); - return copy; -} - - diff --git a/contrib/libobjc/sarray.c b/contrib/libobjc/sarray.c deleted file mode 100644 index f5ace10bf0..0000000000 --- a/contrib/libobjc/sarray.c +++ /dev/null @@ -1,522 +0,0 @@ -/* Sparse Arrays for Objective C dispatch tables - Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC 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 "sarray.h" -#include "runtime.h" -#include -#include "assert.h" - -int nbuckets = 0; /* !T:MUTEX */ -int nindices = 0; /* !T:MUTEX */ -int narrays = 0; /* !T:MUTEX */ -int idxsize = 0; /* !T:MUTEX */ - -static void * first_free_data = NULL; /* !T:MUTEX */ - -#ifdef OBJC_SPARSE2 -const char* __objc_sparse2_id = "2 level sparse indices"; -#endif - -#ifdef OBJC_SPARSE3 -const char* __objc_sparse3_id = "3 level sparse indices"; -#endif - -#ifdef __alpha__ -const void *memcpy (void*, const void*, size_t); -#endif - -/* This function removes any structures left over from free operations - that were not safe in a multi-threaded environment. */ -void -sarray_remove_garbage(void) -{ - void **vp; - void *np; - - objc_mutex_lock(__objc_runtime_mutex); - - vp = first_free_data; - first_free_data = NULL; - - while (vp) { - np = *vp; - objc_free(vp); - vp = np; - } - - objc_mutex_unlock(__objc_runtime_mutex); -} - -/* Free a block of dynamically allocated memory. If we are in multi-threaded - mode, it is ok to free it. If not, we add it to the garbage heap to be - freed later. */ - -static void -sarray_free_garbage(void *vp) -{ - objc_mutex_lock(__objc_runtime_mutex); - - if (__objc_runtime_threads_alive == 1) { - objc_free(vp); - if (first_free_data) - sarray_remove_garbage(); - } - else { - *(void **)vp = first_free_data; - first_free_data = vp; - } - - objc_mutex_unlock(__objc_runtime_mutex); -} - -/* sarray_at_put : copies data in such a way as to be thread reader safe. */ -void -sarray_at_put(struct sarray* array, sidx index, void* element) -{ -#ifdef OBJC_SPARSE3 - struct sindex** the_index; - struct sindex* new_index; -#endif - struct sbucket** the_bucket; - struct sbucket* new_bucket; -#ifdef OBJC_SPARSE3 - size_t ioffset; -#endif - size_t boffset; - size_t eoffset; -#ifdef PRECOMPUTE_SELECTORS - union sofftype xx; - xx.idx = index; -#ifdef OBJC_SPARSE3 - ioffset = xx.off.ioffset; -#endif - boffset = xx.off.boffset; - eoffset = xx.off.eoffset; -#else /* not PRECOMPUTE_SELECTORS */ -#ifdef OBJC_SPARSE3 - ioffset = index/INDEX_CAPACITY; - boffset = (index/BUCKET_SIZE)%INDEX_SIZE; - eoffset = index%BUCKET_SIZE; -#else - boffset = index/BUCKET_SIZE; - eoffset = index%BUCKET_SIZE; -#endif -#endif /* not PRECOMPUTE_SELECTORS */ - - assert(soffset_decode(index) < array->capacity); /* Range check */ - -#ifdef OBJC_SPARSE3 - the_index = &(array->indices[ioffset]); - the_bucket = &((*the_index)->buckets[boffset]); -#else - the_bucket = &(array->buckets[boffset]); -#endif - - if ((*the_bucket)->elems[eoffset] == element) - return; /* great! we just avoided a lazy copy */ - -#ifdef OBJC_SPARSE3 - - /* First, perform lazy copy/allocation of index if needed */ - - if ((*the_index) == array->empty_index) { - - /* The index was previously empty, allocate a new */ - new_index = (struct sindex*)objc_malloc(sizeof(struct sindex)); - memcpy(new_index, array->empty_index, sizeof(struct sindex)); - new_index->version.version = array->version.version; - *the_index = new_index; /* Prepared for install. */ - the_bucket = &((*the_index)->buckets[boffset]); - - nindices += 1; - } else if ((*the_index)->version.version != array->version.version) { - - /* This index must be lazy copied */ - struct sindex* old_index = *the_index; - new_index = (struct sindex*)objc_malloc(sizeof(struct sindex)); - memcpy( new_index, old_index, sizeof(struct sindex)); - new_index->version.version = array->version.version; - *the_index = new_index; /* Prepared for install. */ - the_bucket = &((*the_index)->buckets[boffset]); - - nindices += 1; - } - -#endif /* OBJC_SPARSE3 */ - - /* next, perform lazy allocation/copy of the bucket if needed */ - - if ((*the_bucket) == array->empty_bucket) { - - /* The bucket was previously empty (or something like that), */ - /* allocate a new. This is the effect of `lazy' allocation */ - new_bucket = (struct sbucket*)objc_malloc(sizeof(struct sbucket)); - memcpy((void *) new_bucket, (const void*)array->empty_bucket, - sizeof(struct sbucket)); - new_bucket->version.version = array->version.version; - *the_bucket = new_bucket; /* Prepared for install. */ - - nbuckets += 1; - - } else if ((*the_bucket)->version.version != array->version.version) { - - /* Perform lazy copy. */ - struct sbucket* old_bucket = *the_bucket; - new_bucket = (struct sbucket*)objc_malloc(sizeof(struct sbucket)); - memcpy( new_bucket, old_bucket, sizeof(struct sbucket)); - new_bucket->version.version = array->version.version; - *the_bucket = new_bucket; /* Prepared for install. */ - - nbuckets += 1; - - } - (*the_bucket)->elems[eoffset] = element; -} - -void -sarray_at_put_safe(struct sarray* array, sidx index, void* element) -{ - if(soffset_decode(index) >= array->capacity) - sarray_realloc(array, soffset_decode(index)+1); - sarray_at_put(array, index, element); -} - -struct sarray* -sarray_new (int size, void* default_element) -{ - struct sarray* arr; -#ifdef OBJC_SPARSE3 - size_t num_indices = ((size-1)/(INDEX_CAPACITY))+1; - struct sindex ** new_indices; -#else /* OBJC_SPARSE2 */ - size_t num_indices = ((size-1)/BUCKET_SIZE)+1; - struct sbucket ** new_buckets; -#endif - int counter; - - assert(size > 0); - - /* Allocate core array */ - arr = (struct sarray*) objc_malloc(sizeof(struct sarray)); - arr->version.version = 0; - - /* Initialize members */ -#ifdef OBJC_SPARSE3 - arr->capacity = num_indices*INDEX_CAPACITY; - new_indices = (struct sindex**) - objc_malloc(sizeof(struct sindex*)*num_indices); - - arr->empty_index = (struct sindex*) objc_malloc(sizeof(struct sindex)); - arr->empty_index->version.version = 0; - - narrays += 1; - idxsize += num_indices; - nindices += 1; - -#else /* OBJC_SPARSE2 */ - arr->capacity = num_indices*BUCKET_SIZE; - new_buckets = (struct sbucket**) - objc_malloc(sizeof(struct sbucket*)*num_indices); - - narrays += 1; - idxsize += num_indices; - -#endif - - arr->empty_bucket = (struct sbucket*) objc_malloc(sizeof(struct sbucket)); - arr->empty_bucket->version.version = 0; - - nbuckets += 1; - - arr->ref_count = 1; - arr->is_copy_of = (struct sarray*)0; - - for (counter=0; counterempty_bucket->elems[counter] = default_element; - -#ifdef OBJC_SPARSE3 - for (counter=0; counterempty_index->buckets[counter] = arr->empty_bucket; - - for (counter=0; counterempty_index; - -#else /* OBJC_SPARSE2 */ - - for (counter=0; counterempty_bucket; - -#endif - -#ifdef OBJC_SPARSE3 - arr->indices = new_indices; -#else /* OBJC_SPARSE2 */ - arr->buckets = new_buckets; -#endif - - return arr; -} - - -/* Reallocate the sparse array to hold `newsize' entries - Note: We really allocate and then free. We have to do this to ensure that - any concurrent readers notice the update. */ - -void -sarray_realloc(struct sarray* array, int newsize) -{ -#ifdef OBJC_SPARSE3 - size_t old_max_index = (array->capacity-1)/INDEX_CAPACITY; - size_t new_max_index = ((newsize-1)/INDEX_CAPACITY); - size_t rounded_size = (new_max_index+1)*INDEX_CAPACITY; - - struct sindex ** new_indices; - struct sindex ** old_indices; - -#else /* OBJC_SPARSE2 */ - size_t old_max_index = (array->capacity-1)/BUCKET_SIZE; - size_t new_max_index = ((newsize-1)/BUCKET_SIZE); - size_t rounded_size = (new_max_index+1)*BUCKET_SIZE; - - struct sbucket ** new_buckets; - struct sbucket ** old_buckets; - -#endif - - int counter; - - assert(newsize > 0); - - /* The size is the same, just ignore the request */ - if(rounded_size <= array->capacity) - return; - - assert(array->ref_count == 1); /* stop if lazy copied... */ - - /* We are asked to extend the array -- allocate new bucket table, */ - /* and insert empty_bucket in newly allocated places. */ - if(rounded_size > array->capacity) - { - -#ifdef OBJC_SPARSE3 - new_max_index += 4; - rounded_size = (new_max_index+1)*INDEX_CAPACITY; - -#else /* OBJC_SPARSE2 */ - new_max_index += 4; - rounded_size = (new_max_index+1)*BUCKET_SIZE; -#endif - - /* update capacity */ - array->capacity = rounded_size; - -#ifdef OBJC_SPARSE3 - /* alloc to force re-read by any concurrent readers. */ - old_indices = array->indices; - new_indices = (struct sindex**) - objc_malloc((new_max_index+1)*sizeof(struct sindex*)); -#else /* OBJC_SPARSE2 */ - old_buckets = array->buckets; - new_buckets = (struct sbucket**) - objc_malloc((new_max_index+1)*sizeof(struct sbucket*)); -#endif - - /* copy buckets below old_max_index (they are still valid) */ - for(counter = 0; counter <= old_max_index; counter++ ) { -#ifdef OBJC_SPARSE3 - new_indices[counter] = old_indices[counter]; -#else /* OBJC_SPARSE2 */ - new_buckets[counter] = old_buckets[counter]; -#endif - } - -#ifdef OBJC_SPARSE3 - /* reset entries above old_max_index to empty_bucket */ - for(counter = old_max_index+1; counter <= new_max_index; counter++) - new_indices[counter] = array->empty_index; -#else /* OBJC_SPARSE2 */ - /* reset entries above old_max_index to empty_bucket */ - for(counter = old_max_index+1; counter <= new_max_index; counter++) - new_buckets[counter] = array->empty_bucket; -#endif - -#ifdef OBJC_SPARSE3 - /* install the new indices */ - array->indices = new_indices; -#else /* OBJC_SPARSE2 */ - array->buckets = new_buckets; -#endif - -#ifdef OBJC_SPARSE3 - /* free the old indices */ - sarray_free_garbage(old_indices); -#else /* OBJC_SPARSE2 */ - sarray_free_garbage(old_buckets); -#endif - - idxsize += (new_max_index-old_max_index); - return; - } -} - - -/* Free a sparse array allocated with sarray_new */ - -void -sarray_free(struct sarray* array) { - -#ifdef OBJC_SPARSE3 - size_t old_max_index = (array->capacity-1)/INDEX_CAPACITY; - struct sindex ** old_indices; -#else - size_t old_max_index = (array->capacity-1)/BUCKET_SIZE; - struct sbucket ** old_buckets; -#endif - int counter = 0; - - assert(array->ref_count != 0); /* Freed multiple times!!! */ - - if(--(array->ref_count) != 0) /* There exists copies of me */ - return; - -#ifdef OBJC_SPARSE3 - old_indices = array->indices; -#else - old_buckets = array->buckets; -#endif - - if((array->is_copy_of) && ((array->is_copy_of->ref_count - 1) == 0)) - sarray_free(array->is_copy_of); - - /* Free all entries that do not point to empty_bucket */ - for(counter = 0; counter <= old_max_index; counter++ ) { -#ifdef OBJC_SPARSE3 - struct sindex* idx = old_indices[counter]; - if((idx != array->empty_index) && - (idx->version.version == array->version.version)) { - int c2; - for(c2=0; c2buckets[c2]; - if((bkt != array->empty_bucket) && - (bkt->version.version == array->version.version)) - { - sarray_free_garbage(bkt); - nbuckets -= 1; - } - } - sarray_free_garbage(idx); - nindices -= 1; - } -#else /* OBJC_SPARSE2 */ - struct sbucket* bkt = array->buckets[counter]; - if ((bkt != array->empty_bucket) && - (bkt->version.version == array->version.version)) - { - sarray_free_garbage(bkt); - nbuckets -= 1; - } -#endif - } - -#ifdef OBJC_SPARSE3 - /* free empty_index */ - if(array->empty_index->version.version == array->version.version) { - sarray_free_garbage(array->empty_index); - nindices -= 1; - } -#endif - - /* free empty_bucket */ - if(array->empty_bucket->version.version == array->version.version) { - sarray_free_garbage(array->empty_bucket); - nbuckets -= 1; - } - idxsize -= (old_max_index+1); - narrays -= 1; - -#ifdef OBJC_SPARSE3 - /* free bucket table */ - sarray_free_garbage(array->indices); - -#else - /* free bucket table */ - sarray_free_garbage(array->buckets); - -#endif - - /* free array */ - sarray_free_garbage(array); -} - -/* This is a lazy copy. Only the core of the structure is actually */ -/* copied. */ - -struct sarray* -sarray_lazy_copy(struct sarray* oarr) -{ - struct sarray* arr; - -#ifdef OBJC_SPARSE3 - size_t num_indices = ((oarr->capacity-1)/INDEX_CAPACITY)+1; - struct sindex ** new_indices; -#else /* OBJC_SPARSE2 */ - size_t num_indices = ((oarr->capacity-1)/BUCKET_SIZE)+1; - struct sbucket ** new_buckets; -#endif - - /* Allocate core array */ - arr = (struct sarray*) objc_malloc(sizeof(struct sarray)); /* !!! */ - arr->version.version = oarr->version.version + 1; -#ifdef OBJC_SPARSE3 - arr->empty_index = oarr->empty_index; -#endif - arr->empty_bucket = oarr->empty_bucket; - arr->ref_count = 1; - oarr->ref_count += 1; - arr->is_copy_of = oarr; - arr->capacity = oarr->capacity; - -#ifdef OBJC_SPARSE3 - /* Copy bucket table */ - new_indices = (struct sindex**) - objc_malloc(sizeof(struct sindex*)*num_indices); - memcpy( new_indices,oarr->indices, - sizeof(struct sindex*)*num_indices); - arr->indices = new_indices; -#else - /* Copy bucket table */ - new_buckets = (struct sbucket**) - objc_malloc(sizeof(struct sbucket*)*num_indices); - memcpy( new_buckets,oarr->buckets, - sizeof(struct sbucket*)*num_indices); - arr->buckets = new_buckets; -#endif - - idxsize += num_indices; - narrays += 1; - - return arr; -} diff --git a/contrib/libobjc/selector.c b/contrib/libobjc/selector.c deleted file mode 100644 index 470a2c48cd..0000000000 --- a/contrib/libobjc/selector.c +++ /dev/null @@ -1,458 +0,0 @@ -/* GNU Objective C Runtime selector related functions - Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 "runtime.h" -#include "sarray.h" -#include "encoding.h" - -/* Initial selector hash table size. Value doesn't matter much */ -#define SELECTOR_HASH_SIZE 128 - -/* Tables mapping selector names to uid and opposite */ -static struct sarray* __objc_selector_array = 0; /* uid -> sel !T:MUTEX */ -static struct sarray* __objc_selector_names = 0; /* uid -> name !T:MUTEX */ -static cache_ptr __objc_selector_hash = 0; /* name -> uid !T:MUTEX */ - -static void register_selectors_from_list(MethodList_t); - -/* Number of selectors stored in each of the above tables */ -int __objc_selector_max_index = 0; /* !T:MUTEX */ - -void __objc_init_selector_tables() -{ - __objc_selector_array = sarray_new (SELECTOR_HASH_SIZE, 0); - __objc_selector_names = sarray_new (SELECTOR_HASH_SIZE, 0); - __objc_selector_hash - = hash_new (SELECTOR_HASH_SIZE, - (hash_func_type) hash_string, - (compare_func_type) compare_strings); -} - -/* This routine is given a class and records all of the methods in its class - structure in the record table. */ -void -__objc_register_selectors_from_class (Class class) -{ - MethodList_t method_list; - - method_list = class->methods; - while (method_list) - { - register_selectors_from_list (method_list); - method_list = method_list->method_next; - } -} - - -/* This routine is given a list of methods and records each of the methods in - the record table. This is the routine that does the actual recording - work. - - This one is only called for Class objects. For categories, - class_add_method_list is called. - */ -static void -register_selectors_from_list (MethodList_t method_list) -{ - int i = 0; - while (i < method_list->method_count) - { - Method_t method = &method_list->method_list[i]; - method->method_name - = sel_register_typed_name ((const char*)method->method_name, - method->method_types); - i += 1; - } -} - - -/* Register instance methods as class methods for root classes */ -void __objc_register_instance_methods_to_class(Class class) -{ - MethodList_t method_list; - MethodList_t class_method_list; - int max_methods_no = 16; - MethodList_t new_list; - Method_t curr_method; - - /* Only if a root class. */ - if(class->super_class) - return; - - /* Allocate a method list to hold the new class methods */ - new_list = objc_calloc(sizeof(struct objc_method_list) - + sizeof(struct objc_method[max_methods_no]), 1); - method_list = class->methods; - class_method_list = class->class_pointer->methods; - curr_method = &new_list->method_list[0]; - - /* Iterate through the method lists for the class */ - while (method_list) - { - int i; - - /* Iterate through the methods from this method list */ - for (i = 0; i < method_list->method_count; i++) - { - Method_t mth = &method_list->method_list[i]; - if (mth->method_name - && !search_for_method_in_list (class_method_list, - mth->method_name)) - { - /* This instance method isn't a class method. - Add it into the new_list. */ - *curr_method = *mth; - - /* Reallocate the method list if necessary */ - if(++new_list->method_count == max_methods_no) - new_list = - objc_realloc(new_list, sizeof(struct objc_method_list) - + sizeof(struct - objc_method[max_methods_no += 16])); - curr_method = &new_list->method_list[new_list->method_count]; - } - } - - method_list = method_list->method_next; - } - - /* If we created any new class methods - then attach the method list to the class */ - if (new_list->method_count) - { - new_list = - objc_realloc(new_list, sizeof(struct objc_method_list) - + sizeof(struct objc_method[new_list->method_count])); - new_list->method_next = class->class_pointer->methods; - class->class_pointer->methods = new_list; - } - - __objc_update_dispatch_table_for_class (class->class_pointer); -} - - -/* Returns YES iff t1 and t2 have same method types, but we ignore - the argframe layout */ -BOOL -sel_types_match (const char* t1, const char* t2) -{ - if (!t1 || !t2) - return NO; - while (*t1 && *t2) - { - if (*t1 == '+') t1++; - if (*t2 == '+') t2++; - while (isdigit(*t1)) t1++; - while (isdigit(*t2)) t2++; - /* xxx Remove these next two lines when qualifiers are put in - all selectors, not just Protocol selectors. */ - t1 = objc_skip_type_qualifiers(t1); - t2 = objc_skip_type_qualifiers(t2); - if (!*t1 && !*t2) - return YES; - if (*t1 != *t2) - return NO; - t1++; - t2++; - } - return NO; -} - -/* return selector representing name */ -SEL -sel_get_typed_uid (const char *name, const char *types) -{ - struct objc_list *l; - sidx i; - - objc_mutex_lock(__objc_runtime_mutex); - - i = (sidx) hash_value_for_key (__objc_selector_hash, name); - if (i == 0) - { - objc_mutex_unlock(__objc_runtime_mutex); - return 0; - } - - for (l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i); - l; l = l->tail) - { - SEL s = (SEL)l->head; - if (types == 0 || s->sel_types == 0) - { - if (s->sel_types == types) - { - objc_mutex_unlock(__objc_runtime_mutex); - return s; - } - } - else if (sel_types_match (s->sel_types, types)) - { - objc_mutex_unlock(__objc_runtime_mutex); - return s; - } - } - - objc_mutex_unlock(__objc_runtime_mutex); - return 0; -} - -/* Return selector representing name; prefer a selector with non-NULL type */ -SEL -sel_get_any_typed_uid (const char *name) -{ - struct objc_list *l; - sidx i; - SEL s = NULL; - - objc_mutex_lock(__objc_runtime_mutex); - - i = (sidx) hash_value_for_key (__objc_selector_hash, name); - if (i == 0) - { - objc_mutex_unlock(__objc_runtime_mutex); - return 0; - } - - for (l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i); - l; l = l->tail) - { - s = (SEL) l->head; - if (s->sel_types) - { - objc_mutex_unlock(__objc_runtime_mutex); - return s; - } - } - - objc_mutex_unlock(__objc_runtime_mutex); - return s; -} - -/* return selector representing name */ -SEL -sel_get_any_uid (const char *name) -{ - struct objc_list *l; - sidx i; - - objc_mutex_lock(__objc_runtime_mutex); - - i = (sidx) hash_value_for_key (__objc_selector_hash, name); - if (soffset_decode (i) == 0) - { - objc_mutex_unlock(__objc_runtime_mutex); - return 0; - } - - l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i); - objc_mutex_unlock(__objc_runtime_mutex); - - if (l == 0) - return 0; - - return (SEL)l->head; -} - -/* return selector representing name */ -SEL -sel_get_uid (const char *name) -{ - return sel_register_typed_name (name, 0); -} - -/* Get name of selector. If selector is unknown, the empty string "" - is returned */ -const char* -sel_get_name (SEL selector) -{ - const char *ret; - - objc_mutex_lock(__objc_runtime_mutex); - if ((soffset_decode((sidx)selector->sel_id) > 0) - && (soffset_decode((sidx)selector->sel_id) <= __objc_selector_max_index)) - ret = sarray_get_safe (__objc_selector_names, (sidx) selector->sel_id); - else - ret = 0; - objc_mutex_unlock(__objc_runtime_mutex); - return ret; -} - -BOOL -sel_is_mapped (SEL selector) -{ - unsigned int idx = soffset_decode ((sidx)selector->sel_id); - return ((idx > 0) && (idx <= __objc_selector_max_index)); -} - - -const char* -sel_get_type (SEL selector) -{ - if (selector) - return selector->sel_types; - else - return 0; -} - -/* The uninstalled dispatch table */ -extern struct sarray* __objc_uninstalled_dtable; - -/* Store the passed selector name in the selector record and return its - selector value (value returned by sel_get_uid). - Assumes that the calling function has locked down __objc_runtime_mutex. */ -/* is_const parameter tells us if the name and types parameters - are really constant or not. If YES then they are constant and - we can just store the pointers. If NO then we need to copy - name and types because the pointers may disappear later on. */ -SEL -__sel_register_typed_name (const char *name, const char *types, - struct objc_selector *orig, BOOL is_const) -{ - struct objc_selector* j; - sidx i; - struct objc_list *l; - - i = (sidx) hash_value_for_key (__objc_selector_hash, name); - if (soffset_decode (i) != 0) - { - for (l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i); - l; l = l->tail) - { - SEL s = (SEL)l->head; - if (types == 0 || s->sel_types == 0) - { - if (s->sel_types == types) - { - if (orig) - { - orig->sel_id = (void*)i; - return orig; - } - else - return s; - } - } - else if (!strcmp (s->sel_types, types)) - { - if (orig) - { - orig->sel_id = (void*)i; - return orig; - } - else - return s; - } - } - if (orig) - j = orig; - else - j = objc_malloc (sizeof (struct objc_selector)); - - j->sel_id = (void*)i; - /* Can we use the pointer or must copy types? Don't copy if NULL */ - if ((is_const) || (types == 0)) - j->sel_types = (const char*)types; - else { - j->sel_types = (char *) objc_malloc(strlen(types)+1); - strcpy((char *)j->sel_types, types); - } - l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i); - } - else - { - __objc_selector_max_index += 1; - i = soffset_encode(__objc_selector_max_index); - if (orig) - j = orig; - else - j = objc_malloc (sizeof (struct objc_selector)); - - j->sel_id = (void*)i; - /* Can we use the pointer or must copy types? Don't copy if NULL */ - if ((is_const) || (types == 0)) - j->sel_types = (const char*)types; - else { - j->sel_types = (char *) objc_malloc(strlen(types)+1); - strcpy((char *)j->sel_types, types); - } - l = 0; - } - - DEBUG_PRINTF ("Record selector %s[%s] as: %ld\n", name, types, - soffset_decode (i)); - - { - int is_new = (l == 0); - const char *new_name; - - /* Can we use the pointer or must copy name? Don't copy if NULL */ - if ((is_const) || (name == 0)) - new_name = name; - else { - new_name = (char *) objc_malloc(strlen(name)+1); - strcpy((char *)new_name, name); - } - - l = list_cons ((void*)j, l); - sarray_at_put_safe (__objc_selector_names, i, (void *) new_name); - sarray_at_put_safe (__objc_selector_array, i, (void *) l); - if (is_new) - hash_add (&__objc_selector_hash, (void *) new_name, (void *) i); - } - - sarray_realloc(__objc_uninstalled_dtable, __objc_selector_max_index+1); - - return (SEL) j; -} - -SEL -sel_register_name (const char *name) -{ - SEL ret; - - objc_mutex_lock(__objc_runtime_mutex); - /* Assume that name is not constant static memory and needs to be - copied before put into a runtime structure. is_const == NO */ - ret = __sel_register_typed_name (name, 0, 0, NO); - objc_mutex_unlock(__objc_runtime_mutex); - - return ret; -} - -SEL -sel_register_typed_name (const char *name, const char *type) -{ - SEL ret; - - objc_mutex_lock(__objc_runtime_mutex); - /* Assume that name and type are not constant static memory and need to - be copied before put into a runtime structure. is_const == NO */ - ret = __sel_register_typed_name (name, type, 0, NO); - objc_mutex_unlock(__objc_runtime_mutex); - - return ret; -} - diff --git a/contrib/libobjc/sendmsg.c b/contrib/libobjc/sendmsg.c deleted file mode 100644 index a4aa4709c7..0000000000 --- a/contrib/libobjc/sendmsg.c +++ /dev/null @@ -1,646 +0,0 @@ -/* GNU Objective C Runtime message lookup - Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 "tconfig.h" -#include "runtime.h" -#include "sarray.h" -#include "encoding.h" -#include "runtime-info.h" - -/* this is how we hack STRUCT_VALUE to be 1 or 0 */ -#define gen_rtx(args...) 1 -#define gen_rtx_MEM(args...) 1 -#define rtx int - -#if !defined(STRUCT_VALUE) || STRUCT_VALUE == 0 -#define INVISIBLE_STRUCT_RETURN 1 -#else -#define INVISIBLE_STRUCT_RETURN 0 -#endif - -/* The uninstalled dispatch table */ -struct sarray* __objc_uninstalled_dtable = 0; /* !T:MUTEX */ - -/* Send +initialize to class */ -static void __objc_send_initialize(Class); - -static void __objc_install_dispatch_table_for_class (Class); - -/* Forward declare some functions */ -static void __objc_init_install_dtable(id, SEL); - -/* Various forwarding functions that are used based upon the - return type for the selector. - __objc_block_forward for structures. - __objc_double_forward for floats/doubles. - __objc_word_forward for pointers or types that fit in registers. - */ -static double __objc_double_forward(id, SEL, ...); -static id __objc_word_forward(id, SEL, ...); -typedef struct { id many[8]; } __big; -#if INVISIBLE_STRUCT_RETURN -static __big -#else -static id -#endif -__objc_block_forward(id, SEL, ...); -static Method_t search_for_method_in_hierarchy (Class class, SEL sel); -Method_t search_for_method_in_list(MethodList_t list, SEL op); -id nil_method(id, SEL, ...); - -/* Given a selector, return the proper forwarding implementation. */ -__inline__ -IMP -__objc_get_forward_imp (SEL sel) -{ - const char *t = sel->sel_types; - - if (t && (*t == '[' || *t == '(' || *t == '{') -#ifdef OBJC_MAX_STRUCT_BY_VALUE - && objc_sizeof_type(t) > OBJC_MAX_STRUCT_BY_VALUE -#endif - ) - return (IMP)__objc_block_forward; - else if (t && (*t == 'f' || *t == 'd')) - return (IMP)__objc_double_forward; - else - return (IMP)__objc_word_forward; -} - -/* Given a class and selector, return the selector's implementation. */ -__inline__ -IMP -get_imp (Class class, SEL sel) -{ - void* res = sarray_get_safe (class->dtable, (size_t) sel->sel_id); - if (res == 0) - { - /* Not a valid method */ - if(class->dtable == __objc_uninstalled_dtable) - { - /* The dispatch table needs to be installed. */ - objc_mutex_lock(__objc_runtime_mutex); - __objc_install_dispatch_table_for_class (class); - objc_mutex_unlock(__objc_runtime_mutex); - /* Call ourselves with the installed dispatch table - and get the real method */ - res = get_imp(class, sel); - } - else - { - /* The dispatch table has been installed so the - method just doesn't exist for the class. - Return the forwarding implementation. */ - res = __objc_get_forward_imp(sel); - } - } - return res; -} - -/* Query if an object can respond to a selector, returns YES if the -object implements the selector otherwise NO. Does not check if the -method can be forwarded. */ -__inline__ -BOOL -__objc_responds_to (id object, SEL sel) -{ - void* res; - - /* Install dispatch table if need be */ - if (object->class_pointer->dtable == __objc_uninstalled_dtable) - { - objc_mutex_lock(__objc_runtime_mutex); - __objc_install_dispatch_table_for_class (object->class_pointer); - objc_mutex_unlock(__objc_runtime_mutex); - } - - /* Get the method from the dispatch table */ - res = sarray_get_safe (object->class_pointer->dtable, (size_t) sel->sel_id); - return (res != 0); -} - -/* This is the lookup function. All entries in the table are either a - valid method *or* zero. If zero then either the dispatch table - needs to be installed or it doesn't exist and forwarding is attempted. */ -__inline__ -IMP -objc_msg_lookup(id receiver, SEL op) -{ - IMP result; - if(receiver) - { - result = sarray_get_safe (receiver->class_pointer->dtable, - (sidx)op->sel_id); - if (result == 0) - { - /* Not a valid method */ - if(receiver->class_pointer->dtable == __objc_uninstalled_dtable) - { - /* The dispatch table needs to be installed. - This happens on the very first method call to the class. */ - __objc_init_install_dtable(receiver, op); - - /* Get real method for this in newly installed dtable */ - result = get_imp(receiver->class_pointer, op); - } - else - { - /* The dispatch table has been installed so the - method just doesn't exist for the class. - Attempt to forward the method. */ - result = __objc_get_forward_imp(op); - } - } - return result; - } - else - return nil_method; -} - -IMP -objc_msg_lookup_super (Super_t super, SEL sel) -{ - if (super->self) - return get_imp (super->class, sel); - else - return nil_method; -} - -int method_get_sizeof_arguments (Method*); - -retval_t -objc_msg_sendv(id object, SEL op, arglist_t arg_frame) -{ - Method* m = class_get_instance_method(object->class_pointer, op); - const char *type; - *((id*)method_get_first_argument (m, arg_frame, &type)) = object; - *((SEL*)method_get_next_argument (arg_frame, &type)) = op; - return __builtin_apply((apply_t)m->method_imp, - arg_frame, - method_get_sizeof_arguments (m)); -} - -void -__objc_init_dispatch_tables() -{ - __objc_uninstalled_dtable - = sarray_new(200, 0); -} - -/* This function is called by objc_msg_lookup when the - dispatch table needs to be installed; thus it is called once - for each class, namely when the very first message is sent to it. */ -static void -__objc_init_install_dtable(id receiver, SEL op) -{ - /* This may happen, if the programmer has taken the address of a - method before the dtable was initialized... too bad for him! */ - if(receiver->class_pointer->dtable != __objc_uninstalled_dtable) - return; - - objc_mutex_lock(__objc_runtime_mutex); - - if(CLS_ISCLASS(receiver->class_pointer)) - { - /* receiver is an ordinary object */ - assert(CLS_ISCLASS(receiver->class_pointer)); - - /* install instance methods table */ - __objc_install_dispatch_table_for_class (receiver->class_pointer); - - /* call +initialize -- this will in turn install the factory - dispatch table if not already done :-) */ - __objc_send_initialize(receiver->class_pointer); - } - else - { - /* receiver is a class object */ - assert(CLS_ISCLASS((Class)receiver)); - assert(CLS_ISMETA(receiver->class_pointer)); - - /* Install real dtable for factory methods */ - __objc_install_dispatch_table_for_class (receiver->class_pointer); - - __objc_send_initialize((Class)receiver); - } - objc_mutex_unlock(__objc_runtime_mutex); -} - -/* Install dummy table for class which causes the first message to - that class (or instances hereof) to be initialized properly */ -void -__objc_install_premature_dtable(Class class) -{ - assert(__objc_uninstalled_dtable); - class->dtable = __objc_uninstalled_dtable; -} - -/* Send +initialize to class if not already done */ -static void -__objc_send_initialize(Class class) -{ - /* This *must* be a class object */ - assert(CLS_ISCLASS(class)); - assert(!CLS_ISMETA(class)); - - if (!CLS_ISINITIALIZED(class)) - { - CLS_SETINITIALIZED(class); - CLS_SETINITIALIZED(class->class_pointer); - - /* Create the garbage collector type memory description */ - __objc_generate_gc_type_description (class); - - if(class->super_class) - __objc_send_initialize(class->super_class); - - { - SEL op = sel_register_name ("initialize"); - IMP imp = 0; - MethodList_t method_list = class->class_pointer->methods; - - while (method_list) { - int i; - Method_t method; - - for (i = 0; i< method_list->method_count; i++) { - method = &(method_list->method_list[i]); - if (method->method_name - && method->method_name->sel_id == op->sel_id) { - imp = method->method_imp; - break; - } - } - - if (imp) - break; - - method_list = method_list->method_next; - - } - if (imp) - (*imp)((id)class, op); - - } - } -} - -/* Walk on the methods list of class and install the methods in the reverse - order of the lists. Since methods added by categories are before the methods - of class in the methods list, this allows categories to substitute methods - declared in class. However if more than one category replaces the same - method nothing is guaranteed about what method will be used. - Assumes that __objc_runtime_mutex is locked down. */ -static void -__objc_install_methods_in_dtable (Class class, MethodList_t method_list) -{ - int i; - - if (!method_list) - return; - - if (method_list->method_next) - __objc_install_methods_in_dtable (class, method_list->method_next); - - for (i = 0; i < method_list->method_count; i++) - { - Method_t method = &(method_list->method_list[i]); - sarray_at_put_safe (class->dtable, - (sidx) method->method_name->sel_id, - method->method_imp); - } -} - -/* Assumes that __objc_runtime_mutex is locked down. */ -static void -__objc_install_dispatch_table_for_class (Class class) -{ - Class super; - - /* If the class has not yet had its class links resolved, we must - re-compute all class links */ - if(!CLS_ISRESOLV(class)) - __objc_resolve_class_links(); - - super = class->super_class; - - if (super != 0 && (super->dtable == __objc_uninstalled_dtable)) - __objc_install_dispatch_table_for_class (super); - - /* Allocate dtable if necessary */ - if (super == 0) - { - objc_mutex_lock(__objc_runtime_mutex); - class->dtable = sarray_new (__objc_selector_max_index, 0); - objc_mutex_unlock(__objc_runtime_mutex); - } - else - class->dtable = sarray_lazy_copy (super->dtable); - - __objc_install_methods_in_dtable (class, class->methods); -} - -void -__objc_update_dispatch_table_for_class (Class class) -{ - Class next; - struct sarray *arr; - - /* not yet installed -- skip it */ - if (class->dtable == __objc_uninstalled_dtable) - return; - - objc_mutex_lock(__objc_runtime_mutex); - - arr = class->dtable; - __objc_install_premature_dtable (class); /* someone might require it... */ - sarray_free (arr); /* release memory */ - - /* could have been lazy... */ - __objc_install_dispatch_table_for_class (class); - - if (class->subclass_list) /* Traverse subclasses */ - for (next = class->subclass_list; next; next = next->sibling_class) - __objc_update_dispatch_table_for_class (next); - - objc_mutex_unlock(__objc_runtime_mutex); -} - - -/* This function adds a method list to a class. This function is - typically called by another function specific to the run-time. As - such this function does not worry about thread safe issues. - - This one is only called for categories. Class objects have their - methods installed right away, and their selectors are made into - SEL's by the function __objc_register_selectors_from_class. */ -void -class_add_method_list (Class class, MethodList_t list) -{ - int i; - - /* Passing of a linked list is not allowed. Do multiple calls. */ - assert (!list->method_next); - - /* Check for duplicates. */ - for (i = 0; i < list->method_count; ++i) - { - Method_t method = &list->method_list[i]; - - if (method->method_name) /* Sometimes these are NULL */ - { - /* This is where selector names are transmogrified to SEL's */ - method->method_name = - sel_register_typed_name ((const char*)method->method_name, - method->method_types); - } - } - - /* Add the methods to the class's method list. */ - list->method_next = class->methods; - class->methods = list; - - /* Update the dispatch table of class */ - __objc_update_dispatch_table_for_class (class); -} - -Method_t -class_get_instance_method(Class class, SEL op) -{ - return search_for_method_in_hierarchy(class, op); -} - -Method_t -class_get_class_method(MetaClass class, SEL op) -{ - return search_for_method_in_hierarchy(class, op); -} - - -/* Search for a method starting from the current class up its hierarchy. - Return a pointer to the method's method structure if found. NULL - otherwise. */ - -static Method_t -search_for_method_in_hierarchy (Class cls, SEL sel) -{ - Method_t method = NULL; - Class class; - - if (! sel_is_mapped (sel)) - return NULL; - - /* Scan the method list of the class. If the method isn't found in the - list then step to its super class. */ - for (class = cls; ((! method) && class); class = class->super_class) - method = search_for_method_in_list (class->methods, sel); - - return method; -} - - - -/* Given a linked list of method and a method's name. Search for the named - method's method structure. Return a pointer to the method's method - structure if found. NULL otherwise. */ -Method_t -search_for_method_in_list (MethodList_t list, SEL op) -{ - MethodList_t method_list = list; - - if (! sel_is_mapped (op)) - return NULL; - - /* If not found then we'll search the list. */ - while (method_list) - { - int i; - - /* Search the method list. */ - for (i = 0; i < method_list->method_count; ++i) - { - Method_t method = &method_list->method_list[i]; - - if (method->method_name) - if (method->method_name->sel_id == op->sel_id) - return method; - } - - /* The method wasn't found. Follow the link to the next list of - methods. */ - method_list = method_list->method_next; - } - - return NULL; -} - -static retval_t __objc_forward (id object, SEL sel, arglist_t args); - -/* Forwarding pointers/integers through the normal registers */ -static id -__objc_word_forward (id rcv, SEL op, ...) -{ - void *args, *res; - - args = __builtin_apply_args (); - res = __objc_forward (rcv, op, args); - if (res) - __builtin_return (res); - else - return res; -} - -/* Specific routine for forwarding floats/double because of - architectural differences on some processors. i386s for - example which uses a floating point stack versus general - registers for floating point numbers. This forward routine - makes sure that GCC restores the proper return values */ -static double -__objc_double_forward (id rcv, SEL op, ...) -{ - void *args, *res; - - args = __builtin_apply_args (); - res = __objc_forward (rcv, op, args); - __builtin_return (res); -} - -#if INVISIBLE_STRUCT_RETURN -static __big -#else -static id -#endif -__objc_block_forward (id rcv, SEL op, ...) -{ - void *args, *res; - - args = __builtin_apply_args (); - res = __objc_forward (rcv, op, args); - if (res) - __builtin_return (res); - else -#if INVISIBLE_STRUCT_RETURN - return (__big) {{0, 0, 0, 0, 0, 0, 0, 0}}; -#else - return nil; -#endif -} - - -/* This function is installed in the dispatch table for all methods which are - not implemented. Thus, it is called when a selector is not recognized. */ -static retval_t -__objc_forward (id object, SEL sel, arglist_t args) -{ - IMP imp; - static SEL frwd_sel = 0; /* !T:SAFE2 */ - SEL err_sel; - - /* first try if the object understands forward:: */ - if (!frwd_sel) - frwd_sel = sel_get_any_uid("forward::"); - - if (__objc_responds_to (object, frwd_sel)) - { - imp = get_imp(object->class_pointer, frwd_sel); - return (*imp)(object, frwd_sel, sel, args); - } - - /* If the object recognizes the doesNotRecognize: method then we're going - to send it. */ - err_sel = sel_get_any_uid ("doesNotRecognize:"); - if (__objc_responds_to (object, err_sel)) - { - imp = get_imp (object->class_pointer, err_sel); - return (*imp) (object, err_sel, sel); - } - - /* The object doesn't recognize the method. Check for responding to - error:. If it does then sent it. */ - { - size_t strlen (const char*); - char msg[256 + strlen ((const char*)sel_get_name (sel)) - + strlen ((const char*)object->class_pointer->name)]; - - sprintf (msg, "(%s) %s does not recognize %s", - (CLS_ISMETA(object->class_pointer) - ? "class" - : "instance" ), - object->class_pointer->name, sel_get_name (sel)); - - err_sel = sel_get_any_uid ("error:"); - if (__objc_responds_to (object, err_sel)) - { - imp = get_imp (object->class_pointer, err_sel); - return (*imp) (object, sel_get_any_uid ("error:"), msg); - } - - /* The object doesn't respond to doesNotRecognize: or error:; Therefore, - a default action is taken. */ - objc_error (object, OBJC_ERR_UNIMPLEMENTED, "%s\n", msg); - - return 0; - } -} - -void -__objc_print_dtable_stats() -{ - int total = 0; - - objc_mutex_lock(__objc_runtime_mutex); - -#ifdef OBJC_SPARSE2 - printf("memory usage: (%s)\n", "2-level sparse arrays"); -#else - printf("memory usage: (%s)\n", "3-level sparse arrays"); -#endif - - printf("arrays: %d = %ld bytes\n", narrays, - (long)narrays*sizeof(struct sarray)); - total += narrays*sizeof(struct sarray); - printf("buckets: %d = %ld bytes\n", nbuckets, - (long)nbuckets*sizeof(struct sbucket)); - total += nbuckets*sizeof(struct sbucket); - - printf("idxtables: %d = %ld bytes\n", idxsize, (long)idxsize*sizeof(void*)); - total += idxsize*sizeof(void*); - printf("-----------------------------------\n"); - printf("total: %d bytes\n", total); - printf("===================================\n"); - - objc_mutex_unlock(__objc_runtime_mutex); -} - -/* Returns the uninstalled dispatch table indicator. - If a class' dispatch table points to __objc_uninstalled_dtable - then that means it needs its dispatch table to be installed. */ -__inline__ -struct sarray* -objc_get_uninstalled_dtable() -{ - return __objc_uninstalled_dtable; -} diff --git a/contrib/libobjc/thr-dce.c b/contrib/libobjc/thr-dce.c deleted file mode 100644 index 3fa5b9b1b3..0000000000 --- a/contrib/libobjc/thr-dce.c +++ /dev/null @@ -1,281 +0,0 @@ -/* GNU Objective C Runtime Thread Interface - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 -#include -#include "runtime.h" - -/* Key structure for maintaining thread specific storage */ -static pthread_key_t _objc_thread_storage; - -/* Backend initialization functions */ - -/* Initialize the threads subsystem. */ -int -__objc_init_thread_system(void) -{ - /* Initialize the thread storage key */ - return pthread_keycreate(&_objc_thread_storage, NULL); -} - -/* Close the threads subsystem. */ -int -__objc_close_thread_system(void) -{ - /* Destroy the thread storage key */ - /* Not implemented yet */ - /* return pthread_key_delete(&_objc_thread_storage); */ - return 0; -} - -/* Backend thread functions */ - -/* Create a new thread of execution. */ -objc_thread_t -__objc_thread_detach(void (*func)(void *arg), void *arg) -{ - objc_thread_t thread_id; - pthread_t new_thread_handle; - - if (pthread_create(&new_thread_handle, pthread_attr_default, - (void *)func, arg) == 0) - { - /* ??? May not work! (64bit) */ - thread_id = *(objc_thread_t *)&new_thread_handle; - pthread_detach(&new_thread_handle); /* Fully detach thread. */ - } - else - thread_id = NULL; - - return thread_id; -} - -/* Set the current thread's priority. */ -int -__objc_thread_set_priority(int priority) -{ - int sys_priority = 0; - - switch (priority) - { - case OBJC_THREAD_INTERACTIVE_PRIORITY: - sys_priority = (PRI_FG_MIN_NP + PRI_FG_MAX_NP) / 2; - break; - default: - case OBJC_THREAD_BACKGROUND_PRIORITY: - sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2; - break; - case OBJC_THREAD_LOW_PRIORITY: - sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2; - break; - } - - /* Change the priority. */ - if (pthread_setprio(pthread_self(), sys_priority) >= 0) - return 0; - else - /* Failed */ - return -1; -} - -/* Return the current thread's priority. */ -int -__objc_thread_get_priority(void) -{ - int sys_priority; - - if ((sys_priority = pthread_getprio(pthread_self())) >= 0) { - if (sys_priority >= PRI_FG_MIN_NP && sys_priority <= PRI_FG_MAX_NP) - return OBJC_THREAD_INTERACTIVE_PRIORITY; - if (sys_priority >= PRI_BG_MIN_NP && sys_priority <= PRI_BG_MAX_NP) - return OBJC_THREAD_BACKGROUND_PRIORITY; - return OBJC_THREAD_LOW_PRIORITY; - } - - /* Failed */ - return -1; -} - -/* Yield our process time to another thread. */ -void -__objc_thread_yield(void) -{ - pthread_yield(); -} - -/* Terminate the current thread. */ -int -__objc_thread_exit(void) -{ - /* exit the thread */ - pthread_exit(&__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; -} - -/* Returns an integer value which uniquely describes a thread. */ -objc_thread_t -__objc_thread_id(void) -{ - pthread_t self = pthread_self(); - - return (objc_thread_t) pthread_getunique_np (&self); -} - -/* Sets the thread's local storage pointer. */ -int -__objc_thread_set_data(void *value) -{ - return pthread_setspecific(_objc_thread_storage, value); -} - -/* Returns the thread's local storage pointer. */ -void * -__objc_thread_get_data(void) -{ - void *value = NULL; - - if ( !(pthread_getspecific(_objc_thread_storage, &value)) ) - return value; - - return NULL; -} - -/* Backend mutex functions */ - -/* Allocate a mutex. */ -int -__objc_mutex_allocate(objc_mutex_t mutex) -{ - if (pthread_mutex_init((pthread_mutex_t *)(&(mutex->backend)), - pthread_mutexattr_default)) - return -1; - else - return 0; -} - -/* Deallocate a mutex. */ -int -__objc_mutex_deallocate(objc_mutex_t mutex) -{ - if (pthread_mutex_destroy((pthread_mutex_t *)(&(mutex->backend)))) - return -1; - else - return 0; -} - -/* Grab a lock on a mutex. */ -int -__objc_mutex_lock(objc_mutex_t mutex) -{ - return pthread_mutex_lock((pthread_mutex_t *)(&(mutex->backend))); -} - -/* Try to grab a lock on a mutex. */ -int -__objc_mutex_trylock(objc_mutex_t mutex) -{ - if (pthread_mutex_trylock((pthread_mutex_t *)(&(mutex->backend))) != 1) - return -1; - else - return 0; -} - -/* Unlock the mutex */ -int -__objc_mutex_unlock(objc_mutex_t mutex) -{ - return pthread_mutex_unlock((pthread_mutex_t *)(&(mutex->backend))); -} - -/* Backend condition mutex functions */ - -/* Allocate a condition. */ -int -__objc_condition_allocate(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; - - /* - if (pthread_cond_init((pthread_cond_t *)(&(condition->backend)), NULL)) - return -1; - else - return 0; - */ -} - -/* Deallocate a condition. */ -int -__objc_condition_deallocate(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_destroy((pthread_cond_t *)(&(condition->backend))); - */ -} - -/* Wait on the condition */ -int -__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) -{ - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_wait((pthread_cond_t *)(&(condition->backend)), - (pthread_mutex_t *)(&(mutex->backend))); - */ -} - -/* Wake up all threads waiting on this condition. */ -int -__objc_condition_broadcast(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_broadcast((pthread_cond_t *)(&(condition->backend))); - */ -} - -/* Wake up one thread waiting on this condition. */ -int -__objc_condition_signal(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_signal((pthread_cond_t *)(&(condition->backend))); - */ -} - -/* End of File */ diff --git a/contrib/libobjc/thr-decosf1.c b/contrib/libobjc/thr-decosf1.c deleted file mode 100644 index 0f7063b7e8..0000000000 --- a/contrib/libobjc/thr-decosf1.c +++ /dev/null @@ -1,281 +0,0 @@ -/* GNU Objective C Runtime Thread Interface - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 -#include -#include "runtime.h" - -/* Key structure for maintaining thread specific storage */ -static pthread_key_t _objc_thread_storage; - -/* Backend initialization functions */ - -/* Initialize the threads subsystem. */ -int -__objc_init_thread_system(void) -{ - /* Initialize the thread storage key */ - return pthread_keycreate(&_objc_thread_storage, NULL); -} - -/* Close the threads subsystem. */ -int -__objc_close_thread_system(void) -{ - /* Destroy the thread storage key */ - /* Not implemented yet */ - /* return pthread_key_delete(&_objc_thread_storage); */ - return 0; -} - -/* Backend thread functions */ - -/* Create a new thread of execution. */ -objc_thread_t -__objc_thread_detach(void (*func)(void *arg), void *arg) -{ - objc_thread_t thread_id; - pthread_t new_thread_handle; - - if (pthread_create(&new_thread_handle, pthread_attr_default, - (void *)func, arg) == 0) - { - /* ??? May not work! (64bit) */ - thread_id = *(objc_thread_t *)&new_thread_handle; - pthread_detach(&new_thread_handle); /* Fully detach thread. */ - } - else - thread_id = NULL; - - return thread_id; -} - -/* Set the current thread's priority. */ -int -__objc_thread_set_priority(int priority) -{ - int sys_priority = 0; - - switch (priority) - { - case OBJC_THREAD_INTERACTIVE_PRIORITY: - sys_priority = (PRI_FG_MIN_NP + PRI_FG_MAX_NP) / 2; - break; - default: - case OBJC_THREAD_BACKGROUND_PRIORITY: - sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2; - break; - case OBJC_THREAD_LOW_PRIORITY: - sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2; - break; - } - - /* Change the priority. */ - if (pthread_setprio(pthread_self(), sys_priority) >= 0) - return 0; - else - /* Failed */ - return -1; -} - -/* Return the current thread's priority. */ -int -__objc_thread_get_priority(void) -{ - int sys_priority; - - if ((sys_priority = pthread_getprio(pthread_self())) >= 0) { - if (sys_priority >= PRI_FG_MIN_NP && sys_priority <= PRI_FG_MAX_NP) - return OBJC_THREAD_INTERACTIVE_PRIORITY; - if (sys_priority >= PRI_BG_MIN_NP && sys_priority <= PRI_BG_MAX_NP) - return OBJC_THREAD_BACKGROUND_PRIORITY; - return OBJC_THREAD_LOW_PRIORITY; - } - - /* Failed */ - return -1; -} - -/* Yield our process time to another thread. */ -void -__objc_thread_yield(void) -{ - pthread_yield(); -} - -/* Terminate the current thread. */ -int -__objc_thread_exit(void) -{ - /* exit the thread */ - pthread_exit(&__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; -} - -/* Returns an integer value which uniquely describes a thread. */ -objc_thread_t -__objc_thread_id(void) -{ - pthread_t self = pthread_self(); - - return (objc_thread_t) pthread_getunique_np (&self); -} - -/* Sets the thread's local storage pointer. */ -int -__objc_thread_set_data(void *value) -{ - return pthread_setspecific(_objc_thread_storage, value); -} - -/* Returns the thread's local storage pointer. */ -void * -__objc_thread_get_data(void) -{ - void *value = NULL; - - if ( !(pthread_getspecific(_objc_thread_storage, &value)) ) - return value; - - return NULL; -} - -/* Backend mutex functions */ - -/* Allocate a mutex. */ -int -__objc_mutex_allocate(objc_mutex_t mutex) -{ - if (pthread_mutex_init((pthread_mutex_t *)(&(mutex->backend)), - pthread_mutexattr_default)) - return -1; - else - return 0; -} - -/* Deallocate a mutex. */ -int -__objc_mutex_deallocate(objc_mutex_t mutex) -{ - if (pthread_mutex_destroy((pthread_mutex_t *)(&(mutex->backend)))) - return -1; - else - return 0; -} - -/* Grab a lock on a mutex. */ -int -__objc_mutex_lock(objc_mutex_t mutex) -{ - return pthread_mutex_lock((pthread_mutex_t *)(&(mutex->backend))); -} - -/* Try to grab a lock on a mutex. */ -int -__objc_mutex_trylock(objc_mutex_t mutex) -{ - if (pthread_mutex_trylock((pthread_mutex_t *)(&(mutex->backend))) != 1) - return -1; - else - return 0; -} - -/* Unlock the mutex */ -int -__objc_mutex_unlock(objc_mutex_t mutex) -{ - return pthread_mutex_unlock((pthread_mutex_t *)(&(mutex->backend))); -} - -/* Backend condition mutex functions */ - -/* Allocate a condition. */ -int -__objc_condition_allocate(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; - - /* - if (pthread_cond_init((pthread_cond_t *)(&(condition->backend)), NULL)) - return -1; - else - return 0; - */ -} - -/* Deallocate a condition. */ -int -__objc_condition_deallocate(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_destroy((pthread_cond_t *)(&(condition->backend))); - */ -} - -/* Wait on the condition */ -int -__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) -{ - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_wait((pthread_cond_t *)(&(condition->backend)), - (pthread_mutex_t *)(&(mutex->backend))); - */ -} - -/* Wake up all threads waiting on this condition. */ -int -__objc_condition_broadcast(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_broadcast((pthread_cond_t *)(&(condition->backend))); - */ -} - -/* Wake up one thread waiting on this condition. */ -int -__objc_condition_signal(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_signal((pthread_cond_t *)(&(condition->backend))); - */ -} - -/* End of File */ diff --git a/contrib/libobjc/thr-irix.c b/contrib/libobjc/thr-irix.c deleted file mode 100644 index 528a3e3a43..0000000000 --- a/contrib/libobjc/thr-irix.c +++ /dev/null @@ -1,235 +0,0 @@ -/* GNU Objective C Runtime Thread Interface - SGI IRIX Implementation - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 -#include -#include -#include -#include -#include -#include "runtime.h" - -/* Key structure for maintaining thread specific storage */ -static void * __objc_shared_arena_handle = NULL; - -/* Backend initialization functions */ - -/* Initialize the threads subsystem. */ -int -__objc_init_thread_system(void) -{ - /* Name of IRIX arena. */ - char arena_name[64]; - - DEBUG_PRINTF("__objc_init_thread_system\n"); - - /* Construct a temporary name for arena. */ - sprintf(arena_name, "/usr/tmp/objc_%05u", (unsigned)getpid()); - - /* Up to 256 threads. Arena only for threads. */ - usconfig(CONF_INITUSERS, 256); - usconfig(CONF_ARENATYPE, US_SHAREDONLY); - - /* Initialize the arena */ - if (!(__objc_shared_arena_handle = usinit(arena_name))) - /* Failed */ - return -1; - - return 0; -} - -/* Close the threads subsystem. */ -int -__objc_close_thread_system(void) -{ - return 0; -} - -/* Backend thread functions */ - -/* Create a new thread of execution. */ -objc_thread_t -__objc_thread_detach(void (*func)(void *arg), void *arg) -{ - objc_thread_t thread_id; - int sys_id; - - if ((sys_id = sproc((void *)func, PR_SALL, arg)) >= 0) - thread_id = (objc_thread_t)sys_id; - else - thread_id = NULL; - - return thread_id; -} - -/* Set the current thread's priority. */ -int -__objc_thread_set_priority(int priority) -{ - /* Not implemented yet */ - return -1; -} - -/* Return the current thread's priority. */ -int -__objc_thread_get_priority(void) -{ - /* Not implemented yet */ - return OBJC_THREAD_INTERACTIVE_PRIORITY; -} - -/* Yield our process time to another thread. */ -void -__objc_thread_yield(void) -{ - sginap(0); -} - -/* Terminate the current thread. */ -int -__objc_thread_exit(void) -{ - /* IRIX only has exit. */ - exit(__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; -} - -/* Returns an integer value which uniquely describes a thread. */ -objc_thread_t -__objc_thread_id(void) -{ - /* Threads are processes. */ - return (objc_thread_t)get_pid(); -} - -/* Sets the thread's local storage pointer. */ -int -__objc_thread_set_data(void *value) -{ - *((void **)&PRDA->usr_prda) = value; - return 0; -} - -/* Returns the thread's local storage pointer. */ -void * -__objc_thread_get_data(void) -{ - return *((void **)&PRDA->usr_prda); -} - -/* Backend mutex functions */ - -/* Allocate a mutex. */ -int -__objc_mutex_allocate(objc_mutex_t mutex) -{ - if (!( (ulock_t)(mutex->backend) = usnewlock(__objc_shared_arena_handle) )) - return -1; - else - return 0; -} - -/* Deallocate a mutex. */ -int -__objc_mutex_deallocate(objc_mutex_t mutex) -{ - usfreelock((ulock_t)(mutex->backend), __objc_shared_arena_handle); - return 0; -} - -/* Grab a lock on a mutex. */ -int -__objc_mutex_lock(objc_mutex_t mutex) -{ - if (ussetlock((ulock_t)(mutex->backend)) == 0) - return -1; - else - return 0; -} - -/* Try to grab a lock on a mutex. */ -int -__objc_mutex_trylock(objc_mutex_t mutex) -{ - if (ustestlock((ulock_t)(mutex->backend)) == 0) - return -1; - else - return 0; -} - -/* Unlock the mutex */ -int -__objc_mutex_unlock(objc_mutex_t mutex) -{ - usunsetlock((ulock_t)(mutex->backend)); - return 0; -} - -/* Backend condition mutex functions */ - -/* Allocate a condition. */ -int -__objc_condition_allocate(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; -} - -/* Deallocate a condition. */ -int -__objc_condition_deallocate(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; -} - -/* Wait on the condition */ -int -__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) -{ - /* Unimplemented. */ - return -1; -} - -/* Wake up all threads waiting on this condition. */ -int -__objc_condition_broadcast(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; -} - -/* Wake up one thread waiting on this condition. */ -int -__objc_condition_signal(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; -} - -/* End of File */ diff --git a/contrib/libobjc/thr-mach.c b/contrib/libobjc/thr-mach.c deleted file mode 100644 index 44af0c1e28..0000000000 --- a/contrib/libobjc/thr-mach.c +++ /dev/null @@ -1,312 +0,0 @@ -/* GNU Objective C Runtime Thread Implementation - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) - Modified for Mach threads by Bill Bumgarner - Condition functions added by Mircea Oancea - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 -#include -#include -#include "runtime.h" - -/* - Obtain the maximum thread priority that can set for t. Under the - mach threading model, it is possible for the developer to adjust the - maximum priority downward only-- cannot be raised without superuser - privileges. Once lowered, it cannot be raised. - */ -static int __mach_get_max_thread_priority(cthread_t t, int *base) -{ - thread_t threadP; - kern_return_t error; - struct thread_sched_info info; - unsigned int info_count=THREAD_SCHED_INFO_COUNT; - - if (t == NULL) - return -1; - - threadP = cthread_thread(t); /* get thread underlying */ - - error=thread_info(threadP, THREAD_SCHED_INFO, - (thread_info_t)&info, &info_count); - - if (error != KERN_SUCCESS) - return -1; - - if (base != NULL) - *base = info.base_priority; - - return info.max_priority; -} - -/* Backend initialization functions */ - -/* Initialize the threads subsystem. */ -int -__objc_init_thread_system(void) -{ - return 0; -} - -/* Close the threads subsystem. */ -int -__objc_close_thread_system(void) -{ - return 0; -} - -/* Backend thread functions */ - -/* Create a new thread of execution. */ -objc_thread_t -__objc_thread_detach(void (*func)(void *arg), void *arg) -{ - objc_thread_t thread_id; - cthread_t new_thread_handle; - - /* create thread */ - new_thread_handle = cthread_fork((cthread_fn_t)func, arg); - - if(new_thread_handle) - { - /* this is not terribly portable */ - thread_id = *(objc_thread_t *)&new_thread_handle; - cthread_detach(new_thread_handle); - } - else - thread_id = NULL; - - return thread_id; -} - -/* Set the current thread's priority. */ -int -__objc_thread_set_priority(int priority) -{ - objc_thread_t *t = objc_thread_id(); - cthread_t cT = (cthread_t) t; - int maxPriority = __mach_get_max_thread_priority(cT, NULL); - int sys_priority = 0; - - if (maxPriority == -1) - return -1; - - switch (priority) - { - case OBJC_THREAD_INTERACTIVE_PRIORITY: - sys_priority = maxPriority; - break; - case OBJC_THREAD_BACKGROUND_PRIORITY: - sys_priority = (maxPriority * 2) / 3; - break; - case OBJC_THREAD_LOW_PRIORITY: - sys_priority = maxPriority / 3; - break; - default: - return -1; - } - - if (sys_priority == 0) - return -1; - - /* Change the priority */ - if (cthread_priority(cT, sys_priority, 0) == KERN_SUCCESS) - return 0; - else - return -1; -} - -/* Return the current thread's priority. */ -int -__objc_thread_get_priority(void) -{ - objc_thread_t *t = objc_thread_id(); - cthread_t cT = (cthread_t) t; /* see objc_thread_id() */ - int basePriority; - int maxPriority; - int sys_priority = 0; - - int interactiveT, backgroundT, lowT; /* thresholds */ - - maxPriority = __mach_get_max_thread_priority(cT, &basePriority); - - if(maxPriority == -1) - return -1; - - if (basePriority > ( (maxPriority * 2) / 3)) - return OBJC_THREAD_INTERACTIVE_PRIORITY; - - if (basePriority > ( maxPriority / 3)) - return OBJC_THREAD_BACKGROUND_PRIORITY; - - return OBJC_THREAD_LOW_PRIORITY; -} - -/* Yield our process time to another thread. */ -void -__objc_thread_yield(void) -{ - cthread_yield(); -} - -/* Terminate the current thread. */ -int -__objc_thread_exit(void) -{ - /* exit the thread */ - cthread_exit(&__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; -} - -/* Returns an integer value which uniquely describes a thread. */ -objc_thread_t -__objc_thread_id(void) -{ - cthread_t self = cthread_self(); - - return *(objc_thread_t *)&self; -} - -/* Sets the thread's local storage pointer. */ -int -__objc_thread_set_data(void *value) -{ - cthread_set_data(cthread_self(), (any_t) value); - return 0; -} - -/* Returns the thread's local storage pointer. */ -void * -__objc_thread_get_data(void) -{ - return (void *) cthread_data(cthread_self()); -} - -/* Backend mutex functions */ - -/* Allocate a mutex. */ -int -__objc_mutex_allocate(objc_mutex_t mutex) -{ - int err = 0; - mutex->backend = objc_malloc(sizeof(struct mutex)); - - err = mutex_init((mutex_t)(mutex->backend)); - - if (err != 0) - { - objc_free(mutex->backend); - return -1; - } - else - return 0; -} - -/* Deallocate a mutex. */ -int -__objc_mutex_deallocate(objc_mutex_t mutex) -{ - mutex_clear((mutex_t)(mutex->backend)); - - objc_free(mutex->backend); - mutex->backend = NULL; - return 0; -} - -/* Grab a lock on a mutex. */ -int -__objc_mutex_lock(objc_mutex_t mutex) -{ - mutex_lock((mutex_t)(mutex->backend)); - return 0; -} - -/* Try to grab a lock on a mutex. */ -int -__objc_mutex_trylock(objc_mutex_t mutex) -{ - if (mutex_try_lock((mutex_t)(mutex->backend)) == 0) - return -1; - else - return 0; -} - -/* Unlock the mutex */ -int -__objc_mutex_unlock(objc_mutex_t mutex) -{ - mutex_unlock((mutex_t)(mutex->backend)); - return 0; -} - -/* Backend condition mutex functions */ - -/* Allocate a condition. */ -int -__objc_condition_allocate(objc_condition_t condition) -{ - condition->backend = objc_malloc(sizeof(struct condition)); - condition_init((condition_t)(condition->backend)); - return 0; -} - -/* Deallocate a condition. */ -int -__objc_condition_deallocate(objc_condition_t condition) -{ - condition_clear((condition_t)(condition->backend)); - objc_free(condition->backend); - condition->backend = NULL; - return 0; -} - -/* Wait on the condition */ -int -__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) -{ - condition_wait((condition_t)(condition->backend), - (mutex_t)(mutex->backend)); - return 0; -} - -/* Wake up all threads waiting on this condition. */ -int -__objc_condition_broadcast(objc_condition_t condition) -{ - condition_broadcast((condition_t)(condition->backend)); - return 0; -} - -/* Wake up one thread waiting on this condition. */ -int -__objc_condition_signal(objc_condition_t condition) -{ - condition_signal((condition_t)(condition->backend)); - return 0; -} - -/* End of File */ diff --git a/contrib/libobjc/thr-os2.c b/contrib/libobjc/thr-os2.c deleted file mode 100644 index a0d7d43661..0000000000 --- a/contrib/libobjc/thr-os2.c +++ /dev/null @@ -1,267 +0,0 @@ -/* GNU Objective C Runtime Thread Interface - OS/2 emx Implementation - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Thomas Baier (baier@ci.tuwien.ac.at) - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 -#include "runtime.h" - -#define INCL_DOSSEMAPHORES -#define INCL_DOSPROCESS - -/* - * conflicts with objc.h: SEL, BOOL, id - * solution: prefixing those with _OS2_ before including - */ -#define SEL _OS2_SEL -#define BOOL _OS2_BOOL -#define id _OS2_id -#include -#undef id -#undef SEL -#undef BOOL - -#include - -/* Backend initialization functions */ - -/* Initialize the threads subsystem. */ -int -__objc_init_thread_system(void) -{ - return 0; -} - -/* Close the threads subsystem. */ -int -__objc_close_thread_system(void) -{ - return 0; -} - -/* Backend thread functions */ - -/* Create a new thread of execution. */ -objc_thread_t -__objc_thread_detach(void (*func)(void *arg), void *arg) -{ - int thread_id = 0; - - if ((thread_id = _beginthread (func,NULL,32768,arg)) < 0) - thread_id = 0; - - return (objc_thread_t)thread_id; -} - -/* Set the current thread's priority. */ -int -__objc_thread_set_priority(int priority) -{ - ULONG sys_class = 0; - ULONG sys_priority = 0; - - /* OBJC_THREAD_INTERACTIVE_PRIORITY -> PRTYC_FOREGROUNDSERVER - * OBJC_THREAD_BACKGROUND_PRIORITY -> PRTYC_REGULAR - * OBJC_THREAD_LOW_PRIORITY -> PRTYC_IDLETIME */ - - switch (priority) { - case OBJC_THREAD_INTERACTIVE_PRIORITY: - sys_class = PRTYC_REGULAR; - sys_priority = 10; - break; - default: - case OBJC_THREAD_BACKGROUND_PRIORITY: - sys_class = PRTYC_IDLETIME; - sys_priority = 25; - break; - case OBJC_THREAD_LOW_PRIORITY: - sys_class = PRTYC_IDLETIME; - sys_priority = 0; - break; - } - - /* Change priority */ - if (!DosSetPriority (PRTYS_THREAD,sys_class,sys_priority,*_threadid)) - return 0; - else - return -1; -} - -/* Return the current thread's priority. */ -int -__objc_thread_get_priority(void) -{ - PTIB ptib; - PPIB ppib; - - /* get information about current thread */ - DosGetInfoBlocks (&ptib,&ppib); - - switch (ptib->tib_ptib2->tib2_ulpri) - { - case PRTYC_IDLETIME: - case PRTYC_REGULAR: - case PRTYC_TIMECRITICAL: - case PRTYC_FOREGROUNDSERVER: - default: - return OBJC_THREAD_INTERACTIVE_PRIORITY; - } - - return -1; -} - -/* Yield our process time to another thread. */ -void -__objc_thread_yield(void) -{ - DosSleep (0); -} - -/* Terminate the current thread. */ -int -__objc_thread_exit(void) -{ - /* terminate the thread, NEVER use DosExit () */ - _endthread (); - - /* Failed if we reached here */ - return -1; -} - -/* Returns an integer value which uniquely describes a thread. */ -objc_thread_t -__objc_thread_id(void) -{ - return (objc_thread_t) *_threadid; -} - -/* Sets the thread's local storage pointer. */ -int -__objc_thread_set_data(void *value) -{ - *_threadstore () = value; - - return 0; -} - -/* Returns the thread's local storage pointer. */ -void * -__objc_thread_get_data(void) -{ - return *_threadstore (); -} - -/* Backend mutex functions */ - -/* Allocate a mutex. */ -int -__objc_mutex_allocate(objc_mutex_t mutex) -{ - if (DosCreateMutexSem (NULL, (HMTX)(&(mutex->backend)),0L,0) > 0) - return -1; - else - return 0; -} - -/* Deallocate a mutex. */ -int -__objc_mutex_deallocate(objc_mutex_t mutex) -{ - DosCloseMutexSem ((HMTX)(mutex->backend)); - return 0; -} - -/* Grab a lock on a mutex. */ -int -__objc_mutex_lock(objc_mutex_t mutex) -{ - if (DosRequestMutexSem ((HMTX)(mutex->backend),-1L) != 0) - return -1; - else - return 0; -} - -/* Try to grab a lock on a mutex. */ -int -__objc_mutex_trylock(objc_mutex_t mutex) -{ - if (DosRequestMutexSem ((HMTX)(mutex->backend),0L) != 0) - return -1; - else - return 0; -} - -/* Unlock the mutex */ -int -__objc_mutex_unlock(objc_mutex_t mutex) -{ - if (DosReleaseMutexSem((HMTX)(mutex->backend)) != 0) - return -1; - else - return 0; -} - -/* Backend condition mutex functions */ - -/* Allocate a condition. */ -int -__objc_condition_allocate(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; -} - -/* Deallocate a condition. */ -int -__objc_condition_deallocate(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; -} - -/* Wait on the condition */ -int -__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) -{ - /* Unimplemented. */ - return -1; -} - -/* Wake up all threads waiting on this condition. */ -int -__objc_condition_broadcast(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; -} - -/* Wake up one thread waiting on this condition. */ -int -__objc_condition_signal(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; -} - -/* End of File */ diff --git a/contrib/libobjc/thr-posix.c b/contrib/libobjc/thr-posix.c deleted file mode 100644 index 5b40f711be..0000000000 --- a/contrib/libobjc/thr-posix.c +++ /dev/null @@ -1,229 +0,0 @@ -/* GNU Objective C Runtime Thread Interface for POSIX compliant threads - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) - Modified for Linux/Pthreads by Kai-Uwe Sattler (kus@iti.cs.uni-magdeburg.de) - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 -#include "runtime.h" -#include - -/* Key structure for maintaining thread specific storage */ -static pthread_key_t _objc_thread_storage; - -/* Backend initialization functions */ - -/* Initialize the threads subsystem. */ -int -__objc_init_thread_system(void) -{ - /* Initialize the thread storage key */ - return pthread_key_create(&_objc_thread_storage, NULL); -} - -/* Close the threads subsystem. */ -int -__objc_close_thread_system(void) -{ - return 0; -} - -/* Backend thread functions */ - -/* Create a new thread of execution. */ -objc_thread_t -__objc_thread_detach(void (*func)(void *arg), void *arg) -{ - objc_thread_t thread_id; - pthread_t new_thread_handle; - - if ( !(pthread_create(&new_thread_handle, NULL, (void *)func, arg)) ) - thread_id = *(objc_thread_t *)&new_thread_handle; - else - thread_id = NULL; - - return thread_id; -} - -/* Set the current thread's priority. */ -int -__objc_thread_set_priority(int priority) -{ - /* Not implemented yet */ - return -1; -} - -/* Return the current thread's priority. */ -int -__objc_thread_get_priority(void) -{ - /* Not implemented yet */ - return -1; -} - -/* Yield our process time to another thread. */ -void -__objc_thread_yield(void) -{ - sched_yield(); -} - -/* Terminate the current thread. */ -int -__objc_thread_exit(void) -{ - /* exit the thread */ - pthread_exit(&__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; -} - -/* Returns an integer value which uniquely describes a thread. */ -objc_thread_t -__objc_thread_id(void) -{ - pthread_t self = pthread_self(); - - return *(objc_thread_t *)&self; -} - -/* Sets the thread's local storage pointer. */ -int -__objc_thread_set_data(void *value) -{ - return pthread_setspecific(_objc_thread_storage, value); -} - -/* Returns the thread's local storage pointer. */ -void * -__objc_thread_get_data(void) -{ - return pthread_getspecific(_objc_thread_storage); -} - -/* Backend mutex functions */ - -/* Allocate a mutex. */ -int -__objc_mutex_allocate(objc_mutex_t mutex) -{ - mutex->backend = objc_malloc(sizeof(pthread_mutex_t)); - - if (pthread_mutex_init((pthread_mutex_t *)mutex->backend, NULL)) - { - objc_free(mutex->backend); - mutex->backend = NULL; - return -1; - } - - return 0; -} - -/* Deallocate a mutex. */ -int -__objc_mutex_deallocate(objc_mutex_t mutex) -{ - if (pthread_mutex_destroy((pthread_mutex_t *)mutex->backend)) - return -1; - - objc_free(mutex->backend); - mutex->backend = NULL; - return 0; -} - -/* Grab a lock on a mutex. */ -int -__objc_mutex_lock(objc_mutex_t mutex) -{ - return pthread_mutex_lock((pthread_mutex_t *)mutex->backend); -} - -/* Try to grab a lock on a mutex. */ -int -__objc_mutex_trylock(objc_mutex_t mutex) -{ - return pthread_mutex_trylock((pthread_mutex_t *)mutex->backend); -} - -/* Unlock the mutex */ -int -__objc_mutex_unlock(objc_mutex_t mutex) -{ - return pthread_mutex_unlock((pthread_mutex_t *)mutex->backend); -} - -/* Backend condition mutex functions */ - -/* Allocate a condition. */ -int -__objc_condition_allocate(objc_condition_t condition) -{ - condition->backend = objc_malloc(sizeof(pthread_cond_t)); - - if (pthread_cond_init((pthread_cond_t *)condition->backend, NULL)) - { - objc_free(condition->backend); - condition->backend = NULL; - return -1; - } - - return 0; -} - -/* Deallocate a condition. */ -int -__objc_condition_deallocate(objc_condition_t condition) -{ - if (pthread_cond_destroy((pthread_cond_t *)condition->backend)) - return -1; - - objc_free(condition->backend); - condition->backend = NULL; - return 0; -} - -/* Wait on the condition */ -int -__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) -{ - return pthread_cond_wait((pthread_cond_t *)condition->backend, - (pthread_mutex_t *)mutex->backend); -} - -/* Wake up all threads waiting on this condition. */ -int -__objc_condition_broadcast(objc_condition_t condition) -{ - return pthread_cond_broadcast((pthread_cond_t *)condition->backend); -} - -/* Wake up one thread waiting on this condition. */ -int -__objc_condition_signal(objc_condition_t condition) -{ - return pthread_cond_signal((pthread_cond_t *)condition->backend); -} - -/* End of File */ diff --git a/contrib/libobjc/thr-pthreads.c b/contrib/libobjc/thr-pthreads.c deleted file mode 100644 index 2efdd15bc5..0000000000 --- a/contrib/libobjc/thr-pthreads.c +++ /dev/null @@ -1,218 +0,0 @@ -/* GNU Objective C Runtime Thread Implementation for PCThreads under GNU/Linux. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Scott Christley - Condition functions added by: Mircea Oancea - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 -#include -#include "runtime.h" - -/* Key structure for maintaining thread specific storage */ -static pthread_key_t _objc_thread_storage; - -/* Backend initialization functions */ - -/* Initialize the threads subsystem. */ -int -__objc_init_thread_system(void) -{ - /* Initialize the thread storage key */ - return pthread_key_create(&_objc_thread_storage, NULL); -} - -/* Close the threads subsystem. */ -int -__objc_close_thread_system(void) -{ - /* Destroy the thread storage key */ - /* Not implemented yet */ - /* return pthread_key_delete(&_objc_thread_storage); */ - return 0; -} - -/* Backend thread functions */ - -/* Create a new thread of execution. */ -objc_thread_t -__objc_thread_detach(void (*func)(void *arg), void *arg) -{ - objc_thread_t thread_id; - pthread_t new_thread_handle; - - if ( !(pthread_create(&new_thread_handle, NULL, (void *)func, arg)) ) - thread_id = *(objc_thread_t *)&new_thread_handle; - else - thread_id = NULL; - - return thread_id; -} - -/* Set the current thread's priority. */ -int -__objc_thread_set_priority(int priority) -{ - /* Not implemented yet */ - return -1; -} - -/* Return the current thread's priority. */ -int -__objc_thread_get_priority(void) -{ - /* Not implemented yet */ - return OBJC_THREAD_INTERACTIVE_PRIORITY; -} - -/* Yield our process time to another thread. */ -void -__objc_thread_yield(void) -{ - pthread_yield(NULL); -} - -/* Terminate the current thread. */ -int -__objc_thread_exit(void) -{ - /* exit the thread */ - pthread_exit(&__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; -} - -/* Returns an integer value which uniquely describes a thread. */ -objc_thread_t -__objc_thread_id(void) -{ - pthread_t self = pthread_self(); - - return *(objc_thread_t *)&self; -} - -/* Sets the thread's local storage pointer. */ -int -__objc_thread_set_data(void *value) -{ - return pthread_setspecific(_objc_thread_storage, value); -} - -/* Returns the thread's local storage pointer. */ -void * -__objc_thread_get_data(void) -{ - void *value = NULL; - - if ( !(pthread_getspecific(_objc_thread_storage, &value)) ) - return value; - - return NULL; -} - -/* Backend mutex functions */ - -/* Allocate a mutex. */ -int -__objc_mutex_allocate(objc_mutex_t mutex) -{ - if (pthread_mutex_init((pthread_mutex_t *)(&(mutex->backend)), NULL)) - return -1; - else - return 0; -} - -/* Deallocate a mutex. */ -int -__objc_mutex_deallocate(objc_mutex_t mutex) -{ - if (pthread_mutex_destroy((pthread_mutex_t *)(&(mutex->backend)))) - return -1; - else - return 0; -} - -/* Grab a lock on a mutex. */ -int -__objc_mutex_lock(objc_mutex_t mutex) -{ - return pthread_mutex_lock((pthread_mutex_t *)(&(mutex->backend))); -} - -/* Try to grab a lock on a mutex. */ -int -__objc_mutex_trylock(objc_mutex_t mutex) -{ - return pthread_mutex_trylock((pthread_mutex_t *)(&(mutex->backend))); -} - -/* Unlock the mutex */ -int -__objc_mutex_unlock(objc_mutex_t mutex) -{ - return pthread_mutex_unlock((pthread_mutex_t *)(&(mutex->backend))); -} - -/* Backend condition mutex functions */ - -/* Allocate a condition. */ -int -__objc_condition_allocate(objc_condition_t condition) -{ - if (pthread_cond_init((pthread_cond_t *)(&(condition->backend)), NULL)) - return -1; - else - return 0; -} - -/* Deallocate a condition. */ -int -__objc_condition_deallocate(objc_condition_t condition) -{ - return pthread_cond_destroy((pthread_cond_t *)(&(condition->backend))); -} - -/* Wait on the condition */ -int -__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) -{ - return pthread_cond_wait((pthread_cond_t *)(&(condition->backend)), - (pthread_mutex_t *)(&(mutex->backend))); -} - -/* Wake up all threads waiting on this condition. */ -int -__objc_condition_broadcast(objc_condition_t condition) -{ - return pthread_cond_broadcast((pthread_cond_t *)(&(condition->backend))); -} - -/* Wake up one thread waiting on this condition. */ -int -__objc_condition_signal(objc_condition_t condition) -{ - return pthread_cond_signal((pthread_cond_t *)(&(condition->backend))); -} - -/* End of File */ diff --git a/contrib/libobjc/thr-single.c b/contrib/libobjc/thr-single.c deleted file mode 100644 index b196677c6b..0000000000 --- a/contrib/libobjc/thr-single.c +++ /dev/null @@ -1,192 +0,0 @@ -/* GNU Objective C Runtime Thread Implementation - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 -#include "runtime.h" - -/* Thread local storage for a single thread */ -static void *thread_local_storage = NULL; - -/* Backend initialization functions */ - -/* Initialize the threads subsystem. */ -int -__objc_init_thread_system(void) -{ - /* No thread support available */ - return -1; -} - -/* Close the threads subsystem. */ -int -__objc_close_thread_system(void) -{ - /* No thread support available */ - return -1; -} - -/* Backend thread functions */ - -/* Create a new thread of execution. */ -objc_thread_t -__objc_thread_detach(void (*func)(void *arg), void *arg) -{ - /* No thread support available */ - return NULL; -} - -/* Set the current thread's priority. */ -int -__objc_thread_set_priority(int priority) -{ - /* No thread support available */ - return -1; -} - -/* Return the current thread's priority. */ -int -__objc_thread_get_priority(void) -{ - return OBJC_THREAD_INTERACTIVE_PRIORITY; -} - -/* Yield our process time to another thread. */ -void -__objc_thread_yield(void) -{ - return; -} - -/* Terminate the current thread. */ -int -__objc_thread_exit(void) -{ - /* No thread support available */ - /* Should we really exit the program */ - /* exit(&__objc_thread_exit_status); */ - return -1; -} - -/* Returns an integer value which uniquely describes a thread. */ -objc_thread_t -__objc_thread_id(void) -{ - /* No thread support, use 1. */ - return (objc_thread_t)1; -} - -/* Sets the thread's local storage pointer. */ -int -__objc_thread_set_data(void *value) -{ - thread_local_storage = value; - return 0; -} - -/* Returns the thread's local storage pointer. */ -void * -__objc_thread_get_data(void) -{ - return thread_local_storage; -} - -/* Backend mutex functions */ - -/* Allocate a mutex. */ -int -__objc_mutex_allocate(objc_mutex_t mutex) -{ - return 0; -} - -/* Deallocate a mutex. */ -int -__objc_mutex_deallocate(objc_mutex_t mutex) -{ - return 0; -} - -/* Grab a lock on a mutex. */ -int -__objc_mutex_lock(objc_mutex_t mutex) -{ - /* There can only be one thread, so we always get the lock */ - return 0; -} - -/* Try to grab a lock on a mutex. */ -int -__objc_mutex_trylock(objc_mutex_t mutex) -{ - /* There can only be one thread, so we always get the lock */ - return 0; -} - -/* Unlock the mutex */ -int -__objc_mutex_unlock(objc_mutex_t mutex) -{ - return 0; -} - -/* Backend condition mutex functions */ - -/* Allocate a condition. */ -int -__objc_condition_allocate(objc_condition_t condition) -{ - return 0; -} - -/* Deallocate a condition. */ -int -__objc_condition_deallocate(objc_condition_t condition) -{ - return 0; -} - -/* Wait on the condition */ -int -__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) -{ - return 0; -} - -/* Wake up all threads waiting on this condition. */ -int -__objc_condition_broadcast(objc_condition_t condition) -{ - return 0; -} - -/* Wake up one thread waiting on this condition. */ -int -__objc_condition_signal(objc_condition_t condition) -{ - return 0; -} - -/* End of File */ diff --git a/contrib/libobjc/thr-solaris.c b/contrib/libobjc/thr-solaris.c deleted file mode 100644 index 90351b43cf..0000000000 --- a/contrib/libobjc/thr-solaris.c +++ /dev/null @@ -1,259 +0,0 @@ -/* GNU Objective C Runtime Thread Interface - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) - Conditions added by Mircea Oancea (mircea@first.elcom.pub.ro) - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 -#include "runtime.h" - -#include -#include -#include - -/* Key structure for maintaining thread specific storage */ -static thread_key_t __objc_thread_data_key; - -/* Backend initialization functions */ - -/* Initialize the threads subsystem. */ -int -__objc_init_thread_system(void) -{ - /* Initialize the thread storage key */ - if (thr_keycreate(&__objc_thread_data_key, NULL) == 0) - return 0; - else - return -1; -} - -/* Close the threads subsystem. */ -int -__objc_close_thread_system(void) -{ - return 0; -} - -/* Backend thread functions */ - -/* Create a new thread of execution. */ -objc_thread_t -__objc_thread_detach(void (*func)(void *arg), void *arg) -{ - objc_thread_t thread_id; - thread_t new_thread_id = 0; - - if (thr_create(NULL, 0, (void *)func, arg, - THR_DETACHED | THR_NEW_LWP, - &new_thread_id) == 0) - thread_id = *(objc_thread_t *)&new_thread_id; - else - thread_id = NULL; - - return thread_id; -} - -/* Set the current thread's priority. */ -int -__objc_thread_set_priority(int priority) -{ - int sys_priority = 0; - - switch (priority) - { - case OBJC_THREAD_INTERACTIVE_PRIORITY: - sys_priority = 300; - break; - default: - case OBJC_THREAD_BACKGROUND_PRIORITY: - sys_priority = 200; - break; - case OBJC_THREAD_LOW_PRIORITY: - sys_priority = 1000; - break; - } - - /* Change priority */ - if (thr_setprio(thr_self(), sys_priority) == 0) - return 0; - else - return -1; -} - -/* Return the current thread's priority. */ -int -__objc_thread_get_priority(void) -{ - int sys_priority; - - if (thr_getprio(thr_self(), &sys_priority) == 0) - { - if (sys_priority >= 250) - return OBJC_THREAD_INTERACTIVE_PRIORITY; - else if (sys_priority >= 150) - return OBJC_THREAD_BACKGROUND_PRIORITY; - return OBJC_THREAD_LOW_PRIORITY; - } - - /* Couldn't get priority. */ - return -1; -} - -/* Yield our process time to another thread. */ -void -__objc_thread_yield(void) -{ - thr_yield(); -} - -/* Terminate the current thread. */ -int -__objc_thread_exit(void) -{ - /* exit the thread */ - thr_exit(&__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; -} - -/* Returns an integer value which uniquely describes a thread. */ -objc_thread_t -__objc_thread_id(void) -{ - return (objc_thread_t)thr_self(); -} - -/* Sets the thread's local storage pointer. */ -int -__objc_thread_set_data(void *value) -{ - if (thr_setspecific(__objc_thread_data_key, value) == 0) - return 0; - else - return -1; -} - -/* Returns the thread's local storage pointer. */ -void * -__objc_thread_get_data(void) -{ - void *value = NULL; - - if (thr_getspecific(__objc_thread_data_key, &value) == 0) - return value; - - return NULL; -} - -/* Backend mutex functions */ - -/* Allocate a mutex. */ -int -__objc_mutex_allocate(objc_mutex_t mutex) -{ - if (mutex_init( (mutex_t *)(&(mutex->backend)), USYNC_THREAD, 0)) - return -1; - else - return 0; -} - - -/* Deallocate a mutex. */ -int -__objc_mutex_deallocate(objc_mutex_t mutex) -{ - mutex_destroy((mutex_t *)(&(mutex->backend))); - return 0; -} - -/* Grab a lock on a mutex. */ -int -__objc_mutex_lock(objc_mutex_t mutex) -{ - if (mutex_lock((mutex_t *)(&(mutex->backend))) != 0) - return -1; - else - return 0; -} - -/* Try to grab a lock on a mutex. */ -int -__objc_mutex_trylock(objc_mutex_t mutex) -{ - if (mutex_trylock((mutex_t *)(&(mutex->backend))) != 0) - return -1; - else - return 0; -} - -/* Unlock the mutex */ -int -__objc_mutex_unlock(objc_mutex_t mutex) -{ - if (mutex_unlock((mutex_t *)(&(mutex->backend))) != 0) - return -1; - else - return 0; -} - -/* Backend condition mutex functions */ - -/* Allocate a condition. */ -int -__objc_condition_allocate(objc_condition_t condition) -{ - return cond_init((cond_t *)(&(condition->backend)), USYNC_THREAD, NULL); -} - -/* Deallocate a condition. */ -int -__objc_condition_deallocate(objc_condition_t condition) -{ - return cond_destroy((cond_t *)(&(condition->backend))); -} - -/* Wait on the condition */ -int -__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) -{ - return cond_wait((cond_t *)(&(condition->backend)), - (mutex_t *)(&(mutex->backend))); -} - -/* Wake up all threads waiting on this condition. */ -int -__objc_condition_broadcast(objc_condition_t condition) -{ - return cond_broadcast((cond_t *)(&(condition->backend))); -} - -/* Wake up one thread waiting on this condition. */ -int -__objc_condition_signal(objc_condition_t condition) -{ - return cond_signal((cond_t *)(&(condition->backend))); -} - -/* End of File */ diff --git a/contrib/libobjc/thr-vxworks.c b/contrib/libobjc/thr-vxworks.c deleted file mode 100644 index b196677c6b..0000000000 --- a/contrib/libobjc/thr-vxworks.c +++ /dev/null @@ -1,192 +0,0 @@ -/* GNU Objective C Runtime Thread Implementation - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 -#include "runtime.h" - -/* Thread local storage for a single thread */ -static void *thread_local_storage = NULL; - -/* Backend initialization functions */ - -/* Initialize the threads subsystem. */ -int -__objc_init_thread_system(void) -{ - /* No thread support available */ - return -1; -} - -/* Close the threads subsystem. */ -int -__objc_close_thread_system(void) -{ - /* No thread support available */ - return -1; -} - -/* Backend thread functions */ - -/* Create a new thread of execution. */ -objc_thread_t -__objc_thread_detach(void (*func)(void *arg), void *arg) -{ - /* No thread support available */ - return NULL; -} - -/* Set the current thread's priority. */ -int -__objc_thread_set_priority(int priority) -{ - /* No thread support available */ - return -1; -} - -/* Return the current thread's priority. */ -int -__objc_thread_get_priority(void) -{ - return OBJC_THREAD_INTERACTIVE_PRIORITY; -} - -/* Yield our process time to another thread. */ -void -__objc_thread_yield(void) -{ - return; -} - -/* Terminate the current thread. */ -int -__objc_thread_exit(void) -{ - /* No thread support available */ - /* Should we really exit the program */ - /* exit(&__objc_thread_exit_status); */ - return -1; -} - -/* Returns an integer value which uniquely describes a thread. */ -objc_thread_t -__objc_thread_id(void) -{ - /* No thread support, use 1. */ - return (objc_thread_t)1; -} - -/* Sets the thread's local storage pointer. */ -int -__objc_thread_set_data(void *value) -{ - thread_local_storage = value; - return 0; -} - -/* Returns the thread's local storage pointer. */ -void * -__objc_thread_get_data(void) -{ - return thread_local_storage; -} - -/* Backend mutex functions */ - -/* Allocate a mutex. */ -int -__objc_mutex_allocate(objc_mutex_t mutex) -{ - return 0; -} - -/* Deallocate a mutex. */ -int -__objc_mutex_deallocate(objc_mutex_t mutex) -{ - return 0; -} - -/* Grab a lock on a mutex. */ -int -__objc_mutex_lock(objc_mutex_t mutex) -{ - /* There can only be one thread, so we always get the lock */ - return 0; -} - -/* Try to grab a lock on a mutex. */ -int -__objc_mutex_trylock(objc_mutex_t mutex) -{ - /* There can only be one thread, so we always get the lock */ - return 0; -} - -/* Unlock the mutex */ -int -__objc_mutex_unlock(objc_mutex_t mutex) -{ - return 0; -} - -/* Backend condition mutex functions */ - -/* Allocate a condition. */ -int -__objc_condition_allocate(objc_condition_t condition) -{ - return 0; -} - -/* Deallocate a condition. */ -int -__objc_condition_deallocate(objc_condition_t condition) -{ - return 0; -} - -/* Wait on the condition */ -int -__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) -{ - return 0; -} - -/* Wake up all threads waiting on this condition. */ -int -__objc_condition_broadcast(objc_condition_t condition) -{ - return 0; -} - -/* Wake up one thread waiting on this condition. */ -int -__objc_condition_signal(objc_condition_t condition) -{ - return 0; -} - -/* End of File */ diff --git a/contrib/libobjc/thr-win32.c b/contrib/libobjc/thr-win32.c deleted file mode 100644 index 8570ffd997..0000000000 --- a/contrib/libobjc/thr-win32.c +++ /dev/null @@ -1,272 +0,0 @@ -/* GNU Objective C Runtime Thread Interface - Win32 Implementation - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 -#include "runtime.h" - -#ifndef __OBJC__ -#define __OBJC__ -#endif -#include - -/* Key structure for maintaining thread specific storage */ -static DWORD __objc_data_tls = (DWORD)-1; - -/* Backend initialization functions */ - -/* Initialize the threads subsystem. */ -int -__objc_init_thread_system(void) -{ - /* Initialize the thread storage key */ - if ((__objc_data_tls = TlsAlloc()) != (DWORD)-1) - return 0; - else - return -1; -} - -/* Close the threads subsystem. */ -int -__objc_close_thread_system(void) -{ - if (__objc_data_tls != (DWORD)-1) - TlsFree(__objc_data_tls); - return 0; -} - -/* Backend thread functions */ - -/* Create a new thread of execution. */ -objc_thread_t -__objc_thread_detach(void (*func)(void *arg), void *arg) -{ - DWORD thread_id = 0; - HANDLE win32_handle; - - if (!(win32_handle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, - arg, 0, &thread_id))) - thread_id = 0; - - return (objc_thread_t)thread_id; -} - -/* Set the current thread's priority. */ -int -__objc_thread_set_priority(int priority) -{ - int sys_priority = 0; - - switch (priority) - { - case OBJC_THREAD_INTERACTIVE_PRIORITY: - sys_priority = THREAD_PRIORITY_NORMAL; - break; - default: - case OBJC_THREAD_BACKGROUND_PRIORITY: - sys_priority = THREAD_PRIORITY_BELOW_NORMAL; - break; - case OBJC_THREAD_LOW_PRIORITY: - sys_priority = THREAD_PRIORITY_LOWEST; - break; - } - - /* Change priority */ - if (SetThreadPriority(GetCurrentThread(), sys_priority)) - return 0; - else - return -1; -} - -/* Return the current thread's priority. */ -int -__objc_thread_get_priority(void) -{ - int sys_priority; - - sys_priority = GetThreadPriority(GetCurrentThread()); - - switch (sys_priority) - { - case THREAD_PRIORITY_HIGHEST: - case THREAD_PRIORITY_TIME_CRITICAL: - case THREAD_PRIORITY_ABOVE_NORMAL: - case THREAD_PRIORITY_NORMAL: - return OBJC_THREAD_INTERACTIVE_PRIORITY; - - default: - case THREAD_PRIORITY_BELOW_NORMAL: - return OBJC_THREAD_BACKGROUND_PRIORITY; - - case THREAD_PRIORITY_IDLE: - case THREAD_PRIORITY_LOWEST: - return OBJC_THREAD_LOW_PRIORITY; - } - - /* Couldn't get priority. */ - return -1; -} - -/* Yield our process time to another thread. */ -void -__objc_thread_yield(void) -{ - Sleep(0); -} - -/* Terminate the current thread. */ -int -__objc_thread_exit(void) -{ - /* exit the thread */ - ExitThread(__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; -} - -/* Returns an integer value which uniquely describes a thread. */ -objc_thread_t -__objc_thread_id(void) -{ - return (objc_thread_t)GetCurrentThreadId(); -} - -/* Sets the thread's local storage pointer. */ -int -__objc_thread_set_data(void *value) -{ - if (TlsSetValue(__objc_data_tls, value)) - return 0; - else - return -1; -} - -/* Returns the thread's local storage pointer. */ -void * -__objc_thread_get_data(void) -{ - return TlsGetValue(__objc_data_tls); /* Return thread data. */ -} - -/* Backend mutex functions */ - -/* Allocate a mutex. */ -int -__objc_mutex_allocate(objc_mutex_t mutex) -{ - if ((mutex->backend = (void *)CreateMutex(NULL, 0, NULL)) == NULL) - return -1; - else - return 0; -} - -/* Deallocate a mutex. */ -int -__objc_mutex_deallocate(objc_mutex_t mutex) -{ - CloseHandle((HANDLE)(mutex->backend)); - return 0; -} - -/* Grab a lock on a mutex. */ -int -__objc_mutex_lock(objc_mutex_t mutex) -{ - int status; - - status = WaitForSingleObject((HANDLE)(mutex->backend), INFINITE); - if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED) - return -1; - else - return 0; -} - -/* Try to grab a lock on a mutex. */ -int -__objc_mutex_trylock(objc_mutex_t mutex) -{ - int status; - - status = WaitForSingleObject((HANDLE)(mutex->backend), 0); - if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED) - return -1; - else - return 0; -} - -/* Unlock the mutex */ -int -__objc_mutex_unlock(objc_mutex_t mutex) -{ - if (ReleaseMutex((HANDLE)(mutex->backend)) == 0) - return -1; - else - return 0; -} - -/* Backend condition mutex functions */ - -/* Allocate a condition. */ -int -__objc_condition_allocate(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; -} - -/* Deallocate a condition. */ -int -__objc_condition_deallocate(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; -} - -/* Wait on the condition */ -int -__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) -{ - /* Unimplemented. */ - return -1; -} - -/* Wake up all threads waiting on this condition. */ -int -__objc_condition_broadcast(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; -} - -/* Wake up one thread waiting on this condition. */ -int -__objc_condition_signal(objc_condition_t condition) -{ - /* Unimplemented. */ - return -1; -} - -/* End of File */ diff --git a/contrib/libobjc/thr.c b/contrib/libobjc/thr.c deleted file mode 100644 index f1c957aaa1..0000000000 --- a/contrib/libobjc/thr.c +++ /dev/null @@ -1,534 +0,0 @@ -/* GNU Objective C Runtime Thread Interface - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC 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 -#include "runtime.h" - -/* Global exit status. */ -int __objc_thread_exit_status = 0; - -/* Flag which lets us know if we ever became multi threaded */ -int __objc_is_multi_threaded = 0; - -/* The hook function called when the runtime becomes multi threaded */ -objc_thread_callback _objc_became_multi_threaded = NULL; - -/* - Use this to set the hook function that will be called when the - runtime initially becomes multi threaded. - The hook function is only called once, meaning only when the - 2nd thread is spawned, not for each and every thread. - - It returns the previous hook function or NULL if there is none. - - A program outside of the runtime could set this to some function so - it can be informed; for example, the GNUstep Base Library sets it - so it can implement the NSBecomingMultiThreaded notification. - */ -objc_thread_callback objc_set_thread_callback(objc_thread_callback func) -{ - objc_thread_callback temp = _objc_became_multi_threaded; - _objc_became_multi_threaded = func; - return temp; -} - -/* - Private functions - - These functions are utilized by the frontend, but they are not - considered part of the public interface. - */ - -/* - First function called in a thread, starts everything else. - - This function is passed to the backend by objc_thread_detach - as the starting function for a new thread. - */ -struct __objc_thread_start_state -{ - SEL selector; - id object; - id argument; -}; - -static volatile void -__objc_thread_detach_function(struct __objc_thread_start_state *istate) -{ - /* Valid state? */ - if (istate) { - id (*imp)(id,SEL,id); - SEL selector = istate->selector; - id object = istate->object; - id argument = istate->argument; - - /* Don't need anymore so free it */ - objc_free(istate); - - /* Clear out the thread local storage */ - objc_thread_set_data(NULL); - - /* Check to see if we just became multi threaded */ - if (!__objc_is_multi_threaded) - { - __objc_is_multi_threaded = 1; - - /* Call the hook function */ - if (_objc_became_multi_threaded != NULL) - (*_objc_became_multi_threaded)(); - } - - /* Call the method */ - if ((imp = (id(*)(id, SEL, id))objc_msg_lookup(object, selector))) - (*imp)(object, selector, argument); - else - objc_error(object, OBJC_ERR_UNIMPLEMENTED, - "objc_thread_detach called with bad selector.\n"); - } - else - objc_error(nil, OBJC_ERR_BAD_STATE, - "objc_thread_detach called with NULL state.\n"); - - /* Exit the thread */ - objc_thread_exit(); -} - -/* - Frontend functions - - These functions constitute the public interface to the Objective-C thread - and mutex functionality. - */ - -/* Frontend thread functions */ - -/* - Detach a new thread of execution and return its id. Returns NULL if fails. - Thread is started by sending message with selector to object. Message - takes a single argument. - */ -objc_thread_t -objc_thread_detach(SEL selector, id object, id argument) -{ - struct __objc_thread_start_state *istate; - objc_thread_t thread_id = NULL; - - /* Allocate the state structure */ - if (!(istate = (struct __objc_thread_start_state *) - objc_malloc(sizeof(*istate)))) - return NULL; - - /* Initialize the state structure */ - istate->selector = selector; - istate->object = object; - istate->argument = argument; - - /* lock access */ - objc_mutex_lock(__objc_runtime_mutex); - - /* Call the backend to spawn the thread */ - if ((thread_id = __objc_thread_detach((void *)__objc_thread_detach_function, - istate)) == NULL) - { - /* failed! */ - objc_mutex_unlock(__objc_runtime_mutex); - objc_free(istate); - return NULL; - } - - /* Increment our thread counter */ - __objc_runtime_threads_alive++; - objc_mutex_unlock(__objc_runtime_mutex); - - return thread_id; -} - -/* Set the current thread's priority. */ -int -objc_thread_set_priority(int priority) -{ - /* Call the backend */ - return __objc_thread_set_priority(priority); -} - -/* Return the current thread's priority. */ -int -objc_thread_get_priority(void) -{ - /* Call the backend */ - return __objc_thread_get_priority(); -} - -/* - Yield our process time to another thread. Any BUSY waiting that is done - by a thread should use this function to make sure that other threads can - make progress even on a lazy uniprocessor system. - */ -void -objc_thread_yield(void) -{ - /* Call the backend */ - __objc_thread_yield(); -} - -/* - Terminate the current tread. Doesn't return. - Actually, if it failed returns -1. - */ -int -objc_thread_exit(void) -{ - /* Decrement our counter of the number of threads alive */ - objc_mutex_lock(__objc_runtime_mutex); - __objc_runtime_threads_alive--; - objc_mutex_unlock(__objc_runtime_mutex); - - /* Call the backend to terminate the thread */ - return __objc_thread_exit(); -} - -/* - Returns an integer value which uniquely describes a thread. Must not be - NULL which is reserved as a marker for "no thread". - */ -objc_thread_t -objc_thread_id(void) -{ - /* Call the backend */ - return __objc_thread_id(); -} - -/* - Sets the thread's local storage pointer. - Returns 0 if successful or -1 if failed. - */ -int -objc_thread_set_data(void *value) -{ - /* Call the backend */ - return __objc_thread_set_data(value); -} - -/* - Returns the thread's local storage pointer. Returns NULL on failure. - */ -void * -objc_thread_get_data(void) -{ - /* Call the backend */ - return __objc_thread_get_data(); -} - -/* Frontend mutex functions */ - -/* - Allocate a mutex. Return the mutex pointer if successful or NULL if the - allocation failed for any reason. - */ -objc_mutex_t -objc_mutex_allocate(void) -{ - objc_mutex_t mutex; - - /* Allocate the mutex structure */ - if (!(mutex = (objc_mutex_t)objc_malloc(sizeof(struct objc_mutex)))) - return NULL; - - /* Call backend to create the mutex */ - if (__objc_mutex_allocate(mutex)) - { - /* failed! */ - objc_free(mutex); - return NULL; - } - - /* Initialize mutex */ - mutex->owner = NULL; - mutex->depth = 0; - return mutex; -} - -/* - Deallocate a mutex. Note that this includes an implicit mutex_lock to - insure that no one else is using the lock. It is legal to deallocate - a lock if we have a lock on it, but illegal to deallocate a lock held - by anyone else. - Returns the number of locks on the thread. (1 for deallocate). - */ -int -objc_mutex_deallocate(objc_mutex_t mutex) -{ - int depth; - - /* Valid mutex? */ - if (!mutex) - return -1; - - /* Acquire lock on mutex */ - depth = objc_mutex_lock(mutex); - - /* Call backend to destroy mutex */ - if (__objc_mutex_deallocate(mutex)) - return -1; - - /* Free the mutex structure */ - objc_free(mutex); - - /* Return last depth */ - return depth; -} - -/* - Grab a lock on a mutex. If this thread already has a lock on this mutex - then we increment the lock count. If another thread has a lock on the - mutex we block and wait for the thread to release the lock. - Returns the lock count on the mutex held by this thread. - */ -int -objc_mutex_lock(objc_mutex_t mutex) -{ - objc_thread_t thread_id; - int status; - - /* Valid mutex? */ - if (!mutex) - return -1; - - /* If we already own the lock then increment depth */ - thread_id = objc_thread_id(); - if (mutex->owner == thread_id) - return ++mutex->depth; - - /* Call the backend to lock the mutex */ - status = __objc_mutex_lock(mutex); - - /* Failed? */ - if (status) - return status; - - /* Successfully locked the thread */ - mutex->owner = thread_id; - return mutex->depth = 1; -} - -/* - Try to grab a lock on a mutex. If this thread already has a lock on - this mutex then we increment the lock count and return it. If another - thread has a lock on the mutex returns -1. - */ -int -objc_mutex_trylock(objc_mutex_t mutex) -{ - objc_thread_t thread_id; - int status; - - /* Valid mutex? */ - if (!mutex) - return -1; - - /* If we already own the lock then increment depth */ - thread_id = objc_thread_id(); - if (mutex->owner == thread_id) - return ++mutex->depth; - - /* Call the backend to try to lock the mutex */ - status = __objc_mutex_trylock(mutex); - - /* Failed? */ - if (status) - return status; - - /* Successfully locked the thread */ - mutex->owner = thread_id; - return mutex->depth = 1; -} - -/* - Unlocks the mutex by one level. - Decrements the lock count on this mutex by one. - If the lock count reaches zero, release the lock on the mutex. - Returns the lock count on the mutex. - It is an error to attempt to unlock a mutex which this thread - doesn't hold in which case return -1 and the mutex is unaffected. - */ -int -objc_mutex_unlock(objc_mutex_t mutex) -{ - objc_thread_t thread_id; - int status; - - /* Valid mutex? */ - if (!mutex) - return -1; - - /* If another thread owns the lock then abort */ - thread_id = objc_thread_id(); - if (mutex->owner != thread_id) - return -1; - - /* Decrement depth and return */ - if (mutex->depth > 1) - return --mutex->depth; - - /* Depth down to zero so we are no longer the owner */ - mutex->depth = 0; - mutex->owner = NULL; - - /* Have the backend unlock the mutex */ - status = __objc_mutex_unlock(mutex); - - /* Failed? */ - if (status) - return status; - - return 0; -} - -/* Frontend condition mutex functions */ - -/* - Allocate a condition. Return the condition pointer if successful or NULL - if the allocation failed for any reason. - */ -objc_condition_t -objc_condition_allocate(void) -{ - objc_condition_t condition; - - /* Allocate the condition mutex structure */ - if (!(condition = - (objc_condition_t)objc_malloc(sizeof(struct objc_condition)))) - return NULL; - - /* Call the backend to create the condition mutex */ - if (__objc_condition_allocate(condition)) - { - /* failed! */ - objc_free(condition); - return NULL; - } - - /* Success! */ - return condition; -} - -/* - Deallocate a condition. Note that this includes an implicit - condition_broadcast to insure that waiting threads have the opportunity - to wake. It is legal to dealloc a condition only if no other - thread is/will be using it. Here we do NOT check for other threads - waiting but just wake them up. - */ -int -objc_condition_deallocate(objc_condition_t condition) -{ - /* Broadcast the condition */ - if (objc_condition_broadcast(condition)) - return -1; - - /* Call the backend to destroy */ - if (__objc_condition_deallocate(condition)) - return -1; - - /* Free the condition mutex structure */ - objc_free(condition); - - return 0; -} - -/* - Wait on the condition unlocking the mutex until objc_condition_signal() - or objc_condition_broadcast() are called for the same condition. The - given mutex *must* have the depth set to 1 so that it can be unlocked - here, so that someone else can lock it and signal/broadcast the condition. - The mutex is used to lock access to the shared data that make up the - "condition" predicate. - */ -int -objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) -{ - objc_thread_t thread_id; - - /* Valid arguments? */ - if (!mutex || !condition) - return -1; - - /* Make sure we are owner of mutex */ - thread_id = objc_thread_id(); - if (mutex->owner != thread_id) - return -1; - - /* Cannot be locked more than once */ - if (mutex->depth > 1) - return -1; - - /* Virtually unlock the mutex */ - mutex->depth = 0; - mutex->owner = (objc_thread_t)NULL; - - /* Call the backend to wait */ - __objc_condition_wait(condition, mutex); - - /* Make ourselves owner of the mutex */ - mutex->owner = thread_id; - mutex->depth = 1; - - return 0; -} - -/* - Wake up all threads waiting on this condition. It is recommended that - the called would lock the same mutex as the threads in objc_condition_wait - before changing the "condition predicate" and make this call and unlock it - right away after this call. - */ -int -objc_condition_broadcast(objc_condition_t condition) -{ - /* Valid condition mutex? */ - if (!condition) - return -1; - - return __objc_condition_broadcast(condition); -} - -/* - Wake up one thread waiting on this condition. It is recommended that - the called would lock the same mutex as the threads in objc_condition_wait - before changing the "condition predicate" and make this call and unlock it - right away after this call. - */ -int -objc_condition_signal(objc_condition_t condition) -{ - /* Valid condition mutex? */ - if (!condition) - return -1; - - return __objc_condition_signal(condition); -} - -/* End of File */ diff --git a/contrib/libstdc++/ChangeLog b/contrib/libstdc++/ChangeLog deleted file mode 100644 index 02b950c48f..0000000000 --- a/contrib/libstdc++/ChangeLog +++ /dev/null @@ -1,1421 +0,0 @@ -Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com) - - * gcc-2.95.3 Released. - -2001-01-01 Bernd Schmidt - - 1999-12-07 Martin v. Löwis - * stl_deque.h (_Deque_base::const_iterator): Change third - template argument to pointer type. - Reported by Carlo Wood - - 1999-11-10 Benjamin Kosnik - Matthias Klose - * stl_rope.h: Fix initialization order. - * stl_deque.h: Use static_casts(signed_type). - -2000-11-24 Magnus Fromreide - - * sstream: Backport libstdc++-V3 sstream to V2. - -2000-04-24 Magnus Fromreide - - * sstream: New file. - * Makefile.in (HEADERS): Add it. - -2000-03-12 Gabriel Dos Reis - - * std/bastring.h (basic_string<>::push_back): Define. - -Tue Mar 7 21:37:56 2000 Jeffrey A Law (law@cygnus.com) - - 1999-11-19 Gabriel Dos Reis - * std/valarray_meta.h (_DEFINE_EXPR_UNARY_FUNCTION): Don't forget - to define tanh. - - 1999-11-05 Gabriel Dos Reis - * std/valarray_meta.h (_DEFINE_EXPR_UNARY_FUNCTION): When - building meta-expressions don't forget to take the contained - closures. - - 1999-10-19 Gabriel Dos Reis - * std/valarray_meta.h: (_BinClos::_BinClos): Fix typo. - - 1999-09-17 Gabriel Dos Reis - * std/complext.cc (pow): Don't expect floating point promotion - in presence of template argument deduction. There is no such - thing. - -2000-02-06 Gabriel Dos Reis - * std/valarray_array.h (__valarray_copy): Fix typo. - -1999-12-14 Martin v. Löwis - * std/bastring.h (basic_string::basic_string): Rename parameters - to avoid shadow warnings. - * std/bastring.cc (alloc): Likewise. - -Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.2 Released. - -Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.1 Released. - -Thu Aug 5 02:00:13 1999 Loren Rittle - - * Makefile.in (MARLINK, MSHLINK): Handle library version - number components with more than one numeric digit. - -Mon Aug 2 00:40:10 1999 Jeffrey A Law (law@cygnus.com) - - 1999-07-16 Markus Gyger (mgyger@gmu.edu) - * stdexcepti.cc (__out_of_range): Use std:: qualifier for names - in std. - (__length_error): Likewise. - -Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -Sat Jul 17 23:49:59 1999 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (INTERFACE): Bump to 3. - -Fri Jul 9 01:20:23 1999 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (VERSION): Bump to 2.10.0. - -Tue Jun 8 00:21:11 1999 Jeffrey A Law (law@cygnus.com) - - * configure.in (*-*-freebsd2*): Add missing '*' at end of configure - string. - -1999-06-05 Gabriel Dos Reis - - * std/std_valarray.h: Don't #include unconditionally - -1999-06-05 Gabriel Dos Reis - - * std/std_valarray.h: New file. - * std/slice.h: New file. - * std/slice_array.h: New file. - * std/gslice.h: New file. - * std/gslice_array.h: New file. - * std/mask_array.h: New file. - * std/indirect_array.h: New file. - * std/valarray_array.h: New file. - * std/valarray_array.tcc: New file. - * std/valarray_meta.h: New file. - * valarray.cc: New file. - * valarray: New file - - * Makefile.in (OBJS): add valarray.o - (HEADERS): add valarray - (valarray.o): define dependency on valarray.cc - (install): make it possible to install valarray file. - -Wed Jun 2 00:21:54 1999 Robert Lipe - - * std/bastring.h (class basic_string:Rep): Encode xlock opcode - as .bytes instead of mnemonics. - -1999-05-20 Angela Marie Thomas - - * configure.in: Test for ${compiler_name}.exe as well. - -1999-05-15 Mark Kettenis - - * configure.in: Add shared library support for the Hurd - (*-*-gnu*). - * config/gnu.ml: New file. - -1999-05-12 Jason Merrill - - * configure.in (compiler_name): Don't do the skip-this-dir thing - if we're reconfiguring. - -1999-05-07 Ulrich Drepper - - * std/bastring.h (class basic_string::Rep): Make release member - function thread-safe for ix86 (x>=4) and UltraSPARC. - - * stlinst.cc: Make it possible to compile with __USE_MALLOC. - -Mon Apr 26 02:24:47 1999 "Loren J. Rittle" - - * config/freebsd.ml (LIBS): Add ARLINK. - * config/openbsd.ml (LIBS): Add ARLINK. - -Fri Apr 2 15:12:14 1999 H.J. Lu (hjl@gnu.org) - - * libstdc++/configure.in (gxx_include_dir): Handle it. - * libstdc++/Makefile.in: Likewise. - -Wed Mar 24 22:36:45 1999 Mumit Khan - - * configure.in (EXEEXT): Define. - (compiler_name): Use. - -Thu Mar 11 01:07:55 1999 Franz Sirl - - * configure.in: Add mh-*pic handling for alpha, arm, powerpc - -Fri Mar 5 02:16:39 1999 Doug Rabson - - * configure.in: Support shared libs on FreeBSD 3.x and 4.x - * config/freebsd.ml: A copy of config/linux.ml since they are both - ELF and both have a shared libm. - -1999-02-24 Jason Merrill - - * configure.in: Fix INSTALLDIR sed pattern for Solaris sed. - -Sat Feb 20 13:17:17 1999 Jeffrey A Law (law@cygnus.com) - - * string, std/straits.h, std/bastring.h: Revert recent change. Needs - some libiberty support before it can be re-enabled. - -Thu Feb 18 19:53:17 1999 Marc Espie - - * configure.in: Handle OpenBSD with and without threads. - * config/openbsd.ml: New file. - * config/openbsd.mt: New file. - -1999-02-04 Ulrich Drepper - - * configure.in: Recognize --enable-threads=posix for all - platforms. - * config/posix.mt: New file. - - * configure.in: Add fragments for Solaris defining macro specifying - thread library to be used. - * config/sol2pth.mt: New file - * config/sol2solth.mt: New file. - * stl/stl_alloc.h: Add support for Solaris thread library. - * stl/stl_config.h: Recognize _SOLTHREADS and define internal macros - appropriately. - -1999-01-28 Baron Roberts - - * string: Uncomment wstring declaration. - - * std/straits.h: Remove #if 0/#endif from around - struct string_char_traits . - #include . - Add missing definition for wchar_t move method. - Add empty() method for trait-based empty string return. - - * std/bastring.h (c_str): Change return of "" to return of - traits::empty() call so that proper empty string is returned - based on the character type (i.e. "" or L""). - -1999-02-07 Jason Merrill - - * Makefile.in (stuff2): Tweak. - -1999-02-04 Ulrich Drepper - - * configure.in: Recognize --enable-threads=posix for all - platforms. - * config/posix.mt: New file. - - * configure.in: Add fragments for Solaris defining macro specifying - thread library to be used. - * config/sol2pth.mt: New file - * config/sol2solth.mt: New file. - * stl/stl_alloc.h: Add support for Solaris thread library. - * stl/stl_config.h: Recognize _SOLTHREADS and define internal macros - appropriately. - -Sat Jan 30 08:05:46 1999 Mumit Khan - - * config/x86-interix.ml: New file. - * configure.in (i[3456]86-*-interix*): Add shared library support. - -1999-01-13 Ulrich Drepper - - * configure.in: Test for "ln -s" and set LN_S in generated Makefile. - * Makefile.in: Use $(LN_S) instead of explicitly ln -s. - -Sun Jan 03 03:16:02 1999 Robert Lipe - - * configure.in: (*-*-sysv5, *-*-*udk*): Treat like sysv4. - -Tue Dec 8 00:59:09 1998 Marc Espie - - * Makefile.in: Be more selective about what files to install. - -1998-11-30 Ulrich Drepper - - * std/bastring.cc (operator>>): Correct cast in last patch. - (getline): Likewise. - -1998-11-27 Alexandre Oliva - - * Makefile.in (HEADERS): Install bitset. - -1998-11-26 Manfred Hollstein - - * configure.in (compiler_name): Add check to detect if this - language's compiler has been built. - -1998-11-23 Ulrich Drepper - - * std/bastring.cc (operator>>): Cast new character to char before - adding to string. - (getline): Likewise. - -Thu Sep 17 01:29:46 1998 H.J. Lu (hjl@gnu.org) - - * Makefile.in ($(ARLINK), $(SHLINK)): Don't rely on 'ln -f'. - - * Makefile.in (install): Don't rely on 'ln -f'. - -1998-09-09 Manfred Hollstein - - * Makefile.in (install): Initialize RELINSTALLDIR correctly - even for multilib and cross configurations. - - * configure.in (INSTALLDIR): Don't change INSTALLDIR's init - value if --enable-version-specific-runtime-libs has been specified. - -Wed Sep 2 21:11:15 1998 H.J. Lu (hjl@gnu.org) - - * Makefile.in (RELINSTALLDIR): New. Use it to make symlinks. - - * configure.in: Fix INSTALLDIR replacement for cross-compile. - -Sun Aug 30 22:17:41 1998 H.J. Lu (hjl@gnu.org) - - * Makefile.in (INTERFACE): New, set to 2. - (ARLIB): Set to libstdc++.a.$(VERSION) - (ARLINK, MARLINK): New macros. - (LIBS): Add $(ARLINK). - ($(ARLINK), marlink): New targets. - (install): Don't check $(libsubdir). Handle versioned libraries. - - * config/linux.ml (ARLIB, MARLINK, SHLIB, MSHLINK): New macros. - (LIBS): Add marlink $(ARLINK). - - * config/aix.ml (ARLIB): Set to libstdc++-ar.a.$(VERSION) - (ARLINK): New macros. - (BUILD_LIBS): Add $(ARLINK). - - * config/dec-osf.ml (LIBS): Add $(ARLINK). - * config/elf.ml (LIBS): Likewise. - * config/elfshlibm.ml (LIBS): Likewise. - * config/hpux.ml (LIBS): Likewise. - * config/iris5.ml (LIBS): Likewise. - * config/sol2shm.ml (LIBS): Likewise. - * config/sunos4.ml (LIBS): Likewise. - - * configure.in: Use ${topsrcdir}/config.if to put - LIBSTDCXX_INTERFACE, CXX_INTERFACE, LIBC_INTERFACE in - ${package_makefile_frag}. - -1998-08-25 Martin von Löwis - - * stdexcept: Remove __HONOR_STD. - -1998-08-23 Mark Mitchell - - * sinst.cc: Don't explicitly instantiation string_char_traits. - * cinst.cc: Likewiwse, for complex, complex, - complex. - -1998-08-17 Mark Mitchell - - * stdexcept: Put things in the std namespace, if appropriate. - -1998-07-12 Jason Merrill - - * Makefile.in (VERSION): Bump to 2.9.0. - -1998-07-12 Lars Albertsson - - * std/bastring.cc (find_last_of): Fix. - (find_last_not_of): Likewise. - -1998-07-06 Manfred Hollstein - - * configure.in (INSTALLDIR): Make sed pattern failsafe. - -1998-07-06 Ulrich Drepper - - * std/bastring.h (class basic_string): Correct iterator return - values in insert member functions. - -1998-07-02 Ulrich Drepper - - * std/bastring.h (class basic_string): Return correct iterators in - erase member functions. - -1998-06-24 Manfred Hollstein - - * Makefile.in (INSTALLDIR): Add comment to document the fact, - this macro will be properly initialized at make's runtime. - (install): Add initialization of INSTALLDIR depending on $(libsubdir) - and ${enable_version_specific_runtime_libs}; use $${INSTALLDIR} shell - variable instead of the $(INSTALLDIR) make macro. - -Tue Mar 24 10:13:07 1998 Jason Merrill - - * std/bastring.cc (basic_string::copy): Mark const here, too. - -1998-03-23 15:59 Ulrich Drepper - - * std/bastring.h (basic_string::copy): Mark copy function as const. - Reported by Scott Schurr . - -Thu Mar 5 09:23:28 1998 Manfred Hollstein - - * configure.in: Make locating frag files failsafe even for the - special case if configuring and building in srcdir. - -1998-03-04 12:37 Ulrich Drepper - - * cinst.cc [INSERT] (operator<<): Correct type of numeric argument. - -Fri Feb 6 01:36:21 1998 Manfred Hollstein - - * Makefile.in (piclist): Check value of enable_shared, not PICFLAG. - (stmp-string, ...): Dito. - (bigstmp-string, ...): Dito. - -Sun Feb 1 13:38:07 1998 H.J. Lu (hjl@gnu.org) - - * config/linux.mt: Don't define _PTHREADS, but define - _IO_MTSAFE_IO. - -Wed Jan 28 10:27:11 1998 Manfred Hollstein - - * tests/configure.in, testsuite/configure.in: Update with yesterday's - toplevel configure.in changes. - -Tue Jan 27 23:27:32 1998 Manfred Hollstein - - * 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:11:27 1998 Jason Merrill - - * Makefile.in (install): Remove the shared library symlink even if - we aren't installing it. - -Tue Jan 27 10:29:44 1998 H.J. Lu (hjl@gnu.org) - - * configure.in (topsrcdir): New. - (configdirs): Check ${topsrcdir}/gcc instead. - (config-ml.in): Use ${topsrcdir}/config-ml.in. - - * tests/configure.in (topsrcdir): New. - (check): Check ${topsrcdir}/gcc instead. - -Sun Jan 25 14:01:50 1998 Jason Merrill - - * std/bastring.h (unique): We only need length bytes. - (c_str): Avoid writing over random memory. - #include . - Lose _G_ALLOC_CONTROL. - * std/bastring.cc: Likewise. - (nilRep): Add initializer for selfish. - * sinst.cc: Just #include . - -Tue Jan 13 21:23:05 1998 H.J. Lu (hjl@gnu.org) - - * configure.in (configdirs): Include testsuite only if - ${srcdir}/../gcc exists. - - * tests/configure.in (check): Set to ${CHECK} if - ${srcdir}/../../gcc doesn't exists. - -1998-01-05 Brendan Kehoe - - * std/bastring.cc (basic_string::Rep::operator delete): Don't claim - to return from deallocate, since this is a void method. - -Sat Jan 3 12:15:41 1998 Franz Sirl - - * configure.in: Finalize support for {alpha|powerpc}*-*-linux-gnulibc1 - -Sun Dec 7 02:34:40 1997 Jody Goldberg - - * libstdc++/std/bastring.h : Move closer to the draft standard - implementation of basic_string by adding 3 paramter 'Allocator'. - NOTE: this still differs from the standard in not offering per - instance allocators. - * libstdc++/std/bastring.cc : Likewise. - * libstdc++/stlinst.cc : Handle thread safe allocators if they are the - default. - -Sun Dec 7 02:32:20 1997 Jason Merrill - - * iosfwd: New header. - * Makefile.in (HEADERS): Add it. - -Sun Dec 7 02:32:20 1997 Gregory L. Galloway (gregg@eoeml.gtri.gatech.edu) - - * Makefile.in (HEADERS): Modified list of headers to - install to include all of SGI STL headers especially hash_set and - hash_map, and added ANSI C++ style wrappers for fstream, iomanip, - iostream, and strstream. - - * fstream, iomanip, iostream, strstream: New forwarding headers - added. - -Thu Nov 27 01:33:55 1997 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (install): Change gxx_includedir to gxx_include_dir. - -Tue Nov 25 23:16:44 1997 Jason Merrill - - London changes to string: - * std/bastring.cc (check_realloc): Don't be selfish anymore. - * std/bastring.h (non-const operator[]): Be selfish. - (iterator forms of insert and erase): Stay selfish. - -Tue Nov 25 14:03:43 1997 H.J. Lu (hjl@gnu.org) - - * Makefile.in (stmp-complex, bigstmp-complex): Changed to - xxxx-complx. - -Mon Nov 24 14:41:33 1997 Jeffrey A Law (law@cygnus.com) - - * Makefile.in: Use ln -f -s, not ln -s -f. - -Fri Nov 21 12:56:24 1997 Manfred Hollstein - - * Makefile.in (bigstmp-complex): Name changed to bigstmp-complx to - cope with filesystem not capable to handle names longer than - 14 characters. - -Sun Nov 16 22:41:55 1997 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (SHLIB): Build with CC instead of CXX. - -Sun Nov 2 23:34:09 1997 Manfred Hollstein - - * configure.in: Use delta.mt for m68k-motorola-sysv. - * config/delta.mt: New makefile fragment. - -Sun Nov 2 12:14:37 1997 Jason Merrill - - * Makefile.in (install): Some of HEADERS come from the stl dir now. - * algorithm, deque, functional, iterator, list, map, memory, numeric, - queue, set, stack, utility, vector: Now in stl dir. - -Fri Oct 10 00:40:00 1997 Jason Merrill - - * std/bastring.h: Use ibegin internally. Return passed iterator - instead of recalculating it where appropriate. - * std/bastring.cc: Adjust for erase. - - From Yotam Medini: - * std/bastring.h: Replace remove with erase. - -Thu Oct 9 23:24:36 1997 Jason Merrill - - * stdexcepti.cc (__out_of_range): New fn. - (__length_error): New fn. - - * std/bastring.h (OUTOFRANGE): Fix logic. Use throwing functions. - (LENGTHERROR): Likewise. - Revert Oct 2 changes. - * string: Revert Oct 2 changes. - -Tue Oct 7 00:51:51 1997 Jason Merrill - - * std/{f,d,ld}complex.h: Replace guiding fns if not -ansi. - -Thu Oct 2 00:08:18 1997 Jason Merrill - - * std/bastring.h: Move exception stuff after definition of string. - Move typedef of string here. - * string: From here. - -Sat Sep 27 16:48:00 1997 Jason Merrill - - * std/complext.h: Lose injection decls. - * std/fcomplex.h: Likewise. - * std/dcomplex.h: Likewise. - * std/ldcomplex.h: Likewise. - -Sat Sep 27 16:47:35 1997 Mark Mitchell - - * std/complext.h: Declare templates before making them - friends. Use new friend <> syntax. - * std/complext.cc: Don't rely on guiding declarations. - * std/fcomplex.h: Use new friend <> syntax. - * std/dcomplex.h: Likewise. - * std/ldcomplex.h: Likewise. - -Thu Sep 25 19:55:56 1997 Jason Merrill - - * std/bastring.h: Enable exceptions. - (assign, append, insert, replace): Implement member template versions. - -1997-09-15 02:37 Ulrich Drepper - - * config/linux.mt: New file. Make sure _PTHREADS is defined - if necessary. - * configure.in: Find linux.mt file. - -Thu Sep 11 15:03:20 1997 Jason Merrill - - * std/bastring.h (class basic_string): Add global scope to - use of reverse_iterator. - -Tue Sep 9 19:47:07 1997 Jason Merrill - - * std/bastring.h: Adjust use of reverse_iterator template. - -Wed Aug 27 00:04:33 1997 Alexandre Oliva (oliva@dcc.unicamp.br) - - * Makefile.in: Create correct multiple links to - shared libstdc++. - -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. - -Mon Aug 25 14:26:45 1997 Jason Merrill - - * Makefile.in (CXXFLAGS): Add -Weffc++. - -Sat Aug 23 21:25:37 1997 Mark Mitchell - - * bastring.h: Enable reverse_iterator and its ilk. - - * bastring.h: Provide specializations of member function templates - for const_iterator. - -Wed Jul 30 10:59:00 1997 Benjamin Kosnik - - * stlinst.cc: Add instantiation file for - __default_alloc_template and - __malloc_alloc_template<0> - -Sun Jun 1 17:03:40 1997 Jason Merrill - - * std/bastring.cc (find_last_of): Correct handling of POS. - (find_last_not_of): Likewise. - -Thu May 1 17:37:10 1997 Jason Merrill - - * Makefile.in ($(SHLIB)): Add $(LIBCXXFLAGS). - -Wed Apr 30 12:06:23 1997 Jason Merrill - - * Makefile.in (IO_DIR): Remove $(MULTIBUILDTOP). - (LIBIBERTY_DIR): Likewise. - * configure.in: Don't turn on multilib here. - -Fri Apr 25 16:09:15 1997 Bob Manson - - * testsuite/libstdc++.tests/test.exp, testsuite/lib/libstdc++.exp, - testsuite/configure.in, testsuite/Makefile.in, - testsuite/config/default.exp, testsuite/ChangeLog: New files. - - * configure.in: Add new testsuite directory to be configured. - -Tue Apr 22 19:03:39 1997 Alexandre Oliva - - * Makefile.in (install): Fix handling of mshlink. - -Fri Apr 4 03:25:13 1997 Ulrich Drepper - - * Makefile.in (IO_DIR): Prepend $(MULTIBUILDTOP) to - support multilib build. - (LIBIBERTY_DIR): Likewise. - - * configure.in: Enable multilibing by default. - Update multilib template to read config-ml.in. - -Wed Mar 12 16:09:34 1997 Jason Merrill - - * configure.in (XCXXINCLUDES): Add the STL directory. - -Thu Jan 23 08:08:43 1997 Brendan Kehoe - - * stdexcept: Delete dtors for all of the error classes, to match - their removal in the Apr 1995 WP. - (class overflow_error): Define missing class, added in May 1996 WP. - -Mon Nov 18 16:57:25 1996 Jason Merrill - - * Makefile.in (stuff[12]): More rules for my own evil purposes. - (CXXFLAGS, CFLAGS): Use -O instead of -O3 so debugging works. - -Wed Oct 16 13:47:45 1996 Jason Merrill - - * config/irix5.ml: Do link against the math library. - * configure.in: Support shared libs on Irix 6. - -Fri Oct 11 18:06:09 1996 Jason Merrill - - * config/linux.ml: Lose version overrides. - - * Makefile.in (MSHLINK): Defaults to .so.2.x - (mshlink): Indirect rule for making it. - -Tue Sep 24 17:58:31 1996 Jason Merrill - - * Remove new, typeinfo, exception, stddef*. - * Move public headers from std/*.h to *. - -Sun Sep 22 05:35:55 1996 Jason Merrill - - * Makefile.in: Remove new, exception, typeinfo handling. - * exceptioni.cc, newi.cc, typeinfoi.cc, std/exception.h, std/new.h, - std/typeinfo.h, new.h: Remove. - * typeinfo, new, exception: Refer to the files with .h in gcc. - -Fri Sep 20 14:39:19 1996 Jason Merrill - - * Makefile.in: Remove references to stl.list. - * configure.in (configdirs): Remove stl. - -Sat Sep 14 09:42:08 1996 Jason Merrill - - * Makefile.in (stuff): Convenience for me. - - * std/bastring.h: Remove kludge obsoleted by new overloading code. - -Fri Sep 6 16:43:21 1996 Jason Merrill - - * typeinfoi.cc (__dynamic_cast): Fix static_cast. - (__rtti_si): Likewise. - (dcast): Likewise. - -Thu Aug 29 17:06:23 1996 Michael Meissner - - * configure.in (i[345]86-*-*): Recognize i686 for pentium pro. - -Tue Jul 23 14:27:44 1996 Mike Stump - - * Makefile.in (exceptioni.o): Use -fexceptions now. - -Mon Jun 17 13:57:24 1996 Per Bothner - - * std/bastring.h (class basic_string::remove): Add casts. - - * configure.in: Use EXTRA_DISTCLEAN rather than DISTCLEAN. - -Fri Jun 7 14:09:20 1996 Jason Merrill - - * typeinfoi.cc (BUILTIN): Align typeinfo object like a pointer. - -Wed May 29 16:48:35 1996 Mike Stump - - * exceptioni.cc (__throw_bad_exception): Add. - * std/exception.h (bad_exception): Add. - * std/typeinfo.h: Remove leftovers of bad_cast_object. - -Mon May 6 14:04:42 1996 Jason Merrill - - * std/complext.h: s/FLOAT/_FLT/g. - -Thu May 2 17:26:24 1996 Mike Stump - - * exceptioni.cc (uncaught_exception): New routine. - * std/exception.h: Declare it. - -Thu Apr 25 13:20:57 1996 Jason Merrill - - * Makefile.in (typeinfoi.o, stdexcepti.o): Use default rule. - -Wed Apr 24 18:38:24 1996 Mike Stump - - * exceptioni.cc: Add #pragma implementation. - * std/exception.h: Add #pragma interface. Moved exception from - stdexcept. - * std/stdexcept.h: Moved exception to exception. Fix all constructor - arguments to take strings to match ANSI. Moved bad_cast and bad_typeid - to typeinfo. - * std/typeinfo.h: Moved bad_cast and bad_typeid from stdexcept. - -Wed Apr 24 10:43:07 1996 Doug Evans - - * Makefile.in (newi.o,cstringi.o,stddefi.o,cstdlibi.o,cmathi.o): Add - rules for SunOS VPATH. - -Fri Apr 19 17:24:51 1996 Jason Merrill - - * Version 2.8.0b3. - -Wed Apr 10 14:38:05 1996 Jason Merrill - - * typeinfoi.cc (base_info): Pack the latter three fields into 32 bits. - -Tue Apr 9 15:49:38 1996 Jason Merrill - - * typeinfoi.cc: Add 'const'. - (__class_type_info): Now just one pointer to an array of structs, - rather than four pointers to arrays. - - * typeinfoi.cc (__throw_type_match_rtti): Check for conversion to - void* before conversion to base*. - (dcast): Handle downcasting to X* given other X subobjects in - the most derived type. Ack. - -Mon Apr 8 15:20:32 1996 Ian Lance Taylor - - * configure.in: Permit --enable-shared to specify a list of - directories. - -Sun Apr 7 22:50:53 1996 Jason Merrill - - * typeinfoi.cc (__rtti_array): New entry point. - -Sat Apr 6 14:41:18 1996 Jason Merrill - - * exceptioni.cc (__throw_bad_cast): New entry point for compiler. - * typeinfoi.cc: Remove __bad_cast_object. - - * typeinfoi.cc: Add nodes for unsigned builtins. - -Fri Apr 5 18:16:22 1996 Jason Merrill - - * typeinfoi.cc, std/typeinfo.h: Total overhaul. Move most - everything out of the header, move name field into type_info, add - single-inheritance case, rewrite pointer handling, add new - compiler interface. Compare addresses to check for equality. - -Wed Mar 27 11:54:08 1996 Jason Merrill - - * Version 2.8.0b2. - -Fri Mar 8 13:56:18 1996 Jason Merrill - - * std/[cs]inst.h: Remove. - -Thu Mar 7 07:29:00 1996 Lee Iverson - - * Makefile.in (install): Restore deleted chdir to stl subdir. - -Thu Mar 7 15:02:58 1996 Jason Merrill - - * std/complext.h: Fix __attribute__ usage. - -Wed Feb 28 10:00:24 1996 Jason Merrill - - * Version 2.8.0b1. - -Mon Feb 26 17:26:26 1996 Jason Merrill - - * std/cstring.h: New approach to changing signatures of string - manipulation functions. Still disabled. - -Tue Feb 20 18:29:30 1996 Jason Merrill - - * std/complext.h (__doapl, __doami, __doaml, __doadv): Helper - templates to implement +=, -=, *= and /=, respectively, since - member function templates do not apply to class specializations. - * std/{f,d,ld}complex.h, std/complext.cc, cinst.cc: Adjust. - - * std/bastring.h: The representation class is now a nested class. - * std/bastring.cc: Add templates for static data members. - * sinst.cc: Don't provide specializations for static data members. - * std/string.h: Use default template parameters. - - * Makefile.in (CXXFLAGS): Remove -pedantic -ansi. - (CFLAGS): Ditto. - -Wed Feb 14 14:39:07 1996 Jason Merrill - - * std/bastring.cc (check_realloc): Fix for sizeof (charT) > 1. - From John Hickin . - -Wed Jan 10 11:05:04 1996 Jason Merrill - - * std/bastring.h (insert): Fix iterator handling. - From Joe Buck . - -Mon Jan 8 11:48:03 1996 Jason Merrill - - * std/bastring.h (max_size): Fix for sizeof (charT) > 1. - * std/bastring.cc (replace): Use it. - - * std/bastring.cc (rfind): Fix for n > length (). - -Tue Dec 19 15:13:08 1995 Jason Merrill - - * config/aix.ml (SHFLAGS): Add -Wl,-unix. - -Mon Dec 18 12:48:25 1995 Mike Stump - - * Makefile.in (exceptioni.o): Compile with -fhandle-exceptions, so - we can unwind through unexpected on machines that don't have a - working __unwind_function. - -Sun Dec 17 00:28:31 1995 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (install): Make sure shared libraries - are installed with mode 555. - -Mon Nov 27 15:01:56 1995 Jason Merrill - - * Makefile.in (install): Make shared library links relative. - (install): Break up -sf into -s -f. - ({M,}SHLINK): Ditto. - -Sun Nov 26 22:48:06 1995 Jason Merrill - - * queue: Include instead of . - -Sat Nov 25 11:33:13 1995 Doug Evans - - * Makefile.in (install): Fix setting of rootme. - -Tue Nov 21 14:20:34 1995 Ian Lance Taylor - - * configure.in: Check ${with_cross_host} rather than comparing - ${host} and ${target}. - -Tue Nov 14 01:50:52 1995 Doug Evans - - * Makefile.in (IO_DIR): Delete MULTITOP, MULTISUBDIR. - (LIBIBERTY_DIR): Likewise. - (INSTALLDIR): Delete MULTISUBDIR. - * configure.in: Delete call to cfg-ml-com.in. Call config-ml.in - instead of cfg-ml-pos.in. - (XCXXINCLUDES): Delete MULTITOP. - * stl/configure.in (XCXXINCLUDES): Delete MULTITOP. - (config-ml.in): Call instead of cfg-ml-pos.in. - -Sun Nov 12 16:44:25 1995 Per Bothner - - * Makefile.in (VERSION): Set to 2.7.1. - -Thu Nov 9 17:39:28 1995 Jason Merrill - - * config/{aix,dec-osf,irix5,linux,sol2shm}.ml: Remove LDLIBS defn; - no longer needed now that make check sets LD_LIBRARY_PATH. - -Wed Nov 8 19:46:35 1995 Brendan Kehoe - - * std/bastring.h: Wrap with #ifndef/#define/#endif. - * std/cassert.h: Likewise. - * std/cinst.h: Likewise. - * std/complext.h: Likewise. - * std/dcomplex.h: Likewise. - * std/fcomplex.h: Likewise. - * std/ldcomplex.h: Likewise. - * std/sinst.h: Likewise. - -Wed Nov 8 16:15:48 1995 Jason Merrill - - * std/bastring.cc (getline): Update to September 95 WP. Now we - don't set failbit when reading an empty line. - -Tue Nov 7 16:09:04 1995 Jason Merrill - - * std/bastring.cc (new): Fix for sizeof (charT) != 1. - -Sat Nov 4 17:37:16 1995 Jason Merrill - - * std/complext.cc (operator / (FLOAT, const complex&)): - Reimplement along the lines of the other operator / templates. - From John Eaton . - -Sat Nov 4 13:33:50 1995 Per Bothner - - * configure.in (DISTCLEAN): New, to add target-mkfrag. - -Tue Oct 31 13:59:32 1995 Jason Merrill - - * std/bastring.h: Use size_t for the reference count. - * std/bastring.cc (create): Set selfish. - From Joe Buck (jbuck@synopsys.com). - -Mon Oct 30 23:09:48 1995 Per Bothner - - * configure.in: Don't bother changing LIBIBERTY for cross, - now that we are using target-libiberty instead. - * Makefile.in (LIBIBERTY_DIR): Simplify. - (LIBIBERTY): Remove. - -Wed Oct 11 14:56:49 1995 Brendan Kehoe - - * config/sol2shm.ml: New files with -rpath. - * configure (*-*-solaris*): Use sol2shm.ml. - -Thu Sep 28 09:26:52 1995 Jason Merrill - - * std/straits.h (compare, copy, move, set): Fix for non-char charT's. - * std/bastring.h (basic_string::remove): Fix for non-char charT's. - -Tue Sep 26 15:22:56 1995 Jason Merrill - - * config/irix5.ml: Pass -rpath to links. - -Fri Sep 15 00:17:47 1995 Jason Merrill - - * config/linux.ml: Conform to Linux shared library numbering - scheme. - * Makefile.in: Ditto. - -Tue Sep 12 00:28:56 1995 Mike Stump - - * typeinfoi.cc: (__pointer_type_info::__rtti_match): Moved from - the headerfile, include all sorts of pointer conversions from 15.3 - para 2. - * std/typeinfo.h (__pointer_type_info::__rtti_match): Moved from here. - -Mon Sep 11 23:27:59 1995 Mike Stump - - * std/typeinfo.h (__pointer_type_info::__rtti_match): We no longer - have to dereference the object pointer, as the pointer is always - passed directly. - -Mon Sep 11 19:29:51 1995 Mike Stump - - * std/typeinfo.h (__pointer_type_info::__rtti_match): Define so - that pointer conversions can happen on catch type matching. - * typeinfoi.cc (__throw_type_match_rtti): Arrange for __rtti_match - to be used on pointers. - -Tue Sep 5 14:49:19 1995 Jason Merrill - - * string.h: Remove for now. - -Thu Aug 31 14:14:01 1995 Jason Merrill - - * std/bastring.cc (operator>>): Simplify and fix. - (resize): Fix order of arguments to append. - (getline): Simplify and fix. - -Thu Aug 24 17:44:09 1995 Jason Merrill - - * std/cstdlib.h (abs): Provide default implementation for peons - without labs. - -Tue Aug 22 08:43:07 1995 Jason Merrill - - * std/cstdlib.h: Comment out definition of div(long,long) for now, - since not all targets have ldiv. - -Mon Aug 21 11:46:03 1995 Jason Merrill - - * std/cmath.h: Wrap abs(double) with #if ! _G_MATH_H_INLINES. - - * stl.h: Add, for compatibility with ObjectSpace STL. - - * std/complext.cc (operator /): Use abs instead of fabs. - - * std/bastring.h (replace): Update single-character replace method - as per my proposal. - - * std/cmath.h: Add abs(float), abs(double) and abs(long double). - Add commented-out declarations for other float and long double - math functions. - - * std/cstdlib.h: Add abs(long) and div(long,long). - - * Makefile.in (install): Make shared library executable and - non-writable. Tidy. - (OBJS): Add cstdlibi.o and cmathi.o. - - * Rename implementation files to have different basenames. - -Mon Aug 21 00:57:03 1995 Jeffrey A. Law - - * Makefile.in (install): Use "cd stl"; no need for $(srcdir) - prefix because we're already in $(srcdir). - -Tue Jul 25 18:41:29 1995 Per Bothner - - * std/stddef.h: Remove obsolete definition of enum capacity. - -Sat Jul 22 13:37:01 1995 Doug Evans - - * Makefile.in (IO_DIR): Add multilib support. - (LIBIBERTY, LIBIBERTY_OBJS, INSTALLDIR, stdlist): Likewise. - (libiberty.a, install): Likewise. - * configure.in: Likewise. - (XCXXINCLUDES): Likewise. - * stl/configure.in: Likewise. - (XCXXINCLUDES): Likewise. - -Mon Jul 17 09:29:31 1995 Brendan Kehoe - - * Makefile.in (typeinfo.o, stdexcept.o): Put an else for the if - stmt checking PICFLAG. - (stmp-string, bigstmp-string, stmp-complex, bigstmp-complex): Likewise. - -Wed Jun 28 17:05:29 1995 Jason Merrill - - * std/*.h: Wrap with extern "C++". - - * std/ciso646.h: Don't worry about #undefing the keywords. - -Mon Jun 26 19:05:38 1995 Jason Merrill - - * std/bastring.h (operator!=): If they've included the STL - function.h, don't overload the operator templates that it defines. - -Fri Jun 23 16:54:17 1995 Jason Merrill - - * Makefile.in (SHLINK): Force link. - (install): Ditto. - - * std/bastring.h (terminate): Never reallocate. - (alloc): No longer const. - - * std/bastring.cc (create): Always allocate an extra byte. - (check_realloc): Always leave room for an extra byte. - (*find*): Add missing 'const'. - - * Makefile.in (SHARLIB): Provide a default value. - -Tue Jun 20 16:29:52 1995 Jason Merrill - - * std/cstring.h: Don't bother tweaking prototypes for now. When - we do, we will use new-style casts. - -Fri Jun 16 13:57:53 1995 Jason Merrill - - * Makefile.in (VERSION): Update to 2.7.0. - - * config/aix.ml: Build both shared and archive libraries. - -Wed Jun 14 21:44:21 1995 Jason Merrill - - * configure.in (frags): Use linux.ml for Linux/ELF. - * config/linux.ml: New file. - -Wed Jun 14 17:56:23 1995 Niclas Andersson - - * configure.in: Use xiberty when building cross-compiler. - -Wed Jun 14 12:57:47 1995 Jason Merrill - - * std/*complex*, std/cinst.h, cinst.cc: Pass by reference to const - rather than by value. - * std/*complex*: Add member functions real() and imag(). - -Sat Jun 10 12:14:38 1995 Jason Merrill - - * Makefile.in (bigstmp-string): Call main string object cstrmain.o - instead of cstring.o. - -Wed Jun 7 11:15:15 1995 Jason Merrill - - * std/cstring.h: Use #include_next to pick up . - - * string.h: New file. - - * Makefile.in (MOSTLYCLEAN_JUNK): Remove piclist. - - * configure.in (MOSTLYCLEAN): Remove stamp-picdir. - -Mon Jun 5 18:36:39 1995 Jason Merrill - - * config/*.ml: Build both shared and archive libraries. - - * configure.in (MOSTLYCLEAN): Remove pic. - (frags): Use toplevel pic frags. - - * Makefile.in (piclist): New rule. - (SHLIB): Use it. - (stl.list): Removed. - (typeinfo.o): Also build pic version. - (stdexcept.o): Ditto. - (*stmp-*): Ditto. - -Tue May 30 12:01:14 1995 Jason Merrill - - * std/{complext,{f,d,ld}complex}.h: To declare specializations, - use friend declarations in the class body... - * std/cinst.h: ...rather than macro hackery. - - * Makefile.in (stdlist): Renamed from list. - - * cstdarg: Don't define __CSTDARG__. - * complex.h: Similarly. - -Tue May 9 19:31:20 1995 Jason Merrill - - * std/bastring.cc (operator>>): Use an int to store the return value - of streambuf::sbumpc. - (getline): Ditto. - * std/bastring.* (replace): Reverse size_t and charT arguments. - - * configure.in (enable_shared): Support enable_shared under AIX. - - * Makefile.in (SHARLIB): New variable and rule for building an - archive library containing a single shared object (for AIX). - -Mon May 8 01:43:19 1995 Jason Merrill - - * std/bastring.h (remove): Forgot one. - (empty): And this. - Disable copy-on-write if someone takes an iterator. - - * std/bastring.cc (getline): Avoid resizing down if unnecessary. - (operator>>): Don't use private methods. - -Sun May 7 02:39:56 1995 Jason Merrill - - * std/bastring.h (insert, replace): Fix. - * std/bastring.cc (find_*_of): Fix. - -Fri May 5 01:45:10 1995 Jason Merrill - - * std/bastring.h: Add iterator remove fn. Remove evil default - arguments. - - * std/*complex*, std/cinst.h, cinst.cc: s/__complex/complex/g. - complex is now specialized. Lose _*_complex in favor of - 'explicit' constructors. - * std/complex.h: Lose typedef of complex. - * std/fcomplex.h: New file. - * std/complext.cc (operator<<): Accept more input forms. - - * std/bastring.h: Add iterator insert fns. - -Thu May 4 02:30:04 1995 Jason Merrill - - * std/bastring.*: Update to current draft. - - * std/bastring.*: Reorganize so that the pointer in a string - object points to the data rather than the bsrep object, for - debugging. - -Tue Apr 25 17:15:09 1995 Jason Merrill - - * configure.in: Update to stay in sync with config.shared. - -Mon Apr 24 13:08:46 1995 Jason Merrill - - * std/complext.h: Declare hypot. Declare appropriate functions const. - -Wed Apr 12 15:26:25 1995 Jason Merrill - - * Makefile.in (typeinfo.o): Don't use $<. - (stdexcept.o): Ditto. - -Sat Apr 8 15:35:00 1995 Mike Stump - - * std/typeinfo.h: Move bad_cast, bad_typeid and __bad_cast_object - from here to stdexcept. - * std/stdexcept.h: Ditto. - * Makefile.in (stdexcept.o): Added rule to build typeinfo.o with - -frtti to support matching of thrown objects with rtti info for - bad_cast. - -Mon Apr 3 18:13:14 1995 Jason Merrill - - * typeinfo: New file. - - * Makefile.in (HEADERS): Add typeinfo. - -Mon Apr 3 15:06:58 1995 Mike Stump - - * Makefile.in (typeinfo.o): Added rule to build typeinfo.o with - -frtti to support matching of thrown objects with rtti info for - bad_cast. - -Wed Mar 29 15:56:06 1995 Mike Stump - - * typeinfo.cc: (__throw_type_match_rtti): Added to support - matching of thrown objects with rtti info. - -Thu Mar 23 18:42:30 1995 Jason Merrill - - * Makefile.in (HEADERS): Add stdexcept. - -Sun Mar 12 01:25:27 1995 Jason Merrill - - * std/typeinfo.h: Add return statements to dummy methods. - -Wed Mar 8 16:09:50 1995 Jason Merrill - - * config/dec-osf.ml: Use -rpath flag. - -Fri Feb 17 18:16:46 1995 Jason Merrill - - * std/typeinfo.h: Add copyright header. - - * Makefile.in (CXXFLAGS): Add a bunch of warning options to keep - me honest. - -Thu Feb 16 00:04:49 1995 Jason Merrill - - * Makefile.in, config/*.ml: Generate shared library on most hosts - as libstdc++.so.$(VERSION), with a symlink to libstdc++.so, so that - multiple versions can coexist. - -Fri Feb 10 02:59:39 1995 Jason Merrill - - * std/exception.h: {set_,}{terminate,unexpected} have C++ linkage. - - * Makefile.in: Allow string and complex to be split up either by - individual function or into I/O and non-I/O. Default to the - latter. - -Wed Feb 8 02:39:47 1995 Jason Merrill - - * std/bastring.h: Start thinking about throwing exceptions. - - * typeinfo.cc: Remove private functions; defining them to call - abort () just delays errors until runtime. Define - __bad_cast_object. - - * std/exception.h: Standard exceptions are now defined in - stdexcept.h. This header now contains declarations of terminate() - et al. - * exception.cc: Move code from libg++/src/except.c here. - * std/typeinfo.h: Define RTTI-related exceptions here. - * stdexcept{,.cc},std/stdexcept.h: New files. - -Mon Feb 6 18:51:31 1995 Jason Merrill - - * Makefile.in (HEADERS): Resurrect, add new STL header names. - (install): Install extensionless headers again. - * extensionless headers: Resurrect, add new STL headers. - Currently only forward to std/whatever or stl/whatever. - -Mon Jan 30 13:53:22 1995 Jason Merrill - - * std/bastring.h (basic_string (charT, size_t)): Mark explicit. - - * Makefile.in (install): Set rootme when installing stl headers. - Only install *.* from std. - -Wed Jan 25 02:29:30 1995 Jason Merrill - - * std/bastring.h (operator=): grab before releasing. - -Mon Jan 23 19:54:02 1995 Ronald F. Guilmette - - * Makefile.in (install): Also install STL headers. - -Mon Jan 23 04:09:35 1995 Jason Merrill - - * Makefile.in (list): Set $rootme before calling make. - -Wed Jan 11 19:24:47 1995 Jason Merrill - - * typeinfo.cc (__rtti_match): Don't try to do pointer arithmetic - with a void *. - - * move all headers into std subdirectory and update files accordingly. - -Thu Jan 5 01:51:49 1995 Jason Merrill - - * bastring.ccI (basic_string (size_t, capacity)): s/reserve/::reserve/. - -Wed Jan 4 17:27:32 1995 Jason Merrill - - * exception: s/string/__string/g. - - * configure.in (MOSTLYCLEAN): Add so_locations. - - * bastring.ccI (basic_string (size_t, capacity)): Fix thinko. - (various find functions): Ditto. - -Fri Dec 30 18:04:00 1994 Mike Stump - - * typeinfo.h: Add support for the built-in type bool. - -Fri Dec 30 14:57:02 1994 Mike Stump - - * typeinfo.{cc, h}: Guard against multiple inclusions, and add #p i/i. - -Fri Dec 2 17:56:05 1994 Mike Stump - - * libg++ 2.6.2 released. - - * typeinfo.{cc, h} (__rtti_match): Change interface to compiler - for dynamic_casting to gear up for exception handling's use of - rtti for argument matching. - -Tue Nov 29 16:49:32 1994 Per Bothner - - * configure.in (configdirs): Add stl. - * Makefile.in: Build stl, and merge .o files from it. - -Thu Nov 17 15:30:57 1994 Jason Merrill - - * bastring.hI: Add iterator, const_iterator, begin() and end() to - basic_string. - -Mon Nov 7 16:50:33 1994 Jason Merrill - - * Makefile.in, configure.in, config/*.ml, tests/Makefile.in, - tests/configure.in: Various changes to handle --enable-shared. - -Fri Nov 4 19:13:33 1994 Mike Stump - - * exception{,.cc}: Added to support catching bad_cast's. - -Thu Nov 3 17:42:13 1994 Mike Stump - - * typeinfo.h (type_info::{name, before}): Add to match draft. - -Thu Nov 3 00:56:34 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * Makefile.in (LIBIBERTY_OBJS): Add strerror.o. - -Mon Oct 31 15:33:06 1994 Kung Hsu (kung@mexican.cygnus.com) - - * typeinfo.cc: Fix a bug in the final return. - * typeinfo.cc: Fix the ANSI header version number. - * typeinfo.h: ditto. - -Fri Oct 28 14:23:12 1994 Mike Stump - - * type_info.{cc,h}: Rename to typeinfo to better match current draft. - -Wed Oct 26 11:13:53 1994 Kung Hsu (kung@mexican.cygnus.com) - - * type_info.h: new header file for rtti. - * type_info.cc: new code file for rtti. - * Makefile.in: change to include type_info.o in libstdc++ for rtti. - -Sat Oct 15 16:09:51 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * libg++ 2.6.1 released. - - * cinst.hI: Also declare instantiations of out-of-line functions. - -Fri Oct 14 15:00:09 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * configure.in (CXXINCLUDES): Use {} to wrap variable name. - * tests/configure.in (CXXINCLUDES): Ditto. - - * cinst.hI: Declare instantiations of two-argument functions so - overload resolution will work. - * complext.hI: Always include cinst.hI. - - * bastring.ccI (operator>>): Tweak. - -Tue Oct 11 17:07:49 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * stddef*: Do the #pragma i/i thang. - - * bastring.hI (basic_string::put_at): Use operator[]. - (basic_string::terminate): Don't necessarily copy the rep. - - * bastring.ccI (operator>>): Avoid shrinking and then re-expanding - the string. - - * bastring.*I, sinst.cc: Only allow allocation policy control if - _G_ALLOC_CONTROL is defined. - - * Makefile.in (libstdc++.a): Depend on iostream.list and libiberty.a. - (../libio/iostream.list): New rule. - (../libiberty/libiberty.a): New rule. - (OBJS): Add stddef.o. - -Sat Oct 8 23:59:45 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * *: First checkin. diff --git a/contrib/libstdc++/FREEBSD-upgrade b/contrib/libstdc++/FREEBSD-upgrade deleted file mode 100644 index 1da945c134..0000000000 --- a/contrib/libstdc++/FREEBSD-upgrade +++ /dev/null @@ -1,19 +0,0 @@ -# ex:ts=8 -$FreeBSD: src/contrib/libstdc++/FREEBSD-upgrade,v 1.1 1999/11/01 07:24:11 obrien Exp $ -$DragonFly: src/contrib/libstdc++/Attic/FREEBSD-upgrade,v 1.2 2003/06/17 04:24:03 dillon Exp $ - -For the import of libstdc++, files were pruned by: - - tar xvypf gcc-2.95.1.tar.bz2 '*/libobjc' - -Then imported by: - cvs -d /home/ncvs import -m "Virgin import of GCC 2.95.2's libstdc++" \ - src/contrib/libstdc++ FSF gcc_2_95_2 - -To make local changes to libstdc++, simply patch and commit to the main -branch (aka HEAD). Never make local changes on the vendor (FSF) branch. - -All local changes should be submitted to "gcc-patches@gcc.gnu.org". - -obrien@NUXI.com -31-October-1999 diff --git a/contrib/libstdc++/Makefile.in b/contrib/libstdc++/Makefile.in deleted file mode 100644 index f13eddcf29..0000000000 --- a/contrib/libstdc++/Makefile.in +++ /dev/null @@ -1,385 +0,0 @@ -# Copyright (C) 1994, 1995 Free Software Foundation - -# This file is part of the GNU ANSI C++ Library. This library is free -# software; you can redistribute it and/or modify it under the terms of -# the GNU General Public License as published by the Free Software -# Foundation; either version 2, or (at your option) any later version. - -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this library; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -VERSION = 2.10.0 -INTERFACE = 3 - -gxx_include_dir=${includedir}/g++ - -OBJS = cstringi.o stdexcepti.o cstdlibi.o cmathi.o stlinst.o valarray.o -SUBLIBS = $(STAMP)-string $(STAMP)-complx - -# C++ headers with no extension -HEADERS= cassert cctype cerrno cfloat ciso646 climits clocale cmath complex \ - csetjmp csignal cstdarg cstddef cstdio cstdlib cstring ctime \ - cwchar cwctype string stdexcept \ - algorithm deque functional hash_map hash_set iterator list map \ - memory numeric pthread_alloc queue rope set slist stack utility \ - vector fstream iomanip iostream strstream iosfwd bitset valarray \ - sstream - -ARLIB = libstdc++.a.$(VERSION) -ARLINK = libstdc++.a -MARLINK = libstdc++.a.`echo $(VERSION) | sed 's/\([0-9]*[.][0-9]*\).*/\1/'` -SHLIB = libstdc++.so.$(VERSION) -SHARLIB = libstdc++-sh.a -SHLINK = libstdc++.so -MSHLINK = libstdc++.so.`echo $(VERSION) | sed 's/\([0-9]*[.][0-9]*\).*/\1/'` -SHFLAGS = -SHDEPS = - -STAMP = bigstmp - -LIBS = $(ARLIB) $(ARLINK) - -#### package, host, target, and site dependent Makefile fragments come in here. -## - -IO_DIR = ../libio -LIBIBERTY_DIR = ../libiberty - -LIBIBERTY_OBJS = `cat $(LIBIBERTY_DIR)/needed-list` strerror.o - -tooldir = $(exec_prefix)/$(target) -# This is where the libraries will be installed; note, it will be set -# at make runtime now. See below at target install. -INSTALLDIR = $(libdir) - -MOSTLYCLEAN_JUNK = *stmp-* tlib*.a *.s *.ii stdlist piclist -CLEAN_JUNK = $(LIBS) - -.PHONY: libs -libs: $(LIBS) - -stdlist: $(IO_DIR)/iostream.list $(OBJS) $(SUBLIBS) $(LIBIBERTY_DIR)/libiberty.a - -rm -f tlist - touch tlist - echo *.o >> tlist - for f in `cat $(IO_DIR)/iostream.list` ; do \ - echo "$(IO_DIR)/$$f" >> tlist ; \ - done - for f in $(LIBIBERTY_OBJS) ; do \ - echo "$(LIBIBERTY_DIR)/$$f" >> tlist ; \ - done - mv tlist stdlist - -piclist: stdlist - -rm -f tlist - cp stdlist tlist - if [ x"$(enable_shared)" = xyes ]; then \ - sed 's,\([A-Za-z_]*\.o\),pic/\1,g' tlist > tlist2 ; \ - mv tlist2 tlist ; \ - else true ; fi - mv tlist piclist - -$(ARLIB): stdlist - -rm -f t$(ARLIB) - $(AR) $(AR_FLAGS) t$(ARLIB) `cat stdlist` - mv t$(ARLIB) $(ARLIB) - $(RANLIB) $(ARLIB) - -$(ARLINK): - -rm -f $(ARLINK) - $(LN_S) $(ARLIB) $(ARLINK) || cp $(ARLIB) $(ARLINK) - -marlink: - @$(MAKE) $(MARLINK) "ARLINK=$(MARLINK)" - -$(SHLIB): piclist - $(CC) $(LIBCXXFLAGS) $(SHFLAGS) -shared -o $(SHLIB) `cat piclist` $(SHDEPS) - -$(SHARLIB): $(SHLIB) - -rm -f t$(SHARLIB) - $(AR) $(AR_FLAGS) t$(SHARLIB) $(SHLIB) - mv t$(SHARLIB) $(SHARLIB) - $(RANLIB) $(SHARLIB) - -$(SHLINK): - -rm -f $(SHLINK) - $(LN_S) $(SHLIB) $(SHLINK) || cp $(ARLIB) $(ARLINK) - -mshlink: - @$(MAKE) $(MSHLINK) "SHLINK=$(MSHLINK)" - -$(IO_DIR)/iostream.list: force - cd $(IO_DIR) ; $(MAKE) $(FLAGS_TO_PASS) iostream.list - -$(LIBIBERTY_DIR)/libiberty.a: - cd $(LIBIBERTY_DIR) ; $(MAKE) $(FLAGS_TO_PASS) - -STRFUNCS = REP MAIN TRAITS ADDSS ADDPS ADDCS ADDSP ADDSC \ - EQSS EQPS EQSP NESS NEPS NESP LTSS LTPS LTSP GTSS GTPS GTSP \ - LESS LEPS LESP GESS GEPS GESP -STRIO = EXTRACT INSERT GETLINE - -# These are here for SunOS VPATH. -cstringi.o: cstringi.cc -cstdlibi.o: cstdlibi.cc -cmathi.o: cmathi.cc -stdexcepti.o: stdexcepti.cc -stlinst.o: stlinst.cc -valarray.o: valarray.cc - -# Later do wide strings, too. -stmp-string: ${srcdir}/sinst.cc ${srcdir}/std/bastring.h \ - ${srcdir}/std/bastring.cc ${srcdir}/std/straits.h - for name in $(STRFUNCS) $(STRIO); do \ - echo c$${name}; \ - if [ x"$(enable_shared)" = xyes ]; then \ - $(COMPILE.cc) $(PICFLAG) -DC -D$${name} ${srcdir}/sinst.cc \ - -o pic/c$${name}.o; \ - else true ; fi; \ - if [ $$? -eq 0 ]; then true; else exit 1; fi; \ - $(COMPILE.cc) -DC -D$${name} ${srcdir}/sinst.cc -o c$${name}.o; \ - if [ $$? -eq 0 ]; then true; else exit 1; fi; \ - done - touch stmp-string - -bigstmp-string: ${srcdir}/sinst.cc ${srcdir}/std/bastring.h \ - ${srcdir}/std/bastring.cc ${srcdir}/std/straits.h - echo cstring - if [ x"$(enable_shared)" = xyes ]; then \ - $(COMPILE.cc) $(PICFLAG) -DC \ - `for N in $(STRFUNCS); do echo " -D$${N}"; done` \ - $(srcdir)/sinst.cc -o pic/cstrmain.o; \ - else true ; fi - $(COMPILE.cc) -DC `for N in $(STRFUNCS); do echo " -D$${N}"; done` \ - $(srcdir)/sinst.cc -o cstrmain.o - echo cstrio - if [ x"$(enable_shared)" = xyes ]; then \ - $(COMPILE.cc) $(PICFLAG) -DC \ - `for N in $(STRIO); do echo " -D$${N}"; done` \ - $(srcdir)/sinst.cc -o pic/cstrio.o; \ - else true ; fi - $(COMPILE.cc) -DC `for N in $(STRIO); do echo " -D$${N}"; done` \ - $(srcdir)/sinst.cc -o cstrio.o - touch bigstmp-string - -COMFUNCS = MAIN ADDCC ADDCF ADDFC SUBCC SUBCF SUBFC MULCC MULCF MULFC DIVCC \ - DIVCF DIVFC PLUS MINUS EQCC EQCF EQFC NECC NECF NEFC ABS ARG POLAR \ - CONJ NORM COS COSH EXP LOG POWCC POWCF POWCI POWFC SIN SINH SQRT -COMIO = EXTRACT INSERT - -stmp-complx: ${srcdir}/cinst.cc ${srcdir}/std/complext.h \ - ${srcdir}/std/complext.cc ${srcdir}/std/dcomplex.h \ - ${srcdir}/std/ldcomplex.h - for N in $(COMFUNCS) $(COMIO); do \ - echo f$${N}; \ - if [ x"$(enable_shared)" = xyes ]; then \ - $(COMPILE.cc) $(PICFLAG) -DF -D$${N} $(srcdir)/cinst.cc \ - -o pic/f$${N}.o; \ - else true ; fi; \ - if [ $$? -eq 0 ]; then true; else exit 1; fi; \ - $(COMPILE.cc) -DF -D$${N} ${srcdir}/cinst.cc -o f$${N}.o; \ - if [ $$? -eq 0 ]; then true; else exit 1; fi; \ - echo d$${N}; \ - if [ x"$(enable_shared)" = xyes ]; then \ - $(COMPILE.cc) $(PICFLAG) -DD -D$${N} $(srcdir)/cinst.cc \ - -o pic/d$${N}.o; \ - else true ; fi; \ - if [ $$? -eq 0 ]; then true; else exit 1; fi; \ - $(COMPILE.cc) -DD -D$${N} ${srcdir}/cinst.cc -o d$${N}.o; \ - if [ $$? -eq 0 ]; then true; else exit 1; fi; \ - echo ld$${N}; \ - if [ x"$(enable_shared)" = xyes ]; then \ - $(COMPILE.cc) $(PICFLAG) -DLD -D$${N} $(srcdir)/cinst.cc \ - -o pic/ld$${N}.o; \ - else true ; fi; \ - if [ $$? -eq 0 ]; then true; else exit 1; fi; \ - $(COMPILE.cc) -DLD -D$${N} ${srcdir}/cinst.cc -o ld$${N}.o; \ - if [ $$? -eq 0 ]; then true; else exit 1; fi; \ - done - touch stmp-complx - -bigstmp-complx: ${srcdir}/cinst.cc ${srcdir}/std/complext.h \ - ${srcdir}/std/complext.cc ${srcdir}/std/dcomplex.h \ - ${srcdir}/std/ldcomplex.h - echo fcomplex - if [ x"$(enable_shared)" = xyes ]; then \ - $(COMPILE.cc) $(PICFLAG) -DF \ - `for N in $(COMFUNCS); do echo " -D$${N}"; done` \ - $(srcdir)/cinst.cc -o pic/fcomplex.o; \ - else true ; fi - $(COMPILE.cc) -DF `for N in $(COMFUNCS); do echo " -D$${N}"; done` \ - $(srcdir)/cinst.cc -o fcomplex.o - echo fcomio - if [ x"$(enable_shared)" = xyes ]; then \ - $(COMPILE.cc) $(PICFLAG) -DF \ - `for N in $(COMIO); do echo " -D$${N}"; done` \ - $(srcdir)/cinst.cc -o pic/fcomio.o; \ - else true ; fi - $(COMPILE.cc) -DF `for N in $(COMIO); do echo " -D$${N}"; done` \ - $(srcdir)/cinst.cc -o fcomio.o - echo dcomplex - if [ x"$(enable_shared)" = xyes ]; then \ - $(COMPILE.cc) $(PICFLAG) -DD \ - `for N in $(COMFUNCS); do echo " -D$${N}"; done` \ - $(srcdir)/cinst.cc -o pic/dcomplex.o; \ - else true ; fi - $(COMPILE.cc) -DD `for N in $(COMFUNCS); do echo " -D$${N}"; done` \ - $(srcdir)/cinst.cc -o dcomplex.o - echo dcomio - if [ x"$(enable_shared)" = xyes ]; then \ - $(COMPILE.cc) $(PICFLAG) -DD \ - `for N in $(COMIO); do echo " -D$${N}"; done` \ - $(srcdir)/cinst.cc -o pic/dcomio.o; \ - else true ; fi - $(COMPILE.cc) -DD `for N in $(COMIO); do echo " -D$${N}"; done` \ - $(srcdir)/cinst.cc -o dcomio.o - echo ldcomplex - if [ x"$(enable_shared)" = xyes ]; then \ - $(COMPILE.cc) $(PICFLAG) -DLD \ - `for N in $(COMFUNCS); do echo " -D$${N}"; done` \ - $(srcdir)/cinst.cc -o pic/ldcomplex.o; \ - else true ; fi - $(COMPILE.cc) -DLD `for N in $(COMFUNCS); do echo " -D$${N}"; done` \ - $(srcdir)/cinst.cc -o ldcomplex.o - echo ldcomio - if [ x"$(enable_shared)" = xyes ]; then \ - $(COMPILE.cc) $(PICFLAG) -DLD \ - `for N in $(COMIO); do echo " -D$${N}"; done` \ - $(srcdir)/cinst.cc -o pic/ldcomio.o; \ - else true ; fi - $(COMPILE.cc) -DLD `for N in $(COMIO); do echo " -D$${N}"; done` \ - $(srcdir)/cinst.cc -o ldcomio.o - touch bigstmp-complx - -.PHONY: install -install: - rootme=`pwd`/ ; export rootme ; \ - if [ -z "$(MULTISUBDIR)" ]; then \ - cd $(srcdir); \ - for FILE in $(HEADERS); do \ - rm -f $(gxx_include_dir)/$$FILE ; \ - if [ -f stl/$$FILE ]; then \ - $(INSTALL_DATA) stl/$$FILE $(gxx_include_dir)/$$FILE ; \ - else \ - $(INSTALL_DATA) $$FILE $(gxx_include_dir)/$$FILE ; \ - fi ; \ - chmod a-x $(gxx_include_dir)/$$FILE ; \ - done ; \ - for FILE in *.h std/*.h std/*.cc std/*.tcc; do \ - rm -f $(gxx_include_dir)/$$FILE ; \ - $(INSTALL_DATA) $$FILE $(gxx_include_dir)/$$FILE ; \ - chmod a-x $(gxx_include_dir)/$$FILE ; \ - done ; \ - cd stl; \ - for FILE in *.h; do \ - rm -f $(gxx_include_dir)/$$FILE ; \ - $(INSTALL_DATA) $$FILE $(gxx_include_dir)/$$FILE ; \ - chmod a-x $(gxx_include_dir)/$$FILE ; \ - done ; \ - else true ; \ - fi - rootme=`pwd`/ ; export rootme ; \ - if [ x$(enable_version_specific_runtime_libs) != xyes ]; then \ - INSTALLDIR=$(libdir); \ - else \ - INSTALLDIR=$(libsubdir); \ - fi; \ - INSTALLLINKDIR=$(libsubdir); \ - if [ $${INSTALLLINKDIR}$(MULTISUBDIR) = $${INSTALLDIR}$(MULTISUBDIR) ]; then \ - RELINSTALLDIR=; \ - elif [ x$(MULTISUBDIR) = x ]; then \ - if [ $(build_alias) = $(target_alias) ]; then \ - RELINSTALLDIR=../../../; \ - else \ - RELINSTALLDIR=../../../../$(target_alias)/lib/; \ - fi; \ - else \ - if [ $(build_alias) = $(target_alias) ]; then \ - RELINSTALLDIR=../../..`echo $(MULTISUBDIR) | sed -e 's,/[^/]*,/..,g'`$(MULTISUBDIR)/; \ - else \ - RELINSTALLDIR=../../../..`echo $(MULTISUBDIR) | sed -e 's,/[^/]*,/..,g'`/$(target_alias)/lib$(MULTISUBDIR)/; \ - fi; \ - fi; \ - if [ $(build_alias) != $(target_alias) ]; then \ - case $$RELINSTALLDIR in \ - ../../../|../../../../) \ - RELINSTALLDIR=../$${RELINSTALLDIR}$(target_alias)/lib/;; \ - esac; \ - fi; \ - rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$(SHLINK) ; \ - rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$(ARLINK) ; \ - for FILE in $(LIBS) ; do \ - rm -f $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \ - if [ $$FILE = $(SHLINK) ] ; then \ - if [ -f $${INSTALLDIR}/$(MSHLINK) ]; then \ - rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \ - $(LN_S) $${RELINSTALLDIR}$(MSHLINK) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE \ - || cp $${RELINSTALLDIR}$(MSHLINK) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \ - else \ - rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \ - $(LN_S) $${RELINSTALLDIR}$(SHLIB) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE \ - || cp $${RELINSTALLDIR}$(SHLIB) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \ - fi; \ - elif [ $$FILE = $(ARLINK) ] ; then \ - if [ -f $${INSTALLDIR}/$(MARLINK) ]; then \ - rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \ - $(LN_S) $${RELINSTALLDIR}$(MARLINK) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE \ - || cp $${RELINSTALLDIR}$(MARLINK) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \ - else \ - rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \ - $(LN_S) $${RELINSTALLDIR}$(ARLIB) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE \ - || cp $${RELINSTALLDIR}$(ARLIB) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \ - fi; \ - elif [ $$FILE = mshlink ]; then \ - for FILE in $(MSHLINK) ; do \ - rm -f $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \ - $(LN_S) $(SHLIB) $${INSTALLDIR}$(MULTISUBDIR)/$$FILE \ - || cp $(SHLIB) $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \ - done; \ - elif [ $$FILE = marlink ]; then \ - for FILE in $(MARLINK) ; do \ - rm -f $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \ - $(LN_S) $(ARLIB) $${INSTALLDIR}$(MULTISUBDIR)/$$FILE \ - || cp $(ARLIB) $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \ - done; \ - elif [ $$FILE = $(SHLIB) ]; then \ - $(INSTALL_PROGRAM) $$FILE $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \ - : On the HP, shared libraries must be mode 555. ;\ - chmod 555 $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \ - else \ - $(INSTALL_DATA) $$FILE $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \ - $(RANLIB) $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \ - chmod a-x $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \ - fi ; \ - done - @rootme=`pwd`/ ; export rootme ; \ - $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install - -.PHONY: force -force: - -MYCXXFLAGS = -g -O2 -Wpointer-arith -Wnested-externs -Woverloaded-virtual -Wbad-function-cast -Winline -Wwrite-strings -pedantic -Wno-long-long -MYCFLAGS = -g -O2 -Wpointer-arith -Wnested-externs - -.PHONY: stuff -stuff: - $(MAKE) stuff1 - $(MAKE) stuff2 - -stuff1: - $(MAKE) clean - $(MAKE) -C ../libio c++clean - touch ../../gcc/libgcc2.ready - -stuff2: - $(MAKE) -C ../../gcc/ libgcc.a - $(MAKE) CXXFLAGS="$(MYCXXFLAGS)" CFLAGS="$(MYCFLAGS)" - -$(MAKE) check - -$(MAKE) -C ../libio check - -$(MAKE) -C ../../gcc check-g++ diff --git a/contrib/libstdc++/NEWS b/contrib/libstdc++/NEWS deleted file mode 100644 index 89e866e7d3..0000000000 --- a/contrib/libstdc++/NEWS +++ /dev/null @@ -1,9 +0,0 @@ -SUMMARY OF RECENT MAJOR CHANGES to LIBSTDC++. -(Also check ../libio/NEWS.) - -*** Noteworthy changes in libstdc++ for EGCS - -* EGCS includes the SGI STL implementation without changes. - -* As a result of these and other changes, libstc++ for EGCS is not binary - compatible with previous releases of libstdc++. diff --git a/contrib/libstdc++/cassert b/contrib/libstdc++/cassert deleted file mode 100644 index b4165bfae7..0000000000 --- a/contrib/libstdc++/cassert +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CASSERT__ -#define __CASSERT__ -#include -#endif diff --git a/contrib/libstdc++/cctype b/contrib/libstdc++/cctype deleted file mode 100644 index e2765aed50..0000000000 --- a/contrib/libstdc++/cctype +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- character type header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CCTYPE__ -#define __CCTYPE__ -#include -#endif diff --git a/contrib/libstdc++/cerrno b/contrib/libstdc++/cerrno deleted file mode 100644 index ce49346959..0000000000 --- a/contrib/libstdc++/cerrno +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- error number header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CERRNO__ -#define __CERRNO__ -#include -#endif diff --git a/contrib/libstdc++/cfloat b/contrib/libstdc++/cfloat deleted file mode 100644 index cf59eadfb7..0000000000 --- a/contrib/libstdc++/cfloat +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CFLOAT__ -#define __CFLOAT__ -#include -#endif diff --git a/contrib/libstdc++/cinst.cc b/contrib/libstdc++/cinst.cc deleted file mode 100644 index 983e8a9caa..0000000000 --- a/contrib/libstdc++/cinst.cc +++ /dev/null @@ -1,154 +0,0 @@ -// Instantiation file for the -*- C++ -*- complex number classes. -// Copyright (C) 1994 Free Software Foundation - -#ifdef F -typedef float f; -#endif -#ifdef D -typedef double f; -#endif -#ifdef LD -typedef long double f; -#endif - -#if defined (MAIN) && defined (__GNUG__) -#ifdef F -#pragma implementation "fcomplex" -#endif -#ifdef D -#pragma implementation "dcomplex" -#endif -#ifdef LD -#pragma implementation "ldcomplex" -#endif -#endif - -#if 0 -#define _G_NO_EXTERN_TEMPLATES -#endif -#include - -typedef complex c; -typedef const c& ccr; - -#ifdef MAIN -template c& __doapl (c*, ccr); -template c& __doaml (c*, ccr); -template c& __doami (c*, ccr); -template c& __doadv (c*, ccr); -#endif - -#ifdef ADDCC -template c operator+ (ccr, ccr); -#endif -#ifdef ADDCF -template c operator+ (ccr, f); -#endif -#ifdef ADDFC -template c operator+ (f, ccr); -#endif -#ifdef SUBCC -template c operator- (ccr, ccr); -#endif -#ifdef SUBCF -template c operator- (ccr, f); -#endif -#ifdef SUBFC -template c operator- (f, ccr); -#endif -#ifdef MULCC -template c operator* (ccr, ccr); -#endif -#ifdef MULCF -template c operator* (ccr, f); -#endif -#ifdef MULFC -template c operator* (f, ccr); -#endif -#ifdef DIVCC -template c operator/ (ccr, ccr); -#endif -#ifdef DIVCF -template c operator/ (ccr, f); -#endif -#ifdef DIVFC -template c operator/ (f, ccr); -#endif -#ifdef PLUS -template c operator+ (ccr); -#endif -#ifdef MINUS -template c operator- (ccr); -#endif -#ifdef EQCC -template bool operator== (ccr, ccr); -#endif -#ifdef EQCF -template bool operator== (ccr, f); -#endif -#ifdef EQFC -template bool operator== (f, ccr); -#endif -#ifdef NECC -template bool operator!= (ccr, ccr); -#endif -#ifdef NECF -template bool operator!= (ccr, f); -#endif -#ifdef NEFC -template bool operator!= (f, ccr); -#endif -#ifdef ABS -template f abs (ccr); -#endif -#ifdef ARG -template f arg (ccr); -#endif -#ifdef POLAR -template c polar (f, f); -#endif -#ifdef CONJ -template c conj (ccr); -#endif -#ifdef NORM -template f norm (ccr); -#endif -#ifdef COS -template c cos (ccr); -#endif -#ifdef COSH -template c cosh (ccr); -#endif -#ifdef EXP -template c exp (ccr); -#endif -#ifdef LOG -template c log (ccr); -#endif -#ifdef POWCC -template c pow (ccr, ccr); -#endif -#ifdef POWCF -template c pow (ccr, f); -#endif -#ifdef POWCI -template c pow (ccr, int); -#endif -#ifdef POWFC -template c pow (f, ccr); -#endif -#ifdef SIN -template c sin (ccr); -#endif -#ifdef SINH -template c sinh (ccr); -#endif -#ifdef SQRT -template c sqrt (ccr); -#endif -#ifdef EXTRACT -template istream& operator>> (istream&, complex&); -#endif -#ifdef INSERT -template ostream& operator<< (ostream&, const complex&); -#endif diff --git a/contrib/libstdc++/ciso646 b/contrib/libstdc++/ciso646 deleted file mode 100644 index 4d8200d73d..0000000000 --- a/contrib/libstdc++/ciso646 +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CISO646__ -#define __CISO646__ -#include -#endif diff --git a/contrib/libstdc++/climits b/contrib/libstdc++/climits deleted file mode 100644 index 1b29b3af01..0000000000 --- a/contrib/libstdc++/climits +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CLIMITS__ -#define __CLIMITS__ -#include -#endif diff --git a/contrib/libstdc++/clocale b/contrib/libstdc++/clocale deleted file mode 100644 index b67cf31c9d..0000000000 --- a/contrib/libstdc++/clocale +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- locale support header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CLOCALE__ -#define __CLOCALE__ -#include -#endif diff --git a/contrib/libstdc++/cmath b/contrib/libstdc++/cmath deleted file mode 100644 index b18ea0b428..0000000000 --- a/contrib/libstdc++/cmath +++ /dev/null @@ -1,76 +0,0 @@ -// The -*- C++ -*- math functions header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CMATH__ -#define __CMATH__ -#include <_G_config.h> -#include - -#ifdef __GNUG__ -#pragma interface "cmath" -#endif - -extern "C++" { -#if 0 -float acos (float); -float asin (float); -float atan (float); -float atan2(float, float); -float ceil (float); -float cos (float); -float cosh (float); -float exp (float); -float fabs (float); -float floor(float); -float fmod (float, float); -float frexp(float, int*); -float modf (float, float*); -float ldexp(float, int); -float log (float); -float log10(float); -float pow (float, float); -float pow (float, int); -float sin (float); -float sinh (float); -float sqrt (float); -float tan (float); -float tanh (float); -#endif - -inline float abs (float x) { return fabs (x); } -#if ! _G_MATH_H_INLINES /* hpux and SCO define this in math.h */ -inline double abs (double x) { return fabs (x); } -#endif - -#if 0 -double pow(double, int); - -long double acos (long double); -long double asin (long double); -long double atan (long double); -long double atan2(long double, long double); -long double ceil (long double); -long double cos (long double); -long double cosh (long double); -long double exp (long double); -long double fabs (long double); -long double floor(long double); -long double frexp(long double, int*); -long double fmod (long double, long double); -long double frexp(long double, int*); -long double log (long double); -long double log10(long double); -long double modf (long double, long double*); -long double pow (long double, long double); -long double pow (long double, int); -long double sin (long double); -long double sinh (long double); -long double sqrt (long double); -long double tan (long double); -long double tanh (long double); -#endif -inline long double abs (long double x) { return fabs (x); } - -} // extern "C++" - -#endif diff --git a/contrib/libstdc++/cmathi.cc b/contrib/libstdc++/cmathi.cc deleted file mode 100644 index afd740f013..0000000000 --- a/contrib/libstdc++/cmathi.cc +++ /dev/null @@ -1,7 +0,0 @@ -// Implementation file for the -*- C++ -*- math functions header. -// This file is part of the GNU ANSI C++ Library. - -#ifdef __GNUG__ -#pragma implementation "cmath" -#endif -#include diff --git a/contrib/libstdc++/complex b/contrib/libstdc++/complex deleted file mode 100644 index bfdd352b46..0000000000 --- a/contrib/libstdc++/complex +++ /dev/null @@ -1,18 +0,0 @@ -// Main header for the -*- C++ -*- complex number classes. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __COMPLEX__ -#define __COMPLEX__ - -#include - -extern "C++" { -#define __STD_COMPLEX - -// ANSI complex types -typedef complex float_complex; -typedef complex double_complex; -typedef complex long_double_complex; -} - -#endif diff --git a/contrib/libstdc++/complex.h b/contrib/libstdc++/complex.h deleted file mode 100644 index 2e88de854a..0000000000 --- a/contrib/libstdc++/complex.h +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- backward compatiblity header. -// Copyright (C) 1994 Free Software Foundation - -#ifndef __COMPLEX_H__ -#include -#endif diff --git a/contrib/libstdc++/config/aix.ml b/contrib/libstdc++/config/aix.ml deleted file mode 100644 index dec7a905a3..0000000000 --- a/contrib/libstdc++/config/aix.ml +++ /dev/null @@ -1,9 +0,0 @@ -# AIX has wierd shared/non-shared libraries. - -ARLIB = libstdc++-ar.a.$(VERSION) -ARLINK = libstdc++-ar.a -SHLINK = libstdc++.a -LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK) -DEPLIBS = ../$(SHLIB) -SHDEPS = -lm -SHFLAGS = -Wl,-unix diff --git a/contrib/libstdc++/config/dec-osf.ml b/contrib/libstdc++/config/dec-osf.ml deleted file mode 100644 index a11f373d84..0000000000 --- a/contrib/libstdc++/config/dec-osf.ml +++ /dev/null @@ -1,6 +0,0 @@ -# We don't need -fpic on the alpha, so let's install both the shared and -# non-shared versions. - -LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK) -DEPLIBS = ../$(SHLIB) -SHDEPS = -lm diff --git a/contrib/libstdc++/config/delta.mt b/contrib/libstdc++/config/delta.mt deleted file mode 100644 index b0b36db106..0000000000 --- a/contrib/libstdc++/config/delta.mt +++ /dev/null @@ -1,2 +0,0 @@ -# If FPU instructions are generated by default, we have to use a special libm.a -MLDLIBS = $(LDLIBS) `case "$(CXXFLAGS)" in *-m68000* | *-mc68000* | *-msoft-float* ) echo -lm ;; * ) echo -lm881 ;; esac` diff --git a/contrib/libstdc++/config/elf.ml b/contrib/libstdc++/config/elf.ml deleted file mode 100644 index bd711debf8..0000000000 --- a/contrib/libstdc++/config/elf.ml +++ /dev/null @@ -1,8 +0,0 @@ -# Elf without shared libm -- we have to link with the archive library, even -# for programs that don't use complex. - -LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK) -SHFLAGS = -h $(SHLIB) -DEPLIBS = ../$(SHLIB) -LDLIBS = -L.. -lstdc++ -lm -MLDLIBS = -L.. -lstdc++ -lm diff --git a/contrib/libstdc++/config/elfshlibm.ml b/contrib/libstdc++/config/elfshlibm.ml deleted file mode 100644 index 826f0bc091..0000000000 --- a/contrib/libstdc++/config/elfshlibm.ml +++ /dev/null @@ -1,6 +0,0 @@ -# Elf with shared libm, so we can link it into the shared libstdc++. - -LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK) -SHFLAGS = -h $(SHLIB) -SHDEPS = -lm -DEPLIBS = ../$(SHLIB) diff --git a/contrib/libstdc++/config/freebsd.ml b/contrib/libstdc++/config/freebsd.ml deleted file mode 100644 index 3ee682690a..0000000000 --- a/contrib/libstdc++/config/freebsd.ml +++ /dev/null @@ -1,6 +0,0 @@ -# Elf with shared libm, so we can link it into the shared libstdc++. - -LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK) mshlink -SHFLAGS = -Wl,-soname,$(MSHLINK) -SHDEPS = -lm -DEPLIBS = ../$(SHLIB) diff --git a/contrib/libstdc++/config/gnu.ml b/contrib/libstdc++/config/gnu.ml deleted file mode 100644 index 2a0380327f..0000000000 --- a/contrib/libstdc++/config/gnu.ml +++ /dev/null @@ -1,6 +0,0 @@ -# Elf with shared libm, so we can link it into the shared libstdc++. - -LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK) -SHFLAGS = -Wl,-soname,$(SHLIB) -SHDEPS = -lm -DEPLIBS = ../$(SHLIB) diff --git a/contrib/libstdc++/config/hpux.ml b/contrib/libstdc++/config/hpux.ml deleted file mode 100644 index a39602a640..0000000000 --- a/contrib/libstdc++/config/hpux.ml +++ /dev/null @@ -1,6 +0,0 @@ -# HPUX uses the .sl suffix for shared libraries. - -SHLIB = libstdc++.sl -LIBS = $(ARLIB) $(ARLINK) $(SHLIB) -DEPLIBS = ../$(SHLIB) -SHFLAGS = $(PICFLAG) diff --git a/contrib/libstdc++/config/irix5.ml b/contrib/libstdc++/config/irix5.ml deleted file mode 100644 index 055c832c26..0000000000 --- a/contrib/libstdc++/config/irix5.ml +++ /dev/null @@ -1,6 +0,0 @@ -# We don't need -fpic on IRIX, so let's install both the shared and -# non-shared versions. - -LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK) -DEPLIBS = ../$(SHLIB) -SHDEPS = -lm diff --git a/contrib/libstdc++/config/linux.ml b/contrib/libstdc++/config/linux.ml deleted file mode 100644 index 14dcb45b79..0000000000 --- a/contrib/libstdc++/config/linux.ml +++ /dev/null @@ -1,11 +0,0 @@ -# Elf with shared libm, so we can link it into the shared libstdc++. - -ARLIB = libstdc++-$(LIBSTDCXX_INTERFACE)$(LIBC_INTERFACE)$(CXX_INTERFACE)-$(VERSION).a -MARLINK = libstdc++$(LIBC_INTERFACE)$(CXX_INTERFACE).a.$(LIBSTDCXX_INTERFACE) -SHLIB = libstdc++-$(LIBSTDCXX_INTERFACE)$(LIBC_INTERFACE)$(CXX_INTERFACE)-$(VERSION).so -MSHLINK = libstdc++$(LIBC_INTERFACE)$(CXX_INTERFACE).so.$(LIBSTDCXX_INTERFACE) - -LIBS = $(ARLIB) marlink $(ARLINK) $(SHLIB) mshlink $(SHLINK) -SHFLAGS = -Wl,-soname,$(MSHLINK) -SHDEPS = -lm -DEPLIBS = ../$(SHLIB) diff --git a/contrib/libstdc++/config/linux.mt b/contrib/libstdc++/config/linux.mt deleted file mode 100644 index 5848851be8..0000000000 --- a/contrib/libstdc++/config/linux.mt +++ /dev/null @@ -1,2 +0,0 @@ -# tell we want the mt-safe version -MT_CFLAGS = -D_IO_MTSAFE_IO diff --git a/contrib/libstdc++/config/openbsd.ml b/contrib/libstdc++/config/openbsd.ml deleted file mode 100644 index 09c40235ad..0000000000 --- a/contrib/libstdc++/config/openbsd.ml +++ /dev/null @@ -1,7 +0,0 @@ -# Base shared lib for OpenBSD i386 - -LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK) mshlink -SHFLAGS = -nostdlib -Wl,-Bshareable,-Bforcearchive -SHDEPS = -lm -DEPLIBS = ../$(SHLIB) - diff --git a/contrib/libstdc++/config/openbsd.mt b/contrib/libstdc++/config/openbsd.mt deleted file mode 100644 index 29da11cf45..0000000000 --- a/contrib/libstdc++/config/openbsd.mt +++ /dev/null @@ -1,3 +0,0 @@ -# tell we want the mt-safe version -MT_CFLAGS = -D_IO_MTSAFE_IO -D_PTHREADS - diff --git a/contrib/libstdc++/config/posix.mt b/contrib/libstdc++/config/posix.mt deleted file mode 100644 index 6afe1e514d..0000000000 --- a/contrib/libstdc++/config/posix.mt +++ /dev/null @@ -1 +0,0 @@ -MT_CFLAGS = -D_PTHREADS diff --git a/contrib/libstdc++/config/sol2pth.mt b/contrib/libstdc++/config/sol2pth.mt deleted file mode 100644 index 6afe1e514d..0000000000 --- a/contrib/libstdc++/config/sol2pth.mt +++ /dev/null @@ -1 +0,0 @@ -MT_CFLAGS = -D_PTHREADS diff --git a/contrib/libstdc++/config/sol2shm.ml b/contrib/libstdc++/config/sol2shm.ml deleted file mode 100644 index e87f079e46..0000000000 --- a/contrib/libstdc++/config/sol2shm.ml +++ /dev/null @@ -1,6 +0,0 @@ -# Solaris2 with shared libm, so we can link it into the shared libstdc++. - -LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK) -SHFLAGS = -h $(SHLIB) -SHDEPS = -lm -DEPLIBS = ../$(SHLIB) diff --git a/contrib/libstdc++/config/sol2solth.mt b/contrib/libstdc++/config/sol2solth.mt deleted file mode 100644 index f809d0ace8..0000000000 --- a/contrib/libstdc++/config/sol2solth.mt +++ /dev/null @@ -1 +0,0 @@ -MT_CFLAGS = -D_SOLTHREADS diff --git a/contrib/libstdc++/config/sunos4.ml b/contrib/libstdc++/config/sunos4.ml deleted file mode 100644 index 3c5de27ab5..0000000000 --- a/contrib/libstdc++/config/sunos4.ml +++ /dev/null @@ -1,9 +0,0 @@ -# SunOS doesn't provide a shared libm, so we have to link with the archive -# library, even for programs that don't use complex. -# SunOS requires a version number in shared library filenames. - -LIBS = $(ARLIB) $(ARLINK) $(SHLIB) -SHFLAGS = $(PICFLAG) -DEPLIBS = ../$(SHLIB) -LDLIBS = -L.. -lstdc++ -lm -MLDLIBS = -L.. -lstdc++ -lm diff --git a/contrib/libstdc++/config/x86-interix.ml b/contrib/libstdc++/config/x86-interix.ml deleted file mode 100644 index 8b8774e3a7..0000000000 --- a/contrib/libstdc++/config/x86-interix.ml +++ /dev/null @@ -1,9 +0,0 @@ -# x86 Interix. SHLINK is defined to be .dummy to avoid running into -# the lack of symbolic links. - -SHLINK = .dummy -SHLIB = libstdc++.so -LIBS = $(ARLIB) $(SHLIB) -DEPLIBS = ../$(SHLIB) -SHFLAGS = $(PICFLAG) - diff --git a/contrib/libstdc++/configure.in b/contrib/libstdc++/configure.in deleted file mode 100644 index bd2c9c71e4..0000000000 --- a/contrib/libstdc++/configure.in +++ /dev/null @@ -1,203 +0,0 @@ -# This file is a shell script fragment that supplies the information -# necessary for a configure script to process the program in -# this directory. For more information, look at ../configure. - -# If the language specific compiler does not exist, but the "gcc" directory -# does, we do not build anything. Note, $r is set by the top-level Makefile. -# Note that when we look for the compiler, we search both with and without -# extension to handle cross and canadian cross builds. -# Note that if $norecursion is set we're being called from config.status, -# so don't check for the compiler; we might be doing a make clean. -compiler_name=cc1plus -rm -f skip-this-dir -if test -n "$r" && [ -z "$norecursion" ] ; then - if test -d "$r"/gcc; then - if test -f "$r"/gcc/$compiler_name \ - || test -f "$r"/gcc/$compiler_name.exe; then - true - else - echo "rm -f multilib.out" > skip-this-dir - fi - fi -fi - -if [ "${srcdir}" = "." ] ; then - if [ "${with_target_subdir}" != "." ] ; then - topsrcdir=${with_multisrctop}../.. - else - topsrcdir=${with_multisrctop}.. - fi -else - topsrcdir=${srcdir}/.. -fi - -if [ -d ${topsrcdir}/gcc ] ; then - configdirs="tests testsuite" -else - configdirs="tests" -fi -srctrigger=sinst.cc -srcname="ANSI C++ library" -package_makefile_frag=Make.pack -package_makefile_rules_frag=Make.pack.r - -# per-host: - -# per-target: - -echo "# Warning: this fragment is automatically generated" > temp.mt -frags= - -# If they didn't specify --enable-shared, don't generate shared libs. -case "${enable_shared}" in - yes) shared=yes ;; - no) shared=no ;; - *libstdc++*) shared=yes ;; - *) shared=no ;; -esac - -if [ "${shared}" = "yes" ]; then - case "${target}" in - alpha*-*-linux*) frags=../../config/mh-elfalphapic ;; - arm*-*-*) frags=../../config/mh-armpic ;; - hppa*-*-*) frags=../../config/mh-papic ;; - i[3456]86-*-*) frags=../../config/mh-x86pic ;; - powerpc*-*-aix*) ;; - powerpc*-*-*) frags=../../config/mh-ppcpic ;; - *-*-*) frags=../../config/mh-${target_cpu}pic ;; - esac - case "${target}" in - *-dec-osf*) frags="${frags} dec-osf.ml";; - *-*-hpux*) frags="${frags} hpux.ml" ;; - *-*-irix[56]*) frags="${frags} irix5.ml" ;; - *-*-linux*aout*) ;; - *-*-freebsd2*) ;; - *-*-freebsd*) frags="${frags} freebsd.ml" ;; - *-*-linux*) frags="${frags} linux.ml" ;; - *-*-openbsd*) frags="${frags} openbsd.ml" ;; - *-*-sysv[45]*|*-*-udk*) frags="${frags} elf.ml" ;; - *-*-solaris*) frags="${frags} sol2shm.ml" ;; - *-*-sunos4*) frags="${frags} sunos4.ml" ;; - *-*-aix*) frags="${frags} aix.ml" ;; - i[3456]86-*-interix*) frags="${frags} x86-interix.ml" ;; - *-*-gnu*) frags="${frags} gnu.ml" ;; - esac -fi - -# Make sure the right flags are defined for multi-threading. -case "${target}" in - alpha*-*-linux-gnulibc1) frags="${frags} linux.mt" ;; - powerpc*-*-linux-gnulibc1) frags="${frags} linux.mt" ;; - *-*-linux-gnu) frags="${frags} linux.mt" ;; - *-*-openbsd*) - case "x${enable_threads}" in - xyes|xposix) frags="${frags} openbsd.mt" ;; - esac;; - m68k-motorola-sysv) frags="${frags} delta.mt" ;; - *-*-solaris*) - case "x${enable_threads}" in - xposix) frags="${frags} sol2pth.mt" ;; - xsolaris) frags="${frags} sol2solth.mt" ;; - esac ;; - *) - case "x${enable_threads}" in - xposix) frags="${frags} posix.mt" ;; - esac ;; -esac - -for frag in ${frags}; do - case ${frag} in - ../* ) - if [ ${srcdir} = . ]; then - [ -n "${with_target_subdir}" ] && frag=../${frag} - [ -n "${with_multisrctop}" ] && frag=${with_multisrctop}${frag} - fi - ;; - esac - frag=${srcdir}/config/$frag - if [ -f ${frag} ]; then - echo "Appending ${frag} to target-mkfrag" - echo "# Following fragment copied from ${frag}" >> temp.mt - cat ${frag} >> temp.mt - fi -done - -target_makefile_frag=target-mkfrag -${moveifchange} temp.mt target-mkfrag - -LIBDIR=yes -TO_TOPDIR=../ -ALL='libs' -XCXXINCLUDES="-I${srcdir} -I${srcdir}/stl -I${TO_TOPDIR}libio -I${srcdir}/${TO_TOPDIR}libio" -MOSTLYCLEAN='*.o pic stamp-picdir core so_locations $(MOSTLYCLEAN_JUNK)' -CLEAN='$(CLEAN_JUNK)' -EXTRA_DISTCLEAN='target-mkfrag' - -(. ${srcdir}/${TO_TOPDIR}libio/config.shared) >${package_makefile_frag} 2>${package_makefile_rules_frag} - -. ${topsrcdir}/config.if -echo " -LIBSTDCXX_INTERFACE=${libstdcxx_interface} -CXX_INTERFACE=${cxx_interface} -LIBC_INTERFACE=${libc_interface} -" >> ${package_makefile_frag} - -# This duplicated the AC_PROG_LN_S macro in GNU autoconf. -rm -f conttestdata -if ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - LN_S="ln -s" -else - LN_S=ln -fi -echo " -LN_S=$LN_S -" >> ${package_makefile_frag} - -# post-target: - -# If cross-compiling, we install in $(tooldir)/lib or in $(libsubdir) -# depending on --enable-version-specific-runtime-libs. -if [ -n "${with_cross_host}" ] ; then - rm -f Makefile.tem - sed \ - -e 's|^\([ ]*INSTALLDIR[ ]*=[ ]*\)\$(libdir)|\1$(tooldir)/lib|' \ - Makefile >Makefile.tem - mv -f Makefile.tem Makefile -fi - -# enable multilib-ing by default. -if [ -z "${enable_multilib}" ]; then - enable_multilib=yes -fi - -. ${topsrcdir}/config-ml.in - -gxx_include_dir= -# Specify the g++ header file directory -# Check whether --with-gxx-include-dir or --without-gxx-include-dir was given. -if test "${with_gxx_include_dir+set}" = set; then - withval="$with_gxx_include_dir" - case "${withval}" in - yes) - echo "configure.in: error: bad value ${withval} given for g++ include directory" 1>&2 - exit 1 - ;; - no) ;; - *) gxx_include_dir=$with_gxx_include_dir ;; - esac -fi - -if test x${gxx_include_dir} = x; then - if test x${enable_version_specific_runtime_libs} = xyes; then - gxx_include_dir='${libsubdir}/include/g++' - else - gxx_include_dir='${prefix}/include/g++'-${libstdcxx_interface} - fi -fi - -rm -f Makefile.tem -sed -e "s%^gxx_include_dir[ ]*=.*$%gxx_include_dir=${gxx_include_dir}%" \ - Makefile >Makefile.tem -mv -f Makefile.tem Makefile diff --git a/contrib/libstdc++/csetjmp b/contrib/libstdc++/csetjmp deleted file mode 100644 index 4bba048dcb..0000000000 --- a/contrib/libstdc++/csetjmp +++ /dev/null @@ -1,8 +0,0 @@ -// The -*- C++ -*- setjmp/longjmp header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSETJMP__ -#define __CSETJMP__ -#include -#endif - diff --git a/contrib/libstdc++/csignal b/contrib/libstdc++/csignal deleted file mode 100644 index 6febfb7b2e..0000000000 --- a/contrib/libstdc++/csignal +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- signal handling header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSIGNAL__ -#define __CSIGNAL__ -#include -#endif diff --git a/contrib/libstdc++/cstdarg b/contrib/libstdc++/cstdarg deleted file mode 100644 index 324f5a1c19..0000000000 --- a/contrib/libstdc++/cstdarg +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTDARG__ -#define __CSTDARG__ -#include -#endif diff --git a/contrib/libstdc++/cstddef b/contrib/libstdc++/cstddef deleted file mode 100644 index db5cbe4003..0000000000 --- a/contrib/libstdc++/cstddef +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTDDEF__ -#define __CSTDDEF__ -#include -#endif diff --git a/contrib/libstdc++/cstdio b/contrib/libstdc++/cstdio deleted file mode 100644 index 1fe1456b5b..0000000000 --- a/contrib/libstdc++/cstdio +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- standard I/O header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTDIO__ -#define __CSTDIO__ -#include -#endif diff --git a/contrib/libstdc++/cstdlib b/contrib/libstdc++/cstdlib deleted file mode 100644 index e7c1a5160a..0000000000 --- a/contrib/libstdc++/cstdlib +++ /dev/null @@ -1,23 +0,0 @@ -// The -*- C++ -*- standard library header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTDLIB__ -#define __CSTDLIB__ -#include - -#ifdef __GNUG__ -#pragma interface "cstdlib" -#endif - -extern "C++" { - -#if _G_HAS_LABS -inline long abs(long x) { return labs (x); } -#else -inline long abs(long x) { return x >= 0 ? x : -x; } -#endif -//inline ldiv_t div(long x, long y) { return ldiv (x, y); } - -} // extern "C++" - -#endif diff --git a/contrib/libstdc++/cstdlibi.cc b/contrib/libstdc++/cstdlibi.cc deleted file mode 100644 index abbfa03464..0000000000 --- a/contrib/libstdc++/cstdlibi.cc +++ /dev/null @@ -1,7 +0,0 @@ -// Implementation file for the -*- C++ -*- standard library header. -// This file is part of the GNU ANSI C++ Library. - -#ifdef __GNUG__ -#pragma implementation "cstdlib" -#endif -#include diff --git a/contrib/libstdc++/cstring b/contrib/libstdc++/cstring deleted file mode 100644 index d8d03a765b..0000000000 --- a/contrib/libstdc++/cstring +++ /dev/null @@ -1,96 +0,0 @@ -// The -*- C++ -*- null-terminated string header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTRING__ -#define __CSTRING__ - -#include - -#if 0 // Let's not bother with this just yet. -#include - -#ifdef __GNUG__ -#pragma interface "cstring" -#endif - -// The ANSI C prototypes for these functions have a const argument type and -// non-const return type, so we can't use them. - -extern "C++" { -extern inline const char * -_G_strchr (const char *s, int c) -{ - return strchr (s, c); -} - -extern inline char * -_G_strchr (char *s, int c) -{ - return const_cast (strchr (s, c)); -} - -extern inline const char * -_G_strpbrk (const char *s1, const char *s2) -{ - return strpbrk (s1, s2); -} - -extern inline char * -_G_strpbrk (char *s1, const char *s2) -{ - return const_cast (strpbrk (s1, s2)); -} - -extern inline const char * -_G_strrchr (const char *s, int c) -{ - return strrchr (s, c); -} - -extern inline char * -_G_strrchr (char *s, int c) -{ - return const_cast (strrchr (s, c)); -} - -extern inline const char * -_G_strstr (const char *s1, const char *s2) -{ - return strstr (s1, s2); -} - -extern inline char * -_G_strstr (char *s1, const char *s2) -{ - return const_cast (strstr (s1, s2)); -} - -extern inline const void * -_G_memchr (const void *s, int c, size_t n) -{ - return memchr (s, c, n); -} - -extern inline void * -_G_memchr (void *s, int c, size_t n) -{ - return const_cast (memchr (s, c, n)); -} -} // extern "C++" - -// Lose any vendor macros for these functions. -#undef strchr -#undef strpbrk -#undef strrchr -#undef strstr -#undef memchr - -// Ewww, namespace pollution. Anyone have a better idea? -#define strchr _G_strchr -#define strpbrk _G_strpbrk -#define strrchr _G_strrchr -#define strstr _G_strstr -#define memchr _G_memchr -#endif // 0 - -#endif // !defined (__CSTRING__) diff --git a/contrib/libstdc++/cstringi.cc b/contrib/libstdc++/cstringi.cc deleted file mode 100644 index 2676febc9b..0000000000 --- a/contrib/libstdc++/cstringi.cc +++ /dev/null @@ -1,7 +0,0 @@ -// Implementation file for the -*- C++ -*- null-terminated string header. -// This file is part of the GNU ANSI C++ Library. - -#ifdef __GNUG__ -#pragma implementation "cstring" -#endif -#include diff --git a/contrib/libstdc++/ctime b/contrib/libstdc++/ctime deleted file mode 100644 index 0184da5929..0000000000 --- a/contrib/libstdc++/ctime +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- time header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CTIME__ -#define __CTIME__ -#include -#endif diff --git a/contrib/libstdc++/cwchar b/contrib/libstdc++/cwchar deleted file mode 100644 index 1674c12b61..0000000000 --- a/contrib/libstdc++/cwchar +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- wide character header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CWCHAR__ -#define __CWCHAR__ -#include -#endif diff --git a/contrib/libstdc++/cwctype b/contrib/libstdc++/cwctype deleted file mode 100644 index 81122012bd..0000000000 --- a/contrib/libstdc++/cwctype +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- wide character type header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CWCTYPE__ -#define __CWCTYPE__ -#include -#endif diff --git a/contrib/libstdc++/fstream b/contrib/libstdc++/fstream deleted file mode 100644 index 2c35ca92b0..0000000000 --- a/contrib/libstdc++/fstream +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __FSTREAM__ -#define __FSTREAM__ -#include -#endif diff --git a/contrib/libstdc++/iomanip b/contrib/libstdc++/iomanip deleted file mode 100644 index 817948579c..0000000000 --- a/contrib/libstdc++/iomanip +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __IOMANIP__ -#define __IOMANIP__ -#include -#endif diff --git a/contrib/libstdc++/iosfwd b/contrib/libstdc++/iosfwd deleted file mode 100644 index 8314cf7b73..0000000000 --- a/contrib/libstdc++/iosfwd +++ /dev/null @@ -1,15 +0,0 @@ -// -*- C++ -*- I/O forward declaration header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __IOSFWD__ -#define __IOSFWD__ -class ios; -class streambuf; -class istream; -class ostream; -class iostream; -class filebuf; -class ifstream; -class ofstream; -class fstream; -#endif diff --git a/contrib/libstdc++/iostream b/contrib/libstdc++/iostream deleted file mode 100644 index 7ecba6e8da..0000000000 --- a/contrib/libstdc++/iostream +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __IOSTREAM__ -#define __IOSTREAM__ -#include -#endif diff --git a/contrib/libstdc++/sinst.cc b/contrib/libstdc++/sinst.cc deleted file mode 100644 index 0b3617ece6..0000000000 --- a/contrib/libstdc++/sinst.cc +++ /dev/null @@ -1,135 +0,0 @@ -// Instantiation file for the -*- C++ -*- string classes. -// Copyright (C) 1994 Free Software Foundation - -// This file is part of the GNU ANSI C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files -// compiled with a GNU compiler to produce an executable, this does not cause -// the resulting executable to be covered by the GNU General Public License. -// This exception does not however invalidate any other reasons why -// the executable file might be covered by the GNU General Public License. - -// Written by Jason Merrill based upon the specification by Takanori Adachi -// in ANSI X3J16/94-0013R2. - -#ifdef __GNUG__ -#ifdef TRAITS -#ifdef C -#pragma implementation "std/straits.h" -#endif -#endif -#endif - -#include - -#ifdef C -typedef char c; -#endif -#ifdef W -typedef wchar_t c; -#endif - -#if defined(TRAITS) && !defined(C) -template class string_char_traits ; -#else -/* string_char_traits is already explicitly specialized in - std/straits.h. */ -#endif - -typedef basic_string s; - -#ifdef MAIN -template class basic_string ; -#endif - -#ifdef ADDSS -template s operator+ (const s&, const s&); -#endif -#ifdef ADDPS -template s operator+ (const c*, const s&); -#endif -#ifdef ADDCS -template s operator+ (c, const s&); -#endif -#ifdef ADDSP -template s operator+ (const s&, const c*); -#endif -#ifdef ADDSC -template s operator+ (const s&, c); -#endif -#ifdef EQSS -template bool operator== (const s&, const s&); -#endif -#ifdef EQPS -template bool operator== (const c*, const s&); -#endif -#ifdef EQSP -template bool operator== (const s&, const c*); -#endif -#ifdef NESS -template bool operator!= (const s&, const s&); -#endif -#ifdef NEPS -template bool operator!= (const c*, const s&); -#endif -#ifdef NESP -template bool operator!= (const s&, const c*); -#endif -#ifdef LTSS -template bool operator< (const s&, const s&); -#endif -#ifdef LTPS -template bool operator< (const c*, const s&); -#endif -#ifdef LTSP -template bool operator< (const s&, const c*); -#endif -#ifdef GTSS -template bool operator> (const s&, const s&); -#endif -#ifdef GTPS -template bool operator> (const c*, const s&); -#endif -#ifdef GTSP -template bool operator> (const s&, const c*); -#endif -#ifdef LESS -template bool operator<= (const s&, const s&); -#endif -#ifdef LEPS -template bool operator<= (const c*, const s&); -#endif -#ifdef LESP -template bool operator<= (const s&, const c*); -#endif -#ifdef GESS -template bool operator>= (const s&, const s&); -#endif -#ifdef GEPS -template bool operator>= (const c*, const s&); -#endif -#ifdef GESP -template bool operator>= (const s&, const c*); -#endif -#ifdef EXTRACT -template istream& operator>> (istream&, s&); -#endif // EXTRACT -#ifdef INSERT -template ostream& operator<< (ostream&, const s&); -#endif // INSERT -#ifdef GETLINE -template istream& getline (istream&, s&, c); -#endif diff --git a/contrib/libstdc++/sstream b/contrib/libstdc++/sstream deleted file mode 100644 index 45393b1476..0000000000 --- a/contrib/libstdc++/sstream +++ /dev/null @@ -1,343 +0,0 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 2000 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* Written by Magnus Fromreide (magfr@lysator.liu.se). */ -/* seekoff and ideas for overflow is largely borrowed from libstdc++-v3 */ - -#ifndef __SSTREAM__ -#define __SSTREAM__ - -#include -#include -#include - -namespace std -{ - class stringbuf : public streambuf - { - public: - typedef char char_type; - typedef int int_type; - typedef streampos pos_type; - typedef streamoff off_type; - - explicit - stringbuf(int which=ios::in|ios::out) - : streambuf(), mode(static_cast(which)), - stream(NULL), stream_len(0) - { - stringbuf_init(); - } - - explicit - stringbuf(const string &str, int which=ios::in|ios::out) - : streambuf(), mode(static_cast(which)), - stream(NULL), stream_len(0) - { - if (mode & (ios::in|ios::out)) - { - stream_len = str.size(); - stream = new char_type[stream_len]; - str.copy(stream, stream_len); - } - stringbuf_init(); - } - - virtual - ~stringbuf() - { - delete[] stream; - } - - string - str() const - { - if (pbase() != 0) - return string(stream, pptr()-pbase()); - else - return string(); - } - - void - str(const string& str) - { - delete[] stream; - stream_len = str.size(); - stream = new char_type[stream_len]; - str.copy(stream, stream_len); - stringbuf_init(); - } - - protected: - // The buffer is already in gptr, so if it ends then it is out of data. - virtual int - underflow() - { - return EOF; - } - - virtual int - overflow(int c = EOF) - { - int res; - if (mode & ios::out) - { - if (c != EOF) - { - streamsize old_stream_len = stream_len; - stream_len += 1; - char_type* new_stream = new char_type[stream_len]; - memcpy(new_stream, stream, old_stream_len); - delete[] stream; - stream = new_stream; - stringbuf_sync(gptr()-eback(), pptr()-pbase()); - sputc(c); - res = c; - } - else - res = EOF; - } - else - res = 0; - return res; - } - - virtual streambuf* - setbuf(char_type* s, streamsize n) - { - if (n != 0) - { - delete[] stream; - stream = new char_type[n]; - memcpy(stream, s, n); - stream_len = n; - stringbuf_sync(0, 0); - } - return this; - } - - virtual pos_type - seekoff(off_type off, ios::seek_dir way, int which = ios::in | ios::out) - { - pos_type ret = pos_type(off_type(-1)); - bool testin = which & ios::in && mode & ios::in; - bool testout = which & ios::out && mode & ios::out; - bool testboth = testin && testout && way != ios::cur; - - if (stream_len && ((testin != testout) || testboth)) - { - char_type* beg = stream; - char_type* curi = NULL; - char_type* curo = NULL; - char_type* endi = NULL; - char_type* endo = NULL; - - if (testin) - { - curi = gptr(); - endi = egptr(); - } - if (testout) - { - curo = pptr(); - endo = epptr(); - } - - off_type newoffi = 0; - off_type newoffo = 0; - if (way == ios::beg) - { - newoffi = beg - curi; - newoffo = beg - curo; - } - else if (way == ios::end) - { - newoffi = endi - curi; - newoffo = endo - curo; - } - - if (testin && newoffi + off + curi - beg >= 0 && - endi - beg >= newoffi + off + curi - beg) - { - gbump(newoffi + off); - ret = pos_type(newoffi + off + curi); - } - if (testout && newoffo + off + curo - beg >= 0 && - endo - beg >= newoffo + off + curo - beg) - { - pbump(newoffo + off); - ret = pos_type(newoffo + off + curo); - } - } - return ret; - } - - virtual pos_type - seekpos(pos_type sp, int which = ios::in | ios::out) - { - pos_type ret = seekoff(sp, ios::beg, which); - return ret; - } - - private: - void - stringbuf_sync(streamsize i, streamsize o) - { - if (mode & ios::in) - setg(stream, stream + i, stream + stream_len); - if (mode & ios::out) - { - setp(stream, stream + stream_len); - pbump(o); - } - } - void - stringbuf_init() - { - if (mode & ios::ate) - stringbuf_sync(0, stream_len); - else - stringbuf_sync(0, 0); - } - - private: - ios::open_mode mode; - char_type* stream; - streamsize stream_len; - }; - - class istringstream : public istream { - public: - typedef char char_type; - typedef int int_type; - typedef streampos pos_type; - typedef streamoff off_type; - - explicit - istringstream(int which=ios::in) - : istream(&sb), sb(which | ios::in) - { } - - explicit - istringstream(const string& str, int which=ios::in) - : istream(&sb), sb(str, which | ios::in) - { } - - stringbuf* - rdbuf() const - { - return const_cast(&sb); - } - - string - str() const - { - return rdbuf()->str(); - } - void - str(const string& s) - { - rdbuf()->str(s); - } - private: - stringbuf sb; - }; - - class ostringstream : public ostream { - public: - typedef char char_type; - typedef int int_type; - typedef streampos pos_type; - typedef streamoff off_type; - - explicit - ostringstream(int which=ios::out) - : ostream(&sb), sb(which | ios::out) - { } - - explicit - ostringstream(const string& str, int which=ios::out) - : ostream(&sb), sb(str, which | ios::out) - { } - - stringbuf* - rdbuf() const - { - return const_cast(&sb); - } - - string - str() const - { - return rdbuf()->str(); - } - - void str(const string& s) - { - rdbuf()->str(s); - } - private: - stringbuf sb; - }; - - class stringstream : public iostream { - public: - typedef char char_type; - typedef int int_type; - typedef streampos pos_type; - typedef streamoff off_type; - - explicit - stringstream(int which=ios::out|ios::in) - : iostream(&sb), sb(which) - { } - - explicit - stringstream(const string& str, int which=ios::out|ios::in) - : iostream(&sb), sb(str, which) - { } - - stringbuf* - rdbuf() const - { - return const_cast(&sb); - } - - string - str() const - { - return rdbuf()->str(); - } - - void - str(const string& s) - { - rdbuf()->str(s); - } - private: - stringbuf sb; - }; -}; - -#endif /* not __STRSTREAM__ */ diff --git a/contrib/libstdc++/std/bastring.cc b/contrib/libstdc++/std/bastring.cc deleted file mode 100644 index f86f6d3015..0000000000 --- a/contrib/libstdc++/std/bastring.cc +++ /dev/null @@ -1,524 +0,0 @@ -// Member templates for the -*- C++ -*- string classes. -// Copyright (C) 1994, 1999 Free Software Foundation - -// This file is part of the GNU ANSI C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files -// compiled with a GNU compiler to produce an executable, this does not cause -// the resulting executable to be covered by the GNU General Public License. -// This exception does not however invalidate any other reasons why -// the executable file might be covered by the GNU General Public License. - -// Written by Jason Merrill based upon the specification by Takanori Adachi -// in ANSI X3J16/94-0013R2. - -extern "C++" { -template -inline void * basic_string ::Rep:: -operator new (size_t s, size_t extra) -{ - return Allocator::allocate(s + extra * sizeof (charT)); -} - -template -inline void basic_string ::Rep:: -operator delete (void * ptr) -{ - Allocator::deallocate(ptr, sizeof(Rep) + - reinterpret_cast(ptr)->res * - sizeof (charT)); -} - -template -inline size_t basic_string ::Rep:: -frob_size (size_t s) -{ - size_t i = 16; - while (i < s) i *= 2; - return i; -} - -template -inline basic_string ::Rep * -basic_string ::Rep:: -create (size_t extra) -{ - extra = frob_size (extra + 1); - Rep *p = new (extra) Rep; - p->res = extra; - p->ref = 1; - p->selfish = false; - return p; -} - -template -charT * basic_string ::Rep:: -clone () -{ - Rep *p = Rep::create (len); - p->copy (0, data (), len); - p->len = len; - return p->data (); -} - -template -inline bool basic_string ::Rep:: -excess_slop (size_t s, size_t r) -{ - return 2 * (s <= 16 ? 16 : s) < r; -} - -template -inline bool basic_string :: -check_realloc (basic_string::size_type s) const -{ - s += sizeof (charT); - rep ()->selfish = false; - return (rep ()->ref > 1 - || s > capacity () - || Rep::excess_slop (s, capacity ())); -} - -template -void basic_string :: -alloc (basic_string::size_type __size, bool __save) -{ - if (! check_realloc (__size)) - return; - - Rep *p = Rep::create (__size); - - if (__save) - { - p->copy (0, data (), length ()); - p->len = length (); - } - else - p->len = 0; - - repup (p); -} - -template -basic_string & -basic_string :: -replace (size_type pos1, size_type n1, - const basic_string& str, size_type pos2, size_type n2) -{ - const size_t len2 = str.length (); - - if (pos1 == 0 && n1 >= length () && pos2 == 0 && n2 >= len2) - return operator= (str); - - OUTOFRANGE (pos2 > len2); - - if (n2 > len2 - pos2) - n2 = len2 - pos2; - - return replace (pos1, n1, str.data () + pos2, n2); -} - -template -inline void basic_string ::Rep:: -copy (size_t pos, const charT *s, size_t n) -{ - if (n) - traits::copy (data () + pos, s, n); -} - -template -inline void basic_string ::Rep:: -move (size_t pos, const charT *s, size_t n) -{ - if (n) - traits::move (data () + pos, s, n); -} - -template -basic_string & -basic_string :: -replace (size_type pos, size_type n1, const charT* s, size_type n2) -{ - const size_type len = length (); - OUTOFRANGE (pos > len); - if (n1 > len - pos) - n1 = len - pos; - LENGTHERROR (len - n1 > max_size () - n2); - size_t newlen = len - n1 + n2; - - if (check_realloc (newlen)) - { - Rep *p = Rep::create (newlen); - p->copy (0, data (), pos); - p->copy (pos + n2, data () + pos + n1, len - (pos + n1)); - p->copy (pos, s, n2); - repup (p); - } - else - { - rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1)); - rep ()->copy (pos, s, n2); - } - rep ()->len = newlen; - - return *this; -} - -template -inline void basic_string ::Rep:: -set (size_t pos, const charT c, size_t n) -{ - traits::set (data () + pos, c, n); -} - -template -basic_string & basic_string :: -replace (size_type pos, size_type n1, size_type n2, charT c) -{ - const size_t len = length (); - OUTOFRANGE (pos > len); - if (n1 > len - pos) - n1 = len - pos; - LENGTHERROR (len - n1 > max_size () - n2); - size_t newlen = len - n1 + n2; - - if (check_realloc (newlen)) - { - Rep *p = Rep::create (newlen); - p->copy (0, data (), pos); - p->copy (pos + n2, data () + pos + n1, len - (pos + n1)); - p->set (pos, c, n2); - repup (p); - } - else - { - rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1)); - rep ()->set (pos, c, n2); - } - rep ()->len = newlen; - - return *this; -} - -template -void basic_string :: -resize (size_type n, charT c) -{ - LENGTHERROR (n > max_size ()); - - if (n > length ()) - append (n - length (), c); - else - erase (n); -} - -template -basic_string ::size_type -basic_string :: -copy (charT* s, size_type n, size_type pos) const -{ - OUTOFRANGE (pos > length ()); - - if (n > length () - pos) - n = length () - pos; - - traits::copy (s, data () + pos, n); - return n; -} - -template -basic_string ::size_type -basic_string :: -find (const charT* s, size_type pos, size_type n) const -{ - size_t xpos = pos; - for (; xpos + n <= length (); ++xpos) - if (traits::eq (data () [xpos], *s) - && traits::compare (data () + xpos, s, n) == 0) - return xpos; - return npos; -} - -template -inline basic_string ::size_type -basic_string :: -_find (const charT* ptr, charT c, size_type xpos, size_type len) -{ - for (; xpos < len; ++xpos) - if (traits::eq (ptr [xpos], c)) - return xpos; - return npos; -} - -template -basic_string ::size_type -basic_string :: -find (charT c, size_type pos) const -{ - return _find (data (), c, pos, length ()); -} - -template -basic_string ::size_type -basic_string :: -rfind (const charT* s, size_type pos, size_type n) const -{ - if (n > length ()) - return npos; - - size_t xpos = length () - n; - if (xpos > pos) - xpos = pos; - - for (++xpos; xpos-- > 0; ) - if (traits::eq (data () [xpos], *s) - && traits::compare (data () + xpos, s, n) == 0) - return xpos; - return npos; -} - -template -basic_string ::size_type -basic_string :: -rfind (charT c, size_type pos) const -{ - if (1 > length ()) - return npos; - - size_t xpos = length () - 1; - if (xpos > pos) - xpos = pos; - - for (++xpos; xpos-- > 0; ) - if (traits::eq (data () [xpos], c)) - return xpos; - return npos; -} - -template -basic_string ::size_type -basic_string :: -find_first_of (const charT* s, size_type pos, size_type n) const -{ - size_t xpos = pos; - for (; xpos < length (); ++xpos) - if (_find (s, data () [xpos], 0, n) != npos) - return xpos; - return npos; -} - -template -basic_string ::size_type -basic_string :: -find_last_of (const charT* s, size_type pos, size_type n) const -{ - if (length() == 0) - return npos; - size_t xpos = length () - 1; - if (xpos > pos) - xpos = pos; - for (++xpos; xpos-- > 0;) - if (_find (s, data () [xpos], 0, n) != npos) - return xpos; - return npos; -} - -template -basic_string ::size_type -basic_string :: -find_first_not_of (const charT* s, size_type pos, size_type n) const -{ - size_t xpos = pos; - for (; xpos < length (); ++xpos) - if (_find (s, data () [xpos], 0, n) == npos) - return xpos; - return npos; -} - -template -basic_string ::size_type -basic_string :: -find_first_not_of (charT c, size_type pos) const -{ - size_t xpos = pos; - for (; xpos < length (); ++xpos) - if (traits::ne (data () [xpos], c)) - return xpos; - return npos; -} - -template -basic_string ::size_type -basic_string :: -find_last_not_of (const charT* s, size_type pos, size_type n) const -{ - if (length() == 0) - return npos; - size_t xpos = length () - 1; - if (xpos > pos) - xpos = pos; - for (++xpos; xpos-- > 0;) - if (_find (s, data () [xpos], 0, n) == npos) - return xpos; - return npos; -} - -template -basic_string ::size_type -basic_string :: -find_last_not_of (charT c, size_type pos) const -{ - if (length() == 0) - return npos; - size_t xpos = length () - 1; - if (xpos > pos) - xpos = pos; - for (++xpos; xpos-- > 0;) - if (traits::ne (data () [xpos], c)) - return xpos; - return npos; -} - -template -int basic_string :: -compare (const basic_string& str, size_type pos, size_type n) const -{ - OUTOFRANGE (pos > length ()); - - size_t rlen = length () - pos; - if (rlen > n) - rlen = n; - if (rlen > str.length ()) - rlen = str.length (); - int r = traits::compare (data () + pos, str.data (), rlen); - if (r != 0) - return r; - if (rlen == n) - return 0; - return (length () - pos) - str.length (); -} - -template -int basic_string :: -compare (const charT* s, size_type pos, size_type n) const -{ - OUTOFRANGE (pos > length ()); - - size_t rlen = length () - pos; - if (rlen > n) - rlen = n; - int r = traits::compare (data () + pos, s, rlen); - if (r != 0) - return r; - return (length () - pos) - n; -} - -#include - -template -istream & -operator>> (istream &is, basic_string &s) -{ - int w = is.width (0); - if (is.ipfx0 ()) - { - register streambuf *sb = is.rdbuf (); - s.resize (0); - while (1) - { - int ch = sb->sbumpc (); - if (ch == EOF) - { - is.setstate (ios::eofbit); - break; - } - else if (traits::is_del (ch)) - { - sb->sungetc (); - break; - } - s += static_cast (ch); - if (--w == 1) - break; - } - } - - is.isfx (); - if (s.length () == 0) - is.setstate (ios::failbit); - - return is; -} - -template -ostream & -operator<< (ostream &o, const basic_string & s) -{ - return o.write (s.data (), s.length ()); -} - -template -istream& -getline (istream &is, basic_string & s, charT delim) -{ - if (is.ipfx1 ()) - { - _IO_size_t count = 0; - streambuf *sb = is.rdbuf (); - s.resize (0); - - while (1) - { - int ch = sb->sbumpc (); - if (ch == EOF) - { - is.setstate (count == 0 - ? (ios::failbit|ios::eofbit) - : ios::eofbit); - break; - } - - ++count; - - if (ch == delim) - break; - - s += static_cast (ch); - - if (s.length () == s.npos - 1) - { - is.setstate (ios::failbit); - break; - } - } - } - - // We need to be friends with istream to do this. - // is._gcount = count; - is.isfx (); - - return is; -} - -template -basic_string ::Rep -basic_string::nilRep = { 0, 0, 1, false }; - -template -const basic_string ::size_type -basic_string ::npos; - -} // extern "C++" diff --git a/contrib/libstdc++/std/bastring.h b/contrib/libstdc++/std/bastring.h deleted file mode 100644 index bbe873085e..0000000000 --- a/contrib/libstdc++/std/bastring.h +++ /dev/null @@ -1,657 +0,0 @@ -// Main templates for the -*- C++ -*- string classes. -// Copyright (C) 1994, 1995, 1999 Free Software Foundation - -// This file is part of the GNU ANSI C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files -// compiled with a GNU compiler to produce an executable, this does not cause -// the resulting executable to be covered by the GNU General Public License. -// This exception does not however invalidate any other reasons why -// the executable file might be covered by the GNU General Public License. - -// Written by Jason Merrill based upon the specification by Takanori Adachi -// in ANSI X3J16/94-0013R2. - -#ifndef __BASTRING__ -#define __BASTRING__ - -#ifdef __GNUG__ -#pragma interface -#endif - -#include -#include - -// NOTE : This does NOT conform to the draft standard and is likely to change -#include - -extern "C++" { -class istream; class ostream; - -#include - -#ifdef __STL_USE_EXCEPTIONS - -extern void __out_of_range (const char *); -extern void __length_error (const char *); - -#define OUTOFRANGE(cond) \ - do { if (cond) __out_of_range (#cond); } while (0) -#define LENGTHERROR(cond) \ - do { if (cond) __length_error (#cond); } while (0) - -#else - -#include -#define OUTOFRANGE(cond) assert (!(cond)) -#define LENGTHERROR(cond) assert (!(cond)) - -#endif - -template , - class Allocator = alloc > -class basic_string -{ -private: - struct Rep { - size_t len, res, ref; - bool selfish; - - charT* data () { return reinterpret_cast(this + 1); } - charT& operator[] (size_t s) { return data () [s]; } - charT* grab () { if (selfish) return clone (); ++ref; return data (); } -#if defined __i486__ || defined __i586__ || defined __i686__ - void release () - { - size_t __val; - // This opcode exists as a .byte instead of as a mnemonic for the - // benefit of SCO OpenServer 5. The system assembler (which is - // essentially required on this target) can't assemble xaddl in - //COFF mode. - asm (".byte 0xf0, 0x0f, 0xc1, 0x02" // lock; xaddl %eax, (%edx) - : "=a" (__val) - : "0" (-1), "m" (ref), "d" (&ref) - : "memory"); - - if (__val == 1) - delete this; - } -#elif defined __sparcv9__ - void release () - { - size_t __newval, __oldval = ref; - do - { - __newval = __oldval - 1; - __asm__ ("cas [%4], %2, %0" - : "=r" (__oldval), "=m" (ref) - : "r" (__oldval), "m" (ref), "r"(&(ref)), "0" (__newval)); - } - while (__newval != __oldval); - - if (__oldval == 0) - delete this; - } -#else - void release () { if (--ref == 0) delete this; } -#endif - - inline static void * operator new (size_t, size_t); - inline static void operator delete (void *); - inline static Rep* create (size_t); - charT* clone (); - - inline void copy (size_t, const charT *, size_t); - inline void move (size_t, const charT *, size_t); - inline void set (size_t, const charT, size_t); - - inline static bool excess_slop (size_t, size_t); - inline static size_t frob_size (size_t); - - private: - Rep &operator= (const Rep &); - }; - -public: -// types: - typedef traits traits_type; - typedef typename traits::char_type value_type; - typedef Allocator allocator_type; - - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef charT& reference; - typedef const charT& const_reference; - typedef charT* pointer; - typedef const charT* const_pointer; - typedef pointer iterator; - typedef const_pointer const_iterator; - typedef ::reverse_iterator reverse_iterator; - typedef ::reverse_iterator const_reverse_iterator; - static const size_type npos = static_cast(-1); - -private: - Rep *rep () const { return reinterpret_cast(dat) - 1; } - void repup (Rep *p) { rep ()->release (); dat = p->data (); } - -public: - const charT* data () const - { return rep ()->data(); } - size_type length () const - { return rep ()->len; } - size_type size () const - { return rep ()->len; } - size_type capacity () const - { return rep ()->res; } - size_type max_size () const - { return (npos - 1)/sizeof (charT); } // XXX - bool empty () const - { return size () == 0; } - -// _lib.string.cons_ construct/copy/destroy: - basic_string& operator= (const basic_string& str) - { - if (&str != this) { rep ()->release (); dat = str.rep ()->grab (); } - return *this; - } - - explicit basic_string (): dat (nilRep.grab ()) { } - basic_string (const basic_string& str): dat (str.rep ()->grab ()) { } - basic_string (const basic_string& str, size_type pos, size_type n = npos) - : dat (nilRep.grab ()) { assign (str, pos, n); } - basic_string (const charT* s, size_type n) - : dat (nilRep.grab ()) { assign (s, n); } - basic_string (const charT* s) - : dat (nilRep.grab ()) { assign (s); } - basic_string (size_type n, charT c) - : dat (nilRep.grab ()) { assign (n, c); } -#ifdef __STL_MEMBER_TEMPLATES - template - basic_string(InputIterator __begin, InputIterator __end) -#else - basic_string(const_iterator __begin, const_iterator __end) -#endif - : dat (nilRep.grab ()) { assign (__begin, __end); } - - ~basic_string () - { rep ()->release (); } - - void swap (basic_string &s) { charT *d = dat; dat = s.dat; s.dat = d; } - - basic_string& append (const basic_string& str, size_type pos = 0, - size_type n = npos) - { return replace (length (), 0, str, pos, n); } - basic_string& append (const charT* s, size_type n) - { return replace (length (), 0, s, n); } - basic_string& append (const charT* s) - { return append (s, traits::length (s)); } - basic_string& append (size_type n, charT c) - { return replace (length (), 0, n, c); } -#ifdef __STL_MEMBER_TEMPLATES - template - basic_string& append(InputIterator first, InputIterator last) -#else - basic_string& append(const_iterator first, const_iterator last) -#endif - { return replace (iend (), iend (), first, last); } - - void push_back(charT __c) - { append(1, __c); } - - basic_string& assign (const basic_string& str, size_type pos = 0, - size_type n = npos) - { return replace (0, npos, str, pos, n); } - basic_string& assign (const charT* s, size_type n) - { return replace (0, npos, s, n); } - basic_string& assign (const charT* s) - { return assign (s, traits::length (s)); } - basic_string& assign (size_type n, charT c) - { return replace (0, npos, n, c); } -#ifdef __STL_MEMBER_TEMPLATES - template - basic_string& assign(InputIterator first, InputIterator last) -#else - basic_string& assign(const_iterator first, const_iterator last) -#endif - { return replace (ibegin (), iend (), first, last); } - - basic_string& operator= (const charT* s) - { return assign (s); } - basic_string& operator= (charT c) - { return assign (1, c); } - - basic_string& operator+= (const basic_string& rhs) - { return append (rhs); } - basic_string& operator+= (const charT* s) - { return append (s); } - basic_string& operator+= (charT c) - { return append (1, c); } - - basic_string& insert (size_type pos1, const basic_string& str, - size_type pos2 = 0, size_type n = npos) - { return replace (pos1, 0, str, pos2, n); } - basic_string& insert (size_type pos, const charT* s, size_type n) - { return replace (pos, 0, s, n); } - basic_string& insert (size_type pos, const charT* s) - { return insert (pos, s, traits::length (s)); } - basic_string& insert (size_type pos, size_type n, charT c) - { return replace (pos, 0, n, c); } - iterator insert(iterator p, charT c) - { size_type __o = p - ibegin (); - insert (p - ibegin (), 1, c); selfish (); - return ibegin () + __o; } - iterator insert(iterator p, size_type n, charT c) - { size_type __o = p - ibegin (); - insert (p - ibegin (), n, c); selfish (); - return ibegin () + __o; } -#ifdef __STL_MEMBER_TEMPLATES - template - void insert(iterator p, InputIterator first, InputIterator last) -#else - void insert(iterator p, const_iterator first, const_iterator last) -#endif - { replace (p, p, first, last); } - - basic_string& erase (size_type pos = 0, size_type n = npos) - { return replace (pos, n, (size_type)0, (charT)0); } - iterator erase(iterator p) - { size_type __o = p - begin(); - replace (__o, 1, (size_type)0, (charT)0); selfish (); - return ibegin() + __o; } - iterator erase(iterator f, iterator l) - { size_type __o = f - ibegin(); - replace (__o, l-f, (size_type)0, (charT)0);selfish (); - return ibegin() + __o; } - - basic_string& replace (size_type pos1, size_type n1, const basic_string& str, - size_type pos2 = 0, size_type n2 = npos); - basic_string& replace (size_type pos, size_type n1, const charT* s, - size_type n2); - basic_string& replace (size_type pos, size_type n1, const charT* s) - { return replace (pos, n1, s, traits::length (s)); } - basic_string& replace (size_type pos, size_type n1, size_type n2, charT c); - basic_string& replace (size_type pos, size_type n, charT c) - { return replace (pos, n, 1, c); } - basic_string& replace (iterator i1, iterator i2, const basic_string& str) - { return replace (i1 - ibegin (), i2 - i1, str); } - basic_string& replace (iterator i1, iterator i2, const charT* s, size_type n) - { return replace (i1 - ibegin (), i2 - i1, s, n); } - basic_string& replace (iterator i1, iterator i2, const charT* s) - { return replace (i1 - ibegin (), i2 - i1, s); } - basic_string& replace (iterator i1, iterator i2, size_type n, charT c) - { return replace (i1 - ibegin (), i2 - i1, n, c); } -#ifdef __STL_MEMBER_TEMPLATES - template - basic_string& replace(iterator i1, iterator i2, - InputIterator j1, InputIterator j2); -#else - basic_string& replace(iterator i1, iterator i2, - const_iterator j1, const_iterator j2); -#endif - -private: - static charT eos () { return traits::eos (); } - void unique () { if (rep ()->ref > 1) alloc (length (), true); } - void selfish () { unique (); rep ()->selfish = true; } - -public: - charT operator[] (size_type pos) const - { - if (pos == length ()) - return eos (); - return data ()[pos]; - } - - reference operator[] (size_type pos) - { selfish (); return (*rep ())[pos]; } - - reference at (size_type pos) - { - OUTOFRANGE (pos >= length ()); - return (*this)[pos]; - } - const_reference at (size_type pos) const - { - OUTOFRANGE (pos >= length ()); - return data ()[pos]; - } - -private: - void terminate () const - { traits::assign ((*rep ())[length ()], eos ()); } - -public: - const charT* c_str () const - { if (length () == 0) return ""; terminate (); return data (); } - void resize (size_type n, charT c); - void resize (size_type n) - { resize (n, eos ()); } - void reserve (size_type) { } - - size_type copy (charT* s, size_type n, size_type pos = 0) const; - - size_type find (const basic_string& str, size_type pos = 0) const - { return find (str.data(), pos, str.length()); } - size_type find (const charT* s, size_type pos, size_type n) const; - size_type find (const charT* s, size_type pos = 0) const - { return find (s, pos, traits::length (s)); } - size_type find (charT c, size_type pos = 0) const; - - size_type rfind (const basic_string& str, size_type pos = npos) const - { return rfind (str.data(), pos, str.length()); } - size_type rfind (const charT* s, size_type pos, size_type n) const; - size_type rfind (const charT* s, size_type pos = npos) const - { return rfind (s, pos, traits::length (s)); } - size_type rfind (charT c, size_type pos = npos) const; - - size_type find_first_of (const basic_string& str, size_type pos = 0) const - { return find_first_of (str.data(), pos, str.length()); } - size_type find_first_of (const charT* s, size_type pos, size_type n) const; - size_type find_first_of (const charT* s, size_type pos = 0) const - { return find_first_of (s, pos, traits::length (s)); } - size_type find_first_of (charT c, size_type pos = 0) const - { return find (c, pos); } - - size_type find_last_of (const basic_string& str, size_type pos = npos) const - { return find_last_of (str.data(), pos, str.length()); } - size_type find_last_of (const charT* s, size_type pos, size_type n) const; - size_type find_last_of (const charT* s, size_type pos = npos) const - { return find_last_of (s, pos, traits::length (s)); } - size_type find_last_of (charT c, size_type pos = npos) const - { return rfind (c, pos); } - - size_type find_first_not_of (const basic_string& str, size_type pos = 0) const - { return find_first_not_of (str.data(), pos, str.length()); } - size_type find_first_not_of (const charT* s, size_type pos, size_type n) const; - size_type find_first_not_of (const charT* s, size_type pos = 0) const - { return find_first_not_of (s, pos, traits::length (s)); } - size_type find_first_not_of (charT c, size_type pos = 0) const; - - size_type find_last_not_of (const basic_string& str, size_type pos = npos) const - { return find_last_not_of (str.data(), pos, str.length()); } - size_type find_last_not_of (const charT* s, size_type pos, size_type n) const; - size_type find_last_not_of (const charT* s, size_type pos = npos) const - { return find_last_not_of (s, pos, traits::length (s)); } - size_type find_last_not_of (charT c, size_type pos = npos) const; - - basic_string substr (size_type pos = 0, size_type n = npos) const - { return basic_string (*this, pos, n); } - - int compare (const basic_string& str, size_type pos = 0, size_type n = npos) const; - // There is no 'strncmp' equivalent for charT pointers. - int compare (const charT* s, size_type pos, size_type n) const; - int compare (const charT* s, size_type pos = 0) const - { return compare (s, pos, traits::length (s)); } - - iterator begin () { selfish (); return &(*this)[0]; } - iterator end () { selfish (); return &(*this)[length ()]; } - -private: - iterator ibegin () const { return &(*rep ())[0]; } - iterator iend () const { return &(*rep ())[length ()]; } - -public: - const_iterator begin () const { return ibegin (); } - const_iterator end () const { return iend (); } - - reverse_iterator rbegin() { return reverse_iterator (end ()); } - const_reverse_iterator rbegin() const - { return const_reverse_iterator (end ()); } - reverse_iterator rend() { return reverse_iterator (begin ()); } - const_reverse_iterator rend() const - { return const_reverse_iterator (begin ()); } - -private: - void alloc (size_type size, bool save); - static size_type _find (const charT* ptr, charT c, size_type xpos, size_type len); - inline bool check_realloc (size_type s) const; - - static Rep nilRep; - charT *dat; -}; - -#ifdef __STL_MEMBER_TEMPLATES -template template -basic_string & basic_string :: -replace (iterator i1, iterator i2, InputIterator j1, InputIterator j2) -#else -template -basic_string & basic_string :: -replace (iterator i1, iterator i2, const_iterator j1, const_iterator j2) -#endif -{ - const size_type len = length (); - size_type pos = i1 - ibegin (); - size_type n1 = i2 - i1; - size_type n2 = j2 - j1; - - OUTOFRANGE (pos > len); - if (n1 > len - pos) - n1 = len - pos; - LENGTHERROR (len - n1 > max_size () - n2); - size_t newlen = len - n1 + n2; - - if (check_realloc (newlen)) - { - Rep *p = Rep::create (newlen); - p->copy (0, data (), pos); - p->copy (pos + n2, data () + pos + n1, len - (pos + n1)); - for (; j1 != j2; ++j1, ++pos) - traits::assign ((*p)[pos], *j1); - repup (p); - } - else - { - rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1)); - for (; j1 != j2; ++j1, ++pos) - traits::assign ((*rep ())[pos], *j1); - } - rep ()->len = newlen; - - return *this; -} - -template -inline basic_string -operator+ (const basic_string & lhs, - const basic_string & rhs) -{ - basic_string str (lhs); - str.append (rhs); - return str; -} - -template -inline basic_string -operator+ (const charT* lhs, const basic_string & rhs) -{ - basic_string str (lhs); - str.append (rhs); - return str; -} - -template -inline basic_string -operator+ (charT lhs, const basic_string & rhs) -{ - basic_string str (1, lhs); - str.append (rhs); - return str; -} - -template -inline basic_string -operator+ (const basic_string & lhs, const charT* rhs) -{ - basic_string str (lhs); - str.append (rhs); - return str; -} - -template -inline basic_string -operator+ (const basic_string & lhs, charT rhs) -{ - basic_string str (lhs); - str.append (1, rhs); - return str; -} - -template -inline bool -operator== (const basic_string & lhs, - const basic_string & rhs) -{ - return (lhs.compare (rhs) == 0); -} - -template -inline bool -operator== (const charT* lhs, const basic_string & rhs) -{ - return (rhs.compare (lhs) == 0); -} - -template -inline bool -operator== (const basic_string & lhs, const charT* rhs) -{ - return (lhs.compare (rhs) == 0); -} - -template -inline bool -operator!= (const charT* lhs, const basic_string & rhs) -{ - return (rhs.compare (lhs) != 0); -} - -template -inline bool -operator!= (const basic_string & lhs, const charT* rhs) -{ - return (lhs.compare (rhs) != 0); -} - -template -inline bool -operator< (const basic_string & lhs, - const basic_string & rhs) -{ - return (lhs.compare (rhs) < 0); -} - -template -inline bool -operator< (const charT* lhs, const basic_string & rhs) -{ - return (rhs.compare (lhs) > 0); -} - -template -inline bool -operator< (const basic_string & lhs, const charT* rhs) -{ - return (lhs.compare (rhs) < 0); -} - -template -inline bool -operator> (const charT* lhs, const basic_string & rhs) -{ - return (rhs.compare (lhs) < 0); -} - -template -inline bool -operator> (const basic_string & lhs, const charT* rhs) -{ - return (lhs.compare (rhs) > 0); -} - -template -inline bool -operator<= (const charT* lhs, const basic_string & rhs) -{ - return (rhs.compare (lhs) >= 0); -} - -template -inline bool -operator<= (const basic_string & lhs, const charT* rhs) -{ - return (lhs.compare (rhs) <= 0); -} - -template -inline bool -operator>= (const charT* lhs, const basic_string & rhs) -{ - return (rhs.compare (lhs) <= 0); -} - -template -inline bool -operator>= (const basic_string & lhs, const charT* rhs) -{ - return (lhs.compare (rhs) >= 0); -} - -template -inline bool -operator!= (const basic_string & lhs, - const basic_string & rhs) -{ - return (lhs.compare (rhs) != 0); -} - -template -inline bool -operator> (const basic_string & lhs, - const basic_string & rhs) -{ - return (lhs.compare (rhs) > 0); -} - -template -inline bool -operator<= (const basic_string & lhs, - const basic_string & rhs) -{ - return (lhs.compare (rhs) <= 0); -} - -template -inline bool -operator>= (const basic_string & lhs, - const basic_string & rhs) -{ - return (lhs.compare (rhs) >= 0); -} - -class istream; class ostream; -template istream& -operator>> (istream&, basic_string &); -template ostream& -operator<< (ostream&, const basic_string &); -template istream& -getline (istream&, basic_string &, charT delim = '\n'); - -} // extern "C++" - -#include - -#endif diff --git a/contrib/libstdc++/std/complext.cc b/contrib/libstdc++/std/complext.cc deleted file mode 100644 index 60227f2132..0000000000 --- a/contrib/libstdc++/std/complext.cc +++ /dev/null @@ -1,273 +0,0 @@ -// Member templates for the -*- C++ -*- complex number classes. -// Copyright (C) 1994 Free Software Foundation - -// This file is part of the GNU ANSI C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files -// compiled with a GNU compiler to produce an executable, this does not cause -// the resulting executable to be covered by the GNU General Public License. -// This exception does not however invalidate any other reasons why -// the executable file might be covered by the GNU General Public License. - -// Written by Jason Merrill based upon the specification in the 27 May 1994 -// C++ working paper, ANSI document X3J16/94-0098. - -#include - -extern "C++" { -template complex -cos (const complex& x) -{ - return complex (cos (real (x)) * cosh (imag (x)), - - sin (real (x)) * sinh (imag (x))); -} - -template complex -cosh (const complex& x) -{ - return complex (cosh (real (x)) * cos (imag (x)), - sinh (real (x)) * sin (imag (x))); -} - -template complex -exp (const complex& x) -{ - return polar (FLOAT (exp (real (x))), imag (x)); -} - -template complex -log (const complex& x) -{ - return complex (log (abs (x)), arg (x)); -} - -template complex -pow (const complex& x, const complex& y) -{ - FLOAT logr = log (abs (x)); - FLOAT t = arg (x); - - return polar (FLOAT (exp (logr * real (y) - imag (y) * t)), - FLOAT (imag (y) * logr + real (y) * t)); -} - -template complex -pow (const complex& x, FLOAT y) -{ - return exp (FLOAT (y) * log (x)); -} - -template complex -pow (FLOAT x, const complex& y) -{ - return exp (y * FLOAT (log (x))); -} - -template complex -sin (const complex& x) -{ - return complex (sin (real (x)) * cosh (imag (x)), - cos (real (x)) * sinh (imag (x))); -} - -template complex -sinh (const complex& x) -{ - return complex (sinh (real (x)) * cos (imag (x)), - cosh (real (x)) * sin (imag (x))); -} - -#include - -template istream& -operator >> (istream& is, complex& x) -{ - FLOAT re, im = 0; - char ch = 0; - - if (is.ipfx0 ()) - { - if (is.peek () == '(') - is >> ch; - is >> re; - if (ch == '(') - { - is >> ch; - if (ch == ',') - is >> im >> ch; - } - } - is.isfx (); - - if (ch != 0 && ch != ')') - is.setstate (ios::failbit); - else if (is.good ()) - x = complex (re, im); - - return is; -} - -template ostream& -operator << (ostream& os, const complex& x) -{ - return os << '(' << real (x) << ',' << imag (x) << ')'; -} - -// The code below is adapted from f2c's libF77, and is subject to this -// copyright: - -/**************************************************************** -Copyright 1990, 1991, 1992, 1993 by AT&T Bell Laboratories and Bellcore. - -Permission to use, copy, modify, and distribute this software -and its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the names of AT&T Bell Laboratories or -Bellcore or any of their entities not be used in advertising or -publicity pertaining to distribution of the software without -specific, written prior permission. - -AT&T and Bellcore disclaim all warranties with regard to this -software, including all implied warranties of merchantability -and fitness. In no event shall AT&T or Bellcore be liable for -any special, indirect or consequential damages or any damages -whatsoever resulting from loss of use, data or profits, whether -in an action of contract, negligence or other tortious action, -arising out of or in connection with the use or performance of -this software. -****************************************************************/ - -template complex& -__doadv (complex* ths, const complex& y) -{ - FLOAT ar = abs (y.re); - FLOAT ai = abs (y.im); - FLOAT nr, ni; - FLOAT t, d; - if (ar <= ai) - { - t = y.re / y.im; - d = y.im * (1 + t*t); - nr = (ths->re * t + ths->im) / d; - ni = (ths->im * t - ths->re) / d; - } - else - { - t = y.im / y.re; - d = y.re * (1 + t*t); - nr = (ths->re + ths->im * t) / d; - ni = (ths->im - ths->re * t) / d; - } - ths->re = nr; - ths->im = ni; - return *ths; -} - -template complex -operator / (const complex& x, const complex& y) -{ - FLOAT ar = abs (real (y)); - FLOAT ai = abs (imag (y)); - FLOAT nr, ni; - FLOAT t, d; - if (ar <= ai) - { - t = real (y) / imag (y); - d = imag (y) * (1 + t*t); - nr = (real (x) * t + imag (x)) / d; - ni = (imag (x) * t - real (x)) / d; - } - else - { - t = imag (y) / real (y); - d = real (y) * (1 + t*t); - nr = (real (x) + imag (x) * t) / d; - ni = (imag (x) - real (x) * t) / d; - } - return complex (nr, ni); -} - -template complex -operator / (FLOAT x, const complex& y) -{ - FLOAT ar = abs (real (y)); - FLOAT ai = abs (imag (y)); - FLOAT nr, ni; - FLOAT t, d; - if (ar <= ai) - { - t = real (y) / imag (y); - d = imag (y) * (1 + t*t); - nr = x * t / d; - ni = -x / d; - } - else - { - t = imag (y) / real (y); - d = real (y) * (1 + t*t); - nr = x / d; - ni = -x * t / d; - } - return complex (nr, ni); -} - -template complex -pow (const complex& xin, int y) -{ - if (y == 0) - return complex (1.0); - complex r (1.0); - complex x (xin); - if (y < 0) - { - y = -y; - x = FLOAT(1)/x; - } - for (;;) - { - if (y & 1) - r *= x; - if (y >>= 1) - x *= x; - else - return r; - } -} - -template complex -sqrt (const complex& x) -{ - FLOAT r = abs (x); - FLOAT nr, ni; - if (r == 0.0) - nr = ni = r; - else if (real (x) > 0) - { - nr = sqrt (0.5 * (r + real (x))); - ni = imag (x) / nr / 2; - } - else - { - ni = sqrt (0.5 * (r - real (x))); - if (imag (x) < 0) - ni = - ni; - nr = imag (x) / ni / 2; - } - return complex (nr, ni); -} -} // extern "C++" diff --git a/contrib/libstdc++/std/complext.h b/contrib/libstdc++/std/complext.h deleted file mode 100644 index 6c55037bf9..0000000000 --- a/contrib/libstdc++/std/complext.h +++ /dev/null @@ -1,400 +0,0 @@ -// The template and inlines for the -*- C++ -*- complex number classes. -// Copyright (C) 1994 Free Software Foundation - -// This file is part of the GNU ANSI C++ Library. This library is free -// software; you can redistribute it and/or modify it under the terms of -// the GNU General Public License as published by the Free Software -// Foundation; either version 2, or (at your option) any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files compiled -// with a GNU compiler to produce an executable, this does not cause the -// resulting executable to be covered by the GNU General Public License. -// This exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -// Written by Jason Merrill based upon the specification in the 27 May 1994 -// C++ working paper, ANSI document X3J16/94-0098. - -#ifndef __COMPLEXT__ -#define __COMPLEXT__ - -#ifdef __GNUG__ -#pragma interface -#endif - -#include - -#if ! defined (__GNUG__) && ! defined (__attribute__) -#define __attribute__(foo) /* Ignore. */ -#endif - -class istream; -class ostream; - -extern "C++" { -template class complex; -template complex<_FLT>& - __doapl (complex<_FLT>* ths, const complex<_FLT>& r); -template complex<_FLT>& - __doami (complex<_FLT>* ths, const complex<_FLT>& r); -template complex<_FLT>& - __doaml (complex<_FLT>* ths, const complex<_FLT>& r); -template complex<_FLT>& - __doadv (complex<_FLT>* ths, const complex<_FLT>& r); - -template -class complex -{ -public: - complex (_FLT r = 0, _FLT i = 0): re (r), im (i) { } - complex& operator += (const complex&); - complex& operator -= (const complex&); - complex& operator *= (const complex&); - complex& operator /= (const complex&); - _FLT real () const { return re; } - _FLT imag () const { return im; } -private: - _FLT re, im; - - friend complex& __doapl<> (complex *, const complex&); - friend complex& __doami<> (complex *, const complex&); - friend complex& __doaml<> (complex *, const complex&); - friend complex& __doadv<> (complex *, const complex&); -}; - -// Declare specializations. -class complex; -class complex; -class complex; - -template -inline complex<_FLT>& -__doapl (complex<_FLT>* ths, const complex<_FLT>& r) -{ - ths->re += r.re; - ths->im += r.im; - return *ths; -} -template -inline complex<_FLT>& -complex<_FLT>::operator += (const complex<_FLT>& r) -{ - return __doapl (this, r); -} - -template -inline complex<_FLT>& -__doami (complex<_FLT>* ths, const complex<_FLT>& r) -{ - ths->re -= r.re; - ths->im -= r.im; - return *ths; -} -template -inline complex<_FLT>& -complex<_FLT>::operator -= (const complex<_FLT>& r) -{ - return __doami (this, r); -} - -template -inline complex<_FLT>& -__doaml (complex<_FLT>* ths, const complex<_FLT>& r) -{ - _FLT f = ths->re * r.re - ths->im * r.im; - ths->im = ths->re * r.im + ths->im * r.re; - ths->re = f; - return *ths; -} -template -inline complex<_FLT>& -complex<_FLT>::operator *= (const complex<_FLT>& r) -{ - return __doaml (this, r); -} - -template -inline complex<_FLT>& -complex<_FLT>::operator /= (const complex<_FLT>& r) -{ - return __doadv (this, r); -} - -template inline _FLT -imag (const complex<_FLT>& x) __attribute__ ((const)); - -template inline _FLT -imag (const complex<_FLT>& x) -{ - return x.imag (); -} - -template inline _FLT -real (const complex<_FLT>& x) __attribute__ ((const)); - -template inline _FLT -real (const complex<_FLT>& x) -{ - return x.real (); -} - -template inline complex<_FLT> -operator + (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const)); - -template inline complex<_FLT> -operator + (const complex<_FLT>& x, const complex<_FLT>& y) -{ - return complex<_FLT> (real (x) + real (y), imag (x) + imag (y)); -} - -template inline complex<_FLT> -operator + (const complex<_FLT>& x, _FLT y) __attribute__ ((const)); - -template inline complex<_FLT> -operator + (const complex<_FLT>& x, _FLT y) -{ - return complex<_FLT> (real (x) + y, imag (x)); -} - -template inline complex<_FLT> -operator + (_FLT x, const complex<_FLT>& y) __attribute__ ((const)); - -template inline complex<_FLT> -operator + (_FLT x, const complex<_FLT>& y) -{ - return complex<_FLT> (x + real (y), imag (y)); -} - -template inline complex<_FLT> -operator - (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const)); - -template inline complex<_FLT> -operator - (const complex<_FLT>& x, const complex<_FLT>& y) -{ - return complex<_FLT> (real (x) - real (y), imag (x) - imag (y)); -} - -template inline complex<_FLT> -operator - (const complex<_FLT>& x, _FLT y) __attribute__ ((const)); - -template inline complex<_FLT> -operator - (const complex<_FLT>& x, _FLT y) -{ - return complex<_FLT> (real (x) - y, imag (x)); -} - -template inline complex<_FLT> -operator - (_FLT x, const complex<_FLT>& y) __attribute__ ((const)); - -template inline complex<_FLT> -operator - (_FLT x, const complex<_FLT>& y) -{ - return complex<_FLT> (x - real (y), - imag (y)); -} - -template inline complex<_FLT> -operator * (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const)); - -template inline complex<_FLT> -operator * (const complex<_FLT>& x, const complex<_FLT>& y) -{ - return complex<_FLT> (real (x) * real (y) - imag (x) * imag (y), - real (x) * imag (y) + imag (x) * real (y)); -} - -template inline complex<_FLT> -operator * (const complex<_FLT>& x, _FLT y) __attribute__ ((const)); - -template inline complex<_FLT> -operator * (const complex<_FLT>& x, _FLT y) -{ - return complex<_FLT> (real (x) * y, imag (x) * y); -} - -template inline complex<_FLT> -operator * (_FLT x, const complex<_FLT>& y) __attribute__ ((const)); - -template inline complex<_FLT> -operator * (_FLT x, const complex<_FLT>& y) -{ - return complex<_FLT> (x * real (y), x * imag (y)); -} - -template complex<_FLT> -operator / (const complex<_FLT>& x, _FLT y) __attribute__ ((const)); - -template complex<_FLT> -operator / (const complex<_FLT>& x, _FLT y) -{ - return complex<_FLT> (real (x) / y, imag (x) / y); -} - -template inline complex<_FLT> -operator + (const complex<_FLT>& x) __attribute__ ((const)); - -template inline complex<_FLT> -operator + (const complex<_FLT>& x) -{ - return x; -} - -template inline complex<_FLT> -operator - (const complex<_FLT>& x) __attribute__ ((const)); - -template inline complex<_FLT> -operator - (const complex<_FLT>& x) -{ - return complex<_FLT> (-real (x), -imag (x)); -} - -template inline bool -operator == (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const)); - -template inline bool -operator == (const complex<_FLT>& x, const complex<_FLT>& y) -{ - return real (x) == real (y) && imag (x) == imag (y); -} - -template inline bool -operator == (const complex<_FLT>& x, _FLT y) __attribute__ ((const)); - -template inline bool -operator == (const complex<_FLT>& x, _FLT y) -{ - return real (x) == y && imag (x) == 0; -} - -template inline bool -operator == (_FLT x, const complex<_FLT>& y) __attribute__ ((const)); - -template inline bool -operator == (_FLT x, const complex<_FLT>& y) -{ - return x == real (y) && imag (y) == 0; -} - -template inline bool -operator != (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const)); - -template inline bool -operator != (const complex<_FLT>& x, const complex<_FLT>& y) -{ - return real (x) != real (y) || imag (x) != imag (y); -} - -template inline bool -operator != (const complex<_FLT>& x, _FLT y) __attribute__ ((const)); - -template inline bool -operator != (const complex<_FLT>& x, _FLT y) -{ - return real (x) != y || imag (x) != 0; -} - -template inline bool -operator != (_FLT x, const complex<_FLT>& y) __attribute__ ((const)); - -template inline bool -operator != (_FLT x, const complex<_FLT>& y) -{ - return x != real (y) || imag (y) != 0; -} - -// Some targets don't provide a prototype for hypot when -ansi. -extern "C" double hypot (double, double) __attribute__ ((const)); - -template inline _FLT -abs (const complex<_FLT>& x) __attribute__ ((const)); - -template inline _FLT -abs (const complex<_FLT>& x) -{ - return hypot (real (x), imag (x)); -} - -template inline _FLT -arg (const complex<_FLT>& x) __attribute__ ((const)); - -template inline _FLT -arg (const complex<_FLT>& x) -{ - return atan2 (imag (x), real (x)); -} - -template inline complex<_FLT> -polar (_FLT r, _FLT t) __attribute__ ((const)); - -template inline complex<_FLT> -polar (_FLT r, _FLT t) -{ - return complex<_FLT> (r * cos (t), r * sin (t)); -} - -template inline complex<_FLT> -conj (const complex<_FLT>& x) __attribute__ ((const)); - -template inline complex<_FLT> -conj (const complex<_FLT>& x) -{ - return complex<_FLT> (real (x), -imag (x)); -} - -template inline _FLT -norm (const complex<_FLT>& x) __attribute__ ((const)); - -template inline _FLT -norm (const complex<_FLT>& x) -{ - return real (x) * real (x) + imag (x) * imag (x); -} - -// Declarations of templates in complext.ccI - -template complex<_FLT> - operator / (const complex<_FLT>&, const complex<_FLT>&) __attribute__ ((const)); -template complex<_FLT> - operator / (_FLT, const complex<_FLT>&) __attribute__ ((const)); -template complex<_FLT> - cos (const complex<_FLT>&) __attribute__ ((const)); -template complex<_FLT> - cosh (const complex<_FLT>&) __attribute__ ((const)); -template complex<_FLT> - exp (const complex<_FLT>&) __attribute__ ((const)); -template complex<_FLT> - log (const complex<_FLT>&) __attribute__ ((const)); -template complex<_FLT> - pow (const complex<_FLT>&, const complex<_FLT>&) __attribute__ ((const)); -template complex<_FLT> - pow (const complex<_FLT>&, _FLT) __attribute__ ((const)); -template complex<_FLT> - pow (const complex<_FLT>&, int) __attribute__ ((const)); -template complex<_FLT> - pow (_FLT, const complex<_FLT>&) __attribute__ ((const)); -template complex<_FLT> - sin (const complex<_FLT>&) __attribute__ ((const)); -template complex<_FLT> - sinh (const complex<_FLT>&) __attribute__ ((const)); -template complex<_FLT> - sqrt (const complex<_FLT>&) __attribute__ ((const)); - -template istream& operator >> (istream&, complex<_FLT>&); -template ostream& operator << (ostream&, const complex<_FLT>&); -} // extern "C++" - -// Specializations and such - -#include -#include -#include - -#endif diff --git a/contrib/libstdc++/std/dcomplex.h b/contrib/libstdc++/std/dcomplex.h deleted file mode 100644 index 5812d9fa7d..0000000000 --- a/contrib/libstdc++/std/dcomplex.h +++ /dev/null @@ -1,91 +0,0 @@ -// The -*- C++ -*- double_complex class. -// Copyright (C) 1994 Free Software Foundation - -// This file is part of the GNU ANSI C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files -// compiled with a GNU compiler to produce an executable, this does not cause -// the resulting executable to be covered by the GNU General Public License. -// This exception does not however invalidate any other reasons why -// the executable file might be covered by the GNU General Public License. - -// Written by Jason Merrill based upon the specification in the 27 May 1994 -// C++ working paper, ANSI document X3J16/94-0098. - -#ifndef __DCOMPLEX__ -#define __DCOMPLEX__ - -#ifdef __GNUG__ -#pragma interface "dcomplex" -#endif - -extern "C++" { -class complex -{ -public: - complex (double r = 0, double i = 0): re (r), im (i) { } - complex (const complex& r): re (r.real ()), im (r.imag ()) { } - explicit complex (const complex& r); - - complex& operator+= (const complex& r) { return __doapl (this, r); } - complex& operator-= (const complex& r) { return __doami (this, r); } - complex& operator*= (const complex& r) { return __doaml (this, r); } - complex& operator/= (const complex& r) { return __doadv (this, r); } - - double real () const { return re; } - double imag () const { return im; } -private: - double re, im; - - friend complex& __doapl<> (complex *, const complex&); - friend complex& __doami<> (complex *, const complex&); - friend complex& __doaml<> (complex *, const complex&); - friend complex& __doadv<> (complex *, const complex&); - -#ifndef __STRICT_ANSI__ - friend inline complex operator + (const complex& x, double y) - { return operator+<> (x, y); } - friend inline complex operator + (double x, const complex& y) - { return operator+<> (x, y); } - friend inline complex operator - (const complex& x, double y) - { return operator-<> (x, y); } - friend inline complex operator - (double x, const complex& y) - { return operator-<> (x, y); } - friend inline complex operator * (const complex& x, double y) - { return operator*<> (x, y); } - friend inline complex operator * (double x, const complex& y) - { return operator*<> (x, y); } - friend inline complex operator / (const complex& x, double y) - { return operator/<> (x, y); } - friend inline complex operator / (double x, const complex& y) - { return operator/<> (x, y); } - friend inline bool operator == (const complex& x, double y) - { return operator==<> (x, y); } - friend inline bool operator == (double x, const complex& y) - { return operator==<> (x, y); } - friend inline bool operator != (const complex& x, double y) - { return operator!=<> (x, y); } - friend inline bool operator != (double x, const complex& y) - { return operator!=<> (x, y); } -#endif /* __STRICT_ANSI__ */ -}; - -inline complex::complex (const complex& r) -: re (r.real ()), im (r.imag ()) -{ } -} // extern "C++" - -#endif diff --git a/contrib/libstdc++/std/fcomplex.h b/contrib/libstdc++/std/fcomplex.h deleted file mode 100644 index cd9af1a2e0..0000000000 --- a/contrib/libstdc++/std/fcomplex.h +++ /dev/null @@ -1,87 +0,0 @@ -// The -*- C++ -*- float_complex class. -// Copyright (C) 1994 Free Software Foundation - -// This file is part of the GNU ANSI C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files -// compiled with a GNU compiler to produce an executable, this does not cause -// the resulting executable to be covered by the GNU General Public License. -// This exception does not however invalidate any other reasons why -// the executable file might be covered by the GNU General Public License. - -// Written by Jason Merrill based upon the specification in the 27 May 1994 -// C++ working paper, ANSI document X3J16/94-0098. - -#ifndef __FCOMPLEX__ -#define __FCOMPLEX__ - -#ifdef __GNUG__ -#pragma interface "fcomplex" -#endif - -extern "C++" { -class complex -{ -public: - complex (float r = 0, float i = 0): re (r), im (i) { } - explicit complex (const complex& r); - explicit complex (const complex& r); - - complex& operator+= (const complex& r) { return __doapl (this, r); } - complex& operator-= (const complex& r) { return __doami (this, r); } - complex& operator*= (const complex& r) { return __doaml (this, r); } - complex& operator/= (const complex& r) { return __doadv (this, r); } - - float real () const { return re; } - float imag () const { return im; } -private: - float re, im; - - friend complex& __doapl<> (complex *, const complex&); - friend complex& __doami<> (complex *, const complex&); - friend complex& __doaml<> (complex *, const complex&); - friend complex& __doadv<> (complex *, const complex&); - -#ifndef __STRICT_ANSI__ - friend inline complex operator + (const complex& x, float y) - { return operator+<> (x, y); } - friend inline complex operator + (float x, const complex& y) - { return operator+<> (x, y); } - friend inline complex operator - (const complex& x, float y) - { return operator-<> (x, y); } - friend inline complex operator - (float x, const complex& y) - { return operator-<> (x, y); } - friend inline complex operator * (const complex& x, float y) - { return operator*<> (x, y); } - friend inline complex operator * (float x, const complex& y) - { return operator*<> (x, y); } - friend inline complex operator / (const complex& x, float y) - { return operator/<> (x, y); } - friend inline complex operator / (float x, const complex& y) - { return operator/<> (x, y); } - friend inline bool operator == (const complex& x, float y) - { return operator==<> (x, y); } - friend inline bool operator == (float x, const complex& y) - { return operator==<> (x, y); } - friend inline bool operator != (const complex& x, float y) - { return operator!=<> (x, y); } - friend inline bool operator != (float x, const complex& y) - { return operator!=<> (x, y); } -#endif /* __STRICT_ANSI__ */ -}; -} // extern "C++" - -#endif diff --git a/contrib/libstdc++/std/gslice.h b/contrib/libstdc++/std/gslice.h deleted file mode 100644 index 4f6e854a14..0000000000 --- a/contrib/libstdc++/std/gslice.h +++ /dev/null @@ -1,111 +0,0 @@ -// The template and inlines for the -*- C++ -*- gslice class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// Written by Gabriel Dos Reis - -#ifndef __GSLICE__ -#define __GSLICE__ - -extern "C++" { - -struct _Indexer { - size_t _M_count; - size_t _M_start; - valarray _M_size; - valarray _M_stride; - valarray _M_index; - _Indexer(size_t, const valarray&, const valarray&); - void _M_increment_use() { ++_M_count; } - size_t _M_decrement_use() { return --_M_count; } -}; - - -class gslice -{ -public: - gslice (); - gslice (size_t, const valarray&, const valarray&); - gslice(const gslice&); - ~gslice(); - - gslice& operator= (const gslice&); - size_t start () const; - valarray size () const; - valarray stride () const; - -private: - _Indexer* _M_index; - - template friend class valarray; -}; - -inline size_t -gslice::start () const -{ return _M_index ? _M_index->_M_start : 0; } - -inline valarray -gslice::size () const -{ return _M_index ? _M_index->_M_size : valarray(); } - -inline valarray -gslice::stride () const -{ return _M_index ? _M_index->_M_stride : valarray(); } - -inline gslice::gslice () : _M_index(0) {} - -inline -gslice::gslice(size_t __o, const valarray& __l, - const valarray& __s) - : _M_index(new _Indexer(__o, __l, __s)) {} - -inline -gslice::gslice(const gslice& __g) : _M_index(__g._M_index) -{ if (_M_index) _M_index->_M_increment_use(); } - -inline -gslice::~gslice() -{ if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index; } - -inline gslice& -gslice::operator= (const gslice& __g) -{ - if (__g._M_index) __g._M_index->_M_increment_use(); - if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index; - _M_index = __g._M_index; - return *this; -} - - -} // extern "C++" - -#endif // __GSLICE__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/gslice_array.h b/contrib/libstdc++/std/gslice_array.h deleted file mode 100644 index 8a67cac905..0000000000 --- a/contrib/libstdc++/std/gslice_array.h +++ /dev/null @@ -1,170 +0,0 @@ -// The template and inlines for the -*- C++ -*- gslice_array class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// Written by Gabriel Dos Reis - -#ifndef __GSLICE_ARRAY__ -#define __GSLICE_ARRAY__ - -extern "C++" { - -template 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 - void operator= (const _Expr<_Dom,_Tp>&) const; - template - void operator*= (const _Expr<_Dom,_Tp>&) const; - template - void operator/= (const _Expr<_Dom,_Tp>&) const; - template - void operator%= (const _Expr<_Dom,_Tp>&) const; - template - void operator+= (const _Expr<_Dom,_Tp>&) const; - template - void operator-= (const _Expr<_Dom,_Tp>&) const; - template - void operator^= (const _Expr<_Dom,_Tp>&) const; - template - void operator&= (const _Expr<_Dom,_Tp>&) const; - template - void operator|= (const _Expr<_Dom,_Tp>&) const; - template - void operator<<= (const _Expr<_Dom,_Tp>&) const; - template - void operator>>= (const _Expr<_Dom,_Tp>&) const; - -private: - _Array<_Tp> _M_array; - const valarray& _M_index; - - friend class valarray<_Tp>; - - gslice_array (_Array<_Tp>, const valarray&); - - // this constructor needs to be implemented. - gslice_array (const gslice_array&); - - // not implemented - gslice_array(); - gslice_array& operator= (const gslice_array&); -}; - -template -inline -gslice_array<_Tp>::gslice_array (_Array<_Tp> __a, - const valarray& __i) - : _M_array (__a), _M_index (__i) {} - - -template -inline -gslice_array<_Tp>::gslice_array (const gslice_array<_Tp>& __a) - : _M_array (__a._M_array), _M_index (__a._M_index) {} - - -template -inline void -gslice_array<_Tp>::operator= (const _Tp& __t) -{ - __valarray_fill (_M_array, _Array(_M_index), - _M_index.size(), __t); -} - -template -inline void -gslice_array<_Tp>::operator= (const valarray<_Tp>& __v) const -{ - __valarray_copy (_Array<_Tp> (__v), __v.size (), - _M_array, _Array(_M_index)); -} - -template -template -inline void -gslice_array<_Tp>::operator= (const _Expr& __e) const -{ - __valarray_copy (__e, _M_index.size(), _M_array, - _Array(_M_index)); -} - -#undef _DEFINE_VALARRAY_OPERATOR -#define _DEFINE_VALARRAY_OPERATOR(op, name) \ -template \ -inline void \ -gslice_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const \ -{ \ - _Array_augmented_##name (_M_array, _Array(_M_index), \ - _Array<_Tp> (__v), __v.size ()); \ -} \ - \ -template template \ -inline void \ -gslice_array<_Tp>::operator##op##= (const _Expr& __e) const \ -{ \ - _Array_augmented_##name (_M_array, _Array(_M_index), __e, \ - _M_index.size()); \ -} - -_DEFINE_VALARRAY_OPERATOR(*, multiplies) -_DEFINE_VALARRAY_OPERATOR(/, divides) -_DEFINE_VALARRAY_OPERATOR(%, modulus) -_DEFINE_VALARRAY_OPERATOR(+, plus) -_DEFINE_VALARRAY_OPERATOR(-, minus) -_DEFINE_VALARRAY_OPERATOR(^, xor) -_DEFINE_VALARRAY_OPERATOR(&, and) -_DEFINE_VALARRAY_OPERATOR(|, or) -_DEFINE_VALARRAY_OPERATOR(<<, shift_left) -_DEFINE_VALARRAY_OPERATOR(>>, shift_right) - -#undef _DEFINE_VALARRAY_OPERATOR - -} // extern "C++" - - -#endif // __GSLICE_ARRAY__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/indirect_array.h b/contrib/libstdc++/std/indirect_array.h deleted file mode 100644 index bb5b79fb83..0000000000 --- a/contrib/libstdc++/std/indirect_array.h +++ /dev/null @@ -1,157 +0,0 @@ -// The template and inlines for the -*- C++ -*- indirect_array class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// Written by Gabriel Dos Reis - -#ifndef __INDIRECT_ARRAY__ -#define __INDIRECT_ARRAY__ - -extern "C++" { - -template class indirect_array -{ -public: - typedef _Tp value_type; - - void operator= (const valarray<_Tp>&) const; - void operator*= (const valarray<_Tp>&) const; - void operator/= (const valarray<_Tp>&) const; - void operator%= (const valarray<_Tp>&) const; - void operator+= (const valarray<_Tp>&) const; - void operator-= (const valarray<_Tp>&) const; - void operator^= (const valarray<_Tp>&) const; - void operator&= (const valarray<_Tp>&) const; - void operator|= (const valarray<_Tp>&) const; - void operator<<= (const valarray<_Tp>&) const; - void operator>>= (const valarray<_Tp>&) const; - void operator= (const _Tp&); - - template - void operator= (const _Expr<_Dom, _Tp>&) const; - template - void operator*= (const _Expr<_Dom, _Tp>&) const; - template - void operator/= (const _Expr<_Dom, _Tp>&) const; - template - void operator%= (const _Expr<_Dom, _Tp>&) const; - template - void operator+= (const _Expr<_Dom, _Tp>&) const; - template - void operator-= (const _Expr<_Dom, _Tp>&) const; - template - void operator^= (const _Expr<_Dom, _Tp>&) const; - template - void operator&= (const _Expr<_Dom, _Tp>&) const; - template - void operator|= (const _Expr<_Dom, _Tp>&) const; - template - void operator<<= (const _Expr<_Dom, _Tp>&) const; - template - void operator>>= (const _Expr<_Dom, _Tp>&) const; - -private: - indirect_array (const indirect_array&); - indirect_array (_Array<_Tp>, size_t, _Array); - - friend class valarray<_Tp>; - friend class gslice_array<_Tp>; - - const size_t _M_sz; - const _Array _M_index; - const _Array<_Tp> _M_array; - - // not implemented - indirect_array (); - indirect_array& operator= (const indirect_array&); -}; - -template -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 -inline -indirect_array<_Tp>::indirect_array (_Array<_Tp> __a, size_t __s, - _Array __i) - : _M_sz (__s), _M_index (__i), _M_array (__a) {} - - -template -inline void -indirect_array<_Tp>::operator= (const _Tp& __t) -{ __valarray_fill(_M_array, _M_index, _M_sz, __t); } - -template -inline void -indirect_array<_Tp>::operator= (const valarray<_Tp>& __v) const -{ __valarray_copy (_Array<_Tp> (__v), _M_sz, _M_array, _M_index); } - -template -template -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 \ -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 template \ -inline void \ -indirect_array<_Tp>::operator##op##= (const _Expr<_Dom,_Tp>& __e) const \ -{ \ - _Array_augmented_##name (_M_array, _M_index, __e, _M_sz); \ -} - -_DEFINE_VALARRAY_OPERATOR(*, multiplies) -_DEFINE_VALARRAY_OPERATOR(/, divides) -_DEFINE_VALARRAY_OPERATOR(%, modulus) -_DEFINE_VALARRAY_OPERATOR(+, plus) -_DEFINE_VALARRAY_OPERATOR(-, minus) -_DEFINE_VALARRAY_OPERATOR(^, xor) -_DEFINE_VALARRAY_OPERATOR(&, and) -_DEFINE_VALARRAY_OPERATOR(|, or) -_DEFINE_VALARRAY_OPERATOR(<<, shift_left) -_DEFINE_VALARRAY_OPERATOR(>>, shift_right) - -#undef _DEFINE_VALARRAY_OPERATOR - -} // extern "C++" - -#endif // __INDIRECT_ARRAY__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/ldcomplex.h b/contrib/libstdc++/std/ldcomplex.h deleted file mode 100644 index bc91fa422b..0000000000 --- a/contrib/libstdc++/std/ldcomplex.h +++ /dev/null @@ -1,95 +0,0 @@ -// The -*- C++ -*- long_double_complex class. -// Copyright (C) 1994 Free Software Foundation - -// This file is part of the GNU ANSI C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files -// compiled with a GNU compiler to produce an executable, this does not cause -// the resulting executable to be covered by the GNU General Public License. -// This exception does not however invalidate any other reasons why -// the executable file might be covered by the GNU General Public License. - -// Written by Jason Merrill based upon the specification in the 27 May 1994 -// C++ working paper, ANSI document X3J16/94-0098. - -#ifndef __LDCOMPLEX__ -#define __LDCOMPLEX__ - -#ifdef __GNUG__ -#pragma interface "ldcomplex" -#endif - -extern "C++" { -class complex -{ -public: - complex (long double r = 0, long double i = 0): re (r), im (i) { } - complex (const complex& r): re (r.real ()), im (r.imag ()) { } - complex (const complex& r): re (r.real ()), im (r.imag ()) { } - - complex& operator+= (const complex& r) { return __doapl (this, r); } - complex& operator-= (const complex& r) { return __doami (this, r); } - complex& operator*= (const complex& r) { return __doaml (this, r); } - complex& operator/= (const complex& r) { return __doadv (this, r); } - - long double real () const { return re; } - long double imag () const { return im; } -private: - long double re, im; - - friend complex& __doapl<> (complex *, const complex&); - friend complex& __doami<> (complex *, const complex&); - friend complex& __doaml<> (complex *, const complex&); - friend complex& __doadv<> (complex *, const complex&); - -#ifndef __STRICT_ANSI__ - friend inline complex operator + (const complex& x, long double y) - { return operator+<> (x, y); } - friend inline complex operator + (long double x, const complex& y) - { return operator+<> (x, y); } - friend inline complex operator - (const complex& x, long double y) - { return operator-<> (x, y); } - friend inline complex operator - (long double x, const complex& y) - { return operator-<> (x, y); } - friend inline complex operator * (const complex& x, long double y) - { return operator*<> (x, y); } - friend inline complex operator * (long double x, const complex& y) - { return operator*<> (x, y); } - friend inline complex operator / (const complex& x, long double y) - { return operator/<> (x, y); } - friend inline complex operator / (long double x, const complex& y) - { return operator/<> (x, y); } - friend inline bool operator == (const complex& x, long double y) - { return operator==<> (x, y); } - friend inline bool operator == (long double x, const complex& y) - { return operator==<> (x, y); } - friend inline bool operator != (const complex& x, long double y) - { return operator!=<> (x, y); } - friend inline bool operator != (long double x, const complex& y) - { return operator!=<> (x, y); } -#endif /* __STRICT_ANSI__ */ -}; - -inline complex::complex (const complex& r) -: re (r.real ()), im (r.imag ()) -{ } - -inline complex::complex (const complex& r) -: re (r.real ()), im (r.imag ()) -{ } -} // extern "C++" - -#endif diff --git a/contrib/libstdc++/std/mask_array.h b/contrib/libstdc++/std/mask_array.h deleted file mode 100644 index d431be4e97..0000000000 --- a/contrib/libstdc++/std/mask_array.h +++ /dev/null @@ -1,154 +0,0 @@ -// The template and inlines for the -*- C++ -*- mask_array class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// Written by Gabriel Dos Reis - -#ifndef __MASK_ARRAY__ -#define __MASK_ARRAY__ - -extern "C++" { - -template class mask_array -{ -public: - typedef _T value_type; - - void operator= (const valarray<_T>&) const; - void operator*= (const valarray<_T>&) const; - void operator/= (const valarray<_T>&) const; - void operator%= (const valarray<_T>&) const; - void operator+= (const valarray<_T>&) const; - void operator-= (const valarray<_T>&) const; - void operator^= (const valarray<_T>&) const; - void operator&= (const valarray<_T>&) const; - void operator|= (const valarray<_T>&) const; - void operator<<=(const valarray<_T>&) const; - void operator>>=(const valarray<_T>&) const; - void operator= (const _T&); - - template - void operator= (const _Expr<_Dom,_T>&) const; - template - void operator*= (const _Expr<_Dom,_T>&) const; - template - void operator/= (const _Expr<_Dom,_T>&) const; - template - void operator%= (const _Expr<_Dom,_T>&) const; - template - void operator+= (const _Expr<_Dom,_T>&) const; - template - void operator-= (const _Expr<_Dom,_T>&) const; - template - void operator^= (const _Expr<_Dom,_T>&) const; - template - void operator&= (const _Expr<_Dom,_T>&) const; - template - void operator|= (const _Expr<_Dom,_T>&) const; - template - void operator<<=(const _Expr<_Dom,_T>&) const; - template - void operator>>=(const _Expr<_Dom,_T>&) const; - -private: - mask_array (_Array<_T>, size_t, _Array); - friend class valarray<_T>; - - const size_t _M_sz; - const _Array _M_mask; - const _Array<_T> _M_array; - - mask_array (const mask_array&); - - // not implemented - mask_array (); - mask_array& operator= (const mask_array&); -}; - -template -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 -inline -mask_array<_T>::mask_array (_Array<_T> __a, size_t __s, _Array __m) - : _M_sz (__s), _M_mask (__m), _M_array (__a) {} - -template -inline void -mask_array<_T>::operator= (const _T& __t) -{ __valarray_fill (_M_array, _M_sz, _M_mask, __t); } - -template -inline void -mask_array<_T>::operator= (const valarray<_T>& __v) const -{ __valarray_copy (_Array<_T> (__v), __v.size (), _M_array, _M_mask); } - -template -template -inline void -mask_array<_T>::operator= (const _Expr& __e) const -{ __valarray_copy (__e, __e.size (), _M_array, _M_mask); } - -#undef _DEFINE_VALARRAY_OPERATOR -#define _DEFINE_VALARRAY_OPERATOR(op, name) \ -template \ -inline void \ -mask_array<_T>::operator##op##= (const valarray<_T>& __v) const \ -{ \ - _Array_augmented_##name (_M_array, _M_mask, \ - _Array<_T> (__v), __v.size ()); \ -} \ - \ -template template \ -inline void \ -mask_array<_T>::operator##op##= (const _Expr& __e) const \ -{ \ - _Array_augmented_##name (_M_array, _M_mask, __e, __e.size ()); \ -} - -_DEFINE_VALARRAY_OPERATOR(*, multiplies) -_DEFINE_VALARRAY_OPERATOR(/, divides) -_DEFINE_VALARRAY_OPERATOR(%, modulus) -_DEFINE_VALARRAY_OPERATOR(+, plus) -_DEFINE_VALARRAY_OPERATOR(-, minus) -_DEFINE_VALARRAY_OPERATOR(^, xor) -_DEFINE_VALARRAY_OPERATOR(&, and) -_DEFINE_VALARRAY_OPERATOR(|, or) -_DEFINE_VALARRAY_OPERATOR(<<, shift_left) -_DEFINE_VALARRAY_OPERATOR(>>, shift_right) - -#undef _DEFINE_VALARRAY_OPERATOR - -} // extern "C++" - -#endif // __MASK_ARRAY__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/slice.h b/contrib/libstdc++/std/slice.h deleted file mode 100644 index cf2fb283de..0000000000 --- a/contrib/libstdc++/std/slice.h +++ /dev/null @@ -1,76 +0,0 @@ -// The template and inlines for the -*- C++ -*- slice class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// Written by Gabriel Dos Reis - -#ifndef __SLICE__ -#define __SLICE__ - -extern "C++" { - -class slice -{ -public: - slice (); - slice (size_t, size_t, size_t); - - size_t start () const; - size_t size () const; - size_t stride () const; - -private: - size_t _M_off; // offset - size_t _M_sz; // size - size_t _M_st; // stride unit -}; - -inline slice::slice () {} - -inline slice::slice (size_t __o, size_t __d, size_t __s) - : _M_off (__o), _M_sz (__d), _M_st (__s) {} - -inline size_t -slice::start () const - { return _M_off; } - -inline size_t -slice::size () const - { return _M_sz; } - -inline size_t -slice::stride () const - { return _M_st; } - -} // extern "C++" - -#endif // __SLICE__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/slice_array.h b/contrib/libstdc++/std/slice_array.h deleted file mode 100644 index dc1aa34d35..0000000000 --- a/contrib/libstdc++/std/slice_array.h +++ /dev/null @@ -1,156 +0,0 @@ -// The template and inlines for the -*- C++ -*- slice_array class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// Written by Gabriel Dos Reis - -#ifndef __SLICE_ARRAY__ -#define __SLICE_ARRAY__ - -extern "C++" { - -template -class slice_array -{ -public: - typedef _T value_type; - - void operator= (const valarray<_T>&) const; - void operator*= (const valarray<_T>&) const; - void operator/= (const valarray<_T>&) const; - void operator%= (const valarray<_T>&) const; - void operator+= (const valarray<_T>&) const; - void operator-= (const valarray<_T>&) const; - void operator^= (const valarray<_T>&) const; - void operator&= (const valarray<_T>&) const; - void operator|= (const valarray<_T>&) const; - void operator<<= (const valarray<_T>&) const; - void operator>>= (const valarray<_T>&) const; - void operator= (const _T &); - - template - void operator= (const _Expr<_Dom,_T>&) const; - template - void operator*= (const _Expr<_Dom,_T>&) const; - template - void operator/= (const _Expr<_Dom,_T>&) const; - template - void operator%= (const _Expr<_Dom,_T>&) const; - template - void operator+= (const _Expr<_Dom,_T>&) const; - template - void operator-= (const _Expr<_Dom,_T>&) const; - template - void operator^= (const _Expr<_Dom,_T>&) const; - template - void operator&= (const _Expr<_Dom,_T>&) const; - template - void operator|= (const _Expr<_Dom,_T>&) const; - template - void operator<<= (const _Expr<_Dom,_T>&) const; - template - void operator>>= (const _Expr<_Dom,_T>&) const; - -private: - friend class valarray<_T>; - slice_array(_Array<_T>, const slice&); - - const size_t _M_sz; - const size_t _M_stride; - const _Array<_T> _M_array; - - // this constructor is implemented since we need to return a value. - slice_array (const slice_array&); - - // not implemented - slice_array (); - slice_array& operator= (const slice_array&); -}; - -template -inline slice_array<_T>::slice_array (_Array<_T> __a, const slice& __s) - : _M_sz (__s.size ()), _M_stride (__s.stride ()), - _M_array (__a.begin () + __s.start ()) {} - -template -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 -inline void -slice_array<_T>::operator= (const _T& __t) -{ __valarray_fill (_M_array, _M_sz, _M_stride, __t); } - -template -inline void -slice_array<_T>::operator= (const valarray<_T>& __v) const -{ __valarray_copy (_Array<_T> (__v), _M_array, _M_sz, _M_stride); } - -template -template -inline void -slice_array<_T>::operator= (const _Expr<_Dom,_T>& __e) const -{ __valarray_copy (__e, _M_sz, _M_array, _M_stride); } - -#undef _DEFINE_VALARRAY_OPERATOR -#define _DEFINE_VALARRAY_OPERATOR(op, name) \ -template \ -inline void \ -slice_array<_T>::operator##op##= (const valarray<_T>& __v) const \ -{ \ - _Array_augmented_##name (_M_array, _M_sz, _M_stride, _Array<_T> (__v));\ -} \ - \ -template template \ -inline void \ -slice_array<_T>::operator##op##= (const _Expr<_Dom,_T>& __e) const \ -{ \ - _Array_augmented_##name (_M_array, _M_stride, __e, _M_sz); \ -} - - -_DEFINE_VALARRAY_OPERATOR(*, multiplies) -_DEFINE_VALARRAY_OPERATOR(/, divides) -_DEFINE_VALARRAY_OPERATOR(%, modulus) -_DEFINE_VALARRAY_OPERATOR(+, plus) -_DEFINE_VALARRAY_OPERATOR(-, minus) -_DEFINE_VALARRAY_OPERATOR(^, xor) -_DEFINE_VALARRAY_OPERATOR(&, and) -_DEFINE_VALARRAY_OPERATOR(|, or) -_DEFINE_VALARRAY_OPERATOR(<<, shift_left) -_DEFINE_VALARRAY_OPERATOR(>>, shift_right) - -#undef _DEFINE_VALARRAY_OPERATOR - -} // extern "C++" - -#endif // __SLICE_ARRAY__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/std_valarray.h b/contrib/libstdc++/std/std_valarray.h deleted file mode 100644 index b300655554..0000000000 --- a/contrib/libstdc++/std/std_valarray.h +++ /dev/null @@ -1,728 +0,0 @@ -// The template and inlines for the -*- C++ -*- valarray class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// Written by Gabriel Dos Reis - -#ifndef __STD_VALARRAY__ -#define __STD_VALARRAY__ -#define _G_NO_VALARRAY_TEMPLATE_EXPORT 1 - -#include -#include -#include -#include -#include -#include - -#ifndef alloca -#ifdef __GNUC__ -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) -#include -#else /* not sparc */ -#if defined (MSDOS) && !defined (__TURBOC__) -#include -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -#include - #pragma alloca -#else /* not MSDOS, __TURBOC__, or _AIX */ -#ifdef __hpux -#endif /* __hpux */ -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc. */ -#endif /* not GNU C. */ -#endif /* alloca not defined. */ - -extern "C" { - void* alloca(size_t); -} - - -extern "C++" { - -template class _Expr; - -template class _ValArray; - -template class _Oper, - template class _Meta, class _Dom> struct _UnClos; - -template class _Oper, - template class _Meta1, - template class _Meta2, - class _Dom1, class _Dom2> class _BinClos; - -template class _Meta, class _Dom> class _SClos; - -template class _Meta, class _Dom> class _GClos; - -template class _Meta, class _Dom> class _IClos; - -template class _Meta, class _Dom> class _ValFunClos; - -template class _Meta, class _Dom> class _RefFunClos; - -template struct _Unary_plus; -template struct _Bitwise_and; -template struct _Bitwise_or; -template struct _Bitwise_xor; -template struct _Bitwise_not; -template struct _Shift_left; -template struct _Shift_right; - -template class valarray; // An array of type _Tp -class slice; // BLAS-like slice out of an array -template class slice_array; -class gslice; // generalized slice out of an array -template class gslice_array; -template class mask_array; // masked array -template class indirect_array; // indirected array - -} // extern "C++" - -#include -#include - -extern "C++" { - -template 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 - 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 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&) const; - mask_array<_Tp> operator[](const valarray&); - _Expr<_IClos<_ValArray, _Tp>, _Tp> - operator[](const valarray&) const; - indirect_array<_Tp> operator[](const valarray&); - - // _lib.valarray.unary_ unary operators: - _Expr<_UnClos<_Unary_plus,_ValArray,_Tp>,_Tp> operator+ () const; - _Expr<_UnClos,_Tp> operator- () const; - _Expr<_UnClos<_Bitwise_not,_ValArray,_Tp>,_Tp> operator~ () const; - _Expr<_UnClos,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 - valarray<_Tp>& operator*= (const _Expr<_Dom,_Tp>&); - template - valarray<_Tp>& operator/= (const _Expr<_Dom,_Tp>&); - template - valarray<_Tp>& operator%= (const _Expr<_Dom,_Tp>&); - template - valarray<_Tp>& operator+= (const _Expr<_Dom,_Tp>&); - template - valarray<_Tp>& operator-= (const _Expr<_Dom,_Tp>&); - template - valarray<_Tp>& operator^= (const _Expr<_Dom,_Tp>&); - template - valarray<_Tp>& operator|= (const _Expr<_Dom,_Tp>&); - template - valarray<_Tp>& operator&= (const _Expr<_Dom,_Tp>&); - template - valarray<_Tp>& operator<<=(const _Expr<_Dom,_Tp>&); - template - 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 struct _Unary_plus : unary_function<_Tp,_Tp> { - _Tp operator() (const _Tp& __t) const { return __t; } -}; - -template struct _Bitwise_and : binary_function<_Tp,_Tp,_Tp> { - _Tp operator() (_Tp __x, _Tp __y) const { return __x & __y; } -}; - -template struct _Bitwise_or : binary_function<_Tp,_Tp,_Tp> { - _Tp operator() (_Tp __x, _Tp __y) const { return __x | __y; } -}; - -template struct _Bitwise_xor : binary_function<_Tp,_Tp,_Tp> { - _Tp operator() (_Tp __x, _Tp __y) const { return __x ^ __y; } -}; - -template struct _Bitwise_not : unary_function<_Tp,_Tp> { - _Tp operator() (_Tp __t) const { return ~__t; } -}; - -template struct _Shift_left : unary_function<_Tp,_Tp> { - _Tp operator() (_Tp __x, _Tp __y) const { return __x << __y; } -}; - -template struct _Shift_right : unary_function<_Tp,_Tp> { - _Tp operator() (_Tp __x, _Tp __y) const { return __x >> __y; } -}; - - -template -inline _Tp -valarray<_Tp>::operator[] (size_t __i) const -{ return _M_data[__i]; } - -template -inline _Tp& -valarray<_Tp>::operator[] (size_t __i) -{ return _M_data[__i]; } - -} // extern "C++" - -#include -#include -#include -#include -#include -#include - -extern "C++" { - -template -inline valarray<_Tp>::valarray () : _M_size (0), _M_data (0) {} - -template -inline valarray<_Tp>::valarray (size_t __n) - : _M_size (__n), _M_data (new _Tp[__n]) {} - -template -inline valarray<_Tp>::valarray (const _Tp& __t, size_t __n) - : _M_size (__n), _M_data (new _Tp[__n]) -{ __valarray_fill (_M_data, _M_size, __t); } - -template -inline valarray<_Tp>::valarray (const _Tp* __restrict__ __pT, size_t __n) - : _M_size (__n), _M_data (new _Tp[__n]) -{ __valarray_copy (__pT, __n, _M_data); } - -template -inline valarray<_Tp>::valarray (const valarray<_Tp>& __v) - : _M_size (__v._M_size), _M_data (new _Tp[__v._M_size]) -{ __valarray_copy (__v._M_data, _M_size, _M_data); } - -template -inline valarray<_Tp>::valarray (const slice_array<_Tp>& __sa) - : _M_size (__sa._M_sz), _M_data (new _Tp[__sa._M_sz]) -{ __valarray_copy (__sa._M_array, __sa._M_sz, __sa._M_stride, - _Array<_Tp>(_M_data)); } - -template -inline valarray<_Tp>::valarray (const gslice_array<_Tp>& __ga) - : _M_size (__ga._M_index.size()), _M_data (new _Tp[_M_size]) -{ __valarray_copy (__ga._M_array, _Array(__ga._M_index), - _Array<_Tp>(_M_data), _M_size); } - -template -inline valarray<_Tp>::valarray (const mask_array<_Tp>& __ma) - : _M_size (__ma._M_sz), _M_data (new _Tp[__ma._M_sz]) -{ __valarray_copy (__ma._M_array, __ma._M_mask, - _Array<_Tp>(_M_data), _M_size); } - -template -inline valarray<_Tp>::valarray (const indirect_array<_Tp>& __ia) - : _M_size (__ia._M_sz), _M_data (new _Tp[__ia._M_sz]) -{ __valarray_copy (__ia._M_array, __ia._M_index, - _Array<_Tp>(_M_data), _M_size); } - -template template -inline valarray<_Tp>::valarray (const _Expr<_Dom, _Tp>& __e) - : _M_size (__e.size ()), _M_data (new _Tp[_M_size]) -{ __valarray_copy (__e, _M_size, _Array<_Tp>(_M_data)); } - -template -inline valarray<_Tp>::~valarray () { delete[] _M_data; } - -template -inline valarray<_Tp>& -valarray<_Tp>::operator= (const valarray<_Tp>& __v) -{ - __valarray_copy(__v._M_data, _M_size, _M_data); - return *this; -} - -template -inline valarray<_Tp>& -valarray<_Tp>::operator= (const _Tp& __t) -{ - __valarray_fill (_M_data, _M_size, __t); - return *this; -} - -template -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 -inline valarray<_Tp>& -valarray<_Tp>::operator= (const gslice_array<_Tp>& __ga) -{ - __valarray_copy (__ga._M_array, _Array(__ga._M_index), - _Array<_Tp>(_M_data), _M_size); - return *this; -} - -template -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 -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 template -inline valarray<_Tp>& -valarray<_Tp>::operator= (const _Expr<_Dom, _Tp>& __e) -{ - __valarray_copy (__e, _M_size, _Array<_Tp>(_M_data)); - return *this; -} - -template -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 -inline slice_array<_Tp> -valarray<_Tp>::operator[] (slice __s) -{ - return slice_array<_Tp> (_Array<_Tp>(_M_data), __s); -} - -template -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 -inline gslice_array<_Tp> -valarray<_Tp>::operator[] (const gslice& __gs) -{ - return gslice_array<_Tp> - (_Array<_Tp>(_M_data), __gs._M_index->_M_index); -} - -template -inline valarray<_Tp> -valarray<_Tp>::operator[] (const valarray& __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 (__m))); -} - -template -inline mask_array<_Tp> -valarray<_Tp>::operator[] (const valarray& __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 (__m)); -} - -template -inline _Expr<_IClos<_ValArray,_Tp>, _Tp> -valarray<_Tp>::operator[] (const valarray& __i) const -{ - typedef _IClos<_ValArray,_Tp> _Closure; - return _Expr<_Closure, _Tp> (_Closure (*this, __i)); -} - -template -inline indirect_array<_Tp> -valarray<_Tp>::operator[] (const valarray& __i) -{ - return indirect_array<_Tp> (_Array<_Tp>(_M_data), __i.size(), - _Array (__i)); -} - -template -inline size_t valarray<_Tp>::size () const { return _M_size; } - -template -inline _Tp -valarray<_Tp>::sum () const -{ - return accumulate (_M_data, _M_data + _M_size, _Tp ()); -} - -template -inline _Tp -valarray<_Tp>::product () const -{ - return accumulate (_M_data, _M_data+_M_size, _Tp(1), multiplies<_Tp> ()); -} - -template -inline valarray<_Tp> -valarray<_Tp>::shift (int __n) const -{ - _Tp* const __a = static_cast<_Tp*> (alloca (sizeof(_Tp) * _M_size)); - if (! __n) // __n == 0: no shift - __valarray_copy (_M_data, _M_size, __a); - else if (__n > 0) { // __n > 0: shift left - if (__n > _M_size) - __valarray_fill(__a, __n, _Tp()); - else { - __valarray_copy (_M_data+__n, _M_size-__n, __a); - __valarray_fill (__a+_M_size-__n, __n, _Tp()); - } - } - else { // __n < 0: shift right - __valarray_copy (_M_data, _M_size+__n, __a-__n); - __valarray_fill(__a, -__n, _Tp()); - } - return valarray<_Tp> (__a, _M_size); -} - -template -inline valarray<_Tp> -valarray<_Tp>::cshift (int __n) const -{ - _Tp* const __a = static_cast<_Tp*> (alloca (sizeof(_Tp) * _M_size)); - if (! __n) // __n == 0: no cshift - __valarray_copy(_M_data, _M_size, __a); - else if (__n > 0) { // __n > 0: cshift left - __valarray_copy (_M_data, __n, __a + _M_size-__n); - __valarray_copy (_M_data + __n, _M_size-__n, __a); - } - else { // __n < 0: cshift right - __valarray_copy (_M_data + _M_size + __n, -__n, __a); - __valarray_copy (_M_data, _M_size + __n, __a - __n); - } - return valarray<_Tp> (__a, _M_size); -} - -template -inline void -valarray<_Tp>::resize (size_t __n, _Tp __c) -{ - if (_M_size != __n) { - delete[] _M_data; - _M_size = __n; - _M_data = new _Tp[_M_size]; - } - __valarray_fill (_M_data, _M_size, __c); -} - -template -inline _Tp -valarray<_Tp>::min() const -{ - return *min_element (_M_data, _M_data+_M_size); -} - -template -inline _Tp -valarray<_Tp>::max() const -{ - return *max_element (_M_data, _M_data+_M_size); -} - -template -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 -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 \ - 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 - inline _Expr<_UnClos, bool> - valarray<_Tp>::operator!() const - { - typedef _UnClos _Closure; - return _Expr<_Closure, bool> (_Closure (*this)); - } - -#define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name) \ - template \ - inline valarray<_Tp> & \ - valarray<_Tp>::operator##_Op##= (const _Tp &__t) \ - { \ - _Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, __t); \ - return *this; \ - } \ - \ - template \ - inline valarray<_Tp> & \ - valarray<_Tp>::operator##_Op##= (const valarray<_Tp> &__v) \ - { \ - _Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, \ - _Array<_Tp>(__v._M_data)); \ - return *this; \ - } - -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(+, plus) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(-, minus) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(*, multiplies) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(/, divides) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(%, modulus) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(^, xor) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, and) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, or) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(<<, shift_left) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, shift_right) - -#undef _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT - - -#define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name) \ - template template \ - 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 \ - 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 \ - 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 \ - 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 \ - 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 \ - 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 \ - inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,bool> \ - operator##_Op (const _Tp &__t, const valarray<_Tp> &__v) \ - { \ - typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure; \ - return _Expr<_Closure, bool> (_Closure (__t, __v)); \ - } - -_DEFINE_LOGICAL_OPERATOR(&&, logical_and) -_DEFINE_LOGICAL_OPERATOR(||, logical_or) -_DEFINE_LOGICAL_OPERATOR(==, equal_to) -_DEFINE_LOGICAL_OPERATOR(!=, not_equal_to) -_DEFINE_LOGICAL_OPERATOR(<, less) -_DEFINE_LOGICAL_OPERATOR(>, greater) -_DEFINE_LOGICAL_OPERATOR(<=, less_equal) -_DEFINE_LOGICAL_OPERATOR(>=, greater_equal) - -#undef _DEFINE_VALARRAY_OPERATOR - -#undef _G_NO_VALARRAY_TEMPLATE_EXPORT - -} // extern "C++" - -#endif // __STD_VALARRAY__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/straits.h b/contrib/libstdc++/std/straits.h deleted file mode 100644 index c80e7ab7a6..0000000000 --- a/contrib/libstdc++/std/straits.h +++ /dev/null @@ -1,161 +0,0 @@ -// Character traits template for the -*- C++ -*- string classes. -// Copyright (C) 1994 Free Software Foundation - -// This file is part of the GNU ANSI C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files -// compiled with a GNU compiler to produce an executable, this does not cause -// the resulting executable to be covered by the GNU General Public License. -// This exception does not however invalidate any other reasons why -// the executable file might be covered by the GNU General Public License. - -// Written by Jason Merrill based upon the specification by Takanori Adachi -// in ANSI X3J16/94-0013R2. - -#ifndef __STRING_CHAR_TRAITS__ -#define __STRING_CHAR_TRAITS__ - -#ifdef __GNUG__ -// For string_char_traits -#pragma interface "std/straits.h" -#endif - -#include - -extern "C++" { -template -struct string_char_traits { - typedef charT char_type; // for users to acquire the basic character type - - // constraints - - static void assign (char_type& c1, const char_type& c2) - { c1 = c2; } - static bool eq (const char_type& c1, const char_type& c2) - { return (c1 == c2); } - static bool ne (const char_type& c1, const char_type& c2) - { return !(c1 == c2); } - static bool lt (const char_type& c1, const char_type& c2) - { return (c1 < c2); } - static char_type eos () { return char_type(); } // the null character - static bool is_del(char_type a) { return 0; } - // characteristic function for delimiters of charT - - // speed-up functions - - static int compare (const char_type* s1, const char_type* s2, size_t n) - { - size_t i; - for (i = 0; i < n; ++i) - if (ne (s1[i], s2[i])) - return lt (s1[i], s2[i]) ? -1 : 1; - - return 0; - } - - static size_t length (const char_type* s) - { - size_t l = 0; - while (ne (*s++, eos ())) - ++l; - return l; - } - - static char_type* copy (char_type* s1, const char_type* s2, size_t n) - { - for (; n--; ) - assign (s1[n], s2[n]); - return s1; - } - - static char_type* move (char_type* s1, const char_type* s2, size_t n) - { - char_type a[n]; - size_t i; - for (i = 0; i < n; ++i) - assign (a[i], s2[i]); - for (i = 0; i < n; ++i) - assign (s1[i], a[i]); - return s1; - } - - static char_type* set (char_type* s1, const char_type& c, size_t n) - { - for (; n--; ) - assign (s1[n], c); - return s1; - } -}; - -class istream; -class ostream; -#include -#include - -struct string_char_traits { - typedef char char_type; - - static void assign (char_type& c1, const char_type& c2) - { c1 = c2; } - static bool eq (const char_type & c1, const char_type& c2) - { return (c1 == c2); } - static bool ne (const char_type& c1, const char_type& c2) - { return (c1 != c2); } - static bool lt (const char_type& c1, const char_type& c2) - { return (c1 < c2); } - static char_type eos () { return 0; } - static bool is_del(char_type a) { return isspace(a); } - - static int compare (const char_type* s1, const char_type* s2, size_t n) - { return memcmp (s1, s2, n); } - static size_t length (const char_type* s) - { return strlen (s); } - static char_type* copy (char_type* s1, const char_type* s2, size_t n) - { return (char_type*) memcpy (s1, s2, n); } - static char_type* move (char_type* s1, const char_type* s2, size_t n) - { return (char_type*) memmove (s1, s2, n); } - static char_type* set (char_type* s1, const char_type& c, size_t n) - { return (char_type*) memset (s1, c, n); } -}; - -#if 0 -#include -struct string_char_traits { - typedef wchar_t char_type; - - static void assign (char_type& c1, const char_type& c2) - { c1 = c2; } - static bool eq (const char_type & c1, const char_type& c2) - { return (c1 == c2); } - static bool ne (const char_type& c1, const char_type& c2) - { return (c1 != c2); } - static bool lt (const char_type& c1, const char_type& c2) - { return (c1 < c2); } - static char_type eos () { return 0; } - static bool is_del(char_type a) { return iswspace(a); } - - static int compare (const char_type* s1, const char_type* s2, size_t n) - { return wmemcmp (s1, s2, n); } - static size_t length (const char_type* s) - { return wcslen (s); } - static char_type* copy (char_type* s1, const char_type* s2, size_t n) - { return wmemcpy (s1, s2, n); } - static char_type* set (char_type* s1, const char_type& c, size_t n) - { return wmemset (s1, c, n); } -}; -#endif -} // extern "C++" -#endif diff --git a/contrib/libstdc++/std/valarray_array.h b/contrib/libstdc++/std/valarray_array.h deleted file mode 100644 index a0b5818fd8..0000000000 --- a/contrib/libstdc++/std/valarray_array.h +++ /dev/null @@ -1,346 +0,0 @@ -// The template and inlines for the -*- C++ -*- internal _Array helper class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// Written by Gabriel Dos Reis - -#ifndef __VALARRAY_ARRAY__ -#define __VALARRAY_ARRAY__ - -#include -#include - -extern "C++" { - -// -// Helper functions on raw pointers -// - -// fill plain array __a[<__n>] with __t -template -inline void -__valarray_fill (_Tp* __restrict__ __a, size_t __n, const _Tp& __t) -{ while (__n--) *__a++ = __t; } - -// fill strided array __a[<__n-1 : __s>] with __t -template -inline void -__valarray_fill (_Tp* __restrict__ __a, size_t __n, - size_t __s, const _Tp& __t) -{ for (size_t __i=0; __i<__n; ++__i, __a+=__s) *__a = __t; } - -// fill indirect array __a[__i[<__n>]] with __i -template -inline void -__valarray_fill(_Tp* __restrict__ __a, const size_t* __restrict__ __i, - size_t __n, const _Tp& __t) -{ for (size_t __j=0; __j<__n; ++__j, ++__i) __a[*__i] = __t; } - -// copy plain array __a[<__n>] in __b[<__n>] -template -inline void -__valarray_copy (const _Tp* __restrict__ __a, size_t __n, - _Tp* __restrict__ __b) -{ memcpy (__b, __a, __n * sizeof(_Tp)); } - -// copy strided array __a[<__n : __s>] in plain __b[<__n>] -template -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 -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 -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 -inline void -__valarray_copy (const _Tp* __restrict__ __a, size_t __n, - _Tp* __restrict__ __b, const size_t* __restrict__ __i) -{ for (size_t __j=0; __j<__n; ++__j, ++__a, ++__i) __b[*__i] = *__a; } - -// -// Helper class _Array, first layer of valarray abstraction. -// All operations on valarray should be forwarded to this class -// whenever possible. -- gdr -// - -template struct _Array { - - explicit _Array (size_t); - explicit _Array (_Tp* const __restrict__); - explicit _Array (const valarray<_Tp>&); - _Array (const _Tp* __restrict__, size_t); - - void free_data() const; - _Tp* begin () const; - - _Tp* const __restrict__ _M_data; -}; - -template -inline void -__valarray_fill (_Array<_Tp> __a, size_t __n, const _Tp& __t) -{ __valarray_fill (__a._M_data, __n, __t); } - -template -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 -inline void -__valarray_fill (_Array<_Tp> __a, _Array __i, - size_t __n, const _Tp& __t) -{ __valarray_fill (__a._M_data, __i._M_data, __n, __t); } - -template -inline void -__valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b) -{ __valarray_copy (__a._M_data, __n, __b._M_data); } - -template -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 -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 -inline void -__valarray_copy (_Array<_Tp> __a, _Array __i, - _Array<_Tp> __b, size_t __n) -{ __valarray_copy (__a._M_data, __i._M_data, __b._M_data, __n); } - -template -inline void -__valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b, - _Array __i) -{ __valarray_copy (__a._M_data, __n, __b._M_data, __i._M_data); } - -template -inline -_Array<_Tp>::_Array (size_t __n) : _M_data (new _Tp[__n]) {} - -template -inline -_Array<_Tp>::_Array (_Tp* const __restrict__ __p) : _M_data (__p) {} - -template -inline _Array<_Tp>::_Array (const valarray<_Tp>& __v) - : _M_data (__v._M_data) {} - -template -inline -_Array<_Tp>::_Array (const _Tp* __restrict__ __b, size_t __s) - : _M_data (new _Tp[__s]) { __valarray_copy (__b, __s, _M_data); } - -template -inline void -_Array<_Tp>::free_data() const { delete[] _M_data; } - -template -inline _Tp* -_Array<_Tp>::begin () const -{ return _M_data; } - -#define _DEFINE_ARRAY_FUNCTION(_Op, _Name) \ -template \ -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 \ -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 \ -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 \ -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 \ -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 \ -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 \ -inline void \ -_Array_augmented_##_Name (_Array<_Tp> __a, _Array __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 \ -inline void \ -_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, \ - _Array<_Tp> __b, _Array __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 \ -void \ -_Array_augmented_##_Name (_Array<_Tp> __a, _Array __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 \ -void \ -_Array_augmented_##_Name (_Array<_Tp> __a, _Array __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 \ -void \ -_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, \ - _Array<_Tp> __b, _Array __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 \ -void \ -_Array_augmented_##_Name (_Array<_Tp> __a, _Array __m, \ - const _Expr<_Dom, _Tp>& __e, size_t __n) \ -{ \ - bool* ok(__m._M_data); \ - _Tp* __p (__a._M_data); \ - for (size_t __i=0; __i<__n; ++__i, ++ok, ++__p) { \ - while (! *ok) { \ - ++ok; \ - ++__p; \ - } \ - *__p _Op##= __e[__i]; \ - } \ -} - -_DEFINE_ARRAY_FUNCTION(+, plus) -_DEFINE_ARRAY_FUNCTION(-, minus) -_DEFINE_ARRAY_FUNCTION(*, multiplies) -_DEFINE_ARRAY_FUNCTION(/, divides) -_DEFINE_ARRAY_FUNCTION(%, modulus) -_DEFINE_ARRAY_FUNCTION(^, xor) -_DEFINE_ARRAY_FUNCTION(|, or) -_DEFINE_ARRAY_FUNCTION(&, and) -_DEFINE_ARRAY_FUNCTION(<<, shift_left) -_DEFINE_ARRAY_FUNCTION(>>, shift_right) - -#undef _DEFINE_ARRAY_FUNCTION - -} // extern "C++" - -#ifdef _G_NO_VALARRAY_TEMPLATE_EXPORT -# define export -# include -#endif - -#endif // __VALARRAY_ARRAY__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/valarray_array.tcc b/contrib/libstdc++/std/valarray_array.tcc deleted file mode 100644 index bd6692571f..0000000000 --- a/contrib/libstdc++/std/valarray_array.tcc +++ /dev/null @@ -1,130 +0,0 @@ -// The template and inlines for the -*- C++ -*- internal _Array helper class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// Written by Gabriel Dos Reis - -#ifndef __VALARRAY_ARRAY_TCC__ -#define __VALARRAY_ARRAY_TCC__ - -extern "C++" { - -export template -void -__valarray_fill (_Array<_Tp> __a, size_t __n, _Array __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 -void -__valarray_copy (_Array<_Tp> __a, _Array __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 -void -__valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b, _Array __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 -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 -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 -void -__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n, - _Array<_Tp> __a, _Array __i) -{ - size_t* __j (__i._M_data); - for (size_t __k=0; __k<__n; ++__k, ++__j) __a._M_data[*__j] = __e[__k]; -} - -export template -void -__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n, - _Array<_Tp> __a, _Array __m) -{ - bool* __ok (__m._M_data); - _Tp* __p (__a._M_data); - for (size_t __i=0; __i<__n; ++__i, ++__ok, ++__p) { - while (! *__ok) { - ++__ok; - ++__p; - } - *__p = __e[__i]; - } -} - -} // extern "C++" - -#endif // __VALARRAY_ARRAY_TCC__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/valarray_meta.h b/contrib/libstdc++/std/valarray_meta.h deleted file mode 100644 index 48fb21371f..0000000000 --- a/contrib/libstdc++/std/valarray_meta.h +++ /dev/null @@ -1,1046 +0,0 @@ -// The template and inlines for the -*- C++ -*- internal _Meta class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// Written by Gabriel Dos Reis - -#ifndef _CPP_VALARRAY_META_H -#define _CPP_VALARRAY_META_H 1 - -// -// Implementing a loosened valarray return value is tricky. -// First we need to meet 26.3.1/3: we should not add more than -// two levels of template nesting. Therefore we resort to template -// template to "flatten" loosened return value types. -// At some point we use partial specialization to remove one level -// template nesting due to _Expr<> -// - - -// This class is NOT defined. It doesn't need to. -template class _Constant; - -// -// Unary function application closure. -// -template 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 class _Meta, class _Dom> class _UnFunClos; - -template -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 -struct _UnFunClos<_ValArray,_Tp> : _UnFunBase > { - typedef _UnFunBase > _Base; - typedef typename _Base::value_type value_type; - - _UnFunClos (const valarray<_Tp>& __v, _Tp __f(_Tp)) - : _Base (__v, __f) {} -}; - -// -// Binary function application closure. -// -template class _Meta1, - template class Meta2, - class _Dom1, class _Dom2> class _BinFunClos; - -template 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 _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 _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 -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 -struct _BinFunClos<_ValArray,_ValArray,_Tp,_Tp> - : _BinFunBase, valarray<_Tp> > { - typedef _BinFunBase, 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 -struct _BinFunClos<_Expr,_ValArray,_Dom,typename _Dom::value_type> - : _BinFunBase<_Dom,valarray > { - 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 -struct _BinFunClos<_ValArray,_Expr,typename _Dom::value_type,_Dom> - : _BinFunBase,_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 -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 -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 -struct _BinFunClos<_ValArray,_Constant,_Tp,_Tp> - : _BinFunBase2 > { - typedef _BinFunBase2 > _Base; - typedef _Tp value_type; - - _BinFunClos (const valarray<_Tp>& __v, const _Tp& __t, - _Tp __f(_Tp, _Tp)) - : _Base (__v, __t, __f) {} -}; - -template -struct _BinFunClos<_Constant,_ValArray,_Tp,_Tp> - : _BinFunBase1 > { - typedef _BinFunBase1 > _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 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 -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 -struct _ValFunClos<_ValArray,_Tp> - : _FunBase, _Tp> { - typedef _FunBase, _Tp> _Base; - typedef _Tp value_type; - - _ValFunClos (const valarray<_Tp>& __v, _Tp __f(_Tp)) - : _Base (__v, __f) {} -}; - -template -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 -struct _RefFunClos<_ValArray,_Tp> - : _FunBase, const _Tp&> { - typedef _FunBase, const _Tp&> _Base; - typedef _Tp value_type; - - _RefFunClos (const valarray<_Tp>& __v, _Tp __f(const _Tp&)) - : _Base (__v, __f) {} -}; - -// -// Unary expression closure. -// - -template class _Oper, typename _Arg> -class _UnBase { -public: - typedef _Oper _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 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 class _Oper, class _Dom> -struct _UnClos<_Oper, _Expr, _Dom> : _UnBase<_Oper, _Dom> { - typedef _Dom _Arg; - typedef _UnBase<_Oper, _Dom> _Base; - typedef typename _Base::value_type value_type; - - _UnClos (const _Arg& __e) : _Base(__e) {} -}; - -template class _Oper, typename _Tp> -struct _UnClos<_Oper, _ValArray, _Tp> : _UnBase<_Oper, valarray<_Tp> > { - typedef valarray<_Tp> _Arg; - typedef _UnBase<_Oper, valarray<_Tp> > _Base; - typedef typename _Base::value_type value_type; - - _UnClos (const _Arg& __e) : _Base(__e) {} -}; - - -// -// Binary expression closure. -// - -template class _Oper, typename _FirstArg, typename _SecondArg> -class _BinBase { -public: - typedef _Oper _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 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 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 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 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 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 class _Oper, class _Dom1, class _Dom2> -struct _BinClos<_Oper, _Expr, _Expr, _Dom1, _Dom2> - : _BinBase<_Oper,_Dom1,_Dom2> { - typedef _BinBase<_Oper,_Dom1,_Dom2> _Base; - typedef typename _Base::value_type value_type; - - _BinClos(const _Dom1& __e1, const _Dom2& __e2) : _Base(__e1, __e2) {} -}; - -template class _Oper, typename _Tp> -struct _BinClos<_Oper,_ValArray,_ValArray,_Tp,_Tp> - : _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> > { - typedef _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> > _Base; - typedef _Tp value_type; - - _BinClos (const valarray<_Tp>& __v, const valarray<_Tp>& __w) - : _Base (__v, __w) {} -}; - -template class _Oper, class _Dom> -struct _BinClos<_Oper,_Expr,_ValArray,_Dom,typename _Dom::value_type> - : _BinBase<_Oper,_Dom,valarray > { - typedef typename _Dom::value_type _Tp; - typedef _BinBase<_Oper,_Dom,valarray<_Tp> > _Base; - typedef typename _Base::value_type value_type; - - _BinClos(const _Dom& __e1, const valarray<_Tp>& __e2) - : _Base (__e1, __e2) {} -}; - -template class _Oper, class _Dom> -struct _BinClos<_Oper,_ValArray,_Expr,typename _Dom::value_type,_Dom> - : _BinBase<_Oper,valarray,_Dom> { - typedef typename _Dom::value_type _Tp; - typedef _BinBase<_Oper,valarray<_Tp>,_Dom> _Base; - typedef typename _Base::value_type value_type; - - _BinClos (const valarray<_Tp>& __e1, const _Dom& __e2) - : _Base (__e1, __e2) {} -}; - -template class _Oper, class _Dom> -struct _BinClos<_Oper,_Expr,_Constant,_Dom,typename _Dom::value_type> - : _BinBase2<_Oper,_Dom> { - typedef typename _Dom::value_type _Tp; - typedef _BinBase2<_Oper,_Dom> _Base; - typedef typename _Base::value_type value_type; - - _BinClos (const _Dom& __e1, const _Tp& __e2) : _Base (__e1, __e2) {} -}; - -template class _Oper, class _Dom> -struct _BinClos<_Oper,_Constant,_Expr,typename _Dom::value_type,_Dom> - : _BinBase1<_Oper,_Dom> { - typedef typename _Dom::value_type _Tp; - typedef _BinBase1<_Oper,_Dom> _Base; - typedef typename _Base::value_type value_type; - - _BinClos (const _Tp& __e1, const _Dom& __e2) : _Base (__e1, __e2) {} -}; - -template class _Oper, typename _Tp> -struct _BinClos<_Oper,_ValArray,_Constant,_Tp,_Tp> - : _BinBase2<_Oper,valarray<_Tp> > { - typedef _BinBase2<_Oper,valarray<_Tp> > _Base; - typedef typename _Base::value_type value_type; - - _BinClos (const valarray<_Tp>& __v, const _Tp& __t) - : _Base (__v, __t) {} -}; - -template class _Oper, typename _Tp> -struct _BinClos<_Oper,_Constant,_ValArray,_Tp,_Tp> - : _BinBase1<_Oper,valarray<_Tp> > { - typedef _BinBase1<_Oper,valarray<_Tp> > _Base; - typedef typename _Base::value_type value_type; - - _BinClos (const _Tp& __t, const valarray<_Tp>& __v) - : _Base (__t, __v) {} -}; - - -// -// slice_array closure. -// -template 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 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 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 -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 _GBase { -public: - typedef typename _Dom::value_type value_type; - - _GBase (const _Dom& __e, const valarray& __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& _M_index; -}; - -template class _GBase<_Array<_Tp> > { -public: - typedef _Tp value_type; - - _GBase (_Array<_Tp> __a, const valarray& __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& _M_index; -}; - -template struct _GClos<_Expr,_Dom> : _GBase<_Dom> { - typedef _GBase<_Dom> _Base; - typedef typename _Base::value_type value_type; - - _GClos (const _Dom& __e, const valarray& __i) - : _Base (__e, __i) {} -}; - -template -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& __i) - : _Base (__a, __i) {} -}; - -// -// indirect_array closure -// - -template class _IBase { -public: - typedef typename _Dom::value_type value_type; - - _IBase (const _Dom& __e, const valarray& __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& _M_index; -}; - -template struct _IClos<_Expr,_Dom> : _IBase<_Dom> { - typedef _IBase<_Dom> _Base; - typedef typename _Base::value_type value_type; - - _IClos (const _Dom& __e, const valarray& __i) - : _Base (__e, __i) {} -}; - -template -struct _IClos<_ValArray,_Tp> : _IBase > { - typedef _IBase > _Base; - typedef _Tp value_type; - - _IClos (const valarray<_Tp>& __a, const valarray& __i) - : _Base (__a, __i) {} -}; - -// -// class _Expr -// -template class _Expr { -public: - typedef _Tp value_type; - - _Expr (const _Clos&); - - const _Clos& operator() () const; - - value_type operator[] (size_t) const; - valarray operator[] (slice) const; - valarray operator[] (const gslice&) const; - valarray operator[] (const valarray&) const; - valarray operator[] (const valarray&) const; - - _Expr<_UnClos<_Unary_plus,_Expr,_Clos>, value_type> - operator+ () const; - - _Expr<_UnClos, value_type> - operator- () const; - - _Expr<_UnClos<_Bitwise_not,_Expr,_Clos>, value_type> - operator~ () const; - - _Expr<_UnClos, bool> - operator! () const; - - size_t size () const; - value_type sum () const; - - valarray shift (int) const; - valarray 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 -inline -_Expr<_Clos,_Tp>::_Expr (const _Clos& __c) : _M_closure(__c) {} - -template -inline const _Clos& -_Expr<_Clos,_Tp>::operator() () const -{ return _M_closure; } - -template -inline _Tp -_Expr<_Clos,_Tp>::operator[] (size_t __i) const -{ return _M_closure[__i]; } - -template -inline valarray<_Tp> -_Expr<_Clos,_Tp>::operator[] (slice __s) const -{ return _M_closure[__s]; } - -template -inline valarray<_Tp> -_Expr<_Clos,_Tp>::operator[] (const gslice& __gs) const -{ return _M_closure[__gs]; } - -template -inline valarray<_Tp> -_Expr<_Clos,_Tp>::operator[] (const valarray& __m) const -{ return _M_closure[__m]; } - -template -inline valarray<_Tp> -_Expr<_Clos,_Tp>::operator[] (const valarray& __i) const -{ return _M_closure[__i]; } - -template -inline size_t -_Expr<_Clos,_Tp>::size () const { return _M_closure.size (); } - -// XXX: replace this with a more robust summation algorithm. -template -inline _Tp -_Expr<_Clos,_Tp>::sum () const -{ - _Tp __s(_Tp()); - size_t __n (_M_closure.size ()); - for (size_t __i=0; __i<__n; ++__i) __s += _M_closure[__i]; - return __s; -} - -template -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 -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 -inline _Expr<_UnClos, bool> -_Expr<_Dom,_Tp>::operator! () const -{ - typedef _UnClos _Closure; - return _Expr<_Closure,_Tp> (_Closure(this->_M_closure)); -} - -#define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name) \ -template \ -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 \ -inline _Expr<_BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2>, \ - typename _Name::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 \ -inline _Expr<_BinClos<_Name,_Expr,_Constant,_Dom,typename _Dom::value_type>, \ - typename _Name::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 \ -inline _Expr<_BinClos<_Name,_Constant,_Expr,typename _Dom::value_type,_Dom>, \ - typename _Name::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 \ -inline _Expr<_BinClos<_Name,_Expr,_ValArray,_Dom,typename _Dom::value_type>, \ - typename _Name::result_type> \ -operator##_Op (const _Expr<_Dom,typename _Dom::value_type>& __e, \ - const valarray& __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 \ -inline _Expr<_BinClos<_Name,_ValArray,_Expr,typename _Dom::value_type,_Dom>, \ - typename _Name::result_type> \ -operator##_Op (const valarray& __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 \ -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 \ -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 \ -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 \ -inline _Expr<_BinClos<_Name,_Expr,_ValArray,_Dom,typename _Dom::value_type>, \ - bool> \ -operator##_Op (const _Expr<_Dom,typename _Dom::value_type>& __e, \ - const valarray& __v) \ -{ \ - typedef typename _Dom::value_type _Tp; \ - typedef _BinClos<_Name,_Expr,_ValArray,_Dom,_Tp> _Closure; \ - return _Expr<_Closure,bool> (_Closure (__e (), __v)); \ -} \ - \ -template \ -inline _Expr<_BinClos<_Name,_ValArray,_Expr,typename _Dom::value_type,_Dom>, \ - bool> \ -operator##_Op (const valarray& __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 \ -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 \ -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 \ -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 \ -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& __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 \ -inline _Expr<_BinFunClos<_ValArray,_Expr,typename _Dom::value_type,_Dom>, \ - typename _Dom::value_type> \ -_Name (const 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 \ -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 \ -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 \ -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 \ -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 \ -inline _Expr<_BinFunClos<_Constant,_ValArray,_Tp,_Tp>,_Tp> \ -_Name (const _Tp& __t, const valarray<_Tp>& __v) \ -{ \ - typedef _BinFunClos<_Constant,_ValArray,_Tp,_Tp> _Closure; \ - return _Expr<_Closure,_Tp> \ - (_Closure (__t, __v, (_Tp(*)(_Tp,_Tp))(&_Name))); \ -} - -_DEFINE_EXPR_BINARY_FUNCTION(atan2) -_DEFINE_EXPR_BINARY_FUNCTION(pow) - -#undef _DEFINE_EXPR_BINARY_FUNCTION - -#endif // _CPP_VALARRAY_META_H - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/stdexcept b/contrib/libstdc++/stdexcept deleted file mode 100644 index 69e9627d57..0000000000 --- a/contrib/libstdc++/stdexcept +++ /dev/null @@ -1,97 +0,0 @@ -// Methods for Exception Support for -*- C++ -*- -// Copyright (C) 1994, 1995, 1997 Free Software Foundation - -// This file is part of the GNU ANSI C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files -// compiled with a GNU compiler to produce an executable, this does not cause -// the resulting executable to be covered by the GNU General Public License. -// This exception does not however invalidate any other reasons why -// the executable file might be covered by the GNU General Public License. - -// Written by Mike Stump based upon the specification in the 20 September 1994 -// C++ working paper, ANSI document X3J16/94-0158. - -#ifndef __STDEXCEPT__ -#define __STDEXCEPT__ - -#ifdef __GNUG__ -#pragma interface "stdexcept" -#endif - -#include -#include - -extern "C++" { - -namespace std { - -class logic_error : public exception { - string _what; -public: - logic_error(const string& what_arg): _what (what_arg) { } - virtual const char* what () const { return _what.c_str (); } -}; - -class domain_error : public logic_error { -public: - domain_error (const string& what_arg): logic_error (what_arg) { } -}; - -class invalid_argument : public logic_error { -public: - invalid_argument (const string& what_arg): logic_error (what_arg) { } -}; - -class length_error : public logic_error { -public: - length_error (const string& what_arg): logic_error (what_arg) { } -}; - -class out_of_range : public logic_error { -public: - out_of_range (const string& what_arg): logic_error (what_arg) { } -}; - -class runtime_error : public exception { - string _what; -public: - runtime_error(const string& what_arg): _what (what_arg) { } - virtual const char* what () const { return _what.c_str (); } -protected: - runtime_error(): exception () { } -}; - -class range_error : public runtime_error { -public: - range_error (const string& what_arg): runtime_error (what_arg) { } -}; - -class overflow_error : public runtime_error { -public: - overflow_error (const string& what_arg): runtime_error (what_arg) { } -}; - -class underflow_error : public runtime_error { -public: - underflow_error (const string& what_arg): runtime_error (what_arg) { } -}; - -} // namespace std - -} // extern "C++" - -#endif diff --git a/contrib/libstdc++/stdexcepti.cc b/contrib/libstdc++/stdexcepti.cc deleted file mode 100644 index 9c02c71f49..0000000000 --- a/contrib/libstdc++/stdexcepti.cc +++ /dev/null @@ -1,21 +0,0 @@ -// Implementation file for Exception Support for -*- C++ -*- -// This file is part of the GNU ANSI C++ Library. - -#ifdef __GNUG__ -#pragma implementation "stdexcept" -#endif - -#include - -// Entry points for string. - -void -__out_of_range (const char *s) -{ - throw std::out_of_range (s); -} - -void __length_error (const char *s) -{ - throw std::length_error (s); -} diff --git a/contrib/libstdc++/stl.h b/contrib/libstdc++/stl.h deleted file mode 100644 index 4b270742c9..0000000000 --- a/contrib/libstdc++/stl.h +++ /dev/null @@ -1,15 +0,0 @@ -// -*- C++ -*- compatibility header. -// This file is part of the GNU ANSI C++ Library. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include diff --git a/contrib/libstdc++/stl/ChangeLog b/contrib/libstdc++/stl/ChangeLog deleted file mode 100644 index 14d56ac3e6..0000000000 --- a/contrib/libstdc++/stl/ChangeLog +++ /dev/null @@ -1,381 +0,0 @@ -Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com) - - * gcc-2.95.3 Released. - -1999-11-06 Martin v. Löwis - - * bitset (class bitset): Declare reference as our friend. - * bitset: Include limits.h. - -Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.2 Released. - -Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.1 Released. - -Sun Aug 8 21:06:16 1999 Alexandre Oliva - - * pthread_alloc: Solaris' ctype.h defines _U to 01; use _Up as - template parameter instead. - -Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -1999-07-11 Martin v. Löwis (loewis@informatik.hu-berlin.de) - - * stl_function.h (bind1st, bind2nd): Rename __opr to __oper, - as __opr is used internally by egcs. - * stl_numeric.h (__power, power): Likewise. - -1999-06-18 Martin von Löwis - - * stl_queue.h: Rename _M_c to c, and _M_comp to comp. - -1999-06-17 Alexandre Oliva - - * stl_algo.h (transform): Rename __opr to __oper, as __opr is used - internally by egcs. - Reported by Harri Porten - -1999-05-17 Mark Kettenis - - * stl_config.h: Only define __STL_PTHREADS with GLIBC >= 2 for - Linux. - -Mon May 17 03:33:47 1999 Mumit Khan - - * stl_config.h (__CYGWIN__): Cygwin newlib RTL lacks drand48. - -1999-05-07 Ulrich Drepper - - * stl_alloc.h: Make it possible to compile with __USE_MALLOC. - -Tue Apr 13 00:32:57 1999 Mumit Khan - - * stl_config.h (__MINGW32__): Mingw32 RTL lacks drand48. - -Sun Apr 11 23:48:30 1999 Jeffrey A Law (law@cygnus.com) - - * bitset: Re-install Alexandre's lost patch from 1998-11-27. - -1999-01-20 Ulrich Drepper - - * stl_construct.h (__destroy_aux): Use != instead of < for - ForwardIterator comparison. - Patch by jmaurer@menuett.rhein-main.de (Jens Maurer). - -1999-01-20 Mark Mitchell - - * stl_config.h (__STL_USE_NAMESPACES): Define. - -1998-11-27 Alexandre Oliva - - * bitset: Explicitly convert basic_string<...>::npos to size_t in - default argument to constructor, to avoid parse error at `>'. - (__STL_EXPLICIT_FUNCTION_TMPL_ARGS): Replace #if with #ifdef. - -1998-11-01 Mark Mitchell - - * stl_alloc.h (default_alloc_template::_S_free_list): Don't - qualify _NFREELISTS. - -1998-10-11 Mark Mitchell - - * stl_config.h (__SGI_STL_USE_AUTO_PTR_CONVERSIONS): Define. - * memory (auto_ptr::operator auto_ptr_ref<_Tp1>): Fix typo. - (auto_ptr::operator auto_ptr<_Tp1>): Add missing - semicolon. - -1998-09-03 Jason Merrill - - * stl_config.h: Define __STL_HAS_WCHAR_T, - __STL_MEMBER_TEMPLATE_CLASSES, __STL_HAS_NAMESPACES, - __STL_NO_NAMESPACES and __STL_LONG_LONG. - -1998-09-02 Jason Merrill - - * algorithm alloc.h defalloc.h hash_map.h hash_set.h iterator - memory pthread_alloc pthread_alloc.h rope ropeimpl.h stl_algo.h - stl_algobase.h stl_alloc.h stl_bvector.h stl_config.h - stl_construct.h stl_deque.h stl_function.h stl_hash_fun.h - stl_hash_map.h stl_hash_set.h stl_hashtable.h stl_heap.h - stl_iterator.h stl_list.h stl_map.h stl_multimap.h stl_multiset.h - stl_numeric.h stl_pair.h stl_queue.h stl_raw_storage_iter.h - stl_relops.h stl_rope.h stl_set.h stl_slist.h stl_stack.h - stl_tempbuf.h stl_tree.h stl_uninitialized.h stl_vector.h - tempbuf.h type_traits.h: Update to SGI STL 3.11. - -Fri Jul 10 15:20:09 1998 Klaus-Georg Adams - - * stl_tempbuf.h (temporary_buffer): Add missing typename. - * type_traits.h: update comments. - -Sun Jun 28 00:49:42 1998 Jeffrey A Law (law@cygnus.com) - - * stl_config.h (__STL_PTHREADS): Don't define for glibc 2 if - _G_USING_THUNKS is not defined. - -1998-04-07 18:32 Ulrich Drepper - - * stl_hashtable.h (__stl_prime_list): Mark last two numbers as - unsigned long since they are otherwise too large for long int on - 32bit machines. - -Fri Feb 20 16:15:05 1998 H.J. Lu (hjl@gnu.org) - Jason Merrill - - * ropeimpl.h: Check __STL_PTHREADS instead of _PTHREADS. - * stl_alloc.h: Ditto. - * stl_config.h: Ditto. - * stl_rope.h: Ditto. - - * stl_config.h: include <_G_config.h> if __GNUG__ is defined. - (__STL_PTHREADS): Defined if _PTHREADS is defined or - __GLIBC__ >= 2. - -Tue Jan 27 12:01:25 1998 Jason Merrill - - * stl_algo.h (__lg): Fix for n == 0. - -Sat Nov 8 00:45:17 1997 Jason Merrill - - * stl_hash_set.h (swap): Fix typo. - -Fri Nov 7 10:27:40 1997 Jason Merrill - - * stl_hashtable.h: Fix typo. - -Thu Nov 6 11:19:09 1997 Jason Merrill - - * stl_algo.h, stl_algobase.h, stl_bvector.h, - stl_deque.h: Update to October 28 SGI release. - -Sun Nov 2 12:14:56 1997 Jason Merrill - - * algo.h, algobase.h, alloc.h, bvector.h, defalloc.h, deque.h, - function.h, hash_map.h, hash_set.h, hashtable.h, heap.h, iterator.h, - list.h, map.h, multimap.h, multiset.h, pair.h, pthread_alloc.h, - rope.h, ropeimpl.h, set.h, slist.h, stack.h, stl_config.h, tempbuf.h, - tree.h, type_traits.h, vector.h: Update to October 27 SGI snapshot. - * algorithm, deque, functional, hash_map, hash_set, iterator, list, - map, memory, numeric, pthread_alloc, queue, rope, set, slist, stack, - stl_algo.h, stl_algobase.h, stl_alloc.h, stl_bvector.h, - stl_construct.h, stl_deque.h, stl_function.h, stl_hash_fun.h, - stl_hash_map.h, stl_hash_set.h, stl_hashtable.h, stl_heap.h, - stl_iterator.h, stl_list.h, stl_map.h, stl_multimap.h, stl_multiset.h, - stl_numeric.h, stl_pair.h, stl_queue.h, stl_raw_storage_iter.h, - stl_relops.h, stl_rope.h, stl_set.h, stl_slist.h, stl_stack.h, - stl_tempbuf.h, stl_tree.h, stl_uninitialized.h, stl_vector.h, - utility, vector: New files in October 27 SGI snapshot. - -Fri Oct 17 19:07:42 1997 Jason Merrill - - * tree.h, vector.h: Fix accidental divergence from SGI release. - -Tue Sep 9 19:47:28 1997 Jason Merrill - - * algo.h, algobase.h, alloc.h, bvector.h, deque.h, hashtable.h, - iterator.h, list.h, rope.h, ropeimpl.h, slist.h, stl_config.h, - tree.h, vector.h: Update To September 8 SGI release. - -Tue Sep 9 17:38:47 1997 Mark Mitchell - - * stl_config.h (__STL_MEMBER_TEMPLATES): Enable. - -Tue Aug 5 17:06:01 1997 Jason Merrill - - * deque.h, function.h, hashtable.h, list.h, rope.h, ropeimpl.h, - tree.h: Update to July 31 SGI release. - -Fri Jul 18 10:06:56 1997 Jason Merrill - - * algo.h, defalloc.h, hashtable.h, rope.h, ropeimpl.h, slist.h: - Update to June 30 SGI release. - -Fri Jul 04 02:17:15 1997 Ulrich Drepper - - * tree.h (rb_tree): Reverse order of member initializations - to prevent warnings. - -Sun Jun 15 18:17:21 1997 Jason Merrill - - * *.h: Update to 6/13 SGI release. - -Fri May 23 10:56:18 1997 Jason Merrill - - * stl_config.h: Add support for exceptions with g++. - - * *.h: Update to 5/8 SGI release. - -Thu Apr 24 19:00:23 1997 Jason Merrill - - * *.h: Update to 3/24 SGI release. - -Wed Feb 19 18:19:18 1997 Jason Merrill - - * *.h: Update to 2/18 SGI release. - - * bool.h: Lose. - -Mon Feb 10 16:33:23 1997 Jason Merrill - - * alloc.h: Don't define __USE_MALLOC for g++. - * bool.h: Lose g++ case. - - * *.h: Update to 2/4 SGI release. - -Mon Jan 13 14:39:16 1997 Jason Merrill - - * *.h: Update to 1/8 SGI release. - -Mon Sep 30 17:56:43 1996 Jason Merrill - - * alloc.h (__unlock): Never use __lock_release. - -Fri Sep 27 19:03:06 1996 Jason Merrill - - * alloc.h (__default_alloc_template): lock is a friend. - -Thu Sep 19 20:10:37 1996 Jason Merrill - - Propagate these changes to new STL code: - * tree.h: Rearrange member initializers in rb_tree constructors. - * vector.h (insert): Cast iterator difference to size_type to - avoid warning. - - * *.h: Update to SGI snapshot (fixed). - * *.c, Makefile.in, configure.in: Removed. - -Sat Sep 14 09:43:06 1996 Jason Merrill - - * deque.h, list.h, tree.h: Remove kludge obsoleted by new - overloading code. - -Sat Aug 10 14:59:50 1996 Jason Merrill - - * tempbuf.cc (__stl_temp_buffer): Align like a pointer. - -Wed Jun 26 13:00:44 1996 Jason Merrill - - * iterator.h: Add default template parameters. - -Wed Apr 24 10:45:22 1996 Doug Evans - - * Makefile.in (tempbuf.o,random.o): Add rules for SunOS VPATH. - -Fri Apr 5 17:52:31 1996 Per Bothner - - * configure.in (EXTRA_MOSTLYCLEAN): New, to remove stl.list. - -Fri Mar 22 14:58:30 1996 Jason Merrill - - Propagate these changes to new STL code: - * tree.h: Rearrange member initializers in rb_tree constructors. - * vector.h (insert): Cast iterator difference to size_type to - avoid warning. - -Sun Mar 10 07:49:03 1996 Jason Merrill - - * deque.h (distance_type): Add overload for g++. - From Joe Buck. - -Thu Feb 22 14:07:12 1996 Jason Merrill - - * bool.h: Revert. - * algo.h bvector.h deque.h function.h iterator.h list.h - pair.h stack.h tree.h vector.h: Wrap #include with - #ifndef __GNUG__. - * defalloc.h list.h deque.h tree.h: Use __GNUG__ to control - workarounds. - -Wed Feb 21 17:13:02 1996 Jason Merrill - - * bool.h (TRUE, FALSE): Define for people expecting the bool.h - from libg++. Is this a good idea? - -Tue Feb 20 18:40:02 1996 Jason Merrill - - * algo.h bool.h bvector.h defalloc.h deque.h function.h heap.h - iterator.h list.h map.h pair.h random.cc stack.h tree.c tree.h - vector.h: Revert to HP release with workarounds for missing - overloading functionality. - * Makefile.in (STL_OBJECTS): Remove tree.o. - -Thu Nov 9 17:05:23 1995 Jason Merrill - - * algo.h algobase.h bvector.h defalloc.h deque.h function.h heap.h - iterator.h list.h map.h multimap.h multiset.h pair.h projectn.h - set.h stack.h tempbuf.h tree.h vector.h: Wrap #include - with #ifndef __GNUG__. - -Thu Nov 2 17:05:44 1995 Jason Merrill - - * deque.h (deque::insert): Fix merge typo. - * vector.h (value_type): Lose. - -Thu Nov 2 14:33:47 1995 Per Bothner - - * algo.h, algobase.h, deque.h, function.h, list.h, pair.h, random.cc: - Merge in Oct 31 1995 release from HP. - -Fri Aug 11 17:11:12 1995 Per Bothner - - * list.h: Avoid duplicate construction and destruction of list_nodes. - Patch from Klamer Schutte . - -Fri Aug 11 16:45:18 1995 Per Bothner - - * algo.h, algobase.h, deque.h: Merged in Jul 12 1995 release from HP. - -Mon Jun 5 18:38:56 1995 Jason Merrill - - * Makefile.in (stl.list): Depend on stamp-picdir. - -Wed May 17 02:30:47 1995 Jason Merrill - - * tree.h: Rearrange member initializers in rb_tree constructors. - - * Update to HP's February 7, 1995 release. - -Fri May 5 10:45:31 1995 Mike Stump - - * random.cc (seed): Move `for' decl out of `for' statement. - -Wed Apr 26 13:09:16 1995 Jason Merrill - - * configure.in (XCXXINCLUDES): Rename. - -Wed Mar 29 19:24:56 1995 Jason Merrill - - * tree.h (insert): Return a value. - - * vector.h (insert): Cast iterator difference to size_type to - avoid warning. - -Sun Feb 12 09:12:17 1995 Mike Stump - - * tree.h (rb_tree::max_size): Add definition when using GNU - workaround. - -Thu Jan 12 01:37:42 1995 deanm@medulla.LABS.TEK.COM (Dean Messing) - - * configure.in (LIBDIR): Set to yes. - -Fri Dec 30 18:26:20 1994 Mike Stump - - * iterator.h: Add default template parameters where possible. - -Fri Dec 30 16:29:39 1994 Mike Stump - - * algo.h: Change rand to __rand to fix make check on linux systems. - -Tue Nov 29 15:30:30 1994 Per Bothner - - * Initial check-in, based on HP's October 21, 1994. diff --git a/contrib/libstdc++/stl/README b/contrib/libstdc++/stl/README deleted file mode 100644 index c319c08c7a..0000000000 --- a/contrib/libstdc++/stl/README +++ /dev/null @@ -1,13 +0,0 @@ -This directory contains an SGI release of the C++ Standard Template -Library, slightly modified to work with g++. - -Note that this is based on a pre-Draft Standard for C++. -Things are likely to change. For example, the header file names -are very likely to change. The Allocator interface will change. Etc, etc. -CYGNUS MAKES NO COMMITTMENT (yet) TO SUPPORT BACKWARD COMPATIBILITY FOR STL. - -For examples of things that should work, look in the ../tests directory. - -DOCUMENTATION: -See http://www.sgi.com/Technology/STL/ or http://www.dinkumware.com/ -on the World-Wide Web. diff --git a/contrib/libstdc++/stl/algo.h b/contrib/libstdc++/stl/algo.h deleted file mode 100644 index 1707868c7c..0000000000 --- a/contrib/libstdc++/stl/algo.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_ALGO_H -#define __SGI_STL_ALGO_H - -#include -#include -#include -#include - -#ifdef __STL_USE_NAMESPACES - -// Names from -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 -using __STD::accumulate; -using __STD::inner_product; -using __STD::partial_sum; -using __STD::adjacent_difference; -using __STD::power; -using __STD::iota; - -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_ALGO_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/algobase.h b/contrib/libstdc++/stl/algobase.h deleted file mode 100644 index f35e7af4a9..0000000000 --- a/contrib/libstdc++/stl/algobase.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_ALGOBASE_H -#define __SGI_STL_ALGOBASE_H - -#ifndef __SGI_STL_PAIR_H -#include -#endif -#ifndef __SGI_STL_ITERATOR_H -#include -#endif -#ifndef __SGI_STL_INTERNAL_ALGOBASE_H -#include -#endif -#ifndef __SGI_STL_INTERNAL_UNINITIALIZED_H -#include -#endif - -#ifdef __STL_USE_NAMESPACES - -// Names from stl_algobase.h -using __STD::iter_swap; -using __STD::swap; -using __STD::min; -using __STD::max; -using __STD::copy; -using __STD::copy_backward; -using __STD::copy_n; -using __STD::fill; -using __STD::fill_n; -using __STD::mismatch; -using __STD::equal; -using __STD::lexicographical_compare; -using __STD::lexicographical_compare_3way; - -// Names from stl_uninitialized.h -using __STD::uninitialized_copy; -using __STD::uninitialized_copy_n; -using __STD::uninitialized_fill; -using __STD::uninitialized_fill_n; - -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_ALGOBASE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/algorithm b/contrib/libstdc++/stl/algorithm deleted file mode 100644 index 1ba584f06d..0000000000 --- a/contrib/libstdc++/stl/algorithm +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_ALGORITHM -#define __SGI_STL_ALGORITHM - -#include -#include -#include -#include -#include - -#endif /* __SGI_STL_ALGORITHM */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/alloc.h b/contrib/libstdc++/stl/alloc.h deleted file mode 100644 index f99a862316..0000000000 --- a/contrib/libstdc++/stl/alloc.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1996-1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_ALLOC_H -#define __SGI_STL_ALLOC_H - -#ifndef __STL_CONFIG_H -#include -#endif -#ifndef __SGI_STL_INTERNAL_ALLOC_H -#include -#endif - -#ifdef __STL_USE_NAMESPACES - -using __STD::__malloc_alloc_template; -using __STD::malloc_alloc; -using __STD::simple_alloc; -using __STD::debug_alloc; -using __STD::__default_alloc_template; -using __STD::alloc; -using __STD::single_client_alloc; -#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG -using __STD::__malloc_alloc_oom_handler; -#endif /* __STL_STATIC_TEMPLATE_MEMBER_BUG */ -#ifdef __STL_USE_STD_ALLOCATORS -using __STD::allocator; -#endif /* __STL_USE_STD_ALLOCATORS */ - -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_ALLOC_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/bitset b/contrib/libstdc++/stl/bitset deleted file mode 100644 index 8b4f8b1a0f..0000000000 --- a/contrib/libstdc++/stl/bitset +++ /dev/null @@ -1,1066 +0,0 @@ -/* - * Copyright (c) 1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_BITSET -#define __SGI_STL_BITSET - -// This implementation of bitset<> has a second template parameter, -// _WordT, which defaults to unsigned long. *YOU SHOULD NOT USE -// THIS FEATURE*. It is experimental, and it may be removed in -// future releases. - -// A bitset of size N, using words of type _WordT, will have -// N % (sizeof(_WordT) * CHAR_BIT) unused bits. (They are the high- -// order bits in the highest word.) It is a class invariant -// of class bitset<> that those unused bits are always zero. - -// Most of the actual code isn't contained in bitset<> itself, but in the -// base class _Base_bitset. The base class works with whole words, not with -// individual bits. This allows us to specialize _Base_bitset for the -// important special case where the bitset is only a single word. - -// The C++ standard does not define the precise semantics of operator[]. -// In this implementation the const version of operator[] is equivalent -// to test(), except that it does no range checking. The non-const version -// returns a reference to a bit, again without doing any range checking. - - -#include // for size_t -#include // for CHAR_BIT -#include -#include // for invalid_argument, out_of_range, overflow_error -#include // for istream, ostream - -#define __BITS_PER_WORDT(__wt) (CHAR_BIT*sizeof(__wt)) -#define __BITSET_WORDS(__n,__wt) \ - ((__n) < 1 ? 1 : ((__n) + __BITS_PER_WORDT(__wt) - 1)/__BITS_PER_WORDT(__wt)) - -__STL_BEGIN_NAMESPACE - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1209 -#endif - -// structure to aid in counting bits -template -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 -struct _First_one { - static unsigned char _S_first_one[256]; -}; - -// -// Base class: general case. -// - -template -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::_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 -_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 -void _Base_bitset<_Nw, _WordT>::_M_do_left_shift(size_t __shift) -{ - if (__shift != 0) { - const size_t __wshift = __shift / __BITS_PER_WORDT(_WordT); - const size_t __offset = __shift % __BITS_PER_WORDT(_WordT); - const size_t __sub_offset = __BITS_PER_WORDT(_WordT) - __offset; - size_t __n = _Nw - 1; - for ( ; __n > __wshift; --__n) - _M_w[__n] = (_M_w[__n - __wshift] << __offset) | - (_M_w[__n - __wshift - 1] >> __sub_offset); - if (__n == __wshift) - _M_w[__n] = _M_w[0] << __offset; - for (size_t __n1 = 0; __n1 < __n; ++__n1) - _M_w[__n1] = static_cast<_WordT>(0); - } -} - -template -void _Base_bitset<_Nw, _WordT>::_M_do_right_shift(size_t __shift) -{ - if (__shift != 0) { - const size_t __wshift = __shift / __BITS_PER_WORDT(_WordT); - const size_t __offset = __shift % __BITS_PER_WORDT(_WordT); - const size_t __sub_offset = __BITS_PER_WORDT(_WordT) - __offset; - const size_t __limit = _Nw - __wshift - 1; - size_t __n = 0; - for ( ; __n < __limit; ++__n) - _M_w[__n] = (_M_w[__n + __wshift] >> __offset) | - (_M_w[__n + __wshift + 1] << __sub_offset); - _M_w[__limit] = _M_w[_Nw-1] >> __offset; - for (size_t __n1 = __limit + 1; __n1 < _Nw; ++__n1) - _M_w[__n1] = static_cast<_WordT>(0); - } -} - -template -unsigned long _Base_bitset<_Nw, _WordT>::_M_do_to_ulong() const -{ - const overflow_error __overflow("bitset"); - - if (sizeof(_WordT) >= sizeof(unsigned long)) { - for (size_t __i = 1; __i < _Nw; ++__i) - if (_M_w[__i]) - __STL_THROW(__overflow); - - const _WordT __mask = static_cast<_WordT>(static_cast(-1)); - if (_M_w[0] & ~__mask) - __STL_THROW(__overflow); - - return static_cast(_M_w[0] & __mask); - } - else { // sizeof(_WordT) < sizeof(unsigned long). - const size_t __nwords = - (sizeof(unsigned long) + sizeof(_WordT) - 1) / sizeof(_WordT); - - size_t __min_nwords = __nwords; - if (_Nw > __nwords) { - for (size_t __i = __nwords; __i < _Nw; ++__i) - if (_M_w[__i]) - __STL_THROW(__overflow); - } - else - __min_nwords = _Nw; - - // If unsigned long is 8 bytes and _WordT is 6 bytes, then an unsigned - // long consists of all of one word plus 2 bytes from another word. - const size_t __part = sizeof(unsigned long) % sizeof(_WordT); - - if (__part != 0 && __nwords <= _Nw && - (_M_w[__min_nwords - 1] >> ((sizeof(_WordT) - __part) * CHAR_BIT)) != 0) - __STL_THROW(__overflow); - - unsigned long __result = 0; - for (size_t __i = 0; __i < __min_nwords; ++__i) { - __result |= static_cast( - _M_w[__i]) << (__i * sizeof(_WordT) * CHAR_BIT); - } - return __result; - } -} // End _M_do_to_ulong - -template -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(__thisword & (~(unsigned char)0)); - if ( __this_byte ) - return __i*__BITS_PER_WORDT(_WordT) + __j*CHAR_BIT + - _First_one::_S_first_one[__this_byte]; - - __thisword >>= CHAR_BIT; - } - } - } - // not found, so return an indication of failure. - return __not_found; -} - -template -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(__thisword & (~(unsigned char)0)); - if ( __this_byte ) - return __i*__BITS_PER_WORDT(_WordT) + __j*CHAR_BIT + - _First_one::_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(__thisword & (~(unsigned char)0)); - if ( __this_byte ) - return __i*__BITS_PER_WORDT(_WordT) + __j*CHAR_BIT + - _First_one::_S_first_one[__this_byte]; - - __thisword >>= CHAR_BIT; - } - } - } - - // not found, so return an indication of failure. - return __not_found; -} // end _M_do_find_next - - -// ------------------------------------------------------------ - -// -// Base class: specialization for a single word. -// - -template -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::_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(_M_w); - else { - const _WordT __mask = static_cast<_WordT>(static_cast(-1)); - if (_M_w & ~__mask) - __STL_THROW(overflow_error("bitset")); - return static_cast(_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 -_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 -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(__thisword & (~(unsigned char)0)); - if ( __this_byte ) - return __j*CHAR_BIT + _First_one::_S_first_one[__this_byte]; - - __thisword >>= CHAR_BIT; - } - } - // not found, so return a value that indicates failure. - return __not_found; -} - -template -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(__thisword & (~(unsigned char)0)); - if ( __this_byte ) - return __j*CHAR_BIT + _First_one::_S_first_one[__this_byte]; - - __thisword >>= CHAR_BIT; - } - } - - // not found, so return a value that indicates failure. - return __not_found; -} // end _M_do_find_next - -// -// One last specialization: _M_do_to_ulong() and the constructor from -// unsigned long are very simple if the bitset consists of a single -// word of type unsigned long. -// - -template<> -inline unsigned long -_Base_bitset<1, unsigned long>::_M_do_to_ulong() const { return _M_w; } - -template<> -inline _Base_bitset<1, unsigned long>::_Base_bitset(unsigned long __val) { - _M_w = __val; -} - - -// ------------------------------------------------------------ -// Helper class to zero out the unused high-order bits in the highest word. - -template struct _Sanitize { - static void _M_do_sanitize(_WordT& __val) - { __val &= ~((~static_cast<_WordT>(0)) << _Extrabits); } -}; - -template struct _Sanitize<_WordT, 0> { - static void _M_do_sanitize(_WordT) {} -}; - -// ------------------------------------------------------------ -// Class bitset. -// _Nb may be any nonzero number of type size_t. -// Type _WordT may be any unsigned integral type. - -template -class bitset : private _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT> -{ -private: - typedef _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT> _Base; - - // Import base's protected interface. Necessary because of new template - // name resolution rules. - using _Base::_S_whichword; - using _Base::_S_whichbyte; - using _Base::_S_whichbit; - using _Base::_S_maskbit; - using _Base::_M_getword; - using _Base::_M_hiword; - using _Base::_M_do_and; - using _Base::_M_do_or; - using _Base::_M_do_xor; - using _Base::_M_do_left_shift; - using _Base::_M_do_right_shift; - using _Base::_M_do_flip; - using _Base::_M_do_set; - using _Base::_M_do_reset; - using _Base::_M_is_equal; - using _Base::_M_is_any; - using _Base::_M_do_count; - using _Base::_M_do_to_ulong; - using _Base::_M_do_find_first; - using _Base::_M_do_find_next; - -private: - void _M_do_sanitize() { - _Sanitize<_WordT,_Nb%__BITS_PER_WORDT(_WordT) > - ::_M_do_sanitize(_M_hiword()); - } - -public: - - // bit reference: - class reference; - friend class reference; - class reference { - friend class bitset; - - _WordT *_M_wp; - size_t _M_bpos; - - // left undefined - reference(); - - reference( bitset& __b, size_t __pos ) { - _M_wp = &__b._M_getword(__pos); - _M_bpos = _S_whichbit(__pos); - } - - public: - ~reference() {} - - // for b[i] = __x; - reference& operator=(bool __x) { - if ( __x ) - *_M_wp |= _S_maskbit(_M_bpos); - else - *_M_wp &= ~_S_maskbit(_M_bpos); - - return *this; - } - - // for b[i] = b[__j]; - reference& operator=(const reference& __j) { - if ( (*(__j._M_wp) & _S_maskbit(__j._M_bpos)) ) - *_M_wp |= _S_maskbit(_M_bpos); - else - *_M_wp &= ~_S_maskbit(_M_bpos); - - return *this; - } - - // flips the bit - bool operator~() const { return (*(_M_wp) & _S_maskbit(_M_bpos)) == 0; } - - // for __x = b[i]; - operator bool() const { return (*(_M_wp) & _S_maskbit(_M_bpos)) != 0; } - - // for b[i].flip(); - reference& flip() { - *_M_wp ^= _S_maskbit(_M_bpos); - return *this; - } - }; - - // 23.3.5.1 constructors: - bitset() {} - bitset(unsigned long __val) : - _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT>(__val) {} - - template - explicit bitset(const basic_string<_CharT,_Traits,_Alloc>& __s, - size_t __pos = 0, - size_t __n = size_t(basic_string<_CharT,_Traits,_Alloc>::npos)) - : _Base() - { - if (__pos > __s.size()) - __STL_THROW(out_of_range("bitset")); - _M_copy_from_string(__s, __pos, __n); - } - - // 23.3.5.2 bitset operations: - bitset<_Nb,_WordT>& operator&=(const bitset<_Nb,_WordT>& __rhs) { - _M_do_and(__rhs); - return *this; - } - - bitset<_Nb,_WordT>& operator|=(const bitset<_Nb,_WordT>& __rhs) { - _M_do_or(__rhs); - return *this; - } - - bitset<_Nb,_WordT>& operator^=(const bitset<_Nb,_WordT>& __rhs) { - _M_do_xor(__rhs); - return *this; - } - - bitset<_Nb,_WordT>& operator<<=(size_t __pos) { - _M_do_left_shift(__pos); - _M_do_sanitize(); - return *this; - } - - bitset<_Nb,_WordT>& operator>>=(size_t __pos) { - _M_do_right_shift(__pos); - _M_do_sanitize(); - return *this; - } - - // - // Extension: - // Versions of single-bit set, reset, flip, test with no range checking. - // - - bitset<_Nb,_WordT>& _Unchecked_set(size_t __pos) { - _M_getword(__pos) |= _S_maskbit(__pos); - return *this; - } - - bitset<_Nb,_WordT>& _Unchecked_set(size_t __pos, int __val) { - if (__val) - _M_getword(__pos) |= _S_maskbit(__pos); - else - _M_getword(__pos) &= ~_S_maskbit(__pos); - - return *this; - } - - bitset<_Nb,_WordT>& _Unchecked_reset(size_t __pos) { - _M_getword(__pos) &= ~_S_maskbit(__pos); - return *this; - } - - bitset<_Nb,_WordT>& _Unchecked_flip(size_t __pos) { - _M_getword(__pos) ^= _S_maskbit(__pos); - return *this; - } - - bool _Unchecked_test(size_t __pos) const { - return (_M_getword(__pos) & _S_maskbit(__pos)) != static_cast<_WordT>(0); - } - - // Set, reset, and flip. - - bitset<_Nb,_WordT>& set() { - _M_do_set(); - _M_do_sanitize(); - return *this; - } - - bitset<_Nb,_WordT>& set(size_t __pos) { - if (__pos >= _Nb) - __STL_THROW(out_of_range("bitset")); - - return _Unchecked_set(__pos); - } - - bitset<_Nb,_WordT>& set(size_t __pos, int __val) { - if (__pos >= _Nb) - __STL_THROW(out_of_range("bitset")); - - return _Unchecked_set(__pos, __val); - } - - bitset<_Nb,_WordT>& reset() { - _M_do_reset(); - return *this; - } - - bitset<_Nb,_WordT>& reset(size_t __pos) { - if (__pos >= _Nb) - __STL_THROW(out_of_range("bitset")); - - return _Unchecked_reset(__pos); - } - - bitset<_Nb,_WordT>& flip() { - _M_do_flip(); - _M_do_sanitize(); - return *this; - } - - bitset<_Nb,_WordT>& flip(size_t __pos) { - if (__pos >= _Nb) - __STL_THROW(out_of_range("bitset")); - - return _Unchecked_flip(__pos); - } - - bitset<_Nb,_WordT> operator~() const { - return bitset<_Nb,_WordT>(*this).flip(); - } - - // element access: - //for b[i]; - reference operator[](size_t __pos) { return reference(*this,__pos); } - bool operator[](size_t __pos) const { return _Unchecked_test(__pos); } - - unsigned long to_ulong() const { return _M_do_to_ulong(); } - -#ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS - template - basic_string<_CharT, _Traits, _Alloc> to_string() const { - basic_string<_CharT, _Traits, _Alloc> __result; - _M_copy_to_string(__result); - return __result; - } -#endif /* __STL_EXPLICIT_FUNCTION_TMPL_ARGS */ - - // Helper functions for string operations. - template - void _M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s, - size_t, - size_t); - - // Helper functions for string operations. - template - void _M_copy_to_string(basic_string<_CharT,_Traits,_Alloc>&) const; - - size_t count() const { return _M_do_count(); } - - size_t size() const { return _Nb; } - - bool operator==(const bitset<_Nb,_WordT>& __rhs) const { - return _M_is_equal(__rhs); - } - bool operator!=(const bitset<_Nb,_WordT>& __rhs) const { - return !_M_is_equal(__rhs); - } - - bool test(size_t __pos) const { - if (__pos > _Nb) - __STL_THROW(out_of_range("bitset")); - - return _Unchecked_test(__pos); - } - - bool any() const { return _M_is_any(); } - bool none() const { return !_M_is_any(); } - - bitset<_Nb,_WordT> operator<<(size_t __pos) const - { return bitset<_Nb,_WordT>(*this) <<= __pos; } - bitset<_Nb,_WordT> operator>>(size_t __pos) const - { return bitset<_Nb,_WordT>(*this) >>= __pos; } - - // - // EXTENSIONS: bit-find operations. These operations are - // experimental, and are subject to change or removal in future - // versions. - // - - // find the index of the first "on" bit - size_t _Find_first() const - { return _M_do_find_first(_Nb); } - - // find the index of the next "on" bit after prev - size_t _Find_next( size_t __prev ) const - { return _M_do_find_next(__prev, _Nb); } - -}; - -// -// Definitions of non-inline member functions. -// - -template -template -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 -template -void bitset<_Nb, _WordT> - ::_M_copy_to_string(basic_string<_CharT, _Traits, _Alloc>& __s) const -{ - __s.assign(_Nb, '0'); - - for (size_t __i = 0; __i < _Nb; ++__i) - if (_Unchecked_test(__i)) - __s[_Nb - 1 - __i] = '1'; -} - -// ------------------------------------------------------------ - -// -// 23.3.5.3 bitset operations: -// - -template -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 -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 -inline bitset<_Nb,_WordT> operator^(const bitset<_Nb,_WordT>& __x, - const bitset<_Nb,_WordT>& __y) { - bitset<_Nb,_WordT> __result(__x); - __result ^= __y; - return __result; -} - -// NOTE: these must be rewritten once we have templatized iostreams. - -template -istream& -operator>>(istream& __is, bitset<_Nb,_WordT>& __x) { - string __tmp; - __tmp.reserve(_Nb); - - // In new templatized iostreams, use istream::sentry - if (__is.flags() & ios::skipws) { - char __c; - do - __is.get(__c); - while (__is && isspace(__c)); - if (__is) - __is.putback(__c); - } - - for (size_t __i = 0; __i < _Nb; ++__i) { - char __c; - __is.get(__c); - - if (!__is) - break; - else if (__c != '0' && __c != '1') { - __is.putback(__c); - break; - } - else - __tmp.push_back(__c); - } - - if (__tmp.empty()) - __is.clear(__is.rdstate() | ios::failbit); - else - __x._M_copy_from_string(__tmp, static_cast(0), _Nb); - - return __is; -} - -template -ostream& operator<<(ostream& __os, const bitset<_Nb,_WordT>& __x) { - string __tmp; - __x._M_copy_to_string(__tmp); - return __os << __tmp; -} - -// ------------------------------------------------------------ -// Lookup tables for find and count operations. - -template -unsigned char _Bit_count<__dummy>::_S_bit_count[] = { - 0, /* 0 */ 1, /* 1 */ 1, /* 2 */ 2, /* 3 */ 1, /* 4 */ - 2, /* 5 */ 2, /* 6 */ 3, /* 7 */ 1, /* 8 */ 2, /* 9 */ - 2, /* 10 */ 3, /* 11 */ 2, /* 12 */ 3, /* 13 */ 3, /* 14 */ - 4, /* 15 */ 1, /* 16 */ 2, /* 17 */ 2, /* 18 */ 3, /* 19 */ - 2, /* 20 */ 3, /* 21 */ 3, /* 22 */ 4, /* 23 */ 2, /* 24 */ - 3, /* 25 */ 3, /* 26 */ 4, /* 27 */ 3, /* 28 */ 4, /* 29 */ - 4, /* 30 */ 5, /* 31 */ 1, /* 32 */ 2, /* 33 */ 2, /* 34 */ - 3, /* 35 */ 2, /* 36 */ 3, /* 37 */ 3, /* 38 */ 4, /* 39 */ - 2, /* 40 */ 3, /* 41 */ 3, /* 42 */ 4, /* 43 */ 3, /* 44 */ - 4, /* 45 */ 4, /* 46 */ 5, /* 47 */ 2, /* 48 */ 3, /* 49 */ - 3, /* 50 */ 4, /* 51 */ 3, /* 52 */ 4, /* 53 */ 4, /* 54 */ - 5, /* 55 */ 3, /* 56 */ 4, /* 57 */ 4, /* 58 */ 5, /* 59 */ - 4, /* 60 */ 5, /* 61 */ 5, /* 62 */ 6, /* 63 */ 1, /* 64 */ - 2, /* 65 */ 2, /* 66 */ 3, /* 67 */ 2, /* 68 */ 3, /* 69 */ - 3, /* 70 */ 4, /* 71 */ 2, /* 72 */ 3, /* 73 */ 3, /* 74 */ - 4, /* 75 */ 3, /* 76 */ 4, /* 77 */ 4, /* 78 */ 5, /* 79 */ - 2, /* 80 */ 3, /* 81 */ 3, /* 82 */ 4, /* 83 */ 3, /* 84 */ - 4, /* 85 */ 4, /* 86 */ 5, /* 87 */ 3, /* 88 */ 4, /* 89 */ - 4, /* 90 */ 5, /* 91 */ 4, /* 92 */ 5, /* 93 */ 5, /* 94 */ - 6, /* 95 */ 2, /* 96 */ 3, /* 97 */ 3, /* 98 */ 4, /* 99 */ - 3, /* 100 */ 4, /* 101 */ 4, /* 102 */ 5, /* 103 */ 3, /* 104 */ - 4, /* 105 */ 4, /* 106 */ 5, /* 107 */ 4, /* 108 */ 5, /* 109 */ - 5, /* 110 */ 6, /* 111 */ 3, /* 112 */ 4, /* 113 */ 4, /* 114 */ - 5, /* 115 */ 4, /* 116 */ 5, /* 117 */ 5, /* 118 */ 6, /* 119 */ - 4, /* 120 */ 5, /* 121 */ 5, /* 122 */ 6, /* 123 */ 5, /* 124 */ - 6, /* 125 */ 6, /* 126 */ 7, /* 127 */ 1, /* 128 */ 2, /* 129 */ - 2, /* 130 */ 3, /* 131 */ 2, /* 132 */ 3, /* 133 */ 3, /* 134 */ - 4, /* 135 */ 2, /* 136 */ 3, /* 137 */ 3, /* 138 */ 4, /* 139 */ - 3, /* 140 */ 4, /* 141 */ 4, /* 142 */ 5, /* 143 */ 2, /* 144 */ - 3, /* 145 */ 3, /* 146 */ 4, /* 147 */ 3, /* 148 */ 4, /* 149 */ - 4, /* 150 */ 5, /* 151 */ 3, /* 152 */ 4, /* 153 */ 4, /* 154 */ - 5, /* 155 */ 4, /* 156 */ 5, /* 157 */ 5, /* 158 */ 6, /* 159 */ - 2, /* 160 */ 3, /* 161 */ 3, /* 162 */ 4, /* 163 */ 3, /* 164 */ - 4, /* 165 */ 4, /* 166 */ 5, /* 167 */ 3, /* 168 */ 4, /* 169 */ - 4, /* 170 */ 5, /* 171 */ 4, /* 172 */ 5, /* 173 */ 5, /* 174 */ - 6, /* 175 */ 3, /* 176 */ 4, /* 177 */ 4, /* 178 */ 5, /* 179 */ - 4, /* 180 */ 5, /* 181 */ 5, /* 182 */ 6, /* 183 */ 4, /* 184 */ - 5, /* 185 */ 5, /* 186 */ 6, /* 187 */ 5, /* 188 */ 6, /* 189 */ - 6, /* 190 */ 7, /* 191 */ 2, /* 192 */ 3, /* 193 */ 3, /* 194 */ - 4, /* 195 */ 3, /* 196 */ 4, /* 197 */ 4, /* 198 */ 5, /* 199 */ - 3, /* 200 */ 4, /* 201 */ 4, /* 202 */ 5, /* 203 */ 4, /* 204 */ - 5, /* 205 */ 5, /* 206 */ 6, /* 207 */ 3, /* 208 */ 4, /* 209 */ - 4, /* 210 */ 5, /* 211 */ 4, /* 212 */ 5, /* 213 */ 5, /* 214 */ - 6, /* 215 */ 4, /* 216 */ 5, /* 217 */ 5, /* 218 */ 6, /* 219 */ - 5, /* 220 */ 6, /* 221 */ 6, /* 222 */ 7, /* 223 */ 3, /* 224 */ - 4, /* 225 */ 4, /* 226 */ 5, /* 227 */ 4, /* 228 */ 5, /* 229 */ - 5, /* 230 */ 6, /* 231 */ 4, /* 232 */ 5, /* 233 */ 5, /* 234 */ - 6, /* 235 */ 5, /* 236 */ 6, /* 237 */ 6, /* 238 */ 7, /* 239 */ - 4, /* 240 */ 5, /* 241 */ 5, /* 242 */ 6, /* 243 */ 5, /* 244 */ - 6, /* 245 */ 6, /* 246 */ 7, /* 247 */ 5, /* 248 */ 6, /* 249 */ - 6, /* 250 */ 7, /* 251 */ 6, /* 252 */ 7, /* 253 */ 7, /* 254 */ - 8 /* 255 */ -}; // end _Bit_count - -template -unsigned char _First_one<__dummy>::_S_first_one[] = { - 0, /* 0 */ 0, /* 1 */ 1, /* 2 */ 0, /* 3 */ 2, /* 4 */ - 0, /* 5 */ 1, /* 6 */ 0, /* 7 */ 3, /* 8 */ 0, /* 9 */ - 1, /* 10 */ 0, /* 11 */ 2, /* 12 */ 0, /* 13 */ 1, /* 14 */ - 0, /* 15 */ 4, /* 16 */ 0, /* 17 */ 1, /* 18 */ 0, /* 19 */ - 2, /* 20 */ 0, /* 21 */ 1, /* 22 */ 0, /* 23 */ 3, /* 24 */ - 0, /* 25 */ 1, /* 26 */ 0, /* 27 */ 2, /* 28 */ 0, /* 29 */ - 1, /* 30 */ 0, /* 31 */ 5, /* 32 */ 0, /* 33 */ 1, /* 34 */ - 0, /* 35 */ 2, /* 36 */ 0, /* 37 */ 1, /* 38 */ 0, /* 39 */ - 3, /* 40 */ 0, /* 41 */ 1, /* 42 */ 0, /* 43 */ 2, /* 44 */ - 0, /* 45 */ 1, /* 46 */ 0, /* 47 */ 4, /* 48 */ 0, /* 49 */ - 1, /* 50 */ 0, /* 51 */ 2, /* 52 */ 0, /* 53 */ 1, /* 54 */ - 0, /* 55 */ 3, /* 56 */ 0, /* 57 */ 1, /* 58 */ 0, /* 59 */ - 2, /* 60 */ 0, /* 61 */ 1, /* 62 */ 0, /* 63 */ 6, /* 64 */ - 0, /* 65 */ 1, /* 66 */ 0, /* 67 */ 2, /* 68 */ 0, /* 69 */ - 1, /* 70 */ 0, /* 71 */ 3, /* 72 */ 0, /* 73 */ 1, /* 74 */ - 0, /* 75 */ 2, /* 76 */ 0, /* 77 */ 1, /* 78 */ 0, /* 79 */ - 4, /* 80 */ 0, /* 81 */ 1, /* 82 */ 0, /* 83 */ 2, /* 84 */ - 0, /* 85 */ 1, /* 86 */ 0, /* 87 */ 3, /* 88 */ 0, /* 89 */ - 1, /* 90 */ 0, /* 91 */ 2, /* 92 */ 0, /* 93 */ 1, /* 94 */ - 0, /* 95 */ 5, /* 96 */ 0, /* 97 */ 1, /* 98 */ 0, /* 99 */ - 2, /* 100 */ 0, /* 101 */ 1, /* 102 */ 0, /* 103 */ 3, /* 104 */ - 0, /* 105 */ 1, /* 106 */ 0, /* 107 */ 2, /* 108 */ 0, /* 109 */ - 1, /* 110 */ 0, /* 111 */ 4, /* 112 */ 0, /* 113 */ 1, /* 114 */ - 0, /* 115 */ 2, /* 116 */ 0, /* 117 */ 1, /* 118 */ 0, /* 119 */ - 3, /* 120 */ 0, /* 121 */ 1, /* 122 */ 0, /* 123 */ 2, /* 124 */ - 0, /* 125 */ 1, /* 126 */ 0, /* 127 */ 7, /* 128 */ 0, /* 129 */ - 1, /* 130 */ 0, /* 131 */ 2, /* 132 */ 0, /* 133 */ 1, /* 134 */ - 0, /* 135 */ 3, /* 136 */ 0, /* 137 */ 1, /* 138 */ 0, /* 139 */ - 2, /* 140 */ 0, /* 141 */ 1, /* 142 */ 0, /* 143 */ 4, /* 144 */ - 0, /* 145 */ 1, /* 146 */ 0, /* 147 */ 2, /* 148 */ 0, /* 149 */ - 1, /* 150 */ 0, /* 151 */ 3, /* 152 */ 0, /* 153 */ 1, /* 154 */ - 0, /* 155 */ 2, /* 156 */ 0, /* 157 */ 1, /* 158 */ 0, /* 159 */ - 5, /* 160 */ 0, /* 161 */ 1, /* 162 */ 0, /* 163 */ 2, /* 164 */ - 0, /* 165 */ 1, /* 166 */ 0, /* 167 */ 3, /* 168 */ 0, /* 169 */ - 1, /* 170 */ 0, /* 171 */ 2, /* 172 */ 0, /* 173 */ 1, /* 174 */ - 0, /* 175 */ 4, /* 176 */ 0, /* 177 */ 1, /* 178 */ 0, /* 179 */ - 2, /* 180 */ 0, /* 181 */ 1, /* 182 */ 0, /* 183 */ 3, /* 184 */ - 0, /* 185 */ 1, /* 186 */ 0, /* 187 */ 2, /* 188 */ 0, /* 189 */ - 1, /* 190 */ 0, /* 191 */ 6, /* 192 */ 0, /* 193 */ 1, /* 194 */ - 0, /* 195 */ 2, /* 196 */ 0, /* 197 */ 1, /* 198 */ 0, /* 199 */ - 3, /* 200 */ 0, /* 201 */ 1, /* 202 */ 0, /* 203 */ 2, /* 204 */ - 0, /* 205 */ 1, /* 206 */ 0, /* 207 */ 4, /* 208 */ 0, /* 209 */ - 1, /* 210 */ 0, /* 211 */ 2, /* 212 */ 0, /* 213 */ 1, /* 214 */ - 0, /* 215 */ 3, /* 216 */ 0, /* 217 */ 1, /* 218 */ 0, /* 219 */ - 2, /* 220 */ 0, /* 221 */ 1, /* 222 */ 0, /* 223 */ 5, /* 224 */ - 0, /* 225 */ 1, /* 226 */ 0, /* 227 */ 2, /* 228 */ 0, /* 229 */ - 1, /* 230 */ 0, /* 231 */ 3, /* 232 */ 0, /* 233 */ 1, /* 234 */ - 0, /* 235 */ 2, /* 236 */ 0, /* 237 */ 1, /* 238 */ 0, /* 239 */ - 4, /* 240 */ 0, /* 241 */ 1, /* 242 */ 0, /* 243 */ 2, /* 244 */ - 0, /* 245 */ 1, /* 246 */ 0, /* 247 */ 3, /* 248 */ 0, /* 249 */ - 1, /* 250 */ 0, /* 251 */ 2, /* 252 */ 0, /* 253 */ 1, /* 254 */ - 0, /* 255 */ -}; // end _First_one - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1209 -#endif - -__STL_END_NAMESPACE - - -#undef __BITS_PER_WORDT -#undef __BITSET_WORDS - -#endif /* __SGI_STL_BITSET */ - - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/bvector.h b/contrib/libstdc++/stl/bvector.h deleted file mode 100644 index 03a3fb1c7f..0000000000 --- a/contrib/libstdc++/stl/bvector.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_BVECTOR_H -#define __SGI_STL_BVECTOR_H - -#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION -#include -#else -#include -#include -#endif - -#include - -#ifdef __STL_USE_NAMESPACES - -using __STD::bit_vector; - -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_BVECTOR_H */ - -// Local Variables: -// mode:C++ -// End: - - diff --git a/contrib/libstdc++/stl/defalloc.h b/contrib/libstdc++/stl/defalloc.h deleted file mode 100644 index 0bfcc2c20a..0000000000 --- a/contrib/libstdc++/stl/defalloc.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -// Inclusion of this file is DEPRECATED. This is the original HP -// default allocator. It is provided only for backward compatibility. -// This file WILL BE REMOVED in a future release. -// -// DO NOT USE THIS FILE unless you have an old container implementation -// that requires an allocator with the HP-style interface. -// -// Standard-conforming allocators have a very different interface. The -// standard default allocator is declared in the header . - -#ifndef DEFALLOC_H -#define DEFALLOC_H - -#include -#include -#include -#include -#include -#include - - -template -inline T* allocate(ptrdiff_t size, T*) { - set_new_handler(0); - T* tmp = (T*)(::operator new((size_t)(size * sizeof(T)))); - if (tmp == 0) { - cerr << "out of memory" << endl; - exit(1); - } - return tmp; -} - - -template -inline void deallocate(T* buffer) { - ::operator delete(buffer); -} - -template -class allocator { -public: - typedef T value_type; - typedef T* pointer; - typedef const T* const_pointer; - typedef T& reference; - typedef const T& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - pointer allocate(size_type n) { - return ::allocate((difference_type)n, (pointer)0); - } - void deallocate(pointer p) { ::deallocate(p); } - pointer address(reference x) { return (pointer)&x; } - const_pointer const_address(const_reference x) { - return (const_pointer)&x; - } - size_type init_page_size() { - return max(size_type(1), size_type(4096/sizeof(T))); - } - size_type max_size() const { - return max(size_type(1), size_type(UINT_MAX/sizeof(T))); - } -}; - -class allocator { -public: - typedef void* pointer; -}; - - - -#endif diff --git a/contrib/libstdc++/stl/deque b/contrib/libstdc++/stl/deque deleted file mode 100644 index 61654acad5..0000000000 --- a/contrib/libstdc++/stl/deque +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_DEQUE -#define __SGI_STL_DEQUE - -#include -#include -#include -#include -#include - -#endif /* __SGI_STL_DEQUE */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/deque.h b/contrib/libstdc++/stl/deque.h deleted file mode 100644 index ede38b1ceb..0000000000 --- a/contrib/libstdc++/stl/deque.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_DEQUE_H -#define __SGI_STL_DEQUE_H - -#include -#include -#include - -#ifdef __STL_USE_NAMESPACES -using __STD::deque; -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_DEQUE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/function.h b/contrib/libstdc++/stl/function.h deleted file mode 100644 index 6474dd99fa..0000000000 --- a/contrib/libstdc++/stl/function.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_FUNCTION_H -#define __SGI_STL_FUNCTION_H - -#ifndef __STL_CONFIG_H -#include -#endif -#ifndef __SGI_STL_INTERNAL_RELOPS -#include -#endif -#include -#ifndef __SGI_STL_INTERNAL_FUNCTION_H -#include -#endif - -#ifdef __STL_USE_NAMESPACE_FOR_RELOPS - -// Names from stl_relops.h -using __STD_RELOPS::operator!=; -using __STD_RELOPS::operator>; -using __STD_RELOPS::operator<=; -using __STD_RELOPS::operator>=; - -#endif /* __STL_USE_NAMESPACE_FOR_RELOPS */ - -#ifdef __STL_USE_NAMESPACES - -// Names from stl_function.h -using __STD::unary_function; -using __STD::binary_function; -using __STD::plus; -using __STD::minus; -using __STD::multiplies; -using __STD::divides; -using __STD::identity_element; -using __STD::modulus; -using __STD::negate; -using __STD::equal_to; -using __STD::not_equal_to; -using __STD::greater; -using __STD::less; -using __STD::greater_equal; -using __STD::less_equal; -using __STD::logical_and; -using __STD::logical_or; -using __STD::logical_not; -using __STD::unary_negate; -using __STD::binary_negate; -using __STD::not1; -using __STD::not2; -using __STD::binder1st; -using __STD::binder2nd; -using __STD::bind1st; -using __STD::bind2nd; -using __STD::unary_compose; -using __STD::binary_compose; -using __STD::compose1; -using __STD::compose2; -using __STD::pointer_to_unary_function; -using __STD::pointer_to_binary_function; -using __STD::ptr_fun; -using __STD::identity; -using __STD::select1st; -using __STD::select2nd; -using __STD::project1st; -using __STD::project2nd; -using __STD::constant_void_fun; -using __STD::constant_unary_fun; -using __STD::constant_binary_fun; -using __STD::constant0; -using __STD::constant1; -using __STD::constant2; -using __STD::subtractive_rng; -using __STD::mem_fun_t; -using __STD::const_mem_fun_t; -using __STD::mem_fun_ref_t; -using __STD::const_mem_fun_ref_t; -using __STD::mem_fun1_t; -using __STD::const_mem_fun1_t; -using __STD::mem_fun1_ref_t; -using __STD::const_mem_fun1_ref_t; -using __STD::mem_fun; -using __STD::mem_fun_ref; -using __STD::mem_fun1; -using __STD::mem_fun1_ref; - -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_FUNCTION_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/functional b/contrib/libstdc++/stl/functional deleted file mode 100644 index d046dbb036..0000000000 --- a/contrib/libstdc++/stl/functional +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef __SGI_STL_FUNCTIONAL -#define __SGI_STL_FUNCTIONAL - -#include -#include -#include - -#endif /* __SGI_STL_FUNCTIONAL */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/hash_map b/contrib/libstdc++/stl/hash_map deleted file mode 100644 index f7421e026f..0000000000 --- a/contrib/libstdc++/stl/hash_map +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef __SGI_STL_HASH_MAP -#define __SGI_STL_HASH_MAP - -#ifndef __SGI_STL_INTERNAL_HASHTABLE_H -#include -#endif - -#include - -#endif /* __SGI_STL_HASH_MAP */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/hash_map.h b/contrib/libstdc++/stl/hash_map.h deleted file mode 100644 index f347162704..0000000000 --- a/contrib/libstdc++/stl/hash_map.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef __SGI_STL_HASH_MAP_H -#define __SGI_STL_HASH_MAP_H - -#ifndef __SGI_STL_INTERNAL_HASHTABLE_H -#include -#endif - -#include -#include - -#ifdef __STL_USE_NAMESPACES -using __STD::hash; -using __STD::hashtable; -using __STD::hash_map; -using __STD::hash_multimap; -#endif /* __STL_USE_NAMESPACES */ - - -#endif /* __SGI_STL_HASH_MAP_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/hash_set b/contrib/libstdc++/stl/hash_set deleted file mode 100644 index 2244f47cfa..0000000000 --- a/contrib/libstdc++/stl/hash_set +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef __SGI_STL_HASH_SET -#define __SGI_STL_HASH_SET - -#ifndef __SGI_STL_INTERNAL_HASHTABLE_H -#include -#endif - -#include - -#endif /* __SGI_STL_HASH_SET */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/hash_set.h b/contrib/libstdc++/stl/hash_set.h deleted file mode 100644 index d3e93c0c26..0000000000 --- a/contrib/libstdc++/stl/hash_set.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef __SGI_STL_HASH_SET_H -#define __SGI_STL_HASH_SET_H - -#ifndef __SGI_STL_INTERNAL_HASHTABLE_H -#include -#endif - -#include -#include - -#ifdef __STL_USE_NAMESPACES -using __STD::hash; -using __STD::hashtable; -using __STD::hash_set; -using __STD::hash_multiset; -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_HASH_SET_H */ diff --git a/contrib/libstdc++/stl/hashtable.h b/contrib/libstdc++/stl/hashtable.h deleted file mode 100644 index 15dbfc9164..0000000000 --- a/contrib/libstdc++/stl/hashtable.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_HASHTABLE_H -#define __SGI_STL_HASHTABLE_H - -#include -#include -#include -#include - -#ifdef __STL_USE_NAMESPACES -using __STD::hash; -using __STD::hashtable; -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_HASHTABLE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/heap.h b/contrib/libstdc++/stl/heap.h deleted file mode 100644 index 2ec93c07b7..0000000000 --- a/contrib/libstdc++/stl/heap.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_HEAP_H -#define __SGI_STL_HEAP_H - -#include -#include - -#ifdef __STL_USE_NAMESPACES - -using __STD::push_heap; -using __STD::pop_heap; -using __STD::make_heap; -using __STD::sort_heap; - -#endif /* __STL_USE_NAMESPACES */ - - -#endif /* __SGI_STL_HEAP_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/iterator b/contrib/libstdc++/stl/iterator deleted file mode 100644 index 4ddd208f27..0000000000 --- a/contrib/libstdc++/stl/iterator +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_ITERATOR -#define __SGI_STL_ITERATOR - -#include -#include -#include /* XXX should use */ -#if 0 /* XXX define a flag for this */ -#include -#else -#include -#endif -#include - -#endif /* __SGI_STL_ITERATOR */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/iterator.h b/contrib/libstdc++/stl/iterator.h deleted file mode 100644 index f8a0237742..0000000000 --- a/contrib/libstdc++/stl/iterator.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_ITERATOR_H -#define __SGI_STL_ITERATOR_H - -#ifndef __SGI_STL_FUNCTION_H -#include -#endif -#include -#include -#ifndef __SGI_STL_INTERNAL_ITERATOR_H -#include -#endif -#ifndef __TYPE_TRAITS_H -#include -#endif -#ifndef __SGI_STL_INTERNAL_CONSTRUCT_H -#include -#endif -#ifndef __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H -#include -#endif - -#ifdef __STL_USE_NAMESPACES - -// Names from stl_iterator.h - -using __STD::input_iterator_tag; -using __STD::output_iterator_tag; -using __STD::forward_iterator_tag; -using __STD::bidirectional_iterator_tag; -using __STD::random_access_iterator_tag; - -#if 0 -using __STD::iterator; -#endif -using __STD::input_iterator; -using __STD::output_iterator; -using __STD::forward_iterator; -using __STD::bidirectional_iterator; -using __STD::random_access_iterator; - -#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION -using __STD::iterator_traits; -#endif - -using __STD::iterator_category; -using __STD::distance_type; -using __STD::value_type; - -using __STD::distance; -using __STD::advance; - -using __STD::insert_iterator; -using __STD::front_insert_iterator; -using __STD::back_insert_iterator; -using __STD::inserter; -using __STD::front_inserter; -using __STD::back_inserter; - -using __STD::reverse_iterator; -using __STD::reverse_bidirectional_iterator; - -using __STD::istream_iterator; -using __STD::ostream_iterator; - -// Names from stl_construct.h -using __STD::construct; -using __STD::destroy; - -// Names from stl_raw_storage_iter.h -using __STD::raw_storage_iterator; - -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_ITERATOR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/list b/contrib/libstdc++/stl/list deleted file mode 100644 index 5294f39fea..0000000000 --- a/contrib/libstdc++/stl/list +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_LIST -#define __SGI_STL_LIST - -#include -#include -#include -#include -#include - -#endif /* __SGI_STL_LIST */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/list.h b/contrib/libstdc++/stl/list.h deleted file mode 100644 index 4e6ee0b411..0000000000 --- a/contrib/libstdc++/stl/list.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_LIST_H -#define __SGI_STL_LIST_H - -#include -#include -#include - -#ifdef __STL_USE_NAMESPACES -using __STD::list; -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_LIST_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/map b/contrib/libstdc++/stl/map deleted file mode 100644 index 4cfb7652c5..0000000000 --- a/contrib/libstdc++/stl/map +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_MAP -#define __SGI_STL_MAP - -#ifndef __SGI_STL_INTERNAL_TREE_H -#include -#endif -#include -#include - -#endif /* __SGI_STL_MAP */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/map.h b/contrib/libstdc++/stl/map.h deleted file mode 100644 index a89bd31e81..0000000000 --- a/contrib/libstdc++/stl/map.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_MAP_H -#define __SGI_STL_MAP_H - -#include -#include - -#ifdef __STL_USE_NAMESPACES -using __STD::map; -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_MAP_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/memory b/contrib/libstdc++/stl/memory deleted file mode 100644 index 64338dd313..0000000000 --- a/contrib/libstdc++/stl/memory +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef __SGI_STL_MEMORY -#define __SGI_STL_MEMORY - -#include -#include -#include -#include -#include -#include - - -#if defined(__STL_MEMBER_TEMPLATES) - -__STL_BEGIN_NAMESPACE - -template class auto_ptr { -private: - _Tp* _M_ptr; - -public: - typedef _Tp element_type; - explicit auto_ptr(_Tp* __p = 0) __STL_NOTHROW : _M_ptr(__p) {} - auto_ptr(auto_ptr& __a) __STL_NOTHROW : _M_ptr(__a.release()) {} - template auto_ptr(auto_ptr<_Tp1>& __a) __STL_NOTHROW - : _M_ptr(__a.release()) {} - auto_ptr& operator=(auto_ptr& __a) __STL_NOTHROW { - if (&__a != this) { - delete _M_ptr; - _M_ptr = __a.release(); - } - return *this; - } - template - auto_ptr& operator=(auto_ptr<_Tp1>& __a) __STL_NOTHROW { - if (__a.get() != this->get()) { - delete _M_ptr; - _M_ptr = __a.release(); - } - return *this; - } - ~auto_ptr() __STL_NOTHROW { delete _M_ptr; } - - _Tp& operator*() const __STL_NOTHROW { - return *_M_ptr; - } - _Tp* operator->() const __STL_NOTHROW { - return _M_ptr; - } - _Tp* get() const __STL_NOTHROW { - return _M_ptr; - } - _Tp* release() __STL_NOTHROW { - _Tp* __tmp = _M_ptr; - _M_ptr = 0; - return __tmp; - } - void reset(_Tp* __p = 0) __STL_NOTHROW { - delete _M_ptr; - _M_ptr = __p; - } - - // According to the C++ standard, these conversions are required. Most - // present-day compilers, however, do not enforce that requirement---and, - // in fact, most present-day compilers do not support the language - // features that these conversions rely on. - -#ifdef __SGI_STL_USE_AUTO_PTR_CONVERSIONS - -private: - template struct auto_ptr_ref { - _Tp1* _M_ptr; - auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {} - }; - -public: - auto_ptr(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW - : _M_ptr(__ref._M_ptr) {} - template operator auto_ptr_ref<_Tp1>() __STL_NOTHROW - { return auto_ptr_ref<_Tp>(this->release()); } - template operator auto_ptr<_Tp1>() __STL_NOTHROW - { return auto_ptr<_Tp1>(this->release()); } - -#endif /* __SGI_STL_USE_AUTO_PTR_CONVERSIONS */ -}; - -__STL_END_NAMESPACE -#endif /* member templates */ - -#endif /* __SGI_STL_MEMORY */ - - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/multimap.h b/contrib/libstdc++/stl/multimap.h deleted file mode 100644 index 1a8ec4af4f..0000000000 --- a/contrib/libstdc++/stl/multimap.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_MULTIMAP_H -#define __SGI_STL_MULTIMAP_H - -#include -#include - -#ifdef __STL_USE_NAMESPACES -using __STD::multimap; -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_MULTIMAP_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/multiset.h b/contrib/libstdc++/stl/multiset.h deleted file mode 100644 index 3024fd74c0..0000000000 --- a/contrib/libstdc++/stl/multiset.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_MULTISET_H -#define __SGI_STL_MULTISET_H - -#include -#include - -#ifdef __STL_USE_NAMESPACES -using __STD::multiset; -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_MULTISET_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/numeric b/contrib/libstdc++/stl/numeric deleted file mode 100644 index 7f048e11b5..0000000000 --- a/contrib/libstdc++/stl/numeric +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_NUMERIC -#define __SGI_STL_NUMERIC - -#include -#include -#include -#include -#include -#include -#include - -#endif /* __SGI_STL_NUMERIC */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/pair.h b/contrib/libstdc++/stl/pair.h deleted file mode 100644 index 00f5caddb6..0000000000 --- a/contrib/libstdc++/stl/pair.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_PAIR_H -#define __SGI_STL_PAIR_H - -#ifndef __STL_CONFIG_H -#include -#endif -#ifndef __SGI_STL_INTERNAL_RELOPS -#include -#endif -#ifndef __SGI_STL_INTERNAL_PAIR_H -#include -#endif - -#ifdef __STL_USE_NAMESPACES - -using __STD::pair; -using __STD::make_pair; - -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_PAIR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/pthread_alloc b/contrib/libstdc++/stl/pthread_alloc deleted file mode 100644 index 1852908095..0000000000 --- a/contrib/libstdc++/stl/pthread_alloc +++ /dev/null @@ -1,479 +0,0 @@ -/* - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_PTHREAD_ALLOC -#define __SGI_STL_PTHREAD_ALLOC - -// Pthread-specific node allocator. -// This is similar to the default allocator, except that free-list -// information is kept separately for each thread, avoiding locking. -// This should be reasonably fast even in the presence of threads. -// The down side is that storage may not be well-utilized. -// It is not an error to allocate memory in thread A and deallocate -// it in thread B. But this effectively transfers ownership of the memory, -// so that it can only be reallocated by thread B. Thus this can effectively -// result in a storage leak if it's done on a regular basis. -// It can also result in frequent sharing of -// cache lines among processors, with potentially serious performance -// consequences. - -#include -#include -#ifndef __RESTRICT -# define __RESTRICT -#endif - -__STL_BEGIN_NAMESPACE - -#define __STL_DATA_ALIGNMENT 8 - -union _Pthread_alloc_obj { - union _Pthread_alloc_obj * __free_list_link; - char __client_data[__STL_DATA_ALIGNMENT]; /* The client sees this. */ -}; - -// Pthread allocators don't appear to the client to have meaningful -// instances. We do in fact need to associate some state with each -// thread. That state is represented by -// _Pthread_alloc_per_thread_state<_Max_size>. - -template -struct _Pthread_alloc_per_thread_state { - typedef _Pthread_alloc_obj __obj; - enum { _S_NFREELISTS = _Max_size/__STL_DATA_ALIGNMENT }; - _Pthread_alloc_obj* volatile __free_list[_S_NFREELISTS]; - _Pthread_alloc_per_thread_state<_Max_size> * __next; - // Free list link for list of available per thread structures. - // When one of these becomes available for reuse due to thread - // termination, any objects in its free list remain associated - // with it. The whole structure may then be used by a newly - // created thread. - _Pthread_alloc_per_thread_state() : __next(0) - { - memset((void *)__free_list, 0, _S_NFREELISTS * sizeof(__obj *)); - } - // Returns an object of size __n, and possibly adds to size n free list. - void *_M_refill(size_t __n); -}; - -// Pthread-specific allocator. -// The argument specifies the largest object size allocated from per-thread -// free lists. Larger objects are allocated using malloc_alloc. -// Max_size must be a power of 2. -template -class _Pthread_alloc_template { - -public: // but only for internal use: - - typedef _Pthread_alloc_obj __obj; - - // Allocates a chunk for nobjs of size "size". nobjs may be reduced - // if it is inconvenient to allocate the requested number. - static char *_S_chunk_alloc(size_t __size, int &__nobjs); - - enum {_S_ALIGN = __STL_DATA_ALIGNMENT}; - - static size_t _S_round_up(size_t __bytes) { - return (((__bytes) + _S_ALIGN-1) & ~(_S_ALIGN - 1)); - } - static size_t _S_freelist_index(size_t __bytes) { - return (((__bytes) + _S_ALIGN-1)/_S_ALIGN - 1); - } - -private: - // Chunk allocation state. And other shared state. - // Protected by _S_chunk_allocator_lock. - static pthread_mutex_t _S_chunk_allocator_lock; - static char *_S_start_free; - static char *_S_end_free; - static size_t _S_heap_size; - static _Pthread_alloc_per_thread_state<_Max_size>* _S_free_per_thread_states; - static pthread_key_t _S_key; - static bool _S_key_initialized; - // Pthread key under which per thread state is stored. - // Allocator instances that are currently unclaimed by any thread. - static void _S_destructor(void *instance); - // Function to be called on thread exit to reclaim per thread - // state. - static _Pthread_alloc_per_thread_state<_Max_size> *_S_new_per_thread_state(); - // Return a recycled or new per thread state. - static _Pthread_alloc_per_thread_state<_Max_size> *_S_get_per_thread_state(); - // ensure that the current thread has an associated - // per thread state. - friend class _M_lock; - class _M_lock { - public: - _M_lock () { pthread_mutex_lock(&_S_chunk_allocator_lock); } - ~_M_lock () { pthread_mutex_unlock(&_S_chunk_allocator_lock); } - }; - -public: - - /* n must be > 0 */ - static void * allocate(size_t __n) - { - __obj * volatile * __my_free_list; - __obj * __RESTRICT __result; - _Pthread_alloc_per_thread_state<_Max_size>* __a; - - if (__n > _Max_size) { - return(malloc_alloc::allocate(__n)); - } - if (!_S_key_initialized || - !(__a = (_Pthread_alloc_per_thread_state<_Max_size>*) - pthread_getspecific(_S_key))) { - __a = _S_get_per_thread_state(); - } - __my_free_list = __a -> __free_list + _S_freelist_index(__n); - __result = *__my_free_list; - if (__result == 0) { - void *__r = __a -> _M_refill(_S_round_up(__n)); - return __r; - } - *__my_free_list = __result -> __free_list_link; - return (__result); - }; - - /* p may not be 0 */ - static void deallocate(void *__p, size_t __n) - { - __obj *__q = (__obj *)__p; - __obj * volatile * __my_free_list; - _Pthread_alloc_per_thread_state<_Max_size>* __a; - - if (__n > _Max_size) { - malloc_alloc::deallocate(__p, __n); - return; - } - if (!_S_key_initialized || - !(__a = (_Pthread_alloc_per_thread_state<_Max_size> *) - pthread_getspecific(_S_key))) { - __a = _S_get_per_thread_state(); - } - __my_free_list = __a->__free_list + _S_freelist_index(__n); - __q -> __free_list_link = *__my_free_list; - *__my_free_list = __q; - } - - static void * reallocate(void *__p, size_t __old_sz, size_t __new_sz); - -} ; - -typedef _Pthread_alloc_template<> pthread_alloc; - - -template -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 -_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 -_Pthread_alloc_per_thread_state<_Max_size> * -_Pthread_alloc_template<_Max_size>::_S_get_per_thread_state() -{ - /*REFERENCED*/ - _M_lock __lock_instance; // Need to acquire lock here. - _Pthread_alloc_per_thread_state<_Max_size> * __result; - if (!_S_key_initialized) { - if (pthread_key_create(&_S_key, _S_destructor)) { - abort(); // failed - } - _S_key_initialized = true; - } - __result = _S_new_per_thread_state(); - if (pthread_setspecific(_S_key, __result)) abort(); - return __result; -} - -/* We allocate memory in large chunks in order to avoid fragmenting */ -/* the malloc heap too much. */ -/* We assume that size is properly aligned. */ -template -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 -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 -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 -_Pthread_alloc_per_thread_state<_Max_size> * -_Pthread_alloc_template<_Max_size>::_S_free_per_thread_states = 0; - -template -pthread_key_t _Pthread_alloc_template<_Max_size>::_S_key; - -template -bool _Pthread_alloc_template<_Max_size>::_S_key_initialized = false; - -template -pthread_mutex_t _Pthread_alloc_template<_Max_size>::_S_chunk_allocator_lock -= PTHREAD_MUTEX_INITIALIZER; - -template -char *_Pthread_alloc_template<_Max_size> -::_S_start_free = 0; - -template -char *_Pthread_alloc_template<_Max_size> -::_S_end_free = 0; - -template -size_t _Pthread_alloc_template<_Max_size> -::_S_heap_size = 0; - -#ifdef __STL_USE_STD_ALLOCATORS - -template -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 struct rebind { - typedef pthread_allocator<_Up> other; - }; - - pthread_allocator() __STL_NOTHROW {} - pthread_allocator(const pthread_allocator& a) __STL_NOTHROW {} - template pthread_allocator(const pthread_allocator<_Up>&) - __STL_NOTHROW {} - ~pthread_allocator() __STL_NOTHROW {} - - pointer address(reference __x) const { return &__x; } - const_pointer address(const_reference __x) const { return &__x; } - - // __n is permitted to be 0. The C++ standard says nothing about what - // the return value is when __n == 0. - _Tp* allocate(size_type __n, const void* = 0) { - return __n != 0 ? static_cast<_Tp*>(_S_Alloc::allocate(__n * sizeof(_Tp))) - : 0; - } - - // p is not permitted to be a null pointer. - void deallocate(pointer __p, size_type __n) - { _S_Alloc::deallocate(__p, __n * sizeof(_Tp)); } - - size_type max_size() const __STL_NOTHROW - { return size_t(-1) / sizeof(_Tp); } - - void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); } - void destroy(pointer _p) { _p->~_Tp(); } -}; - -template<> -class pthread_allocator { -public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef void* pointer; - typedef const void* const_pointer; - typedef void value_type; - - template struct rebind { - typedef pthread_allocator<_Up> other; - }; -}; - -template -inline bool operator==(const _Pthread_alloc_template<_Max_size>&, - const _Pthread_alloc_template<_Max_size>&) -{ - return true; -} - -template -inline bool operator==(const pthread_allocator<_T1>&, - const pthread_allocator<_T2>& a2) -{ - return true; -} - -template -inline bool operator!=(const pthread_allocator<_T1>&, - const pthread_allocator<_T2>&) -{ - return false; -} - -template -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 -struct _Alloc_traits<_Tp, __allocator<_Up, _Pthread_alloc_template<_Max> > > -{ - static const bool _S_instanceless = true; - typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max> > _Alloc_type; - typedef __allocator<_Tp, _Pthread_alloc_template<_Max> > allocator_type; -}; - -template -struct _Alloc_traits<_Tp, pthread_allocator<_Up> > -{ - static const bool _S_instanceless = true; - typedef simple_alloc<_Tp, _Pthread_alloc_template<> > _Alloc_type; - typedef pthread_allocator<_Tp> allocator_type; -}; - - -#endif /* __STL_USE_STD_ALLOCATORS */ - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_PTHREAD_ALLOC */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/pthread_alloc.h b/contrib/libstdc++/stl/pthread_alloc.h deleted file mode 100644 index 774ef04edc..0000000000 --- a/contrib/libstdc++/stl/pthread_alloc.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 1996-1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_PTHREAD_ALLOC_H -#define __SGI_STL_PTHREAD_ALLOC_H - -#include - -#ifdef __STL_USE_NAMESPACES - -using __STD::_Pthread_alloc_template; -using __STD::pthread_alloc; - -#endif /* __STL_USE_NAMESPACES */ - - -#endif /* __SGI_STL_PTHREAD_ALLOC_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/queue b/contrib/libstdc++/stl/queue deleted file mode 100644 index f9417fb1fb..0000000000 --- a/contrib/libstdc++/stl/queue +++ /dev/null @@ -1,45 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_QUEUE -#define __SGI_STL_QUEUE - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif /* __SGI_STL_QUEUE */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/rope b/contrib/libstdc++/stl/rope deleted file mode 100644 index f861500000..0000000000 --- a/contrib/libstdc++/stl/rope +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_ROPE -#define __SGI_STL_ROPE - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif /* __SGI_STL_ROPE */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/rope.h b/contrib/libstdc++/stl/rope.h deleted file mode 100644 index d767fa32e7..0000000000 --- a/contrib/libstdc++/stl/rope.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_ROPE_H -#define __SGI_STL_ROPE_H - -#include -#include - -#ifdef __STL_USE_NAMESPACES - -using __STD::char_producer; -using __STD::sequence_buffer; -using __STD::rope; -using __STD::crope; -using __STD::wrope; - -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_ROPE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/ropeimpl.h b/contrib/libstdc++/stl/ropeimpl.h deleted file mode 100644 index 18bb2c9ec9..0000000000 --- a/contrib/libstdc++/stl/ropeimpl.h +++ /dev/null @@ -1,1550 +0,0 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -# include /* XXX should use */ -# include /* XXX should use */ - -__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 -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 -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 -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 -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 -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 -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 -inline -_Rope_const_iterator<_CharT, _Alloc>::_Rope_const_iterator( - const _Rope_iterator<_CharT,_Alloc>& __x) -: _Rope_iterator_base<_CharT,_Alloc>(__x) -{ } - -template -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 -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 -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 -#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 -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 -#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 -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 -rope<_CharT,_Alloc>::_RopeLeaf* -rope<_CharT,_Alloc>::_S_destr_leaf_concat_char_iter - (_RopeLeaf* __r, const _CharT* __iter, size_t __len) -{ - __stl_assert(__r->_M_refcount >= 1); - if (__r->_M_refcount > 1) - return _S_leaf_concat_char_iter(__r, __iter, __len); - size_t __old_len = __r->_M_size; - if (_S_allocated_capacity(__old_len) >= __old_len + __len) { - // The space has been partially initialized for the standard - // character types. But that doesn't matter for those types. - uninitialized_copy_n(__iter, __len, __r->_M_data + __old_len); - if (_S_is_basic_char_type((_CharT*)0)) { - _S_cond_store_eos(__r->_M_data[__old_len + __len]); - __stl_assert(__r->_M_c_string == __r->_M_data); - } else if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string) { - __r->_M_free_c_string(); - __r->_M_c_string = 0; - } - __r->_M_size = __old_len + __len; - __stl_assert(__r->_M_refcount == 1); - __r->_M_refcount = 2; - return __r; - } else { - _RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len); - __stl_assert(__result->_M_refcount == 1); - return __result; - } -} -#endif - -// Assumes left and right are not 0. -// Does not increment (nor decrement on exception) child reference counts. -// Result has ref count 1. -template -rope<_CharT,_Alloc>::_RopeRep* -rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right) -{ - _RopeConcatenation* __result = - _S_new_RopeConcatenation(__left, __right, __left->get_allocator()); - size_t __depth = __result->_M_depth; - -# ifdef __STL_USE_STD_ALLOCATORS - __stl_assert(__left->get_allocator() == __right->get_allocator()); -# endif - if (__depth > 20 && (__result->_M_size < 1000 || - __depth > _RopeRep::_S_max_rope_depth)) { - _RopeRep* __balanced; - - __STL_TRY { - __balanced = _S_balance(__result); -# ifndef __GC - if (__result != __balanced) { - __stl_assert(1 == __result->_M_refcount - && 1 == __balanced->_M_refcount); - } -# endif - __result->_M_unref_nonnil(); - } - __STL_UNWIND((_C_deallocate(__result,1))); - // In case of exception, we need to deallocate - // otherwise dangling result node. But caller - // still owns its children. Thus unref is - // inappropriate. - return __balanced; - } else { - return __result; - } -} - -template -rope<_CharT,_Alloc>::_RopeRep* rope<_CharT,_Alloc>::_S_concat_char_iter - (_RopeRep* __r, const _CharT*__s, size_t __slen) -{ - _RopeRep* __result; - if (0 == __slen) { - _S_ref(__r); - return __r; - } - if (0 == __r) - return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, - __r->get_allocator()); - if (_RopeRep::_S_leaf == __r->_M_tag && - __r->_M_size + __slen <= _S_copy_max) { - __result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen); -# ifndef __GC - __stl_assert(1 == __result->_M_refcount); -# endif - return __result; - } - if (_RopeRep::_S_concat == __r->_M_tag - && _RopeRep::_S_leaf == ((_RopeConcatenation*)__r)->_M_right->_M_tag) { - _RopeLeaf* __right = - (_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right); - if (__right->_M_size + __slen <= _S_copy_max) { - _RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left; - _RopeRep* __nright = - _S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen); - __left->_M_ref_nonnil(); - __STL_TRY { - __result = _S_tree_concat(__left, __nright); - } - __STL_UNWIND(_S_unref(__left); _S_unref(__nright)); -# ifndef __GC - __stl_assert(1 == __result->_M_refcount); -# endif - return __result; - } - } - _RopeRep* __nright = - __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->get_allocator()); - __STL_TRY { - __r->_M_ref_nonnil(); - __result = _S_tree_concat(__r, __nright); - } - __STL_UNWIND(_S_unref(__r); _S_unref(__nright)); -# ifndef __GC - __stl_assert(1 == __result->_M_refcount); -# endif - return __result; -} - -#ifndef __GC -template -rope<_CharT,_Alloc>::_RopeRep* -rope<_CharT,_Alloc>::_S_destr_concat_char_iter( - _RopeRep* __r, const _CharT* __s, size_t __slen) -{ - _RopeRep* __result; - if (0 == __r) - return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, - __r->get_allocator()); - size_t __count = __r->_M_refcount; - size_t __orig_size = __r->_M_size; - __stl_assert(__count >= 1); - if (__count > 1) return _S_concat_char_iter(__r, __s, __slen); - if (0 == __slen) { - __r->_M_refcount = 2; // One more than before - return __r; - } - if (__orig_size + __slen <= _S_copy_max && - _RopeRep::_S_leaf == __r->_M_tag) { - __result = _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen); - return __result; - } - if (_RopeRep::_S_concat == __r->_M_tag) { - _RopeLeaf* __right = (_RopeLeaf*)(((_RopeConcatenation*)__r)->_M_right); - if (_RopeRep::_S_leaf == __right->_M_tag - && __right->_M_size + __slen <= _S_copy_max) { - _RopeRep* __new_right = - _S_destr_leaf_concat_char_iter(__right, __s, __slen); - if (__right == __new_right) { - __stl_assert(__new_right->_M_refcount == 2); - __new_right->_M_refcount = 1; - } else { - __stl_assert(__new_right->_M_refcount >= 1); - __right->_M_unref_nonnil(); - } - __stl_assert(__r->_M_refcount == 1); - __r->_M_refcount = 2; // One more than before. - ((_RopeConcatenation*)__r)->_M_right = __new_right; - __r->_M_size = __orig_size + __slen; - if (0 != __r->_M_c_string) { - __r->_M_free_c_string(); - __r->_M_c_string = 0; - } - return __r; - } - } - _RopeRep* __right = - __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->get_allocator()); - __r->_M_ref_nonnil(); - __STL_TRY { - __result = _S_tree_concat(__r, __right); - } - __STL_UNWIND(_S_unref(__r); _S_unref(__right)) - __stl_assert(1 == __result->_M_refcount); - return __result; -} -#endif /* !__GC */ - -template -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 -rope<_CharT,_Alloc>::_RopeRep* -rope<_CharT,_Alloc>::_S_substring(_RopeRep* __base, - size_t __start, size_t __endp1) -{ - if (0 == __base) return 0; - size_t __len = __base->_M_size; - size_t __adj_endp1; - const size_t __lazy_threshold = 128; - - if (__endp1 >= __len) { - if (0 == __start) { - __base->_M_ref_nonnil(); - return __base; - } else { - __adj_endp1 = __len; - } - } else { - __adj_endp1 = __endp1; - } - switch(__base->_M_tag) { - case _RopeRep::_S_concat: - { - _RopeConcatenation* __c = (_RopeConcatenation*)__base; - _RopeRep* __left = __c->_M_left; - _RopeRep* __right = __c->_M_right; - size_t __left_len = __left->_M_size; - _RopeRep* __result; - - if (__adj_endp1 <= __left_len) { - return _S_substring(__left, __start, __endp1); - } else if (__start >= __left_len) { - return _S_substring(__right, __start - __left_len, - __adj_endp1 - __left_len); - } - _Self_destruct_ptr __left_result( - _S_substring(__left, __start, __left_len)); - _Self_destruct_ptr __right_result( - _S_substring(__right, 0, __endp1 - __left_len)); - __result = _S_concat(__left_result, __right_result); -# ifndef __GC - __stl_assert(1 == __result->_M_refcount); -# endif - return __result; - } - case _RopeRep::_S_leaf: - { - _RopeLeaf* __l = (_RopeLeaf*)__base; - _RopeLeaf* __result; - size_t __result_len; - if (__start >= __adj_endp1) return 0; - __result_len = __adj_endp1 - __start; - if (__result_len > __lazy_threshold) goto lazy; -# ifdef __GC - const _CharT* __section = __l->_M_data + __start; - __result = _S_new_RopeLeaf(__section, __result_len, - __base->get_allocator()); - __result->_M_c_string = 0; // Not eos terminated. -# else - // We should sometimes create substring node instead. - __result = __STL_ROPE_FROM_UNOWNED_CHAR_PTR( - __l->_M_data + __start, __result_len, - __base->get_allocator()); -# endif - return __result; - } - case _RopeRep::_S_substringfn: - // Avoid introducing multiple layers of substring nodes. - { - _RopeSubstring* __old = (_RopeSubstring*)__base; - size_t __result_len; - if (__start >= __adj_endp1) return 0; - __result_len = __adj_endp1 - __start; - if (__result_len > __lazy_threshold) { - _RopeSubstring* __result = - _S_new_RopeSubstring(__old->_M_base, - __start + __old->_M_start, - __adj_endp1 - __start, - __base->get_allocator()); - return __result; - - } // *** else fall through: *** - } - case _RopeRep::_S_function: - { - _RopeFunction* __f = (_RopeFunction*)__base; - _CharT* __section; - size_t __result_len; - if (__start >= __adj_endp1) return 0; - __result_len = __adj_endp1 - __start; - - if (__result_len > __lazy_threshold) goto lazy; - __section = (_CharT*) - _Data_allocate(_S_rounded_up_size(__result_len)); - __STL_TRY { - (*(__f->_M_fn))(__start, __result_len, __section); - } - __STL_UNWIND(_RopeRep::__STL_FREE_STRING( - __section, __result_len, __base->get_allocator())); - _S_cond_store_eos(__section[__result_len]); - return _S_new_RopeLeaf(__section, __result_len, - __base->get_allocator()); - } - } - /*NOTREACHED*/ - __stl_assert(false); - lazy: - { - // Create substring node. - return _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start, - __base->get_allocator()); - } -} - -template -class _Rope_flatten_char_consumer : public _Rope_char_consumer<_CharT> { - private: - _CharT* _M_buf_ptr; - public: - // _CharT* _M_buffer; // XXX not used - - _Rope_flatten_char_consumer(_CharT* __buffer) { - _M_buf_ptr = __buffer; - }; - ~_Rope_flatten_char_consumer() {} - bool operator() (const _CharT* __leaf, size_t __n) { - uninitialized_copy_n(__leaf, __n, _M_buf_ptr); - _M_buf_ptr += __n; - return true; - } -}; - -template -class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> { - private: - _CharT _M_pattern; - public: - size_t _M_count; // Number of nonmatching characters - _Rope_find_char_char_consumer(_CharT __p) - : _M_pattern(__p), _M_count(0) {} - ~_Rope_find_char_char_consumer() {} - bool operator() (const _CharT* __leaf, size_t __n) { - size_t __i; - for (__i = 0; __i < __n; __i++) { - if (__leaf[__i] == _M_pattern) { - _M_count += __i; return false; - } - } - _M_count += __n; return true; - } -}; - -template -class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> { - private: - typedef ostream _Insert_ostream; - _Insert_ostream& _M_o; - public: - // _CharT* buffer; // XXX not used - _Rope_insert_char_consumer(_Insert_ostream& __writer) - : _M_o(__writer) {}; - ~_Rope_insert_char_consumer() { }; - // Caller is presumed to own the ostream - bool operator() (const _CharT* __leaf, size_t __n); - // Returns true to continue traversal. -}; - -template -bool _Rope_insert_char_consumer<_CharT>::operator() - (const _CharT* __leaf, size_t __n) -{ - size_t __i; - // We assume that formatting is set up correctly for each element. - for (__i = 0; __i < __n; __i++) _M_o << __leaf[__i]; - return true; -} - -inline bool _Rope_insert_char_consumer::operator() - (const char* __leaf, size_t __n) -{ - size_t __i; - for (__i = 0; __i < __n; __i++) _M_o.put(__leaf[__i]); - return true; -} - -#if 0 -// I couldn't get this to work work with the VC++ version of basic_ostream. -// It also doesn't really do the right thing unless o is a wide stream. -// Given that wchar_t is often 4 bytes, its not clear to me how useful -// this stuff is anyway. -inline bool _Rope_insert_char_consumer::operator() - (const wchar_t* __leaf, size_t __n) -{ - size_t __i; - for (__i = 0; __i < __n; __i++) _M_o.put(__leaf[__i]); - return true; -} -#endif /* !_MSC_VER && !BORLAND */ - -template -bool rope<_CharT, _Alloc>::_S_apply_to_pieces( - _Rope_char_consumer<_CharT>& __c, - const _RopeRep* __r, - size_t __begin, size_t __end) -{ - if (0 == __r) return true; - switch(__r->_M_tag) { - case _RopeRep::_S_concat: - { - _RopeConcatenation* __conc = (_RopeConcatenation*)__r; - _RopeRep* __left = __conc->_M_left; - size_t __left_len = __left->_M_size; - if (__begin < __left_len) { - size_t __left_end = min(__left_len, __end); - if (!_S_apply_to_pieces(__c, __left, __begin, __left_end)) - return false; - } - if (__end > __left_len) { - _RopeRep* __right = __conc->_M_right; - size_t __right_start = max(__left_len, __begin); - if (!_S_apply_to_pieces(__c, __right, - __right_start - __left_len, - __end - __left_len)) { - return false; - } - } - } - return true; - case _RopeRep::_S_leaf: - { - _RopeLeaf* __l = (_RopeLeaf*)__r; - return __c(__l->_M_data + __begin, __end - __begin); - } - case _RopeRep::_S_function: - case _RopeRep::_S_substringfn: - { - _RopeFunction* __f = (_RopeFunction*)__r; - size_t __len = __end - __begin; - bool __result; - _CharT* __buffer = - (_CharT*)alloc::allocate(__len * sizeof(_CharT)); - __STL_TRY { - (*(__f->_M_fn))(__begin, __end, __buffer); - __result = __c(__buffer, __len); - alloc::deallocate(__buffer, __len * sizeof(_CharT)); - } - __STL_UNWIND((alloc::deallocate(__buffer, - __len * sizeof(_CharT)))) - return __result; - } - default: - __stl_assert(false); - /*NOTREACHED*/ - return false; - } -} - -inline void _Rope_fill(ostream& __o, size_t __n) -{ - char __f = __o.fill(); - size_t __i; - - for (__i = 0; __i < __n; __i++) __o.put(__f); -} - - -template inline bool _Rope_is_simple(_CharT*) { return false; } -inline bool _Rope_is_simple(char*) { return true; } -inline bool _Rope_is_simple(wchar_t*) { return true; } - - -template -ostream& operator<< (ostream& __o, const rope<_CharT, _Alloc>& __r) -{ - size_t __w = __o.width(); - bool __left = bool(__o.flags() & ios::left); - size_t __pad_len; - size_t __rope_len = __r.size(); - _Rope_insert_char_consumer<_CharT> __c(__o); - bool __is_simple = _Rope_is_simple((_CharT*)0); - - if (__rope_len < __w) { - __pad_len = __w - __rope_len; - } else { - __pad_len = 0; - } - if (!__is_simple) __o.width(__w/__rope_len); - __STL_TRY { - if (__is_simple && !__left && __pad_len > 0) { - _Rope_fill(__o, __pad_len); - } - __r.apply_to_pieces(0, __r.size(), __c); - if (__is_simple && __left && __pad_len > 0) { - _Rope_fill(__o, __pad_len); - } - if (!__is_simple) - __o.width(__w); - } - __STL_UNWIND(if (!__is_simple) __o.width(__w)) - return __o; -} - -template -_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 -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 -_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 -void -rope<_CharT,_Alloc>::_S_dump(_RopeRep* __r, int __indent) -{ - for (int __i = 0; __i < __indent; __i++) putchar(' '); - if (0 == __r) { - printf("NULL\n"); return; - } - if (_RopeRep::_S_concat == __r->_M_tag) { - _RopeConcatenation* __c = (_RopeConcatenation*)__r; - _RopeRep* __left = __c->_M_left; - _RopeRep* __right = __c->_M_right; - -# ifdef __GC - printf("Concatenation %p (depth = %d, len = %ld, %s balanced)\n", - __r, __r->_M_depth, __r->_M_size, __r->_M_is_balanced? "" : "not"); -# else - printf("Concatenation %p (rc = %ld, depth = %d, " - "len = %ld, %s balanced)\n", - __r, __r->_M_refcount, __r->_M_depth, __r->_M_size, - __r->_M_is_balanced? "" : "not"); -# endif - _S_dump(__left, __indent + 2); - _S_dump(__right, __indent + 2); - return; - } else { - char* __kind; - - switch (__r->_M_tag) { - case _RopeRep::_S_leaf: - __kind = "Leaf"; - break; - case _RopeRep::_S_function: - __kind = "Function"; - break; - case _RopeRep::_S_substringfn: - __kind = "Function representing substring"; - break; - default: - __kind = "(corrupted kind field!)"; - } -# ifdef __GC - printf("%s %p (depth = %d, len = %ld) ", - __kind, __r, __r->_M_depth, __r->_M_size); -# else - printf("%s %p (rc = %ld, depth = %d, len = %ld) ", - __kind, __r, __r->_M_refcount, __r->_M_depth, __r->_M_size); -# endif - if (_S_is_one_byte_char_type((_CharT*)0)) { - const int __max_len = 40; - _Self_destruct_ptr __prefix(_S_substring(__r, 0, __max_len)); - _CharT __buffer[__max_len + 1]; - bool __too_big = __r->_M_size > __prefix->_M_size; - - _S_flatten(__prefix, __buffer); - __buffer[__prefix->_M_size] = _S_eos((_CharT*)0); - printf("%s%s\n", - (char*)__buffer, __too_big? "...\n" : "\n"); - } else { - printf("\n"); - } - } -} - -template -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 -rope<_CharT,_Alloc>::_RopeRep* -rope<_CharT,_Alloc>::_S_balance(_RopeRep* __r) -{ - _RopeRep* __forest[_RopeRep::_S_max_rope_depth + 1]; - _RopeRep* __result = 0; - int __i; - // Invariant: - // The concatenation of forest in descending order is equal to __r. - // __forest[__i]._M_size >= _S_min_len[__i] - // __forest[__i]._M_depth = __i - // References from forest are included in refcount. - - for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i) - __forest[__i] = 0; - __STL_TRY { - _S_add_to_forest(__r, __forest); - for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i) - if (0 != __forest[__i]) { -# ifndef __GC - _Self_destruct_ptr __old(__result); -# endif - __result = _S_concat(__forest[__i], __result); - __forest[__i]->_M_unref_nonnil(); -# if !defined(__GC) && defined(__STL_USE_EXCEPTIONS) - __forest[__i] = 0; -# endif - } - } - __STL_UNWIND(for(__i = 0; __i <= _RopeRep::_S_max_rope_depth; __i++) - _S_unref(__forest[__i])) - if (__result->_M_depth > _RopeRep::_S_max_rope_depth) abort(); - return(__result); -} - - -template -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 -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 -_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 -_CharT* -rope<_CharT,_Alloc>::_S_fetch_ptr(_RopeRep* __r, size_type __i) -{ - _RopeRep* __clrstack[_RopeRep::_S_max_rope_depth]; - size_t __csptr = 0; - - for(;;) { - if (__r->_M_refcount > 1) return 0; - switch(__r->_M_tag) { - case _RopeRep::_S_concat: - { - _RopeConcatenation* __c = (_RopeConcatenation*)__r; - _RopeRep* __left = __c->_M_left; - size_t __left_len = __left->_M_size; - - if (__c->_M_c_string != 0) __clrstack[__csptr++] = __c; - if (__i >= __left_len) { - __i -= __left_len; - __r = __c->_M_right; - } else { - __r = __left; - } - } - break; - case _RopeRep::_S_leaf: - { - _RopeLeaf* __l = (_RopeLeaf*)__r; - if (__l->_M_c_string != __l->_M_data && __l->_M_c_string != 0) - __clrstack[__csptr++] = __l; - while (__csptr > 0) { - -- __csptr; - _RopeRep* __d = __clrstack[__csptr]; - __d->_M_free_c_string(); - __d->_M_c_string = 0; - } - return __l->_M_data + __i; - } - case _RopeRep::_S_function: - case _RopeRep::_S_substringfn: - return 0; - } - } -} -# endif /* __GC */ - -// The following could be implemented trivially using -// lexicographical_compare_3way. -// We do a little more work to avoid dealing with rope iterators for -// flat strings. -template -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 -_Rope_char_ref_proxy<_CharT, _Alloc>& -_Rope_char_ref_proxy<_CharT, _Alloc>::operator= (_CharT __c) { - _RopeRep* __old = _M_root->_M_tree_ptr; -# ifndef __GC - // First check for the case in which everything is uniquely - // referenced. In that case we can do this destructively. - _CharT* __ptr = _My_rope::_S_fetch_ptr(__old, _M_pos); - if (0 != __ptr) { - *__ptr = __c; - return *this; - } -# endif - _Self_destruct_ptr __left( - _My_rope::_S_substring(__old, 0, _M_pos)); - _Self_destruct_ptr __right( - _My_rope::_S_substring(__old, _M_pos+1, __old->_M_size)); - _Self_destruct_ptr __result_left( - _My_rope::_S_destr_concat_char_iter(__left, &__c, 1)); - -# ifndef __GC - __stl_assert(__left == __result_left || 1 == __result_left->_M_refcount); -# endif - _RopeRep* __result = - _My_rope::_S_concat(__result_left, __right); -# ifndef __GC - __stl_assert(1 <= __result->_M_refcount); - _RopeRep::_S_unref(__old); -# endif - _M_root->_M_tree_ptr = __result; - return *this; -} - -template -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 -_Rope_char_ptr_proxy<_CharT, _Alloc> -_Rope_char_ref_proxy<_CharT, _Alloc>::operator& () const { - return _Rope_char_ptr_proxy<_CharT, _Alloc>(*this); -} - -template -rope<_CharT, _Alloc>::rope(size_t __n, _CharT __c, - const allocator_type& __a) -: _Base(__a) -{ - rope<_CharT,_Alloc> __result; - const size_t __exponentiate_threshold = 32; - size_t __exponent; - size_t __rest; - _CharT* __rest_buffer; - _RopeRep* __remainder; - rope<_CharT,_Alloc> __remainder_rope; - - if (0 == __n) - return; - - __exponent = __n / __exponentiate_threshold; - __rest = __n % __exponentiate_threshold; - if (0 == __rest) { - __remainder = 0; - } else { - __rest_buffer = _Data_allocate(_S_rounded_up_size(__rest)); - uninitialized_fill_n(__rest_buffer, __rest, __c); - _S_cond_store_eos(__rest_buffer[__rest]); - __STL_TRY { - __remainder = _S_new_RopeLeaf(__rest_buffer, __rest, __a); - } - __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__rest_buffer, __rest, __a)) - } - __remainder_rope._M_tree_ptr = __remainder; - if (__exponent != 0) { - _CharT* __base_buffer = - _Data_allocate(_S_rounded_up_size(__exponentiate_threshold)); - _RopeLeaf* __base_leaf; - rope __base_rope; - uninitialized_fill_n(__base_buffer, __exponentiate_threshold, __c); - _S_cond_store_eos(__base_buffer[__exponentiate_threshold]); - __STL_TRY { - __base_leaf = _S_new_RopeLeaf(__base_buffer, - __exponentiate_threshold, __a); - } - __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__base_buffer, - __exponentiate_threshold, __a)) - __base_rope._M_tree_ptr = __base_leaf; - if (1 == __exponent) { - __result = __base_rope; -# ifndef __GC - __stl_assert(2 == __result._M_tree_ptr->_M_refcount); - // One each for base_rope and __result -# endif - } else { - // XXX what is power()? - __result = power(__base_rope, __exponent, _Concat_fn()); - } - if (0 != __remainder) { - __result += __remainder_rope; - } - } else { - __result = __remainder_rope; - } - _M_tree_ptr = __result._M_tree_ptr; - _M_tree_ptr->_M_ref_nonnil(); -} - -template - _CharT rope<_CharT,_Alloc>::_S_empty_c_str[1]; - -# ifdef __STL_PTHREADS - template - pthread_mutex_t - rope<_CharT,_Alloc>::_S_swap_lock = PTHREAD_MUTEX_INITIALIZER; -# endif - -template -const _CharT* rope<_CharT,_Alloc>::c_str() const { - if (0 == _M_tree_ptr) { - _S_empty_c_str[0] = _S_eos((_CharT*)0); // Possibly redundant, - // but probably fast. - return _S_empty_c_str; - } - __GC_CONST _CharT* __old_c_string = _M_tree_ptr->_M_c_string; - if (0 != __old_c_string) return(__old_c_string); - size_t __s = size(); - _CharT* __result = _Data_allocate(__s + 1); - _S_flatten(_M_tree_ptr, __result); - __result[__s] = _S_eos((_CharT*)0); -# ifdef __GC - _M_tree_ptr->_M_c_string = __result; -# else - if ((__old_c_string = - _S_atomic_swap(&(_M_tree_ptr->_M_c_string), __result)) != 0) { - // It must have been added in the interim. Hence it had to have been - // separately allocated. Deallocate the old copy, since we just - // replaced it. - destroy(__old_c_string, __old_c_string + __s + 1); - _Data_deallocate(__old_c_string, __s + 1); - } -# endif - return(__result); -} - -template -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 -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 __first, - _Rope_iterator __middle, - _Rope_iterator __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 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 __first, - _Rope_iterator __middle, - _Rope_iterator __last) { - _Rope_rotate(__first, __middle, __last); -} -# endif -#endif /* _MSC_VER */ - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#endif - -__STL_END_NAMESPACE - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/set b/contrib/libstdc++/stl/set deleted file mode 100644 index c836c4596d..0000000000 --- a/contrib/libstdc++/stl/set +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_SET -#define __SGI_STL_SET - -#ifndef __SGI_STL_INTERNAL_TREE_H -#include -#endif -#include -#include - -#endif /* __SGI_STL_SET */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/set.h b/contrib/libstdc++/stl/set.h deleted file mode 100644 index 9004d2e047..0000000000 --- a/contrib/libstdc++/stl/set.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_SET_H -#define __SGI_STL_SET_H - -#include -#include - -#ifdef __STL_USE_NAMESPACES -using __STD::set; -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_SET_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/slist b/contrib/libstdc++/stl/slist deleted file mode 100644 index c3ec74204c..0000000000 --- a/contrib/libstdc++/stl/slist +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef __SGI_STL_SLIST -#define __SGI_STL_SLIST - -#include -#include -#include -#include -#include - -#endif /* __SGI_STL_SLIST */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/slist.h b/contrib/libstdc++/stl/slist.h deleted file mode 100644 index d2377b0cf5..0000000000 --- a/contrib/libstdc++/stl/slist.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef __SGI_STL_SLIST_H -#define __SGI_STL_SLIST_H - -#include -#include -#include - -#ifdef __STL_USE_NAMESPACES -using __STD::slist; -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_SLIST_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stack b/contrib/libstdc++/stl/stack deleted file mode 100644 index 36461d95b8..0000000000 --- a/contrib/libstdc++/stl/stack +++ /dev/null @@ -1,41 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_STACK -#define __SGI_STL_STACK - -#include -#include -#include -#include -#include -#include - -#endif /* __SGI_STL_STACK */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stack.h b/contrib/libstdc++/stl/stack.h deleted file mode 100644 index 89beca82f1..0000000000 --- a/contrib/libstdc++/stl/stack.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_STACK_H -#define __SGI_STL_STACK_H - -#include -#include -#include -#include -#include - -#ifdef __STL_USE_NAMESPACES -using __STD::stack; -using __STD::queue; -using __STD::priority_queue; -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_STACK_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_algo.h b/contrib/libstdc++/stl/stl_algo.h deleted file mode 100644 index e9beaee15f..0000000000 --- a/contrib/libstdc++/stl/stl_algo.h +++ /dev/null @@ -1,2894 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_ALGO_H -#define __SGI_STL_INTERNAL_ALGO_H - -#include - -__STL_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 -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 -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 -_Function for_each(_InputIter __first, _InputIter __last, _Function __f) { - for ( ; __first != __last; ++__first) - __f(*__first); - return __f; -} - -// find and find_if. - -template -inline _InputIter find(_InputIter __first, _InputIter __last, - const _Tp& __val, - input_iterator_tag) -{ - while (__first != __last && *__first != __val) - ++__first; - return __first; -} - -template -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 -_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 -_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 -inline _InputIter find(_InputIter __first, _InputIter __last, - const _Tp& __val) -{ - return find(__first, __last, __val, __ITERATOR_CATEGORY(__first)); -} - -template -inline _InputIter find_if(_InputIter __first, _InputIter __last, - _Predicate __pred) { - return find_if(__first, __last, __pred, __ITERATOR_CATEGORY(__first)); -} - -// adjacent_find. - -template -_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 -_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 -void count(_InputIter __first, _InputIter __last, const _Tp& __value, - _Size& __n) { - for ( ; __first != __last; ++__first) - if (*__first == __value) - ++__n; -} - -template -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 -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 -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 -_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 -_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, - _ForwardIter2 __first2, _ForwardIter2 __last2, - _BinaryPred __predicate) -{ - // Test for empty ranges - if (__first1 == __last1 || __first2 == __last2) - return __first1; - - // Test for a pattern of length 1. - _ForwardIter2 __tmp(__first2); - ++__tmp; - if (__tmp == __last2) - return find(__first1, __last1, *__first2); - - // General case. - - _ForwardIter2 __p1, __p; - - __p1 = __first2; ++__p1; - - _ForwardIter1 __current = __first1; - - while (__first1 != __last1) { - while (__first1 != __last1) { - if (__predicate(*__first1, *__first2)) - break; - ++__first1; - } - while (__first1 != __last1 && !__predicate(*__first1, *__first2)) - ++__first1; - if (__first1 == __last1) - return __last1; - - __p = __p1; - __current = __first1; - if (++__current == __last1) return __last1; - - while (__predicate(*__current, *__p)) { - if (++__p == __last2) - return __first1; - if (++__current == __last1) - return __last1; - } - - ++__first1; - } - return __first1; -} - -// search_n. Search for __count consecutive copies of __val. - -template -_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 -_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 -_ForwardIter2 swap_ranges(_ForwardIter1 __first1, _ForwardIter1 __last1, - _ForwardIter2 __first2) { - for ( ; __first1 != __last1; ++__first1, ++__first2) - iter_swap(__first1, __first2); - return __first2; -} - -// transform - -template -_OutputIter transform(_InputIter __first, _InputIter __last, - _OutputIter __result, _UnaryOperation __oper) { - for ( ; __first != __last; ++__first, ++__result) - *__result = __oper(*__first); - return __result; -} - -template -_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 -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 -void replace_if(_ForwardIter __first, _ForwardIter __last, - _Predicate __pred, const _Tp& __new_value) { - for ( ; __first != __last; ++__first) - if (__pred(*__first)) - *__first = __new_value; -} - -template -_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 -_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 -void generate(_ForwardIter __first, _ForwardIter __last, _Generator __gen) { - for ( ; __first != __last; ++__first) - *__first = __gen(); -} - -template -_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 -_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 -_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 -_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 -_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 -_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 -inline _OutputIter __unique_copy(_InputIter __first, _InputIter __last, - _OutputIter __result, - output_iterator_tag) { - return __unique_copy(__first, __last, __result, __VALUE_TYPE(__first)); -} - -template -_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 -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 -_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 -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 -_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 -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 -_ForwardIter unique(_ForwardIter __first, _ForwardIter __last) { - __first = adjacent_find(__first, __last); - return unique_copy(__first, __last, __first); -} - -template -_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 -void __reverse(_BidirectionalIter __first, _BidirectionalIter __last, - bidirectional_iterator_tag) { - while (true) - if (__first == __last || __first == --__last) - return; - else - iter_swap(__first++, __last); -} - -template -void __reverse(_RandomAccessIter __first, _RandomAccessIter __last, - random_access_iterator_tag) { - while (__first < __last) - iter_swap(__first++, --__last); -} - -template -inline void reverse(_BidirectionalIter __first, _BidirectionalIter __last) { - __reverse(__first, __last, __ITERATOR_CATEGORY(__first)); -} - -template -_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 -_EuclideanRingElement __gcd(_EuclideanRingElement __m, - _EuclideanRingElement __n) -{ - while (__n != 0) { - _EuclideanRingElement __t = __m % __n; - __m = __n; - __n = __t; - } - return __m; -} - -template -_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 -_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 -_RandomAccessIter __rotate(_RandomAccessIter __first, - _RandomAccessIter __middle, - _RandomAccessIter __last, - _Distance *, _Tp *) { - - _Distance __n = __last - __first; - _Distance __k = __middle - __first; - _Distance __l = __n - __k; - _RandomAccessIter __result = __first + (__last - __middle); - - if (__k == __l) { - swap_ranges(__first, __middle, __middle); - return __result; - } - - _Distance __d = __gcd(__n, __k); - - for (_Distance __i = 0; __i < __d; __i++) { - _Tp __tmp = *__first; - _RandomAccessIter __p = __first; - - if (__k < __l) { - for (_Distance __j = 0; __j < __l/__d; __j++) { - if (__p > __first + __l) { - *__p = *(__p - __l); - __p -= __l; - } - - *__p = *(__p + __k); - __p += __k; - } - } - - else { - for (_Distance __j = 0; __j < __k/__d - 1; __j ++) { - if (__p < __last - __k) { - *__p = *(__p + __k); - __p += __k; - } - - *__p = * (__p - __l); - __p -= __l; - } - } - - *__p = __tmp; - ++__first; - } - - return __result; -} - -template -inline _ForwardIter rotate(_ForwardIter __first, _ForwardIter __middle, - _ForwardIter __last) { - return __rotate(__first, __middle, __last, - __DISTANCE_TYPE(__first), - __ITERATOR_CATEGORY(__first)); -} - -template -_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 -inline _Distance __random_number(_Distance __n) { -#ifdef __STL_NO_DRAND48 - return rand() % __n; -#else - return lrand48() % __n; -#endif -} - -// random_shuffle - -template -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 -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 -_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 -_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 -_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 -_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 -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 -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 -_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 -_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 -inline _ForwardIter partition(_ForwardIter __first, - _ForwardIter __last, - _Predicate __pred) { - return __partition(__first, __last, __pred, __ITERATOR_CATEGORY(__first)); -} - - -template -_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 -_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 -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 -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 -_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 -_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 -void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val) { - _RandomAccessIter __next = __last; - --__next; - while (__val < *__next) { - *__last = *__next; - __last = __next; - --__next; - } - *__last = __val; -} - -template -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 -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 -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 -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 -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 -void __unguarded_insertion_sort_aux(_RandomAccessIter __first, - _RandomAccessIter __last, _Tp*) { - for (_RandomAccessIter __i = __first; __i != __last; ++__i) - __unguarded_linear_insert(__i, _Tp(*__i)); -} - -template -inline void __unguarded_insertion_sort(_RandomAccessIter __first, - _RandomAccessIter __last) { - __unguarded_insertion_sort_aux(__first, __last, __VALUE_TYPE(__first)); -} - -template -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 -inline void __unguarded_insertion_sort(_RandomAccessIter __first, - _RandomAccessIter __last, - _Compare __comp) { - __unguarded_insertion_sort_aux(__first, __last, __VALUE_TYPE(__first), - __comp); -} - -template -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 -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 -inline _Size __lg(_Size __n) { - _Size __k; - for (__k = 0; __n != 1; __n >>= 1) ++__k; - return __k; -} - -template -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -inline void stable_sort(_RandomAccessIter __first, - _RandomAccessIter __last) { - __stable_sort_aux(__first, __last, - __VALUE_TYPE(__first), - __DISTANCE_TYPE(__first)); -} - -template -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 -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 -inline void partial_sort(_RandomAccessIter __first, - _RandomAccessIter __middle, - _RandomAccessIter __last) { - __partial_sort(__first, __middle, __last, __VALUE_TYPE(__first)); -} - -template -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 -inline void partial_sort(_RandomAccessIter __first, - _RandomAccessIter __middle, - _RandomAccessIter __last, _Compare __comp) { - __partial_sort(__first, __middle, __last, __VALUE_TYPE(__first), __comp); -} - -template -_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 -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 -_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 -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 -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 -inline void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, - _RandomAccessIter __last) { - __nth_element(__first, __nth, __last, __VALUE_TYPE(__first)); -} - -template -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 -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 -_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 -inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val) { - return __lower_bound(__first, __last, __val, - __DISTANCE_TYPE(__first)); -} - -template -_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 -inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val, _Compare __comp) { - return __lower_bound(__first, __last, __val, __comp, - __DISTANCE_TYPE(__first)); -} - -template -_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 -inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val) { - return __upper_bound(__first, __last, __val, - __DISTANCE_TYPE(__first)); -} - -template -_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 -inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val, _Compare __comp) { - return __upper_bound(__first, __last, __val, __comp, - __DISTANCE_TYPE(__first)); -} - -template -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 -inline pair<_ForwardIter, _ForwardIter> -equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) { - return __equal_range(__first, __last, __val, - __DISTANCE_TYPE(__first)); -} - -template -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 -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 -bool binary_search(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val) { - _ForwardIter __i = lower_bound(__first, __last, __val); - return __i != __last && !(__val < *__i); -} - -template -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 -_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 -_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 -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 -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 -_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 -_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 -_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 -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 -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 -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 -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 -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 -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 -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 -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 -_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 -_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 -_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 -_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 -_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 -_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 -_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 -_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 -_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 -_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 -_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 -_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 -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 -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 -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 -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 -_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 -_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 -_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 -_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 -_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 -_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 -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 -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 -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 -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 -inline bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last) -{ - return __is_heap(__first, __last - __first); -} - - -template -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 -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 -bool is_sorted(_ForwardIter __first, _ForwardIter __last, - _StrictWeakOrdering __comp) -{ - if (__first == __last) - return true; - - _ForwardIter __next = __first; - for (++__next; __next != __last; __first = __next, ++__next) { - if (__comp(*__next, *__first)) - return false; - } - - return true; -} - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1209 -#endif - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_ALGO_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_algobase.h b/contrib/libstdc++/stl/stl_algobase.h deleted file mode 100644 index 15e535f483..0000000000 --- a/contrib/libstdc++/stl/stl_algobase.h +++ /dev/null @@ -1,526 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - - -#ifndef __SGI_STL_INTERNAL_ALGOBASE_H -#define __SGI_STL_INTERNAL_ALGOBASE_H - -#ifndef __STL_CONFIG_H -#include -#endif -#ifndef __SGI_STL_INTERNAL_RELOPS -#include -#endif -#ifndef __SGI_STL_INTERNAL_PAIR_H -#include -#endif -#ifndef __TYPE_TRAITS_H_ -#include -#endif - -#include -#include -#include -#include -#include -#include - -#ifndef __SGI_STL_INTERNAL_ITERATOR_H -#include -#endif - -__STL_BEGIN_NAMESPACE - -// swap and iter_swap - -template -inline void __iter_swap(_ForwardIter1 __a, _ForwardIter2 __b, _Tp*) { - _Tp __tmp = *__a; - *__a = *__b; - *__b = __tmp; -} - -template -inline void iter_swap(_ForwardIter1 __a, _ForwardIter2 __b) { - __iter_swap(__a, __b, __VALUE_TYPE(__a)); -} - -template -inline void swap(_Tp& __a, _Tp& __b) { - _Tp __tmp = __a; - __a = __b; - __b = __tmp; -} - -//-------------------------------------------------- -// min and max - -#ifndef __BORLANDC__ - -#undef min -#undef max - -template -inline const _Tp& min(const _Tp& __a, const _Tp& __b) { - return __b < __a ? __b : __a; -} - -template -inline const _Tp& max(const _Tp& __a, const _Tp& __b) { - return __a < __b ? __b : __a; -} - -#endif /* __BORLANDC__ */ - -template -inline const _Tp& min(const _Tp& __a, const _Tp& __b, _Compare __comp) { - return __comp(__b, __a) ? __b : __a; -} - -template -inline const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) { - return __comp(__a, __b) ? __b : __a; -} - -//-------------------------------------------------- -// copy - -// All of these auxiliary functions serve two purposes. (1) Replace -// calls to copy with memmove whenever possible. (Memmove, not memcpy, -// because the input and output ranges are permitted to overlap.) -// (2) If we're using random access iterators, then write the loop as -// a for loop with an explicit count. The auxiliary class __copy_dispatch -// is a workaround for compilers that don't support partial ordering of -// function templates. - -template -inline _OutputIter __copy(_InputIter __first, _InputIter __last, - _OutputIter __result, - input_iterator_tag, _Distance*) -{ - for ( ; __first != __last; ++__result, ++__first) - *__result = *__first; - return __result; -} - -template -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 -inline _Tp* -__copy_trivial(const _Tp* __first, const _Tp* __last, _Tp* __result) { - memmove(__result, __first, sizeof(_Tp) * (__last - __first)); - return __result + (__last - __first); -} - -#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION - -template -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 -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 -struct __copy_dispatch -{ - static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) { - return __copy_trivial(__first, __last, __result); - } -}; - -template -inline _OutputIter copy(_InputIter __first, _InputIter __last, - _OutputIter __result) { - typedef typename iterator_traits<_InputIter>::value_type _Tp; - typedef typename __type_traits<_Tp>::has_trivial_assignment_operator - _Trivial; - return __copy_dispatch<_InputIter, _OutputIter, _Trivial> - ::copy(__first, __last, __result); -} - -#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - -template -inline _OutputIter copy(_InputIter __first, _InputIter __last, - _OutputIter __result) -{ - return __copy(__first, __last, __result, - __ITERATOR_CATEGORY(__first), - __DISTANCE_TYPE(__first)); -} - -inline char* copy(const char* __first, const char* __last, char* __result) { - memmove(__result, __first, __last - __first); - return __result + (__last - __first); -} - -inline wchar_t* copy(const wchar_t* __first, const wchar_t* __last, - wchar_t* __result) { - memmove(__result, __first, sizeof(wchar_t) * (__last - __first)); - return __result + (__last - __first); -} - -#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - -//-------------------------------------------------- -// copy_backward - -template -inline _BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first, - _BidirectionalIter1 __last, - _BidirectionalIter2 __result, - bidirectional_iterator_tag, - _Distance*) -{ - while (__first != __last) - *--__result = *--__last; - return __result; -} - -template -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 -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 -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 -struct __copy_backward_dispatch -{ - static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) { - return __copy_backward_dispatch<_Tp*, _Tp*, __true_type> - ::copy(__first, __last, __result); - } -}; - -template -inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) { - typedef typename __type_traits::value_type> - ::has_trivial_assignment_operator - _Trivial; - return __copy_backward_dispatch<_BI1, _BI2, _Trivial> - ::copy(__first, __last, __result); -} - -#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - -template -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 -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 -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 -inline pair<_InputIter, _OutputIter> -__copy_n(_InputIter __first, _Size __count, _OutputIter __result) { - return __copy_n(__first, __count, __result, - __ITERATOR_CATEGORY(__first)); -} - -template -inline pair<_InputIter, _OutputIter> -copy_n(_InputIter __first, _Size __count, _OutputIter __result) { - return __copy_n(__first, __count, __result); -} - -//-------------------------------------------------- -// fill and fill_n - - -template -void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __value) { - for ( ; __first != __last; ++__first) - *__first = __value; -} - -template -_OutputIter fill_n(_OutputIter __first, _Size __n, const _Tp& __value) { - for ( ; __n > 0; --__n, ++__first) - *__first = __value; - return __first; -} - -//-------------------------------------------------- -// equal and mismatch - -template -pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1, - _InputIter1 __last1, - _InputIter2 __first2) { - while (__first1 != __last1 && *__first1 == *__first2) { - ++__first1; - ++__first2; - } - return pair<_InputIter1, _InputIter2>(__first1, __first2); -} - -template -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 -inline bool equal(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2) { - for ( ; __first1 != __last1; ++__first1, ++__first2) - if (*__first1 != *__first2) - return false; - return true; -} - -template -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 -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 -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 -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 -int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2) -{ - return __lexicographical_compare_3way(__first1, __last1, __first2, __last2); -} - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_ALGOBASE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_alloc.h b/contrib/libstdc++/stl/stl_alloc.h deleted file mode 100644 index 208309a389..0000000000 --- a/contrib/libstdc++/stl/stl_alloc.h +++ /dev/null @@ -1,1057 +0,0 @@ -/* - * Copyright (c) 1996-1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_ALLOC_H -#define __SGI_STL_INTERNAL_ALLOC_H - -#ifdef __SUNPRO_CC -# define __PRIVATE public - // Extra access restrictions prevent us from really making some things - // private. -#else -# define __PRIVATE private -#endif - -#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG -# define __USE_MALLOC -#endif - - -// This implements some standard node allocators. These are -// NOT the same as the allocators in the C++ draft standard or in -// in the original STL. They do not encapsulate different pointer -// types; indeed we assume that there is only one pointer type. -// The allocation primitives are intended to allocate individual objects, -// not larger arenas as with the original STL allocators. - -#if 0 -# include -# define __THROW_BAD_ALLOC throw bad_alloc() -#elif !defined(__THROW_BAD_ALLOC) -# include -# define __THROW_BAD_ALLOC cerr << "out of memory" << endl; exit(1) -#endif - -#ifdef __STL_WIN32THREADS -# include -#endif - -#include -#include -#include -#include -#ifndef __RESTRICT -# define __RESTRICT -#endif - -#if !defined(__STL_PTHREADS) && !defined(__STL_SOLTHREADS) \ - && !defined(_NOTHREADS) \ - && !defined(__STL_SGI_THREADS) && !defined(__STL_WIN32THREADS) -# define _NOTHREADS -#endif - -# ifdef __STL_PTHREADS - // POSIX Threads - // This is dubious, since this is likely to be a high contention - // lock. Performance may not be adequate. -# include -# define __NODE_ALLOCATOR_LOCK \ - if (threads) pthread_mutex_lock(&_S_node_allocator_lock) -# define __NODE_ALLOCATOR_UNLOCK \ - if (threads) pthread_mutex_unlock(&_S_node_allocator_lock) -# define __NODE_ALLOCATOR_THREADS true -# define __VOLATILE volatile // Needed at -O3 on SGI -# endif -# ifdef __STL_SOLTHREADS -# include -# define __NODE_ALLOCATOR_LOCK \ - if (threads) mutex_lock(&_S_node_allocator_lock) -# define __NODE_ALLOCATOR_UNLOCK \ - if (threads) mutex_unlock(&_S_node_allocator_lock) -# define __NODE_ALLOCATOR_THREADS true -# define __VOLATILE -# endif -# ifdef __STL_WIN32THREADS - // The lock needs to be initialized by constructing an allocator - // objects of the right type. We do that here explicitly for alloc. -# define __NODE_ALLOCATOR_LOCK \ - EnterCriticalSection(&_S_node_allocator_lock) -# define __NODE_ALLOCATOR_UNLOCK \ - LeaveCriticalSection(&_S_node_allocator_lock) -# define __NODE_ALLOCATOR_THREADS true -# define __VOLATILE volatile // may not be needed -# endif /* WIN32THREADS */ -# ifdef __STL_SGI_THREADS - // This should work without threads, with sproc threads, or with - // pthreads. It is suboptimal in all cases. - // It is unlikely to even compile on nonSGI machines. - - extern "C" { - extern int __us_rsthread_malloc; - } - // The above is copied from malloc.h. Including - // would be cleaner but fails with certain levels of standard - // conformance. -# define __NODE_ALLOCATOR_LOCK if (threads && __us_rsthread_malloc) \ - { _S_lock(&_S_node_allocator_lock); } -# define __NODE_ALLOCATOR_UNLOCK if (threads && __us_rsthread_malloc) \ - { _S_unlock(&_S_node_allocator_lock); } -# define __NODE_ALLOCATOR_THREADS true -# define __VOLATILE volatile // Needed at -O3 on SGI -# endif -# ifdef _NOTHREADS -// Thread-unsafe -# define __NODE_ALLOCATOR_LOCK -# define __NODE_ALLOCATOR_UNLOCK -# define __NODE_ALLOCATOR_THREADS false -# define __VOLATILE -# endif - -__STL_BEGIN_NAMESPACE - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1174 -#endif - -// Malloc-based allocator. Typically slower than default alloc below. -// Typically thread-safe and more storage efficient. -#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG -# ifdef __DECLARE_GLOBALS_HERE - void (* __malloc_alloc_oom_handler)() = 0; - // g++ 2.7.2 does not handle static template data members. -# else - extern void (* __malloc_alloc_oom_handler)(); -# endif -#endif - -template -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 -void (* __malloc_alloc_template<__inst>::__malloc_alloc_oom_handler)() = 0; -#endif - -template -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 -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 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 debug_alloc { - -private: - - enum {_S_extra = 8}; // Size of space used to store size. Note - // that this must be large enough to preserve - // alignment. - -public: - - static void* allocate(size_t __n) - { - char* __result = (char*)_Alloc::allocate(__n + _S_extra); - *(size_t*)__result = __n; - return __result + _S_extra; - } - - static void deallocate(void* __p, size_t __n) - { - char* __real_p = (char*)__p - _S_extra; - assert(*(size_t*)__real_p == __n); - _Alloc::deallocate(__real_p, __n + _S_extra); - } - - static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz) - { - char* __real_p = (char*)__p - _S_extra; - assert(*(size_t*)__real_p == __old_sz); - char* __result = (char*) - _Alloc::reallocate(__real_p, __old_sz + _S_extra, __new_sz + _S_extra); - *(size_t*)__result = __new_sz; - return __result + _S_extra; - } - -}; - - -# ifdef __USE_MALLOC - -typedef malloc_alloc alloc; -typedef malloc_alloc single_client_alloc; - -# else - - -// Default node allocator. -// With a reasonable compiler, this should be roughly as fast as the -// original STL class-specific allocators, but with less fragmentation. -// Default_alloc_template parameters are experimental and MAY -// DISAPPEAR in the future. Clients should just use alloc for now. -// -// Important implementation properties: -// 1. If the client request an object of size > _MAX_BYTES, the resulting -// object will be obtained directly from malloc. -// 2. In all other cases, we allocate an object of size exactly -// _S_round_up(requested_size). Thus the client has enough size -// information that we can return the object to the proper free list -// without permanently losing part of the object. -// - -// The first template parameter specifies whether more than one thread -// may use this allocator. It is safe to allocate an object from -// one instance of a default_alloc and deallocate it with another -// one. This effectively transfers its ownership to the second one. -// This may have undesirable effects on reference locality. -// The second parameter is unreferenced and serves only to allow the -// creation of multiple default_alloc instances. -// Node that containers built on different allocator instances have -// different types, limiting the utility of this approach. -#ifdef __SUNPRO_CC -// breaks if we make these template class members: - enum {_ALIGN = 8}; - enum {_MAX_BYTES = 128}; - enum {_NFREELISTS = _MAX_BYTES/_ALIGN}; -#endif - -template -class __default_alloc_template { - -private: - // Really we should use static const int x = N - // instead of enum { x = N }, but few compilers accept the former. -# ifndef __SUNPRO_CC - enum {_ALIGN = 8}; - enum {_MAX_BYTES = 128}; - enum {_NFREELISTS = _MAX_BYTES/_ALIGN}; -# endif - static size_t - _S_round_up(size_t __bytes) - { return (((__bytes) + _ALIGN-1) & ~(_ALIGN - 1)); } - -__PRIVATE: - union _Obj { - union _Obj* _M_free_list_link; - char _M_client_data[1]; /* The client sees this. */ - }; -private: -# ifdef __SUNPRO_CC - static _Obj* __VOLATILE _S_free_list[]; - // Specifying a size results in duplicate def for 4.1 -# else - static _Obj* __VOLATILE _S_free_list[_NFREELISTS]; -# endif - static size_t _S_freelist_index(size_t __bytes) { - return (((__bytes) + _ALIGN-1)/_ALIGN - 1); - } - - // Returns an object of size __n, and optionally adds to size __n free list. - static void* _S_refill(size_t __n); - // Allocates a chunk for nobjs of size "size". nobjs may be reduced - // if it is inconvenient to allocate the requested number. - static char* _S_chunk_alloc(size_t __size, int& __nobjs); - - // Chunk allocation state. - static char* _S_start_free; - static char* _S_end_free; - static size_t _S_heap_size; - -# ifdef __STL_SGI_THREADS - static volatile unsigned long _S_node_allocator_lock; - static void _S_lock(volatile unsigned long*); - static inline void _S_unlock(volatile unsigned long*); -# endif - -# ifdef __STL_PTHREADS - static pthread_mutex_t _S_node_allocator_lock; -# endif - -# ifdef __STL_SOLTHREADS - static mutex_t _S_node_allocator_lock; -# endif - -# ifdef __STL_WIN32THREADS - static CRITICAL_SECTION _S_node_allocator_lock; - static bool _S_node_allocator_lock_initialized; - - public: - __default_alloc_template() { - // This assumes the first constructor is called before threads - // are started. - if (!_S_node_allocator_lock_initialized) { - InitializeCriticalSection(&_S_node_allocator_lock); - _S_node_allocator_lock_initialized = true; - } - } - private: -# endif - - class _Lock { - public: - _Lock() { __NODE_ALLOCATOR_LOCK; } - ~_Lock() { __NODE_ALLOCATOR_UNLOCK; } - }; - friend class _Lock; - -public: - - /* __n must be > 0 */ - static void* allocate(size_t __n) - { - _Obj* __VOLATILE* __my_free_list; - _Obj* __RESTRICT __result; - - if (__n > (size_t) _MAX_BYTES) { - return(malloc_alloc::allocate(__n)); - } - __my_free_list = _S_free_list + _S_freelist_index(__n); - // Acquire the lock here with a constructor call. - // This ensures that it is released in exit or during stack - // unwinding. -# ifndef _NOTHREADS - /*REFERENCED*/ - _Lock __lock_instance; -# endif - __result = *__my_free_list; - if (__result == 0) { - void* __r = _S_refill(_S_round_up(__n)); - return __r; - } - *__my_free_list = __result -> _M_free_list_link; - return (__result); - }; - - /* __p may not be 0 */ - static void deallocate(void* __p, size_t __n) - { - _Obj* __q = (_Obj*)__p; - _Obj* __VOLATILE* __my_free_list; - - if (__n > (size_t) _MAX_BYTES) { - malloc_alloc::deallocate(__p, __n); - return; - } - __my_free_list = _S_free_list + _S_freelist_index(__n); - // acquire lock -# ifndef _NOTHREADS - /*REFERENCED*/ - _Lock __lock_instance; -# endif /* _NOTHREADS */ - __q -> _M_free_list_link = *__my_free_list; - *__my_free_list = __q; - // lock is released here - } - - static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz); - -} ; - -typedef __default_alloc_template<__NODE_ALLOCATOR_THREADS, 0> alloc; -typedef __default_alloc_template 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 -char* -__default_alloc_template<__threads, __inst>::_S_chunk_alloc(size_t __size, - int& __nobjs) -{ - char* __result; - size_t __total_bytes = __size * __nobjs; - size_t __bytes_left = _S_end_free - _S_start_free; - - if (__bytes_left >= __total_bytes) { - __result = _S_start_free; - _S_start_free += __total_bytes; - return(__result); - } else if (__bytes_left >= __size) { - __nobjs = (int)(__bytes_left/__size); - __total_bytes = __size * __nobjs; - __result = _S_start_free; - _S_start_free += __total_bytes; - return(__result); - } else { - size_t __bytes_to_get = - 2 * __total_bytes + _S_round_up(_S_heap_size >> 4); - // Try to make use of the left-over piece. - if (__bytes_left > 0) { - _Obj* __VOLATILE* __my_free_list = - _S_free_list + _S_freelist_index(__bytes_left); - - ((_Obj*)_S_start_free) -> _M_free_list_link = *__my_free_list; - *__my_free_list = (_Obj*)_S_start_free; - } - _S_start_free = (char*)malloc(__bytes_to_get); - if (0 == _S_start_free) { - size_t __i; - _Obj* __VOLATILE* __my_free_list; - _Obj* __p; - // Try to make do with what we have. That can't - // hurt. We do not try smaller requests, since that tends - // to result in disaster on multi-process machines. - for (__i = __size; __i <= _MAX_BYTES; __i += _ALIGN) { - __my_free_list = _S_free_list + _S_freelist_index(__i); - __p = *__my_free_list; - if (0 != __p) { - *__my_free_list = __p -> _M_free_list_link; - _S_start_free = (char*)__p; - _S_end_free = _S_start_free + __i; - return(_S_chunk_alloc(__size, __nobjs)); - // Any leftover piece will eventually make it to the - // right free list. - } - } - _S_end_free = 0; // In case of exception. - _S_start_free = (char*)malloc_alloc::allocate(__bytes_to_get); - // This should either throw an - // exception or remedy the situation. Thus we assume it - // succeeded. - } - _S_heap_size += __bytes_to_get; - _S_end_free = _S_start_free + __bytes_to_get; - return(_S_chunk_alloc(__size, __nobjs)); - } -} - - -/* Returns an object of size __n, and optionally adds to size __n free list.*/ -/* We assume that __n is properly aligned. */ -/* We hold the allocation lock. */ -template -void* -__default_alloc_template<__threads, __inst>::_S_refill(size_t __n) -{ - int __nobjs = 20; - char* __chunk = _S_chunk_alloc(__n, __nobjs); - _Obj* __VOLATILE* __my_free_list; - _Obj* __result; - _Obj* __current_obj; - _Obj* __next_obj; - int __i; - - if (1 == __nobjs) return(__chunk); - __my_free_list = _S_free_list + _S_freelist_index(__n); - - /* Build free list in chunk */ - __result = (_Obj*)__chunk; - *__my_free_list = __next_obj = (_Obj*)(__chunk + __n); - for (__i = 1; ; __i++) { - __current_obj = __next_obj; - __next_obj = (_Obj*)((char*)__next_obj + __n); - if (__nobjs - 1 == __i) { - __current_obj -> _M_free_list_link = 0; - break; - } else { - __current_obj -> _M_free_list_link = __next_obj; - } - } - return(__result); -} - -template -void* -__default_alloc_template::reallocate(void* __p, - size_t __old_sz, - size_t __new_sz) -{ - void* __result; - size_t __copy_sz; - - if (__old_sz > (size_t) _MAX_BYTES && __new_sz > (size_t) _MAX_BYTES) { - return(realloc(__p, __new_sz)); - } - if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p); - __result = allocate(__new_sz); - __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz; - memcpy(__result, __p, __copy_sz); - deallocate(__p, __old_sz); - return(__result); -} - -#ifdef __STL_PTHREADS - template - pthread_mutex_t - __default_alloc_template<__threads, __inst>::_S_node_allocator_lock - = PTHREAD_MUTEX_INITIALIZER; -#endif - -#ifdef __STL_SOLTHREADS - template - mutex_t - __default_alloc_template<__threads, __inst>::_S_node_allocator_lock - = DEFAULTMUTEX; -#endif - -#ifdef __STL_WIN32THREADS - template - CRITICAL_SECTION - __default_alloc_template<__threads, __inst>:: - _S_node_allocator_lock; - - template - bool - __default_alloc_template<__threads, __inst>:: - _S_node_allocator_lock_initialized - = false; -#endif - -#ifdef __STL_SGI_THREADS -__STL_END_NAMESPACE -#include -#include /* XXX should use */ -__STL_BEGIN_NAMESPACE -// Somewhat generic lock implementations. We need only test-and-set -// and some way to sleep. These should work with both SGI pthreads -// and sproc threads. They may be useful on other systems. -template -volatile unsigned long -__default_alloc_template<__threads, __inst>::_S_node_allocator_lock = 0; - -#if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64)) || defined(__GNUC__) -# define __test_and_set(l,v) test_and_set(l,v) -#endif - -template -void -__default_alloc_template<__threads, __inst>:: - _S_lock(volatile unsigned long* __lock) -{ - const unsigned __low_spin_max = 30; // spins if we suspect uniprocessor - const unsigned __high_spin_max = 1000; // spins for multiprocessor - static unsigned __spin_max = __low_spin_max; - unsigned __my_spin_max; - static unsigned __last_spins = 0; - unsigned __my_last_spins; - unsigned __junk; -# define __ALLOC_PAUSE \ - __junk *= __junk; __junk *= __junk; __junk *= __junk; __junk *= __junk - int __i; - - if (!__test_and_set((unsigned long*)__lock, 1)) { - return; - } - __my_spin_max = __spin_max; - __my_last_spins = __last_spins; - for (__i = 0; __i < __my_spin_max; __i++) { - if (__i < __my_last_spins/2 || *__lock) { - __ALLOC_PAUSE; - continue; - } - if (!__test_and_set((unsigned long*)__lock, 1)) { - // got it! - // Spinning worked. Thus we're probably not being scheduled - // against the other process with which we were contending. - // Thus it makes sense to spin longer the next time. - __last_spins = __i; - __spin_max = __high_spin_max; - return; - } - } - // We are probably being scheduled against the other process. Sleep. - __spin_max = __low_spin_max; - for (__i = 0 ;; ++__i) { - struct timespec __ts; - int __log_nsec = __i + 6; - - if (!__test_and_set((unsigned long *)__lock, 1)) { - return; - } - if (__log_nsec > 27) __log_nsec = 27; - /* Max sleep is 2**27nsec ~ 60msec */ - __ts.tv_sec = 0; - __ts.tv_nsec = 1 << __log_nsec; - nanosleep(&__ts, 0); - } -} - -template -inline void -__default_alloc_template<__threads, __inst>::_S_unlock( - volatile unsigned long* __lock) -{ -# if defined(__GNUC__) && __mips >= 3 - asm("sync"); - *__lock = 0; -# elif __mips >= 3 && (defined (_ABIN32) || defined(_ABI64)) - __lock_release(__lock); -# else - *__lock = 0; - // This is not sufficient on many multiprocessors, since - // writes to protected variables and the lock may be reordered. -# endif -} -#endif - -template -char* __default_alloc_template<__threads, __inst>::_S_start_free = 0; - -template -char* __default_alloc_template<__threads, __inst>::_S_end_free = 0; - -template -size_t __default_alloc_template<__threads, __inst>::_S_heap_size = 0; - -template -__default_alloc_template<__threads, __inst>::_Obj* __VOLATILE -__default_alloc_template<__threads, __inst> ::_S_free_list[ - _NFREELISTS -] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -// The 16 zeros are necessary to make version 4.1 of the SunPro -// compiler happy. Otherwise it appears to allocate too little -// space for the array. - -# ifdef __STL_WIN32THREADS - // Create one to get critical section initialized. - // We do this onece per file, but only the first constructor - // does anything. - static alloc __node_allocator_dummy_instance; -# endif - -#endif /* ! __USE_MALLOC */ - -// This implements allocators as specified in the C++ standard. -// -// Note that standard-conforming allocators use many language features -// that are not yet widely implemented. In particular, they rely on -// member templates, partial specialization, partial ordering of function -// templates, the typename keyword, and the use of the template keyword -// to refer to a template member of a dependent type. - -#ifdef __STL_USE_STD_ALLOCATORS - -template -class 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 struct rebind { - typedef allocator<_Tp1> other; - }; - - allocator() __STL_NOTHROW {} - allocator(const allocator&) __STL_NOTHROW {} - template 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 { - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef void* pointer; - typedef const void* const_pointer; - typedef void value_type; - - template struct rebind { - typedef allocator<_Tp1> other; - }; -}; - - -template -inline bool operator==(const allocator<_T1>&, const allocator<_T2>&) -{ - return true; -} - -template -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 -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 struct rebind { - typedef __allocator<_Tp1, _Alloc> other; - }; - - __allocator() __STL_NOTHROW {} - __allocator(const __allocator& __a) __STL_NOTHROW - : __underlying_alloc(__a.__underlying_alloc) {} - template - __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 __allocator { - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef void* pointer; - typedef const void* const_pointer; - typedef void value_type; - - template struct rebind { - typedef __allocator<_Tp1, _Alloc> other; - }; -}; - -template -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 -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 (for example) will -// work correctly. - -template -inline bool operator==(const __malloc_alloc_template&, - const __malloc_alloc_template&) -{ - return true; -} - -#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER -template -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 -inline bool operator==(const __default_alloc_template<__threads, __inst>&, - const __default_alloc_template<__threads, __inst>&) -{ - return true; -} - -# ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER -template -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 -inline bool operator==(const debug_alloc<_Alloc>&, - const debug_alloc<_Alloc>&) { - return true; -} - -#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER -template -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 -struct _Alloc_traits -{ - static const bool _S_instanceless = false; - typedef typename _Allocator::__STL_TEMPLATE rebind<_Tp>::other - allocator_type; -}; - -template -const bool _Alloc_traits<_Tp, _Allocator>::_S_instanceless; - -// The version for the default allocator. - -template -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 -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 -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 -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 -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 -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 -struct _Alloc_traits<_Tp, __allocator<_Tp1, debug_alloc<_Alloc> > > -{ - static const bool _S_instanceless = true; - typedef simple_alloc<_Tp, debug_alloc<_Alloc> > _Alloc_type; - typedef __allocator<_Tp, debug_alloc<_Alloc> > allocator_type; -}; - - -#endif /* __STL_USE_STD_ALLOCATORS */ - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#endif - -__STL_END_NAMESPACE - -#undef __PRIVATE - -#endif /* __SGI_STL_INTERNAL_ALLOC_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_bvector.h b/contrib/libstdc++/stl/stl_bvector.h deleted file mode 100644 index 0d0cdb6c82..0000000000 --- a/contrib/libstdc++/stl/stl_bvector.h +++ /dev/null @@ -1,838 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_BVECTOR_H -#define __SGI_STL_INTERNAL_BVECTOR_H - -__STL_BEGIN_NAMESPACE - -static const int __WORD_BIT = int(CHAR_BIT*sizeof(unsigned int)); - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1174 -#pragma set woff 1375 -#endif - -struct _Bit_reference { - unsigned int* _M_p; - unsigned int _M_mask; - _Bit_reference(unsigned int* __x, unsigned int __y) - : _M_p(__x), _M_mask(__y) {} - -public: - _Bit_reference() : _M_p(0), _M_mask(0) {} - operator bool() const { return !(!(*_M_p & _M_mask)); } - _Bit_reference& operator=(bool __x) - { - if (__x) *_M_p |= _M_mask; - else *_M_p &= ~_M_mask; - return *this; - } - _Bit_reference& operator=(const _Bit_reference& __x) - { return *this = bool(__x); } - bool operator==(const _Bit_reference& __x) const - { return bool(*this) == bool(__x); } - bool operator<(const _Bit_reference& __x) const { - return !bool(*this) && bool(__x); - } - void flip() { *_M_p ^= _M_mask; } -}; - -inline void swap(_Bit_reference __x, _Bit_reference __y) -{ - bool __tmp = __x; - __x = __y; - __y = __tmp; -} - -struct _Bit_iterator : public random_access_iterator { - typedef _Bit_reference reference; - typedef _Bit_reference* pointer; - typedef _Bit_iterator iterator; - - unsigned int* _M_p; - unsigned int _M_offset; - void bump_up() { - if (_M_offset++ == __WORD_BIT - 1) { - _M_offset = 0; - ++_M_p; - } - } - void bump_down() { - if (_M_offset-- == 0) { - _M_offset = __WORD_BIT - 1; - --_M_p; - } - } - - _Bit_iterator() : _M_p(0), _M_offset(0) {} - _Bit_iterator(unsigned int* __x, unsigned int __y) - : _M_p(__x), _M_offset(__y) {} - reference operator*() const { return reference(_M_p, 1U << _M_offset); } - iterator& operator++() { - bump_up(); - return *this; - } - iterator operator++(int) { - iterator __tmp = *this; - bump_up(); - return __tmp; - } - iterator& operator--() { - bump_down(); - return *this; - } - iterator operator--(int) { - iterator __tmp = *this; - bump_down(); - return __tmp; - } - iterator& operator+=(difference_type __i) { - difference_type __n = __i + _M_offset; - _M_p += __n / __WORD_BIT; - __n = __n % __WORD_BIT; - if (__n < 0) { - _M_offset = (unsigned int) __n + __WORD_BIT; - --_M_p; - } else - _M_offset = (unsigned int) __n; - return *this; - } - iterator& operator-=(difference_type __i) { - *this += -__i; - return *this; - } - iterator operator+(difference_type __i) const { - iterator __tmp = *this; - return __tmp += __i; - } - iterator operator-(difference_type __i) const { - iterator __tmp = *this; - return __tmp -= __i; - } - difference_type operator-(iterator __x) const { - return __WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset; - } - reference operator[](difference_type __i) { return *(*this + __i); } - bool operator==(const iterator& __x) const { - return _M_p == __x._M_p && _M_offset == __x._M_offset; - } - bool operator!=(const iterator& __x) const { - return _M_p != __x._M_p || _M_offset != __x._M_offset; - } - bool operator<(iterator __x) const { - return _M_p < __x._M_p || (_M_p == __x._M_p && _M_offset < __x._M_offset); - } -}; - -struct _Bit_const_iterator - : public random_access_iterator -{ - typedef bool reference; - typedef bool const_reference; - typedef const bool* pointer; - typedef _Bit_const_iterator const_iterator; - - unsigned int* _M_p; - unsigned int _M_offset; - void bump_up() { - if (_M_offset++ == __WORD_BIT - 1) { - _M_offset = 0; - ++_M_p; - } - } - void bump_down() { - if (_M_offset-- == 0) { - _M_offset = __WORD_BIT - 1; - --_M_p; - } - } - - _Bit_const_iterator() : _M_p(0), _M_offset(0) {} - _Bit_const_iterator(unsigned int* __x, unsigned int __y) - : _M_p(__x), _M_offset(__y) {} - _Bit_const_iterator(const _Bit_iterator& __x) - : _M_p(__x._M_p), _M_offset(__x._M_offset) {} - const_reference operator*() const { - return _Bit_reference(_M_p, 1U << _M_offset); - } - const_iterator& operator++() { - bump_up(); - return *this; - } - const_iterator operator++(int) { - const_iterator __tmp = *this; - bump_up(); - return __tmp; - } - const_iterator& operator--() { - bump_down(); - return *this; - } - const_iterator operator--(int) { - const_iterator __tmp = *this; - bump_down(); - return __tmp; - } - const_iterator& operator+=(difference_type __i) { - difference_type __n = __i + _M_offset; - _M_p += __n / __WORD_BIT; - __n = __n % __WORD_BIT; - if (__n < 0) { - _M_offset = (unsigned int) __n + __WORD_BIT; - --_M_p; - } else - _M_offset = (unsigned int) __n; - return *this; - } - const_iterator& operator-=(difference_type __i) { - *this += -__i; - return *this; - } - const_iterator operator+(difference_type __i) const { - const_iterator __tmp = *this; - return __tmp += __i; - } - const_iterator operator-(difference_type __i) const { - const_iterator __tmp = *this; - return __tmp -= __i; - } - difference_type operator-(const_iterator __x) const { - return __WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset; - } - const_reference operator[](difference_type __i) { - return *(*this + __i); - } - bool operator==(const const_iterator& __x) const { - return _M_p == __x._M_p && _M_offset == __x._M_offset; - } - bool operator!=(const const_iterator& __x) const { - return _M_p != __x._M_p || _M_offset != __x._M_offset; - } - bool operator<(const_iterator __x) const { - return _M_p < __x._M_p || (_M_p == __x._M_p && _M_offset < __x._M_offset); - } -}; - -// Bit-vector base class, which encapsulates the difference between -// old SGI-style allocators and standard-conforming allocators. - -#ifdef __STL_USE_STD_ALLOCATORS - -// Base class for ordinary allocators. -template -class _Bvector_alloc_base { -public: - typedef typename _Alloc_traits::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::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 _Bvector_alloc_base<_Allocator, true> { -public: - typedef typename _Alloc_traits::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::_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 _Bvector_base - : public _Bvector_alloc_base<_Alloc, - _Alloc_traits::_S_instanceless> -{ - typedef _Bvector_alloc_base<_Alloc, - _Alloc_traits::_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 _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 _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 if we have the necessary -// compiler support. Otherwise, we define a class bit_vector which uses -// the default allocator. - -#if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && !defined(__STL_NO_BOOL) -#define __SGI_STL_VECBOOL_TEMPLATE -#define __BVECTOR vector -#else -#undef __SGI_STL_VECBOOL_TEMPLATE -#define __BVECTOR bit_vector -#endif - -# ifdef __SGI_STL_VECBOOL_TEMPLATE - __STL_END_NAMESPACE -# include - __STL_BEGIN_NAMESPACE -template class vector - : public _Bvector_base<_Alloc> -# else /* __SGI_STL_VECBOOL_TEMPLATE */ -class bit_vector - : public _Bvector_base<__STL_DEFAULT_ALLOCATOR(bool) > -# endif /* __SGI_STL_VECBOOL_TEMPLATE */ -{ -# ifdef __SGI_STL_VECBOOL_TEMPLATE - typedef _Bvector_base<_Alloc> _Base; -# else /* __SGI_STL_VECBOOL_TEMPLATE */ - typedef _Bvector_base<__STL_DEFAULT_ALLOCATOR(bool) > _Base; -# endif /* __SGI_STL_VECBOOL_TEMPLATE */ -public: - typedef bool value_type; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Bit_reference reference; - typedef bool const_reference; - typedef _Bit_reference* pointer; - typedef const bool* const_pointer; - - typedef _Bit_iterator iterator; - typedef _Bit_const_iterator const_iterator; - -#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION - typedef reverse_iterator const_reverse_iterator; - typedef reverse_iterator reverse_iterator; -#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - typedef reverse_iterator const_reverse_iterator; - typedef reverse_iterator - 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 - 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 - 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 - void _M_insert_range(iterator __pos, - _InputIterator __first, _InputIterator __last, - input_iterator_tag) { - for ( ; __first != __last; ++__first) { - __pos = insert(__pos, *__first); - ++__pos; - } - } - - template - void _M_insert_range(iterator __position, - _ForwardIterator __first, _ForwardIterator __last, - forward_iterator_tag) { - if (__first != __last) { - size_type __n = 0; - distance(__first, __last, __n); - if (capacity() - size() >= __n) { - copy_backward(__position, end(), _M_finish + difference_type(__n)); - copy(__first, __last, __position); - _M_finish += difference_type(__n); - } - else { - size_type __len = size() + max(size(), __n); - unsigned int* __q = _M_bit_alloc(__len); - iterator __i = copy(begin(), __position, iterator(__q, 0)); - __i = copy(__first, __last, __i); - _M_finish = copy(__position, end(), __i); - _M_deallocate(); - _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT; - _M_start = iterator(__q, 0); - } - } - } - -#endif /* __STL_MEMBER_TEMPLATES */ - -public: - iterator begin() { return _M_start; } - const_iterator begin() const { return _M_start; } - iterator end() { return _M_finish; } - const_iterator end() const { return _M_finish; } - - reverse_iterator rbegin() { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const { - return const_reverse_iterator(end()); - } - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rend() const { - return const_reverse_iterator(begin()); - } - - size_type size() const { return size_type(end() - begin()); } - size_type max_size() const { return size_type(-1); } - size_type capacity() const { - return size_type(const_iterator(_M_end_of_storage, 0) - begin()); - } - bool empty() const { return begin() == end(); } - reference operator[](size_type __n) { - return *(begin() + difference_type(__n)); - } - const_reference operator[](size_type __n) const { - return *(begin() + difference_type(__n)); - } - - explicit __BVECTOR(const allocator_type& __a = allocator_type()) - : _Base(__a) {} - - __BVECTOR(size_type __n, bool __value, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { - _M_initialize(__n); - fill(_M_start._M_p, _M_end_of_storage, __value ? ~0 : 0); - } - - explicit __BVECTOR(size_type __n) - : _Base(allocator_type()) - { - _M_initialize(__n); - fill(_M_start._M_p, _M_end_of_storage, 0); - } - - __BVECTOR(const __BVECTOR& __x) : _Base(__x.get_allocator()) { - _M_initialize(__x.size()); - copy(__x.begin(), __x.end(), _M_start); - } - -#ifdef __STL_MEMBER_TEMPLATES - // Check whether it's an integral type. If so, it's not an iterator. - template - __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 - 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 - void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, - __false_type) { - _M_initialize_range(__first, __last, __ITERATOR_CATEGORY(__first)); - } -#else /* __STL_MEMBER_TEMPLATES */ - __BVECTOR(const_iterator __first, const_iterator __last, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { - size_type __n = 0; - distance(__first, __last, __n); - _M_initialize(__n); - copy(__first, __last, _M_start); - } - __BVECTOR(const bool* __first, const bool* __last, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { - size_type __n = 0; - distance(__first, __last, __n); - _M_initialize(__n); - copy(__first, __last, _M_start); - } -#endif /* __STL_MEMBER_TEMPLATES */ - - ~__BVECTOR() { } - - __BVECTOR& operator=(const __BVECTOR& __x) { - if (&__x == this) return *this; - if (__x.size() > capacity()) { - _M_deallocate(); - _M_initialize(__x.size()); - } - copy(__x.begin(), __x.end(), begin()); - _M_finish = begin() + difference_type(__x.size()); - return *this; - } - - // assign(), a generalized assignment member function. Two - // versions: one that takes a count, and one that takes a range. - // The range version is a member template, so we dispatch on whether - // or not the type is an integer. - - void assign(size_t __n, bool __x) { - if (__n > size()) { - fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0); - insert(end(), __n - size(), __x); - } - else { - erase(begin() + __n, end()); - fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0); - } - } - -#ifdef __STL_MEMBER_TEMPLATES - - template - void assign(_InputIterator __first, _InputIterator __last) { - typedef typename _Is_integer<_InputIterator>::_Integral _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - } - - template - void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) - { assign((size_t) __n, (bool) __val); } - - template - void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type) - { _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); } - - template - 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 - 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 - void insert(iterator __position, - _InputIterator __first, _InputIterator __last) { - typedef typename _Is_integer<_InputIterator>::_Integral _Integral; - _M_insert_dispatch(__position, __first, __last, _Integral()); - } - - template - void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, - __true_type) { - insert(__pos, (size_type) __n, (bool) __x); - } - - template - void _M_insert_dispatch(iterator __pos, - _InputIterator __first, _InputIterator __last, - __false_type) { - _M_insert_range(__pos, __first, __last, __ITERATOR_CATEGORY(__first)); - } -#else /* __STL_MEMBER_TEMPLATES */ - void insert(iterator __position, - const_iterator __first, const_iterator __last) { - if (__first == __last) return; - size_type __n = 0; - distance(__first, __last, __n); - if (capacity() - size() >= __n) { - copy_backward(__position, end(), _M_finish + __n); - copy(__first, __last, __position); - _M_finish += __n; - } - else { - size_type __len = size() + max(size(), __n); - unsigned int* __q = _M_bit_alloc(__len); - iterator __i = copy(begin(), __position, iterator(__q, 0)); - __i = copy(__first, __last, __i); - _M_finish = copy(__position, end(), __i); - _M_deallocate(); - _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT; - _M_start = iterator(__q, 0); - } - } - - void insert(iterator __position, const bool* __first, const bool* __last) { - if (__first == __last) return; - size_type __n = 0; - distance(__first, __last, __n); - if (capacity() - size() >= __n) { - copy_backward(__position, end(), _M_finish + __n); - copy(__first, __last, __position); - _M_finish += __n; - } - else { - size_type __len = size() + max(size(), __n); - unsigned int* __q = _M_bit_alloc(__len); - iterator __i = copy(begin(), __position, iterator(__q, 0)); - __i = copy(__first, __last, __i); - _M_finish = copy(__position, end(), __i); - _M_deallocate(); - _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT; - _M_start = iterator(__q, 0); - } - } -#endif /* __STL_MEMBER_TEMPLATES */ - - void insert(iterator __position, size_type __n, bool __x) { - if (__n == 0) return; - if (capacity() - size() >= __n) { - copy_backward(__position, end(), _M_finish + difference_type(__n)); - fill(__position, __position + difference_type(__n), __x); - _M_finish += difference_type(__n); - } - else { - size_type __len = size() + max(size(), __n); - unsigned int* __q = _M_bit_alloc(__len); - iterator __i = copy(begin(), __position, iterator(__q, 0)); - fill_n(__i, __n, __x); - _M_finish = copy(__position, end(), __i + difference_type(__n)); - _M_deallocate(); - _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT; - _M_start = iterator(__q, 0); - } - } - - void pop_back() { --_M_finish; } - iterator erase(iterator __position) { - if (__position + 1 != end()) - copy(__position + 1, end(), __position); - --_M_finish; - return __position; - } - iterator erase(iterator __first, iterator __last) { - _M_finish = copy(__last, end(), __first); - return __first; - } - void resize(size_type __new_size, bool __x = bool()) { - if (__new_size < size()) - erase(begin() + difference_type(__new_size), end()); - else - insert(end(), __new_size - size(), __x); - } - void clear() { erase(begin(), end()); } -}; - -#ifdef __SGI_STL_VECBOOL_TEMPLATE - -typedef vector bit_vector; - -#else /* __SGI_STL_VECBOOL_TEMPLATE */ - -inline bool -operator==(const bit_vector& __x, const bit_vector& __y) -{ - return (__x.size() == __y.size() && - equal(__x.begin(), __x.end(), __y.begin())); -} - -inline bool -operator<(const bit_vector& __x, const bit_vector& __y) -{ - return lexicographical_compare(__x.begin(), __x.end(), - __y.begin(), __y.end()); -} - -#endif /* __SGI_STL_VECBOOL_TEMPLATE */ - -#undef __SGI_STL_VECBOOL_TEMPLATE -#undef __BVECTOR - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#pragma reset woff 1375 -#endif - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_BVECTOR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_config.h b/contrib/libstdc++/stl/stl_config.h deleted file mode 100644 index d72f9e1c74..0000000000 --- a/contrib/libstdc++/stl/stl_config.h +++ /dev/null @@ -1,356 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * Copyright (c) 1997 - * Silicon Graphics - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef __STL_CONFIG_H -# define __STL_CONFIG_H - -// Flags: -// * __STL_NO_BOOL: defined if the compiler doesn't have bool as a builtin -// type. -// * __STL_HAS_WCHAR_T: defined if the compier has wchar_t as a builtin type. -// * __STL_NO_DRAND48: defined if the compiler doesn't have the drand48 -// function. -// * __STL_STATIC_TEMPLATE_MEMBER_BUG: defined if the compiler can't handle -// static members of template classes. -// * __STL_CLASS_PARTIAL_SPECIALIZATION: defined if the compiler supports -// partial specialization of template classes. -// * __STL_PARTIAL_SPECIALIZATION_SYNTAX: defined if the compiler -// supports partial specialization syntax for full specialization of -// class templates. (Even if it doesn't actually support partial -// specialization itself.) -// * __STL_FUNCTION_TMPL_PARTIAL_ORDER: defined if the compiler supports -// partial ordering of function templates. (a.k.a partial specialization -// of function templates.) -// * __STL_MEMBER_TEMPLATES: defined if the compiler supports template -// member functions of classes. -// * __STL_MEMBER_TEMPLATE_CLASSES: defined if the compiler supports -// nested classes that are member templates of other classes. -// * __STL_EXPLICIT_FUNCTION_TMPL_ARGS: defined if the compiler -// supports calling a function template by providing its template -// arguments explicitly. -// * __STL_LIMITED_DEFAULT_TEMPLATES: defined if the compiler is unable -// to handle default template parameters that depend on previous template -// parameters. -// * __STL_NON_TYPE_TMPL_PARAM_BUG: defined if the compiler has trouble with -// function template argument deduction for non-type template parameters. -// * __SGI_STL_NO_ARROW_OPERATOR: defined if the compiler is unable -// to support the -> operator for iterators. -// * __STL_USE_EXCEPTIONS: defined if the compiler (in the current compilation -// mode) supports exceptions. -// * __STL_USE_NAMESPACES: defined if the compiler has the necessary -// support for namespaces. -// * __STL_NO_EXCEPTION_HEADER: defined if the compiler does not have a -// standard-conforming header . -// * __STL_SGI_THREADS: defined if this is being compiled for an SGI IRIX -// system in multithreaded mode, using native SGI threads instead of -// pthreads. -// * __STL_WIN32THREADS: defined if this is being compiled on a WIN32 -// compiler in multithreaded mode. -// * __STL_LONG_LONG if the compiler has long long and unsigned long long -// types. (They're not in the C++ standard, but they are expected to be -// included in the forthcoming C9X standard.) - - -// User-settable macros that control compilation: -// * __STL_USE_SGI_ALLOCATORS: if defined, then the STL will use older -// SGI-style allocators, instead of standard-conforming allocators, -// even if the compiler supports all of the language features needed -// for standard-conforming allocators. -// * __STL_NO_NAMESPACES: if defined, don't put the library in namespace -// std, even if the compiler supports namespaces. -// * __STL_ASSERTIONS: if defined, then enable runtime checking through the -// __stl_assert macro. -// * _PTHREADS: if defined, use Posix threads for multithreading support. -// * _NOTHREADS: if defined, don't use any multithreading support. - - -// Other macros defined by this file: - -// * bool, true, and false, if __STL_NO_BOOL is defined. -// * typename, as a null macro if it's not already a keyword. -// * explicit, as a null macro if it's not already a keyword. -// * namespace-related macros (__STD, __STL_BEGIN_NAMESPACE, etc.) -// * exception-related macros (__STL_TRY, __STL_UNWIND, etc.) -// * __stl_assert, either as a test or as a null macro, depending on -// whether or not __STL_ASSERTIONS is defined. - -#ifdef _PTHREADS -# define __STL_PTHREADS -#endif -#ifdef _SOLTHREADS -# define __STL_SOLTHREADS -#endif - -# if defined(__sgi) && !defined(__GNUC__) -# if !defined(_BOOL) -# define __STL_NO_BOOL -# endif -# if defined(_WCHAR_T_IS_KEYWORD) -# define __STL_HAS_WCHAR_T -# endif -# if !defined(_TYPENAME_IS_KEYWORD) -# define __STL_NEED_TYPENAME -# endif -# ifdef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES -# define __STL_CLASS_PARTIAL_SPECIALIZATION -# endif -# ifdef _MEMBER_TEMPLATES -# define __STL_MEMBER_TEMPLATES -# define __STL_MEMBER_TEMPLATE_CLASSES -# endif -# if defined(_MEMBER_TEMPLATE_KEYWORD) -# define __STL_MEMBER_TEMPLATE_KEYWORD -# endif -# if (_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32 -# define __STL_MEMBER_TEMPLATE_KEYWORD -# endif -# if !defined(_EXPLICIT_IS_KEYWORD) -# define __STL_NEED_EXPLICIT -# endif -# ifdef __EXCEPTIONS -# define __STL_USE_EXCEPTIONS -# endif -# if (_COMPILER_VERSION >= 721) && defined(_NAMESPACES) -# define __STL_HAS_NAMESPACES -# endif -# if (_COMPILER_VERSION < 721) -# define __STL_NO_EXCEPTION_HEADER -# endif -# if !defined(_NOTHREADS) && !defined(__STL_PTHREADS) -# define __STL_SGI_THREADS -# endif -# if defined(_LONGLONG) && defined(_SGIAPI) && _SGIAPI -# define __STL_LONG_LONG -# endif -# endif - -# ifdef __GNUC__ -# include <_G_config.h> -# define __STL_HAS_WCHAR_T -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) -# define __STL_STATIC_TEMPLATE_MEMBER_BUG -# define __STL_NEED_TYPENAME -# define __STL_NEED_EXPLICIT -# else -# define __STL_CLASS_PARTIAL_SPECIALIZATION -# define __STL_FUNCTION_TMPL_PARTIAL_ORDER -# define __STL_MEMBER_TEMPLATES -# define __STL_MEMBER_TEMPLATE_CLASSES -# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS -# define __STL_HAS_NAMESPACES -# define __STL_NO_NAMESPACES -# define __SGI_STL_USE_AUTO_PTR_CONVERSIONS -# define __STL_USE_NAMESPACES -# endif -# if defined(__linux__) - /* glibc pre 2.0 is very buggy. We have to disable thread for it. - It should be upgraded to glibc 2.0 or later. */ -# if !defined(_NOTHREADS) && __GLIBC__ >= 2 && defined(_G_USING_THUNKS) -# define __STL_PTHREADS -# ifdef __STRICT_ANSI__ - /* Work around a bug in the glibc 2.0.x pthread.h. */ -# define sigset_t __sigset_t -# endif -# endif -# endif -# ifdef __EXCEPTIONS -# define __STL_USE_EXCEPTIONS -# endif -# ifndef __STRICT_ANSI__ -# define __STL_LONG_LONG -# endif -# endif - -# if defined(__SUNPRO_CC) -# define __STL_NO_BOOL -# define __STL_NEED_TYPENAME -# define __STL_NEED_EXPLICIT -# define __STL_USE_EXCEPTIONS -# endif - -# if defined(__COMO__) -# define __STL_MEMBER_TEMPLATES -# define __STL_MEMBER_TEMPLATE_CLASSES -# define __STL_CLASS_PARTIAL_SPECIALIZATION -# define __STL_USE_EXCEPTIONS -# define __STL_HAS_NAMESPACES -# endif - -# if defined(__MINGW32__) -# define __STL_NO_DRAND48 -# endif - -# if defined(__CYGWIN__) -# define __STL_NO_DRAND48 -# endif - -# if defined(_MSC_VER) -# define __STL_NO_DRAND48 -# define __STL_NEED_TYPENAME -# if _MSC_VER < 1100 /* 1000 is version 4.0, 1100 is 5.0, 1200 is 6.0. */ -# define __STL_NEED_EXPLICIT -# define __STL_NO_BOOL -# if _MSC_VER > 1000 -# include -# define __STL_DONT_USE_BOOL_TYPEDEF -# endif -# endif -# define __STL_NON_TYPE_TMPL_PARAM_BUG -# define __SGI_STL_NO_ARROW_OPERATOR -# ifdef _CPPUNWIND -# define __STL_USE_EXCEPTIONS -# endif -# ifdef _MT -# define __STL_WIN32THREADS -# endif -# if _MSC_VER >= 1200 -# define __STL_PARTIAL_SPECIALIZATION_SYNTAX -# define __STL_HAS_NAMESPACES -# define __STL_NO_NAMESPACES -# endif -# endif - -# if defined(__BORLANDC__) -# define __STL_NO_DRAND48 -# define __STL_NEED_TYPENAME -# define __STL_LIMITED_DEFAULT_TEMPLATES -# define __SGI_STL_NO_ARROW_OPERATOR -# define __STL_NON_TYPE_TMPL_PARAM_BUG -# ifdef _CPPUNWIND -# define __STL_USE_EXCEPTIONS -# endif -# ifdef __MT__ -# define __STL_WIN32THREADS -# endif -# endif - -# if defined(__STL_NO_BOOL) && !defined(__STL_DONT_USE_BOOL_TYPEDEF) - typedef int bool; -# define true 1 -# define false 0 -# endif - -# ifdef __STL_NEED_TYPENAME -# define typename -# endif - -# ifdef __STL_MEMBER_TEMPLATE_KEYWORD -# define __STL_TEMPLATE template -# else -# define __STL_TEMPLATE -# endif - -# ifdef __STL_NEED_EXPLICIT -# define explicit -# endif - -# ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS -# define __STL_NULL_TMPL_ARGS <> -# else -# define __STL_NULL_TMPL_ARGS -# endif - -# if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) \ - || defined (__STL_PARTIAL_SPECIALIZATION_SYNTAX) -# define __STL_TEMPLATE_NULL template<> -# else -# define __STL_TEMPLATE_NULL -# endif - -// Use standard-conforming allocators if we have the necessary language -// features. __STL_USE_SGI_ALLOCATORS is a hook so that users can -// disable new-style allocators, and continue to use the same kind of -// allocators as before, without having to edit library headers. -# if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && \ - defined(__STL_MEMBER_TEMPLATES) && \ - defined(__STL_MEMBER_TEMPLATE_CLASSES) && \ - !defined(__STL_NO_BOOL) && \ - !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) && \ - !defined(__STL_LIMITED_DEFAULT_TEMPLATES) && \ - !defined(__STL_USE_SGI_ALLOCATORS) -# define __STL_USE_STD_ALLOCATORS -# endif - -# ifndef __STL_DEFAULT_ALLOCATOR -# ifdef __STL_USE_STD_ALLOCATORS -# define __STL_DEFAULT_ALLOCATOR(T) allocator -# else -# define __STL_DEFAULT_ALLOCATOR(T) alloc -# endif -# endif - -// __STL_NO_NAMESPACES is a hook so that users can disable namespaces -// without having to edit library headers. -# if defined(__STL_HAS_NAMESPACES) && !defined(__STL_NO_NAMESPACES) -# define __STD std -# define __STL_BEGIN_NAMESPACE namespace std { -# define __STL_END_NAMESPACE } -# define __STL_USE_NAMESPACE_FOR_RELOPS -# define __STL_BEGIN_RELOPS_NAMESPACE namespace std { -# define __STL_END_RELOPS_NAMESPACE } -# define __STD_RELOPS std -# define __STL_USE_NAMESPACES -# else -# define __STD -# define __STL_BEGIN_NAMESPACE -# define __STL_END_NAMESPACE -# undef __STL_USE_NAMESPACE_FOR_RELOPS -# define __STL_BEGIN_RELOPS_NAMESPACE -# define __STL_END_RELOPS_NAMESPACE -# define __STD_RELOPS -# undef __STL_USE_NAMESPACES -# endif - -# ifdef __STL_USE_EXCEPTIONS -# define __STL_TRY try -# define __STL_CATCH_ALL catch(...) -# define __STL_THROW(x) throw x -# define __STL_RETHROW throw -# define __STL_NOTHROW throw() -# define __STL_UNWIND(action) catch(...) { action; throw; } -# else -# define __STL_TRY -# define __STL_CATCH_ALL if (false) -# define __STL_THROW(x) -# define __STL_RETHROW -# define __STL_NOTHROW -# define __STL_UNWIND(action) -# endif - -#ifdef __STL_ASSERTIONS -# include -# define __stl_assert(expr) \ - if (!(expr)) { fprintf(stderr, "%s:%d STL assertion failure: %s\n", \ - __FILE__, __LINE__, # expr); abort(); } -#else -# define __stl_assert(expr) -#endif - -#endif /* __STL_CONFIG_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_construct.h b/contrib/libstdc++/stl/stl_construct.h deleted file mode 100644 index 761784d57d..0000000000 --- a/contrib/libstdc++/stl/stl_construct.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_CONSTRUCT_H -#define __SGI_STL_INTERNAL_CONSTRUCT_H - -#include - -__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 -inline void destroy(_Tp* __pointer) { - __pointer->~_Tp(); -} - -template -inline void construct(_T1* __p, const _T2& __value) { - new (__p) _T1(__value); -} - -template -inline void construct(_T1* __p) { - new (__p) _T1(); -} - -template -inline void -__destroy_aux(_ForwardIterator __first, _ForwardIterator __last, __false_type) -{ - for ( ; __first != __last; ++__first) - destroy(&*__first); -} - -template -inline void __destroy_aux(_ForwardIterator, _ForwardIterator, __true_type) {} - -template -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 -inline void destroy(_ForwardIterator __first, _ForwardIterator __last) { - __destroy(__first, __last, __VALUE_TYPE(__first)); -} - -inline void destroy(char*, char*) {} -inline void destroy(wchar_t*, wchar_t*) {} - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_CONSTRUCT_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_deque.h b/contrib/libstdc++/stl/stl_deque.h deleted file mode 100644 index 24a8bfb1bc..0000000000 --- a/contrib/libstdc++/stl/stl_deque.h +++ /dev/null @@ -1,1698 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_DEQUE_H -#define __SGI_STL_INTERNAL_DEQUE_H - -/* Class invariants: - * For any nonsingular iterator i: - * i.node is the address of an element in the map array. The - * contents of i.node is a pointer to the beginning of a node. - * i.first == *(i.node) - * i.last == i.first + node_size - * i.cur is a pointer in the range [i.first, i.last). NOTE: - * the implication of this is that i.cur is always a dereferenceable - * pointer, even if i is a past-the-end iterator. - * Start and Finish are always nonsingular iterators. NOTE: this means - * that an empty deque must have one node, and that a deque - * with N elements, where N is the buffer size, must have two nodes. - * For every node other than start.node and finish.node, every element - * in the node is an initialized object. If start.node == finish.node, - * then [start.cur, finish.cur) are initialized objects, and - * the elements outside that range are uninitialized storage. Otherwise, - * [start.cur, start.last) and [finish.first, finish.cur) are initialized - * objects, and [start.first, start.cur) and [finish.cur, finish.last) - * are uninitialized storage. - * [map, map + map_size) is a valid, non-empty range. - * [start.node, finish.node] is a valid range contained within - * [map, map + map_size). - * A pointer in the range [map, map + map_size) points to an allocated node - * if and only if the pointer is in the range [start.node, finish.node]. - */ - - -/* - * In previous versions of deque, node_size was fixed by the - * implementation. In this version, however, users can select - * the node size. Deque has three template parameters; the third, - * a number of type size_t, is the number of elements per node. - * If the third template parameter is 0 (which is the default), - * then deque will use a default node size. - * - * The only reason for using an alternate node size is if your application - * requires a different performance tradeoff than the default. If, - * for example, your program contains many deques each of which contains - * only a few elements, then you might want to save memory (possibly - * by sacrificing some speed) by using smaller nodes. - * - * Unfortunately, some compilers have trouble with non-type template - * parameters; stl_config.h defines __STL_NON_TYPE_TMPL_PARAM_BUG if - * that is the case. If your compiler is one of them, then you will - * not be able to use alternate node sizes; you will have to use the - * default value. - */ - -__STL_BEGIN_NAMESPACE - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1174 -#pragma set woff 1375 -#endif - -// Note: this function is simply a kludge to work around several compilers' -// bugs in handling constant expressions. -inline size_t -__deque_buf_size(size_t __n, size_t __size) -{ - return __n != 0 ? __n : (__size < 512 ? size_t(512 / __size) : size_t(1)); -} - -#ifndef __STL_NON_TYPE_TMPL_PARAM_BUG -template -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 -struct _Deque_iterator { - typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator; - typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; - static size_t - _S_buffer_size() { return __deque_buf_size(0, sizeof(_Tp)); } -#endif - - typedef random_access_iterator_tag iterator_category; - typedef _Tp value_type; - typedef _Ptr pointer; - typedef _Ref reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp** _Map_pointer; - - typedef _Deque_iterator _Self; - - _Tp* _M_cur; - _Tp* _M_first; - _Tp* _M_last; - _Map_pointer _M_node; - - _Deque_iterator(_Tp* __x, _Map_pointer __y) - : _M_cur(__x), _M_first(*__y), - _M_last(*__y + _S_buffer_size()), _M_node(__y) {} - _Deque_iterator() : _M_cur(0), _M_first(0), _M_last(0), _M_node(0) {} - _Deque_iterator(const iterator& __x) - : _M_cur(__x._M_cur), _M_first(__x._M_first), - _M_last(__x._M_last), _M_node(__x._M_node) {} - - reference operator*() const { return *_M_cur; } -#ifndef __SGI_STL_NO_ARROW_OPERATOR - pointer operator->() const { return _M_cur; } -#endif /* __SGI_STL_NO_ARROW_OPERATOR */ - - difference_type operator-(const _Self& __x) const { - return difference_type(_S_buffer_size()) * (_M_node - __x._M_node - 1) + - (_M_cur - _M_first) + (__x._M_last - __x._M_cur); - } - - _Self& operator++() { - ++_M_cur; - if (_M_cur == _M_last) { - _M_set_node(_M_node + 1); - _M_cur = _M_first; - } - return *this; - } - _Self operator++(int) { - _Self __tmp = *this; - ++*this; - return __tmp; - } - - _Self& operator--() { - if (_M_cur == _M_first) { - _M_set_node(_M_node - 1); - _M_cur = _M_last; - } - --_M_cur; - return *this; - } - _Self operator--(int) { - _Self __tmp = *this; - --*this; - return __tmp; - } - - _Self& operator+=(difference_type __n) - { - difference_type __offset = __n + (_M_cur - _M_first); - if (__offset >= 0 && __offset < difference_type(_S_buffer_size())) - _M_cur += __n; - else { - difference_type __node_offset = - __offset > 0 ? __offset / difference_type(_S_buffer_size()) - : -difference_type((-__offset - 1) / _S_buffer_size()) - 1; - _M_set_node(_M_node + __node_offset); - _M_cur = _M_first + - (__offset - __node_offset * difference_type(_S_buffer_size())); - } - return *this; - } - - _Self operator+(difference_type __n) const - { - _Self __tmp = *this; - return __tmp += __n; - } - - _Self& operator-=(difference_type __n) { return *this += -__n; } - - _Self operator-(difference_type __n) const { - _Self __tmp = *this; - return __tmp -= __n; - } - - reference operator[](difference_type __n) const { return *(*this + __n); } - - bool operator==(const _Self& __x) const { return _M_cur == __x._M_cur; } - bool operator!=(const _Self& __x) const { return !(*this == __x); } - bool operator<(const _Self& __x) const { - return (_M_node == __x._M_node) ? - (_M_cur < __x._M_cur) : (_M_node < __x._M_node); - } - - void _M_set_node(_Map_pointer __new_node) { - _M_node = __new_node; - _M_first = *__new_node; - _M_last = _M_first + difference_type(_S_buffer_size()); - } -}; - -#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION - -#ifndef __STL_NON_TYPE_TMPL_PARAM_BUG - -template -inline random_access_iterator_tag -iterator_category(const _Deque_iterator<_Tp,_Ref,_Ptr,__bufsiz>&) { - return random_access_iterator_tag(); -} - -template -inline _Tp* -value_type(const _Deque_iterator<_Tp,_Ref,_Ptr,__bufsiz>&) { - return 0; -} - -template -inline ptrdiff_t* -distance_type(const _Deque_iterator<_Tp,_Ref,_Ptr,__bufsiz>&) { - return 0; -} - -#else /* __STL_NON_TYPE_TMPL_PARAM_BUG */ - -template -inline random_access_iterator_tag -iterator_category(const _Deque_iterator<_Tp,_Ref,_Ptr>&) -{ - return random_access_iterator_tag(); -} - -template -inline _Tp* -value_type(const _Deque_iterator<_Tp,_Ref,_Ptr>&) { return 0; } - -template -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 _Deque_alloc_base { -public: - typedef typename _Alloc_traits<_Tp,_Alloc>::allocator_type allocator_type; - allocator_type get_allocator() const { return node_allocator; } - - _Deque_alloc_base(const allocator_type& __a) - : node_allocator(__a), map_allocator(__a), _M_map(0), _M_map_size(0) - {} - -protected: - typedef typename _Alloc_traits<_Tp*, _Alloc>::allocator_type - map_allocator_type; - - allocator_type node_allocator; - map_allocator_type map_allocator; - - _Tp* _M_allocate_node() { - return node_allocator.allocate(__deque_buf_size(__bufsiz,sizeof(_Tp))); - } - void _M_deallocate_node(_Tp* __p) { - node_allocator.deallocate(__p, __deque_buf_size(__bufsiz,sizeof(_Tp))); - } - _Tp** _M_allocate_map(size_t __n) - { return map_allocator.allocate(__n); } - void _M_deallocate_map(_Tp** __p, size_t __n) - { map_allocator.deallocate(__p, __n); } - - _Tp** _M_map; - size_t _M_map_size; -}; - -// Specialization for instanceless allocators. -template -class _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 _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 _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 -_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 -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 -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 -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 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_reverse_iterator; - typedef reverse_iterator reverse_iterator; -#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - typedef reverse_iterator - const_reverse_iterator; - typedef reverse_iterator - reverse_iterator; -#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - -protected: // Internal typedefs - typedef pointer* _Map_pointer; - static size_t _S_buffer_size() - { return __deque_buf_size(__bufsiz, sizeof(_Tp)); } - -protected: -#ifdef __STL_USE_NAMESPACES - using _Base::_M_initialize_map; - using _Base::_M_create_nodes; - using _Base::_M_destroy_nodes; - using _Base::_M_allocate_node; - using _Base::_M_deallocate_node; - using _Base::_M_allocate_map; - using _Base::_M_deallocate_map; - - using _Base::_M_map; - using _Base::_M_map_size; - using _Base::_M_start; - using _Base::_M_finish; -#endif /* __STL_USE_NAMESPACES */ - -public: // Basic accessors - iterator begin() { return _M_start; } - iterator end() { return _M_finish; } - const_iterator begin() const { return _M_start; } - const_iterator end() const { return _M_finish; } - - reverse_iterator rbegin() { return reverse_iterator(_M_finish); } - reverse_iterator rend() { return reverse_iterator(_M_start); } - const_reverse_iterator rbegin() const - { return const_reverse_iterator(_M_finish); } - const_reverse_iterator rend() const - { return const_reverse_iterator(_M_start); } - - reference operator[](size_type __n) - { return _M_start[difference_type(__n)]; } - const_reference operator[](size_type __n) const - { return _M_start[difference_type(__n)]; } - - reference front() { return *_M_start; } - reference back() { - iterator __tmp = _M_finish; - --__tmp; - return *__tmp; - } - const_reference front() const { return *_M_start; } - const_reference back() const { - const_iterator __tmp = _M_finish; - --__tmp; - return *__tmp; - } - - size_type size() const { return _M_finish - _M_start;; } - size_type max_size() const { return size_type(-1); } - bool empty() const { return _M_finish == _M_start; } - -public: // Constructor, destructor. - explicit deque(const allocator_type& __a = allocator_type()) - : _Base(__a, 0) {} - deque(const deque& __x) : _Base(__x.get_allocator(), __x.size()) - { uninitialized_copy(__x.begin(), __x.end(), _M_start); } - deque(size_type __n, const value_type& __value, - const allocator_type& __a = allocator_type()) : _Base(__a, __n) - { _M_fill_initialize(__value); } - explicit deque(size_type __n) : _Base(allocator_type(), __n) - { _M_fill_initialize(value_type()); } - -#ifdef __STL_MEMBER_TEMPLATES - - // Check whether it's an integral type. If so, it's not an iterator. - template - 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 - void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) { - _M_initialize_map(__n); - _M_fill_initialize(__x); - } - - template - void _M_initialize_dispatch(_InputIter __first, _InputIter __last, - __false_type) { - _M_range_initialize(__first, __last, __ITERATOR_CATEGORY(__first)); - } - -#else /* __STL_MEMBER_TEMPLATES */ - - deque(const value_type* __first, const value_type* __last, - const allocator_type& __a = allocator_type()) - : _Base(__a, __last - __first) - { uninitialized_copy(__first, __last, _M_start); } - deque(const_iterator __first, const_iterator __last, - const allocator_type& __a = allocator_type()) - : _Base(__a, __last - __first) - { uninitialized_copy(__first, __last, _M_start); } - -#endif /* __STL_MEMBER_TEMPLATES */ - - ~deque() { destroy(_M_start, _M_finish); } - - deque& operator= (const deque& __x) { - const size_type __len = size(); - if (&__x != this) { - if (__len >= __x.size()) - erase(copy(__x.begin(), __x.end(), _M_start), _M_finish); - else { - const_iterator __mid = __x.begin() + difference_type(__len); - copy(__x.begin(), __mid, _M_start); - insert(_M_finish, __mid, __x.end()); - } - } - return *this; - } - - void swap(deque& __x) { - __STD::swap(_M_start, __x._M_start); - __STD::swap(_M_finish, __x._M_finish); - __STD::swap(_M_map, __x._M_map); - __STD::swap(_M_map_size, __x._M_map_size); - } - -public: - // assign(), a generalized assignment member function. Two - // versions: one that takes a count, and one that takes a range. - // The range version is a member template, so we dispatch on whether - // or not the type is an integer. - - void assign(size_type __n, const _Tp& __val) { - if (__n > size()) { - fill(begin(), end(), __val); - insert(end(), __n - size(), __val); - } - else { - erase(begin() + __n, end()); - fill(begin(), end(), __val); - } - } - -#ifdef __STL_MEMBER_TEMPLATES - - template - 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 - void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) - { assign((size_type) __n, (_Tp) __val); } - - template - void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, - __false_type) { - _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); - } - - template - void _M_assign_aux(_InputIterator __first, _InputIterator __last, - input_iterator_tag); - - template - void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, - forward_iterator_tag) { - size_type __len = 0; - distance(__first, __last, __len); - if (__len > size()) { - _ForwardIterator __mid = __first; - advance(__mid, size()); - copy(__first, __mid, begin()); - insert(end(), __mid, __last); - } - else - erase(copy(__first, __last, begin()), end()); - } - -#endif /* __STL_MEMBER_TEMPLATES */ - -public: // push_* and pop_* - - void push_back(const value_type& __t) { - if (_M_finish._M_cur != _M_finish._M_last - 1) { - construct(_M_finish._M_cur, __t); - ++_M_finish._M_cur; - } - else - _M_push_back_aux(__t); - } - - void push_back() { - if (_M_finish._M_cur != _M_finish._M_last - 1) { - construct(_M_finish._M_cur); - ++_M_finish._M_cur; - } - else - _M_push_back_aux(); - } - - void push_front(const value_type& __t) { - if (_M_start._M_cur != _M_start._M_first) { - construct(_M_start._M_cur - 1, __t); - --_M_start._M_cur; - } - else - _M_push_front_aux(__t); - } - - void push_front() { - if (_M_start._M_cur != _M_start._M_first) { - construct(_M_start._M_cur - 1); - --_M_start._M_cur; - } - else - _M_push_front_aux(); - } - - - void pop_back() { - if (_M_finish._M_cur != _M_finish._M_first) { - --_M_finish._M_cur; - destroy(_M_finish._M_cur); - } - else - _M_pop_back_aux(); - } - - void pop_front() { - if (_M_start._M_cur != _M_start._M_last - 1) { - destroy(_M_start._M_cur); - ++_M_start._M_cur; - } - else - _M_pop_front_aux(); - } - -public: // Insert - - iterator insert(iterator position, const value_type& __x) { - if (position._M_cur == _M_start._M_cur) { - push_front(__x); - return _M_start; - } - else if (position._M_cur == _M_finish._M_cur) { - push_back(__x); - iterator __tmp = _M_finish; - --__tmp; - return __tmp; - } - else { - return _M_insert_aux(position, __x); - } - } - - iterator insert(iterator __position) - { return insert(__position, value_type()); } - - void insert(iterator __pos, size_type __n, const value_type& __x); - -#ifdef __STL_MEMBER_TEMPLATES - - // Check whether it's an integral type. If so, it's not an iterator. - template - void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { - typedef typename _Is_integer<_InputIterator>::_Integral _Integral; - _M_insert_dispatch(__pos, __first, __last, _Integral()); - } - - template - void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, - __true_type) { - insert(__pos, (size_type) __n, (value_type) __x); - } - - template - void _M_insert_dispatch(iterator __pos, - _InputIterator __first, _InputIterator __last, - __false_type) { - insert(__pos, __first, __last, __ITERATOR_CATEGORY(__first)); - } - -#else /* __STL_MEMBER_TEMPLATES */ - - void insert(iterator __pos, - const value_type* __first, const value_type* __last); - void insert(iterator __pos, - const_iterator __first, const_iterator __last); - -#endif /* __STL_MEMBER_TEMPLATES */ - - void resize(size_type __new_size, const value_type& __x) { - const size_type __len = size(); - if (__new_size < __len) - erase(_M_start + __new_size, _M_finish); - else - insert(_M_finish, __new_size - __len, __x); - } - - void resize(size_type new_size) { resize(new_size, value_type()); } - -public: // Erase - iterator erase(iterator __pos) { - iterator __next = __pos; - ++__next; - difference_type __index = __pos - _M_start; - if (static_cast(__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 - void _M_range_initialize(_InputIterator __first, _InputIterator __last, - input_iterator_tag); - - template - 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 - void insert(iterator __pos, _InputIterator __first, _InputIterator __last, - input_iterator_tag); - - template - 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 - void _M_insert_aux(iterator __pos, - _ForwardIterator __first, _ForwardIterator __last, - size_type __n); - -#else /* __STL_MEMBER_TEMPLATES */ - - void _M_insert_aux(iterator __pos, - const value_type* __first, const value_type* __last, - size_type __n); - - void _M_insert_aux(iterator __pos, - const_iterator __first, const_iterator __last, - size_type __n); - -#endif /* __STL_MEMBER_TEMPLATES */ - - iterator _M_reserve_elements_at_front(size_type __n) { - size_type __vacancies = _M_start._M_cur - _M_start._M_first; - if (__n > __vacancies) - _M_new_elements_at_front(__n - __vacancies); - return _M_start - difference_type(__n); - } - - iterator _M_reserve_elements_at_back(size_type __n) { - size_type __vacancies = (_M_finish._M_last - _M_finish._M_cur) - 1; - if (__n > __vacancies) - _M_new_elements_at_back(__n - __vacancies); - return _M_finish + difference_type(__n); - } - - void _M_new_elements_at_front(size_type __new_elements); - void _M_new_elements_at_back(size_type __new_elements); - -protected: // Allocation of _M_map and nodes - - // Makes sure the _M_map has space for new nodes. Does not actually - // add the nodes. Can invalidate _M_map pointers. (And consequently, - // deque iterators.) - - void _M_reserve_map_at_back (size_type __nodes_to_add = 1) { - if (__nodes_to_add + 1 > _M_map_size - (_M_finish._M_node - _M_map)) - _M_reallocate_map(__nodes_to_add, false); - } - - void _M_reserve_map_at_front (size_type __nodes_to_add = 1) { - if (__nodes_to_add > size_type(_M_start._M_node - _M_map)) - _M_reallocate_map(__nodes_to_add, true); - } - - void _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front); - -#ifdef __STL_NON_TYPE_TMPL_PARAM_BUG -public: - bool operator==(const deque<_Tp,_Alloc,0>& __x) const { - return size() == __x.size() && equal(begin(), end(), __x.begin()); - } - bool operator!=(const deque<_Tp,_Alloc,0>& __x) const { - return size() != __x.size() || !equal(begin(), end(), __x.begin()); - } - bool operator<(const deque<_Tp,_Alloc,0>& __x) const { - return lexicographical_compare(begin(), end(), __x.begin(), __x.end()); - } -#endif /* __STL_NON_TYPE_TMPL_PARAM_BUG */ -}; - -// Non-inline member functions - -#ifdef __STL_MEMBER_TEMPLATES - -template -template -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 -void -deque<_Tp, _Alloc, __bufsize>::insert(iterator __pos, - size_type __n, const value_type& __x) -{ - if (__pos._M_cur == _M_start._M_cur) { - iterator __new_start = _M_reserve_elements_at_front(__n); - uninitialized_fill(__new_start, _M_start, __x); - _M_start = __new_start; - } - else if (__pos._M_cur == _M_finish._M_cur) { - iterator __new_finish = _M_reserve_elements_at_back(__n); - uninitialized_fill(_M_finish, __new_finish, __x); - _M_finish = __new_finish; - } - else - _M_insert_aux(__pos, __n, __x); -} - -#ifndef __STL_MEMBER_TEMPLATES - -template -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 -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 -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(__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 -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 -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 -template -void -deque<_Tp,_Alloc,__bufsize>::_M_range_initialize(_InputIterator __first, - _InputIterator __last, - input_iterator_tag) -{ - _M_initialize_map(0); - for ( ; __first != __last; ++__first) - push_back(*__first); -} - -template -template -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 -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 -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 -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 -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 -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 -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 -template -void -deque<_Tp,_Alloc,__bufsize>::insert(iterator __pos, - _InputIterator __first, - _InputIterator __last, - input_iterator_tag) -{ - copy(__first, __last, inserter(*this, __pos)); -} - -template -template -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 -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(__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 -typename deque<_Tp,_Alloc,__bufsize>::iterator -deque<_Tp,_Alloc,__bufsize>::_M_insert_aux(iterator __pos) -{ - difference_type __index = __pos - _M_start; - if (static_cast(__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 -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(__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 -template -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(__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 -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 -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 -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 -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 -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 -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 -bool operator<(const deque<_Tp, _Alloc, __bufsiz>& __x, - const deque<_Tp, _Alloc, __bufsiz>& __y) -{ - return lexicographical_compare(__x.begin(), __x.end(), - __y.begin(), __y.end()); -} - -#endif /* __STL_NON_TYPE_TMPL_PARAM_BUG */ - -#if defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER) && \ - !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) - -template -inline void -swap(deque<_Tp,_Alloc,__bufsiz>& __x, deque<_Tp,_Alloc,__bufsiz>& __y) -{ - __x.swap(__y); -} - -#endif - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#pragma reset woff 1375 -#endif - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_DEQUE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_function.h b/contrib/libstdc++/stl/stl_function.h deleted file mode 100644 index a5a8486576..0000000000 --- a/contrib/libstdc++/stl/stl_function.h +++ /dev/null @@ -1,700 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_FUNCTION_H -#define __SGI_STL_INTERNAL_FUNCTION_H - -__STL_BEGIN_NAMESPACE - -template -struct unary_function { - typedef _Arg argument_type; - typedef _Result result_type; -}; - -template -struct binary_function { - typedef _Arg1 first_argument_type; - typedef _Arg2 second_argument_type; - typedef _Result result_type; -}; - -template -struct plus : public binary_function<_Tp,_Tp,_Tp> { - _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x + __y; } -}; - -template -struct minus : public binary_function<_Tp,_Tp,_Tp> { - _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x - __y; } -}; - -template -struct multiplies : public binary_function<_Tp,_Tp,_Tp> { - _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; } -}; - -template -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 inline _Tp identity_element(plus<_Tp>) { - return _Tp(0); -} -template inline _Tp identity_element(multiplies<_Tp>) { - return _Tp(1); -} - -template -struct modulus : public binary_function<_Tp,_Tp,_Tp> -{ - _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x % __y; } -}; - -template -struct negate : public unary_function<_Tp,_Tp> -{ - _Tp operator()(const _Tp& __x) const { return -__x; } -}; - -template -struct equal_to : public binary_function<_Tp,_Tp,bool> -{ - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; } -}; - -template -struct not_equal_to : public binary_function<_Tp,_Tp,bool> -{ - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x != __y; } -}; - -template -struct greater : public binary_function<_Tp,_Tp,bool> -{ - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x > __y; } -}; - -template -struct less : public binary_function<_Tp,_Tp,bool> -{ - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; } -}; - -template -struct greater_equal : public binary_function<_Tp,_Tp,bool> -{ - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x >= __y; } -}; - -template -struct less_equal : public binary_function<_Tp,_Tp,bool> -{ - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x <= __y; } -}; - -template -struct logical_and : public binary_function<_Tp,_Tp,bool> -{ - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x && __y; } -}; - -template -struct logical_or : public binary_function<_Tp,_Tp,bool> -{ - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x || __y; } -}; - -template -struct logical_not : public unary_function<_Tp,bool> -{ - bool operator()(const _Tp& __x) const { return !__x; } -}; - -template -class unary_negate - : public unary_function { -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 -inline unary_negate<_Predicate> -not1(const _Predicate& __pred) -{ - return unary_negate<_Predicate>(__pred); -} - -template -class binary_negate - : public binary_function { -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 -inline binary_negate<_Predicate> -not2(const _Predicate& __pred) -{ - return binary_negate<_Predicate>(__pred); -} - -template -class binder1st - : public unary_function { -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 -inline binder1st<_Operation> -bind1st(const _Operation& __oper, const _Tp& __x) -{ - typedef typename _Operation::first_argument_type _Arg1_type; - return binder1st<_Operation>(__oper, _Arg1_type(__x)); -} - -template -class binder2nd - : public unary_function { -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 -inline binder2nd<_Operation> -bind2nd(const _Operation& __oper, const _Tp& __x) -{ - typedef typename _Operation::second_argument_type _Arg2_type; - return binder2nd<_Operation>(__oper, _Arg2_type(__x)); -} - -// unary_compose and binary_compose (extensions, not part of the standard). - -template -class unary_compose - : public unary_function -{ -protected: - _Operation1 __op1; - _Operation2 __op2; -public: - unary_compose(const _Operation1& __x, const _Operation2& __y) - : __op1(__x), __op2(__y) {} - typename _Operation1::result_type - operator()(const typename _Operation2::argument_type& __x) const { - return __op1(__op2(__x)); - } -}; - -template -inline unary_compose<_Operation1,_Operation2> -compose1(const _Operation1& __op1, const _Operation2& __op2) -{ - return unary_compose<_Operation1,_Operation2>(__op1, __op2); -} - -template -class binary_compose - : public unary_function { -protected: - _Operation1 _M_op1; - _Operation2 _M_op2; - _Operation3 _M_op3; -public: - binary_compose(const _Operation1& __x, const _Operation2& __y, - const _Operation3& __z) - : _M_op1(__x), _M_op2(__y), _M_op3(__z) { } - typename _Operation1::result_type - operator()(const typename _Operation2::argument_type& __x) const { - return _M_op1(_M_op2(__x), _M_op3(__x)); - } -}; - -template -inline binary_compose<_Operation1, _Operation2, _Operation3> -compose2(const _Operation1& __op1, const _Operation2& __op2, - const _Operation3& __op3) -{ - return binary_compose<_Operation1,_Operation2,_Operation3> - (__op1, __op2, __op3); -} - -template -class 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 -inline pointer_to_unary_function<_Arg, _Result> ptr_fun(_Result (*__x)(_Arg)) -{ - return pointer_to_unary_function<_Arg, _Result>(__x); -} - -template -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 -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 -struct _Identity : public unary_function<_Tp,_Tp> { - const _Tp& operator()(const _Tp& __x) const { return __x; } -}; - -template struct identity : public _Identity<_Tp> {}; - -// select1st and select2nd are extensions: they are not part of the standard. -template -struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> { - const typename _Pair::first_type& operator()(const _Pair& __x) const { - return __x.first; - } -}; - -template -struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> -{ - const typename _Pair::second_type& operator()(const _Pair& __x) const { - return __x.second; - } -}; - -template struct select1st : public _Select1st<_Pair> {}; -template struct select2nd : public _Select2nd<_Pair> {}; - -// project1st and project2nd are extensions: they are not part of the standard -template -struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1> { - _Arg1 operator()(const _Arg1& __x, const _Arg2&) const { return __x; } -}; - -template -struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> { - _Arg2 operator()(const _Arg1&, const _Arg2& __y) const { return __y; } -}; - -template -struct project1st : public _Project1st<_Arg1, _Arg2> {}; - -template -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 -struct constant_void_fun -{ - typedef _Result result_type; - result_type __val; - constant_void_fun(const result_type& __v) : __val(__v) {} - const result_type& operator()() const { return __val; } -}; - -#ifndef __STL_LIMITED_DEFAULT_TEMPLATES -template -#else -template -#endif -struct constant_unary_fun : public unary_function<_Argument, _Result> { - _Result _M_val; - constant_unary_fun(const _Result& __v) : _M_val(__v) {} - const _Result& operator()(const _Argument&) const { return _M_val; } -}; - -#ifndef __STL_LIMITED_DEFAULT_TEMPLATES -template -#else -template -#endif -struct constant_binary_fun : public binary_function<_Arg1, _Arg2, _Result> { - _Result _M_val; - constant_binary_fun(const _Result& __v) : _M_val(__v) {} - const _Result& operator()(const _Arg1&, const _Arg2&) const { - return _M_val; - } -}; - -template -inline constant_void_fun<_Result> constant0(const _Result& __val) -{ - return constant_void_fun<_Result>(__val); -} - -template -inline constant_unary_fun<_Result,_Result> constant1(const _Result& __val) -{ - return constant_unary_fun<_Result,_Result>(__val); -} - -template -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 { -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 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 const_mem_fun_t : public unary_function { -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 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 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 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 const_mem_fun1_t : public binary_function { -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 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 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 mem_fun_t : 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 const_mem_fun_t : public unary_function { -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 mem_fun_ref_t : 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 const_mem_fun_ref_t : 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 mem_fun1_t : 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 const_mem_fun1_t - : public binary_function { -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 mem_fun1_ref_t - : 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 const_mem_fun1_ref_t - : 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 -inline mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)()) - { return mem_fun_t<_Ret,_Tp>(__f); } - -template -inline const_mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)() const) - { return const_mem_fun_t<_Ret,_Tp>(__f); } - -template -inline mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)()) - { return mem_fun_ref_t<_Ret,_Tp>(__f); } - -template -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 -inline mem_fun1_t<_Ret,_Tp,_Arg> mem_fun(_Ret (_Tp::*__f)(_Arg)) - { return mem_fun1_t<_Ret,_Tp,_Arg>(__f); } - -template -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 -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 -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 -inline mem_fun1_t<_Ret,_Tp,_Arg> mem_fun1(_Ret (_Tp::*__f)(_Arg)) - { return mem_fun1_t<_Ret,_Tp,_Arg>(__f); } - -template -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 -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 -inline const_mem_fun1_ref_t<_Ret,_Tp,_Arg> -mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const) - { return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); } - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_FUNCTION_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_hash_fun.h b/contrib/libstdc++/stl/stl_hash_fun.h deleted file mode 100644 index 44ab9bb567..0000000000 --- a/contrib/libstdc++/stl/stl_hash_fun.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_HASH_FUN_H -#define __SGI_STL_HASH_FUN_H - -#include - -__STL_BEGIN_NAMESPACE - -template 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 -{ - size_t operator()(const char* __s) const { return __stl_hash_string(__s); } -}; - -__STL_TEMPLATE_NULL struct hash -{ - size_t operator()(const char* __s) const { return __stl_hash_string(__s); } -}; - -__STL_TEMPLATE_NULL struct hash { - size_t operator()(char __x) const { return __x; } -}; -__STL_TEMPLATE_NULL struct hash { - size_t operator()(unsigned char __x) const { return __x; } -}; -__STL_TEMPLATE_NULL struct hash { - size_t operator()(unsigned char __x) const { return __x; } -}; -__STL_TEMPLATE_NULL struct hash { - size_t operator()(short __x) const { return __x; } -}; -__STL_TEMPLATE_NULL struct hash { - size_t operator()(unsigned short __x) const { return __x; } -}; -__STL_TEMPLATE_NULL struct hash { - size_t operator()(int __x) const { return __x; } -}; -__STL_TEMPLATE_NULL struct hash { - size_t operator()(unsigned int __x) const { return __x; } -}; -__STL_TEMPLATE_NULL struct hash { - size_t operator()(long __x) const { return __x; } -}; -__STL_TEMPLATE_NULL struct hash { - size_t operator()(unsigned long __x) const { return __x; } -}; - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_HASH_FUN_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_hash_map.h b/contrib/libstdc++/stl/stl_hash_map.h deleted file mode 100644 index bf16f60eca..0000000000 --- a/contrib/libstdc++/stl/stl_hash_map.h +++ /dev/null @@ -1,416 +0,0 @@ -/* - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_HASH_MAP_H -#define __SGI_STL_INTERNAL_HASH_MAP_H - - -__STL_BEGIN_NAMESPACE - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1174 -#pragma set woff 1375 -#endif - -#ifndef __STL_LIMITED_DEFAULT_TEMPLATES -template , - class _EqualKey = equal_to<_Key>, - class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) > -#else -template -#endif -class hash_map -{ -private: - typedef hashtable,_Key,_HashFcn, - _Select1st >,_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 - hash_map(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - template - hash_map(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - template - 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 - hash_map(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } - -#else - hash_map(const value_type* __f, const value_type* __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_map(const value_type* __f, const value_type* __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_map(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_map(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } - - hash_map(const_iterator __f, const_iterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_map(const_iterator __f, const_iterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_map(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_map(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } -#endif /*__STL_MEMBER_TEMPLATES */ - -public: - size_type size() const { return _M_ht.size(); } - size_type max_size() const { return _M_ht.max_size(); } - bool empty() const { return _M_ht.empty(); } - void swap(hash_map& __hs) { _M_ht.swap(__hs._M_ht); } - friend bool - operator== __STL_NULL_TMPL_ARGS (const hash_map&, const hash_map&); - - iterator begin() { return _M_ht.begin(); } - iterator end() { return _M_ht.end(); } - const_iterator begin() const { return _M_ht.begin(); } - const_iterator end() const { return _M_ht.end(); } - -public: - pair insert(const value_type& __obj) - { return _M_ht.insert_unique(__obj); } -#ifdef __STL_MEMBER_TEMPLATES - template - 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 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 equal_range(const key_type& __key) - { return _M_ht.equal_range(__key); } - pair - 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 -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 -inline void -swap(hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1, - hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2) -{ - __hm1.swap(__hm2); -} - -#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ - -#ifndef __STL_LIMITED_DEFAULT_TEMPLATES -template , - class _EqualKey = equal_to<_Key>, - class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) > -#else -template -#endif -class hash_multimap -{ -private: - typedef hashtable, _Key, _HashFcn, - _Select1st >, _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 - hash_multimap(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - template - hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - template - 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 - hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } - -#else - hash_multimap(const value_type* __f, const value_type* __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multimap(const value_type* __f, const value_type* __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multimap(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multimap(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } - - hash_multimap(const_iterator __f, const_iterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multimap(const_iterator __f, const_iterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multimap(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multimap(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } -#endif /*__STL_MEMBER_TEMPLATES */ - -public: - size_type size() const { return _M_ht.size(); } - size_type max_size() const { return _M_ht.max_size(); } - bool empty() const { return _M_ht.empty(); } - void swap(hash_multimap& __hs) { _M_ht.swap(__hs._M_ht); } - friend bool - operator== __STL_NULL_TMPL_ARGS (const hash_multimap&, - const hash_multimap&); - - iterator begin() { return _M_ht.begin(); } - iterator end() { return _M_ht.end(); } - const_iterator begin() const { return _M_ht.begin(); } - const_iterator end() const { return _M_ht.end(); } - -public: - iterator insert(const value_type& __obj) - { return _M_ht.insert_equal(__obj); } -#ifdef __STL_MEMBER_TEMPLATES - template - 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 equal_range(const key_type& __key) - { return _M_ht.equal_range(__key); } - pair - 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 -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 -inline void -swap(hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1, - hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2) -{ - __hm1.swap(__hm2); -} - -#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#pragma reset woff 1375 -#endif - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_HASH_MAP_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_hash_set.h b/contrib/libstdc++/stl/stl_hash_set.h deleted file mode 100644 index b623a642cf..0000000000 --- a/contrib/libstdc++/stl/stl_hash_set.h +++ /dev/null @@ -1,401 +0,0 @@ -/* - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_HASH_SET_H -#define __SGI_STL_INTERNAL_HASH_SET_H - -__STL_BEGIN_NAMESPACE - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1174 -#pragma set woff 1375 -#endif - -#ifndef __STL_LIMITED_DEFAULT_TEMPLATES -template , - class _EqualKey = equal_to<_Value>, - class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) > -#else -template -#endif -class hash_set -{ -private: - typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, - _EqualKey, _Alloc> _Ht; - _Ht _M_ht; - -public: - typedef typename _Ht::key_type key_type; - typedef typename _Ht::value_type value_type; - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Ht::const_pointer pointer; - typedef typename _Ht::const_pointer const_pointer; - typedef typename _Ht::const_reference reference; - typedef typename _Ht::const_reference const_reference; - - typedef typename _Ht::const_iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher hash_funct() const { return _M_ht.hash_funct(); } - key_equal key_eq() const { return _M_ht.key_eq(); } - allocator_type get_allocator() const { return _M_ht.get_allocator(); } - -public: - hash_set() - : _M_ht(100, hasher(), key_equal(), allocator_type()) {} - explicit hash_set(size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} - hash_set(size_type __n, const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) {} - hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - -#ifdef __STL_MEMBER_TEMPLATES - template - hash_set(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - template - hash_set(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - template - 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 - hash_set(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } -#else - - hash_set(const value_type* __f, const value_type* __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_set(const value_type* __f, const value_type* __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_set(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_set(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } - - hash_set(const_iterator __f, const_iterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_set(const_iterator __f, const_iterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_set(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_set(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } -#endif /*__STL_MEMBER_TEMPLATES */ - -public: - size_type size() const { return _M_ht.size(); } - size_type max_size() const { return _M_ht.max_size(); } - bool empty() const { return _M_ht.empty(); } - void swap(hash_set& __hs) { _M_ht.swap(__hs._M_ht); } - friend bool operator== __STL_NULL_TMPL_ARGS (const hash_set&, - const hash_set&); - - iterator begin() const { return _M_ht.begin(); } - iterator end() const { return _M_ht.end(); } - -public: - pair insert(const value_type& __obj) - { - pair __p = _M_ht.insert_unique(__obj); - return pair(__p.first, __p.second); - } -#ifdef __STL_MEMBER_TEMPLATES - template - 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 insert_noresize(const value_type& __obj) - { - pair __p = - _M_ht.insert_unique_noresize(__obj); - return pair(__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 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 -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 -inline void -swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, - hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) -{ - __hs1.swap(__hs2); -} - -#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ - - -#ifndef __STL_LIMITED_DEFAULT_TEMPLATES -template , - class _EqualKey = equal_to<_Value>, - class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) > -#else -template -#endif -class hash_multiset -{ -private: - typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, - _EqualKey, _Alloc> _Ht; - _Ht _M_ht; - -public: - typedef typename _Ht::key_type key_type; - typedef typename _Ht::value_type value_type; - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Ht::const_pointer pointer; - typedef typename _Ht::const_pointer const_pointer; - typedef typename _Ht::const_reference reference; - typedef typename _Ht::const_reference const_reference; - - typedef typename _Ht::const_iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher hash_funct() const { return _M_ht.hash_funct(); } - key_equal key_eq() const { return _M_ht.key_eq(); } - allocator_type get_allocator() const { return _M_ht.get_allocator(); } - -public: - hash_multiset() - : _M_ht(100, hasher(), key_equal(), allocator_type()) {} - explicit hash_multiset(size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} - hash_multiset(size_type __n, const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) {} - hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - -#ifdef __STL_MEMBER_TEMPLATES - template - hash_multiset(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - template - hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - template - 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 - hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } -#else - - hash_multiset(const value_type* __f, const value_type* __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multiset(const value_type* __f, const value_type* __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multiset(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multiset(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } - - hash_multiset(const_iterator __f, const_iterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multiset(const_iterator __f, const_iterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multiset(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multiset(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } -#endif /*__STL_MEMBER_TEMPLATES */ - -public: - size_type size() const { return _M_ht.size(); } - size_type max_size() const { return _M_ht.max_size(); } - bool empty() const { return _M_ht.empty(); } - void swap(hash_multiset& hs) { _M_ht.swap(hs._M_ht); } - friend bool operator== __STL_NULL_TMPL_ARGS (const hash_multiset&, - const hash_multiset&); - - iterator begin() const { return _M_ht.begin(); } - iterator end() const { return _M_ht.end(); } - -public: - iterator insert(const value_type& __obj) - { return _M_ht.insert_equal(__obj); } -#ifdef __STL_MEMBER_TEMPLATES - template - 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 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 -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 -inline void -swap(hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, - hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) { - __hs1.swap(__hs2); -} - -#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#pragma reset woff 1375 -#endif - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_HASH_SET_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_hashtable.h b/contrib/libstdc++/stl/stl_hashtable.h deleted file mode 100644 index 78b36c1d5a..0000000000 --- a/contrib/libstdc++/stl/stl_hashtable.h +++ /dev/null @@ -1,1039 +0,0 @@ -/* - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_HASHTABLE_H -#define __SGI_STL_INTERNAL_HASHTABLE_H - -// Hashtable class, used to implement the hashed associative containers -// hash_set, hash_map, hash_multiset, and hash_multimap. - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -__STL_BEGIN_NAMESPACE - -template -struct _Hashtable_node -{ - _Hashtable_node* _M_next; - _Val _M_val; -}; - -template -class hashtable; - -template -struct _Hashtable_iterator; - -template -struct _Hashtable_const_iterator; - -template -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 -struct _Hashtable_const_iterator { - typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc> - _Hashtable; - typedef _Hashtable_iterator<_Val,_Key,_HashFcn, - _ExtractKey,_EqualKey,_Alloc> - iterator; - typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, - _ExtractKey, _EqualKey, _Alloc> - const_iterator; - typedef _Hashtable_node<_Val> _Node; - - typedef forward_iterator_tag iterator_category; - typedef _Val value_type; - typedef ptrdiff_t difference_type; - typedef size_t size_type; - typedef const _Val& reference; - typedef const _Val* pointer; - - const _Node* _M_cur; - const _Hashtable* _M_ht; - - _Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab) - : _M_cur(__n), _M_ht(__tab) {} - _Hashtable_const_iterator() {} - _Hashtable_const_iterator(const iterator& __it) - : _M_cur(__it._M_cur), _M_ht(__it._M_ht) {} - reference operator*() const { return _M_cur->_M_val; } -#ifndef __SGI_STL_NO_ARROW_OPERATOR - pointer operator->() const { return &(operator*()); } -#endif /* __SGI_STL_NO_ARROW_OPERATOR */ - const_iterator& operator++(); - const_iterator operator++(int); - bool operator==(const const_iterator& __it) const - { return _M_cur == __it._M_cur; } - bool operator!=(const const_iterator& __it) const - { return _M_cur != __it._M_cur; } -}; - -// Note: assumes long is at least 32 bits. -static const int __stl_num_primes = 28; -static const unsigned long __stl_prime_list[__stl_num_primes] = -{ - 53ul, 97ul, 193ul, 389ul, 769ul, - 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, - 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, - 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, - 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul, - 1610612741ul, 3221225473ul, 4294967291ul -}; - -inline unsigned long __stl_next_prime(unsigned long __n) -{ - const unsigned long* __first = __stl_prime_list; - const unsigned long* __last = __stl_prime_list + __stl_num_primes; - const unsigned long* pos = lower_bound(__first, __last, __n); - return pos == __last ? *(__last - 1) : *pos; -} - -// Forward declaration of operator==. - -template -class hashtable; - -template -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 hashtable { -public: - typedef _Key key_type; - typedef _Val value_type; - typedef _HashFcn hasher; - typedef _EqualKey key_equal; - - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - - hasher hash_funct() const { return _M_hash; } - key_equal key_eq() const { return _M_equals; } - -private: - typedef _Hashtable_node<_Val> _Node; - -#ifdef __STL_USE_STD_ALLOCATORS -public: - typedef typename _Alloc_traits<_Val,_Alloc>::allocator_type allocator_type; - allocator_type get_allocator() const { return _M_node_allocator; } -private: - typename _Alloc_traits<_Node, _Alloc>::allocator_type _M_node_allocator; - _Node* _M_get_node() { return _M_node_allocator.allocate(1); } - void _M_put_node(_Node* __p) { _M_node_allocator.deallocate(__p, 1); } -# define __HASH_ALLOC_INIT(__a) _M_node_allocator(__a), -#else /* __STL_USE_STD_ALLOCATORS */ -public: - typedef _Alloc allocator_type; - allocator_type get_allocator() const { return allocator_type(); } -private: - typedef simple_alloc<_Node, _Alloc> _M_node_allocator_type; - _Node* _M_get_node() { return _M_node_allocator_type::allocate(1); } - void _M_put_node(_Node* __p) { _M_node_allocator_type::deallocate(__p, 1); } -# define __HASH_ALLOC_INIT(__a) -#endif /* __STL_USE_STD_ALLOCATORS */ - -private: - hasher _M_hash; - key_equal _M_equals; - _ExtractKey _M_get_key; - vector<_Node*,_Alloc> _M_buckets; - size_type _M_num_elements; - -public: - typedef _Hashtable_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc> - iterator; - typedef _Hashtable_const_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey, - _Alloc> - const_iterator; - - friend struct - _Hashtable_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>; - friend struct - _Hashtable_const_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>; - -public: - hashtable(size_type __n, - const _HashFcn& __hf, - const _EqualKey& __eql, - const _ExtractKey& __ext, - const allocator_type& __a = allocator_type()) - : __HASH_ALLOC_INIT(__a) - _M_hash(__hf), - _M_equals(__eql), - _M_get_key(__ext), - _M_buckets(__a), - _M_num_elements(0) - { - _M_initialize_buckets(__n); - } - - hashtable(size_type __n, - const _HashFcn& __hf, - const _EqualKey& __eql, - const allocator_type& __a = allocator_type()) - : __HASH_ALLOC_INIT(__a) - _M_hash(__hf), - _M_equals(__eql), - _M_get_key(_ExtractKey()), - _M_buckets(__a), - _M_num_elements(0) - { - _M_initialize_buckets(__n); - } - - hashtable(const hashtable& __ht) - : __HASH_ALLOC_INIT(__ht.get_allocator()) - _M_hash(__ht._M_hash), - _M_equals(__ht._M_equals), - _M_get_key(__ht._M_get_key), - _M_buckets(__ht.get_allocator()), - _M_num_elements(0) - { - _M_copy_from(__ht); - } - -#undef __HASH_ALLOC_INIT - - hashtable& operator= (const hashtable& __ht) - { - if (&__ht != this) { - clear(); - _M_hash = __ht._M_hash; - _M_equals = __ht._M_equals; - _M_get_key = __ht._M_get_key; - _M_copy_from(__ht); - } - return *this; - } - - ~hashtable() { clear(); } - - size_type size() const { return _M_num_elements; } - size_type max_size() const { return size_type(-1); } - bool empty() const { return size() == 0; } - - void swap(hashtable& __ht) - { - __STD::swap(_M_hash, __ht._M_hash); - __STD::swap(_M_equals, __ht._M_equals); - __STD::swap(_M_get_key, __ht._M_get_key); - _M_buckets.swap(__ht._M_buckets); - __STD::swap(_M_num_elements, __ht._M_num_elements); - } - - iterator begin() - { - for (size_type __n = 0; __n < _M_buckets.size(); ++__n) - if (_M_buckets[__n]) - return iterator(_M_buckets[__n], this); - return end(); - } - - iterator end() { return iterator(0, this); } - - const_iterator begin() const - { - for (size_type __n = 0; __n < _M_buckets.size(); ++__n) - if (_M_buckets[__n]) - return const_iterator(_M_buckets[__n], this); - return end(); - } - - const_iterator end() const { return const_iterator(0, this); } - - friend bool - operator== __STL_NULL_TMPL_ARGS (const hashtable&, const hashtable&); - -public: - - size_type bucket_count() const { return _M_buckets.size(); } - - size_type max_bucket_count() const - { return __stl_prime_list[__stl_num_primes - 1]; } - - size_type elems_in_bucket(size_type __bucket) const - { - size_type __result = 0; - for (_Node* __cur = _M_buckets[__bucket]; __cur; __cur = __cur->_M_next) - __result += 1; - return __result; - } - - pair 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 insert_unique_noresize(const value_type& __obj); - iterator insert_equal_noresize(const value_type& __obj); - -#ifdef __STL_MEMBER_TEMPLATES - template - void insert_unique(_InputIterator __f, _InputIterator __l) - { - insert_unique(__f, __l, __ITERATOR_CATEGORY(__f)); - } - - template - void insert_equal(_InputIterator __f, _InputIterator __l) - { - insert_equal(__f, __l, __ITERATOR_CATEGORY(__f)); - } - - template - void insert_unique(_InputIterator __f, _InputIterator __l, - input_iterator_tag) - { - for ( ; __f != __l; ++__f) - insert_unique(*__f); - } - - template - void insert_equal(_InputIterator __f, _InputIterator __l, - input_iterator_tag) - { - for ( ; __f != __l; ++__f) - insert_equal(*__f); - } - - template - 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 - 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 - equal_range(const key_type& __key); - - pair - 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 -_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 -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 -_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 -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 -inline forward_iterator_tag -iterator_category(const _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&) -{ - return forward_iterator_tag(); -} - -template -inline _Val* -value_type(const _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&) -{ - return (_Val*) 0; -} - -template -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 -inline forward_iterator_tag -iterator_category(const _Hashtable_const_iterator<_Val,_Key,_HF, - _ExK,_EqK,_All>&) -{ - return forward_iterator_tag(); -} - -template -inline _Val* -value_type(const _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&) -{ - return (_Val*) 0; -} - -template -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 -inline bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1, - const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2) -{ - typedef typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::_Node _Node; - if (__ht1._M_buckets.size() != __ht2._M_buckets.size()) - return false; - for (int __n = 0; __n < __ht1._M_buckets.size(); ++__n) { - _Node* __cur1 = __ht1._M_buckets[__n]; - _Node* __cur2 = __ht2._M_buckets[__n]; - for ( ; __cur1 && __cur2 && __cur1->_M_val == __cur2->_M_val; - __cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next) - {} - if (__cur1 || __cur2) - return false; - } - return true; -} - -#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER - -template -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 -pair::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(__cur, this), false); - - _Node* __tmp = _M_new_node(__obj); - __tmp->_M_next = __first; - _M_buckets[__n] = __tmp; - ++_M_num_elements; - return pair(iterator(__tmp, this), true); -} - -template -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 -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 -pair::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 _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 -pair::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 _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 -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 -void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const iterator& __it) -{ - if (_Node* const __p = __it._M_cur) { - const size_type __n = _M_bkt_num(__p->_M_val); - _Node* __cur = _M_buckets[__n]; - - if (__cur == __p) { - _M_buckets[__n] = __cur->_M_next; - _M_delete_node(__cur); - --_M_num_elements; - } - else { - _Node* __next = __cur->_M_next; - while (__next) { - if (__next == __p) { - __cur->_M_next = __next->_M_next; - _M_delete_node(__next); - --_M_num_elements; - break; - } - else { - __cur = __next; - __next = __cur->_M_next; - } - } - } - } -} - -template -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 -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(__first._M_ht)), - iterator(const_cast<_Node*>(__last._M_cur), - const_cast(__last._M_ht))); -} - -template -inline void -hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const const_iterator& __it) -{ - erase(iterator(const_cast<_Node*>(__it._M_cur), - const_cast(__it._M_ht))); -} - -template -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 -void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> - ::_M_erase_bucket(const size_type __n, _Node* __first, _Node* __last) -{ - _Node* __cur = _M_buckets[__n]; - if (__cur == __first) - _M_erase_bucket(__n, __last); - else { - _Node* __next; - for (__next = __cur->_M_next; - __next != __first; - __cur = __next, __next = __cur->_M_next) - ; - while (__next) { - __cur->_M_next = __next->_M_next; - _M_delete_node(__next); - __next = __cur->_M_next; - --_M_num_elements; - } - } -} - -template -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 -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 -void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> - ::_M_copy_from(const hashtable& __ht) -{ - _M_buckets.clear(); - _M_buckets.reserve(__ht._M_buckets.size()); - _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0); - __STL_TRY { - for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) { - if (const _Node* __cur = __ht._M_buckets[__i]) { - _Node* __copy = _M_new_node(__cur->_M_val); - _M_buckets[__i] = __copy; - - for (_Node* __next = __cur->_M_next; - __next; - __cur = __next, __next = __cur->_M_next) { - __copy->_M_next = _M_new_node(__next->_M_val); - __copy = __copy->_M_next; - } - } - } - _M_num_elements = __ht._M_num_elements; - } - __STL_UNWIND(clear()); -} - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_HASHTABLE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_heap.h b/contrib/libstdc++/stl/stl_heap.h deleted file mode 100644 index 62f142ec97..0000000000 --- a/contrib/libstdc++/stl/stl_heap.h +++ /dev/null @@ -1,281 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_HEAP_H -#define __SGI_STL_INTERNAL_HEAP_H - -__STL_BEGIN_NAMESPACE - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1209 -#endif - -// Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap. - -template -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 -inline void -__push_heap_aux(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Distance*, _Tp*) -{ - __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0), - _Tp(*(__last - 1))); -} - -template -inline void -push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) -{ - __push_heap_aux(__first, __last, - __DISTANCE_TYPE(__first), __VALUE_TYPE(__first)); -} - -template -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 -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 -inline void -push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp) -{ - __push_heap_aux(__first, __last, __comp, - __DISTANCE_TYPE(__first), __VALUE_TYPE(__first)); -} - -template -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 -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 -inline void -__pop_heap_aux(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Tp*) -{ - __pop_heap(__first, __last - 1, __last - 1, - _Tp(*(__last - 1)), __DISTANCE_TYPE(__first)); -} - -template -inline void pop_heap(_RandomAccessIterator __first, - _RandomAccessIterator __last) -{ - __pop_heap_aux(__first, __last, __VALUE_TYPE(__first)); -} - -template -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 -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 -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 -inline void -pop_heap(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Compare __comp) -{ - __pop_heap_aux(__first, __last, __VALUE_TYPE(__first), __comp); -} - -template -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 -inline void -make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) -{ - __make_heap(__first, __last, - __VALUE_TYPE(__first), __DISTANCE_TYPE(__first)); -} - -template -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 -inline void -make_heap(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Compare __comp) -{ - __make_heap(__first, __last, __comp, - __VALUE_TYPE(__first), __DISTANCE_TYPE(__first)); -} - -template -void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) -{ - while (__last - __first > 1) - pop_heap(__first, __last--); -} - -template -void -sort_heap(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Compare __comp) -{ - while (__last - __first > 1) - pop_heap(__first, __last--, __comp); -} - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1209 -#endif - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_HEAP_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_iterator.h b/contrib/libstdc++/stl/stl_iterator.h deleted file mode 100644 index e2bd714969..0000000000 --- a/contrib/libstdc++/stl/stl_iterator.h +++ /dev/null @@ -1,915 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_ITERATOR_H -#define __SGI_STL_INTERNAL_ITERATOR_H - -__STL_BEGIN_NAMESPACE - -struct input_iterator_tag {}; -struct output_iterator_tag {}; -struct forward_iterator_tag : public input_iterator_tag {}; -struct bidirectional_iterator_tag : public forward_iterator_tag {}; -struct random_access_iterator_tag : public bidirectional_iterator_tag {}; - -// The base classes input_iterator, output_iterator, forward_iterator, -// bidirectional_iterator, and random_access_iterator are not part of -// the C++ standard. (they have been replaced by struct iterator.) -// They are included for backward compatibility with the HP STL. - -template 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 struct forward_iterator { - typedef forward_iterator_tag iterator_category; - typedef _Tp value_type; - typedef _Distance difference_type; - typedef _Tp* pointer; - typedef _Tp& reference; -}; - - -template struct bidirectional_iterator { - typedef bidirectional_iterator_tag iterator_category; - typedef _Tp value_type; - typedef _Distance difference_type; - typedef _Tp* pointer; - typedef _Tp& reference; -}; - -template 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 -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 -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 -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 -struct iterator_traits { - 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 -inline typename iterator_traits<_Iter>::iterator_category -__iterator_category(const _Iter&) -{ - typedef typename iterator_traits<_Iter>::iterator_category _Category; - return _Category(); -} - -template -inline typename iterator_traits<_Iter>::difference_type* -__distance_type(const _Iter&) -{ - return static_cast::difference_type*>(0); -} - -template -inline typename iterator_traits<_Iter>::value_type* -__value_type(const _Iter&) -{ - return static_cast::value_type*>(0); -} - -template -inline typename iterator_traits<_Iter>::iterator_category -iterator_category(const _Iter& __i) { return __iterator_category(__i); } - - -template -inline typename iterator_traits<_Iter>::difference_type* -distance_type(const _Iter& __i) { return __distance_type(__i); } - -template -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 -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 -inline forward_iterator_tag -iterator_category(const forward_iterator<_Tp, _Distance>&) - { return forward_iterator_tag(); } - -template -inline bidirectional_iterator_tag -iterator_category(const bidirectional_iterator<_Tp, _Distance>&) - { return bidirectional_iterator_tag(); } - -template -inline random_access_iterator_tag -iterator_category(const random_access_iterator<_Tp, _Distance>&) - { return random_access_iterator_tag(); } - -template -inline random_access_iterator_tag iterator_category(const _Tp*) - { return random_access_iterator_tag(); } - -template -inline _Tp* value_type(const input_iterator<_Tp, _Distance>&) - { return (_Tp*)(0); } - -template -inline _Tp* value_type(const forward_iterator<_Tp, _Distance>&) - { return (_Tp*)(0); } - -template -inline _Tp* value_type(const bidirectional_iterator<_Tp, _Distance>&) - { return (_Tp*)(0); } - -template -inline _Tp* value_type(const random_access_iterator<_Tp, _Distance>&) - { return (_Tp*)(0); } - -template -inline _Tp* value_type(const _Tp*) { return (_Tp*)(0); } - -template -inline _Distance* distance_type(const input_iterator<_Tp, _Distance>&) -{ - return (_Distance*)(0); -} - -template -inline _Distance* distance_type(const forward_iterator<_Tp, _Distance>&) -{ - return (_Distance*)(0); -} - -template -inline _Distance* -distance_type(const bidirectional_iterator<_Tp, _Distance>&) -{ - return (_Distance*)(0); -} - -template -inline _Distance* -distance_type(const random_access_iterator<_Tp, _Distance>&) -{ - return (_Distance*)(0); -} - -template -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 -inline void __distance(_InputIterator __first, _InputIterator __last, - _Distance& __n, input_iterator_tag) -{ - while (__first != __last) { ++__first; ++__n; } -} - -template -inline void __distance(_RandomAccessIterator __first, - _RandomAccessIterator __last, - _Distance& __n, random_access_iterator_tag) -{ - __n += __last - __first; -} - -template -inline void distance(_InputIterator __first, - _InputIterator __last, _Distance& __n) -{ - __distance(__first, __last, __n, iterator_category(__first)); -} - -#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION - -template -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 -inline typename iterator_traits<_RandomAccessIterator>::difference_type -__distance(_RandomAccessIterator __first, _RandomAccessIterator __last, - random_access_iterator_tag) { - return __last - __first; -} - -template -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 -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 -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 -inline void __advance(_RandomAccessIterator& __i, _Distance __n, - random_access_iterator_tag) { - __i += __n; -} - -template -inline void advance(_InputIterator& __i, _Distance __n) { - __advance(__i, __n, iterator_category(__i)); -} - -template -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 -inline output_iterator_tag -iterator_category(const back_insert_iterator<_Container>&) -{ - return output_iterator_tag(); -} - -#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - -template -inline back_insert_iterator<_Container> back_inserter(_Container& __x) { - return back_insert_iterator<_Container>(__x); -} - -template -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 -inline output_iterator_tag -iterator_category(const front_insert_iterator<_Container>&) -{ - return output_iterator_tag(); -} - -#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - -template -inline front_insert_iterator<_Container> front_inserter(_Container& __x) { - return front_insert_iterator<_Container>(__x); -} - -template -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 -inline output_iterator_tag -iterator_category(const insert_iterator<_Container>&) -{ - return output_iterator_tag(); -} - -#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - -template -inline -insert_iterator<_Container> inserter(_Container& __x, _Iterator __i) -{ - typedef typename _Container::iterator __iter; - return insert_iterator<_Container>(__x, __iter(__i)); -} - -#ifndef __STL_LIMITED_DEFAULT_TEMPLATES -template -#else -template -#endif -class reverse_bidirectional_iterator { - typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, - _Reference, _Distance> _Self; -protected: - _BidirectionalIterator current; -public: - typedef bidirectional_iterator_tag iterator_category; - typedef _Tp value_type; - typedef _Distance difference_type; - typedef _Tp* pointer; - typedef _Reference reference; - - reverse_bidirectional_iterator() {} - explicit reverse_bidirectional_iterator(_BidirectionalIterator __x) - : current(__x) {} - _BidirectionalIterator base() const { return current; } - _Reference operator*() const { - _BidirectionalIterator __tmp = current; - return *--__tmp; - } -#ifndef __SGI_STL_NO_ARROW_OPERATOR - pointer operator->() const { return &(operator*()); } -#endif /* __SGI_STL_NO_ARROW_OPERATOR */ - _Self& operator++() { - --current; - return *this; - } - _Self operator++(int) { - _Self __tmp = *this; - --current; - return __tmp; - } - _Self& operator--() { - ++current; - return *this; - } - _Self operator--(int) { - _Self __tmp = *this; - ++current; - return __tmp; - } -}; - -#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION - -template -inline bidirectional_iterator_tag -iterator_category(const reverse_bidirectional_iterator<_BidirectionalIterator, - _Tp, _Reference, - _Distance>&) -{ - return bidirectional_iterator_tag(); -} - -template -inline _Tp* -value_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, - _Reference, _Distance>&) -{ - return (_Tp*) 0; -} - -template -inline _Distance* -distance_type(const reverse_bidirectional_iterator<_BidirectionalIterator, - _Tp, - _Reference, _Distance>&) -{ - return (_Distance*) 0; -} - -#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - -template -inline bool operator==( - const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __x, - const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __y) -{ - return __x.base() == __y.base(); -} - -#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION - -// This is the new version of reverse_iterator, as defined in the -// draft C++ standard. It relies on the iterator_traits template, -// which in turn relies on partial specialization. The class -// reverse_bidirectional_iterator is no longer part of the draft -// standard, but it is retained for backward compatibility. - -template -class 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 - 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 -inline bool operator==(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) { - return __x.base() == __y.base(); -} - -template -inline bool operator<(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) { - return __y.base() < __x.base(); -} - -template -inline typename reverse_iterator<_Iterator>::difference_type -operator-(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) { - return __y.base() - __x.base(); -} - -template -inline reverse_iterator<_Iterator> -operator+(typename reverse_iterator<_Iterator>::difference_type __n, - const reverse_iterator<_Iterator>& __x) { - return reverse_iterator<_Iterator>(__x.base() - __n); -} - -#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - -// This is the old version of reverse_iterator, as found in the original -// HP STL. It does not use partial specialization. - -#ifndef __STL_LIMITED_DEFAULT_TEMPLATES -template -#else -template -#endif -class reverse_iterator { - typedef reverse_iterator<_RandomAccessIterator, _Tp, _Reference, _Distance> - _Self; -protected: - _RandomAccessIterator current; -public: - typedef random_access_iterator_tag iterator_category; - typedef _Tp value_type; - typedef _Distance difference_type; - typedef _Tp* pointer; - typedef _Reference reference; - - reverse_iterator() {} - explicit reverse_iterator(_RandomAccessIterator __x) : current(__x) {} - _RandomAccessIterator base() const { return current; } - _Reference operator*() const { return *(current - 1); } -#ifndef __SGI_STL_NO_ARROW_OPERATOR - pointer operator->() const { return &(operator*()); } -#endif /* __SGI_STL_NO_ARROW_OPERATOR */ - _Self& operator++() { - --current; - return *this; - } - _Self operator++(int) { - _Self __tmp = *this; - --current; - return __tmp; - } - _Self& operator--() { - ++current; - return *this; - } - _Self operator--(int) { - _Self __tmp = *this; - ++current; - return __tmp; - } - _Self operator+(_Distance __n) const { - return _Self(current - __n); - } - _Self& operator+=(_Distance __n) { - current -= __n; - return *this; - } - _Self operator-(_Distance __n) const { - return _Self(current + __n); - } - _Self& operator-=(_Distance __n) { - current += __n; - return *this; - } - _Reference operator[](_Distance __n) const { return *(*this + __n); } -}; - -template -inline random_access_iterator_tag -iterator_category(const reverse_iterator<_RandomAccessIterator, _Tp, - _Reference, _Distance>&) -{ - return random_access_iterator_tag(); -} - -template -inline _Tp* value_type(const reverse_iterator<_RandomAccessIterator, _Tp, - _Reference, _Distance>&) -{ - return (_Tp*) 0; -} - -template -inline _Distance* -distance_type(const reverse_iterator<_RandomAccessIterator, - _Tp, _Reference, _Distance>&) -{ - return (_Distance*) 0; -} - - -template -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 -inline bool -operator<(const reverse_iterator<_RandomAccessIterator, _Tp, - _Reference, _Distance>& __x, - const reverse_iterator<_RandomAccessIterator, _Tp, - _Reference, _Distance>& __y) -{ - return __y.base() < __x.base(); -} - -template -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 -inline reverse_iterator<_RandAccIter, _Tp, _Ref, _Dist> -operator+(_Dist __n, - const reverse_iterator<_RandAccIter, _Tp, _Ref, _Dist>& __x) -{ - return reverse_iterator<_RandAccIter, _Tp, _Ref, _Dist>(__x.base() - __n); -} - -#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - -// When we have templatized iostreams, istream_iterator and ostream_iterator -// must be rewritten. - -template -class istream_iterator { - friend bool operator== __STL_NULL_TMPL_ARGS (const istream_iterator&, - const istream_iterator&); -protected: - istream* _M_stream; - _Tp _M_value; - bool _M_end_marker; - void _M_read() { - _M_end_marker = (*_M_stream) ? true : false; - if (_M_end_marker) *_M_stream >> _M_value; - _M_end_marker = (*_M_stream) ? true : false; - } -public: - typedef input_iterator_tag iterator_category; - typedef _Tp value_type; - typedef _Dist difference_type; - typedef const _Tp* pointer; - typedef const _Tp& reference; - - istream_iterator() : _M_stream(&cin), _M_end_marker(false) {} - istream_iterator(istream& __s) : _M_stream(&__s) { _M_read(); } - reference operator*() const { return _M_value; } -#ifndef __SGI_STL_NO_ARROW_OPERATOR - pointer operator->() const { return &(operator*()); } -#endif /* __SGI_STL_NO_ARROW_OPERATOR */ - istream_iterator<_Tp, _Dist>& operator++() { - _M_read(); - return *this; - } - istream_iterator<_Tp, _Dist> operator++(int) { - istream_iterator<_Tp, _Dist> __tmp = *this; - _M_read(); - return __tmp; - } -}; - -#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION - -template -inline input_iterator_tag -iterator_category(const istream_iterator<_Tp, _Dist>&) -{ - return input_iterator_tag(); -} - -template -inline _Tp* -value_type(const istream_iterator<_Tp, _Dist>&) { return (_Tp*) 0; } - -template -inline _Dist* -distance_type(const istream_iterator<_Tp, _Dist>&) { return (_Dist*)0; } - -#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - -template -inline bool operator==(const istream_iterator<_Tp, _Distance>& __x, - const istream_iterator<_Tp, _Distance>& __y) { - return (__x._M_stream == __y._M_stream && - __x._M_end_marker == __y._M_end_marker) || - __x._M_end_marker == false && __y._M_end_marker == false; -} - -template -class 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 -inline output_iterator_tag -iterator_category(const ostream_iterator<_Tp>&) { - return output_iterator_tag(); -} - -#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_ITERATOR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_list.h b/contrib/libstdc++/stl/stl_list.h deleted file mode 100644 index 5d95d641e5..0000000000 --- a/contrib/libstdc++/stl/stl_list.h +++ /dev/null @@ -1,840 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_LIST_H -#define __SGI_STL_INTERNAL_LIST_H - -__STL_BEGIN_NAMESPACE - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1174 -#pragma set woff 1375 -#endif - -template -struct _List_node { - typedef void* _Void_pointer; - _Void_pointer _M_next; - _Void_pointer _M_prev; - _Tp _M_data; -}; - -template -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 -inline bidirectional_iterator_tag -iterator_category(const _List_iterator<_Tp, _Ref, _Ptr>&) -{ - return bidirectional_iterator_tag(); -} - -template -inline _Tp* -value_type(const _List_iterator<_Tp, _Ref, _Ptr>&) -{ - return 0; -} - -template -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 _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 _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 _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 _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 -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 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_reverse_iterator; - typedef reverse_iterator reverse_iterator; -#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - typedef reverse_bidirectional_iterator - const_reverse_iterator; - typedef reverse_bidirectional_iterator - 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 - void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, - __true_type) { - insert(__pos, (size_type) __n, (_Tp) __x); - } - - template - void _M_insert_dispatch(iterator __pos, - _InputIterator __first, _InputIterator __last, - __false_type); - - template - void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { - typedef typename _Is_integer<_InputIterator>::_Integral _Integral; - _M_insert_dispatch(__pos, __first, __last, _Integral()); - } - -#else /* __STL_MEMBER_TEMPLATES */ - void insert(iterator __position, const _Tp* __first, const _Tp* __last); - void insert(iterator __position, - const_iterator __first, const_iterator __last); -#endif /* __STL_MEMBER_TEMPLATES */ - void insert(iterator __pos, size_type __n, const _Tp& __x); - - void push_front(const _Tp& __x) { insert(begin(), __x); } - void push_front() {insert(begin());} - void push_back(const _Tp& __x) { insert(end(), __x); } - void push_back() {insert(end());} - - iterator erase(iterator __position) { - _Node* __next_node = (_Node*) (__position._M_node->_M_next); - _Node* __prev_node = (_Node*) (__position._M_node->_M_prev); - __prev_node->_M_next = __next_node; - __next_node->_M_prev = __prev_node; - destroy(&__position._M_node->_M_data); - _M_put_node(__position._M_node); - return iterator(__next_node); - } - iterator erase(iterator __first, iterator __last); - void clear() { _Base::clear(); } - - void resize(size_type __new_size, const _Tp& __x); - void resize(size_type __new_size) { resize(__new_size, _Tp()); } - - void pop_front() { erase(begin()); } - void pop_back() { - iterator __tmp = end(); - erase(--__tmp); - } - list(size_type __n, const _Tp& __value, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { insert(begin(), __n, __value); } - explicit list(size_type __n) - : _Base(allocator_type()) - { insert(begin(), __n, _Tp()); } - -#ifdef __STL_MEMBER_TEMPLATES - - // We don't need any dispatching tricks here, because insert does all of - // that anyway. - template - list(_InputIterator __first, _InputIterator __last, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { insert(begin(), __first, __last); } - -#else /* __STL_MEMBER_TEMPLATES */ - - list(const _Tp* __first, const _Tp* __last, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { insert(begin(), __first, __last); } - list(const_iterator __first, const_iterator __last, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { insert(begin(), __first, __last); } - -#endif /* __STL_MEMBER_TEMPLATES */ - list(const list<_Tp, _Alloc>& __x) : _Base(__x.get_allocator()) - { insert(begin(), __x.begin(), __x.end()); } - - ~list() { } - - list<_Tp, _Alloc>& operator=(const list<_Tp, _Alloc>& __x); - -public: - // assign(), a generalized assignment member function. Two - // versions: one that takes a count, and one that takes a range. - // The range version is a member template, so we dispatch on whether - // or not the type is an integer. - - void assign(size_type __n, const _Tp& __val); - -#ifdef __STL_MEMBER_TEMPLATES - - template - void assign(_InputIterator __first, _InputIterator __last) { - typedef typename _Is_integer<_InputIterator>::_Integral _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - } - - template - void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) - { assign((size_type) __n, (_Tp) __val); } - - template - 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 void remove_if(_Predicate); - template void unique(_BinaryPredicate); - template void merge(list&, _StrictWeakOrdering); - template void sort(_StrictWeakOrdering); -#endif /* __STL_MEMBER_TEMPLATES */ - - friend bool operator== __STL_NULL_TMPL_ARGS ( - const list& __x, const list& __y); -}; - -template -inline bool operator==(const list<_Tp,_Alloc>& __x, - const list<_Tp,_Alloc>& __y) -{ - typedef typename list<_Tp,_Alloc>::_Node _Node; - _Node* __e1 = __x._M_node; - _Node* __e2 = __y._M_node; - _Node* __n1 = (_Node*) __e1->_M_next; - _Node* __n2 = (_Node*) __e2->_M_next; - for ( ; __n1 != __e1 && __n2 != __e2 ; - __n1 = (_Node*) __n1->_M_next, __n2 = (_Node*) __n2->_M_next) - if (__n1->_M_data != __n2->_M_data) - return false; - return __n1 == __e1 && __n2 == __e2; -} - -template -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 -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 template -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 -void -list<_Tp, _Alloc>::insert(iterator __position, - const _Tp* __first, const _Tp* __last) -{ - for ( ; __first != __last; ++__first) - insert(__position, *__first); -} - -template -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 -void -list<_Tp, _Alloc>::insert(iterator __position, size_type __n, const _Tp& __x) -{ - for ( ; __n > 0; --__n) - insert(__position, __x); -} - -template -list<_Tp,_Alloc>::iterator list<_Tp, _Alloc>::erase(iterator __first, - iterator __last) -{ - while (__first != __last) - erase(__first++); - return __last; -} - -template -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 -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 -void list<_Tp, _Alloc>::assign(size_type __n, const _Tp& __val) { - iterator __i = begin(); - for ( ; __i != end() && __n > 0; ++__i, --__n) - *__i = __val; - if (__n > 0) - insert(end(), __n, __val); - else - erase(__i, end()); -} - -#ifdef __STL_MEMBER_TEMPLATES - -template template -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 -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 -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 -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 -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 -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 template -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 template -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 template -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 template -void list<_Tp, _Alloc>::sort(_StrictWeakOrdering __comp) -{ - // Do nothing if the list has length 0 or 1. - if (_M_node->_M_next != _M_node && - ((_Node*) (_M_node->_M_next))->_M_next != _M_node) { - list<_Tp, _Alloc> __carry; - list<_Tp, _Alloc> __counter[64]; - int __fill = 0; - while (!empty()) { - __carry.splice(__carry.begin(), *this, begin()); - int __i = 0; - while(__i < __fill && !__counter[__i].empty()) { - __counter[__i].merge(__carry, __comp); - __carry.swap(__counter[__i++]); - } - __carry.swap(__counter[__i]); - if (__i == __fill) ++__fill; - } - - for (int __i = 1; __i < __fill; ++__i) - __counter[__i].merge(__counter[__i-1], __comp); - swap(__counter[__fill-1]); - } -} - -#endif /* __STL_MEMBER_TEMPLATES */ - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#pragma reset woff 1375 -#endif - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_LIST_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_map.h b/contrib/libstdc++/stl/stl_map.h deleted file mode 100644 index a702e8023e..0000000000 --- a/contrib/libstdc++/stl/stl_map.h +++ /dev/null @@ -1,242 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_MAP_H -#define __SGI_STL_INTERNAL_MAP_H - -__STL_BEGIN_NAMESPACE - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1174 -#pragma set woff 1375 -#endif - -#ifndef __STL_LIMITED_DEFAULT_TEMPLATES -template , - class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) > -#else -template -#endif -class map { -public: - -// typedefs: - - typedef _Key key_type; - typedef _Tp data_type; - typedef _Tp mapped_type; - typedef pair value_type; - typedef _Compare key_compare; - - class value_compare - : public binary_function { - friend class map<_Key,_Tp,_Compare,_Alloc>; - protected : - _Compare _M_comp; - value_compare(_Compare __c) : _M_comp(__c) {} - public: - bool operator()(const value_type& __x, const value_type& __y) const { - return _M_comp(__x.first, __y.first); - } - }; - -private: - typedef _Rb_tree, key_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 - map(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_unique(__first, __last); } - - template - 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 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 - 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 equal_range(const key_type& __x) { - return _M_t.equal_range(__x); - } - pair equal_range(const key_type& __x) const { - return _M_t.equal_range(__x); - } - friend bool operator== __STL_NULL_TMPL_ARGS (const map&, const map&); - friend bool operator< __STL_NULL_TMPL_ARGS (const map&, const map&); -}; - -template -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 -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 -inline void swap(map<_Key,_Tp,_Compare,_Alloc>& __x, - map<_Key,_Tp,_Compare,_Alloc>& __y) { - __x.swap(__y); -} - -#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#pragma reset woff 1375 -#endif - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_MAP_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_multimap.h b/contrib/libstdc++/stl/stl_multimap.h deleted file mode 100644 index b7d3b87e52..0000000000 --- a/contrib/libstdc++/stl/stl_multimap.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_MULTIMAP_H -#define __SGI_STL_INTERNAL_MULTIMAP_H - -__STL_BEGIN_NAMESPACE - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1174 -#pragma set woff 1375 -#endif - -#ifndef __STL_LIMITED_DEFAULT_TEMPLATES -template , - class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) > -#else -template -#endif -class multimap { -public: - -// typedefs: - - typedef _Key key_type; - typedef _Tp data_type; - typedef _Tp mapped_type; - typedef pair value_type; - typedef _Compare key_compare; - - class value_compare : public binary_function { - friend class multimap<_Key,_Tp,_Compare,_Alloc>; - protected: - _Compare _M_comp; - value_compare(_Compare __c) : _M_comp(__c) {} - public: - bool operator()(const value_type& __x, const value_type& __y) const { - return _M_comp(__x.first, __y.first); - } - }; - -private: - typedef _Rb_tree, key_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 - multimap(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_equal(__first, __last); } - - template - 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 - 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 equal_range(const key_type& __x) { - return _M_t.equal_range(__x); - } - pair equal_range(const key_type& __x) const { - return _M_t.equal_range(__x); - } - friend bool operator== __STL_NULL_TMPL_ARGS (const multimap&, - const multimap&); - friend bool operator< __STL_NULL_TMPL_ARGS (const multimap&, - const multimap&); -}; - -template -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 -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 -inline void swap(multimap<_Key,_Tp,_Compare,_Alloc>& __x, - multimap<_Key,_Tp,_Compare,_Alloc>& __y) { - __x.swap(__y); -} - -#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#pragma reset woff 1375 -#endif - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_MULTIMAP_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_multiset.h b/contrib/libstdc++/stl/stl_multiset.h deleted file mode 100644 index 7378e43f8b..0000000000 --- a/contrib/libstdc++/stl/stl_multiset.h +++ /dev/null @@ -1,224 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_MULTISET_H -#define __SGI_STL_INTERNAL_MULTISET_H - -__STL_BEGIN_NAMESPACE - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1174 -#pragma set woff 1375 -#endif - -#ifndef __STL_LIMITED_DEFAULT_TEMPLATES -template , - class _Alloc = __STL_DEFAULT_ALLOCATOR(_Key) > -#else -template -#endif -class multiset { -public: - // typedefs: - - typedef _Key key_type; - typedef _Key value_type; - typedef _Compare key_compare; - typedef _Compare value_compare; -private: - typedef _Rb_tree, key_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 - multiset(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_equal(__first, __last); } - - template - 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 - 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 equal_range(const key_type& __x) const { - return _M_t.equal_range(__x); - } - friend bool operator== __STL_NULL_TMPL_ARGS (const multiset&, - const multiset&); - friend bool operator< __STL_NULL_TMPL_ARGS (const multiset&, - const multiset&); -}; - -template -inline bool operator==(const multiset<_Key,_Compare,_Alloc>& __x, - const multiset<_Key,_Compare,_Alloc>& __y) { - return __x._M_t == __y._M_t; -} - -template -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 -inline void swap(multiset<_Key,_Compare,_Alloc>& __x, - multiset<_Key,_Compare,_Alloc>& __y) { - __x.swap(__y); -} - -#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#pragma reset woff 1375 -#endif - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_MULTISET_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_numeric.h b/contrib/libstdc++/stl/stl_numeric.h deleted file mode 100644 index 392515a3d8..0000000000 --- a/contrib/libstdc++/stl/stl_numeric.h +++ /dev/null @@ -1,239 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - - -#ifndef __SGI_STL_INTERNAL_NUMERIC_H -#define __SGI_STL_INTERNAL_NUMERIC_H - -__STL_BEGIN_NAMESPACE - -template -_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) -{ - for ( ; __first != __last; ++__first) - __init = __init + *__first; - return __init; -} - -template -_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, - _BinaryOperation __binary_op) -{ - for ( ; __first != __last; ++__first) - __init = __binary_op(__init, *__first); - return __init; -} - -template -_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _Tp __init) -{ - for ( ; __first1 != __last1; ++__first1, ++__first2) - __init = __init + (*__first1 * *__first2); - return __init; -} - -template -_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 -_OutputIterator -__partial_sum(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _Tp*) -{ - _Tp __value = *__first; - while (++__first != __last) { - __value = __value + *__first; - *++__result = __value; - } - return ++__result; -} - -template -_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 -_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 -_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 -_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 -_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 -_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 -_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 -_Tp __power(_Tp __x, _Integer __n, _MonoidOperation __oper) -{ - if (__n == 0) - return identity_element(__oper); - else { - while ((__n & 1) == 0) { - __n >>= 1; - __x = __oper(__x, __x); - } - - _Tp __result = __x; - __n >>= 1; - while (__n != 0) { - __x = __oper(__x, __x); - if ((__n & 1) != 0) - __result = __oper(__result, __x); - __n >>= 1; - } - return __result; - } -} - -template -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 -inline _Tp power(_Tp __x, _Integer __n, _MonoidOperation __oper) -{ - return __power(__x, __n, __oper); -} - -template -inline _Tp power(_Tp __x, _Integer __n) -{ - return __power(__x, __n); -} - -// iota is not part of the C++ standard. It is an extension. - -template -void -iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value) -{ - while (__first != __last) - *__first++ = __value++; -} - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_NUMERIC_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_pair.h b/contrib/libstdc++/stl/stl_pair.h deleted file mode 100644 index 3aa290b59e..0000000000 --- a/contrib/libstdc++/stl/stl_pair.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_PAIR_H -#define __SGI_STL_INTERNAL_PAIR_H - -__STL_BEGIN_NAMESPACE - -template -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 - pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} -#endif -}; - -template -inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) -{ - return __x.first == __y.first && __x.second == __y.second; -} - -template -inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) -{ - return __x.first < __y.first || - (!(__y.first < __x.first) && __x.second < __y.second); -} - -template -inline pair<_T1, _T2> make_pair(const _T1& __x, const _T2& __y) -{ - return pair<_T1, _T2>(__x, __y); -} - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_PAIR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_queue.h b/contrib/libstdc++/stl/stl_queue.h deleted file mode 100644 index c1e2b69844..0000000000 --- a/contrib/libstdc++/stl/stl_queue.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_QUEUE_H -#define __SGI_STL_INTERNAL_QUEUE_H - -__STL_BEGIN_NAMESPACE - -#ifndef __STL_LIMITED_DEFAULT_TEMPLATES -template > -#else -template -#endif -class queue { - friend bool operator== __STL_NULL_TMPL_ARGS (const queue&, const queue&); - friend bool operator< __STL_NULL_TMPL_ARGS (const queue&, const queue&); -public: - typedef typename _Sequence::value_type value_type; - typedef typename _Sequence::size_type size_type; - typedef _Sequence container_type; - - typedef typename _Sequence::reference reference; - typedef typename _Sequence::const_reference const_reference; -protected: - _Sequence c; -public: - queue() : c() {} - explicit queue(const _Sequence& __c) : c(__c) {} - - bool empty() const { return c.empty(); } - size_type size() const { return c.size(); } - reference front() { return c.front(); } - const_reference front() const { return c.front(); } - reference back() { return c.back(); } - const_reference back() const { return c.back(); } - void push(const value_type& __x) { c.push_back(__x); } - void pop() { c.pop_front(); } -}; - -template -bool -operator==(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) -{ - return __x.c == __y.c; -} - -template -bool -operator<(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) -{ - return __x.c < __y.c; -} - -#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER - -template -bool -operator!=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) -{ - return !(__x == __y); -} - -template -bool -operator>(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) -{ - return __y < __x; -} - -template -bool -operator<=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) -{ - return !(__y < __x); -} - -template -bool -operator>=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) -{ - return !(__x < __y); -} - -#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ - -#ifndef __STL_LIMITED_DEFAULT_TEMPLATES -template , - class _Compare = less > -#else -template -#endif -class priority_queue { -public: - typedef typename _Sequence::value_type value_type; - typedef typename _Sequence::size_type size_type; - typedef _Sequence container_type; - - typedef typename _Sequence::reference reference; - typedef typename _Sequence::const_reference const_reference; -protected: - _Sequence c; - _Compare comp; -public: - priority_queue() : c() {} - explicit priority_queue(const _Compare& __x) : c(), comp(__x) {} - priority_queue(const _Compare& __x, const _Sequence& __s) - : c(__s), comp(__x) - { make_heap(c.begin(), c.end(), comp); } - -#ifdef __STL_MEMBER_TEMPLATES - template - priority_queue(_InputIterator __first, _InputIterator __last) - : c(__first, __last) { make_heap(c.begin(), c.end(), comp); } - - template - priority_queue(_InputIterator __first, - _InputIterator __last, const _Compare& __x) - : c(__first, __last), comp(__x) - { make_heap(c.begin(), c.end(), comp); } - - template - priority_queue(_InputIterator __first, _InputIterator __last, - const _Compare& __x, const _Sequence& __s) - : c(__s), comp(__x) - { - c.insert(c.end(), __first, __last); - make_heap(c.begin(), c.end(), comp); - } - -#else /* __STL_MEMBER_TEMPLATES */ - priority_queue(const value_type* __first, const value_type* __last) - : c(__first, __last) { make_heap(c.begin(), c.end(), comp); } - - priority_queue(const value_type* __first, const value_type* __last, - const _Compare& __x) - : c(__first, __last), comp(__x) - { make_heap(c.begin(), c.end(), comp); } - - priority_queue(const value_type* __first, const value_type* __last, - const _Compare& __x, const _Sequence& __c) - : c(__c), comp(__x) - { - c.insert(c.end(), __first, __last); - make_heap(c.begin(), c.end(), comp); - } -#endif /* __STL_MEMBER_TEMPLATES */ - - bool empty() const { return c.empty(); } - size_type size() const { return c.size(); } - const_reference top() const { return c.front(); } - void push(const value_type& __x) { - __STL_TRY { - c.push_back(__x); - push_heap(c.begin(), c.end(), comp); - } - __STL_UNWIND(c.clear()); - } - void pop() { - __STL_TRY { - pop_heap(c.begin(), c.end(), comp); - c.pop_back(); - } - __STL_UNWIND(c.clear()); - } -}; - -// no equality is provided - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_QUEUE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_raw_storage_iter.h b/contrib/libstdc++/stl/stl_raw_storage_iter.h deleted file mode 100644 index 6f3951cb8a..0000000000 --- a/contrib/libstdc++/stl/stl_raw_storage_iter.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H -#define __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H - -__STL_BEGIN_NAMESPACE - -template -class 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 -inline output_iterator_tag -iterator_category(const raw_storage_iterator<_ForwardIterator, _Tp>&) -{ - return output_iterator_tag(); -} - -#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_relops.h b/contrib/libstdc++/stl/stl_relops.h deleted file mode 100644 index 16cad1b84e..0000000000 --- a/contrib/libstdc++/stl/stl_relops.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * Copyright (c) 1996,1997 - * Silicon Graphics - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_RELOPS -#define __SGI_STL_INTERNAL_RELOPS - -__STL_BEGIN_RELOPS_NAMESPACE - -template -inline bool operator!=(const _Tp& __x, const _Tp& __y) { - return !(__x == __y); -} - -template -inline bool operator>(const _Tp& __x, const _Tp& __y) { - return __y < __x; -} - -template -inline bool operator<=(const _Tp& __x, const _Tp& __y) { - return !(__y < __x); -} - -template -inline bool operator>=(const _Tp& __x, const _Tp& __y) { - return !(__x < __y); -} - -__STL_END_RELOPS_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_RELOPS */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_rope.h b/contrib/libstdc++/stl/stl_rope.h deleted file mode 100644 index fa1e848c06..0000000000 --- a/contrib/libstdc++/stl/stl_rope.h +++ /dev/null @@ -1,2541 +0,0 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -// rope<_CharT,_Alloc> is a sequence of _CharT. -// Ropes appear to be mutable, but update operations -// really copy enough of the data structure to leave the original -// valid. Thus ropes can be logically copied by just copying -// a pointer value. - -#ifndef __SGI_STL_INTERNAL_ROPE_H -# define __SGI_STL_INTERNAL_ROPE_H - -# ifdef __GC -# define __GC_CONST const -# else -# define __GC_CONST // constant except for deallocation -# endif -# ifdef __STL_SGI_THREADS -# include -# 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 -inline _CharT _S_eos(_CharT*) { return _CharT(); } - -// Test for basic character types. -// For basic character types leaves having a trailing eos. -template -inline bool _S_is_basic_char_type(_CharT*) { return false; } -template -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 -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 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 -// 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 and a -// little like containers. - -template -// 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 _Rope_char_consumer { - public: - // If we had member templates, these should not be virtual. - // For now we need to use run-time parametrization where - // compile-time would do. _Hence this should all be private - // for now. - // The symmetry with char_producer is accidental and temporary. - virtual ~_Rope_char_consumer() {}; - virtual bool operator()(const _CharT* __buffer, size_t __len) = 0; -}; - -// -// What follows should really be local to rope. Unfortunately, -// that doesn't work, since it makes it impossible to define generic -// equality on rope iterators. According to the draft standard, the -// template parameters for such an equality operator cannot be inferred -// from the occurence of a member class as a parameter. -// (SGI compilers in fact allow this, but the __result wouldn't be -// portable.) -// Similarly, some of the static member functions are member functions -// only to avoid polluting the global namespace, and to circumvent -// restrictions on type inference for template functions. -// - -template class rope; -template struct _Rope_RopeConcatenation; -template struct _Rope_RopeLeaf; -template struct _Rope_RopeFunction; -template struct _Rope_RopeSubstring; -template class _Rope_iterator; -template class _Rope_const_iterator; -template class _Rope_char_ref_proxy; -template class _Rope_char_ptr_proxy; - -// -// The internal data structure for representing a rope. This is -// private to the implementation. A rope is really just a pointer -// to one of these. -// -// A few basic functions for manipulating this data structure -// are members of _RopeRep. Most of the more complex algorithms -// are implemented as rope members. -// -// Some of the static member functions of _RopeRep have identically -// named functions in rope that simply invoke the _RopeRep versions. -// -// A macro to introduce various allocation and deallocation functions -// These need to be defined differently depending on whether or not -// we are using standard conforming allocators, and whether the allocator -// instances have real state. Thus this macro is invoked repeatedly -// with different definitions of __ROPE_DEFINE_ALLOC. -// __ROPE_DEFINE_ALLOC(type,name) defines -// type * name_allocate(size_t) and -// void name_deallocate(tipe *, size_t) -// Both functions may or may not be static. - -#define __ROPE_DEFINE_ALLOCS(__a) \ - __ROPE_DEFINE_ALLOC(_CharT,_Data) /* character data */ \ - typedef _Rope_RopeConcatenation<_CharT,__a> __C; \ - __ROPE_DEFINE_ALLOC(__C,_C) \ - typedef _Rope_RopeLeaf<_CharT,__a> __L; \ - __ROPE_DEFINE_ALLOC(__L,_L) \ - typedef _Rope_RopeFunction<_CharT,__a> __F; \ - __ROPE_DEFINE_ALLOC(__F,_F) \ - typedef _Rope_RopeSubstring<_CharT,__a> __S; \ - __ROPE_DEFINE_ALLOC(__S,_S) - -// Internal rope nodes potentially store a copy of the allocator -// instance used to allocate them. This is mostly redundant. -// But the alternative would be to pass allocator instances around -// in some form to nearly all internal functions, since any pointer -// assignment may result in a zero reference count and thus require -// deallocation. -// The _Rope_rep_base class encapsulates -// the differences between SGI-style allocators and standard-conforming -// allocators. - -#ifdef __STL_USE_STD_ALLOCATORS - -#define __STATIC_IF_SGI_ALLOC /* not static */ - -// Base class for ordinary allocators. -template -class _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 _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 -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 _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 -struct _Rope_RopeRep : public _Rope_rep_base<_CharT,_Alloc> { - public: - enum { _S_max_rope_depth = 45 }; - enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function}; - _Tag _M_tag:8; - bool _M_is_balanced:8; - unsigned char _M_depth; - __GC_CONST _CharT* _M_c_string; - /* Flattened version of string, if needed. */ - /* typically 0. */ - /* If it's not 0, then the memory is owned */ - /* by this node. */ - /* In the case of a leaf, this may point to */ - /* the same memory as the data field. */ - typedef _Rope_rep_base<_CharT,_Alloc>::allocator_type allocator_type; - _Rope_RopeRep(_Tag __t, int __d, bool __b, size_t __size, - allocator_type __a) - : _Rope_rep_base<_CharT,_Alloc>(__size, __a), - _M_tag(__t), _M_depth(__d), _M_is_balanced(__b), _M_c_string(0) - { -# ifndef __GC - _M_refcount = 1; - _M_init_refcount_lock(); -# endif - } -# ifndef __GC -# if defined(__STL_WIN32THREADS) - long _M_refcount; // InterlockedIncrement wants a long * -# else - size_t _M_refcount; -# endif - // We count references from rope instances - // and references from other rope nodes. We - // do not count const_iterator references. - // Iterator references are counted so that rope modifications - // can be detected after the fact. - // Generally function results are counted, i.__e. - // a pointer returned by a function is included at the - // point at which the pointer is returned. - // The recipient should decrement the count if the - // __result is not needed. - // Generally function arguments are not reflected - // in the reference count. The callee should increment - // the count before saving the argument someplace that - // will outlive the call. -# endif -# ifndef __GC -# ifdef __STL_SGI_THREADS - // Reference counting with multiple threads and no - // hardware or thread package support is pretty awful. - // Mutexes are normally too expensive. - // We'll assume a COMPARE_AND_SWAP(destp, __old, new) - // operation, which might be cheaper. -# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64)) -# define __add_and_fetch(l,v) add_then_test((unsigned long*)l,v) -# endif - void _M_init_refcount_lock() {} - void _M_incr_refcount () - { - __add_and_fetch(&_M_refcount, 1); - } - size_t _M_decr_refcount () - { - return __add_and_fetch(&_M_refcount, (size_t)(-1)); - } -# elif defined(__STL_WIN32THREADS) - void _M_init_refcount_lock() {} - void _M_incr_refcount () - { - InterlockedIncrement(&_M_refcount); - } - size_t _M_decr_refcount () - { - return InterlockedDecrement(&_M_refcount); - } -# elif defined(__STL_PTHREADS) - // This should be portable, but performance is expected - // to be quite awful. This really needs platform specific - // code. - pthread_mutex_t _M_refcount_lock; - void _M_init_refcount_lock() { - pthread_mutex_init(&_M_refcount_lock, 0); - } - void _M_incr_refcount () - { - pthread_mutex_lock(&_M_refcount_lock); - ++_M_refcount; - pthread_mutex_unlock(&_M_refcount_lock); - } - size_t _M_decr_refcount () - { - size_t __result; - pthread_mutex_lock(&_M_refcount_lock); - __result = --_M_refcount; - pthread_mutex_unlock(&_M_refcount_lock); - return __result; - } -# else - void _M_init_refcount_lock() {} - void _M_incr_refcount () - { - ++_M_refcount; - } - size_t _M_decr_refcount () - { - --_M_refcount; - return _M_refcount; - } -# endif -# else - void _M_incr_refcount () {} -# endif -# ifdef __STL_USE_STD_ALLOCATORS - static void _S_free_string(__GC_CONST _CharT*, size_t __len, - allocator_type __a); -# define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l, __a); -# else - static void _S_free_string(__GC_CONST _CharT*, size_t __len); -# define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l); -# endif - // Deallocate data section of a leaf. - // This shouldn't be a member function. - // But its hard to do anything else at the - // moment, because it's templatized w.r.t. - // an allocator. - // Does nothing if __GC is defined. -# ifndef __GC - void _M_free_c_string(); - void _M_free_tree(); - // Deallocate t. Assumes t is not 0. - void _M_unref_nonnil() - { - if (0 == _M_decr_refcount()) _M_free_tree(); - } - void _M_ref_nonnil() - { - _M_incr_refcount(); - } - static void _S_unref(_Rope_RopeRep* __t) - { - if (0 != __t) { - __t->_M_unref_nonnil(); - } - } - static void _S_ref(_Rope_RopeRep* __t) - { - if (0 != __t) __t->_M_incr_refcount(); - } - static void _S_free_if_unref(_Rope_RopeRep* __t) - { - if (0 != __t && 0 == __t->_M_refcount) __t->_M_free_tree(); - } -# else /* __GC */ - void _M_unref_nonnil() {} - void _M_ref_nonnil() {} - static void _S_unref(_Rope_RopeRep*) {} - static void _S_ref(_Rope_RopeRep*) {} - static void _S_free_if_unref(_Rope_RopeRep*) {} -# endif - -}; - -template -struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> { - public: - // Apparently needed by VC++ - // The data fields of leaves are allocated with some - // extra space, to accomodate future growth and for basic - // character types, to hold a trailing eos character. - enum { _S_alloc_granularity = 8 }; - static size_t _S_rounded_up_size(size_t __n) { - size_t __size_with_eos; - - if (_S_is_basic_char_type((_CharT*)0)) { - __size_with_eos = __n + 1; - } else { - __size_with_eos = __n; - } -# ifdef __GC - return __size_with_eos; -# else - // Allow slop for in-place expansion. - return (__size_with_eos + _S_alloc_granularity-1) - &~ (_S_alloc_granularity-1); -# endif - } - __GC_CONST _CharT* _M_data; /* Not necessarily 0 terminated. */ - /* The allocated size is */ - /* _S_rounded_up_size(size), except */ - /* in the GC case, in which it */ - /* doesn't matter. */ - typedef _Rope_rep_base<_CharT,_Alloc>::allocator_type allocator_type; - _Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size, allocator_type __a) - : _Rope_RopeRep<_CharT,_Alloc>(_S_leaf, 0, true, __size, __a), - _M_data(__d) - { - __stl_assert(__size > 0); - if (_S_is_basic_char_type((_CharT *)0)) { - // already eos terminated. - _M_c_string = __d; - } - } - // The constructor assumes that d has been allocated with - // the proper allocator and the properly padded size. - // In contrast, the destructor deallocates the data: -# ifndef __GC - ~_Rope_RopeLeaf() { - if (_M_data != _M_c_string) { - _M_free_c_string(); - } - __STL_FREE_STRING(_M_data, _M_size, get_allocator()); - } -# endif -}; - -template -struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT,_Alloc> { - public: - _Rope_RopeRep<_CharT,_Alloc>* _M_left; - _Rope_RopeRep<_CharT,_Alloc>* _M_right; - typedef _Rope_rep_base<_CharT,_Alloc>::allocator_type allocator_type; - _Rope_RopeConcatenation(_Rope_RopeRep<_CharT,_Alloc>* __l, - _Rope_RopeRep<_CharT,_Alloc>* __r, - allocator_type __a) - : _Rope_RopeRep<_CharT,_Alloc>( - _S_concat, max(__l->_M_depth, __r->_M_depth) + 1, false, - __l->_M_size + __r->_M_size, __a), - _M_left(__l), _M_right(__r) - {} -# ifndef __GC - ~_Rope_RopeConcatenation() { - _M_free_c_string(); - _M_left->_M_unref_nonnil(); - _M_right->_M_unref_nonnil(); - } -# endif -}; - -template -struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT,_Alloc> { - public: - char_producer<_CharT>* _M_fn; -# ifndef __GC - bool _M_delete_when_done; // Char_producer is owned by the - // rope and should be explicitly - // deleted when the rope becomes - // inaccessible. -# else - // In the GC case, we either register the rope for - // finalization, or not. Thus the field is unnecessary; - // the information is stored in the collector data structures. - // We do need a finalization procedure to be invoked by the - // collector. - static void _S_fn_finalization_proc(void * __tree, void *) { - delete ((_Rope_RopeFunction *)__tree) -> _M_fn; - } -# endif - typedef _Rope_rep_base<_CharT,_Alloc>::allocator_type allocator_type; - _Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size, - bool __d, allocator_type __a) - :_Rope_RopeRep<_CharT,_Alloc>(_S_function, 0, true, __size, __a), - _M_fn(__f) -# ifndef __GC - , _M_delete_when_done(__d) -# endif - { - __stl_assert(__size > 0); -# ifdef __GC - if (__d) { - GC_REGISTER_FINALIZER( - this, _Rope_RopeFunction::_S_fn_finalization_proc, 0, 0, 0); - } -# endif - } -# ifndef __GC - ~_Rope_RopeFunction() { - _M_free_c_string(); - if (_M_delete_when_done) { - delete _M_fn; - } - } -# endif -}; -// Substring results are usually represented using just -// concatenation nodes. But in the case of very long flat ropes -// or ropes with a functional representation that isn't practical. -// In that case, we represent the __result as a special case of -// RopeFunction, whose char_producer points back to the rope itself. -// In all cases except repeated substring operations and -// deallocation, we treat the __result as a RopeFunction. -template -struct _Rope_RopeSubstring : public _Rope_RopeFunction<_CharT,_Alloc>, - public char_producer<_CharT> { - public: - // XXX this whole class should be rewritten. - _Rope_RopeRep<_CharT,_Alloc>* _M_base; // not 0 - size_t _M_start; - virtual void operator()(size_t __start_pos, size_t __req_len, - _CharT* __buffer) { - switch(_M_base->_M_tag) { - case _S_function: - case _S_substringfn: - { - char_producer<_CharT>* __fn = - ((_Rope_RopeFunction<_CharT,_Alloc>*)_M_base)->_M_fn; - __stl_assert(__start_pos + __req_len <= _M_size); - __stl_assert(_M_start + _M_size <= _M_base->_M_size); - (*__fn)(__start_pos + _M_start, __req_len, __buffer); - } - break; - case _S_leaf: - { - __GC_CONST _CharT* __s = - ((_Rope_RopeLeaf<_CharT,_Alloc>*)_M_base)->_M_data; - uninitialized_copy_n(__s + __start_pos + _M_start, __req_len, - __buffer); - } - break; - default: - __stl_assert(false); - } - } - typedef _Rope_rep_base<_CharT,_Alloc>::allocator_type allocator_type; - _Rope_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s, - size_t __l, allocator_type __a) - : _Rope_RopeFunction<_CharT,_Alloc>(this, __l, false, __a), _M_base(__b) - , _M_start(__s) - { - __stl_assert(__l > 0); - __stl_assert(__s + __l <= __b->_M_size); -# ifndef __GC - _M_base->_M_ref_nonnil(); -# endif - _M_tag = _S_substringfn; - } - virtual ~_Rope_RopeSubstring() - { -# ifndef __GC - _M_base->_M_unref_nonnil(); - // _M_free_c_string(); -- done by parent class -# endif - } -}; - - -// Self-destructing pointers to Rope_rep. -// These are not conventional smart pointers. Their -// only purpose in life is to ensure that unref is called -// on the pointer either at normal exit or if an exception -// is raised. It is the caller's responsibility to -// adjust reference counts when these pointers are initialized -// or assigned to. (This convention significantly reduces -// the number of potentially expensive reference count -// updates.) -#ifndef __GC - template - 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 _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 - inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, - _Rope_char_ref_proxy <_CharT, __Alloc > __b) { - _CharT __tmp = __a; - __a = __b; - __b = __tmp; - } -#else -// There is no really acceptable way to handle this. The default -// definition of swap doesn't work for proxy references. -// It can't really be made to work, even with ugly hacks, since -// the only unusual operation it uses is the copy constructor, which -// is needed for other purposes. We provide a macro for -// full specializations, and instantiate the most common case. -# define _ROPE_SWAP_SPECIALIZATION(_CharT, __Alloc) \ - inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, \ - _Rope_char_ref_proxy <_CharT, __Alloc > __b) { \ - _CharT __tmp = __a; \ - __a = __b; \ - __b = __tmp; \ - } - -_ROPE_SWAP_SPECIALIZATION(char,__STL_DEFAULT_ALLOCATOR(char)) - -#endif /* !__STL_FUNCTION_TMPL_PARTIAL_ORDER */ - -template -class _Rope_char_ptr_proxy { - // XXX this class should be rewritten. - friend class _Rope_char_ref_proxy<_CharT,_Alloc>; - size_t _M_pos; - rope<_CharT,_Alloc>* _M_root; // The whole rope. - public: - _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x) - : _M_pos(__x._M_pos), _M_root(__x._M_root) {} - _Rope_char_ptr_proxy(const _Rope_char_ptr_proxy& __x) - : _M_pos(__x._M_pos), _M_root(__x._M_root) {} - _Rope_char_ptr_proxy() {} - _Rope_char_ptr_proxy(_CharT* __x) : _M_root(0), _M_pos(0) { - __stl_assert(0 == __x); - } - _Rope_char_ptr_proxy& - operator= (const _Rope_char_ptr_proxy& __x) { - _M_pos = __x._M_pos; - _M_root = __x._M_root; - return *this; - } - friend bool operator== __STL_NULL_TMPL_ARGS - (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x, - const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y); - - _Rope_char_ref_proxy<_CharT,_Alloc> operator*() const { - return _Rope_char_ref_proxy<_CharT,_Alloc>(_M_root, _M_pos); - } -}; - - -// Rope iterators: -// Unlike in the C version, we cache only part of the stack -// for rope iterators, since they must be efficiently copyable. -// When we run out of cache, we have to reconstruct the iterator -// value. -// Pointers from iterators are not included in reference counts. -// Iterators are assumed to be thread private. Ropes can -// be shared. - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1375 -#endif - -template -class _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 _Rope_iterator; - -template -class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> { - friend class rope<_CharT,_Alloc>; - protected: - _Rope_const_iterator(const _RopeRep* __root, size_t __pos): - _Rope_iterator_base<_CharT,_Alloc>( - const_cast<_RopeRep*>(__root), __pos) - // Only nonconst iterators modify root ref count - {} - public: - typedef _CharT reference; // Really a value. Returning a reference - // Would be a mess, since it would have - // to be included in refcount. - typedef const _CharT* pointer; - - public: - _Rope_const_iterator() {}; - _Rope_const_iterator(const _Rope_const_iterator& __x) : - _Rope_iterator_base<_CharT,_Alloc>(__x) { } - _Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x); - _Rope_const_iterator(const rope<_CharT,_Alloc>& __r, size_t __pos) : - _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos) {} - _Rope_const_iterator& operator= (const _Rope_const_iterator& __x) { - if (0 != __x._M_buf_ptr) { - *(static_cast<_Rope_iterator_base<_CharT,_Alloc>*>(this)) = __x; - } else { - _M_current_pos = __x._M_current_pos; - _M_root = __x._M_root; - _M_buf_ptr = 0; - } - return(*this); - } - reference operator*() { - if (0 == _M_buf_ptr) _S_setcache(*this); - return *_M_buf_ptr; - } - _Rope_const_iterator& operator++() { - __GC_CONST _CharT* __next; - if (0 != _M_buf_ptr && (__next = _M_buf_ptr + 1) < _M_buf_end) { - _M_buf_ptr = __next; - ++_M_current_pos; - } else { - _M_incr(1); - } - return *this; - } - _Rope_const_iterator& operator+=(ptrdiff_t __n) { - if (__n >= 0) { - _M_incr(__n); - } else { - _M_decr(-__n); - } - return *this; - } - _Rope_const_iterator& operator--() { - _M_decr(1); - return *this; - } - _Rope_const_iterator& operator-=(ptrdiff_t __n) { - if (__n >= 0) { - _M_decr(__n); - } else { - _M_incr(-__n); - } - return *this; - } - _Rope_const_iterator operator++(int) { - size_t __old_pos = _M_current_pos; - _M_incr(1); - return _Rope_const_iterator<_CharT,_Alloc>(_M_root, __old_pos); - // This makes a subsequent dereference expensive. - // Perhaps we should instead copy the iterator - // if it has a valid cache? - } - _Rope_const_iterator operator--(int) { - size_t __old_pos = _M_current_pos; - _M_decr(1); - return _Rope_const_iterator<_CharT,_Alloc>(_M_root, __old_pos); - } - friend _Rope_const_iterator<_CharT,_Alloc> operator- __STL_NULL_TMPL_ARGS - (const _Rope_const_iterator<_CharT,_Alloc>& __x, - ptrdiff_t __n); - friend _Rope_const_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS - (const _Rope_const_iterator<_CharT,_Alloc>& __x, - ptrdiff_t __n); - friend _Rope_const_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS - (ptrdiff_t __n, - const _Rope_const_iterator<_CharT,_Alloc>& __x); - reference operator[](size_t __n) { - return rope<_CharT,_Alloc>::_S_fetch(_M_root, _M_current_pos + __n); - } - friend bool operator== __STL_NULL_TMPL_ARGS - (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y); - friend bool operator< __STL_NULL_TMPL_ARGS - (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y); - friend ptrdiff_t operator- __STL_NULL_TMPL_ARGS - (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y); -}; - -template -class _Rope_iterator : public _Rope_iterator_base<_CharT,_Alloc> { - friend class rope<_CharT,_Alloc>; - protected: - rope<_CharT,_Alloc>* _M_root_rope; - // root is treated as a cached version of this, - // and is used to detect changes to the underlying - // rope. - // Root is included in the reference count. - // This is necessary so that we can detect changes reliably. - // Unfortunately, it requires careful bookkeeping for the - // nonGC case. - _Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos) - : _Rope_iterator_base<_CharT,_Alloc>(__r->_M_tree_ptr, __pos), - _M_root_rope(__r) - { _RopeRep::_S_ref(_M_root); } - - void _M_check(); - public: - typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference; - typedef _Rope_char_ref_proxy<_CharT,_Alloc>* pointer; - - public: - rope<_CharT,_Alloc>& container() { return *_M_root_rope; } - _Rope_iterator() { - _M_root = 0; // Needed for reference counting. - }; - _Rope_iterator(const _Rope_iterator& __x) : - _Rope_iterator_base<_CharT,_Alloc>(__x) { - _M_root_rope = __x._M_root_rope; - _RopeRep::_S_ref(_M_root); - } - _Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos); - ~_Rope_iterator() { - _RopeRep::_S_unref(_M_root); - } - _Rope_iterator& operator= (const _Rope_iterator& __x) { - _RopeRep* __old = _M_root; - - _RopeRep::_S_ref(__x._M_root); - if (0 != __x._M_buf_ptr) { - _M_root_rope = __x._M_root_rope; - *(static_cast<_Rope_iterator_base<_CharT,_Alloc>*>(this)) = __x; - } else { - _M_current_pos = __x._M_current_pos; - _M_root = __x._M_root; - _M_root_rope = __x._M_root_rope; - _M_buf_ptr = 0; - } - _RopeRep::_S_unref(__old); - return(*this); - } - reference operator*() { - _M_check(); - if (0 == _M_buf_ptr) { - return _Rope_char_ref_proxy<_CharT,_Alloc>( - _M_root_rope, _M_current_pos); - } else { - return _Rope_char_ref_proxy<_CharT,_Alloc>( - _M_root_rope, _M_current_pos, *_M_buf_ptr); - } - } - _Rope_iterator& operator++() { - _M_incr(1); - return *this; - } - _Rope_iterator& operator+=(difference_type __n) { - if (__n >= 0) { - _M_incr(__n); - } else { - _M_decr(-__n); - } - return *this; - } - _Rope_iterator& operator--() { - _M_decr(1); - return *this; - } - _Rope_iterator& operator-=(difference_type __n) { - if (__n >= 0) { - _M_decr(__n); - } else { - _M_incr(-__n); - } - return *this; - } - _Rope_iterator operator++(int) { - size_t __old_pos = _M_current_pos; - _M_incr(1); - return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos); - } - _Rope_iterator operator--(int) { - size_t __old_pos = _M_current_pos; - _M_decr(1); - return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos); - } - reference operator[](ptrdiff_t __n) { - return _Rope_char_ref_proxy<_CharT,_Alloc>( - _M_root_rope, _M_current_pos + __n); - } - friend bool operator== __STL_NULL_TMPL_ARGS - (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y); - friend bool operator< __STL_NULL_TMPL_ARGS - (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y); - friend ptrdiff_t operator- __STL_NULL_TMPL_ARGS - (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y); - friend _Rope_iterator<_CharT,_Alloc> operator- __STL_NULL_TMPL_ARGS - (const _Rope_iterator<_CharT,_Alloc>& __x, - ptrdiff_t __n); - friend _Rope_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS - (const _Rope_iterator<_CharT,_Alloc>& __x, - ptrdiff_t __n); - friend _Rope_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS - (ptrdiff_t __n, - const _Rope_iterator<_CharT,_Alloc>& __x); - -}; - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1375 -#endif - -// The rope base class encapsulates -// the differences between SGI-style allocators and standard-conforming -// allocators. - -#ifdef __STL_USE_STD_ALLOCATORS - -// Base class for ordinary allocators. -template -class _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 _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 -struct _Rope_base - : public _Rope_alloc_base<_CharT,_Alloc, - _Alloc_traits<_CharT,_Alloc>::_S_instanceless> -{ - typedef _Rope_alloc_base<_CharT,_Alloc, - _Alloc_traits<_CharT,_Alloc>::_S_instanceless> - _Base; - typedef typename _Base::allocator_type allocator_type; - _Rope_base(_RopeRep* __t, const allocator_type& __a) : _Base(__t, __a) {} - _Rope_base(const allocator_type& __a) : _Base(__a) {} -}; - -#else /* !__STL_USE_STD_ALLOCATORS */ - -template -class _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 rope : public _Rope_base<_CharT,_Alloc> { - public: - typedef _CharT value_type; - typedef ptrdiff_t difference_type; - typedef size_t size_type; - typedef _CharT const_reference; - typedef const _CharT* const_pointer; - typedef _Rope_iterator<_CharT,_Alloc> iterator; - typedef _Rope_const_iterator<_CharT,_Alloc> const_iterator; - typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference; - typedef _Rope_char_ptr_proxy<_CharT,_Alloc> pointer; - - friend class _Rope_iterator<_CharT,_Alloc>; - friend class _Rope_const_iterator<_CharT,_Alloc>; - friend struct _Rope_RopeRep<_CharT,_Alloc>; - friend class _Rope_iterator_base<_CharT,_Alloc>; - friend class _Rope_char_ptr_proxy<_CharT,_Alloc>; - friend class _Rope_char_ref_proxy<_CharT,_Alloc>; - friend struct _Rope_RopeSubstring<_CharT,_Alloc>; - - protected: - typedef _Rope_base<_CharT,_Alloc> _Base; - typedef typename _Base::allocator_type allocator_type; -# ifdef __STL_USE_NAMESPACES - using _Base::_M_tree_ptr; -# endif - typedef __GC_CONST _CharT* _Cstrptr; -# ifdef __STL_SGI_THREADS - static _Cstrptr _S_atomic_swap(_Cstrptr* __p, _Cstrptr __q) { -# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64)) - return (_Cstrptr) test_and_set((unsigned long*)__p, - (unsigned long)__q); -# else - return (_Cstrptr) __test_and_set((unsigned long*)__p, - (unsigned long)__q); -# endif - } -# elif defined(__STL_WIN32THREADS) - static _Cstrptr _S_atomic_swap(_Cstrptr* __p, _Cstrptr __q) { - return (_Cstrptr) InterlockedExchange( - (LPLONG)__p, (LONG)__q); - } -# elif defined(__STL_PTHREADS) - // This should be portable, but performance is expected - // to be quite awful. This really needs platform specific - // code. - static pthread_mutex_t _S_swap_lock; - static _Cstrptr _S_atomic_swap(_Cstrptr* __p, _Cstrptr __q) { - pthread_mutex_lock(&_S_swap_lock); - _Cstrptr __result = *__p; - *__p = __q; - pthread_mutex_unlock(&_S_swap_lock); - return __result; - } -# else - static _Cstrptr _S_atomic_swap(_Cstrptr* __p, _Cstrptr __q) { - _Cstrptr __result = *__p; - *__p = __q; - return __result; - } -# endif - - static _CharT _S_empty_c_str[1]; - - static bool _S_is0(_CharT __c) { return __c == _S_eos((_CharT*)0); } - enum { _S_copy_max = 23 }; - // For strings shorter than _S_copy_max, we copy to - // concatenate. - - typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; - typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation; - typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf; - typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction; - typedef _Rope_RopeSubstring<_CharT,_Alloc> _RopeSubstring; - - // Retrieve a character at the indicated position. - static _CharT _S_fetch(_RopeRep* __r, size_type __pos); - -# ifndef __GC - // Obtain a pointer to the character at the indicated position. - // The pointer can be used to change the character. - // If such a pointer cannot be produced, as is frequently the - // case, 0 is returned instead. - // (Returns nonzero only if all nodes in the path have a refcount - // of 1.) - static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos); -# endif - - static bool _S_apply_to_pieces( - // should be template parameter - _Rope_char_consumer<_CharT>& __c, - const _RopeRep* __r, - size_t __begin, size_t __end); - // begin and end are assumed to be in range. - -# ifndef __GC - static void _S_unref(_RopeRep* __t) - { - _RopeRep::_S_unref(__t); - } - static void _S_ref(_RopeRep* __t) - { - _RopeRep::_S_ref(__t); - } -# else /* __GC */ - static void _S_unref(_RopeRep*) {} - static void _S_ref(_RopeRep*) {} -# endif - - -# ifdef __GC - typedef _Rope_RopeRep<_CharT,_Alloc>* _Self_destruct_ptr; -# else - typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr; -# endif - - // _Result is counted in refcount. - static _RopeRep* _S_substring(_RopeRep* __base, - size_t __start, size_t __endp1); - - static _RopeRep* _S_concat_char_iter(_RopeRep* __r, - const _CharT* __iter, size_t __slen); - // Concatenate rope and char ptr, copying __s. - // Should really take an arbitrary iterator. - // Result is counted in refcount. - static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r, - const _CharT* __iter, size_t __slen) - // As above, but one reference to __r is about to be - // destroyed. Thus the pieces may be recycled if all - // relevent reference counts are 1. -# ifdef __GC - // We can't really do anything since refcounts are unavailable. - { return _S_concat_char_iter(__r, __iter, __slen); } -# else - ; -# endif - - static _RopeRep* _S_concat(_RopeRep* __left, _RopeRep* __right); - // General concatenation on _RopeRep. _Result - // has refcount of 1. Adjusts argument refcounts. - - public: - void apply_to_pieces( size_t __begin, size_t __end, - _Rope_char_consumer<_CharT>& __c) const { - _S_apply_to_pieces(__c, _M_tree_ptr, __begin, __end); - } - - - protected: - - static size_t _S_rounded_up_size(size_t __n) { - return _RopeLeaf::_S_rounded_up_size(__n); - } - - static size_t _S_allocated_capacity(size_t __n) { - if (_S_is_basic_char_type((_CharT*)0)) { - return _S_rounded_up_size(__n) - 1; - } else { - return _S_rounded_up_size(__n); - } - } - - // Allocate and construct a RopeLeaf using the supplied allocator - // Takes ownership of s instead of copying. - static _RopeLeaf* _S_new_RopeLeaf(__GC_CONST _CharT *__s, - size_t __size, allocator_type __a) - { -# ifdef __STL_USE_STD_ALLOCATORS - _RopeLeaf* __space = _LAllocator(__a).allocate(1); -# else - _RopeLeaf* __space = _L_allocate(1); -# endif - return new(__space) _RopeLeaf(__s, __size, __a); - } - - static _RopeConcatenation* _S_new_RopeConcatenation( - _RopeRep* __left, _RopeRep* __right, - allocator_type __a) - { -# ifdef __STL_USE_STD_ALLOCATORS - _RopeConcatenation* __space = _CAllocator(__a).allocate(1); -# else - _RopeConcatenation* __space = _C_allocate(1); -# endif - return new(__space) _RopeConcatenation(__left, __right, __a); - } - - static _RopeFunction* _S_new_RopeFunction(char_producer<_CharT>* __f, - size_t __size, bool __d, allocator_type __a) - { -# ifdef __STL_USE_STD_ALLOCATORS - _RopeFunction* __space = _FAllocator(__a).allocate(1); -# else - _RopeFunction* __space = _F_allocate(1); -# endif - return new(__space) _RopeFunction(__f, __size, __d, __a); - } - - static _RopeSubstring* _S_new_RopeSubstring( - _Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s, - size_t __l, allocator_type __a) - { -# ifdef __STL_USE_STD_ALLOCATORS - _RopeSubstring* __space = _SAllocator(__a).allocate(1); -# else - _RopeSubstring* __space = _S_allocate(1); -# endif - return new(__space) _RopeSubstring(__b, __s, __l, __a); - } - -# ifdef __STL_USE_STD_ALLOCATORS - static - _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s, - size_t __size, allocator_type __a) -# define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \ - _S_RopeLeaf_from_unowned_char_ptr(__s, __size, __a) -# else - static - _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr2(const _CharT* __s, - size_t __size) -# define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \ - _S_RopeLeaf_from_unowned_char_ptr2(__s, __size) -# endif - { - if (0 == __size) return 0; -# ifdef __STL_USE_STD_ALLOCATORS - _CharT* __buf = __a.allocate(_S_rounded_up_size(__size)); -# else - _CharT* __buf = _Data_allocate(_S_rounded_up_size(__size)); - allocator_type __a = allocator_type(); -# endif - - uninitialized_copy_n(__s, __size, __buf); - _S_cond_store_eos(__buf[__size]); - __STL_TRY { - return _S_new_RopeLeaf(__buf, __size, __a); - } - __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__buf, __size, __a)) - } - - - // Concatenation of nonempty strings. - // Always builds a concatenation node. - // Rebalances if the result is too deep. - // Result has refcount 1. - // Does not increment left and right ref counts even though - // they are referenced. - static _RopeRep* - _S_tree_concat(_RopeRep* __left, _RopeRep* __right); - - // Concatenation helper functions - static _RopeLeaf* - _S_leaf_concat_char_iter(_RopeLeaf* __r, - const _CharT* __iter, size_t __slen); - // Concatenate by copying leaf. - // should take an arbitrary iterator - // result has refcount 1. -# ifndef __GC - static _RopeLeaf* _S_destr_leaf_concat_char_iter - (_RopeLeaf* __r, const _CharT* __iter, size_t __slen); - // A version that potentially clobbers __r if __r->_M_refcount == 1. -# endif - - // A helper function for exponentiating strings. - // This uses a nonstandard refcount convention. - // The result has refcount 0. - struct _Concat_fn - : public binary_function, - rope<_CharT,_Alloc>, - rope<_CharT,_Alloc> > { - rope operator() (const rope& __x, const rope& __y) { - return __x + __y; - } - }; - - // Needed by the call to "power" used to build ropes - // consisting of n copies of a character. - friend rope identity_element(_Concat_fn) - { return rope<_CharT,_Alloc>(); } - - static size_t _S_char_ptr_len(const _CharT* __s); - // slightly generalized strlen - - rope(_RopeRep* __t, const allocator_type& __a = allocator_type()) - : _Base(__t,__a) { } - - - // Copy __r to the _CharT buffer. - // Returns __buffer + __r->_M_size. - // Assumes that buffer is uninitialized. - static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer); - - // Again, with explicit starting position and length. - // Assumes that buffer is uninitialized. - static _CharT* _S_flatten(_RopeRep* __r, - size_t __start, size_t __len, - _CharT* __buffer); - - static const unsigned long - _S_min_len[_RopeRep::_S_max_rope_depth + 1]; - - static bool _S_is_balanced(_RopeRep* __r) - { return (__r->_M_size >= _S_min_len[__r->_M_depth]); } - - static bool _S_is_almost_balanced(_RopeRep* __r) - { return (__r->_M_depth == 0 || - __r->_M_size >= _S_min_len[__r->_M_depth - 1]); } - - static bool _S_is_roughly_balanced(_RopeRep* __r) - { return (__r->_M_depth <= 1 || - __r->_M_size >= _S_min_len[__r->_M_depth - 2]); } - - // Assumes the result is not empty. - static _RopeRep* _S_concat_and_set_balanced(_RopeRep* __left, - _RopeRep* __right) - { - _RopeRep* __result = _S_concat(__left, __right); - if (_S_is_balanced(__result)) __result->_M_is_balanced = true; - return __result; - } - - // The basic rebalancing operation. Logically copies the - // rope. The result has refcount of 1. The client will - // usually decrement the reference count of __r. - // The result is within height 2 of balanced by the above - // definition. - static _RopeRep* _S_balance(_RopeRep* __r); - - // Add all unbalanced subtrees to the forest of balanceed trees. - // Used only by balance. - static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest); - - // Add __r to forest, assuming __r is already balanced. - static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest); - - // Print to stdout, exposing structure - static void _S_dump(_RopeRep* __r, int __indent = 0); - - // Return -1, 0, or 1 if __x < __y, __x == __y, or __x > __y resp. - static int _S_compare(const _RopeRep* __x, const _RopeRep* __y); - - public: - bool empty() const { return 0 == _M_tree_ptr; } - - // Comparison member function. This is public only for those - // clients that need a ternary comparison. Others - // should use the comparison operators below. - int compare(const rope& __y) const { - return _S_compare(_M_tree_ptr, __y._M_tree_ptr); - } - - rope(const _CharT* __s, const allocator_type& __a = allocator_type()) - : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, _S_char_ptr_len(__s), - __a),__a) - { } - - rope(const _CharT* __s, size_t __len, - const allocator_type& __a = allocator_type()) - : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __len, __a), __a) - { } - - // Should perhaps be templatized with respect to the iterator type - // and use Sequence_buffer. (It should perhaps use sequence_buffer - // even now.) - rope(const _CharT *__s, const _CharT *__e, - const allocator_type& __a = allocator_type()) - : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __e - __s, __a), __a) - { } - - rope(const const_iterator& __s, const const_iterator& __e, - const allocator_type& __a = allocator_type()) - : _Base(_S_substring(__s._M_root, __s._M_current_pos, - __e._M_current_pos), __a) - { } - - rope(const iterator& __s, const iterator& __e, - const allocator_type& __a = allocator_type()) - : _Base(_S_substring(__s._M_root, __s._M_current_pos, - __e._M_current_pos), __a) - { } - - rope(_CharT __c, const allocator_type& __a = allocator_type()) - : _Base(__a) - { - _CharT* __buf = _Data_allocate(_S_rounded_up_size(1)); - - construct(__buf, __c); - __STL_TRY { - _M_tree_ptr = _S_new_RopeLeaf(__buf, 1, __a); - } - __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__buf, 1, __a)) - } - - rope(size_t __n, _CharT __c, - const allocator_type& __a = allocator_type()); - - rope(const allocator_type& __a = allocator_type()) - : _Base(0, __a) {} - - // Construct a rope from a function that can compute its members - rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { - _M_tree_ptr = (0 == __len) ? - 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a); - } - - rope(const rope& __x, const allocator_type& __a = allocator_type()) - : _Base(__x._M_tree_ptr, __a) - { - _S_ref(_M_tree_ptr); - } - - ~rope() - { - _S_unref(_M_tree_ptr); - } - - rope& operator=(const rope& __x) - { - _RopeRep* __old = _M_tree_ptr; -# ifdef __STL_USE_STD_ALLOCATORS - __stl_assert(get_allocator() == __x.get_allocator()); -# endif - _M_tree_ptr = __x._M_tree_ptr; - _S_ref(_M_tree_ptr); - _S_unref(__old); - return(*this); - } - - void push_back(_CharT __x) - { - _RopeRep* __old = _M_tree_ptr; - _M_tree_ptr = _S_concat_char_iter(_M_tree_ptr, &__x, 1); - _S_unref(__old); - } - - void pop_back() - { - _RopeRep* __old = _M_tree_ptr; - _M_tree_ptr = - _S_substring(_M_tree_ptr, 0, _M_tree_ptr->_M_size - 1); - _S_unref(__old); - } - - _CharT back() const - { - return _S_fetch(_M_tree_ptr, _M_tree_ptr->_M_size - 1); - } - - void push_front(_CharT __x) - { - _RopeRep* __old = _M_tree_ptr; - _RopeRep* __left = - __STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, get_allocator()); - __STL_TRY { - _M_tree_ptr = _S_concat(__left, _M_tree_ptr); - _S_unref(__old); - _S_unref(__left); - } - __STL_UNWIND(_S_unref(__left)) - } - - void pop_front() - { - _RopeRep* __old = _M_tree_ptr; - _M_tree_ptr = _S_substring(_M_tree_ptr, 1, _M_tree_ptr->_M_size); - _S_unref(__old); - } - - _CharT front() const - { - return _S_fetch(_M_tree_ptr, 0); - } - - void balance() - { - _RopeRep* __old = _M_tree_ptr; - _M_tree_ptr = _S_balance(_M_tree_ptr); - _S_unref(__old); - } - - void copy(_CharT* __buffer) const { - destroy(__buffer, __buffer + size()); - _S_flatten(_M_tree_ptr, __buffer); - } - - // This is the copy function from the standard, but - // with the arguments reordered to make it consistent with the - // rest of the interface. - // Note that this guaranteed not to compile if the draft standard - // order is assumed. - size_type copy(size_type __pos, size_type __n, _CharT* __buffer) const - { - size_t __size = size(); - size_t __len = (__pos + __n > __size? __size - __pos : __n); - - destroy(__buffer, __buffer + __len); - _S_flatten(_M_tree_ptr, __pos, __len, __buffer); - return __len; - } - - // Print to stdout, exposing structure. May be useful for - // performance debugging. - void dump() { - _S_dump(_M_tree_ptr); - } - - // Convert to 0 terminated string in new allocated memory. - // Embedded 0s in the input do not terminate the copy. - const _CharT* c_str() const; - - // As above, but lso use the flattened representation as the - // the new rope representation. - const _CharT* replace_with_c_str(); - - // Reclaim memory for the c_str generated flattened string. - // Intentionally undocumented, since it's hard to say when this - // is safe for multiple threads. - void delete_c_str () { - if (0 == _M_tree_ptr) return; - if (_RopeRep::_S_leaf == _M_tree_ptr->_M_tag && - ((_RopeLeaf*)_M_tree_ptr)->_M_data == - _M_tree_ptr->_M_c_string) { - // Representation shared - return; - } -# ifndef __GC - _M_tree_ptr->_M_free_c_string(); -# endif - _M_tree_ptr->_M_c_string = 0; - } - - _CharT operator[] (size_type __pos) const { - return _S_fetch(_M_tree_ptr, __pos); - } - - _CharT at(size_type __pos) const { - // if (__pos >= size()) throw out_of_range; // XXX - return (*this)[__pos]; - } - - const_iterator begin() const { - return(const_iterator(_M_tree_ptr, 0)); - } - - // An easy way to get a const iterator from a non-const container. - const_iterator const_begin() const { - return(const_iterator(_M_tree_ptr, 0)); - } - - const_iterator end() const { - return(const_iterator(_M_tree_ptr, size())); - } - - const_iterator const_end() const { - return(const_iterator(_M_tree_ptr, size())); - } - - size_type size() const { - return(0 == _M_tree_ptr? 0 : _M_tree_ptr->_M_size); - } - - size_type length() const { - return size(); - } - - size_type max_size() const { - return _S_min_len[_RopeRep::_S_max_rope_depth-1] - 1; - // Guarantees that the result can be sufficirntly - // balanced. Longer ropes will probably still work, - // but it's harder to make guarantees. - } - -# ifdef __STL_CLASS_PARTIAL_SPECIALIZATION - typedef reverse_iterator const_reverse_iterator; -# else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - typedef reverse_iterator const_reverse_iterator; -# endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - - const_reverse_iterator rbegin() const { - return const_reverse_iterator(end()); - } - - const_reverse_iterator const_rbegin() const { - return const_reverse_iterator(end()); - } - - const_reverse_iterator rend() const { - return const_reverse_iterator(begin()); - } - - const_reverse_iterator const_rend() const { - return const_reverse_iterator(begin()); - } - - friend rope<_CharT,_Alloc> - operator+ __STL_NULL_TMPL_ARGS (const rope<_CharT,_Alloc>& __left, - const rope<_CharT,_Alloc>& __right); - - friend rope<_CharT,_Alloc> - operator+ __STL_NULL_TMPL_ARGS (const rope<_CharT,_Alloc>& __left, - const _CharT* __right); - - friend rope<_CharT,_Alloc> - operator+ __STL_NULL_TMPL_ARGS (const rope<_CharT,_Alloc>& __left, - _CharT __right); - - // The symmetric cases are intentionally omitted, since they're presumed - // to be less common, and we don't handle them as well. - - // The following should really be templatized. - // The first argument should be an input iterator or - // forward iterator with value_type _CharT. - rope& append(const _CharT* __iter, size_t __n) { - _RopeRep* __result = - _S_destr_concat_char_iter(_M_tree_ptr, __iter, __n); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - return *this; - } - - rope& append(const _CharT* __c_string) { - size_t __len = _S_char_ptr_len(__c_string); - append(__c_string, __len); - return(*this); - } - - rope& append(const _CharT* __s, const _CharT* __e) { - _RopeRep* __result = - _S_destr_concat_char_iter(_M_tree_ptr, __s, __e - __s); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - return *this; - } - - rope& append(const_iterator __s, const_iterator __e) { - __stl_assert(__s._M_root == __e._M_root); -# ifdef __STL_USE_STD_ALLOCATORS - __stl_assert(get_allocator() == __s._M_root->get_allocator()); -# endif - _Self_destruct_ptr __appendee(_S_substring( - __s._M_root, __s._M_current_pos, __e._M_current_pos)); - _RopeRep* __result = - _S_concat(_M_tree_ptr, (_RopeRep*)__appendee); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - return *this; - } - - rope& append(_CharT __c) { - _RopeRep* __result = - _S_destr_concat_char_iter(_M_tree_ptr, &__c, 1); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - return *this; - } - - rope& append() { return append(_CharT()); } // XXX why? - - rope& append(const rope& __y) { -# ifdef __STL_USE_STD_ALLOCATORS - __stl_assert(__y.get_allocator() == get_allocator()); -# endif - _RopeRep* __result = _S_concat(_M_tree_ptr, __y._M_tree_ptr); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - return *this; - } - - rope& append(size_t __n, _CharT __c) { - rope<_CharT,_Alloc> __last(__n, __c); - return append(__last); - } - - void swap(rope& __b) { -# ifdef __STL_USE_STD_ALLOCATORS - __stl_assert(get_allocator() == __b.get_allocator()); -# endif - _RopeRep* __tmp = _M_tree_ptr; - _M_tree_ptr = __b._M_tree_ptr; - __b._M_tree_ptr = __tmp; - } - - - protected: - // Result is included in refcount. - static _RopeRep* replace(_RopeRep* __old, size_t __pos1, - size_t __pos2, _RopeRep* __r) { - if (0 == __old) { _S_ref(__r); return __r; } - _Self_destruct_ptr __left( - _S_substring(__old, 0, __pos1)); - _Self_destruct_ptr __right( - _S_substring(__old, __pos2, __old->_M_size)); - _RopeRep* __result; - -# ifdef __STL_USE_STD_ALLOCATORS - __stl_assert(__old->get_allocator() == __r->get_allocator()); -# endif - if (0 == __r) { - __result = _S_concat(__left, __right); - } else { - _Self_destruct_ptr __left_result(_S_concat(__left, __r)); - __result = _S_concat(__left_result, __right); - } - return __result; - } - - public: - void insert(size_t __p, const rope& __r) { - _RopeRep* __result = - replace(_M_tree_ptr, __p, __p, __r._M_tree_ptr); -# ifdef __STL_USE_STD_ALLOCATORS - __stl_assert(get_allocator() == __r.get_allocator()); -# endif - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - } - - void insert(size_t __p, size_t __n, _CharT __c) { - rope<_CharT,_Alloc> __r(__n,__c); - insert(__p, __r); - } - - void insert(size_t __p, const _CharT* __i, size_t __n) { - _Self_destruct_ptr __left(_S_substring(_M_tree_ptr, 0, __p)); - _Self_destruct_ptr __right(_S_substring(_M_tree_ptr, __p, size())); - _Self_destruct_ptr __left_result( - _S_concat_char_iter(__left, __i, __n)); - _RopeRep* __result = _S_concat(__left_result, __right); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - } - - void insert(size_t __p, const _CharT* __c_string) { - insert(__p, __c_string, _S_char_ptr_len(__c_string)); - } - - void insert(size_t __p, _CharT __c) { - insert(__p, &__c, 1); - } - - void insert(size_t __p) { - _CharT __c = _CharT(); - insert(__p, &__c, 1); - } - - void insert(size_t __p, const _CharT* __i, const _CharT* __j) { - rope __r(__i, __j); - insert(__p, __r); - } - - void insert(size_t __p, const const_iterator& __i, - const const_iterator& __j) { - rope __r(__i, __j); - insert(__p, __r); - } - - void insert(size_t __p, const iterator& __i, - const iterator& __j) { - rope __r(__i, __j); - insert(__p, __r); - } - - // (position, length) versions of replace operations: - - void replace(size_t __p, size_t __n, const rope& __r) { - _RopeRep* __result = - replace(_M_tree_ptr, __p, __p + __n, __r._M_tree_ptr); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - } - - void replace(size_t __p, size_t __n, - const _CharT* __i, size_t __i_len) { - rope __r(__i, __i_len); - replace(__p, __n, __r); - } - - void replace(size_t __p, size_t __n, _CharT __c) { - rope __r(__c); - replace(__p, __n, __r); - } - - void replace(size_t __p, size_t __n, const _CharT* __c_string) { - rope __r(__c_string); - replace(__p, __n, __r); - } - - void replace(size_t __p, size_t __n, - const _CharT* __i, const _CharT* __j) { - rope __r(__i, __j); - replace(__p, __n, __r); - } - - void replace(size_t __p, size_t __n, - const const_iterator& __i, const const_iterator& __j) { - rope __r(__i, __j); - replace(__p, __n, __r); - } - - void replace(size_t __p, size_t __n, - const iterator& __i, const iterator& __j) { - rope __r(__i, __j); - replace(__p, __n, __r); - } - - // Single character variants: - void replace(size_t __p, _CharT __c) { - iterator __i(this, __p); - *__i = __c; - } - - void replace(size_t __p, const rope& __r) { - replace(__p, 1, __r); - } - - void replace(size_t __p, const _CharT* __i, size_t __i_len) { - replace(__p, 1, __i, __i_len); - } - - void replace(size_t __p, const _CharT* __c_string) { - replace(__p, 1, __c_string); - } - - void replace(size_t __p, const _CharT* __i, const _CharT* __j) { - replace(__p, 1, __i, __j); - } - - void replace(size_t __p, const const_iterator& __i, - const const_iterator& __j) { - replace(__p, 1, __i, __j); - } - - void replace(size_t __p, const iterator& __i, - const iterator& __j) { - replace(__p, 1, __i, __j); - } - - // Erase, (position, size) variant. - void erase(size_t __p, size_t __n) { - _RopeRep* __result = replace(_M_tree_ptr, __p, __p + __n, 0); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - } - - // Erase, single character - void erase(size_t __p) { - erase(__p, __p + 1); - } - - // Insert, iterator variants. - iterator insert(const iterator& __p, const rope& __r) - { insert(__p.index(), __r); return __p; } - iterator insert(const iterator& __p, size_t __n, _CharT __c) - { insert(__p.index(), __n, __c); return __p; } - iterator insert(const iterator& __p, _CharT __c) - { insert(__p.index(), __c); return __p; } - iterator insert(const iterator& __p ) - { insert(__p.index()); return __p; } - iterator insert(const iterator& __p, const _CharT* c_string) - { insert(__p.index(), c_string); return __p; } - iterator insert(const iterator& __p, const _CharT* __i, size_t __n) - { insert(__p.index(), __i, __n); return __p; } - iterator insert(const iterator& __p, const _CharT* __i, - const _CharT* __j) - { insert(__p.index(), __i, __j); return __p; } - iterator insert(const iterator& __p, - const const_iterator& __i, const const_iterator& __j) - { insert(__p.index(), __i, __j); return __p; } - iterator insert(const iterator& __p, - const iterator& __i, const iterator& __j) - { insert(__p.index(), __i, __j); return __p; } - - // Replace, range variants. - void replace(const iterator& __p, const iterator& __q, - const rope& __r) - { replace(__p.index(), __q.index() - __p.index(), __r); } - void replace(const iterator& __p, const iterator& __q, _CharT __c) - { replace(__p.index(), __q.index() - __p.index(), __c); } - void replace(const iterator& __p, const iterator& __q, - const _CharT* __c_string) - { replace(__p.index(), __q.index() - __p.index(), __c_string); } - void replace(const iterator& __p, const iterator& __q, - const _CharT* __i, size_t __n) - { replace(__p.index(), __q.index() - __p.index(), __i, __n); } - void replace(const iterator& __p, const iterator& __q, - const _CharT* __i, const _CharT* __j) - { replace(__p.index(), __q.index() - __p.index(), __i, __j); } - void replace(const iterator& __p, const iterator& __q, - const const_iterator& __i, const const_iterator& __j) - { replace(__p.index(), __q.index() - __p.index(), __i, __j); } - void replace(const iterator& __p, const iterator& __q, - const iterator& __i, const iterator& __j) - { replace(__p.index(), __q.index() - __p.index(), __i, __j); } - - // Replace, iterator variants. - void replace(const iterator& __p, const rope& __r) - { replace(__p.index(), __r); } - void replace(const iterator& __p, _CharT __c) - { replace(__p.index(), __c); } - void replace(const iterator& __p, const _CharT* __c_string) - { replace(__p.index(), __c_string); } - void replace(const iterator& __p, const _CharT* __i, size_t __n) - { replace(__p.index(), __i, __n); } - void replace(const iterator& __p, const _CharT* __i, const _CharT* __j) - { replace(__p.index(), __i, __j); } - void replace(const iterator& __p, const_iterator __i, - const_iterator __j) - { replace(__p.index(), __i, __j); } - void replace(const iterator& __p, iterator __i, iterator __j) - { replace(__p.index(), __i, __j); } - - // Iterator and range variants of erase - iterator erase(const iterator& __p, const iterator& __q) { - size_t __p_index = __p.index(); - erase(__p_index, __q.index() - __p_index); - return iterator(this, __p_index); - } - iterator erase(const iterator& __p) { - size_t __p_index = __p.index(); - erase(__p_index, 1); - return iterator(this, __p_index); - } - - rope substr(size_t __start, size_t __len = 1) const { - return rope<_CharT,_Alloc>( - _S_substring(_M_tree_ptr, __start, __start + __len)); - } - - rope substr(iterator __start, iterator __end) const { - return rope<_CharT,_Alloc>( - _S_substring(_M_tree_ptr, __start.index(), __end.index())); - } - - rope substr(iterator __start) const { - size_t __pos = __start.index(); - return rope<_CharT,_Alloc>( - _S_substring(_M_tree_ptr, __pos, __pos + 1)); - } - - rope substr(const_iterator __start, const_iterator __end) const { - // This might eventually take advantage of the cache in the - // iterator. - return rope<_CharT,_Alloc>( - _S_substring(_M_tree_ptr, __start.index(), __end.index())); - } - - rope<_CharT,_Alloc> substr(const_iterator __start) { - size_t __pos = __start.index(); - return rope<_CharT,_Alloc>( - _S_substring(_M_tree_ptr, __pos, __pos + 1)); - } - - static const size_type npos; - - size_type find(_CharT __c, size_type __pos = 0) const; - size_type find(_CharT* __s, size_type __pos = 0) const { - size_type __result_pos; - const_iterator __result = search(const_begin() + __pos, const_end(), - __s, __s + _S_char_ptr_len(__s)); - __result_pos = __result.index(); -# ifndef __STL_OLD_ROPE_SEMANTICS - if (__result_pos == size()) __result_pos = npos; -# endif - return __result_pos; - } - - iterator mutable_begin() { - return(iterator(this, 0)); - } - - iterator mutable_end() { - return(iterator(this, size())); - } - -# ifdef __STL_CLASS_PARTIAL_SPECIALIZATION - typedef reverse_iterator reverse_iterator; -# else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - typedef reverse_iterator 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 -const rope<_CharT, _Alloc>::size_type rope<_CharT, _Alloc>::npos = - (size_type)(-1); - -template -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 -inline bool operator< (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y) { - return (__x._M_current_pos < __y._M_current_pos); -} - -template -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 -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 -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 -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 -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 -inline bool operator< (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y) { - return (__x._M_current_pos < __y._M_current_pos); -} - -template -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 -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 -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 -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 -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 -inline -rope<_CharT,_Alloc>& -operator+= (rope<_CharT,_Alloc>& __left, - const rope<_CharT,_Alloc>& __right) -{ - __left.append(__right); - return __left; -} - -template -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 -inline -rope<_CharT,_Alloc>& -operator+= (rope<_CharT,_Alloc>& __left, - const _CharT* __right) { - __left.append(__right); - return __left; -} - -template -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 -inline -rope<_CharT,_Alloc>& -operator+= (rope<_CharT,_Alloc>& __left, _CharT __right) { - __left.append(__right); - return __left; -} - -template -bool -operator< (const rope<_CharT,_Alloc>& __left, - const rope<_CharT,_Alloc>& __right) { - return __left.compare(__right) < 0; -} - -template -bool -operator== (const rope<_CharT,_Alloc>& __left, - const rope<_CharT,_Alloc>& __right) { - return __left.compare(__right) == 0; -} - -template -inline bool operator== (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x, - const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) { - return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root); -} - -template -ostream& operator<< (ostream& __o, const rope<_CharT,_Alloc>& __r); - -typedef rope crope; -typedef rope 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 -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 -{ - 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 -{ - 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 - -# endif /* __SGI_STL_INTERNAL_ROPE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_set.h b/contrib/libstdc++/stl/stl_set.h deleted file mode 100644 index 003069cb07..0000000000 --- a/contrib/libstdc++/stl/stl_set.h +++ /dev/null @@ -1,216 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_SET_H -#define __SGI_STL_INTERNAL_SET_H - -__STL_BEGIN_NAMESPACE - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1174 -#pragma set woff 1375 -#endif - -#ifndef __STL_LIMITED_DEFAULT_TEMPLATES -template , - class _Alloc = __STL_DEFAULT_ALLOCATOR(_Key) > -#else -template -#endif -class set { -public: - // typedefs: - - typedef _Key key_type; - typedef _Key value_type; - typedef _Compare key_compare; - typedef _Compare value_compare; -private: - typedef _Rb_tree, key_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 - set(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_unique(__first, __last); } - - template - 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 insert(const value_type& __x) { - pair __p = _M_t.insert_unique(__x); - return pair(__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 - 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 equal_range(const key_type& __x) const { - return _M_t.equal_range(__x); - } - friend bool operator== __STL_NULL_TMPL_ARGS (const set&, const set&); - friend bool operator< __STL_NULL_TMPL_ARGS (const set&, const set&); -}; - -template -inline bool operator==(const set<_Key,_Compare,_Alloc>& __x, - const set<_Key,_Compare,_Alloc>& __y) { - return __x._M_t == __y._M_t; -} - -template -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 -inline void swap(set<_Key,_Compare,_Alloc>& __x, - set<_Key,_Compare,_Alloc>& __y) { - __x.swap(__y); -} - -#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#pragma reset woff 1375 -#endif - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_SET_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_slist.h b/contrib/libstdc++/stl/stl_slist.h deleted file mode 100644 index 6da234d92c..0000000000 --- a/contrib/libstdc++/stl/stl_slist.h +++ /dev/null @@ -1,945 +0,0 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_SLIST_H -#define __SGI_STL_INTERNAL_SLIST_H - - -__STL_BEGIN_NAMESPACE - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1174 -#pragma set woff 1375 -#endif - -struct _Slist_node_base -{ - _Slist_node_base* _M_next; -}; - -inline _Slist_node_base* -__slist_make_link(_Slist_node_base* __prev_node, - _Slist_node_base* __new_node) -{ - __new_node->_M_next = __prev_node->_M_next; - __prev_node->_M_next = __new_node; - return __new_node; -} - -inline _Slist_node_base* -__slist_previous(_Slist_node_base* __head, - const _Slist_node_base* __node) -{ - while (__head && __head->_M_next != __node) - __head = __head->_M_next; - return __head; -} - -inline const _Slist_node_base* -__slist_previous(const _Slist_node_base* __head, - const _Slist_node_base* __node) -{ - while (__head && __head->_M_next != __node) - __head = __head->_M_next; - return __head; -} - -inline void __slist_splice_after(_Slist_node_base* __pos, - _Slist_node_base* __before_first, - _Slist_node_base* __before_last) -{ - if (__pos != __before_first && __pos != __before_last) { - _Slist_node_base* __first = __before_first->_M_next; - _Slist_node_base* __after = __pos->_M_next; - __before_first->_M_next = __before_last->_M_next; - __pos->_M_next = __first; - __before_last->_M_next = __after; - } -} - -inline _Slist_node_base* __slist_reverse(_Slist_node_base* __node) -{ - _Slist_node_base* __result = __node; - __node = __node->_M_next; - __result->_M_next = 0; - while(__node) { - _Slist_node_base* __next = __node->_M_next; - __node->_M_next = __result; - __result = __node; - __node = __next; - } - return __result; -} - -inline size_t __slist_size(_Slist_node_base* __node) -{ - size_t __result = 0; - for ( ; __node != 0; __node = __node->_M_next) - ++__result; - return __result; -} - -template -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 -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 -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 _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 _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 -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 -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 -_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 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 - slist(_InputIterator __first, _InputIterator __last, - const allocator_type& __a = allocator_type()) : _Base(__a) - { _M_insert_after_range(&_M_head, __first, __last); } - -#else /* __STL_MEMBER_TEMPLATES */ - slist(const_iterator __first, const_iterator __last, - const allocator_type& __a = allocator_type()) : _Base(__a) - { _M_insert_after_range(&_M_head, __first, __last); } - slist(const value_type* __first, const value_type* __last, - const allocator_type& __a = allocator_type()) : _Base(__a) - { _M_insert_after_range(&_M_head, __first, __last); } -#endif /* __STL_MEMBER_TEMPLATES */ - - slist(const slist& __x) : _Base(__x.get_allocator()) - { _M_insert_after_range(&_M_head, __x.begin(), __x.end()); } - - slist& operator= (const slist& __x); - - ~slist() {} - -public: - // assign(), a generalized assignment member function. Two - // versions: one that takes a count, and one that takes a range. - // The range version is a member template, so we dispatch on whether - // or not the type is an integer. - - void assign(size_type __n, const _Tp& __val); - -#ifdef __STL_MEMBER_TEMPLATES - - template - void assign(_InputIterator __first, _InputIterator __last) { - typedef typename _Is_integer<_InputIterator>::_Integral _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - } - - template - void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) - { assign((size_type) __n, (_Tp) __val); } - - template - void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, - __false_type); - -#endif /* __STL_MEMBER_TEMPLATES */ - -public: - - iterator begin() { return iterator((_Node*)_M_head._M_next); } - const_iterator begin() const - { return const_iterator((_Node*)_M_head._M_next);} - - iterator end() { return iterator(0); } - const_iterator end() const { return const_iterator(0); } - - size_type size() const { return __slist_size(_M_head._M_next); } - - size_type max_size() const { return size_type(-1); } - - bool empty() const { return _M_head._M_next == 0; } - - void swap(slist& __x) { __STD::swap(_M_head._M_next, __x._M_head._M_next); } - -public: - friend bool operator== __STL_NULL_TMPL_ARGS (const slist<_Tp,_Alloc>& _SL1, - const slist<_Tp,_Alloc>& _SL2); - -public: - - reference front() { return ((_Node*) _M_head._M_next)->_M_data; } - const_reference front() const - { return ((_Node*) _M_head._M_next)->_M_data; } - void push_front(const value_type& __x) { - __slist_make_link(&_M_head, _M_create_node(__x)); - } - void push_front() { __slist_make_link(&_M_head, _M_create_node());} - void pop_front() { - _Node* __node = (_Node*) _M_head._M_next; - _M_head._M_next = __node->_M_next; - destroy(&__node->_M_data); - _M_put_node(__node); - } - - iterator previous(const_iterator __pos) { - return iterator((_Node*) __slist_previous(&_M_head, __pos._M_node)); - } - const_iterator previous(const_iterator __pos) const { - return const_iterator((_Node*) __slist_previous(&_M_head, __pos._M_node)); - } - -private: - _Node* _M_insert_after(_Node_base* __pos, const value_type& __x) { - return (_Node*) (__slist_make_link(__pos, _M_create_node(__x))); - } - - _Node* _M_insert_after(_Node_base* __pos) { - return (_Node*) (__slist_make_link(__pos, _M_create_node())); - } - - void _M_insert_after_fill(_Node_base* __pos, - size_type __n, const value_type& __x) { - for (size_type __i = 0; __i < __n; ++__i) - __pos = __slist_make_link(__pos, _M_create_node(__x)); - } - -#ifdef __STL_MEMBER_TEMPLATES - - // Check whether it's an integral type. If so, it's not an iterator. - template - 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 - void _M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x, - __true_type) { - _M_insert_after_fill(__pos, __n, __x); - } - - template - 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 - 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 - void insert(iterator __pos, _InIter __first, _InIter __last) { - _M_insert_after_range(__slist_previous(&_M_head, __pos._M_node), - __first, __last); - } - -#else /* __STL_MEMBER_TEMPLATES */ - - void insert(iterator __pos, const_iterator __first, const_iterator __last) { - _M_insert_after_range(__slist_previous(&_M_head, __pos._M_node), - __first, __last); - } - void insert(iterator __pos, const value_type* __first, - const value_type* __last) { - _M_insert_after_range(__slist_previous(&_M_head, __pos._M_node), - __first, __last); - } - -#endif /* __STL_MEMBER_TEMPLATES */ - - -public: - iterator erase_after(iterator __pos) { - return iterator((_Node*) _M_erase_after(__pos._M_node)); - } - iterator erase_after(iterator __before_first, iterator __last) { - return iterator((_Node*) _M_erase_after(__before_first._M_node, - __last._M_node)); - } - - iterator erase(iterator __pos) { - return (_Node*) _M_erase_after(__slist_previous(&_M_head, - __pos._M_node)); - } - iterator erase(iterator __first, iterator __last) { - return (_Node*) _M_erase_after( - __slist_previous(&_M_head, __first._M_node), __last._M_node); - } - - void resize(size_type new_size, const _Tp& __x); - void resize(size_type new_size) { resize(new_size, _Tp()); } - void clear() { _M_erase_after(&_M_head, 0); } - -public: - // Moves the range [__before_first + 1, __before_last + 1) to *this, - // inserting it immediately after __pos. This is constant time. - void splice_after(iterator __pos, - iterator __before_first, iterator __before_last) - { - if (__before_first != __before_last) - __slist_splice_after(__pos._M_node, __before_first._M_node, - __before_last._M_node); - } - - // Moves the element that follows __prev to *this, inserting it immediately - // after __pos. This is constant time. - void splice_after(iterator __pos, iterator __prev) - { - __slist_splice_after(__pos._M_node, - __prev._M_node, __prev._M_node->_M_next); - } - - - // Linear in distance(begin(), __pos), and linear in __x.size(). - void splice(iterator __pos, slist& __x) { - if (__x._M_head._M_next) - __slist_splice_after(__slist_previous(&_M_head, __pos._M_node), - &__x._M_head, __slist_previous(&__x._M_head, 0)); - } - - // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i). - void splice(iterator __pos, slist& __x, iterator __i) { - __slist_splice_after(__slist_previous(&_M_head, __pos._M_node), - __slist_previous(&__x._M_head, __i._M_node), - __i._M_node); - } - - // Linear in distance(begin(), __pos), in distance(__x.begin(), __first), - // and in distance(__first, __last). - void splice(iterator __pos, slist& __x, iterator __first, iterator __last) - { - if (__first != __last) - __slist_splice_after(__slist_previous(&_M_head, __pos._M_node), - __slist_previous(&__x._M_head, __first._M_node), - __slist_previous(__first._M_node, __last._M_node)); - } - -public: - void reverse() { - if (_M_head._M_next) - _M_head._M_next = __slist_reverse(_M_head._M_next); - } - - void remove(const _Tp& __val); - void unique(); - void merge(slist& __x); - void sort(); - -#ifdef __STL_MEMBER_TEMPLATES - template - void remove_if(_Predicate __pred); - - template - void unique(_BinaryPredicate __pred); - - template - void merge(slist&, _StrictWeakOrdering); - - template - void sort(_StrictWeakOrdering __comp); -#endif /* __STL_MEMBER_TEMPLATES */ -}; - -template -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 -void slist<_Tp, _Alloc>::assign(size_type __n, const _Tp& __val) { - _Node_base* __prev = &_M_head; - _Node* __node = (_Node*) _M_head._M_next; - for ( ; __node != 0 && __n > 0 ; --__n) { - __node->_M_data = __val; - __prev = __node; - __node = (_Node*) __node->_M_next; - } - if (__n > 0) - _M_insert_after_fill(__prev, __n, __val); - else - _M_erase_after(__prev, 0); -} - -#ifdef __STL_MEMBER_TEMPLATES - -template template -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 -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 -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 -inline void swap(slist<_Tp,_Alloc>& __x, slist<_Tp,_Alloc>& __y) { - __x.swap(__y); -} - -#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ - - -template -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 -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 -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 -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 -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 -template -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 template -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 template -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 template -void slist<_Tp,_Alloc>::sort(_StrictWeakOrdering __comp) -{ - if (_M_head._M_next && _M_head._M_next->_M_next) { - slist __carry; - slist __counter[64]; - int __fill = 0; - while (!empty()) { - __slist_splice_after(&__carry._M_head, &_M_head, _M_head._M_next); - int __i = 0; - while (__i < __fill && !__counter[__i].empty()) { - __counter[__i].merge(__carry, __comp); - __carry.swap(__counter[__i]); - ++__i; - } - __carry.swap(__counter[__i]); - if (__i == __fill) - ++__fill; - } - - for (int __i = 1; __i < __fill; ++__i) - __counter[__i].merge(__counter[__i-1], __comp); - this->swap(__counter[__fill-1]); - } -} - -#endif /* __STL_MEMBER_TEMPLATES */ - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#pragma reset woff 1375 -#endif - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_SLIST_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_stack.h b/contrib/libstdc++/stl/stl_stack.h deleted file mode 100644 index 2a04b21e50..0000000000 --- a/contrib/libstdc++/stl/stl_stack.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_STACK_H -#define __SGI_STL_INTERNAL_STACK_H - -__STL_BEGIN_NAMESPACE - -#ifndef __STL_LIMITED_DEFAULT_TEMPLATES -template > -#else -template -#endif -class stack { - friend bool operator== __STL_NULL_TMPL_ARGS (const stack&, const stack&); - friend bool operator< __STL_NULL_TMPL_ARGS (const stack&, const stack&); -public: - typedef typename _Sequence::value_type value_type; - typedef typename _Sequence::size_type size_type; - typedef _Sequence container_type; - - typedef typename _Sequence::reference reference; - typedef typename _Sequence::const_reference const_reference; -protected: - _Sequence _M_c; -public: - stack() : _M_c() {} - explicit stack(const _Sequence& __s) : _M_c(__s) {} - - bool empty() const { return _M_c.empty(); } - size_type size() const { return _M_c.size(); } - reference top() { return _M_c.back(); } - const_reference top() const { return _M_c.back(); } - void push(const value_type& __x) { _M_c.push_back(__x); } - void pop() { _M_c.pop_back(); } -}; - -template -bool operator==(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) -{ - return __x._M_c == __y._M_c; -} - -template -bool operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) -{ - return __x._M_c < __y._M_c; -} - -#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER - -template -bool operator!=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) -{ - return !(__x == __y); -} - -template -bool operator>(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) -{ - return __y < __x; -} - -template -bool operator<=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) -{ - return !(__y < __x); -} - -template -bool operator>=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) -{ - return !(__x < __y); -} - -#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_STACK_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_tempbuf.h b/contrib/libstdc++/stl/stl_tempbuf.h deleted file mode 100644 index e1b2eadafc..0000000000 --- a/contrib/libstdc++/stl/stl_tempbuf.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_TEMPBUF_H -#define __SGI_STL_INTERNAL_TEMPBUF_H - - -__STL_BEGIN_NAMESPACE - -template -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 -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 -inline pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __len, _Tp*) { - return __get_temporary_buffer(__len, (_Tp*) 0); -} - -template -void return_temporary_buffer(_Tp* __p) { - free(__p); -} - -template -class _Temporary_buffer { -private: - ptrdiff_t _M_original_len; - ptrdiff_t _M_len; - _Tp* _M_buffer; - - void _M_allocate_buffer() { - _M_original_len = _M_len; - _M_buffer = 0; - - if (_M_len > (ptrdiff_t)(INT_MAX / sizeof(_Tp))) - _M_len = INT_MAX / sizeof(_Tp); - - while (_M_len > 0) { - _M_buffer = (_Tp*) malloc(_M_len * sizeof(_Tp)); - if (_M_buffer) - break; - _M_len /= 2; - } - } - - void _M_initialize_buffer(const _Tp&, __true_type) {} - void _M_initialize_buffer(const _Tp& val, __false_type) { - uninitialized_fill_n(_M_buffer, _M_len, val); - } - -public: - ptrdiff_t size() const { return _M_len; } - ptrdiff_t requested_size() const { return _M_original_len; } - _Tp* begin() { return _M_buffer; } - _Tp* end() { return _M_buffer + _M_len; } - - _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) { - typedef typename __type_traits<_Tp>::has_trivial_default_constructor - _Trivial; - __STL_TRY { - _M_len = 0; - distance(__first, __last, _M_len); - _M_allocate_buffer(); - if (_M_len > 0) - _M_initialize_buffer(*__first, _Trivial()); - } - __STL_UNWIND(free(_M_buffer); _M_buffer = 0; _M_len = 0); - } - - ~_Temporary_buffer() { - destroy(_M_buffer, _M_buffer + _M_len); - free(_M_buffer); - } - -private: - // Disable copy constructor and assignment operator. - _Temporary_buffer(const _Temporary_buffer&) {} - void operator=(const _Temporary_buffer&) {} -}; - -// Class temporary_buffer is not part of the standard. It is an extension. - -template ::value_type -#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - > -struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp> -{ - temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) - : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) {} - ~temporary_buffer() {} -}; - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_TEMPBUF_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_tree.h b/contrib/libstdc++/stl/stl_tree.h deleted file mode 100644 index c82943f568..0000000000 --- a/contrib/libstdc++/stl/stl_tree.h +++ /dev/null @@ -1,1333 +0,0 @@ -/* - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_TREE_H -#define __SGI_STL_INTERNAL_TREE_H - -/* - -Red-black tree class, designed for use in implementing STL -associative containers (set, multiset, map, and multimap). The -insertion and deletion algorithms are based on those in Cormen, -Leiserson, and Rivest, Introduction to Algorithms (MIT Press, 1990), -except that - -(1) the header cell is maintained with links not only to the root -but also to the leftmost node of the tree, to enable constant time -begin(), and to the rightmost node of the tree, to enable linear time -performance when used with the generic set algorithms (set_union, -etc.); - -(2) when a node being deleted has two children its successor node is -relinked into its place, rather than copied, so that the only -iterators invalidated are those referring to the deleted node. - -*/ - -#include -#include -#include -#include - -__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 -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 -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 -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 _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 _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 -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 -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 _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 iterator; - typedef _Rb_tree_iterator - const_iterator; - -#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION - typedef reverse_iterator const_reverse_iterator; - typedef reverse_iterator reverse_iterator; -#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - typedef reverse_bidirectional_iterator - reverse_iterator; - typedef reverse_bidirectional_iterator - 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 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 - void insert_unique(_InputIterator __first, _InputIterator __last); - template - 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 equal_range(const key_type& __x); - pair equal_range(const key_type& __x) const; - -public: - // Debugging. - bool __rb_verify() const; -}; - -template -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 -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 -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 -_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 -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 -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 -pair::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(_M_insert(__x, __y, __v), true); - else - --__j; - if (_M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__v))) - return pair(_M_insert(__x, __y, __v), true); - return pair(__j, false); -} - - -template -typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator -_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc> - ::insert_unique(iterator __position, const _Val& __v) -{ - if (__position._M_node == _M_header->_M_left) { // begin() - if (size() > 0 && - _M_key_compare(_KeyOfValue()(__v), _S_key(__position._M_node))) - return _M_insert(__position._M_node, __position._M_node, __v); - // first argument just needs to be non-null - else - return insert_unique(__v).first; - } else if (__position._M_node == _M_header) { // end() - if (_M_key_compare(_S_key(_M_rightmost()), _KeyOfValue()(__v))) - return _M_insert(0, _M_rightmost(), __v); - else - return insert_unique(__v).first; - } else { - iterator __before = __position; - --__before; - if (_M_key_compare(_S_key(__before._M_node), _KeyOfValue()(__v)) - && _M_key_compare(_KeyOfValue()(__v), _S_key(__position._M_node))) { - if (_S_right(__before._M_node) == 0) - return _M_insert(0, __before._M_node, __v); - else - return _M_insert(__position._M_node, __position._M_node, __v); - // first argument just needs to be non-null - } else - return insert_unique(__v).first; - } -} - -template -typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator -_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc> - ::insert_equal(iterator __position, const _Val& __v) -{ - if (__position._M_node == _M_header->_M_left) { // begin() - if (size() > 0 && - _M_key_compare(_KeyOfValue()(__v), _S_key(__position._M_node))) - return _M_insert(__position._M_node, __position._M_node, __v); - // first argument just needs to be non-null - else - return insert_equal(__v); - } else if (__position._M_node == _M_header) {// end() - if (!_M_key_compare(_KeyOfValue()(__v), _S_key(_M_rightmost()))) - return _M_insert(0, _M_rightmost(), __v); - else - return insert_equal(__v); - } else { - iterator __before = __position; - --__before; - if (!_M_key_compare(_KeyOfValue()(__v), _S_key(__before._M_node)) - && !_M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__v))) { - if (_S_right(__before._M_node) == 0) - return _M_insert(0, __before._M_node, __v); - else - return _M_insert(__position._M_node, __position._M_node, __v); - // first argument just needs to be non-null - } else - return insert_equal(__v); - } -} - -#ifdef __STL_MEMBER_TEMPLATES - -template - template -void _Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc> - ::insert_equal(_II __first, _II __last) -{ - for ( ; __first != __last; ++__first) - insert_equal(*__first); -} - -template - template -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 -void -_Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc> - ::insert_equal(const _Val* __first, const _Val* __last) -{ - for ( ; __first != __last; ++__first) - insert_equal(*__first); -} - -template -void -_Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc> - ::insert_equal(const_iterator __first, const_iterator __last) -{ - for ( ; __first != __last; ++__first) - insert_equal(*__first); -} - -template -void -_Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc> - ::insert_unique(const _Val* __first, const _Val* __last) -{ - for ( ; __first != __last; ++__first) - insert_unique(*__first); -} - -template -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 -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 -typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::size_type -_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::erase(const _Key& __x) -{ - pair __p = equal_range(__x); - size_type __n = 0; - distance(__p.first, __p.second, __n); - erase(__p.first, __p.second); - return __n; -} - -template -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 -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 -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 -void _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> - ::erase(const _Key* __first, const _Key* __last) -{ - while (__first != __last) erase(*__first++); -} - -template -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 -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 -typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::size_type -_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> - ::count(const _Key& __k) const -{ - pair __p = equal_range(__k); - size_type __n = 0; - distance(__p.first, __p.second, __n); - return __n; -} - -template -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 -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 -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 -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 -inline -pair::iterator, - typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator> -_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> - ::equal_range(const _Key& __k) -{ - return pair(lower_bound(__k), upper_bound(__k)); -} - -template -inline -pair::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(lower_bound(__k), - upper_bound(__k)); -} - -inline int -__black_count(_Rb_tree_node_base* __node, _Rb_tree_node_base* __root) -{ - if (__node == 0) - return 0; - else { - int __bc = __node->_M_color == _S_rb_tree_black ? 1 : 0; - if (__node == __root) - return __bc; - else - return __bc + __black_count(__node->_M_parent, __root); - } -} - -template -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 -struct rb_tree : public _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> -{ - typedef _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> _Base; - typedef typename _Base::allocator_type allocator_type; - - rb_tree(const _Compare& __comp = _Compare(), - const allocator_type& __a = allocator_type()) - : _Base(__comp, __a) {} - - ~rb_tree() {} -}; - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1375 -#endif - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_TREE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_uninitialized.h b/contrib/libstdc++/stl/stl_uninitialized.h deleted file mode 100644 index 3146c82a71..0000000000 --- a/contrib/libstdc++/stl/stl_uninitialized.h +++ /dev/null @@ -1,279 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_UNINITIALIZED_H -#define __SGI_STL_INTERNAL_UNINITIALIZED_H - -__STL_BEGIN_NAMESPACE - -// uninitialized_copy - -// Valid if copy construction is equivalent to assignment, and if the -// destructor is trivial. -template -inline _ForwardIter -__uninitialized_copy_aux(_InputIter __first, _InputIter __last, - _ForwardIter __result, - __true_type) -{ - return copy(__first, __last, __result); -} - -template -_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 -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 -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 -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 -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 -inline pair<_InputIter, _ForwardIter> -__uninitialized_copy_n(_InputIter __first, _Size __count, - _ForwardIter __result) { - return __uninitialized_copy_n(__first, __count, __result, - __ITERATOR_CATEGORY(__first)); -} - -template -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 -inline void -__uninitialized_fill_aux(_ForwardIter __first, _ForwardIter __last, - const _Tp& __x, __true_type) -{ - fill(__first, __last, __x); -} - -template -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 -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 -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 -inline _ForwardIter -__uninitialized_fill_n_aux(_ForwardIter __first, _Size __n, - const _Tp& __x, __true_type) -{ - return fill_n(__first, __n, __x); -} - -template -_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 -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 -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 -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 -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 -inline void -__uninitialized_copy_fill(_InputIter __first1, _InputIter __last1, - _ForwardIter __first2, _ForwardIter __last2, - const _Tp& __x) -{ - _ForwardIter __mid2 = uninitialized_copy(__first1, __last1, __first2); - __STL_TRY { - uninitialized_fill(__mid2, __last2, __x); - } - __STL_UNWIND(destroy(__first2, __mid2)); -} - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_UNINITIALIZED_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/stl_vector.h b/contrib/libstdc++/stl/stl_vector.h deleted file mode 100644 index d1149e9af6..0000000000 --- a/contrib/libstdc++/stl/stl_vector.h +++ /dev/null @@ -1,823 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef __SGI_STL_INTERNAL_VECTOR_H -#define __SGI_STL_INTERNAL_VECTOR_H - -__STL_BEGIN_NAMESPACE - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1174 -#pragma set woff 1375 -#endif - -// The vector base class serves two purposes. First, its constructor -// and destructor allocate (but don't initialize) storage. This makes -// exception safety easier. Second, the base class encapsulates all of -// the differences between SGI-style allocators and standard-conforming -// allocators. - -#ifdef __STL_USE_STD_ALLOCATORS - -// Base class for ordinary allocators. -template -class _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 _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 -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 _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 vector : protected _Vector_base<_Tp, _Alloc> -{ -private: - typedef _Vector_base<_Tp, _Alloc> _Base; -public: - typedef _Tp value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type* iterator; - typedef const value_type* const_iterator; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - - typedef typename _Base::allocator_type allocator_type; - allocator_type get_allocator() const { return _Base::get_allocator(); } - -#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION - typedef reverse_iterator const_reverse_iterator; - typedef reverse_iterator reverse_iterator; -#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - typedef reverse_iterator const_reverse_iterator; - typedef reverse_iterator - reverse_iterator; -#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - -protected: -#ifdef __STL_HAS_NAMESPACES - using _Base::_M_allocate; - using _Base::_M_deallocate; - using _Base::_M_start; - using _Base::_M_finish; - using _Base::_M_end_of_storage; -#endif /* __STL_HAS_NAMESPACES */ - -protected: - void _M_insert_aux(iterator __position, const _Tp& __x); - void _M_insert_aux(iterator __position); - -public: - iterator begin() { return _M_start; } - const_iterator begin() const { return _M_start; } - iterator end() { return _M_finish; } - const_iterator end() const { return _M_finish; } - - reverse_iterator rbegin() - { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const - { return const_reverse_iterator(end()); } - reverse_iterator rend() - { return reverse_iterator(begin()); } - const_reverse_iterator rend() const - { return const_reverse_iterator(begin()); } - - size_type size() const - { return size_type(end() - begin()); } - size_type max_size() const - { return size_type(-1) / sizeof(_Tp); } - size_type capacity() const - { return size_type(_M_end_of_storage - begin()); } - bool empty() const - { return begin() == end(); } - - reference operator[](size_type __n) { return *(begin() + __n); } - const_reference operator[](size_type __n) const { return *(begin() + __n); } - - explicit vector(const allocator_type& __a = allocator_type()) - : _Base(__a) {} - - vector(size_type __n, const _Tp& __value, - const allocator_type& __a = allocator_type()) - : _Base(__n, __a) - { _M_finish = uninitialized_fill_n(_M_start, __n, __value); } - - explicit vector(size_type __n) - : _Base(__n, allocator_type()) - { _M_finish = uninitialized_fill_n(_M_start, __n, _Tp()); } - - vector(const vector<_Tp, _Alloc>& __x) - : _Base(__x.size(), __x.get_allocator()) - { _M_finish = uninitialized_copy(__x.begin(), __x.end(), _M_start); } - -#ifdef __STL_MEMBER_TEMPLATES - // Check whether it's an integral type. If so, it's not an iterator. - template - 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 - 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 - void _M_initialize_aux(_InputIterator __first, _InputIterator __last, - __false_type) { - _M_range_initialize(__first, __last, __ITERATOR_CATEGORY(__first)); - } - -#else - vector(const _Tp* __first, const _Tp* __last, - const allocator_type& __a = allocator_type()) - : _Base(__last - __first, __a) - { _M_finish = uninitialized_copy(__first, __last, _M_start); } -#endif /* __STL_MEMBER_TEMPLATES */ - - ~vector() { destroy(_M_start, _M_finish); } - - vector<_Tp, _Alloc>& operator=(const vector<_Tp, _Alloc>& __x); - void reserve(size_type __n) { - if (capacity() < __n) { - const size_type __old_size = size(); - iterator __tmp = _M_allocate_and_copy(__n, _M_start, _M_finish); - destroy(_M_start, _M_finish); - _M_deallocate(_M_start, _M_end_of_storage - _M_start); - _M_start = __tmp; - _M_finish = __tmp + __old_size; - _M_end_of_storage = _M_start + __n; - } - } - - // assign(), a generalized assignment member function. Two - // versions: one that takes a count, and one that takes a range. - // The range version is a member template, so we dispatch on whether - // or not the type is an integer. - - void assign(size_type __n, const _Tp& __val); - -#ifdef __STL_MEMBER_TEMPLATES - - template - void assign(_InputIterator __first, _InputIterator __last) { - typedef typename _Is_integer<_InputIterator>::_Integral _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - } - - template - void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) - { assign((size_type) __n, (_Tp) __val); } - - template - void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type) - { _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); } - - template - void _M_assign_aux(_InputIterator __first, _InputIterator __last, - input_iterator_tag); - - template - void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, - forward_iterator_tag); - -#endif /* __STL_MEMBER_TEMPLATES */ - - reference front() { return *begin(); } - const_reference front() const { return *begin(); } - reference back() { return *(end() - 1); } - const_reference back() const { return *(end() - 1); } - - void push_back(const _Tp& __x) { - if (_M_finish != _M_end_of_storage) { - construct(_M_finish, __x); - ++_M_finish; - } - else - _M_insert_aux(end(), __x); - } - void push_back() { - if (_M_finish != _M_end_of_storage) { - construct(_M_finish); - ++_M_finish; - } - else - _M_insert_aux(end()); - } - void swap(vector<_Tp, _Alloc>& __x) { - __STD::swap(_M_start, __x._M_start); - __STD::swap(_M_finish, __x._M_finish); - __STD::swap(_M_end_of_storage, __x._M_end_of_storage); - } - - iterator insert(iterator __position, const _Tp& __x) { - size_type __n = __position - begin(); - if (_M_finish != _M_end_of_storage && __position == end()) { - construct(_M_finish, __x); - ++_M_finish; - } - else - _M_insert_aux(__position, __x); - return begin() + __n; - } - iterator insert(iterator __position) { - size_type __n = __position - begin(); - if (_M_finish != _M_end_of_storage && __position == end()) { - construct(_M_finish); - ++_M_finish; - } - else - _M_insert_aux(__position); - return begin() + __n; - } -#ifdef __STL_MEMBER_TEMPLATES - // Check whether it's an integral type. If so, it's not an iterator. - template - void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { - typedef typename _Is_integer<_InputIterator>::_Integral _Integral; - _M_insert_dispatch(__pos, __first, __last, _Integral()); - } - - template - void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, - __true_type) { - insert(__pos, (size_type) __n, (_Tp) __val); - } - - template - void _M_insert_dispatch(iterator __pos, - _InputIterator __first, _InputIterator __last, - __false_type) { - _M_range_insert(__pos, __first, __last, __ITERATOR_CATEGORY(__first)); - } -#else /* __STL_MEMBER_TEMPLATES */ - void insert(iterator __position, - const_iterator __first, const_iterator __last); -#endif /* __STL_MEMBER_TEMPLATES */ - - void insert (iterator __pos, size_type __n, const _Tp& __x); - - void pop_back() { - --_M_finish; - destroy(_M_finish); - } - iterator erase(iterator __position) { - if (__position + 1 != end()) - copy(__position + 1, _M_finish, __position); - --_M_finish; - destroy(_M_finish); - return __position; - } - iterator erase(iterator __first, iterator __last) { - iterator __i = copy(__last, _M_finish, __first); - destroy(__i, _M_finish); - _M_finish = _M_finish - (__last - __first); - return __first; - } - - void resize(size_type __new_size, const _Tp& __x) { - if (__new_size < size()) - erase(begin() + __new_size, end()); - else - insert(end(), __new_size - size(), __x); - } - void resize(size_type __new_size) { resize(__new_size, _Tp()); } - void clear() { erase(begin(), end()); } - -protected: - -#ifdef __STL_MEMBER_TEMPLATES - template - iterator _M_allocate_and_copy(size_type __n, _ForwardIterator __first, - _ForwardIterator __last) -{ - iterator __result = _M_allocate(__n); - __STL_TRY { - uninitialized_copy(__first, __last, __result); - return __result; - } - __STL_UNWIND(_M_deallocate(__result, __n)); - } -#else /* __STL_MEMBER_TEMPLATES */ - iterator _M_allocate_and_copy(size_type __n, const_iterator __first, - const_iterator __last) - { - iterator __result = _M_allocate(__n); - __STL_TRY { - uninitialized_copy(__first, __last, __result); - return __result; - } - __STL_UNWIND(_M_deallocate(__result, __n)); - } -#endif /* __STL_MEMBER_TEMPLATES */ - - -#ifdef __STL_MEMBER_TEMPLATES - template - 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 - 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 - void _M_range_insert(iterator __pos, - _InputIterator __first, _InputIterator __last, - input_iterator_tag); - - template - void _M_range_insert(iterator __pos, - _ForwardIterator __first, _ForwardIterator __last, - forward_iterator_tag); - -#endif /* __STL_MEMBER_TEMPLATES */ -}; - -template -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 -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 -inline void swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y) -{ - __x.swap(__y); -} - -#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ - -template -vector<_Tp,_Alloc>& -vector<_Tp,_Alloc>::operator=(const vector<_Tp, _Alloc>& __x) -{ - if (&__x != this) { - const size_type __xlen = __x.size(); - if (__xlen > capacity()) { - iterator __tmp = _M_allocate_and_copy(__xlen, __x.begin(), __x.end()); - destroy(_M_start, _M_finish); - _M_deallocate(_M_start, _M_end_of_storage - _M_start); - _M_start = __tmp; - _M_end_of_storage = _M_start + __xlen; - } - else if (size() >= __xlen) { - iterator __i = copy(__x.begin(), __x.end(), begin()); - destroy(__i, _M_finish); - } - else { - copy(__x.begin(), __x.begin() + size(), _M_start); - uninitialized_copy(__x.begin() + size(), __x.end(), _M_finish); - } - _M_finish = _M_start + __xlen; - } - return *this; -} - -template -void vector<_Tp, _Alloc>::assign(size_t __n, const value_type& __val) { - if (__n > capacity()) { - vector<_Tp, _Alloc> __tmp(__n, __val, get_allocator()); - __tmp.swap(*this); - } - else if (__n > size()) { - fill(begin(), end(), __val); - _M_finish = uninitialized_fill_n(_M_finish, __n - size(), __val); - } - else - erase(fill_n(begin(), __n, __val), end()); -} - -#ifdef __STL_MEMBER_TEMPLATES - -template template -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 template -void -vector<_Tp, _Alloc>::_M_assign_aux(_ForwardIter __first, _ForwardIter __last, - forward_iterator_tag) { - size_type __len = 0; - distance(__first, __last, __len); - - if (__len > capacity()) { - iterator __tmp = _M_allocate_and_copy(__len, __first, __last); - destroy(_M_start, _M_finish); - _M_deallocate(_M_start, _M_end_of_storage - _M_start); - _M_start = __tmp; - _M_end_of_storage = _M_finish = _M_start + __len; - } - else if (size() >= __len) { - iterator __new_finish = copy(__first, __last, _M_start); - destroy(__new_finish, _M_finish); - _M_finish = __new_finish; - } - else { - _ForwardIter __mid = __first; - advance(__mid, size()); - copy(__first, __mid, _M_start); - _M_finish = uninitialized_copy(__mid, __last, _M_finish); - } -} - -#endif /* __STL_MEMBER_TEMPLATES */ - -template -void -vector<_Tp, _Alloc>::_M_insert_aux(iterator __position, const _Tp& __x) -{ - if (_M_finish != _M_end_of_storage) { - construct(_M_finish, *(_M_finish - 1)); - ++_M_finish; - _Tp __x_copy = __x; - copy_backward(__position, _M_finish - 2, _M_finish - 1); - *__position = __x_copy; - } - else { - const size_type __old_size = size(); - const size_type __len = __old_size != 0 ? 2 * __old_size : 1; - iterator __new_start = _M_allocate(__len); - iterator __new_finish = __new_start; - __STL_TRY { - __new_finish = uninitialized_copy(_M_start, __position, __new_start); - construct(__new_finish, __x); - ++__new_finish; - __new_finish = uninitialized_copy(__position, _M_finish, __new_finish); - } - __STL_UNWIND((destroy(__new_start,__new_finish), - _M_deallocate(__new_start,__len))); - destroy(begin(), end()); - _M_deallocate(_M_start, _M_end_of_storage - _M_start); - _M_start = __new_start; - _M_finish = __new_finish; - _M_end_of_storage = __new_start + __len; - } -} - -template -void -vector<_Tp, _Alloc>::_M_insert_aux(iterator __position) -{ - if (_M_finish != _M_end_of_storage) { - construct(_M_finish, *(_M_finish - 1)); - ++_M_finish; - copy_backward(__position, _M_finish - 2, _M_finish - 1); - *__position = _Tp(); - } - else { - const size_type __old_size = size(); - const size_type __len = __old_size != 0 ? 2 * __old_size : 1; - iterator __new_start = _M_allocate(__len); - iterator __new_finish = __new_start; - __STL_TRY { - __new_finish = uninitialized_copy(_M_start, __position, __new_start); - construct(__new_finish); - ++__new_finish; - __new_finish = uninitialized_copy(__position, _M_finish, __new_finish); - } - __STL_UNWIND((destroy(__new_start,__new_finish), - _M_deallocate(__new_start,__len))); - destroy(begin(), end()); - _M_deallocate(_M_start, _M_end_of_storage - _M_start); - _M_start = __new_start; - _M_finish = __new_finish; - _M_end_of_storage = __new_start + __len; - } -} - -template -void vector<_Tp, _Alloc>::insert(iterator __position, size_type __n, - const _Tp& __x) -{ - if (__n != 0) { - if (size_type(_M_end_of_storage - _M_finish) >= __n) { - _Tp __x_copy = __x; - const size_type __elems_after = _M_finish - __position; - iterator __old_finish = _M_finish; - if (__elems_after > __n) { - uninitialized_copy(_M_finish - __n, _M_finish, _M_finish); - _M_finish += __n; - copy_backward(__position, __old_finish - __n, __old_finish); - fill(__position, __position + __n, __x_copy); - } - else { - uninitialized_fill_n(_M_finish, __n - __elems_after, __x_copy); - _M_finish += __n - __elems_after; - uninitialized_copy(__position, __old_finish, _M_finish); - _M_finish += __elems_after; - fill(__position, __old_finish, __x_copy); - } - } - else { - const size_type __old_size = size(); - const size_type __len = __old_size + max(__old_size, __n); - iterator __new_start = _M_allocate(__len); - iterator __new_finish = __new_start; - __STL_TRY { - __new_finish = uninitialized_copy(_M_start, __position, __new_start); - __new_finish = uninitialized_fill_n(__new_finish, __n, __x); - __new_finish - = uninitialized_copy(__position, _M_finish, __new_finish); - } - __STL_UNWIND((destroy(__new_start,__new_finish), - _M_deallocate(__new_start,__len))); - destroy(_M_start, _M_finish); - _M_deallocate(_M_start, _M_end_of_storage - _M_start); - _M_start = __new_start; - _M_finish = __new_finish; - _M_end_of_storage = __new_start + __len; - } - } -} - -#ifdef __STL_MEMBER_TEMPLATES - -template template -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 template -void -vector<_Tp, _Alloc>::_M_range_insert(iterator __position, - _ForwardIterator __first, - _ForwardIterator __last, - forward_iterator_tag) -{ - if (__first != __last) { - size_type __n = 0; - distance(__first, __last, __n); - if (size_type(_M_end_of_storage - _M_finish) >= __n) { - const size_type __elems_after = _M_finish - __position; - iterator __old_finish = _M_finish; - if (__elems_after > __n) { - uninitialized_copy(_M_finish - __n, _M_finish, _M_finish); - _M_finish += __n; - copy_backward(__position, __old_finish - __n, __old_finish); - copy(__first, __last, __position); - } - else { - _ForwardIterator __mid = __first; - advance(__mid, __elems_after); - uninitialized_copy(__mid, __last, _M_finish); - _M_finish += __n - __elems_after; - uninitialized_copy(__position, __old_finish, _M_finish); - _M_finish += __elems_after; - copy(__first, __mid, __position); - } - } - else { - const size_type __old_size = size(); - const size_type __len = __old_size + max(__old_size, __n); - iterator __new_start = _M_allocate(__len); - iterator __new_finish = __new_start; - __STL_TRY { - __new_finish = uninitialized_copy(_M_start, __position, __new_start); - __new_finish = uninitialized_copy(__first, __last, __new_finish); - __new_finish - = uninitialized_copy(__position, _M_finish, __new_finish); - } - __STL_UNWIND((destroy(__new_start,__new_finish), - _M_deallocate(__new_start,__len))); - destroy(_M_start, _M_finish); - _M_deallocate(_M_start, _M_end_of_storage - _M_start); - _M_start = __new_start; - _M_finish = __new_finish; - _M_end_of_storage = __new_start + __len; - } - } -} - -#else /* __STL_MEMBER_TEMPLATES */ - -template -void -vector<_Tp, _Alloc>::insert(iterator __position, - const_iterator __first, - const_iterator __last) -{ - if (__first != __last) { - size_type __n = 0; - distance(__first, __last, __n); - if (size_type(_M_end_of_storage - _M_finish) >= __n) { - const size_type __elems_after = _M_finish - __position; - iterator __old_finish = _M_finish; - if (__elems_after > __n) { - uninitialized_copy(_M_finish - __n, _M_finish, _M_finish); - _M_finish += __n; - copy_backward(__position, __old_finish - __n, __old_finish); - copy(__first, __last, __position); - } - else { - uninitialized_copy(__first + __elems_after, __last, _M_finish); - _M_finish += __n - __elems_after; - uninitialized_copy(__position, __old_finish, _M_finish); - _M_finish += __elems_after; - copy(__first, __first + __elems_after, __position); - } - } - else { - const size_type __old_size = size(); - const size_type __len = __old_size + max(__old_size, __n); - iterator __new_start = _M_allocate(__len); - iterator __new_finish = __new_start; - __STL_TRY { - __new_finish = uninitialized_copy(_M_start, __position, __new_start); - __new_finish = uninitialized_copy(__first, __last, __new_finish); - __new_finish - = uninitialized_copy(__position, _M_finish, __new_finish); - } - __STL_UNWIND((destroy(__new_start,__new_finish), - _M_deallocate(__new_start,__len))); - destroy(_M_start, _M_finish); - _M_deallocate(_M_start, _M_end_of_storage - _M_start); - _M_start = __new_start; - _M_finish = __new_finish; - _M_end_of_storage = __new_start + __len; - } - } -} - -#endif /* __STL_MEMBER_TEMPLATES */ - -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#pragma reset woff 1375 -#endif - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_INTERNAL_VECTOR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/tempbuf.h b/contrib/libstdc++/stl/tempbuf.h deleted file mode 100644 index aa4f289c58..0000000000 --- a/contrib/libstdc++/stl/tempbuf.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_TEMPBUF_H -#define __SGI_STL_TEMPBUF_H - -#ifndef __SGI_STL_PAIR_H -#include -#endif -#include /* XXX should use */ -#include /* XXX should use */ -#include /* XXX should use */ -#ifndef __TYPE_TRAITS_H -#include -#endif -#ifndef __SGI_STL_INTERNAL_CONSTRUCT_H -#include -#endif -#ifndef __SGI_STL_INTERNAL_UNINITIALIZED_H -#include -#endif -#ifndef __SGI_STL_INTERNAL_TEMPBUF_H -#include -#endif - -#ifdef __STL_USE_NAMESPACES - -using __STD::get_temporary_buffer; -using __STD::return_temporary_buffer; -using __STD::temporary_buffer; - -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_TEMPBUF_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/tree.h b/contrib/libstdc++/stl/tree.h deleted file mode 100644 index 77c57cbbba..0000000000 --- a/contrib/libstdc++/stl/tree.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - */ - -#ifndef __SGI_STL_TREE_H -#define __SGI_STL_TREE_H - -#ifndef __SGI_STL_INTERNAL_TREE_H -#include -#endif -#include -#include - -#ifdef __STL_USE_NAMESPACES -using __STD::rb_tree; -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_TREE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/type_traits.h b/contrib/libstdc++/stl/type_traits.h deleted file mode 100644 index b6a7dfc6de..0000000000 --- a/contrib/libstdc++/stl/type_traits.h +++ /dev/null @@ -1,373 +0,0 @@ -/* - * - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __TYPE_TRAITS_H -#define __TYPE_TRAITS_H - -#ifndef __STL_CONFIG_H -#include -#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 void copy(T* source, T* destination, int n, __false_type); -//Copy an array of elements which have trivial copy constructors. Use memcpy. -template void copy(T* source, T* destination, int n, __true_type); - -//Copy an array of any type by using the most efficient copy mechanism -template inline void copy(T* source,T* destination,int n) { - copy(source, destination, n, - typename __type_traits::has_trivial_copy_constructor()); -} -*/ - - -struct __true_type { -}; - -struct __false_type { -}; - -template -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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 -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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 struct _Is_integer { - typedef __false_type _Integral; -}; - -#ifndef __STL_NO_BOOL - -__STL_TEMPLATE_NULL struct _Is_integer { - typedef __true_type _Integral; -}; - -#endif /* __STL_NO_BOOL */ - -__STL_TEMPLATE_NULL struct _Is_integer { - typedef __true_type _Integral; -}; - -__STL_TEMPLATE_NULL struct _Is_integer { - typedef __true_type _Integral; -}; - -__STL_TEMPLATE_NULL struct _Is_integer { - typedef __true_type _Integral; -}; - -#ifdef __STL_HAS_WCHAR_T - -__STL_TEMPLATE_NULL struct _Is_integer { - typedef __true_type _Integral; -}; - -#endif /* __STL_HAS_WCHAR_T */ - -__STL_TEMPLATE_NULL struct _Is_integer { - typedef __true_type _Integral; -}; - -__STL_TEMPLATE_NULL struct _Is_integer { - typedef __true_type _Integral; -}; - -__STL_TEMPLATE_NULL struct _Is_integer { - typedef __true_type _Integral; -}; - -__STL_TEMPLATE_NULL struct _Is_integer { - typedef __true_type _Integral; -}; - -__STL_TEMPLATE_NULL struct _Is_integer { - typedef __true_type _Integral; -}; - -__STL_TEMPLATE_NULL struct _Is_integer { - typedef __true_type _Integral; -}; - -#ifdef __STL_LONG_LONG - -__STL_TEMPLATE_NULL struct _Is_integer { - typedef __true_type _Integral; -}; - -__STL_TEMPLATE_NULL struct _Is_integer { - typedef __true_type _Integral; -}; - -#endif /* __STL_LONG_LONG */ - -#endif /* __TYPE_TRAITS_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/utility b/contrib/libstdc++/stl/utility deleted file mode 100644 index df8c224388..0000000000 --- a/contrib/libstdc++/stl/utility +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_UTILITY -#define __SGI_STL_UTILITY - -#include -#include -#include - -#endif /* __SGI_STL_UTILITY */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/vector b/contrib/libstdc++/stl/vector deleted file mode 100644 index 4bcdebcc18..0000000000 --- a/contrib/libstdc++/stl/vector +++ /dev/null @@ -1,41 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_VECTOR -#define __SGI_STL_VECTOR - -#include -#include -#include -#include -#include -#include - -#endif /* __SGI_STL_VECTOR */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stl/vector.h b/contrib/libstdc++/stl/vector.h deleted file mode 100644 index 231a227b7e..0000000000 --- a/contrib/libstdc++/stl/vector.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_VECTOR_H -#define __SGI_STL_VECTOR_H - -#include -#include -#include - -#ifdef __STL_USE_NAMESPACES -using __STD::vector; -#endif /* __STL_USE_NAMESPACES */ - -#endif /* __SGI_STL_VECTOR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/stlinst.cc b/contrib/libstdc++/stlinst.cc deleted file mode 100644 index 2a221fbaee..0000000000 --- a/contrib/libstdc++/stlinst.cc +++ /dev/null @@ -1,10 +0,0 @@ -// Instantiation file for the -*- C++ -*- Standard Library allocator templates -// This file is part of the GNU ANSI C++ Library. - -#include - -#ifndef __USE_MALLOC -template class __default_alloc_template<__NODE_ALLOCATOR_THREADS, 0>; -#endif - -template class __malloc_alloc_template<0>; diff --git a/contrib/libstdc++/string b/contrib/libstdc++/string deleted file mode 100644 index fa6f1abaa7..0000000000 --- a/contrib/libstdc++/string +++ /dev/null @@ -1,13 +0,0 @@ -// Main header for the -*- C++ -*- string classes. - -#ifndef __STRING__ -#define __STRING__ - -#include - -extern "C++" { -typedef basic_string string; -// typedef basic_string wstring; -} // extern "C++" - -#endif diff --git a/contrib/libstdc++/strstream b/contrib/libstdc++/strstream deleted file mode 100644 index ee360e0b7e..0000000000 --- a/contrib/libstdc++/strstream +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __STRSTREAM__ -#define __STRSTREAM__ -#include -#endif diff --git a/contrib/libstdc++/tests/ChangeLog b/contrib/libstdc++/tests/ChangeLog deleted file mode 100644 index 3bcb473a62..0000000000 --- a/contrib/libstdc++/tests/ChangeLog +++ /dev/null @@ -1,132 +0,0 @@ -Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com) - - * gcc-2.95.3 Released. - -Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.2 Released. - -Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.1 Released. - -Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -1998-07-17 Jason Merrill - - * tmap.cc: Use less. - * tlist.cc (main): Use remove_if. - -1998-07-13 Manfred Hollstein - - * Makefile.in (VERSION): Bump to 2.9.0. - -1998-07-12 Bob Sidebotham - - * tstring.cc (findtest): New fn. - -1998-06-01 Jason Merrill - - * tlist.cc, tvector.cc, tmap.cc: Remove explicit instantiations. - -Fri Oct 10 00:40:31 1997 Jason Merrill - - * tstring.cc (identitytest): s/remove/erase/. - -Thu Sep 25 19:48:22 1997 Jason Merrill - - * tstring.cc: Add some tests for the member templates. - -Wed Jun 11 11:00:10 1997 Jason Merrill - - * tmap.cc: Explicitly instantiate allocator classes. - * tvector.cc, tlist.cc: Likewise. - -Fri May 16 18:38:05 1997 Bob Manson - - * tcomplex.cc (main): If we're using short doubles, compensate for - roundoff in result of pow(a,b). - -Thu May 1 17:37:53 1997 Jason Merrill - - * configure.in (CHECK): Add $(CXXFLAGS). - * Makefile.in (tcomplex): Add $(CXXFLAGS). - -Fri Apr 25 16:07:46 1997 Bob Manson - - * configure.in: Change "check" to "check-old". Add do-nothing - check target. - -Sun Nov 3 12:44:48 1996 Jason Merrill - - * tstring.cc: Treat string literals as const. - -Tue Sep 24 18:00:20 1996 Jason Merrill - - * tstring.cc, tcomplex.cc: Remove gratuitous uses of std/. - -Mon Jun 17 14:05:50 1996 Per Bothner - - * tlist.cc (test_splice): New test. - -Fri Mar 22 16:08:36 1996 Jason Merrill - - * Makefile.in (VERSION): 2.8.0. - - * tlist.cc, tmap.cc, tvector.cc: Remove explicit instantiation - directive. - -Sat Nov 18 19:52:26 1995 Mike Stump - - * Makefile.in: Update version to 2.7.1. - -Tue May 9 19:36:54 1995 Jason Merrill - - * tstring.cc (decltest): Adjust single-character test. - -Fri May 5 14:35:19 1995 Jason Merrill - - * tcomplex.*: Update to reflect that operator<< now - accepts more forms of input. - -Thu Apr 27 15:34:58 1995 Brendan Kehoe (brendan@lisa.cygnus.com) - - * configure.in: Update to stay in sync with config.shared. - -Thu Feb 16 00:08:28 1995 Jason Merrill - - * Makefile.in (VERSION, SHLIB): Define. - -Tue Jan 24 02:36:24 1995 Jason Merrill - - * Makefile.in (CXXFLAGS): Don't set. - -Mon Jan 23 04:12:10 1995 Jason Merrill - - * tlist.cc (plus): Remove. - -Thu Jan 19 19:41:07 1995 Jason Merrill - - * Makefile.in: Don't set LD_LIBRARY_PATH. Users will have to set - it themselves. - -Mon Jan 16 13:57:34 1995 Jason Merrill - - * Makefile.in: Update to reflect header movement. - -Wed Dec 14 19:55:45 1994 Per Bothner - - * configure.in: Fix quoting problem. Reported nu H.J.Lu. - -Tue Nov 29 16:46:56 1994 Per Bothner - - * Makefile.in, configure.in: Re-write to avoid duplication. - * {tvector,tmap,tlist}.{cc,exp}, configure.in: New tests for STL. - - diff --git a/contrib/libstdc++/tests/Makefile.in b/contrib/libstdc++/tests/Makefile.in deleted file mode 100644 index 057482f185..0000000000 --- a/contrib/libstdc++/tests/Makefile.in +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (C) 1994 Free Software Foundation - -# This file is part of the GNU ANSI C++ Library. This library is free -# software; you can redistribute it and/or modify it under the terms of -# the GNU General Public License as published by the Free Software -# Foundation; either version 2, or (at your option) any later version. - -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this library; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -VERSION = 2.9.0 -SHLIB = libstdc++.so.$(VERSION) - -DEPLIBS = ../libstdc++.a -LDLIBS = -L.. -lstdc++ -MDEPLIBS = $(DEPLIBS) -MLDLIBS = $(LDLIBS) -lm - -#### package, host, target, and site dependent Makefile fragments come in here. -## - -tcomplex.o: ${srcdir}/../std/complext.h ${srcdir}/../std/dcomplex.h -tcomplex: tcomplex.o $(MDEPLIBS) - $(CXX) $(CXXFLAGS) -o tcomplex tcomplex.o $(MLDLIBS) - -tstring.o: ${srcdir}/../std/bastring.h - -# NOTE: Rules for following tests are generated by $(srcdir)/configure.in !!! - diff --git a/contrib/libstdc++/tests/configure.in b/contrib/libstdc++/tests/configure.in deleted file mode 100644 index 06c56192be..0000000000 --- a/contrib/libstdc++/tests/configure.in +++ /dev/null @@ -1,65 +0,0 @@ -# This file is a shell script fragment that supplies the information -# necessary for a configure script to process the program in -# this directory. For more information, look at ../../configure. - -configdirs= -srctrigger=tcomplex.cc -srcname="tests for ANSI C++ library" -package_makefile_frag=Make.pack -package_makefile_rules_frag=Make.pack.r - -# per-host: - -# per-target: - -target_makefile_frag=../target-mkfrag - -TO_TOPDIR=../../ -ALL=' ' -XCXXINCLUDES="-I${srcdir}/.. -I${srcdir}/../stl -I${TO_TOPDIR}libio -I${srcdir}/${TO_TOPDIR}libio" -SIMPLE_TESTS='tstring tlist tmap tvector' -TESTS="tcomplex ${SIMPLE_TESTS}" -MOSTLYCLEAN="*.o core ${TESTS} *.out" -(. ${srcdir}/${TO_TOPDIR}libio/config.shared) >${package_makefile_frag} 2>${package_makefile_rules_frag} - -# post-target: - -CHECK="" - -for TEST in ${SIMPLE_TESTS} ; do - echo "${TEST}: ${TEST}.o" '$(DEPLIBS) - $(CXX) $(CXXFLAGS) -o' "${TEST} ${TEST}.o" '$(LDLIBS) -' >> Makefile -done - -for TEST in ${TESTS} ; do - echo ".PHONY: check-${TEST}" >>Makefile - if [ -f ${srcdir}/${TEST}.inp ] ; then - echo "check-${TEST}: ${TEST}" '$(srcdir)'"/${TEST}.inp - ./${TEST} < "'$(srcdir)'"/${TEST}.inp > ${TEST}.out 2>&1" >>Makefile - else - echo "check-${TEST}: ${TEST} - ./${TEST} > ${TEST}.out 2>&1" >>Makefile - fi - echo ' diff -c $(srcdir)/'"${TEST}.exp ${TEST}.out" >>Makefile - CHECK="${CHECK} check-${TEST}" -done - -if [ "${srcdir}" = "." ] ; then - if [ "${with_target_subdir}" != "." ] ; then - topsrcdir=${with_multisrctop}../../.. - else - topsrcdir=${with_multisrctop}../.. - fi -else - topsrcdir=${srcdir}/../.. -fi - -if [ -d ${topsrcdir}/gcc ] ; then - echo " -check: -check-old: ${CHECK}" >>Makefile -else - echo " -check: ${CHECK}" >>Makefile -fi diff --git a/contrib/libstdc++/tests/tcomplex.cc b/contrib/libstdc++/tests/tcomplex.cc deleted file mode 100644 index 5311f0d8b7..0000000000 --- a/contrib/libstdc++/tests/tcomplex.cc +++ /dev/null @@ -1,151 +0,0 @@ -// Tests for the -*- C++ -*- complex number classes. -// Copyright (C) 1994 Free Software Foundation - -// This file is part of the GNU ANSI C++ Library. This library is free -// software; you can redistribute it and/or modify it under the terms of -// the GNU General Public License as published by the Free Software -// Foundation; either version 2, or (at your option) any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -#include -#include -#include - -// to test near-equality - -const double eps = 0.000001; - -static void close_enough(const double_complex& a, const double_complex& b) -{ - assert(fabs(real(a) - real(b)) < eps && - fabs(imag(a) - imag(b)) < eps); -} - - -void test3(double_complex& a, double_complex& b, double_complex& c) -{ - - close_enough(-(-a) , a); - close_enough((a + b) , (b + a)); - close_enough((a + (-b)) , (a - b)); - close_enough((a * b) , (b * a)); - close_enough((a * (-b)) , -(a * b)); - close_enough((a / (-b)) , -(a / b)); - close_enough((a - b) , -(b - a)); - close_enough((a + (b + c)) , ((a + b) + c)); - close_enough((a * (b * c)) , ((a * b) * c)); - close_enough((a * (b + c)) , ((a * b) + (a * c))); - close_enough(((a - b) + b) , a); - close_enough(((a + b) - b) , a); - close_enough(((a * b) / b) , a); - close_enough(((a / b) * b) , a); - - - double_complex x = a; - x *= b; - close_enough(x , (a * b)); - x += c; - close_enough(x , ((a * b) + c)); - x -= a; - close_enough(x , (((a * b) + c) - a)); - x /= b; - close_enough(x , ((((a * b) + c) - a) / b)); - -} - -main() -{ - double_complex one = 1.0; - double_complex i (0.0, 1.0); - double_complex neg_one = -1.0; - - cout << "double_complex one = " << one << "\n"; - cout << "i = " << i << "\n"; - cout << "neg_one = " << neg_one << "\n"; - cout << "sqrt(neg_one) = " << sqrt(neg_one) << "\n"; - - double_complex a (2.0, 3.0); - double_complex b (4.0, 5.0); - - cout << "a = " << a << "\n"; - cout << "b = " << b << "\n"; - - cout << "a + one = " << (a + one) << "\n"; - (close_enough((a+one), double_complex(3.0, 3.0))); - cout << "a - one = " << (a - one) << "\n"; - (close_enough((a-one), double_complex(1.0, 3.0))); - cout << "a * one = " << (a * one) << "\n"; - (close_enough((a*one), a)); - cout << "a / one = " << (a / one) << "\n"; - (close_enough((a/one), a)); - - cout << "a + b = " << (a + b) << "\n"; - (close_enough((a+b), double_complex(6.0, 8.0))); - cout << "a - b = " << (a - b) << "\n"; - (close_enough((a-b), double_complex(-2.0, -2.0))); - cout << "a * b = " << (a * b) << "\n"; - (close_enough((a*b), double_complex(-7.0, 22.0))); - cout << "a / b = " << (a / b) << "\n"; - (close_enough((a/b), double_complex(0.5609760976, 0.0487804878))); - - double_complex c; - - c = a; cout << "c = a; c += b = " << (c += b) << "\n"; - c = a; cout << "c = a; c -= b = " << (c -= b) << "\n"; - c = a; cout << "c = a; c *= b = " << (c *= b) << "\n"; - c = a; cout << "c = a; c /= b = " << (c /= b) << "\n"; - - cout << "-a = " << (-a) << "\n"; - cout << "real(a) = " << real(a) << "\n"; - assert(real(a) == 2.0); - cout << "imag(a) = " << imag(a) << "\n"; - assert(imag(a) == 3.0); - cout << "conj(a) = " << conj(a) << "\n"; - assert(conj(a) == double_complex(2.0, -3.0)); - cout << "norm(a) = " << norm(a) << "\n"; - assert(norm(a) == 13.0); - - cout << "abs(a) = " << abs(a) << "\n"; - cout << "arg(a) = " << arg(a) << "\n"; - cout << "cos(a) = " << cos(a) << "\n"; - cout << "sin(a) = " << sin(a) << "\n"; - cout << "cosh(a) = " << cosh(a) << "\n"; - cout << "sinh(a) = " << sinh(a) << "\n"; - cout << "log(a) = " << log(a) << "\n"; - cout << "exp(a) = " << exp(a) << "\n"; - cout << "sqrt(a) = " << sqrt(a) << "\n"; - cout << "pow(a, 2) = " << pow(a, 2) << "\n"; - { - double_complex p = pow(a, b); - if(sizeof(float)==sizeof(double)) { - long w = (long)(p.imag()*100000); - if (w==-98642) - p=double_complex(-0.753046,-0.986429); - } - cout << "pow(a, b) = " << p << "\n"; - } - - double_complex d (10, 20); - double_complex e = pow(a, 2); - - test3(one, one, one); - test3(a, a, a); - test3(a, b, d); - test3(e, i, b); - test3(d, d, i); - - cout << "enter a complex number in form a or (a) or (a, b): "; - cin >> c; - cout << "number = " << c << "\n"; - - cout << "\nEnd of test\n"; - return 0; -} diff --git a/contrib/libstdc++/tests/tcomplex.exp b/contrib/libstdc++/tests/tcomplex.exp deleted file mode 100644 index 5bef15cd37..0000000000 --- a/contrib/libstdc++/tests/tcomplex.exp +++ /dev/null @@ -1,37 +0,0 @@ -double_complex one = (1,0) -i = (0,1) -neg_one = (-1,0) -sqrt(neg_one) = (0,1) -a = (2,3) -b = (4,5) -a + one = (3,3) -a - one = (1,3) -a * one = (2,3) -a / one = (2,3) -a + b = (6,8) -a - b = (-2,-2) -a * b = (-7,22) -a / b = (0.560976,0.0487805) -c = a; c += b = (6,8) -c = a; c -= b = (-2,-2) -c = a; c *= b = (-7,22) -c = a; c /= b = (0.560976,0.0487805) --a = (-2,-3) -real(a) = 2 -imag(a) = 3 -conj(a) = (2,-3) -norm(a) = 13 -abs(a) = 3.60555 -arg(a) = 0.982794 -cos(a) = (-4.18963,-9.10923) -sin(a) = (9.1545,-4.16891) -cosh(a) = (-3.72455,0.511823) -sinh(a) = (-3.59056,0.530921) -log(a) = (1.28247,0.982794) -exp(a) = (-7.31511,1.04274) -sqrt(a) = (1.67415,0.895977) -pow(a, 2) = (-5,12) -pow(a, b) = (-0.753046,-0.986429) -enter a complex number in form a or (a) or (a, b): number = (1.2,-34) - -End of test diff --git a/contrib/libstdc++/tests/tcomplex.inp b/contrib/libstdc++/tests/tcomplex.inp deleted file mode 100644 index c4e1d84660..0000000000 --- a/contrib/libstdc++/tests/tcomplex.inp +++ /dev/null @@ -1 +0,0 @@ -(1.2, -34) diff --git a/contrib/libstdc++/tests/tlist.cc b/contrib/libstdc++/tests/tlist.cc deleted file mode 100644 index a37c999d0b..0000000000 --- a/contrib/libstdc++/tests/tlist.cc +++ /dev/null @@ -1,151 +0,0 @@ -// test/demo of generic lists - -#include - -#define tassert(ex) {if ((ex)) cerr << #ex << "\n"; \ - else _assert(#ex, __FILE__,__LINE__); } - -#include -#include -#include - -bool int_compare(int a, int b) -{ - return a < b; -} - -int inc(int x) -{ - return x + 1; -} - -void print(list& l) -{ - for (list::iterator it = l.begin(); it != l.end(); it++) - cout << *it << " "; - cout << "\n"; -} - -int is_odd(int x) -{ - return x & 1; -} - -int is_even(int x) -{ - return (x & 1) == 0; -} - -void sequence(list& a, int lo, int hi) -{ - back_insert_iterator > it(a); - while (lo <= hi) - *it++ = lo++; -} - -int old_rand = 9999; - -int get_rand() -{ - old_rand = ((long)old_rand * (long)1243) % (long)971; - return old_rand; -} - -void randseq(list& a, int n) -{ - back_insert_iterator > it(a); - while (--n >= 0) - *it++ = get_rand() % 50; -} - -int array1 [] = { 9, 16, 36 }; -int array2 [] = { 1, 4 }; - -int test_splice () -{ - list l1 (array1, array1 + 3); - list l2 (array2, array2 + 2); - list::iterator i1 = l1.begin (); - l1.splice (i1, l2); - list::iterator i2 = l1.begin (); - while (i2 != l1.end ()) - cout << *i2++ << endl; - return 0; -} - -main() -{ - list a; int i; - list::iterator it, bit; - sequence(a, 1, 20); - cout << "\nlist a = sequence(1, 20);\n"; print(a); - for (it = a.begin (), i = 0; it != a.end (); it++, i++) - assert (*it == i + 1); - list b; - randseq(b, 20); - cout << "\nlist b = randseq(20);\n"; print(b); - list c; - c.insert (c.end(), a.begin(), a.end()); - c.insert (c.end(), b.begin(), b.end()); - cout << "\nlist c = a and b;\n"; print(c); - - list d; - for (it = a.begin(); it != a.end(); it++) - d.insert(d.end (), inc(*it)); - cout << "\nlist d = map(inc, a);\n"; print(d); - - list e; - back_insert_iterator > e_insertor (e); - reverse_copy (a.begin(), a.end (), e_insertor); - cout << "\nlist e = reverse(a);\n"; print(e); - - list f; - for (it = a.begin(); it != a.end(); it++) - if (is_odd (*it)) - f.insert(f.end (), *it); - cout << "\nlist f = select(is_odd, a);\n"; print(f); - list ff; - for (it = f.begin(); it != f.end(); it++) - if (is_even (*it)) - ff.insert(ff.end (), *it); - assert(ff.empty()); - - int red = 0; - for (it = a.begin(); it != a.end(); it++) - red += *it; - cout << "\nint red = a.reduce(plus, 0);\n"; cout << red; - it = a.begin(); ++it; ++it; - int second = *it; - cout << "\nint second = a[2];\n"; cout << second; - list g; - for (it = a.begin(), bit = b.begin(); it != a.end () && bit != b.end (); ) - g.insert (g.end (), *it++ + *bit++); - cout << "\nlist g = combine(plus, a, b);\n"; print(g); - g.remove_if (is_odd); - cout << "\ng.del(is_odd);\n"; print(g); - - ff.erase (ff.begin (), ff.end()); - for (it = g.begin(); it != g.end(); it++) - if (is_odd (*it)) - ff.insert (ff.end (), *it); - assert(ff.empty()); - - b.sort(); - for (it = b.begin(); bit = it++, it != b.end (); ) assert (*it >= *bit); - cout << "\nb.sort(int_compare);\n"; print(b); - - list h; - back_insert_iterator > h_insertor (h); - merge (a.begin (), a.end (), b.begin (), b.end (), h_insertor, int_compare); - cout << "\nlist h = merge(a, b, int_compare);\n"; print(h); - for (it = h.begin(); bit = it++, it != h.end (); ) assert (*it >= *bit); - - cout << "\nh via iterator:\n"; - for (it = h.begin(); it != h.end (); it++) - cout << *it << ", "; - cout << "\n"; - - test_splice (); - - cout << "\ndone\n"; -} diff --git a/contrib/libstdc++/tests/tlist.exp b/contrib/libstdc++/tests/tlist.exp deleted file mode 100644 index 65f7806826..0000000000 --- a/contrib/libstdc++/tests/tlist.exp +++ /dev/null @@ -1,44 +0,0 @@ - -list a = sequence(1, 20); -1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 - -list b = randseq(20); -28 27 5 17 44 6 9 40 15 26 49 35 15 48 13 27 25 25 9 6 - -list c = a and b; -1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 28 27 5 17 44 6 9 40 15 26 49 35 15 48 13 27 25 25 9 6 - -list d = map(inc, a); -2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 - -list e = reverse(a); -20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 - -list f = select(is_odd, a); -1 3 5 7 9 11 13 15 17 19 - -int red = a.reduce(plus, 0); -210 -int second = a[2]; -3 -list g = combine(plus, a, b); -29 29 8 21 49 12 16 48 24 36 60 47 28 62 28 43 42 43 28 26 - -g.del(is_odd); -8 12 16 48 24 36 60 28 62 28 42 28 26 - -b.sort(int_compare); -5 6 6 9 9 13 15 15 17 25 25 26 27 27 28 35 40 44 48 49 - -list h = merge(a, b, int_compare); -1 2 3 4 5 5 6 6 6 7 8 9 9 9 10 11 12 13 13 14 15 15 15 16 17 17 18 19 20 25 25 26 27 27 28 35 40 44 48 49 - -h via iterator: -1, 2, 3, 4, 5, 5, 6, 6, 6, 7, 8, 9, 9, 9, 10, 11, 12, 13, 13, 14, 15, 15, 15, 16, 17, 17, 18, 19, 20, 25, 25, 26, 27, 27, 28, 35, 40, 44, 48, 49, -1 -4 -9 -16 -36 - -done diff --git a/contrib/libstdc++/tests/tmap.cc b/contrib/libstdc++/tests/tmap.cc deleted file mode 100644 index 900e66f506..0000000000 --- a/contrib/libstdc++/tests/tmap.cc +++ /dev/null @@ -1,59 +0,0 @@ -#include -#include -#include -#include - -#define int_less less -struct str_less { - bool operator() (char* x, char* y) const { return strcmp(x,y) < 0; } -}; - -#if 0 -int SIZE; - -void add(int x[], int y[], map& a) -{ - for (int i = 0; i < SIZE; ++i) a[x[i]] = y[i]; -} -#endif - -int -main(int argv, char** argc) -{ -#if 0 - if (argv > 1) - { - SIZE = abs(atoi(argc[1])); - SIZE &= ~1; - } - else - SIZE = 100; - nums = new int[SIZE]; - odds = new int[SIZE]; - perm = new int[SIZE]; -#endif - - map my_map; - - map phones; - - my_map[4] = 40; - my_map[2] = 20; - - // The (char*) is needed because g++ doesn't - // convert char[] to char* in this context. - phones[(char*)"tom"] = 2345; - phones[(char*)"dick"] = 5678; - phones[(char*)"harry"] = 7654; - - cout << "2 -> " << my_map[2] << endl; - cout << "4 -> " << my_map[4] << endl; - - map::iterator it = my_map.begin(); - for ( ; it != my_map.end(); it++) - cout << "my_map[" << (*it).first << "] = " << (*it).second << endl; - - map::iterator pit = phones.begin(); - for ( ; pit != phones.end(); pit++) - cout << "phones[" << (*pit).first << "] = " << (*pit).second << endl; -} diff --git a/contrib/libstdc++/tests/tmap.exp b/contrib/libstdc++/tests/tmap.exp deleted file mode 100644 index b7b5df249f..0000000000 --- a/contrib/libstdc++/tests/tmap.exp +++ /dev/null @@ -1,7 +0,0 @@ -2 -> 20 -4 -> 40 -my_map[2] = 20 -my_map[4] = 40 -phones[dick] = 5678 -phones[harry] = 7654 -phones[tom] = 2345 diff --git a/contrib/libstdc++/tests/tstring.cc b/contrib/libstdc++/tests/tstring.cc deleted file mode 100644 index 833d3d9646..0000000000 --- a/contrib/libstdc++/tests/tstring.cc +++ /dev/null @@ -1,249 +0,0 @@ -// Tests for the -*- C++ -*- string classes. -// Copyright (C) 1994 Free Software Foundation - -// This file is part of the GNU ANSI C++ Library. This library is free -// software; you can redistribute it and/or modify it under the terms of -// the GNU General Public License as published by the Free Software -// Foundation; either version 2, or (at your option) any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -#include -#include -#include -#include -#include - -string X = "Hello"; -string Y = "world"; -string N = "123"; -string c; -const char* s = ","; - -void decltest() -{ - string x; - cout << "an empty string:" << x << "\n"; - assert(x == ""); - - string y = "Hello"; - cout << "A string initialized to Hello:" << y << "\n"; - assert(y == "Hello"); - - if (y[y.length()-1] == 'o') - y = y + '\n'; - assert(y == "Hello\n"); - y = "Hello"; - - string a = y; - cout << "A string initialized to previous string:" << a << "\n"; - assert(a == "Hello"); - assert(a == y); - - string b (a, 1, 2); - cout << "A string initialized to (previous string, 1, 2):" << b << "\n"; - assert(b == "el"); - - char ch = '@'; - string z (1, ch); - cout << "A string initialized to @:" << z << "\n"; - assert (z == "@"); - - string n ("20"); - cout << "A string initialized to 20:" << n << "\n"; - assert(n == "20"); - - int i = atoi(n.c_str ()); - double f = atof(n.c_str ()); - cout << "n = " << n << " atoi(n) = " << i << " atof(n) = " << f << "\n"; - assert(i == 20); - assert(f == 20); - - int ar[] = { 'H', 'e', 'l', 'l', 'o' }; - string is (ar, ar+sizeof(ar)/sizeof(ar[0])); - cout << "is = " << is << endl; - assert (is == "Hello"); -} - -void cattest() -{ - string x = X; - string y = Y; - string z = x + y; - cout << "z = x + y = " << z << "\n"; - assert(z == "Helloworld"); - - x += y; - cout << "x += y; x = " << x << "\n"; - assert(x == "Helloworld"); - - y = Y; - x = X; - y.insert (0, x); - cout << "y.insert (0, x); y = " << y << "\n"; - assert(y == "Helloworld"); - - y = Y; - x = X; - x = x + y + x; - cout << "x = x + y + x; x = " << x << "\n"; - assert(x == "HelloworldHello"); - - y = Y; - x = X; - x = y + x + x; - cout << "x = y + x + x; x = " << x << "\n"; - assert(x == "worldHelloHello"); - - x = X; - y = Y; - z = x + s + ' ' + y.substr (y.find ('w'), 1) + y.substr (y.find ('w') + 1) + "."; - cout << "z = x + s + + y.substr (y.find (w), 1) + y.substr (y.find (w) + 1) + . = " << z << "\n"; - assert(z == "Hello, world."); -} - -void -findtest() -{ - string x; - string::size_type pos; - pos = x.find_last_not_of('X'); - assert(pos == string::npos); - pos = x.find_last_not_of("XYZ"); - assert(pos == string::npos); - - string y("a"); - pos = y.find_last_not_of('X'); - assert(pos == 0); - pos = y.find_last_not_of('a'); - assert(pos == string::npos); - pos = y.find_last_not_of("XYZ"); - assert(pos == 0); - pos = y.find_last_not_of("a"); - assert(pos == string::npos); - - string z("ab"); - pos = z.find_last_not_of('X'); - assert(pos == 1); - pos = z.find_last_not_of("XYZ"); - assert(pos == 1); - pos = z.find_last_not_of('b'); - assert(pos == 0); - pos = z.find_last_not_of("Xb"); - assert(pos == 0); - pos = z.find_last_not_of("Xa"); - assert(pos == 1); - pos = z.find_last_of("ab"); - assert(pos == 1); - pos = z.find_last_of("Xa"); - assert(pos == 0); - pos = z.find_last_of("Xb"); - assert(pos == 1); - pos = z.find_last_of("XYZ"); - assert(pos == string::npos); - pos = z.find_last_of('a'); - assert(pos == 0); - pos = z.find_last_of('b'); - assert(pos == 1); - pos = z.find_last_of('X'); - assert(pos == string::npos); -} - -void comparetest() -{ - string x = X; - string y = Y; - string n = N; - string z = x + y; - - assert(x != y); - assert(x == "Hello"); - assert(x != z.substr (0, 4)); - assert(x.compare (y) < 0); - assert(x.compare (z.substr (0, 6)) < 0); - - assert(x.find ("lo") == 3); - assert(x.find ("l", 2) == 2); - assert(x.rfind ("l") == 3); -} - -void substrtest() -{ - string x = X; - - char ch = x[0]; - cout << "ch = x[0] = " << ch << "\n"; - assert(ch == 'H'); - - string z = x.substr (2, 3); - cout << "z = x.substr (2, 3) = " << z << "\n"; - assert(z == "llo"); - - x.replace (2, 2, "r"); - cout << "x.replace (2, 2, r); x = " << x << "\n"; - assert(x == "Hero"); - - x = X; - x.replace (0, 1, 'j'); - cout << "x.replace (0, 1, 'j'); x = " << x << "\n"; - assert(x == "jello"); - - int ar[] = { 'H', 'e', 'l', 'l', 'o' }; - x.replace (find (x.begin (), x.end (), 'l'), - find (x.rbegin (), x.rend (), 'l').base (), - ar, ar+sizeof(ar)/sizeof(ar[0])); - cout << "x = " << x << endl; - assert (x == "jeHelloo"); -} - -void iotest() -{ - string z; - cout << "enter a word:"; - cin >> z; - cout << "word =" << z << " "; - cout << "length = " << z.length() << "\n"; -} - -void identitytest(string a, string b) -{ - string x = a; - string y = b; - x += b; - y.insert (0, a); - assert((a + b) == x); - assert((a + b) == y); - assert(x == y); - - assert((a + b + a) == (a + (b + a))); - - x.erase (x.rfind (b)); - assert(x == a); - - y.replace (0, y.rfind (b), b); - assert(y == (b + b)); - y.replace (y.find (b), b.length (), a); - assert(y == (a + b)); -} - -int main() -{ - decltest(); - cattest(); - comparetest(); - findtest(); - substrtest(); - identitytest(X, X); - identitytest(X, Y); - identitytest(X+Y+N+X+Y+N, "A string that will be used in identitytest but is otherwise just another useless string."); - iotest(); - cout << "\nEnd of test\n"; - return 0; -} diff --git a/contrib/libstdc++/tests/tstring.exp b/contrib/libstdc++/tests/tstring.exp deleted file mode 100644 index 4526279b88..0000000000 --- a/contrib/libstdc++/tests/tstring.exp +++ /dev/null @@ -1,22 +0,0 @@ -an empty string: -A string initialized to Hello:Hello -A string initialized to previous string:Hello -A string initialized to (previous string, 1, 2):el -A string initialized to @:@ -A string initialized to 20:20 -n = 20 atoi(n) = 20 atof(n) = 20 -is = Hello -z = x + y = Helloworld -x += y; x = Helloworld -y.insert (0, x); y = Helloworld -x = x + y + x; x = HelloworldHello -x = y + x + x; x = worldHelloHello -z = x + s + + y.substr (y.find (w), 1) + y.substr (y.find (w) + 1) + . = Hello, world. -ch = x[0] = H -z = x.substr (2, 3) = llo -x.replace (2, 2, r); x = Hero -x.replace (0, 1, 'j'); x = jello -x = jeHelloo -enter a word:word =abcdefghijklmnopqrstuvwxyz length = 26 - -End of test diff --git a/contrib/libstdc++/tests/tstring.inp b/contrib/libstdc++/tests/tstring.inp deleted file mode 100644 index b0883f382e..0000000000 --- a/contrib/libstdc++/tests/tstring.inp +++ /dev/null @@ -1 +0,0 @@ -abcdefghijklmnopqrstuvwxyz diff --git a/contrib/libstdc++/tests/tvector.cc b/contrib/libstdc++/tests/tvector.cc deleted file mode 100644 index ef238ef52d..0000000000 --- a/contrib/libstdc++/tests/tvector.cc +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include - -main () -{ - cout << "Fill of C array:\n"; - char x[50]; - fill (x, x+50, '/'); - fill (x+1, x+49, '*'); - copy (x, x+50, ostream_iterator(cout)); - - cout << "\nFill of vector:\n"; - - vector cvec; - cvec.insert (cvec.begin(), 50, '/'); - fill (cvec.begin()+1, cvec.end()-1, '-'); - copy (cvec.begin(), cvec.end(), ostream_iterator(cout)); - cout << endl; -} diff --git a/contrib/libstdc++/tests/tvector.exp b/contrib/libstdc++/tests/tvector.exp deleted file mode 100644 index 84a9d1bf3a..0000000000 --- a/contrib/libstdc++/tests/tvector.exp +++ /dev/null @@ -1,4 +0,0 @@ -Fill of C array: -/************************************************/ -Fill of vector: -/------------------------------------------------/ diff --git a/contrib/libstdc++/testsuite/ChangeLog b/contrib/libstdc++/testsuite/ChangeLog deleted file mode 100644 index 3d7602748e..0000000000 --- a/contrib/libstdc++/testsuite/ChangeLog +++ /dev/null @@ -1,94 +0,0 @@ -Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com) - - * gcc-2.95.3 Released. - -Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.2 Released. - -Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.1 Released. - -Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -Wed Nov 25 01:00:07 1998 Marc Espie - - * Makefile.in (just-check): Ignore errors. - -Sun Jun 28 00:00:10 1998 Carlo Wood - - * lib/libstdc++.exp: Use global variable ld_library_path (not local) - that is a lot more persistent; dejagnu-980528 needs this. - * lib/libstdc++.exp (test_stdc++): Use regular expression " -lstdc.." - to remove -lstdc++ arguments (not " -lstdc.*"). - -Thu Dec 25 00:34:03 1997 Jeffrey A Law (law@cygnus.com) - - * lib/libstdc++.exp (test_libstdc++): Set LD_LIBRARY_PATH - and SHLIB_PATH appropriately. - -Wed Sep 3 09:39:36 1997 Jeffrey A Law (law@cygnus.com) - - * lib/libstdc++.exp: Remove libg++_link_flags. - -Wed Aug 6 18:43:23 1997 Jason Merrill - - * lib/libstdc++.exp: Remove libio_link_flags. - -Thu Jul 17 14:54:58 1997 Brendan Kehoe - - * lib/libstdc++.exp (base_dir): Move from here... - (test_libstdc++): To here. - (LIBSTDCPP): Delete unused global decl. - -Tue Jun 17 01:46:49 1997 Bob Manson - - * lib/libstdc++.exp: Strip off leading LFs from both the pattern - being matched against and the output from the board. Find the - correct multilib libstdc++ to link with. Use g++_link_flags - and libio_link_flags. Link in the status wrapper if needed. - (libstdc++_init): New procedure. - -Tue Jun 3 17:16:39 1997 Bob Manson - - * lib/libstdc++.exp: Don't use global exec_output variable; the - output is returned from remote_load instead. - -Tue Apr 29 17:20:05 1997 Mike Stump - - * lib/libstdc++.exp: Fixup so that $compile_args works better. - * libstdc++.tests/test.exp: Also run with -O. - -Tue Apr 29 16:34:37 1997 Mike Stump - - * testsuite/lib/libstdc++.exp: Fixup so that we always have the - same number of testcases, and so that we have meaningful testcase - names. - -Tue Apr 29 13:05:14 1997 Bob Manson - - * lib/libstdc++.exp: Add support for --tool_opts. - -Mon Apr 28 11:10:25 1997 Bob Manson - - * Makefile.in: Add comment so target Makefile fragments get added. - Removed clean rule, because it is added by configure. - - * configure.in (TESTS): Add. - -Sun Apr 27 15:03:10 1997 Brendan Kehoe - - * Makefile.in (clean): Add empty rule for now. - -Fri Apr 25 18:59:14 1997 Bob Manson - - * lib/libstdc++.exp(test_libstdc++): Return on error. Generate a - FAIL if the compile fails. Remove CRs from the output from the - testcase. diff --git a/contrib/libstdc++/testsuite/Makefile.in b/contrib/libstdc++/testsuite/Makefile.in deleted file mode 100644 index 7c85678e1f..0000000000 --- a/contrib/libstdc++/testsuite/Makefile.in +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright (C) 1997 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 GNU CC; see the file COPYING. If not, write to -# the Free Software Foundation, 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. */ - -srcdir = libstdc++.tests - -EXPECT = `if [ -f $${rootme}/../../expect/expect ] ; then \ - echo $${rootme}/../../expect/expect ; \ - else echo expect ; fi` - -RUNTEST = `if [ -f $${srcdir}/../../dejagnu/runtest ] ; then \ - echo $${srcdir}/../../dejagnu/runtest ; \ - else echo runtest; fi` -RUNTESTFLAGS = - -#### package, host, target, and site dependent Makefile fragments come in here. -## - -.PHONY: all -all: - -.PHONY: check -check: all just-check - -site.exp: ./config.status Makefile - @echo "Making a new config file..." - -@rm -f ./tmp? - @touch site.exp - -@mv site.exp site.bak - @echo "## these variables are automatically generated by make ##" > ./tmp0 - @echo "# Do not edit here. If you wish to override these values" >> ./tmp0 - @echo "# add them to the last section" >> ./tmp0 - @echo "set host_alias $(host_alias)" >> ./tmp0 - @echo "set host_triplet ${host_canonical}" >> ./tmp0 - @echo "set target_alias $(target_alias)" >> ./tmp0 - @echo "set target_triplet ${target_canonical}" >> ./tmp0 - @echo "set build_triplet ${build_canonical}" >> ./tmp0 - @echo "set srcdir ${srcdir}" >> ./tmp0 - @echo "set tool libstdc++" >> ./tmp0 - @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0 - @cat ./tmp0 > site.exp - @cat site.bak | sed \ - -e '1,/^## All variables above are.*##/ d' >> site.exp - -@rm -f ./tmp? - -just-check: site.exp - -rootme=`pwd`; export rootme; \ - srcdir=${srcdir} ; export srcdir ; \ - EXPECT=${EXPECT} ; export EXPECT ; \ - if [ -f $${rootme}/../../expect/expect ] ; then \ - TCL_LIBRARY=$${srcdir}/../../tcl/library ; \ - export TCL_LIBRARY ; fi ; \ - $(RUNTEST) $(RUNTESTFLAGS) diff --git a/contrib/libstdc++/testsuite/config/default.exp b/contrib/libstdc++/testsuite/config/default.exp deleted file mode 100644 index 90967cccc1..0000000000 --- a/contrib/libstdc++/testsuite/config/default.exp +++ /dev/null @@ -1 +0,0 @@ -load_lib "standard.exp" diff --git a/contrib/libstdc++/testsuite/configure.in b/contrib/libstdc++/testsuite/configure.in deleted file mode 100644 index ad5f232b08..0000000000 --- a/contrib/libstdc++/testsuite/configure.in +++ /dev/null @@ -1,24 +0,0 @@ -# This file is a shell script fragment that supplies the information -# necessary for a configure script to process the program in -# this directory. For more information, look at ../../configure. - -configdirs= -srctrigger=configure.in -srcname="tests for ANSI C++ library, dejagnu style" -package_makefile_frag=Make.pack -package_makefile_rules_frag=Make.pack.r - -# per-host: - -# per-target: - -target_makefile_frag=../target-mkfrag - -TO_TOPDIR=../../ -ALL=' ' -XCXXINCLUDES="-I${srcdir}/.. -I${srcdir}/../stl -I${TO_TOPDIR}libio -I${srcdir}/${TO_TOPDIR}libio" -TESTS="tcomplex tstring tlist tmap tvector" -MOSTLYCLEAN="*.o core ${TESTS} *.out" -(. ${srcdir}/${TO_TOPDIR}libio/config.shared) >${package_makefile_frag} 2>${package_makefile_rules_frag} - -# post-target: diff --git a/contrib/libstdc++/testsuite/lib/libstdc++.exp b/contrib/libstdc++/testsuite/lib/libstdc++.exp deleted file mode 100644 index 3333ddad6c..0000000000 --- a/contrib/libstdc++/testsuite/lib/libstdc++.exp +++ /dev/null @@ -1,179 +0,0 @@ -# Copyright (C) 1997 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-lib-g++@prep.ai.mit.edu - -# This file was written by Bob Manson. (manson@cygnus.com) - -load_lib "libgloss.exp" - -global tmpdir - -if ![info exists tmpdir] { - set tmpdir "/tmp" -} - -# -# Build the status wrapper library as needed. -# -proc libstdc++_init { args } { - global wrapper_file; - global wrap_compile_flags; - set wrapper_file ""; - set wrap_compile_flags ""; - if [target_info exists needs_status_wrapper] { - set result [build_wrapper "testglue.o"]; - if { $result != "" } { - set wrapper_file [lindex $result 0]; - set wrap_compile_flags [lindex $result 1]; - } else { - warning "Status wrapper failed to build." - } - } -} -# -# Run the test specified by srcfile and resultfile. compile_args and -# exec_args are additional arguments to be passed in when compiling and -# running the testcase, respectively. -# - -proc test_libstdc++ { options srcfile compile_args inpfile resultfile exec_args } { - global base_dir - global LIBSTDCPP - global srcdir subdir objdir - global TOOL_OPTIONS - global ld_library_path - - if [info exists LIBSTDCPP] { - set libstdcpp $LIBSTDCPP; - } else { - set gp [get_multilibs]; - if { $gp != "" } { - if [file exists "$gp/libstdc++/libstdc++.a"] { - set libstdcpp "-L$gp/libstdc++ -lstdc++"; - } - } - if ![info exists libstdcpp] { - set libstdcpp [findfile $base_dir/../../libstdc++/libstdc++.a "-L$base_dir/../../libstdc++ -lstdc++" -lstdc++] - } - } - - verbose "using LIBSTDCPP = $libstdcpp" 2 - set args "" - - # Basically we want to build up a colon separated path list from - # the value of $libstdcpp. - - # First strip away any -L arguments. - regsub -all -- "-L" $libstdcpp "" ld_library_path - - # Then remove any -lstdc++ argument. - regsub -all -- " -lstdc.." $ld_library_path "" ld_library_path - - # That's enough to make things work for the normal case. - # If we wanted to handle an arbitrary value of libstdcpp, - # then we'd have to do a lot more work. - - if { $compile_args != "" } { - lappend args "additional_flags=$compile_args" - } - lappend args "incdir=.." - lappend args "incdir=$srcdir/.." - lappend args "incdir=$srcdir/../stl" - lappend args "incdir=." - if [info exists TOOL_OPTIONS] { - lappend args "additional_flags=$TOOL_OPTIONS" - } - - global wrapper_file wrap_compile_flags; - # We have to include libio, for _G_config.h. - lappend args "additional_flags=$wrap_compile_flags"; - lappend args "libs=$wrapper_file"; - lappend args "libs=$libstdcpp"; - lappend args "additional_flags=[libio_include_flags]" - lappend args debug - - regsub "^.*/(\[^/.\]+)\[.\]\[^/]*$" "$srcfile" "\\1" out - set executable "${objdir}/$out" - set errname "[file tail $srcfile]" - if { $compile_args != "" } { - set errname "$errname $compile_args" - } - - if { [target_compile $srcfile "$executable" executable $args] != "" } { - fail "$errname compilation" - setup_xfail "*-*-*" - fail "$errname execution" - setup_xfail "*-*-*" - fail "$errname output" - return; - } - pass "$errname compilation" - - set result [libstdc++_load $executable "$exec_args" "$inpfile"]; - set status [lindex $result 0]; - set output [lindex $result 1]; - $status "$errname execution" - if { $status != "pass" } { - setup_xfail "*-*-*" - fail "$errname output" - return; - } - - verbose "resultfile is $resultfile" - set id [open $resultfile r]; - set expected "" - append expected [read $id]; - regsub -all "\r" "$output" "" output; - regsub "\n*$" $expected "" expected - regsub "\n*$" $output "" output - regsub "^\n*" $expected "" expected - regsub "^\n*" $output "" output - regsub -all "\[ \t\]\[ \t\]*" $expected " " expected - regsub -all "\[ \t\]*\n\n*" $expected "\n" expected - regsub -all "\[ \t\]\[ \t\]*" $output " " output - regsub -all "\[ \t\]*\n\n*" $output "\n" output - verbose "expected is $expected" - verbose "actual is $output" - set passed 0; - if {$options == "regexp_match"} { - if [regexp $expected $output] { - set passed 1; - } - } else { - if { $expected == $output } { - set passed 1; - } - } - if { $passed == 1 } { - pass "$errname output" - } else { - clone_output "expected was $expected" - clone_output "output was $output" - fail "$errname output" - } - close $id; -} - -# -# libstdc++_version -- extract and print the version number of libstdc++p -# -proc default_libstdc++_version {} { -} - -proc default_libstdc++_start { } { -} diff --git a/contrib/libstdc++/testsuite/libstdc++.tests/test.exp b/contrib/libstdc++/testsuite/libstdc++.tests/test.exp deleted file mode 100644 index 7368cfb282..0000000000 --- a/contrib/libstdc++/testsuite/libstdc++.tests/test.exp +++ /dev/null @@ -1,34 +0,0 @@ -global srcdir subdir - -catch "glob -nocomplain $srcdir/$subdir/../../tests/*.exp" srcfiles -verbose "srcfiles are $srcfiles" - -set prefix "" -foreach x $srcfiles { - regsub "\\.exp$" $x "" prefix - set bname [file tail $prefix] - set args "" - if [file exists $srcdir/$subdir/${bname}.arg] { - set id [open "$srcdir/$subdir/${bname}.arg" r]; - set args [read -nonewline $id]; - close $id; - } - if [file exists $srcdir/$subdir/${bname}.xpo] { - set resfile "$srcdir/$subdir/${bname}.xpo" - set options "regexp_match" - } else { - set resfile "${prefix}.exp" - set options "" - } - - if [file exists ${prefix}.inp] { - set inpfile ${prefix}.inp - } else { - set inpfile "" - } - - verbose "inpfile is $inpfile" - - test_libstdc++ $options "${prefix}.cc" "" $inpfile $resfile $args - test_libstdc++ $options "${prefix}.cc" "-O" $inpfile $resfile $args -} diff --git a/contrib/libstdc++/valarray b/contrib/libstdc++/valarray deleted file mode 100644 index a938b6a686..0000000000 --- a/contrib/libstdc++/valarray +++ /dev/null @@ -1,8 +0,0 @@ -// Main header for -*- C++ -*- valarray classes. - -#ifndef __VALARRAY__ -#define __VALARRAY__ - -#include - -#endif diff --git a/contrib/libstdc++/valarray.cc b/contrib/libstdc++/valarray.cc deleted file mode 100644 index 5e7fe0cf05..0000000000 --- a/contrib/libstdc++/valarray.cc +++ /dev/null @@ -1,50 +0,0 @@ -#include - -// Some Explicit Instanciations. -template class multiplies; -template size_t accumulate(size_t*, size_t*, size_t, multiplies); - -template void - __valarray_fill(size_t* __restrict__, size_t, const size_t&); - -template void - __valarray_copy(const size_t* __restrict__, size_t, size_t* __restrict__); - -template valarray::valarray(size_t); -template valarray::~valarray(); -template valarray::valarray(const valarray&); -template size_t valarray::size() const; -template size_t& valarray::operator[](size_t); -template size_t valarray::product() const; - - -void __gslice_to_index(size_t __o, const valarray& __l, - const valarray& __s, - valarray& __i) -{ - const size_t __n = __l.size(); - size_t* const __t = static_cast(alloca(__n*sizeof(size_t))); - __valarray_fill(__t, __n, size_t(0)); - const size_t __z = __i.size(); - __valarray_fill(&__i[0], __z, __o); - for (size_t __j=0; __j<__z; ++__j) { - for (size_t __k=0; __k<__n; ++__k) - __i[__j] += __s[__k]*__t[__k]; - ++__t[__n-1]; - for (size_t __k=__n-1; __k; --__k) { - if (__t[__k] >= __l[__k]) { - __t[__k] = 0; - ++__t[__k-1]; - } - } - } -} - -_Indexer::_Indexer(size_t __o, const valarray& __l, - const valarray& __s) - : _M_count(1), _M_start(__o), _M_size(__l), _M_stride(__s), - _M_index(__l.size() ? __l.product() : 0) -{ __gslice_to_index(__o, __l, __s, _M_index); } - - - -- 2.11.4.GIT