summaryrefslogtreecommitdiffstats
path: root/contrib/libstdc++/libio
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libstdc++/libio')
-rw-r--r--contrib/libstdc++/libio/ChangeLog2774
-rw-r--r--contrib/libstdc++/libio/Makefile.am67
-rw-r--r--contrib/libstdc++/libio/Makefile.in426
-rw-r--r--contrib/libstdc++/libio/_G_config.h136
-rw-r--r--contrib/libstdc++/libio/filedoalloc.c101
-rw-r--r--contrib/libstdc++/libio/fileops.c1049
-rw-r--r--contrib/libstdc++/libio/genops.c1123
-rw-r--r--contrib/libstdc++/libio/iofclose.c97
-rw-r--r--contrib/libstdc++/libio/iofopen.c78
-rw-r--r--contrib/libstdc++/libio/iofwide.c476
-rw-r--r--contrib/libstdc++/libio/iolibio.h82
-rw-r--r--contrib/libstdc++/libio/libio.h511
-rw-r--r--contrib/libstdc++/libio/libioP.h821
-rw-r--r--contrib/libstdc++/libio/stdfiles.c71
-rw-r--r--contrib/libstdc++/libio/stdio.c43
-rw-r--r--contrib/libstdc++/libio/wfiledoalloc.c108
-rw-r--r--contrib/libstdc++/libio/wfileops.c754
-rw-r--r--contrib/libstdc++/libio/wgenops.c756
18 files changed, 9473 insertions, 0 deletions
diff --git a/contrib/libstdc++/libio/ChangeLog b/contrib/libstdc++/libio/ChangeLog
new file mode 100644
index 0000000..86c0903
--- /dev/null
+++ b/contrib/libstdc++/libio/ChangeLog
@@ -0,0 +1,2774 @@
+2001-02-03 Alexandre Oliva <aoliva@redhat.com>
+ Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
+
+ * Makefile.am (mkinstalldirs): Set.
+
+2001-01-28 Benjamin Kosnik <bkoz@gnu.org>
+
+ * Makefile.am (LIBIO_SRCS): Remove stdio.c.
+
+2000-10-29 Benjamin Kosnik <bkoz@gnu.org>
+
+ * Makefile.am (INCLUDES): Change to $(top_builddir)/include.
+
+2000-10-29 Mark Mitchell <mark@codesourcery.com>
+
+ * iofopen.c (_IO_new_fopen): Don't define `_IO_wide_data wd'
+ if _GLIBCPP_USE_WCHAR_T is not defined.
+ * iofwide.c: Don't define codecvt functions when
+ _GLIBCPP_USE_WCHAR_T is not defined.
+ (_IO_fwide): Don't try to put the stream in wide mode when
+ _GLIBCPP_USE_WCHAR_T is not defined.
+ * libio.h (_IO_wide_data): Define it as an incomplete struct
+ when _GLIBCPP_USE_WCHAR_T is not defined.
+ * wfiledoalloc.c: Don't define anything when
+ _GLIBCPP_USE_WCHAR_T is not defined.
+ * wfileops.c: Likewise.
+ * wgenops.c: Likewise.
+
+ * _G_config.h (_G_USING_THUNKS): Allow overrides from
+ OS-configuration files.
+ * libioP.h: Test _G_USING_THUNKS with #if, rather than #ifdef.
+
+2000-10-17 Benjamin Kosnik <bkoz@gnu.org>
+
+ * libioP.h: Break up extern "C" bits around includes.
+ * libio.h: Only include C headers, or else _C_legacy namespaces
+ will be nested.
+ * libioP.h: Same here.
+
+2000-10-11 Benjamin Kosnik <bkoz@gnu.org>
+
+ * Makefile.am: Add includes from GLIBCPP_EXPORT_INCLUDES.
+
+2000-10-10 Benjamin Kosnik <bkoz@gnu.org>
+
+ * _G_config.h (__need_ptrdiff_t): Add.
+
+2000-10-08 Benjamin Kosnik <bkoz@gnu.org>
+
+ * Makefile.am (INCLUDES): Simplify.
+ * libioP.h (JUMP1): If compiling c++, use std headers.
+ * _G_config.h: Same.
+
+2000-10-07 Benjamin Kosnik <bkoz@gnu.org>
+
+ * Makefile.am (CONFIG_INCLUDES): Remove.
+
+2000-10-06 Benjamin Kosnik <bkoz@gnu.org>
+
+ * Makefile.am (libio_la_DEPENDENCIES): Remove extaneous cruft.
+ (libio_la_SOURCES): Remove.
+
+2000-10-05 Benjamin Kosnik <bkoz@gnu.org>
+
+ * Makefile.am (INCLUDES): Add glibcpp_includedir.
+
+2000-10-04 Benjamin Kosnik <bkoz@gnu.org>
+
+ * _G_config.h : Re-guard the __mbstate_t declaration.
+
+2000-09-27 Benjamin Kosnik <bkoz@gnu.org>
+
+ * libioP.h: Remove fcntl.h include.
+
+2000-08-22 Benjamin Kosnik <bkoz@gnu.org>
+
+ * iofwide.c (_IO_fwide): Simplify, as nl_langinfo is assumed.
+
+2000-08-14 Benjamin Kosnik <bkoz@gnu.org>
+
+ * *: Merge with mainline glibc sources.
+ * filedoalloc.c (_IO_file_doallocate): Don't call
+ _IO_cleanup_registration_needed, even if not libc.
+ * iofwide.c (_IO_fwide): Correct placement of defines.
+ * cleanup.c: Remove.
+
+2000-08-04 benjamin kosnik <bkoz@haight.constant.com>
+
+ * genops.c (_IO_unbuffer_write): Don't call _IO_SETBUF if the
+ stream is not orientated.
+
+2000-08-04 Benjamin Kosnik <bkoz@gnu.org>
+
+ * Makefile.am (LIBIO_SRCS): Add c_codecvt.c
+
+2000-07-12 benjamin kosnik <bkoz@gnu.org>
+
+ * _G_config.h: Smoke less crack, don't define _G_HAVE_ST_BLKSIZE.
+
+2000-04-25 Benjamin Kosnik <bkoz@gnu.org>
+
+ * libio.h: Change decls for seekoff/seekpos.
+ * Makefile.am: Add bits to not generate _G_config.h on linux.
+ * gen-params: Remove sigset_t declaration.
+
+2000-02-29 Benjamin Kosnik <bkoz@gnu.org>
+
+ * Makefile.am (libio_headers): Strip out deadweight.
+
+2000-02-21 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * gen-params (CONFIG_NM): Specifically add in nm as the
+ default CONFIG_NM.
+
+2000-02-10 Benjamin Kosnik <bkoz@gnu.org>
+
+ * Makefile.am: Add bits for _G_config.h generation.
+ * gen-params: New file.
+
+2000-02-07 Benjamin Kosnik <bkoz@gnu.org>
+
+ * Makefile.am: Change license.
+
+1999-07-28 Benjamin Kosnik <bkoz@gnu.org>
+
+ * Makefile.am (libio_la_SOURCES): Remove cleanup.c, so that
+ _IO_cleanup will not be undefined.
+
+1998-11-26 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * configure.in (compiler_name): Add check to detect if this
+ language's compiler has been built.
+
+1998-10-12 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * config.shared (depend.new): delete libc-lock.h from
+ dependencies, and fix _G_config.h -> $(_G_CONFIG_H) rule
+ * depend: Rebuilt.
+
+Sun Oct 11 01:51:42 1998 Jeffrey A Law (law@cygnus.com)
+
+ * config.shared (depend.new): Fix typo.
+ * depend: Rebuilt.
+
+1998-09-09 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * configure.in (INSTALLDIR): Fix comment about changing INSTALLDIR's
+ value; don't change its value if --enable-version-specific-runtime-libs
+ has been specified.
+
+Wed Sep 2 21:05:39 1998 H.J. Lu (hjl@gnu.org)
+
+ * configure.in: Fix INSTALLDIR replacement for cross-compile.
+
+Sun Aug 30 22:27:02 1998 Lutz Wohlrab <lutz.wohlrab@informatik.tu-chemnitz.de>
+
+ * dbz/Makefile.in: Avoid assumptions about "tr" behaves when
+ LANG is set to something other than English.
+
+Sun Aug 30 22:17:00 1998 H.J. Lu (hjl@gnu.org)
+
+ * config.shared: Set libsubdir.
+
+1998-08-25 14:34 Ulrich Drepper <drepper@cygnus.com>
+
+ * libio/iogetline.c (_IO_getline_info): Don't read anything for
+ N == 0. Patch by HJ Lu.
+
+1998-08-23 Mark Mitchell <mark@markmitchell.com>
+
+ * iomanip.h: Use __extension__ for `extern' explicit template
+ instantiations.
+
+1998-08-17 Ulrich Drepper <drepper@cygnus.com>
+
+ * strfile.h: Define __PMT if not already defined.
+
+1998-08-03 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * libioP.h: Use __PMT in typedefs.
+ * strfile.h: Likewise.
+
+1998-06-29 Ulrich Drepper <drepper@cygnus.com>
+
+ * libio.h: Rewrite __PMT change so that it works with platforms
+ defining __P but not __PMT.
+
+ * libio.h (__PMT): New macro. Defined like __P. Use is for
+ function pointers.
+
+1998-06-27 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * Makefile.in (install): Remove superfluous /include.
+
+1998-06-26 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * config.shared (FLAGS_TO_PASS): Add gcc_version_trigger.
+ (Makefile): Add dependency upon $(gcc_version_trigger).
+
+1998-06-24 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * Makefile.in (install): Install _G_config.h depending on new flag
+ --enable-version-specific-runtime-libs.
+ * config/linux.mt (gxx_include_dir): Remove definition here as we use
+ gcc's default anyway.
+
+1998-06-24 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * config.shared (FLAGS_TO_PASS): Add gcc_version.
+
+1998-06-19 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * config.shared (FLAGS_TO_PASS): Add libsubdir.
+
+1998-06-07 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * genops.c (__underflow): Read character from read pointer as unsigned.
+ (__uflow): Likewise.
+
+1998-05-22 Ulrich Drepper <drepper@cygnus.com>
+
+ * strops.c (_IO_str_underflow): Read newly available character
+ from buffer as unsigned.
+
+Sun Apr 19 22:13:36 1998 H.J. Lu (hjl@gnu.org)
+
+ * isgetline.cc (istream::get): Fix a typo.
+
+Thu Mar 5 09:23:28 1998 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * configure.in: Make locating frag files failsafe even for the
+ special case if configuring and building in srcdir.
+
+1998-02-24 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ Changes for _G_IO_IO_FILE_VERSION == 0x20001:
+ * libioP.h (_IO_showmanyc_t, _IO_SHOWMANYC, _IO_imbue_t,
+ _IO_IMBUE): New definitions.
+ (struct _IO_jump_t): Add __showmanyc and __imbue fields.
+ (_IO_file_fopen): Add new fourth argument.
+ * filebuf.cc (filebuf::open): Pass new fourth argument to
+ _IO_file_fopen.
+ * iolibio.h (_IO_freopen): Likewise.
+ * streambuf.cc (streambuf::showmanyc, streambuf::imbue): New
+ functions.
+ * streambuf.h (_IO_wchar_t): Define to _G_wchar_t.
+ (ios::fill): Remove casts.
+ (struct streambuf): Add showmanyc and imbue members.
+
+ * iostream.cc (ostream::operator<<(double n)) [__GLIBC_MINOR__ >=
+ 1]: Initialize new fields is_char of struct printf_info.
+ (ostream::operator<<(long double n)) [__GLIBC_MINOR__ >= 1]:
+ Likewise.
+
+Sun Feb 22 17:24:53 1998 Jeffrey A Law (law@cygnus.com)
+
+ * config.shared: Bring back changes from Ian and Fred that were
+ accidentally clobbered. Should eliminate the need for Dave's
+ recent change.
+
+Tue Feb 17 21:56:25 1998 H.J. Lu (hjl@gnu.org)
+
+ * config/linux.mt (IO_OBJECTS): Add iogetline.o.
+ * config/linuxlibc1.mt: Ditto.
+
+ * iogetline.c (_IO_getline_info): Renamed from _IO_getline.
+ (_IO_getline): Just call _IO_getline_info.
+
+ * isgetline.cc (istream::getline, istream::get, _sb_readline):
+ Call _IO_getline_info instead of _IO_getline and get the EOF
+ information.
+ * sbgetline.cc (streambuf::sgetline): Ditto.
+
+ * libioP.h (_IO_getline_info): New declaration.
+
+ * iogetline.c (_IO_getline): Handle the case when there is no
+ buffer.
+
+Fri Feb 13 00:57:20 1998 Krister Walfridsson (cato@df.lth.se)
+
+ * fileops.c: #include <unistd.h>.
+ * ioprims.c: Likewise.
+
+1998-02-10 Mark Mitchell <mmitchell@usa.net>
+
+ * iostream.cc (ostream::operator<<(long double)): Don't use
+ labeled initializers.
+
+Fri Feb 6 01:35:56 1998 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * config.shared (FLAGS_TO_PASS): Don't emit PICFLAG.
+ (.c.o): Check value of enable_shared, not PICFLAG.
+ (.C.o): Dito.
+ (.cc.o): Dito.
+ (stamp-picdir): Dito.
+
+Thu Feb 5 17:41:26 1998 Dave Brolley <brolley@cygnus.com>
+
+ * config.shared (LIBS): Change to -L../../libstdc++ (was -L../libstdc++)
+ if ${DOING_GPERF} is true.
+
+1998-01-20 Andreas Schwab (schwab@issan.informatik.uni-dortmund.de)
+
+ * iostream.cc (istream::operator>>(long double&))
+ [!_G_HAVE_LONG_DOUBLE_IO]: Scan value into separate variable, in
+ case long double is bigger than double.
+ (ostream::operator<<(double)) [_G_HAVE_PRINTF_FP]: Fix order of
+ initializers of struct printf_info to match declaration order,
+ to work around g++ bug.
+ (ostream::operator<<(long double)) [_G_HAVE_PRINTF_FP]: Likewise.
+
+ * gen-params: Add missing quotes. Avoid useless use of command
+ substitution.
+
+Sun Feb 1 13:29:47 1998 H.J. Lu (hjl@gnu.org)
+
+ * filebuf.cc (filebuf::open): Call _IO_file_open if
+ _G_HAVE_IO_FILE_OPEN is 1.
+
+ * libio.h (_IO_fpos64_t, _IO_off64_t): Defined if
+ _G_IO_IO_FILE_VERSION == 0x20001.
+
+ * libioP.h (_IO_file_open): New declaration.
+
+ * libio.h (_IO_FILE, _IO_stdin_, _IO_stdout_, _IO_stderr_,
+ _IO_seekoff, _IO_seekpos): Add support for libio in glibc 2.1.
+ * libioP.h (_IO_seekoff_t, _IO_seekpos_t, _IO_seek_t,
+ _IO_seekoff, _IO_seekpos, _IO_default_seekoff,
+ _IO_default_seekpos, _IO_default_seek, _IO_file_seekoff,
+ _IO_file_seek, _IO_str_seekoff, _IO_pos_BAD, _IO_pos_as_off,
+ _IO_pos_0): Ditto.
+ * streambuf.h (streamoff, streampos): Ditto.
+
+ * gen-params (__extension__): Use only if gcc version >= 2.8.
+
+Sun Feb 1 13:08:18 1998 Krister Walfridsson (cato@df.lth.se)
+
+ * dbz/dbz.c (putconf): Handle systems which use "long long" as type
+ for "off_t".
+ * dbz/dbzmain.c (mkfiles): Likewise.
+
+Wed Jan 28 10:27:11 1998 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * config.shared (FLAGS_TO_PASS): Add gxx_include_dir.
+
+ * stdio/configure.in, tests/configure.in: Update with yesterday's
+ toplevel configure.in changes.
+ * testsuite/configure.in: Likewise.
+
+ * config.shared: Fix typo in yesterday's changes.
+
+Tue Jan 27 23:26:07 1998 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * config.shared: Emit everything which needs to be re-definable
+ via file descriptor 1; the generic stuff is emitted using redirection
+ onto fd 2.
+
+ * configure.in (package_makefile_rules_frag): New variable
+ which is used in the call to config.shared; redirect file descriptor 2
+ to ${package_makefile_rules_frag}.
+
+Tue Jan 27 10:35:22 1998 H.J. Lu (hjl@gnu.org)
+
+ * configure.in (topsrcdir): New.
+ (CHECK_SUBDIRS, configdirs): Check ${topsrcdir}/gcc instead.
+ (config-ml.in): Use ${topsrcdir}/config-ml.in.
+
+ * tests/configure.in (topsrcdir): New.
+ (CHECK): Check ${topsrcdir}/gcc instead.
+
+Fri Jan 16 00:48:03 1998 Manfred Hollstein <manfred@lts.sel.alcatel.de>
+
+ * config.shared (FLAGS_TO_PASS): Add SHELL.
+
+Thu Jan 15 00:21:58 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure.in: For *-*-cygwin32*, add a -I for winsup to both
+ XCINCLUDES and XCXXINCLUDES.
+ * config.shared: Use ${host_includes} when setting CXXINCLUDES in
+ the DOING_LIBGXX case.
+ * Makefile.in (_G_config.h): Pass $(CINCLUDES) in CC and
+ $(CXXINCLUDES) in CXX when running gen-params.
+
+Tue Jan 13 21:32:08 1998 H.J. Lu (hjl@gnu.org)
+
+ * configure.in (CHECK_SUBDIRS): Set to testsuite only if
+ ${srcdir}/../gcc exists.
+ (configdirs): Include testsuite only if ${srcdir}/../gcc exists.
+
+ * tests/Makefile.in (check): Depend on $(CHECK).
+
+ * tests/configure.in (CHECK): Set to "check-iostream
+ check-stdio" if ${srcdir}/../../gcc doesn't exists.
+
+Thu Jan 8 18:09:03 1998 Fred Fish <fnf@cygnus.com>
+
+ * config.shared (THIS_FILE): Really found via TOLIBIO instead
+ of TOLIBCXX, which is empty when configuring gperf.
+ (LIBS): When linking gperf, find libstdc++ relative to TO_TOPDIR
+ instead of hardcoded "../".
+
+1997-12-12 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ Don't make gperf depend upon libg++.
+ * config.shared (TOLIBGCXX) [DOING_GPERF]: Delete.
+ (LIBS) [DOING_GPERF]: Make it just `-L../libstdc++ -lstdc++'.
+
+Thu Dec 11 11:20:59 1997 H.J. Lu (hjl@gnu.org)
+
+ * configure.in (target frags): Add *-linux-gnu.
+
+Fri Dec 5 16:22:15 1997 H.J. Lu (hjl@gnu.org)
+
+ * streambuf.cc (streambuf::~streambuf): Don't delete _lock
+ for _IO_stdin/_IO_stdout/_IO_stderr.
+
+Thu Nov 27 01:32:43 1997 Jeffrey A Law (law@cygnus.com)
+
+ * Makefile.in (install): Change gxx_includedir to gcc_include_dir.
+ * config.shared (gxx_includedir): Remove default definition.
+ * config/linux.mt: Change gxx_includedir to gxx_include_dir.
+ * config/linuxaxp1.mt: Likewise.
+
+Wed Nov 26 16:08:50 1997 Richard Henderson (rth@cygnus.com)
+
+ * configure.in (target frags): Add powerpc*-linux-gnulibc1.
+ (stdio-lock): Similarly.
+
+ * configure.in (target frags): Add alpha*-linux-gnulibc1.
+ (pic frags): Its alpha*- not alpha-.
+ (stdio-lock): Kill everything. Add alpha*-linux-gnulibc1.
+ * libio.h: Check __GLIBC_MINOR__ to find stdio-lock.h. If not
+ _IO_MTSAFE_IO & GLIBC, make sure the lock pointer is still there.
+ * libioP.h: Check __GLIBC_MINOR__ to find libc-lock.h.
+
+ * config/linuxaxp1-libc-lock.h: New file.
+ * config/linuxaxp1-stdio-lock.h: New file.
+ * config/linuxaxp1.mt: New file.
+
+ * gen-params (va_list): Check for and use __gnuc_va_list.
+ (NULL): Work around some linux kernel headers and redefine NULL.
+
+Mon Nov 24 17:04:18 1997 Michael Meissner <meissner@cygnus.com>
+
+ * stdiostream.cc (sys_read): Declare ch with int type, rather than
+ without a type.
+
+Tue Nov 18 09:53:58 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
+
+ * stdstrbufs.cc (DEF_STDFILE): Use STD_VTABLE.
+
+Tue Nov 11 01:40:17 1997 Oleg Krivosheev <kriol@fnal.gov>
+
+ * iomanip.h: Fix guiding decls.
+
+1997-11-05 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * libio.h (__P): Name its arg `p' instead of `params'.
+ Avoids problems with an unchanged Solaris math.h header.
+
+Wed Oct 29 23:01:47 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * gen-params: Override NULL.
+
+1997-10-27 03:53 Ulrich Drepper <drepper@cygnus.com>
+
+ * stdio-lock.h: Removed. Was never needed.
+
+Wed Oct 22 19:19:32 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
+
+ * libio.h (_IO_LOCK_T): Handle glibc 2 when _IO_MTSAFE_IO is
+ not defined.
+
+ * iovsscanf.c (vsscanf): Make it weak alias of _IO_vsscanf if
+ __linux__ is defined instead of __ELF__
+
+ * config/linuxlibc1.mt (USER_INCLUDES): Add libio.h.
+
+1997-10-15 Ulrich Drepper <drepper@cygnus.com>
+
+ * configure.in: Create compatibility code in bits/libc-lock.h file.
+
+Thu Oct 9 07:08:41 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
+
+ * libio.h (_IO_LOCK_T): Handle glibc 2 when _IO_MTSAFE_IO is
+ not defined.
+
+ * filedoalloc.c (_IO_file_doallocate): Don't call
+ _IO_cleanup_registration_needed if __linux__ is defined.
+
+ * iofclose.c (fclose): Make it weak alias of _IO_fclose if
+ __ELF__ is defined.
+
+ * iovsprintf.c (vsprintf): Make it weak alias of _IO_vsprintf
+ if __ELF__ is defined.
+
+ * iovsscanf.c (vsscanf): Make it weak alias of _IO_vsscanf if
+ __ELF__ is defined.
+
+ * config/linuxlibc1.mt (MT_CFLAGS): Defined as -D_G_HAVE_MMAP.
+ (IO_OBJECTS): Add filedoalloc.o fileops.o genops.o iofclose.o
+ iovsprintf.o iovsscanf.o strops.o.
+
+Fri Oct 3 10:13:13 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * iostream.cc, libio.h: Convert other uses of #ifdef
+ _G_HAVE_PRINTF_FP to #if.
+
+1997-10-02 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * iostream.cc (operator<<): Use `#if _G_HAVE_PRINTF_FP', not ifdef.
+
+Thu Oct 2 10:36:49 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * gen-params: Fix __printf_fp test.
+ * config/linuxlibc1.mt (gxx_includedir): Don't define.
+
+Thu Oct 2 10:36:26 1997 Ulrich Drepper <drepper@rtl.cygnus.com>
+
+ * config/linuxlibc1.mt (_G_CONFIG_H): Don't define.
+ * gen-params: Add test for __printf_fp.
+
+Sun Sep 28 12:09:04 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * iomanip.h: Use new friend <> syntax.
+
+Sun Sep 28 12:04:21 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * libio.h: Don't use _IO_LOCK_T if it's not defined.
+
+Fri Sep 26 20:56:41 1997
+
+ Based on a patch by H.J. Lu (hjl@gnu.ai.mit.edu).
+
+ * Makefile.in (STDIO_OBJECTS): New. Defined as stdfiles.o.
+ (LIBIO_OBJECTS): Add $(STDIO_OBJECTS).
+ (PICFLAG): New, empty. moved to here from config.shared.
+
+ * config.shared (DISTCLEAN): Add target-mkfrag.
+ (PICFLAG): Removed.
+
+ * configure.in (*-linux-gnulibc1): Remove warning.
+ (*-linux-gnu): Use linux.mt mtsafe.mt.
+ (alpha-*-linux*): Use mh-elfalphapic.
+
+ * gen-params (_G_ullong): Also check unsigned long long int.
+ (_G_llong): Also check long long int.
+
+ * libio.h (_IO_lock_t): Add support for the Linux libc 5.
+ (_IO_peekc): Defined as _IO_peekc_unlocked if _IO_MTSAFE_IO
+ is not defined.
+
+ * iostream.cc (__cvt_double): Fix a typo in declaration.
+ (info): Use expr != 0 to initialize the bit fields. Don't
+ initialize "extra" for the Linux libc 5.
+
+ * streambuf.h (_G_NEED_STDARG_H): Changed from _IO_NEED_STDARG_H.
+
+ * config/linux.mt (STDIO_OBJECTS): New, empty.
+ (MT_CFLAGS): Removed.
+
+ * config/linuxlibc1.mt: Rewrite. it's identical to linux.mt but
+ IO_OBJECTS mentions files not in early libc5 versions.
+
+ * config/mtsafe.mt: New.
+
+ * dbz/Makefile.in (check): Support make -j.
+
+ * tests/tFile.cc (tempfile): Fix a typo.
+
+1997-09-19 11:52 Jim Wilson <wilson@cygnus.com>
+
+ * Makefile.in (LIBIO_OBJECTS): Depend on _G_CONFIG_H.
+
+1997-09-17 04:08 Ulrich Drepper <drepper@cygnus.com>
+
+ * iostream.cc: Add forward declaration for __cvt_double.
+ * libio.h: Define _IO_USE_DTOA is _G_HAVE_PRINTF_FP is not defined.
+ * strops.c (_IO_str_count): Correct last change.
+
+1997-09-17 02:50 Ulrich Drepper <drepper@cygnus.com>
+
+ * libioP.h: Define __set_errno if not already defined.
+
+1997-09-15 02:37 Ulrich Drepper <drepper@cygnus.com>
+
+ * config/linux.mt: Rewrite for use with glibc 2.
+ * config/linuxlibc1.mt: Old content of linux.mt, fir libc4 and
+ libc5.
+
+ * config.shared (COMPILE.c): Allow new flags in MT_CFLAGS be
+ passed.
+ (COMPILE.cc): Likewise.
+
+ * configure.in (*-linux*): Remove goal. We now have...
+ (*-linux-gnulibc1): For libc4 and libc5. Emit warning.
+ (*-linux-gnu)): For glibc 2.
+ Create links to find headers for multi-threading if necessary.
+
+ * fileops.c: Make thread-safe by using _IO_cleanup_region_start
+ etc to handle cancelation. Acquire locks in functions which are
+ called directly.
+ (_IO_file_read, _IO_file_write): Remove dead code.
+
+ * include/empty.h: Define stub macros for locking.
+
+ * iolibio.h: Add prototypes for obstack printing functions.
+
+ * ioseekoff.c (_IO_seekoff): Lock stream before working.
+ * ioseekpos.c (_IO_seekpos): Likewise.
+
+ * iostream.cc: Add support for long double I/O.
+ Use __printf_fp from glibc is available.
+ Use _IO_cleanup_region_start to handle cancelation correctly.
+ * iostream.h (class ostream): Change opfx and osfx to lock/unlock
+ stream
+ (class istream): Likewise for ipfx, ipfx0, ipfx1, and isfx.
+ Declare new function lock and unlock for ostream and istream.
+ * osform.cc: Use _IO_cleanup_region_start to handle cancelation
+ correctly.
+
+ * libio.h: Update from glibc version. Pretty printing.
+ * libioP.h: Likewise.
+
+ * outfloat.c: Only compile if _IO_USE_DTOA is defined.
+
+ * stdio/feof.c: Make thread safe.
+ * stdio/ferror.c: Likewise.
+ * stdio/getc.c : Likewise.
+ * stdio/putc.c : Likewise.
+ * stdio/stdio.h: Declare function of thread-safe API.
+
+ * stdio/obprintf.c: New file.
+ * stdio/vasprintf.c: New file.
+
+ * stdio-lock.h: Removed.
+
+ * stdstrbufs.c: Add definitions for thread-safe streams.
+
+ * streambuf.cc: Initialize lock.
+
+ * strops.c (_IO_str_count): Undo last change.
+
+ * tests/tFile.cc: Support parallel builds by avoiding fixed
+ name for test file.
+
+Thu Sep 11 18:43:56 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * Makefile.in (iostream.list): Remove STDIO_WRAP_OBJECTS.
+
+Mon Sep 8 01:30:27 1997 Weiwen Liu <liu@hepunix.physics.yale.edu>
+
+ * libio.h: Fix typo.
+
+Sun Sep 7 23:00:18 1997 Jim Wilson (wilson@cygnus.com)
+
+ * linux.mt (LIBIOSTREAM_DEP): Change stdio.list to stmp-stdio.
+
+Fri Sep 5 09:58:43 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * Makefile.in (iostream.list): Instead of adding stdio.list, add
+ STDIO_WRAP_OBJECTS.
+ (iostream.list): Lose dependency on stmp-stdio, not necessary for
+ our stuff. The stdio stuff is present here just for uniformity
+ with glibc.
+
+Thu Sep 4 17:26:22 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parsestream.cc (general_parsebuf): Cast return of malloc to char*.
+
+1997-09-04 16:11 Ulrich Drepper <drepper@cygnus.com>
+
+ Change compared to version initially intended to in:
+ * strops.c (_IO_str_count): Still use _IO_write_ptr, not
+ _IO_write_end, for now.
+
+ * iofeof.c, ioferror.c, iofflush_u.c, iogetc.c, ioputc.c, peekc.c,
+ stdio-lock.h: New files.
+
+ * include: New dir.
+ * include/empty.h: New header.
+
+ * filedoalloc.c: Update and reformat copyright.
+ Don't use DEFUN.
+ Use __set_errno throughout the code to support multi-threaded
+ programs.
+ Correct layout to follow the Coding Standard.
+ Add casts to prevent warnings.
+ * fileops.c: Likewise.
+ * genops.c: Likewise.
+ * iofclose.c: Likewise.
+ * iofdopen.c: Likewise.
+ * iofflush.c: Likewise.
+ * iofgetpos.c: Likewise.
+ * iofgets.c: Likewise.
+ * iofopen.c: Likewise.
+ * iofprintf.c: Likewise.
+ * iofputs.c: Likewise.
+ * iofread.c: Likewise.
+ * iofsetpos.c: Likewise.
+ * ioftell.c: Likewise.
+ * iofwrite.c: Likewise.
+ * iogetdelim.c: Likewise.
+ * iogetline.c: Likewise.
+ * iogets.c: Likewise.
+ * iopadn.c: Likewise.
+ * iopopen.c: Likewise.
+ * ioputs.c: Likewise.
+ * ioseekoff.c: Likewise.
+ * iosetbuffer.c: Likewise.
+ * iosetvbuf.c: Likewise.
+ * iosprintf.c: Likewise.
+ * ioungetc.c: Likewise.
+ * iovsprintf.c: Likewise.
+ * iovsscanf.c: Likewise.
+ * libio.h: Likewise.
+ * libioP.h: Likewise.
+ * stdfiles.c: Likewise.
+ * strfile.h: Likewise.
+ * strops.c: Likewise.
+
+ * Makefile.in (IO_OBJECTS): Add peekc.o, iogetc.o, ioputc.o,
+ iofeof.o, and ioferror.o.
+ (iostream.list): Depend upon stmp-stdio. Add the entries
+ from stdio.list to iostream.list.
+ (stmp-stdio): New name for what was the stdio/stdio.list rule.
+ All it now does is cd down into stdio and build stdio.list.
+
+ * configure.in (ALL): Add libiostream.a.
+
+ * libio.h [_IO_MTSFE_IO]: Include header declaring locking code.
+ Otherwise define opaque _IO_lock_t.
+ Define _IO_cookie_file.
+ Rename _IO_getc to _IO_getc_unlocked, _IO_peekc to _IO_peekc_unlocked,
+ _IO_putc to _IO_putc_unlocked, _IO_feof to _IO_feof_unclocked, and
+ _IO_ferror to _IO_ferror_unlocked.
+ Add prototypes for _IO_getc, _IO_putc, _IO_feof, _IO_ferror,
+ and _IO_peekc_locked.
+ Add declarations for _IO_flockfile, _IO_funlockfile, and
+ _IO_ftrylockfile. If !_IO_MTSAFE_IO define _IO_flockfile,
+ _IO_funlockfile, _IO_ftrylockfile, _IO_cleanup_region_start, and
+ _IO_cleanup_region_end as empty macros.
+
+ * libioP.h: Change type of finish function to take an additional int
+ argument and change declaration of finish functions.
+ Add prototypes for _IO_seekoff and _IO_seekpos.
+ If _G_HAVE_MMAP is defined use stream buffers allocated with mmap.
+ Redefine FREE_BUF and ALLOC_BUF macros to help in both situations.
+ (FILEBUF_LITERAL): If we compile for a thread-safe library also
+ initialize lock member.
+
+ * filedoalloc.c: Take care for systems already defining _POSIX_SOURCE.
+ Keep name space clean on systems which require this.
+ (_IO_file_doallocate): Adopt ALLOC_BUF call for changed semantic.
+
+ * fileops.c: Keep name space clean on systems which require this.
+ (_IO_file_attach): Don't fail if seek failed because it's used on a
+ pipe.
+ (_IO_file_underflow): Update buffer pointers before calling `read'
+ since the `read' might not return anymore.
+ (_IO_file_overflow): If stream allows no writes set error flag.
+ (_IO_seekoff): Make sure that after flushing the file pointer in
+ the underlying file is exact.
+ (_IO_file_read): Don't restart `read' syscall if it return EINTR.
+ This violates POSIX.
+ (_IO_file_write): Likewise for `write'.
+ (_IO_cleanup): Install as exit handler in glibc.
+
+ * genops.c (_IO_setb): Correctly use FREE_BUF.
+ (_IO_default_doallocate): Correctly use ALLOC_BUF.
+ (_IO_init): Initialize lock in stream structure.
+ (_IO_default_finish): Destroy lock.
+ (_IO_get_column): Don't compile since it's not needed.
+ (_IO_nobackup_default): Likewise.
+
+ * iopopen.c: Take care for systems already defining _POSIX_SOURCE.
+ Correct _IO_fork and _IO_dup2 prototypes.
+
+ * iofclose.c: Acquire lock before starting the work.
+ * iofflush.c: Likewise.
+ * iofgetpos.c: Likewise.
+ * iofgets.c: Likewise.
+ * iofputs.c: Likewise.
+ * iofread.c: Likewise.
+ * iofsetpos.c: Likewise.
+ * ioftell.c: Likewise.
+ * iofwrite.c: Likewise.
+ * iogetdelim.c: Likewise.
+ * iogets.c: Likewise.
+ * ioputs.c: Likewise.
+ * iosetbuffer.c: Likewise.
+ * iosetvbuf.c: Likewise.
+ * ioungetc.c: Likewise.
+
+ * iofdopen.c: Create and initialize lock for new stream.
+ * iofopen.c: Likewise.
+ * iopopen.c (_IO_popen): Likewise.
+ * iovsprintf.c: Likewise.
+ * iovsscanf.c: Likewise.
+
+ * genops.c: Make weak aliases for various functions.
+ * iofclose.c: Likewise.
+ * iofdopen.c: Likewise.
+ * iofflush.c: Likewise.
+ * iofgetpos.c: Likewise.
+ * iofgets.c: Likewise.
+ * iofopen.c: Likewise.
+ * iofputs.c: Likewise.
+ * iofread.c: Likewise.
+ * iofsetpos.c: Likewise.
+ * ioftell.c: Likewise.
+ * iofwrite.c: Likewise.
+ * iogetdelim.c: Likewise.
+ * iogets.c: Likewise.
+ * ioputs.c: Likewise.
+ * iosetbuffer.c: Likewise.
+ * iosetvbuf.c: Likewise.
+ * ioungetc.c: Likewise.
+ * iovsprintf.c: Likewise.
+ * iovsscanf.c: Likewise.
+
+ * iofflush_u.c: New file. fflush_unlocked implementation.
+
+ * iostream.h [_G_HAVE_LONG_DOUBLE_IO]: Declare real long double
+ output operator.
+
+ * peekc.c: New file. Implement _IO_peekc_locked function.
+
+ * stdfiles.c: If we compile for a thread-safe library also define
+ lock variable.
+
+Tue Aug 26 12:24:01 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
+
+ * testsuite/Makefile.in (check): Don't depend on site.exp.
+ (just-check): Depend on site.exp.
+
+Wed Aug 20 02:01:34 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * iostream.h: Add copy assignment ops for _IO_?stream_withassign.
+
+Tue Jul 22 10:31:41 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * config.shared (CHECK_SUBDIRS): Use install-sh, not install.sh.
+
+Wed Jun 25 12:20:55 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * config.shared (DOING_GPERF): Look for this, defining TOLIBGXX
+ and LIBS for it.
+
+Wed Jun 18 11:03:34 1997 Bob Manson <manson@charmed.cygnus.com>
+
+ * config.shared (FLAGS_TO_PASS): Don't include RUNTEST.
+
+Tue Jun 17 22:23:48 1997 Bob Manson <manson@charmed.cygnus.com>
+
+ * config.shared (FLAGS_TO_PASS): Pass RUNTEST and RUNTESTFLAGS.
+
+Fri May 16 21:08:53 1997 Bob Manson <manson@charmed.cygnus.com>
+
+ * iovfprintf.c: Declare __cvt_double before use.
+
+ * floatconv.c (d2b): Use _G_int32_t instead of int for the
+ e and bits parameters.
+ (_IO_strtod): Use _G_int32_t.
+
+ * gen-params: Look for NO_USE_DTOA and USE_INT32_FLAGS.
+
+ * strops.c (_IO_str_init_static): use _G_int32_t appropriately.
+
+ * libio.h: If _G_NO_USE_DTOA is set, then don't define
+ _IO_USE_DTOA.
+
+ * config/mn10200.mt: Don't use dtoa, it only works
+ for "real" doubles.
+
+Thu May 15 17:44:12 1997 Bob Manson <manson@charmed.cygnus.com>
+
+ * configure.in: Set CHECK_SUBDIRS to testsuite if we're doing
+ a cross compile.
+
+ * config.shared(check): Only run make check in the directories
+ specified by CHECK_SUBDIRS. Set CHECK_SUBDIRS to SUBDIRS
+ if it has no previous value.
+
+Thu May 1 17:35:19 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * Makefile.in (test, tpipe): Add $(CFLAGS).
+
+Wed Apr 30 12:16:29 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * configure.in: Don't turn on multilib here.
+
+Sat Apr 26 13:38:21 1997 Bob Manson <manson@charmed.cygnus.com>
+
+ * configure.in (configdirs): Add testsuite directory.
+
+ * testsuite/ChangeLog:
+ * testsuite/Makefile.in:
+ * testsuite/libio.tests/tiomanip.exp:
+ * testsuite/libio.tests/tstdiomisc.exp:
+ * testsuite/libio.tests/tiomisc.exp:
+ * testsuite/libio.tests/tFile.exp:
+ * testsuite/libio.tests/tfformat.exp:
+ * testsuite/libio.tests/tiformat.exp:
+ * testsuite/libio.tests/hounddog.exp:
+ * testsuite/libio.tests/putbackdog.exp:
+ * testsuite/configure.in:
+ * testsuite/lib/libio.exp:
+ * testsuite/config/default.exp:
+ New files for DejaGnu-style testsuite.
+
+Fri Apr 4 03:16:44 1997 Ulrich Drepper <drepepr@cygnus.com>
+
+ * configure.in: Enable multilibing by default.
+ Update multilib template to read config-ml.in.
+
+ * floatconv.c: Enable use in cross targets which use the
+ newlib ieeefp.h header.
+
+Thu Jan 23 09:16:16 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * libioP.h (_IO_file_attach): Delete redundant decl.
+
+Tue Jan 21 22:13:45 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * streambuf.h (class ios): Take out STREAMSIZE member, since we
+ only need (and should only have) the global one.
+
+Tue Jan 7 14:02:40 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * iostream.h (long long fns): Use __extension__.
+
+ * gen-params: Use _G_llong and _G_ullong instead of long long for
+ deduced types.
+
+Fri Dec 6 13:13:30 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * dbz/dbz.c: Use off_t.
+
+Sat Nov 23 15:44:37 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * Makefile.in (install): Don't install _G_config.h with other headers.
+
+Mon Nov 18 17:12:41 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * config.shared (SUBDIRS): Use -O instead of -O3 for debugging.
+
+Sun Nov 3 12:43:34 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * iostream.cc (write_int): Treat string literals as const.
+
+Thu Sep 26 10:09:18 1996 Michael Meissner <meissner@tiktok.cygnus.com>
+
+ * depend: Regenerate.
+
+Wed Sep 25 22:54:45 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * config.shared (depend.new): Deal with headers that don't end in .h.
+
+Thu Aug 29 17:05:53 1996 Michael Meissner <meissner@tiktok.cygnus.com>
+
+ * configure.in (i[345]86-*-*): Recognize i686 for pentium pro.
+
+Mon Aug 5 01:26:32 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * config{ure.in,.shared} (DISTCLEAN): Add multilib.out.
+
+Fri Aug 2 17:39:35 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * libio.h (NULL): Use __null.
+ * libioP.h (NULL): Ditto.
+ * streambuf.h (NULL): Ditto.
+ * ioextend.cc (get_array_element): Use NULL instead of (void*)0.
+
+Fri Jul 5 18:26:41 1996 Jim Wilson <wilson@cygnus.com>
+
+ * strfile.h (struct _IO_streambuf): New struct type.
+ (struct _IO_strfile): Use it.
+
+Tue Jun 18 18:24:21 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * fstream.h (fstreambase): Make __my_fb mutable.
+ From Joe Buck.
+
+Tue Jun 18 11:03:53 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * dbz/fake.c (main): Set return type to int.
+ * dbz/dbzmain.c (main): Likewise.
+ * dbz/byteflip.c (main): Likewise.
+
+Mon Jun 17 14:05:36 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * gen-params: Check if clog conflicts with system libraries.
+ * stdstreams.cc: If it does, use __IO_clog.
+ * iostream.h: Likewise.
+
+Tue Jun 11 13:39:31 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * stdiostream.h (istdiostream (FILE*)): Put istream base
+ initializer before init for __f.
+ (ostdiostream (FILE*)): Likewise for ostream base init.
+
+Tue May 14 11:47:21 1996 Per Bothner <bothner@andros.cygnus.com>
+
+ * strfile.h (_IO_str_fields): Removed _len field.
+ (_IO_STR_DYNAMIC, _IO_STR_FROZEN): new macros.
+ * strstream.h (strstreambuf::is_static): Removed.
+ (strstreambuf::frozen): Use _IO_STR_DYNAMIC instead of is_static.
+ * strstream.h, strstream.cc: Remove support for !_IO_NEW_STREAMS.
+ * strstream.cc (strstreambuf::init_dynamic): Don't set _s._len.
+ * strops.c (_IO_str_init_static): Better handling of the
+ negative (== unbounded) size case.
+ (_IO_str_overflow, _IO_str_underflow, _IO_str_count): Re-write
+ to not use _s._len, and otherwise cleanup/fix.
+ * strstream.h, strstream.cc (strstreambase::strstreambase()): Call
+ ios::init here.
+ (other constructors): Simplify - init already called.
+
+Tue May 14 10:55:21 1996 Per Bothner <bothner@deneb.cygnus.com>
+
+ Change so that strstreambuf default constructor does no allocation.
+ * strstream.h (strstreambuf::init_dynamic): Default initial size = 0.
+ * strstream.cc (strstreambuf::init_dynamic): Don't allocate a
+ buffer (yet) if initial_size is 0.
+ * strops.c (_IO_str_overflow): Add 100 to size of re-allocated
+ buffer, to handle case when initial size is 0.
+
+ * iostdio.h (remove, rename, tmpfile, tempnam): Comment out.
+
+Mon May 13 23:19:39 1996 Per Bothner <bothner@deneb.cygnus.com>
+
+ * fileops.c (_IO_file_close_it): Just call _IO_do_flush rather
+ than _IO_file_sync, to avoid useless lseek.
+
+Tue May 14 10:48:48 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * floatconv.c (_IO_strtod): Force rv into the stack.
+
+ * config.shared (gxx_includedir): Now $(includedir)/g++.
+
+Sat Apr 27 02:37:49 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * libioP.h (JUMP*): Implement for thunks.
+ (_IO_jump_t): Add second dummy field for thunks.
+
+Thu Apr 25 13:20:00 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * config.shared (CXX): Use gcc, not g++.
+
+Wed Apr 24 10:29:50 1996 Doug Evans <dje@blues.cygnus.com>
+
+ * config.shared (depend.new): Delete $(srcdir)/ from foo.{c,cc}
+ for SunOS VPATH.
+ * depend: Regenerated.
+
+Fri Apr 19 17:24:51 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * Version 2.8.0b3.
+
+Wed Apr 10 17:16:01 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * configure.in (ALL): Don't build iostream.a.
+
+Mon Apr 8 14:44:11 1996 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * iosetvbuf.c (_IO_setvbuf): Clear _IO_UNBUFFERED unless _IONBF.
+
+Mon Apr 8 15:08:23 1996 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure.in: Permit --enable-shared to specify a list of
+ directories.
+
+Fri Apr 5 17:48:56 1996 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * config.shared (MOSTLYCLEAN): Also remove ${EXTRA_MOSTLYCLEAN}.
+
+Fri Mar 22 23:25:00 1996 Ulrich Drepper <drepepr@gnu.ai.mit.edu>
+
+ * genops.c (_IO_sputbackc, _IO_sungetc): Clear EOF flag if putsh
+ back was successful.
+
+Wed Mar 27 11:54:08 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * Version 2.8.0b2.
+
+Fri Mar 22 15:39:36 1996 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * fileops.c (_IO_do_write): Revert previous fix. (It fails to
+ handle the case that fp->_IO_read_end != fp->_IO_write_base.)
+ (_IO_file_overflow): Instead, if _IO_read_ptr is at the end of
+ the buffer, reset all the read pointers to _IO_buf_base.
+
+Tue Mar 12 12:03:17 1996 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * fileops.c (_IO_do_write): Even if to_do==0, must re-set buffer
+ pointers. Bug and solution from Luke Blanshard <luke@cs.wisc.edu>.
+
+Wed Feb 28 10:00:24 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * Version 2.8.0b1.
+
+Tue Feb 27 18:08:16 1996 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * iopopen.c (_IO_proc_open): Use (char*)0 rather than imprecise NULL.
+
+ * streambuf.h (ios): Add ios::binary; deprecate ios::bin.
+ * filebuf.cc (filebuf::open): Handle ios::binary.
+
+Fri Feb 9 12:40:19 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cleanup.c (_IO_cleanup_registration_needed) [!_G_HAVE_ATEXIT]: Init
+ to NULL.
+ * filedoalloc.c (_IO_cleanup_registration_needed): Remove decl.
+
+Thu Feb 8 08:12:50 1996 Brendan Kehoe <brendan@cygnus.com>
+
+ * filedoalloc.c (_IO_cleanup_registration_needed): Revert previous
+ change, since cleanup.c only defines it if _G_HAVE_ATEXIT.
+
+Wed Feb 7 15:10:17 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * filedoalloc.c (_IO_cleanup_registration_needed): Declare as extern.
+
+Tue Dec 12 17:21:13 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * indstream.h, instream.cc (indirectbuf::uflow): New method.
+ * indstream.cc (indirectbuf::underflow): Fix to use sgetc, not sbumpc.
+ Fixes bug reported by Kevin Beyer <beyer@cs.wisc.edu>.
+
+ * indstream.cc (indirectbuf::seekpos): Add paranoia test.
+
+Fri Dec 8 14:55:34 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * stream.h: Add warning to not use these functions.
+ * stream.cc (str, chr): Re-implement here (from libg++).
+
+Tue Nov 28 15:07:01 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * config.shared: Use test instead of [ to avoid DEC Unix lossage.
+
+Thu Nov 23 14:51:43 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * iopopen.c: Move #include <sys/types.h> ahead of #include <signal.h>
+ to deal with BSDI's literal implementation of Posix.
+
+Sat Nov 25 11:21:55 1995 Doug Evans <dje@canuck.cygnus.com>
+
+ * Makefile.in (install): Set rootme.
+ * config.shared (TOPDIR): Set with ${foo-...} rather than ${foo=...}.
+ (INSTALL): Handle absolute, dot, relative-not-dot values of srcdir.
+ (TEXIDIR): Likewise.
+
+Tue Nov 21 14:12:05 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure.in: Check ${with_cross_host} rather than comparing
+ ${host} and ${target}.
+
+Mon Nov 20 13:55:29 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * configure.in: Match *-sco3.2v[45]*.
+
+Wed Nov 15 20:19:31 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * config.shared (FLAGS_TO_PASS): Also pass SHLIB and SHCURSES.
+
+Tue Nov 14 01:41:08 1995 Doug Evans <dje@canuck.cygnus.com>
+
+ * config.shared (TO_REAL_TOPDIR): Define.
+ (MULTITOP): Deleted.
+ (MULTISRCTOP, MULTIBUILDTOP): New.
+ (TOPDIR): Change MULTITOP to MULTIBUILDTOP, and use TO_REAL_TOPDIR.
+ (INSTALL): Add with_multisrctop, TO_REAL_TOPDIR.
+ (TEXIDIR): Use TO_REAL_TOPDIR.
+ (LIBS): Delete MULTITOP.
+ (FLAGS_TO_PASS): Add NM.
+ (CXXINCLUDES): Delete MULTITOP.
+ (depend.new): Delete adding MULTITOP to ../ build tree references.
+ Add MULTISRCTOP to ../ source tree references.
+ * configure.in: Delete call to cfg-ml-com.in. Call config-ml.in
+ instead of cfg-ml-pos.in.
+
+Sun Nov 12 16:30:48 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * Makefile.in (VERSION): Set to 2.7.1.
+ * configure.in: Add warning for Linux.
+ * config.shared (DISTCLEAN): Add EXTRA_DISTCLEAN.
+
+ * editbuf.h (edit_mark::index_in_buffer): Avoid unused param warning.
+
+ * iostream.cc (istream::operator>> (char*)): Improve ANSI compliance.
+
+Fri Nov 10 08:41:37 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * config.shared (check): Add missing semicolon.
+
+Thu Nov 9 17:27:22 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * configure.in (ALL): Remove $(OSPRIM_OBJECTS).
+ * config.shared (check): Set LD_LIBRARY_PATH.
+ * NEWS: Fix typo.
+ * iogetdelim.c (_IO_getdelim): Index *lineptr, rather than lineptr.
+ From alan@spri.levels.unisa.edu.au (Alan Modra).
+
+Mon Nov 6 15:03:33 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * streambuf.cc, editbuf.cc, isgetline.cc, parsestream.cc:
+ Fixes to avoid -Wall warnings.
+
+Fri Nov 3 16:41:41 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * gen-params [!__STDC__]: Include varargs.h instead of stdarg.h.
+
+Thu Nov 2 15:04:03 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * config.shared: Re-write if X then Y else true fi to (not X) || Y.
+
+Wed Nov 1 13:26:44 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * iostream.h (istream::ipfx): Add default argument value.
+ Reported by Yotam Medini <yotam_medini@tmai.com>.
+
+ * libioP.h (_IO_blen): Fix typo.
+ Reported by Bryan T. Vold <btv@ldl.healthpartners.com>.
+
+Fri Oct 27 19:26:20 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * Makefile.in (_G_config.h): Set CC to $(CC) rather than to $(CXX),
+ now that CXX defaults to g++ and CC default to gcc (when found).
+ * config.shared: Simplify CXX and CC, since they get overridden
+ by ../configure anyway.
+
+Wed Oct 25 19:45:50 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * iostdio.h: Wrap including the file with #ifndef _IOSTDIO_H.
+
+Wed Oct 25 11:14:25 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * libio.h (_IO_seekoff, _IO_seekpos): New declarations.
+ * libioP.h (_IO_seekoff, _IO_seekpos): Remove declarations.
+ * libioP.h: Cleanup; remove old !_IO_UNIFIED_JUMPTABLES stuff.
+
+ * filebuf.cc (filebuf::~filebuf): Only call SYSYCLOSE if currently
+ open. Bug found by Martin Gerbershagen <ger@ezis-ulm.de>.
+
+ * streambuf.h (streambuf::pubseekoff, streambuf::pubseekpos):
+ Added, from ANSI draft.
+ * filebuf.cc (filebuf::open), iostream.cc (variables places), SFile.cc:
+ Use pubseekoff/pubseekpos rather than sseekoff/sseekpos.
+
+ * Makefile.in (install): Don't install libiostream.a.
+
+ * filedoalloc.c: Also #include <unistd.h>.
+
+Mon Oct 9 18:09:54 1995 Jason Molenda <crash@phydeaux.cygnus.com>
+
+ * config.shared (SUFFIXES): add .c.
+
+Tue Sep 26 16:08:01 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * procbuf.cc: Move #pragma implementation to beginning.
+
+Wed Sep 20 17:53:33 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * procbuf.h, procbuf.cc: Add #pragma interface/implementation stuff.
+
+Wed Sep 20 18:59:00 1995 John Eaton <jwe@bevo.che.wisc.edu>
+
+ * procbuf.h: Protect from being included multiple times.
+
+Wed Sep 20 15:47:14 1995 John Eaton <jwe@bevo.che.wisc.edu>
+
+ * procbuf.h (procbuf): Add '_next' pointer field for compatibility
+ with _IO_proc_file.
+
+Wed Sep 20 13:54:02 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * config.shared: Add support for maintainer-clean target as a
+ synonym for realclean.
+ * dbz/Makefile.in: Likewise.
+
+Mon Sep 11 12:11:19 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * iopopen.c: #include <sys/types.h> before <sys/wait.h>.
+ This is in accordance with Posix, and needed for ISC.
+
+Fri Sep 8 00:11:55 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * gen-params: Use double quotes in the eval setting $TYPE to
+ $VALUE, to preserve any single quotes in $VALUE.
+
+Mon Aug 21 11:39:09 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * gen-params: Test for an appropriate version of gcc before using
+ mode attributes.
+
+ * config.shared: Add $(PICDIR) to $ALL.
+
+Mon Aug 7 17:51:40 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * gen-params: Generate new macro _G_HAVE_SYS_CDEFS.
+ * libio.h: If _G_HAVE_SYS_CDEFS, get __P from <sys/cdefs.h>.
+
+Fri Aug 4 23:21:17 1995 Paul Eggert <eggert@twinsun.com>
+
+ * gen-params: When following typedef changes, allow typedefs
+ that do not have a space before the defined type name,
+ e.g. `typedef void *__gnuc_va_list;' as in Linux. Also,
+ not require a space in the definiens, e.g. `typedef void*foo;'.
+
+Thu Aug 3 17:54:15 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * iostream.h, iostream.cc (istream::sync): Added missing method.
+
+Thu Aug 3 17:49:34 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * configure.in: Remove netbsd special case.
+ * config/netbsd.mt: Removed; no longer used.
+
+Tue Jun 20 16:07:12 1995 Paul Eggert <eggert@twinsun.com>
+
+ * gen-params: Take transitive closure of `typedef' relation.
+ This is needed for BSD/OS 2.0, which has
+ fpos_t -> off_t -> quad_t -> long long.
+
+Mon Jul 24 18:28:10 1995 Doug Evans <dje@canuck.cygnus.com>
+
+ * config.shared (TOPDIR): Delete extra '/', $rootme may be empty.
+
+Sat Jul 22 13:27:45 1995 Doug Evans <dje@canuck.cygnus.com>
+
+ * config.shared (depend.new): Fix quoting in DO NOT EDIT line.
+
+ * Makefile.in (_G_config.h): Add multilib support.
+ (install): Likewise.
+ * config.shared: Likewise.
+ * configure.in: Likewise.
+
+Wed Jun 28 17:40:25 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * PlotFile.h, SFile.h, builtinbuf.h, editbuf.h, fstream.h,
+ indstream.h, iomanip.h, iostream.h, parsestream.h, pfstream.h,
+ procbuf.h, stdiostream.h, stream.h, streambuf.h, strstream.h: Wrap
+ with extern "C++".
+
+Thu Jun 22 04:34:01 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * gen-params: Surround attributes with __.
+
+Mon Jun 19 00:33:22 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * config.shared (SUBDIRS): Massage broken shells that require
+ 'else true'.
+
+Sat Jun 17 11:25:38 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * streambuf.h: Declare inline members inline in class.
+
+Thu Jun 15 20:45:13 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * Makefile.in (VERSION): Update to version 2.7.0.
+
+Wed Jun 14 21:41:11 1995 Jason Merrill <jason@python.cygnus.com>
+
+ * Makefile.in (STDIO_WRAP_OBJECTS): Remove stdfiles.o.
+ (LIBIO_OBJECTS): Add stdfiles.o.
+
+Wed Jun 7 16:11:36 1995 Jason Merrill <jason@python.cygnus.com>
+
+ * config.shared (all): Appease bash.
+
+Wed Jun 7 11:16:38 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * configure.in (MOSTLYCLEAN): Remove stamp-picdir.
+
+ * config.shared (MOSTLYCLEAN): Ditto.
+ (CLEAN): Don't.
+
+Mon Jun 5 18:29:39 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * config/mh-*pic: Removed.
+
+ * configure.in (MOSTLYCLEAN): Remove pic objects.
+ (frags): Use toplevel pic fragments.
+
+ * config.shared (CXXFLAGS): Use -O3.
+ (PICFLAG, PICDIR): New macros.
+ (all): Depend on $(PICDIR).
+ (FLAGS_TO_PASS): Pass PICFLAG.
+ (.x.o): Also build pic object.
+ (stamp-picdir): Create directory for pic objects.
+ (MOSTLYCLEAN): Remove pic objects.
+ (CLEAN): Remove stamp-picdir.
+
+ * Makefile.in (iostream.list): Depend on stamp-picdir.
+ (c++clean): Don't remove _G_config.h.
+
+Mon Jun 5 15:03:47 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * strstream.h, strstream.cc (strstream::strstream()): Re-implement to
+ be like ostrstream::ostrestream(), and not leak memory.
+
+ * streambuf.h: Use #if !_IO_UNIFIED_JUMPTABLES instead of #ifndef.
+
+ * iolibio.h (_IO_rewind): Add missing flags when calling _IO_seekoff.
+
+Thu May 25 22:30:21 1995 J.T. Conklin <jtc@rtl.cygnus.com>
+
+ * config/netbsd.mt (G_CONFIG_ARGS): Add defn for off_t. Another
+ layer of typedefs has been added and the gen-params script can
+ not handle it.
+
+Wed May 10 03:02:58 1995 Jason Merrill <jason@python.cygnus.com>
+
+ * iolibio.h (_IO_rewind): Add new argument to _IO_seekoff.
+
+ * config/linux.mt (LIBIOSTREAM_OBJECTS): Include $(STDIO_WRAP_OBJECTS).
+ (LIBIOSTREAM_DEP): Include stdio.list.
+ (LIBIOSTREAM_USE): Include `cat stdio.list`.
+
+ * Makefile.in (LIBIOSTREAM_DEP): New variable.
+ (LIBIOSTREAM_USE): Ditto.
+ (libiostream.a): Use them.
+ (iostream.list): Ditto.
+ (stdio.list): New rule.
+ (stdio/stdio.list): Ditto.
+
+Tue May 9 18:29:38 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * libioP.h (_IO_jump_t): Change TYPE for __dummy from int to
+ _G_size_t.
+
+Sat May 6 13:50:37 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * libio.h (_IO_UNIFIED_JUMPTABLES): #define as true.
+ (_IO_FILE): Remove _jumps field (#if _IO_UNIFIED_JUMPTABLES).
+
+ * libioP.h (enum _IO_seekflags_): Removed.
+
+ * libioP.h (_IO_setbuf_t): Change return value of setpos jumptable
+ function to match C++ streambuf::setpos. (Return NULL on failure.)
+ * fileops.c (_IO_file_setbuf), genops.c (_IO_default_setbuf),
+ filebuf.cc, iosetvbuf.c: Update to use new setbuf conventions.
+
+ * streambuf.h (streambuf): Re-order virtual functions more logically.
+ * streambuf.cc (streambuf::uflow), streambuf.h: New virtual.
+ * libioP.h (struct _IO_jump_t): Define using new JUMP_FIELD macro.
+ And re-order in more logical order consistent with streambuf vtable.
+ * fileops.c (_IO_file_jumps), iopopen.c (_IO_proc_jumps), iovfprintf.c
+ (_IO_helper_jumps), streambuf.cc (_IO_streambuf_jumps), strops.c
+ (_IO_str_jumps): Update accordingly, using JUMP_INIT macro.
+ * stdfiles.c: Set vtable to point to _IO_file_jumps.
+ * filebuf.cc, iopopen.c, iovfprintf.c (helper_vfprintf), iovsprintf.c,
+ iovsscanf.c: Use macros and #if to set jumptables.
+
+ * streambuf.c: _IO_streambuf_jumps and the _IO_sb_* methods are not
+ needed #if _IO_UNIFIED_JUMPTABLES.
+ * filebuf.cc (filebuf::__new): Also no longer needed.
+ * fstream.cc (fstreambase::__fb_init, fstreambase::fstreambase): Fix.
+ * stdstrbufs.c: Use filebuf vtable instead of builtinbuf's.
+ * builtinbuf.h, builtinbuf.cc (builtinbuf): Commented out #if
+ _IO_UNIFIED_JUMPTABLES - no longer needed.
+ * strstream.cc (SET_STR_JUMPS): Does nothing now.
+
+ * builtinbuf.cc, fileops.c, genops.c, iofgetpos.c, iofsetpos.c,
+ ioftell.c, iopopen.c, ioseekoff.c, ioseekpos.c, iosetvbuf.c,
+ iovfprintf.c, iovfscanf.c, strops.c: Use DEFUN and DEFUN_VOID.
+ * filebuf.cc, fileops.c, genops.c, iopopen.c, ioseekoff.c, ioseekpos.c,
+ iosetvbuf.c, iovfscanf.c: Use new JUMP_* and IO_OVERFLOW/... macros.
+
+ * libioP.h (_IO_seekpos_t): Third arg is now an int (using _IOS_INPUT
+ and _IOS_OUTPUT), not an enum _IO_seekflags_. Flags values are
+ changed, and their sense inverted (to match streambuf::seekpos).
+ * libioP.h (_IO_seekoff_t): Similarly match streambuf::seekoff.
+ * filebuf.cc, fileops.c (_IO_file_fopen, _IO_file_seekoff), genops.c
+ (_IO_default_seekpos, _IO_default_seekpos), iofgetpos.c, iofsetpos.c,
+ iolibio.h (_IO_fseek), ioftell.c, ioseekoff.c, ioseekpos.c,
+ iostream.cc, streambuf.cc, strops.c (_IO_str_seekoff), strstream.cc:
+ New seekpos/seekoff conventions.
+ * iostreamP.h (convert_to_seekflags): Removed - no longer needed.
+
+ * iolibio.h (_IO_fread): New declaration.
+
+ * dbz/Makefile.in: Re-arrange for cleaner dependencies.
+
+Fri May 5 15:55:22 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * libioP.h (_IO_JUMPS. JUMP_FIELD, JUMP0, JUMP1, JUMP2, JUMP3,
+ JUMP_INIT, _IO_FINISH, _IO_OVERFLOW, ... _IO_SYSSTAT): New macros
+ in preparation for new unified jumptable/vtable implementation.
+ * cleanup.c, filedoalloc.c, iofclose.c, iofflush.c, iofiledoalloc.c,
+ ioprims.c, iosetbuffer.c, iostrerror.c, ioungetc.c: Use DEFUN.
+ * filedoalloc.c, iofclose, iofflush, iosetbuffer.c: Use new macros.
+
+ * iofopen.c, iofdopen.c: Use macros and #if for new jumptables.
+
+ * gen-params: Do not #include <sys/types.h>.
+ Add missing quote in 'eval'.
+ Do add #include <sys/types.h> in test for <sys/resource.h>.
+ * config/netbsd.mt: New file, defining _G_CONFIG_ARGS (for fpos_t).
+ * configure.in: Use netbsd.mt for NetBSD.
+
+Wed May 3 15:03:47 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * libioP.h (DEFUN, DEFUN_VOID, AND): New macros, from ansidecl.h.
+ * iofdopen.c, iofgets.c, iofopen.c, iofputs.c, iofread.c, iofwrite.c,
+ iogetdelim.c, iogetline.c, iogets.c, ioignore.c, iopadn.c, ioperror.c,
+ ioputs.c, iovsprintf.c, iovsscanf.c, outfloat.c: Use DEFUN.
+
+Mon May 1 16:22:30 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * gen-params: #include <sys/types.h>. Don't use __WCHAR_TYPE__ in
+ definition of _G_wchar_t. Use __attribute__ ((mode)) to get
+ specific-sized ints under gcc, don't worry about int8 or int64
+ otherwise. Provide defaults if deduction fails.
+
+Thu Apr 27 18:27:53 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * streambuf.h (ios::~ios): Delete _arrays.
+ (_IO_NEW_STREAMS): Turn on.
+ * libio.h (__adjust_column): Remove bogus declaration.
+ * genops.c (_IO_set_column): Fix typo (in commented-out code).
+
+Tue Apr 25 17:14:29 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * config.shared (CXXINCLUDES): Use a shell variable with a
+ different name from the make variable.
+ * configure.in: Update accordingly.
+
+Mon Apr 17 17:19:40 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * streambuf.h (__adjust_column): Remove redundant declaration.
+
+Sat Apr 15 11:39:25 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * config.shared (do-clean-dvi): Also remove *.cps.
+
+ * gen-params: Use ${SED} instead of sed.
+
+ * libio.h: Remove #if'd out stuff (confuses makedepend).
+
+ * stdstreams.cc (STD_STR): Standard streams start with ios::dec set.
+
+Fri Apr 14 23:46:31 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * iostream.h, iostream.cc (istream::read, ostream::write):
+ Use streamsize for the length parameter.
+
+ * streambuf.h: Removed redundant __overflow and __underflow.
+
+ * fstream.h, fstream.cc: Add void fstreambase::attach(int).
+
+ * iosscanf.c (_IO_sscanf): Fix non-__STDC__ missing declaration.
+
+Mon Apr 3 15:40:55 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * indstream.*: Fix prototypes of xsputn and xsgetn.
+
+ * fileops.c: Avoid ??? trigraph.
+
+Mon Mar 27 16:16:38 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * iomanip.h (operator<< (ostream&, const omanip<TP>&): Define
+ separately.
+ (operator>> (istream&, const imanip<TP>&): Ditto.
+
+Mon Mar 27 08:56:00 1995 Brendan Kehoe (brendan@lisa.cygnus.com)
+
+ * builtinbuf.cc (builtinbuf::setbuf): Cast NULL to streambuf*, to
+ avoid warning/error about conversion from void*.
+ * indstream.cc (indirectbuf::seekoff): Likewise.
+ (indirectbuf::seekpos): Likewise.
+ * filebuf.cc (filebuf::setbuf): Likewise.
+ (filebuf::close): Cast NULL to filebuf*.
+
+Wed Mar 1 14:23:18 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * configure.in (DISTCLEAN): Add, with target-mkfrag.
+
+Fri Feb 24 01:01:08 1995 Jason Merrill <jason@python.cygnus.com>
+
+ * configure.in (frags): Don't require so many dashes in the
+ canonical target name.
+
+Sat Feb 18 13:18:30 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * streambuf.cc (streambuf::sync): Always return 0, even for
+ non-flushed output. This is required by the ANSI/ISO draft.
+ * genops.c (_IO_sync): Likewise always return 0.
+
+Fri Feb 17 16:33:28 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * fileops.c (_IO_file_close_it): Call _IO_file_sync, rather
+ than _IO_do_flush, because we want to adjust the file pointer
+ if reading and not at end (as in SVR4, and as in fflush).
+ Also, make sure to return error indication if sync fails.
+ (_IO_file_sync): Ignore seek error if it is ESPIPE.
+ (_IO_file_seekoff): If not readable, do dumb lseek.
+ * iofclose.c (_IO_fclose): If closing a non-filebuf, return -1
+ if _IO_ERR_SEEN.
+
+Fri Feb 17 19:31:00 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * gen-params: Check for struct tms in <sys/times.h>, defining
+ HAVE_SYS_TIMES accordingly.
+
+Wed Feb 15 21:05:11 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * strops.c (_IO_str_count): Use LEN macro.
+ (_IO_str_seekoff): Update _len field.
+
+Mon Feb 6 19:29:00 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * gen-params: Default to short, long and long long for 16, 32 and
+ 64 bit types, in case detection fails.
+
+Wed Jan 25 18:07:30 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * gen-params (_G_wint_t): Allow for broken promotions.
+
+Tue Jan 24 16:15:40 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * stdstrbufs.cc (_IO_fake_stdiobufs): Add an extra layer of struct,
+ to force correct alignment on i960s.
+ (DEF_STDIOBUF, _IO_{stdin,stdout,stderr}_buf): Update accordingly.
+
+Thu Jan 19 18:30:53 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * config.shared (CXXINCLUDES): Add libstdc++ to includes for
+ building libg++.
+ (LIBS): Also link with libstdc++ when building libg++ toys.
+ Don't set EXPORT_ALL_VARIABLES; users will have to set
+ LD_LIBRARY_PATH themselves.
+
+Fri Dec 30 16:38:13 1994 Mike Stump <mrs@cygnus.com>
+
+ * config/linux.mt: Fix build problem on linux 1.0.8.
+
+Thu Dec 22 11:49:45 1994 J.T. Conklin (jtc@phishhead.cygnus.com)
+
+ * config/netware.mt: Use gcc to pre-link iostream.nlm's objects
+ instead of using nlmconv, so that references to functions in
+ libgcc.a are resolved.
+
+ * configure.in: Append .mt to target makefile fragment file names.
+
+ * floatconv.c (tens, tinytens, bigtens): Added const qualifier.
+
+Tue Dec 20 09:59:50 1994 Mike Stump <mrs@cygnus.com>
+
+ * gen-params (VTABLE_LABEL_PREFIX): Since some systems have GNU nm
+ as nm, and they demangle by default, we have to notice this, and
+ try --no-cplus (linux) or --no-demangle when running nm.
+
+Wed Dec 14 18:13:58 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * gen-params: To determine vt-name-mangling using dummy.C add
+ #include and #prama interface/implementation to avoid problem with
+ assemblers that don't emit local symbols. Reported under HPUX 8
+ by Thomas Arend <arend@blasius.Chemietechnik.Uni-Dortmund.DE>.
+
+ * streambuf.h (ios::ios): Move inline definition after
+ that of ios::init (which ios::ios calls).
+
+Sun Dec 4 19:50:32 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * fileops.c (_IO_file_init, _IO_file_close_it, _IO_file_sync):
+ Set _offset to _IO_pos_BAD, to support applications that follow
+ POSIX.1 rules on mixing file handles.
+
+ * fileops.c (_IO_file_overflow): Handle case that buffer was
+ allocated (perhaps by setvbuf) but _IO_write_base is still 0.
+
+ * iostdio.h (setbuffer): #define as _IO_setbuffer.
+ * streambuf.h, filebuf.cc: Removed filebuf::do_write.
+
+Tue Nov 29 23:38:57 1994 Per Bothner (bothner@rtl.cygnus.com)
+
+ * floatconv.c (setword0, setword1): Fix typo.
+
+Tue Nov 29 15:37:29 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * config.shared: Move -fno-implicit-template from CXXFLAGS
+ to LIBCXXFLAGS. Tests are better run without it.
+
+ * floatconv.c (word0, word1): Re-place/re-implement using unions
+ instead of casts to avoid optimizer problems.
+
+ * dbz/dbzmain.c: Renamed dirname -> dir_name to avoid OSF
+ header file braindamage.
+
+Sat Nov 5 19:44:00 1994 Jason Merrill (jason@phydeaux.cygnus.com)
+
+ * config.shared (LIBCFLAGS): Define.
+ (LIBCXXFLAGS): Define.
+ (DOING_LIBGXX): Define TOLIBGXX. Change LIBS to use -lg++. Add
+ LD_LIBRARY_PATH and .EXPORT_ALL_VARIABLES:.
+ (FLAGS_TO_PASS): Add LIBC{,XX}FLAGS.
+ (XC{,XX}FLAGS): Set to LIBCFLAGS or CFLAGS depending on $LIBDIR.
+ (COMPILE.c): Define, use in .c.o rule.
+ (COMPILE.cc): Define, use in .cc.o rule.
+
+Sat Nov 5 15:12:12 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * Makefile.in (VERSION): Update to 0.67.
+
+ * streambuf.h (ios::dont_close): Is now set by default.
+ * fstream.h, fstream.cc (__fb_init): New function. Clears
+ ios::dont_close. Change fstreambase constructors to call it.
+ * strstream.cc: *strstream constructors must clear ios::dont_close.
+ * iostream.cc: Simplify - don't need to set ios::dont_close.
+ * ioassign.cc: Simplify - assume ios::dont_close is always set.
+
+ * fstream.h, fstream.cc: If _IO_NEW_STREAMS, put the
+ filebuf as a member __my_fb.
+ * strstream.{h,cc}: Likewile use a strstreambuf member __my_sb.
+ * streambuf.h, stdstreams.cc, ioextend.cc:
+ Fix if _IO_NEW_STREAMS to not use ios::dont_close.
+
+ * streambuf.h (class ios): Move rdbuf later, to avoid
+ inability of g++ to inline.
+ * filebuf.cc (filebuf::~filebuf): Call _IO_do_flush.
+
+ * config.shared: Emit rules to make depend.
+ * depend: New file.
+
+Fri Nov 4 17:19:11 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * README: Fix typos.
+ * libio.h: Add comment. Update Copyright notice.
+
+Fri Nov 4 21:46:30 1994 Paul Eggert <eggert@twinsun.com>
+
+ * libio.h (__P): Change argument name spelling from
+ `paramlist' to `protos' for compatibility with BSDI 1.1.
+
+Thu Nov 3 00:45:16 1994 Jason Merrill (jason@phydeaux.cygnus.com)
+
+ * config.shared (CXXFLAGS): Add -fno-implicit-templates.
+
+Mon Oct 24 15:57:35 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * config.shared: Define NOSTDIC and use it for libio too.
+
+Thu Oct 20 19:45:35 1994 Jason Merrill (jason@phydeaux.cygnus.com)
+
+ * iogetdelim.c: #include <stdlib.h>.
+
+Thu Oct 20 17:09:52 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * iostream.h: Add classes _IO_istream_withassign and
+ _IO_ostream_withassign. Re-type cin, cout, cerr, clog.
+ (class iostream): Don't add extra _gcount field.
+ * ioassign.cc: New file. Implement operator= for cin etc.
+ * streambuf.h (class ios): Change return type of operator=.
+ * Makefile.in (IOSTREAM_OBJECTS): Add ioassign.o.
+
+ * Makefile.in: Re-arrange, so linux.mt overrides can work.
+
+ * fileops.c (_IO_file_seekoff): Optimize seeks within buffer.
+
+Wed Oct 19 14:25:47 1994 Jason Merrill (jason@phydeaux.cygnus.com)
+
+ * gen-params (wint_t): Return to using __WCHAR_TYPE__ for
+ compatibility with gcc versions prior to 2.6.1.
+
+Tue Oct 18 17:08:18 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * Makefile.in: Define _G_CONFOG_H as _G_config.h for Linux. Use it.
+ (IO_OBJECTS): Add iogetdelim.o.
+ * config/linux.mt: New file.
+ * configure.in: Select config/linux.mt if Linux.
+ * iogetdelim.c: Verious cleanups, many from
+ Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>.
+ * libioP.h: Add _IO_getdelim. Use (void) for no-parameter functions.
+
+Thu Oct 13 16:30:56 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * libio.h: Rename USE_DTOA to _IO_USE_DTOA for namespace reasons.
+ * iostream.cc, iovfscanf.c, iovfprintf, floatconv.c:
+ Update USE_DTOA -> _IO_USE_DTOA.
+
+ * libio.h (_IO_feof, _IO_ferror): Move to here ...
+ * iolibio: ... from here
+
+ * iostream.cc (istream::get, istream::ignore, istream::read):
+ Set _gcount to 0 if ipfx0 failed.
+
+ * iostream.cc (flush): Do virtual function call, rather than
+ going through jumptable. (To get correct method in derived class.)
+ Bug and fix from John Wiegley <jw@cis.ohio-state.edu>.
+
+ * iofdopen.c (O_ACCMODE): Define using O_RDWR, not O_RDWRITE.
+
+ * streambuf.h (ios::rdbuf(streambuf*)): New.
+ * streambuf.h (ios::operator=): Make private (i.e. dis-allow).
+
+Wed Oct 12 19:09:20 1994 Jason Merrill (jason@phydeaux.cygnus.com)
+
+ * gen-params: Define _G_NO_NRV and _G_NO_EXTERN_TEMPLATES if not
+ compiling with g++.
+
+Thu Oct 6 16:03:43 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iostream.texi (ostrstream::str): Note that NUL is not written
+ automatically.
+
+Wed Oct 5 17:28:29 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iogetdelim.c (_IO_getdelim): New function.
+
+Wed Oct 5 15:40:22 1994 J.T. Conklin (jtc@phishhead.cygnus.com)
+
+ * config/netware.mt: New file, first cut at Netware NLM support.
+ * configure.in (*-*-netware*): Use config/netware.mt.
+
+ * config.shared (NLMCONV, LD): New definition.
+
+ * gen-params: check for nm in ${binutils}/nm.new.
+ * config.shared: Likewise.
+
+Tue Oct 4 12:20:01 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iomanip.h (omanip::operator<<): Make 2nd arg be const.
+ Bug and fix reported by Greg McGary <gkm@magilla.cichlid.com>.
+
+ * strstream.cc (strstreambuf::pcount): Simplify, to match
+ ANSI/ISO specification.
+
+Mon Sep 26 15:19:52 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * gen-params: Include <wchar.h> and <wctype.h> if they exist.
+
+Thu Sep 8 14:41:41 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * iostream.h (class istream): Declare operator>>(long double&).
+ (class ostream): Define operator<<(long double).
+
+ * iostream.cc (istream::operator>>(long double&)): Define.
+
+Wed Sep 7 14:42:29 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iostream.texi (Overflow): Fix bugs in example.
+
+Fri Sep 2 17:45:57 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iostream.tex: Document a little on how to write your
+ own streambuf-derived class, with an example.
+
+Tue Aug 30 13:03:57 1994 Brendan Kehoe (brendan@lisa.cygnus.com)
+
+ * floatconv.c (s2b): Declare X and Y to be _G_int32_t.
+ (diff, quorem): Declare BORROW, Y, and Z likewise.
+ (ulp): Declare L likewise.
+ (_IO_strtod): Declare L and AADJ likewise.
+ (_IO_dtoa): Declare L and D likewise. Cast division of D by DS to
+ _G_int32_t.
+
+Mon Aug 29 16:01:54 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iosetvbuf.c (_IO_setvbuf): If setting _IOFBF and no
+ buffer was specified, call __doallocate.
+
+ * fileops.c, floatconv.c: Add a bunch of parentheses to
+ shut up gcc warnings. Patch from H.J.Lu.
+
+ * stdiostream.cc (stdiobuf::sys_read): Inline call to getc
+ for the normal case (size==1).
+
+Sat Aug 20 12:14:52 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * Makefile.in (VERSION): Increase to 0.66.
+
+Fri Aug 19 17:28:41 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iolibio.h: Added _IO_printf prototype.
+ Added extern "C" { ... } wrappers #ifdef __cplusplus.
+ Bugs reported by Neal Becker <neal@ctd.comsat.com>.
+
+Wed Aug 17 18:17:15 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * fileops.c (_IO_file_seekoff): For _IO_seek_cur, adjust for
+ read-ahead before jumping to label dumb.
+
+Wed Aug 3 13:15:01 1994 H.J. Lu (hjl@nynexst.com)
+
+ * libioP.h (CHECK_FILE(FILE,RET)): new, which checks for
+ FILE == NULL and _IO_MAGIC_MASK.
+ (COERCE_FILE(FILE)): merged into CHECK_FILE(FILE,RET)
+ with typo fixes.
+
+ * iofread.c, iofwrite.c: add CHECK_FILE(fp, 0);
+ * iofclose.c: add CHECK_FILE(fp, EOF); remove _IO_MAGIC_MASK check.
+
+ * iofflush.c, iofgetpos.c, iofputs.c, iofscanf.c,
+ iofsetpos.c, iofvbuf.c, ioungetc.c:
+ Add CHECK_FILE(fp, EOF) and remove COERCE_FILE(fp).
+
+ * iofgets.c: add CHECK_FILE(fp, NULL) and remove COERCE_FILE(fp).
+ * iofprintf.c: add CHECK_FILE(fp, -1) and remove COERCE_FILE(fp).
+ * ioftell.c: add CHECK_FILE(fp, -1L) and remove COERCE_FILE(fp).
+ * iosetbuffer.c: add CHECK_FILE(fp, ) and remove COERCE_FILE(fp).
+
+Fri Aug 12 15:35:39 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iofdopen.c (_IO_fdopen): #define O_ACCMODE if it isn't.
+ Still set O_APPEND if "a" is given, but don't unset it
+ if it isn't. Added comment.
+
+Mon Aug 8 13:11:00 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * gen-params (VTABLE_LABEL_PREFIX): Changes in the implementation.
+ For look for _*vt[$_.]7*filebuf in the nm output, because that
+ matches what g++ produces and has produced. Thus it should be
+ somewhat more robust.
+
+Sun Aug 7 22:52:49 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * gen-params (CC): Remove no-longer-needed -I options
+ passed to xgcc (now they are implied by the -B options).
+
+Wed Jul 20 16:41:13 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * Makefile.in (tooldir): Added definition, so we can do
+ 'make install' in this directory.
+ Bug reported by Klamer Schutte <schutte@tpd.tno.nl>.
+
+Mon Jul 18 18:02:34 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * gen-params (VTABLE_LABEL_PREFIX): Remove filename sppearing
+ by itself. Add comment explaining what is going on.
+
+Tue Dec 21 13:02:48 1993 H.J. Lu (hjl@jalod)
+
+ * libio.h: define _IO_uid_t and _IO_HAVE_ST_BLKSIZE
+ as _G_xxxxxxxx.
+
+Tue Dec 21 13:02:48 1993 H.J. Lu (hjl@jalod)
+
+ * iopopen.c: Don't include <errno.h>. It is included in "libioP.h".
+
+ * iopopen.c (_IO_proc_close) : check if fp is on the list
+ before close it.
+
+Thu Jul 14 16:38:47 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * gen-params (CONFIG_NM): Make sed scripts to find vtable name
+ mangling more robost for different forms of nm output.
+
+Tue Dec 21 13:02:48 1993 H.J. Lu (hjl@jalod)
+
+ * iofopen.c (_IO_fopen): don't check [redundantly] fp == NULL after
+ IO_file_init(&fp->_file).
+
+ * iomanip.h (template<class TP> class iapp):
+ change ostream to istream.
+
+Tue Jul 12 14:09:02 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * Makefile.in (VERSION): Increase to 0.65.
+ * libioP.h (builtinbuf_vtable): Only define #ifdef __cplusplus.
+
+ * gen-params (_G_int8_t): Only define if defined(__STDC__),
+ because K&R C compilers don't have signed char.
+ (_G_int64_t, _G_uint64_t): Only define if defined(__GNUC__)
+ because other compilers may not have long long.
+
+Sun Mar 06 13:10:21 1994 H.J. Lu (hjl@nynexst.com)
+
+ * floatconv.c (_IO_dtoa ()): fix a small memory leak, set the
+ "on_stack" field to be 0 if "result" is not NULL.
+
+Sat Mar 05 13:18:20 1994 H.J. Lu (hjl@nynexst.com)
+
+ * floatconv.c (_IO_dtoa ()): if the number of digits of the
+ floating point number is more than the previous one, free the
+ old string and allocate a new one.
+ [Minor optimization to avoid Bcopy. -PB]
+
+Mon Jul 11 10:53:41 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * fileops.c (_IO_file_underflow): 'count' should be unsigned,
+ since it contains the return value of read. Reported by
+ Teemu Torma <tot@trema.fi>.
+
+Tue Dec 21 13:02:48 1993 H.J. Lu (hjl@nynexst.com)
+
+ * floatconv.c (_IO_strtod ()): make "+" and "-" as error.
+
+Sat Jul 9 15:09:21 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ Make sure _IO_FILE::_flags is always initialized correctly, for the
+ C functions (fopen, fdopen, popen), and not just the C++ functions.
+ * fileops.c (_IO_file_init): Set _flags to CLOSED_FILEBUF_FLAGS.
+ * fileops.c (_IO_file_fopen): Remove bogus assignment.
+ * filebuf.cc (filebuf constructors): Don't pass CLOSED_FILEBUF_FLAGS
+ to streambuf constructor - _IO_file_init does it instead.
+ * filebuf.cc (CLOSED_FILEBUF_FLAGS): Removed.
+ * iopopen.c (_IO_proc_open): Use _IO_mask_flags.
+
+Thu Jun 30 08:49:53 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * dbz/Makefile.in (mostlyclean): Add target.
+
+Wed Jun 29 09:30:12 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * gen-params: Woops, can't run a C program to determine target
+ characteristics. Sigh.
+
+Tue Jun 28 03:11:33 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * gen-params: Add _G_{,u}int{8,16,64}_t, use a short C program to
+ determine what all these should be rather than trying to compare
+ the MAX numbers in the shell.
+
+Sun Jun 26 21:04:24 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * stdiostream.h, stdiostream.cc (stdiobuf::xsgetn): Removed.
+ Too hairy. If we want to optimize it, we should do so in
+ filebuf::xsgetn (or rather _IO_file_xsgetn).
+
+ * stdiostream.h (class stdiobuf), stdiostream.cc: Fix parameter
+ and return types of virtual function to matcher base types (Oops!).
+ * streamstream.cc (stdiobuf::xsgetn, stdiobuf::xsputn):
+ Optimize to call fread.fwrite directly if !buffered.
+ * fileops.c: Fix comment.
+
+Fri Jun 24 11:28:18 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * stdiostream.h (istdiostream, ostdiostream): New classes.
+
+ More robust final cleanup.
+ * cleanup.c (_IO_register_cleanup): Register _IO_cleanup,
+ rather than _IO_flush_all.
+ * filedoalloc.c: Update comment.
+ * genops.c (_IO_unbuffer_all): New. Makes all files unbuffered.
+ * genops.c (_IO_cleanup), libioP.h: New function. Call
+ _IO_flush_all, and then _IO_unbuffer_all. This is in case C++
+ destructors try to do output *after* _IO_cleanup is called.
+
+ Construct standard stdiobufs statically (using type punning).
+ * stdstrbufs.c; Unless _STDIO_USES_IOSTREAM declare standard
+ stdiobufs (for stdin, stdout, and stderr), using type punning
+ (struct _IO_fake_stdiobuf). This avoids constructor-time problems.
+ * stdstreams.cc: Remove the declarations of the stdiobufs.
+ Instead use the new (fake) ones in stdstrbufs.cc. We no longer
+ have to call ios::sync_with_stdio at constructor time.
+
+ Preliminary support for new ANSI streambuf::uflow virtual.
+ * libioP.h (struct _IO_jump_t): Add __uflow field.
+ * genops.c (_IO_default_uflow), libioP.h: New function.
+ * fileops.c (_IO_file_jumps), iopopen.c (IO_proc_jumps),
+ iovfprintf.c (_IO_helper_jumps), strops.c (_IO_str_jumps),
+ streambuf.cc (_IO_streambuf_jumps): Add _IO_default_uflow.
+ * genops.c (__uflow): New function.
+ (save_for_backup): New function. Some code shared by
+ __underflow and __uflow, moved out from the former.
+ (_IO_default_uflow): New function.
+ * libio.h (_IO_getc): Call __uflow, not __underflow.
+
+Wed Jun 22 20:22:49 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ Make sure that the vtable of a streambuf is always valid,
+ which makes ios::rdbuf simpler and faster.
+ * gen-params: Add code to determine _G_VTABLE_LABEL_HAS_LENGTH,
+ _G_VTABLE_LABEL_PREFIX, _G_VTABLE_LABEL_PREFIX_ID, and
+ _G_USING_THUNKS, which describe how virtual function tables are named.
+ * stdfiles.c (FILEBUF_LITERAL): Moved to libioP.h.
+ * libioP.h (builtinbuf_vtable): New (complicated) declaration.
+ * filebuf.cc (filebuf::__new), strstream.cc (SET_STR_JUMPS):
+ Initialize vtable to builtinbuf_vtable, not NULL.
+ * stdstrbufs.cc: New file. Same as stdfiles.c, except that
+ vtable is initialized to builtinbuf_vtable, not NULL.
+ * streambuf.h (ios::rdbuf): Can now simplify/optimize, due to
+ above changes. Always, just return _strbuf.
+ * builtinbuf.h, builtinbuf.cc (builtinbuf::vtable,
+ builtinbuf::get_builtin_vtable): Removed. No longer needed.
+ * streambuf.h, builtinbuf.cc (ios::_IO_fix_vtable): No longer needed.
+ Only defined #ifdef _STREAM_COMPAT, for binary compatibility.
+ * Makefile.in: Move stdfiles.o from IO_OBJECTS to STDIO_WRAP_OBJECTS.
+ (IOSTREAM_OBJECT): Add stdstrbufs.o.
+ * Makefile.in (_G_config.h): Pass $(CXXFLAGS) as part of $(CXX).
+
+Fri Feb 11 11:08:01 1994 SBPM Marc GINGOLD (marc@david.saclay.cea.fr)
+
+ * iovfprintf.c (helper_vfprintf): add
+ hp->_IO_file_flags = _IO_MAGIC|(_IO_IS_FILEBUF+_IO_NO_READS);
+ [This is needed because _IO_vfprintf checks for _IO_UNBUFFERED. -PB]
+ [Actually: don't set _IO_IS_FILEBUF. -PB]
+
+Wed Jun 22 13:49:22 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * stdiostream.cc, stdiostream.h (stdiobuf::buffered): New methods.
+
+ * iofdopen.c (_IO_fdopen): Various minor improvements.
+
+ * iovfscanf.c: Don't return EOF on control_failure.
+
+Tue Dec 21 13:02:48 1993 H.J. Lu (hjl@nynexst.com)
+
+ * iovfscanf.c: Enforce the sequence of the conversion specifications.
+
+Fri Jun 17 20:57:22 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iofdopen.c: Use fcntl to check that requested access mode is
+ compatible with existing access mode, and to change the
+ O_APPEND file status flag if need be.
+
+Thu Jun 16 17:33:50 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * streambuf.h (ios::init): Initialize all the fields.
+ This may be overkill, but the current ANSI working paper requires it.
+ * streambuf.h (ios::ios): Reimplement in terms of ios::init.
+ * iostream.cc (Non-default constructors istream::istream,
+ ostream::ostream, iostream::iostream): Cannot use a mem-initializer,
+ because it is ignored if initializing a derived class. Instead,
+ call ios::init.
+
+Wed Jun 15 13:35:37 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * stdstreams.cc (ISTREAM_DEF): Fix typo (it's a _fake_istream, not
+ a _fake_ostream). Reported by Jason Shirk <jshirk@gomez.intel.com>.
+
+ * stdiostream.h, stdiostream.cc (stdiobuf::~stdiobuf): New.
+ Call _IO_do_flush.
+ * stdiostream.cc (stdiobuf::sync): Call _IO_do_flush rather
+ than filebuf::sync (to avoid bad seeks).
+
+ * libioP.h (_IO_do_flush): Add missing parentheses.
+
+Fri Jun 3 19:16:57 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * config.shared (CXXFLAGS): Remove -fno-implicit-templates.
+
+ * iomanip.h: Add explicit external instantiations.
+
+Wed Jun 1 14:14:44 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * libio.h (struct _IO_FILE_plus): Move definition from here ...
+ * libioP.h (struct _IO_FILE_plus): ... to here. Since this
+ file is private to the implementation, we can rename the fields
+ from the implementor's to the user's name anme space.
+ (This avoids a lossage on SCO, whose stdio.h has a #define _file.)
+ * iofdopen.c, iofopen.c, stdfiles.c: Fix field references accordingly.
+ * iopopen.c (struct_IO_proc_file): Rename fields from
+ implementor's name space to user's, and update usages.
+ * streambuf.h (streambuf::_vtable): Re-implement to not need
+ struct _IO_FILE_plus.
+ * strfile.h (struct _IO_strfile_): Likewise.
+
+Wed Jun 1 13:57:48 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * config.shared (CXXFLAGS): Use -fno-implicit-templates instead of
+ -fexternal-templates.
+
+Tue May 31 08:49:28 1994 Mike Stump (mrs@cygnus.com)
+
+ * genops.c, iofclose.c, iofdopen.c, iofopen.c, iopopen.c: Be
+ consistent about protecting #include <stdlib.h>.
+
+ * ioputs.c: Add #include <string.h>, to avoid warning on alpha.
+
+ * iofdopen.c: Add #include <stdlib.h>, so that malloc works on
+ machines where sizeof(int) != sizeof(void *).
+
+Mon May 30 17:26:49 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * pfstream.cc (ipfstream::ipfstream, opfstream::opfstream):
+ Reverse sense of test of return value of procbuf::open.
+ (It returns NULL on failure.)
+
+ * filedoalloc.c (_IO_file_doallocate): Remove dead code for
+ USE_MALLOC_BUF. Add code to return EOF if ALLOC_BUF fails.
+
+Sat May 28 13:47:47 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * iomanip.cc: Explicitly instantiate smanip<int> and
+ smanip<ios::fmtflags>.
+
+Wed May 25 16:04:12 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * strfile.h: Use __P instead of _PARAMS.
+
+Fri May 20 11:42:17 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * libio.h: Rename _PARAMS macro to __P for better glibc and BSD
+ compatibility. (Also define _PARAMS for backwards compatibility.)
+ * cleanup.c, iolibio.h, ioperror.c, iovfprintf.c, iovfscanf.c,
+ libioP.h: Use __P instead of _PARAMS.
+ * iostdio.h: Use __P instead of _ARGS.
+
+ * fileops.c (_IO_file_read): Minor stylistic tweak. (It is
+ preferable to test errno *after* the error return.)
+
+Fri May 13 15:25:36 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * iostream.*: Add insertor and extractor for bool (just pretend
+ it's an int).
+
+Fri May 13 14:12:03 1994 Mike Stump (mrs@cygnus.com)
+
+ * gen-params: Check for builtin bool support.
+
+Wed May 11 00:48:35 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ Make libg++ build with gcc -ansi -pedantic-errors
+ * gen-params: #ifdef __STRICT_ANSI__, #define _G_NO_NRV.
+ * pfstream.cc (ipfstream::ipfstream): Wrap use of variable-size
+ array in #ifndef __STRICT_ANSI__.
+
+Fri May 6 12:42:21 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * Makefile.in (VERSION): Increase to 0.64.
+
+ * isgetline.cc (istream::getline): The delimiter should *not*
+ be included in the gcount().
+
+ * filedoalloc.c: #include <stdlib.h> (If __STDC__) to get malloc.
+ * iostream.h (ostream::put): Remove overloaded versions, to match
+ new working paper. (Actually just put inside _STREAM_COMPAT, for now.)
+
+Tue May 3 14:14:57 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * genops.c (_IO_default_finish): Make robust when called
+ multiple times on the same _IO_FILE*. (One way this can
+ happen is by the builtinbuf destructor being followed by the
+ streambuf destructor.)
+
+Mon May 2 13:55:26 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * gen-params: Actually determine wint_t rather than depending on
+ cpp to provide it or defaulting to the underlying type for
+ wchar_t.
+
+Sat Apr 30 14:47:30 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * gen-params: Add _G_wint_t, allow __*_TYPE__ to override values
+ at compile time, fix definition of _G_ARGS.
+
+Fri Apr 29 16:55:37 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * libio.h: Remove #pragma interface. (There is no implementation.)
+
+Mon Mar 28 14:22:26 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iostream.cc (ostream::operator<<(double)): Add/fix support
+ for printing '+' when ios::showpos is set.
+ (Fixes bug reported by Doug Moore <dougm@cs.rice.edu>.)
+ * iostream.cc (istream::read): Set eofbit as well as failbit on eof.
+ * iostream.cc (ostream::operator<<(int)): Fix conversion
+ to unsigned (used to lose on INT_MIN).
+ * iostream.cc (ostream::operator<<(long)): Use (unsigned long),
+ rather than (unsigned) for temporary.
+
+ * config.shared, Makefile.in: Remove definitions and uses
+ of XTRAFLAGS. It is no longer needed, since it is
+ now implied by the -B flag.
+
+Fri Mar 25 00:31:22 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * builtinbuf.h: Add put /**/ around comment on trailing #endif.
+
+ * Makefile.in (c++clean): Make clean in tests subdir, too.
+
+Wed Mar 23 16:42:09 1994 Doug Evans (dje@canuck.cygnus.com)
+
+ * configure.in: Remove Makefile.tem before creating it.
+ Needed when configuring from read-only source trees.
+
+Wed Mar 16 14:06:42 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * stdstreams.cc: Fix so that stdiobuf are used for cin/cout/cerr,
+ unless _STDIO_USES_IOSTREAM is defined.
+ * filebuf.cc (filebuf::setbuf): Fix confusion about return
+ value from _IO_file_setbuf.
+
+Sun Mar 13 00:54:12 1994 Paul Eggert (eggert@twinsun.com)
+
+ * config.shared: Ensure that `all' precedes `.PHONY';
+ BSDI 1.1 needs this.
+
+Sat Mar 12 03:58:00 1994 Paul Eggert (eggert@twinsun.com)
+
+ * config.shared: Output a definition of INSTALL that uses
+ $${rootme}, not ${rootme}. Most `make's don't care, but BSDI
+ 1.1 `make' does.
+
+Fri Mar 4 17:33:01 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iopopen.c: #define _POSIX_SOURCE.
+ * isgetline.c (istream::getline): Various fixes.
+
+Thu Mar 3 17:58:20 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iostream.cc (write_int): Fix test for when to add initial '0'
+ when ios::oct and ios::showbase are set.
+ For hex, showbase adds initial 0x (or 0X) regardless of val==0.
+ Bugs reported by Phil Roth <proth@cs.uiuc.edu>.
+
+Mon Feb 21 13:18:20 1994 H.J. Lu (hjl@nynexst.com)
+
+ * libio.h (_IO_PENDING_OUTPUT_COUNT(_fp)): return the
+ pending output count in _fp.
+
+Fri Feb 25 09:26:57 1994 Ian Lance Taylor (ian@cygnus.com)
+
+ * gen-params: For HAVE_SYS_WAIT, compile dummy.c, not dummy.C.
+
+Tue Feb 22 11:19:09 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * streambuf.h, genops.c, libioP.h: Rename references to
+ _IO_FILE fields other_gbase => _IO_save_base,
+ _aux_limit => _IO_backup_base, and _other_egptr => _IO_save_end.
+ * libio.h: Remove no-longer needed macros _other_gbase,
+ _aux_limit, and _other_egptr.
+ * genops.c (__underflow, _IO_default_finishh, _IO_unsave_markers):
+ Check _IO_save_base for NULL before FREEing it or calling
+ _IO_free_backup_area.
+
+Thu Feb 17 15:26:59 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * gen-params: Improve deduction of _G_uint32 and _G_int32.
+ Should now work for 16-bit, 32-bit, or 64-bit targets.
+ * gen-params: Check for sys/wait.h using ${CC}, since it's
+ now used in a C file, not a C++ file.
+ * floatconv.c: Typedef _G_uint32_t as unsigned32, and use
+ unsigned32 in place of unsigned long. (Needed for Alpha.)
+
+Tue Feb 8 13:40:15 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * fileops.c (_IO_file_close_it): Simplify by using _IO_do_flush.
+ * fileops.c (_IO_file_finish): Don't call _IO_file_close_it -
+ do it inline. Call _IO_do_flush even if _IO_DELETE_DONT_CLOSE.
+ * fileops.c (_IO_file_attach): Set _IO_DELETE_DONT_CLOSE.
+ * genops.c (_IO_flush_all): Only call overflow if there is
+ something to write.
+ * iofclose.c (_IO_fclose): Check that magic number is correct,
+ and clear it when done. Avoids crashing some buggy applications.
+ * iogetline.c (_IO_getline): Don't gratuitously increment old_len.
+ * iogets.c (_IO_gets): Take care to get required ANSi semantics.
+
+Sun Feb 6 19:50:39 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * iomanip.cc: Explicitly instantiate operator<< and >>.
+
+Fri Feb 4 12:28:22 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * config.shared (CXXFLAGS): Use -fexternal-templates.
+
+ * iomanip.h: Uncomment #pragma interface.
+
+Thu Jan 20 13:48:40 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ If no characters are read by fgets, ANSI C doesn't allow '\0' to
+ be written to the buffer, but it is required by ANSI C++
+ for istream::get and istream::getline. Both use _IO_getline ...
+ * iogetline.c (_IO_getline): Don't write a '\0' at the end
+ of the read data. The input buffer length does not include
+ space for a '\0'.
+ * iofgets.c, iogets.c: Change appropriately.
+ Also check for _IO_ERR_SEEN, as required by ANSI.
+ * isgetline.cc: Update accordingly.
+
+Mon Jan 17 13:24:26 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * Makefile.in (c++clean): Added target for compiler testing
+ (i.e. make c++clean all).
+
+Mon Jan 10 11:20:42 1994 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * libio.h (_IO_putc): Add parentheses.
+ Patch from Rik Faith <faith@cs.unc.edu>.
+
+Tue Jan 4 01:32:28 1993 Hongjiu Lu (hjl@nynexst.com)
+
+ * genops.c (_IO_default_xsputn):
+ (_IO_default_xsgetn):
+ * ioignore.c: change "_IO_size_t count" to
+ "_IO_ssize_t count".
+ * iogetline.c: change "_IO_size_t len" to
+ "_IO_ssize_t len".
+
+Mon Dec 20 00:31:21 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * config.shared (CXXINCLUDES): Fix quoting of $(NOSTDINC).
+
+Sun Dec 19 21:03:45 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * Makefile.in (VERSION): Increase to 0.63.
+
+Fri Dec 17 13:02:44 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iofread.c (_IO_fread): Return 0 if either size or count is 0.
+ * iofwrite.c (_IO_fwrite): Return 0 if either size or count is 0.
+ (This is consistent with fread, and most implementations, but not
+ with a literal reading of the ANSI spec.)
+ * iovfscanf.c (_IO_vfscanf): If got EOF while skipping spaces,
+ set seen_eof and break (instead of returning).
+ * sbscan.cc (streambuf::vscan): Set error state before returning.
+ * streambuf.h: Add a forward declarations for class istream
+ to work around a g++ vtable name mangling bug. (Patch from
+ harry@pdsrc.hilco.com via Jeffrey A Law <law@snake.cs.utah.edu>.)
+ * NEWS: New file.
+
+Sat Dec 11 16:21:08 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iovfprintf.c (struct helper_file, _IO_helper_overflow,
+ helper_vfprintf, _IO_helper_jumps): New structs and functions.
+ (_IO_vfprintf): Use helper_vfprintf to make printing to
+ unbuffered files more efficient.
+ * genops.c (_IO_default_underflow), libioP.h: New function.
+
+ * iovsscanf.c (_IO_vsscanf): The input string's length marks
+ its logical end-of-file.
+
+Wed Dec 8 13:20:46 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * indstream.cc (indirectbuf::sync()): Don't crash if get_stream()
+ or put_stream() are NULL; sync() both streams even if error.
+
+Sun Dec 5 19:24:29 1993 Brendan Kehoe (brendan@lisa.cygnus.com)
+
+ * iostreamP.h (convert_to_seekflags): Use _IO_seek_set instead of
+ 0 inside the conditial expressions.
+
+ * iofsetpos.c (_IO_fsetpos): Delete unused var `pos'.
+
+Sat Dec 4 15:57:26 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * filedoalloc.c (_IO_file_doallocate): Change type of couldbetty
+ to int, and type of size to _IO_size_t, instead of size_t.
+ (Change needed for Ultrix, which incorrectly deliberately doesn't
+ define size_t in <sys/types.h> if _POSIX_SOURCE is defined.)
+
+Thu Dec 2 22:43:03 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * fileops.c (_IO_file_finish): Remove redundant call to _IO_un_link.
+ * iofclose.c (_IO_fclose): Don't call fp->_jumps->__close; it's
+ too low-level. Instead call _IO_file_close_it.
+ * dbz/Makefile.in (rclean, distclean): Add some missing files.
+
+Wed Dec 1 13:19:14 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * config/hpux.mt (MATH_H_INLINES): No longer define.
+ Patch from Jeffrey A Law <law@snake.cs.utah.edu>.
+
+Fri Nov 26 13:28:36 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * config.shared (CINCLUDES): Define default if libg++.
+ * iofread.c: Use _IO_sgetn.c.
+ * iolibio.h (_IO_clearerr): Fix typo.
+ * genops.c (_IO_seekmark): Return 0 on success.
+ * floactconv.c (Binit): Change to static.
+ * iofclose.c (_IO_fclose): Check if file is _IO_stdin, _IO_stdout,
+ or _IO_stderr; if so don't try to free it. Fix from hjl@nynexst.com.
+
+ * genops.c (_IO_default_sync), libioP.h: New function.
+ * libioP.h (_IO_default_close): Use _IO_default_sync -same interface.
+
+ * Makefile.in: Increase version to 0.62.
+ * iopopen.c (_IO_proc_close): Use waitpid (available in libibarty,
+ if needed), rather than wait. Don't block/ignore SIGINT etc,
+ as this is counter to Posix.2.
+ * iopopen.c: Chain open proc_files, and have the child close
+ the ones that are open (as required by Posix.2).
+
+ * fstream.h (fstreambase::rdbuf), strstream.h (strstreambase
+ ::rdbuf): Call ios::rdbuf() instead of getting _strbuf directly.
+
+ * sbscan.cc (streambuf::vscan): Comment out duplicate default arg.
+ * floatconv.c: Recognize Alpha and i860 as little-endian.
+ * streambuf.cc: Return two bogus value returns from void functions.
+ * iolibio.h, iofwrite.c: Fix buffer type to (const void*).
+ * libio.h: Predefine of struct _IO_FILE to help non-g++-compilers.
+ * libioP.h, pfstream.cc, stdfiles.c, iovfscanf.c: Cleanup syntax junk.
+ * stdstreams.cc: Minor simplification.
+ * streambuf.h, builtinbuf.cc: Add non-const ios::_IO_fix_vtable()
+ for temporary binary compatibility.
+
+ * filedoalloc.c, fileops.c: Add _POSIX_SOURCE.
+ * fileops.c, iofopen.c, iofputs.c, iostream.cc, strops.c,
+ strstream.cc, genops.c: Add some missing #includes.
+ * iofopen.c, iofdopen.c: Return NULL if malloc fails.
+ * iovfscanf.c: Fix return type in strtol prototype.
+ * fwrite.c: Remove bogus file.
+
+Wed Nov 17 14:09:42 1993 Per Bothner (bothner@cygnus.com)
+
+ * builtinbuf.cc (ios::_IO_fix_vtable), streambuf.h: Make method
+ const, to reduce problems with -Wcast-qual.
+
+Tue Nov 16 19:30:42 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
+
+ * config.shared (CXXINCLUDE): use ${} instead of $() for NOSTDINC
+
+Tue Nov 16 14:15:45 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iopopen.c (_IO_proc_close): Re-structure to avoid
+ declarations after statements.
+ * floatconv.c: If not __STDC__, #define DBL_MANT_DIG.
+ * config/isc.mt (G_CONFIG_ARGS): Remove bogus spaces.
+ Patch from David A. Avery <daa@nic.cerf.net>.
+
+Tue Nov 16 15:58:31 1993 Mark Eichin (eichin@cygnus.com)
+
+ * Makefile.in (_G_config.h): explicitly use $(SHELL) to run
+ gen-params, since we know it is a script (we're explicitly looking
+ in ${srcdir} for it) and /bin/sh might not be good enough.
+
+Mon Nov 15 13:26:22 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * builtinbuf.cc: Don't depend on initialization of static
+ variable builtinbuf::vtable, since that might happen after
+ we need it (for a static constructor). Instead, initialize
+ it when needed by inlining the code from get_builtin_vtable
+ into ios::_IO_fix_vtable().
+
+ * floatconv.c: Avoid using #elif, which some C compilers lack.
+ * iogetline.c, libioP.h: Make char parameter be int, to avoid
+ some default promotion anomalies.
+
+Fri Nov 5 11:49:46 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * config.shared (do-clean-dvi): Remove TeX work files.
+ * iopopen.c (extern _IO_fork): Don't use parameter type void.
+ * strops.c (_IO_str_init_static): Clear the allocate_buffer
+ function pointer, to mark the strfile as being static.
+ Bug fix from Mike Raisbeck <mike@pudding.rtr.COM>.
+
+Thu Nov 4 10:44:24 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * filebuf.cc (filebuf:): Use sseekoff rather than seekoff
+ (which loses if vtable pointer is NULL).
+
+ * iostream.cc (ostream::operator<<(long long n)): Fix thinko.
+
+ * Makefile.in (VERSION): Increase to 0.60.
+ * Makefile.in (IO_OBJECTS): Added iopopen.o.
+ * config.shared (DISTCLEAN): Also remove Make.pack.
+ * config.shared (CXXINCLUDES): Add $(NOSTDINC).
+
+ * config.shared (INSTALL): Fix so it ues the correct install.sh
+ whether $srcdir is absolute or relative.
+
+ * floatconv.c (DBL_MAX_10_EXP): Fix default value.
+
+Wed Nov 3 10:20:49 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * gen-params: Make more robust to allow random junk (NeXT
+ has spaces) before typedefs.
+
+ * fileops.c (_IO_file_overflow): Reduce code duplication.
+ * Makefile.in (IO_OBJECTS): Remove ioputs.o.
+
+ * iovfscanf.c, libio.h: Extra parameter to _IO_vfscanf,
+ for optionally setting an error indication..
+ * iofscanf.c, ioscanf.c, iofscanf.c, iovsscanf.c: Fix calls to
+ _IO_vfscanf to pass an extra NULL.
+ * sbscan.cc (streambuf::vscan): If passed an extra stream,
+ set its error state (using new _IO_vfscanf parameter.
+
+ * filedoalloc.c, fileops.c, genops.c, iogetline.c, ioignore.c,
+ libio.h, libioP.h, streambuf.cc streambuf.h, strfile.h, strops.c,
+ strstream.cc: Replace macros (_base, _ebuf, _eback, _gptr, _egptr,
+ _pbase, _pptr, _epptr) by field names (_IO_buf_base, _IO_buf_end,
+ _IO_read_base, _IO_read_pre, IO_read_end, _IO_write_base,
+ _IO_write_ptr, _IO_write_end).
+ * libio.h: Remove the old macros (which fixes a conflict.
+
+Mon Nov 1 15:22:12 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iostream.cc: Use _IO_sputn instead of sputn. _IO_sputn does
+ not require a vtable pointer, and is also slightly faster.
+
+ * builtinbuf.{h,cc} (builtinbuf::setbuf): Fix return and
+ parameter types.
+
+Mon Oct 25 12:56:33 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ Kludge to make sure _IO_FILE buffers get flushed before exit.
+ * dbz/dbzmain.c, dbz/fake.c, dbz/byteflip.c:
+ Invoke DBZ_FINISH macro (if defined) before (normal) exits.
+ * dbz/Makefile.in (CFLAGS): Define DBZ_FINISH to call _IO_flush_all.
+
+Sat Oct 23 22:10:53 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * Makefile.in (VERSION): Set to 0.60 for libg++ release.
+ * fileops.c (_IO_file_attach): Set _offset to _IO_pos_BAD.
+ * iostream.cc (ostream::flush): Fix thinkp.
+ * editbuf.cc, isgetsb.cc, isscan.cc, osform.cc, parsestream.cc,
+ pfstream.cc, sbform.cc, sbscan.cc, stdstreams.cc, stream.cc:
+ Replace #include "ioprivate.h" by #include "libioP.h" (and
+ sometimes stdarg.h, stdlib.h and/or string.h).
+ * ioprivate.h: Removed.
+
+
+Thu Oct 21 19:24:02 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * PlotFile.h, SFile.h, editbuf.cc, editbuf.h, filebuf.cc,
+ fstream.cc, fstream.h, indstream.cc, indstream.h, iomanip.cc,
+ iomanip.h, ioprivate.h, iostream.cc, iostream.h, isgetline.cc,
+ isgetsb.cc, parsestream.cc, parsestream.h, pfstream.cc,
+ pfstream.h, procbuf.cc, procbuf.h, stdiostream.cc, stdiostream.h,
+ stdstreams.cc, streambuf.cc, streambuf.h, strstream.cc,
+ strstream.h: Remove old (duplicate) copyright notices.
+
+ * iostream.cc: Fix calls to sync() to be safe in the presence
+ of vtable-less streambufs.
+
+Wed Oct 20 15:22:04 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * streambuf.h (streambuf::underflow, streambuf::overflow):
+ Don't make virtual functions pure.
+ * streambuf.cc (streambuf::underflow, streambuf::overflow):
+ Default definitions (return EOF).
+ * fstream.h: Add new (int fd, char* buf, int len) constructors.
+ These are deprecated, but added for AT&T compatibility.
+ * fstream.cc fstreambase::fstreambase(int fd, char *p, int l): New.
+
+Thu Oct 14 14:57:01 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
+
+ * configure.in: use 'mv -f' instead of 'mv'
+
+Tue Oct 12 05:01:44 1993 Mike Stump (mrs@cygnus.com)
+
+ * floatconv.c: Fix typo, change __STDC to __STDC__.
+
+Mon Oct 11 17:03:12 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * cleanup.c: It should be #if _G_HAVE_ATEXIT, not #ifdef.
+
+ * floatconv.c, iostrerror.c, iovfprintf.c, iovfscanf.c, libioP.h:
+ Bunch of fixes to allow use of non-ANSI (K&R) C compilers.
+
+ * Makefile.in (iostream.list): Use CC=$(CXX) to force use of gcc.
+ * README: New file.
+
+Fri Oct 8 16:19:58 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * Makefile.in: Move ioungetc.o from STDIO_WRAP_OBJECTS to
+ IO_OBJECTS (since it is needed for iovfscanf.c).
+ * iostrerror.c: Add declaration of strerror.
+
+Thu Oct 7 12:02:28 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * cleanup.c: New file, to cause flushing at exit.
+ * filedoalloc.c: Cause flushing on exit.
+ * Makefile.in (OSPRIM_OBJECTS): Add cleanup.o.
+ * gen-params: Check for atexit.
+
+Tue Oct 5 19:11:14 1993 Mike Stump (mrs@cygnus.com)
+
+ * ioperror.c (_IO_strerror): Add missing ()s in _PARAMS usage.
+
+Tue Oct 5 10:33:37 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iofprintf.c, iofscanf.c, ioprintf.c, ioscanf.c, iosprintf.c,
+ iosscanf.c: Remove bogus semi-colon after va_dcl.
+ * ioperror.c: Fix typos in declaration.
+
+Mon Oct 4 17:12:22 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * configure.in (CLEAN): Define (as _G_config.h *.a).
+
+ * fileops.c (_IO_file_read): Don't assume EINTR is defined.
+ * iosetbuf.c: Replace by generalized ...
+ * iosetbuffer.c: ... variant, derived from BSD.
+ * Makefile.in (STDIO_WRAP_OBJECTS): Change correspondingly.
+ * iosetvbuf.c (iosetvbuf): Minor ANSI tweak.
+ * iostdio.h (setbuf, setlinebuf): New #defines.
+ * iolibio.h (_IO_setbuf, _IO_setlinebuf): (Re-)define as macros.
+ * Makefile.in (LIBIO_OBJECTS): New macro.
+
+Tue Sep 28 14:15:52 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * libioP.h (_IO_proc_open, _IO_proc_close): Add missing return types.
+ * procbuf.cc: Belated fixes.
+
+Mon Sep 27 14:04:47 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * Makefile.in: List new files. Add STDIO_WRAP_OBJECTS macro.
+ * floatconv.c (d2b): Use Exp_msk11 instead of Exp_msk1.
+ * iofgetpos.c (_IO_fgetpos), iofsetpos.c (_IO_fsetpos): Clean up.
+ * iolibio.h: New file. Declarations of _IO_foo, for most foo
+ where foo is a stdio function. (Remove these from libio.h.)
+ * iostream.h (istream::istreambuf, ostream::ostreambuf): Move
+ obsolete functions inside #ifdef _STREAM_COMPAT.
+ * libio.h, libioP.h, streambuf.h, parsestream.h, stdiostream.h:
+ Use _IO_fpos_t rather than _IO_pos_t.
+ * iopopen.c: New file type, for pipe (popen-like) streams.
+ * procbuf.cc: Now just a C++ wrapper for the files in iopopen.c.
+ * streambuf.h (ios::unsetf): Return complete old value of flags.
+ * iogets.c (_IO_gets(), ioungetc.c (_IO_ungetc), ioperror.c
+ (_IO_perror), iostrerror.c (_IO_strerror): New files and
+ functions, for stdio implementation.
+ * iostdio.h: Add declarations for various recently-added functions.
+
+Sun Sep 12 14:24:55 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * streambuf.h (ios::showpos):: Fix typo.
+
+Fri Aug 27 12:05:47 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iopadn.c (_IO_padn): Change to return count of chars written.
+ * outfloat.c, iovfprintf.c: Change for new _IO_padn interface.
+ * iostream.cc (ostream::operator<<): Make sure to set badbit
+ on a failure (many places). Use _IO_padn more.
+ * iostream.cc (ostream& ostream::operator<<(const void *p): Move to
+ * osform.cc: ... here, to reduce linking-in-the-world syndrome.
+ * osform.cc: Use rdbuf(), instead of _strbuf directly.
+
+ * genops.c (_IO_sgetn), libio.h: New function.
+ * streambuf.h (streambuf.h::sgetn): Use _IO_sgetn.
+ * SFile.cc (SFile::operator[]): Use sseekoff, not seekoff.
+
+Thu Aug 26 10:16:31 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
+
+ * config.shared (SUBDIRS): only recurse if the directory is configured
+
+Wed Aug 25 12:56:12 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * config/{hpux.mt, isc.mt, sco4.mt}:
+ Moved from ../libg++/config (since they affect _G_config.h).
+ * configure.in: Set target_make_frag to one of the above files.
+
+Fri Aug 20 00:53:14 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * iofopen.c (iofopen): Fix type passed to _IO_un_link().
+ * Makefile.in (_G_config.h): Pass $CC (not $CXX) as CC.
+
+ * configure.in (configdirs): Add dbz and stdio.
+ * fileops.c (_IO_file_seekoff): Convert more old functionality.
+ * iofdopen.c: Use mode parameter to set _flags.
+ * iofscanf.c, ioputs.c, ioscanf.c, iosprintf.c: New files.
+ * Makefile.in (IO_OBJECTS): Added new objects.
+ * iostdio.h: Add feof. fscanf, puts, sprintf, vsprintf.
+ * libio.h: Add _IO_vprintf macro.
+ * iofopen.c: Invoke _IO_un_link if failure.
+ * iovsprintf.c: Write terminating NUL.
+
+ * libioP.h: Add COERCE_FILE macro (by default does nothing).
+ * iofclose.c, iofflush.c, iofgets.c, iofprintf.c, iofputs.c,
+ iofread.c, ioftell.c, iofwrite.c, iosetbuf.c, iosetvbuf.c:
+ Invoke COERCE_FILE macro.
+ * ioftell.c: Use _IO_seekoff.
+
+Wed Aug 18 22:49:56 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * sbform.cc (streambuf::form), sbscan.cc (streambuf::scan):
+ Remove cast to _IO_va_list. (Loses if array type.)
+
+ * libio.h: Handle _IO_va_list for systems that need <stdarg.h>.
+ * floatconv.h: Fix typo (reported by H.J.Lu).
+
+Wed Aug 18 19:34:04 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
+
+ * configure.in (INSTALLDIR): handle native vs. cross case
+
+ * Makefile.in (install): don't use $TARGETLIB, set INSTALLDIR to
+ $(libdir)
+
+Wed Aug 18 12:10:03 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * Makefile.in: Rename iostream-files to iostream.list.
+ * configure.in: Add iostream.list to MOSTLYCLEAN.
+
+Tue Aug 17 18:56:59 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ * Makefile.in: Depend on _G_config.h where appropriate.
+ * config.shared (CXXINCLUDES): If doing libg++, search ../libio.
+
+Tue Aug 17 17:34:24 1993 Per Bothner (bothner@kalessin.cygnus.com)
+
+ New directory. Based on old libg++/iostream code,
+ but extensively re-written.
diff --git a/contrib/libstdc++/libio/Makefile.am b/contrib/libstdc++/libio/Makefile.am
new file mode 100644
index 0000000..dbba6ff
--- /dev/null
+++ b/contrib/libstdc++/libio/Makefile.am
@@ -0,0 +1,67 @@
+## Makefile for the libio subdirectory of the GNU C++ Standard library.
+##
+## Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+##
+## This file is part of the libstdc++ version 3 distribution.
+## Process this file with automake to produce Makefile.in.
+
+## This file is part of the GNU ISO C++ Library. This library is free
+## software; you can redistribute it and/or modify it under the
+## terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option)
+## any later version.
+
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License along
+## with this library; see the file COPYING. If not, write to the Free
+## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+## USA.
+
+AUTOMAKE_OPTIONS = 1.3 cygnus
+
+mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
+
+if GLIBCPP_BUILD_LIBIO
+noinst_LTLIBRARIES = libio.la
+else
+noinst_LTLIBRARIES =
+endif
+
+# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
+GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
+TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
+LIBIO_INCLUDES = @LIBIO_INCLUDES@
+
+INCLUDES = \
+ -nostdinc++ \
+ $(GLIBCPP_INCLUDES) $(LIBIO_INCLUDES) $(TOPLEVEL_INCLUDES)
+
+libio_headers = \
+ libio.h libioP.h iolibio.h
+
+if GLIBCPP_NEED_LIBIO
+LIBIO_SRCS = \
+ filedoalloc.c genops.c fileops.c stdfiles.c c_codecvt.c \
+ iofclose.c iofopen.c
+else
+LIBIO_SRCS =
+endif
+
+if GLIBCPP_NEED_WLIBIO
+LIBIO_WSRCS = \
+ wfiledoalloc.c wfileops.c wgenops.c iofwide.c
+else
+LIBIO_WSRCS =
+endif
+
+
+EXTRA_DIST = iostreamP.h
+
+libio_la_SOURCES = $(LIBIO_SRCS) $(LIBIO_WSRCS)
+
+
+AM_CFLAGS = -D_GNU_SOURCE @DEBUG_FLAGS@
diff --git a/contrib/libstdc++/libio/Makefile.in b/contrib/libstdc++/libio/Makefile.in
new file mode 100644
index 0000000..085c1af
--- /dev/null
+++ b/contrib/libstdc++/libio/Makefile.in
@@ -0,0 +1,426 @@
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
+host_alias = @host_alias@
+host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
+AR = @AR@
+AS = @AS@
+ATOMICITY_INC_SRCDIR = @ATOMICITY_INC_SRCDIR@
+AWK = @AWK@
+BASIC_FILE_H = @BASIC_FILE_H@
+BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCODECVT_C = @CCODECVT_C@
+CCODECVT_H = @CCODECVT_H@
+CLOCALE_H = @CLOCALE_H@
+CMESSAGES_H = @CMESSAGES_H@
+CPP = @CPP@
+CPU_LIMITS_INC_SRCDIR = @CPU_LIMITS_INC_SRCDIR@
+CSHADOW_FLAGS = @CSHADOW_FLAGS@
+CSTDIO_H = @CSTDIO_H@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+C_INCLUDE_DIR = @C_INCLUDE_DIR@
+DATADIRNAME = @DATADIRNAME@
+DEBUG_FLAGS = @DEBUG_FLAGS@
+DLLTOOL = @DLLTOOL@
+EXEEXT = @EXEEXT@
+EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
+GCJ = @GCJ@
+GCJFLAGS = @GCJFLAGS@
+GENCAT = @GENCAT@
+GLIBC21 = @GLIBC21@
+GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+INSTOBJEXT = @INSTOBJEXT@
+INTLBISON = @INTLBISON@
+INTLLIBS = @INTLLIBS@
+INTLOBJS = @INTLOBJS@
+INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
+LIBICONV = @LIBICONV@
+LIBMATHOBJS = @LIBMATHOBJS@
+LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
+LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
+LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@
+LIBTOOL = @LIBTOOL@
+LIBUNWIND_FLAG = @LIBUNWIND_FLAG@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
+OPT_LDFLAGS = @OPT_LDFLAGS@
+OS_INC_SRCDIR = @OS_INC_SRCDIR@
+PACKAGE = @PACKAGE@
+POFILES = @POFILES@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SECTION_FLAGS = @SECTION_FLAGS@
+SECTION_LDFLAGS = @SECTION_LDFLAGS@
+STRIP = @STRIP@
+USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+WARN_FLAGS = @WARN_FLAGS@
+WERROR = @WERROR@
+check_msgfmt = @check_msgfmt@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+glibcpp_CXX = @glibcpp_CXX@
+glibcpp_MOFILES = @glibcpp_MOFILES@
+glibcpp_POFILES = @glibcpp_POFILES@
+glibcpp_basedir = @glibcpp_basedir@
+glibcpp_builddir = @glibcpp_builddir@
+glibcpp_localedir = @glibcpp_localedir@
+glibcpp_prefixdir = @glibcpp_prefixdir@
+glibcpp_srcdir = @glibcpp_srcdir@
+glibcpp_thread_h = @glibcpp_thread_h@
+glibcpp_toolexecdir = @glibcpp_toolexecdir@
+glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
+gxx_include_dir = @gxx_include_dir@
+ifGNUmake = @ifGNUmake@
+libio_la = @libio_la@
+libtool_VERSION = @libtool_VERSION@
+release_VERSION = @release_VERSION@
+toplevel_srcdir = @toplevel_srcdir@
+
+AUTOMAKE_OPTIONS = 1.3 cygnus
+
+mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
+@GLIBCPP_BUILD_LIBIO_TRUE@noinst_LTLIBRARIES = @GLIBCPP_BUILD_LIBIO_TRUE@libio.la
+@GLIBCPP_BUILD_LIBIO_FALSE@noinst_LTLIBRARIES =
+
+# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
+GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
+TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
+LIBIO_INCLUDES = @LIBIO_INCLUDES@
+
+INCLUDES = \
+ -nostdinc++ \
+ $(GLIBCPP_INCLUDES) $(LIBIO_INCLUDES) $(TOPLEVEL_INCLUDES)
+
+
+libio_headers = \
+ libio.h libioP.h iolibio.h
+
+@GLIBCPP_NEED_LIBIO_TRUE@LIBIO_SRCS = @GLIBCPP_NEED_LIBIO_TRUE@\
+@GLIBCPP_NEED_LIBIO_TRUE@ filedoalloc.c genops.c fileops.c stdfiles.c c_codecvt.c \
+@GLIBCPP_NEED_LIBIO_TRUE@ iofclose.c iofopen.c
+@GLIBCPP_NEED_LIBIO_FALSE@LIBIO_SRCS =
+@GLIBCPP_NEED_WLIBIO_TRUE@LIBIO_WSRCS = @GLIBCPP_NEED_WLIBIO_TRUE@\
+@GLIBCPP_NEED_WLIBIO_TRUE@ wfiledoalloc.c wfileops.c wgenops.c iofwide.c
+@GLIBCPP_NEED_WLIBIO_FALSE@LIBIO_WSRCS =
+
+EXTRA_DIST = iostreamP.h
+
+libio_la_SOURCES = $(LIBIO_SRCS) $(LIBIO_WSRCS)
+
+AM_CFLAGS = -D_GNU_SOURCE @DEBUG_FLAGS@
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I..
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+libio_la_LDFLAGS =
+libio_la_LIBADD =
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@libio_la_OBJECTS = \
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@filedoalloc.lo \
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@genops.lo fileops.lo \
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@stdfiles.lo \
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@c_codecvt.lo \
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@iofclose.lo \
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@iofopen.lo \
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@wfiledoalloc.lo \
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@wfileops.lo \
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@wgenops.lo \
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@iofwide.lo
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@libio_la_OBJECTS = \
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@wfiledoalloc.lo \
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@wfileops.lo \
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@wgenops.lo \
+@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@iofwide.lo
+@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@libio_la_OBJECTS = \
+@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@filedoalloc.lo \
+@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@genops.lo \
+@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@fileops.lo \
+@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@stdfiles.lo \
+@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@c_codecvt.lo \
+@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@iofclose.lo \
+@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@iofopen.lo
+@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_FALSE@libio_la_OBJECTS =
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+DIST_COMMON = ChangeLog Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = gtar
+GZIP_ENV = --best
+SOURCES = $(libio_la_SOURCES)
+OBJECTS = $(libio_la_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .obj .s
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --cygnus libio/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-noinstLTLIBRARIES:
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+
+distclean-noinstLTLIBRARIES:
+
+maintainer-clean-noinstLTLIBRARIES:
+
+.c.o:
+ $(COMPILE) -c $<
+
+# FIXME: We should only use cygpath when building on Windows,
+# and only if it is available.
+.c.obj:
+ $(COMPILE) -c `cygpath -w $<`
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+ -rm -f *.$(OBJEXT)
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+.c.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.s.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.S.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+
+maintainer-clean-libtool:
+
+libio.la: $(libio_la_OBJECTS) $(libio_la_DEPENDENCIES)
+ $(LINK) $(libio_la_LDFLAGS) $(libio_la_OBJECTS) $(libio_la_LIBADD) $(LIBS)
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = libio
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ cp -pr $$d/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am:
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-info-am:
+install-info: install-info-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile $(LTLIBRARIES)
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-noinstLTLIBRARIES mostlyclean-compile \
+ mostlyclean-libtool mostlyclean-tags \
+ mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-noinstLTLIBRARIES clean-compile clean-libtool \
+ clean-tags clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am: distclean-noinstLTLIBRARIES distclean-compile \
+ distclean-libtool distclean-tags distclean-generic \
+ clean-am
+ -rm -f libtool
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-noinstLTLIBRARIES \
+ maintainer-clean-compile maintainer-clean-libtool \
+ maintainer-clean-tags maintainer-clean-generic \
+ distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: mostlyclean-noinstLTLIBRARIES distclean-noinstLTLIBRARIES \
+clean-noinstLTLIBRARIES maintainer-clean-noinstLTLIBRARIES \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile mostlyclean-libtool distclean-libtool \
+clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
+dvi-am dvi check check-am installcheck-am installcheck install-info-am \
+install-info install-exec-am install-exec install-data-am install-data \
+install-am install uninstall-am uninstall all-redirect all-am all \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/contrib/libstdc++/libio/_G_config.h b/contrib/libstdc++/libio/_G_config.h
new file mode 100644
index 0000000..d6738c2
--- /dev/null
+++ b/contrib/libstdc++/libio/_G_config.h
@@ -0,0 +1,136 @@
+/* This file is needed by libio to define various configuration parameters.
+ These are always the same in the GNU C library. */
+
+#ifndef _G_config_h
+#define _G_config_h 1
+
+#ifndef _LIBC
+# include <bits/c++config.h>
+# ifdef _GLIBCPP_USE_THREADS
+# define _IO_MTSAFE_IO
+# endif
+#endif
+
+/* Define types for libio in terms of the standard internal type names. */
+
+#include <sys/types.h>
+#define __need_size_t
+#define __need_wchar_t
+#define __need_wint_t
+#define __need_NULL
+#define __need_ptrdiff_t
+#ifdef __cplusplus
+# include <cstddef>
+#else
+# include <stddef.h>
+#endif
+
+
+#ifndef _WINT_T
+/* Integral type unchanged by default argument promotions that can
+ hold any value corresponding to members of the extended character
+ set, as well as at least one value that does not correspond to any
+ member of the extended character set. */
+# define _WINT_T
+typedef unsigned int wint_t;
+#endif
+
+/* For use as part of glibc (native) or as part of libstdc++ (maybe
+ not glibc) */
+#ifndef __c_mbstate_t_defined
+# define __c_mbstate_t_defined 1
+/*# ifdef _GLIBCPP_USE_WCHAR_T*/
+typedef struct
+{
+ int count;
+ wint_t value;
+}__c_mbstate_t;
+/*# endif*/
+#endif
+#undef __need_mbstate_t
+
+typedef size_t _G_size_t;
+
+
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+typedef struct
+{
+ __off_t __pos;
+ __c_mbstate_t __state;
+} _G_fpos_t;
+
+typedef struct
+{
+ __off64_t __pos;
+ __c_mbstate_t __state;
+} _G_fpos64_t;
+#else
+typedef __off_t _G_fpos_t;
+typedef __off64_t _G_fpos64_t;
+#endif
+#define _G_ssize_t __ssize_t
+#define _G_off_t __off_t
+#define _G_off64_t __off64_t
+#define _G_pid_t __pid_t
+#define _G_uid_t __uid_t
+#define _G_wchar_t wchar_t
+#define _G_wint_t wint_t
+#define _G_stat64 stat64
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+# include <iconv.h>
+typedef iconv_t _G_iconv_t;
+#endif
+
+typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
+typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
+typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
+typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
+
+#define _G_HAVE_BOOL 1
+
+
+/* These library features are always available in the GNU C library. */
+#define _G_HAVE_ATEXIT 1
+#define _G_HAVE_SYS_CDEFS 1
+#define _G_HAVE_SYS_WAIT 1
+#define _G_NEED_STDARG_H 1
+#define _G_va_list __gnuc_va_list
+
+#define _G_HAVE_PRINTF_FP 1
+#define _G_HAVE_MMAP 1
+#define _G_HAVE_LONG_DOUBLE_IO 1
+#define _G_HAVE_IO_FILE_OPEN 1
+#define _G_HAVE_IO_GETLINE_INFO 1
+
+#define _G_IO_IO_FILE_VERSION 0x20001
+
+//#define _G_OPEN64 __open64
+//#define _G_LSEEK64 __lseek64
+//#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf)
+
+/* This is defined by <bits/stat.h> if `st_blksize' exists. */
+/*#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)*/
+
+#define _G_BUFSIZ 8192
+
+/* These are the vtbl details for ELF. */
+#define _G_NAMES_HAVE_UNDERSCORE 0
+#define _G_VTABLE_LABEL_HAS_LENGTH 1
+#ifndef _G_USING_THUNKS
+# define _G_USING_THUNKS 1
+#endif /* _G_USING_THUNKS */
+#define _G_VTABLE_LABEL_PREFIX "__vt_"
+#define _G_VTABLE_LABEL_PREFIX_ID __vt_
+
+#define _G_INTERNAL_CCS "UCS4"
+#define _G_HAVE_WEAK_SYMBOL 1
+#define _G_STDIO_USES_LIBIO 1
+
+#if defined __cplusplus || defined __STDC__
+# define _G_ARGS(ARGLIST) ARGLIST
+#else
+# define _G_ARGS(ARGLIST) ()
+#endif
+
+#endif /* _G_config.h */
+
diff --git a/contrib/libstdc++/libio/filedoalloc.c b/contrib/libstdc++/libio/filedoalloc.c
new file mode 100644
index 0000000..12c1135
--- /dev/null
+++ b/contrib/libstdc++/libio/filedoalloc.c
@@ -0,0 +1,101 @@
+/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/*
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley. The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+/* Modified for GNU iostream by Per Bothner 1991, 1992. */
+
+#ifndef _POSIX_SOURCE
+# define _POSIX_SOURCE
+#endif
+#include "libioP.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef __STDC__
+#include <stdlib.h>
+#include <unistd.h>
+#endif
+
+#ifdef _LIBC
+# undef isatty
+# define isatty(Fd) __isatty (Fd)
+#endif
+
+/*
+ * Allocate a file buffer, or switch to unbuffered I/O.
+ * Per the ANSI C standard, ALL tty devices default to line buffered.
+ *
+ * As a side effect, we set __SOPT or __SNPT (en/dis-able fseek
+ * optimisation) right after the _fstat() that finds the buffer size.
+ */
+
+int
+_IO_file_doallocate (fp)
+ _IO_FILE *fp;
+{
+ _IO_size_t size;
+ int couldbetty;
+ char *p;
+ struct _G_stat64 st;
+
+ if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0)
+ {
+ couldbetty = 0;
+ size = _IO_BUFSIZ;
+#if 0
+ /* do not try to optimise fseek() */
+ fp->_flags |= __SNPT;
+#endif
+ }
+ else
+ {
+ couldbetty = S_ISCHR (st.st_mode);
+#if _IO_HAVE_ST_BLKSIZE
+ size = st.st_blksize <= 0 ? _IO_BUFSIZ : st.st_blksize;
+#else
+ size = _IO_BUFSIZ;
+#endif
+ }
+ ALLOC_BUF (p, size, EOF);
+ _IO_setb (fp, p, p + size, 1);
+ if (couldbetty && isatty (fp->_fileno))
+ fp->_flags |= _IO_LINE_BUF;
+ return 1;
+}
diff --git a/contrib/libstdc++/libio/fileops.c b/contrib/libstdc++/libio/fileops.c
new file mode 100644
index 0000000..a830b5c
--- /dev/null
+++ b/contrib/libstdc++/libio/fileops.c
@@ -0,0 +1,1049 @@
+/* Copyright (C) 1993, 1995, 1997-1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+ Written by Per Bothner <bothner@cygnus.com>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+
+#ifndef _POSIX_SOURCE
+# define _POSIX_SOURCE
+#endif
+#include "libioP.h"
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <errno.h>
+#ifdef __STDC__
+#include <stdlib.h>
+#endif
+#if _LIBC
+# include "../wcsmbs/wcsmbsload.h"
+# include <shlib-compat.h>
+#endif
+#ifndef errno
+extern int errno;
+#endif
+#ifndef __set_errno
+# define __set_errno(Val) errno = (Val)
+#endif
+
+
+#ifdef _LIBC
+# define open(Name, Flags, Prot) __open (Name, Flags, Prot)
+# define close(FD) __close (FD)
+# define lseek(FD, Offset, Whence) __lseek (FD, Offset, Whence)
+# define read(FD, Buf, NBytes) __read (FD, Buf, NBytes)
+# define write(FD, Buf, NBytes) __write (FD, Buf, NBytes)
+#else
+# define _IO_new_do_write _IO_do_write
+# define _IO_new_file_attach _IO_file_attach
+# define _IO_new_file_close_it _IO_file_close_it
+# define _IO_new_file_finish _IO_file_finish
+# define _IO_new_file_fopen _IO_file_fopen
+# define _IO_new_file_init _IO_file_init
+# define _IO_new_file_setbuf _IO_file_setbuf
+# define _IO_new_file_sync _IO_file_sync
+# define _IO_new_file_overflow _IO_file_overflow
+# define _IO_new_file_seekoff _IO_file_seekoff
+# define _IO_new_file_underflow _IO_file_underflow
+# define _IO_new_file_write _IO_file_write
+# define _IO_new_file_xsputn _IO_file_xsputn
+#endif
+
+/* An fstream can be in at most one of put mode, get mode, or putback mode.
+ Putback mode is a variant of get mode.
+
+ In a filebuf, there is only one current position, instead of two
+ separate get and put pointers. In get mode, the current position
+ is that of gptr(); in put mode that of pptr().
+
+ The position in the buffer that corresponds to the position
+ in external file system is normally _IO_read_end, except in putback
+ mode, when it is _IO_save_end.
+ If the field _fb._offset is >= 0, it gives the offset in
+ the file as a whole corresponding to eGptr(). (?)
+
+ PUT MODE:
+ If a filebuf is in put mode, then all of _IO_read_ptr, _IO_read_end,
+ and _IO_read_base are equal to each other. These are usually equal
+ to _IO_buf_base, though not necessarily if we have switched from
+ get mode to put mode. (The reason is to maintain the invariant
+ that _IO_read_end corresponds to the external file position.)
+ _IO_write_base is non-NULL and usually equal to _IO_base_base.
+ We also have _IO_write_end == _IO_buf_end, but only in fully buffered mode.
+ The un-flushed character are those between _IO_write_base and _IO_write_ptr.
+
+ GET MODE:
+ If a filebuf is in get or putback mode, eback() != egptr().
+ In get mode, the unread characters are between gptr() and egptr().
+ The OS file position corresponds to that of egptr().
+
+ PUTBACK MODE:
+ Putback mode is used to remember "excess" characters that have
+ been sputbackc'd in a separate putback buffer.
+ In putback mode, the get buffer points to the special putback buffer.
+ The unread characters are the characters between gptr() and egptr()
+ in the putback buffer, as well as the area between save_gptr()
+ and save_egptr(), which point into the original reserve buffer.
+ (The pointers save_gptr() and save_egptr() are the values
+ of gptr() and egptr() at the time putback mode was entered.)
+ The OS position corresponds to that of save_egptr().
+
+ LINE BUFFERED OUTPUT:
+ During line buffered output, _IO_write_base==base() && epptr()==base().
+ However, ptr() may be anywhere between base() and ebuf().
+ This forces a call to filebuf::overflow(int C) on every put.
+ If there is more space in the buffer, and C is not a '\n',
+ then C is inserted, and pptr() incremented.
+
+ UNBUFFERED STREAMS:
+ If a filebuf is unbuffered(), the _shortbuf[1] is used as the buffer.
+*/
+
+#define CLOSED_FILEBUF_FLAGS \
+ (_IO_IS_FILEBUF+_IO_NO_READS+_IO_NO_WRITES+_IO_TIED_PUT_GET)
+
+
+void
+_IO_new_file_init (fp)
+ struct _IO_FILE_plus *fp;
+{
+ /* POSIX.1 allows another file handle to be used to change the position
+ of our file descriptor. Hence we actually don't know the actual
+ position before we do the first fseek (and until a following fflush). */
+ fp->file._offset = _IO_pos_BAD;
+ fp->file._IO_file_flags |= CLOSED_FILEBUF_FLAGS;
+
+ _IO_link_in (fp);
+ fp->file._fileno = -1;
+}
+
+int
+_IO_new_file_close_it (fp)
+ _IO_FILE *fp;
+{
+ int write_status, close_status;
+ if (!_IO_file_is_open (fp))
+ return EOF;
+
+ write_status = _IO_do_flush (fp);
+
+ _IO_unsave_markers(fp);
+
+ close_status = _IO_SYSCLOSE (fp);
+
+ /* Free buffer. */
+ if (fp->_mode <= 0)
+ {
+ _IO_setb (fp, NULL, NULL, 0);
+ _IO_setg (fp, NULL, NULL, NULL);
+ _IO_setp (fp, NULL, NULL);
+ }
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+ else
+ {
+ _IO_wsetb (fp, NULL, NULL, 0);
+ _IO_wsetg (fp, NULL, NULL, NULL);
+ _IO_wsetp (fp, NULL, NULL);
+ }
+#endif
+
+ _IO_un_link ((struct _IO_FILE_plus *) fp);
+ fp->_flags = _IO_MAGIC|CLOSED_FILEBUF_FLAGS;
+ fp->_fileno = -1;
+ fp->_offset = _IO_pos_BAD;
+
+ return close_status ? close_status : write_status;
+}
+
+void
+_IO_new_file_finish (fp, dummy)
+ _IO_FILE *fp;
+ int dummy;
+{
+ if (_IO_file_is_open (fp))
+ {
+ _IO_do_flush (fp);
+ if (!(fp->_flags & _IO_DELETE_DONT_CLOSE))
+ _IO_SYSCLOSE (fp);
+ }
+ _IO_default_finish (fp, 0);
+}
+
+#if defined __GNUC__ && __GNUC__ >= 2
+__inline__
+#endif
+_IO_FILE *
+_IO_file_open (fp, filename, posix_mode, prot, read_write, is32not64)
+ _IO_FILE *fp;
+ const char *filename;
+ int posix_mode;
+ int prot;
+ int read_write;
+ int is32not64;
+{
+ int fdesc;
+#ifdef _G_OPEN64
+ fdesc = (is32not64
+ ? open (filename, posix_mode, prot)
+ : _G_OPEN64 (filename, posix_mode, prot));
+#else
+ fdesc = open (filename, posix_mode, prot);
+#endif
+ if (fdesc < 0)
+ return NULL;
+ fp->_fileno = fdesc;
+ _IO_mask_flags (fp, read_write,_IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
+ if (read_write & _IO_IS_APPENDING)
+ if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT)
+ == _IO_pos_BAD && errno != ESPIPE)
+ return NULL;
+ _IO_link_in ((struct _IO_FILE_plus *) fp);
+ return fp;
+}
+
+_IO_FILE *
+_IO_new_file_fopen (fp, filename, mode, is32not64)
+ _IO_FILE *fp;
+ const char *filename;
+ const char *mode;
+ int is32not64;
+{
+ int oflags = 0, omode;
+ int read_write;
+ int oprot = 0666;
+ int i;
+ _IO_FILE *result;
+#if _LIBC
+ const char *cs;
+#endif
+
+ if (_IO_file_is_open (fp))
+ return 0;
+ switch (*mode)
+ {
+ case 'r':
+ omode = O_RDONLY;
+ read_write = _IO_NO_WRITES;
+ break;
+ case 'w':
+ omode = O_WRONLY;
+ oflags = O_CREAT|O_TRUNC;
+ read_write = _IO_NO_READS;
+ break;
+ case 'a':
+ omode = O_WRONLY;
+ oflags = O_CREAT|O_APPEND;
+ read_write = _IO_NO_READS|_IO_IS_APPENDING;
+ break;
+ default:
+ __set_errno (EINVAL);
+ return NULL;
+ }
+ for (i = 1; i < 4; ++i)
+ {
+ switch (*++mode)
+ {
+ case '\0':
+ break;
+ case '+':
+ omode = O_RDWR;
+ read_write &= _IO_IS_APPENDING;
+ continue;
+ case 'x':
+ oflags |= O_EXCL;
+ continue;
+ case 'b':
+ default:
+ /* Ignore. */
+ continue;
+ }
+ break;
+ }
+
+ result = _IO_file_open (fp, filename, omode|oflags, oprot, read_write,
+ is32not64);
+
+
+#if _LIBC
+ /* Test whether the mode string specifies the conversion. */
+ cs = strstr (mode, ",ccs=");
+ if (cs != NULL)
+ {
+ /* Yep. Load the appropriate conversions and set the orientation
+ to wide. */
+ struct gconv_fcts fcts;
+ struct _IO_codecvt *cc;
+
+ if (! _IO_CHECK_WIDE (fp) || __wcsmbs_named_conv (&fcts, cs + 5) != 0)
+ {
+ /* Something went wrong, we cannot load the conversion modules.
+ This means we cannot proceed since the user explicitly asked
+ for these. */
+ _IO_new_fclose (result);
+ return NULL;
+ }
+
+ cc = fp->_codecvt = &fp->_wide_data->_codecvt;
+
+ /* The functions are always the same. */
+ *cc = __libio_codecvt;
+
+ cc->__cd_in.__cd.__nsteps = 1; /* Only one step allowed. */
+ cc->__cd_in.__cd.__steps = fcts.towc;
+
+ cc->__cd_in.__cd.__data[0].__invocation_counter = 0;
+ cc->__cd_in.__cd.__data[0].__internal_use = 1;
+ cc->__cd_in.__cd.__data[0].__flags = __GCONV_IS_LAST;
+ cc->__cd_in.__cd.__data[0].__statep = &result->_wide_data->_IO_state;
+
+ cc->__cd_out.__cd.__nsteps = 1; /* Only one step allowed. */
+ cc->__cd_out.__cd.__steps = fcts.tomb;
+
+ cc->__cd_out.__cd.__data[0].__invocation_counter = 0;
+ cc->__cd_out.__cd.__data[0].__internal_use = 1;
+ cc->__cd_out.__cd.__data[0].__flags = __GCONV_IS_LAST;
+ cc->__cd_out.__cd.__data[0].__statep = &result->_wide_data->_IO_state;
+
+ /* Set the mode now. */
+ result->_mode = 1;
+ }
+#endif /* GNU libc */
+
+ return result;
+}
+
+_IO_FILE *
+_IO_new_file_attach (fp, fd)
+ _IO_FILE *fp;
+ int fd;
+{
+ if (_IO_file_is_open (fp))
+ return NULL;
+ fp->_fileno = fd;
+ fp->_flags &= ~(_IO_NO_READS+_IO_NO_WRITES);
+ fp->_flags |= _IO_DELETE_DONT_CLOSE;
+ /* Get the current position of the file. */
+ /* We have to do that since that may be junk. */
+ fp->_offset = _IO_pos_BAD;
+ if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
+ == _IO_pos_BAD && errno != ESPIPE)
+ return NULL;
+ return fp;
+}
+
+_IO_FILE *
+_IO_new_file_setbuf (fp, p, len)
+ _IO_FILE *fp;
+ char *p;
+ _IO_ssize_t len;
+{
+ if (_IO_default_setbuf (fp, p, len) == NULL)
+ return NULL;
+
+ fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end
+ = fp->_IO_buf_base;
+ _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
+
+ return fp;
+}
+
+static int new_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
+
+/* Write TO_DO bytes from DATA to FP.
+ Then mark FP as having empty buffers. */
+
+int
+_IO_new_do_write (fp, data, to_do)
+ _IO_FILE *fp;
+ const char *data;
+ _IO_size_t to_do;
+{
+ return (to_do == 0 || new_do_write (fp, data, to_do) == to_do) ? 0 : EOF;
+}
+
+static
+int
+new_do_write (fp, data, to_do)
+ _IO_FILE *fp;
+ const char *data;
+ _IO_size_t to_do;
+{
+ _IO_size_t count;
+ if (fp->_flags & _IO_IS_APPENDING)
+ /* On a system without a proper O_APPEND implementation,
+ you would need to sys_seek(0, SEEK_END) here, but is
+ is not needed nor desirable for Unix- or Posix-like systems.
+ Instead, just indicate that offset (before and after) is
+ unpredictable. */
+ fp->_offset = _IO_pos_BAD;
+ else if (fp->_IO_read_end != fp->_IO_write_base)
+ {
+ _IO_off64_t new_pos
+ = _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1);
+ if (new_pos == _IO_pos_BAD)
+ return 0;
+ fp->_offset = new_pos;
+ }
+ count = _IO_SYSWRITE (fp, data, to_do);
+ if (fp->_cur_column && count)
+ fp->_cur_column = _IO_adjust_column (fp->_cur_column - 1, data, count) + 1;
+ _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
+ fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_buf_base;
+ fp->_IO_write_end = (fp->_mode < 0
+ && (fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
+ ? fp->_IO_buf_base : fp->_IO_buf_end);
+ return count;
+}
+
+int
+_IO_new_file_underflow (fp)
+ _IO_FILE *fp;
+{
+ _IO_ssize_t count;
+#if 0
+ /* SysV does not make this test; take it out for compatibility */
+ if (fp->_flags & _IO_EOF_SEEN)
+ return (EOF);
+#endif
+
+ if (fp->_flags & _IO_NO_READS)
+ {
+ fp->_flags |= _IO_ERR_SEEN;
+ __set_errno (EBADF);
+ return EOF;
+ }
+ if (fp->_IO_read_ptr < fp->_IO_read_end)
+ return *(unsigned char *) fp->_IO_read_ptr;
+
+ if (fp->_IO_buf_base == NULL)
+ {
+ /* Maybe we already have a push back pointer. */
+ if (fp->_IO_save_base != NULL)
+ {
+ free (fp->_IO_save_base);
+ fp->_flags &= ~_IO_IN_BACKUP;
+ }
+ _IO_doallocbuf (fp);
+ }
+
+ /* Flush all line buffered files before reading. */
+ /* FIXME This can/should be moved to genops ?? */
+ if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
+ _IO_flush_all_linebuffered ();
+
+ _IO_switch_to_get_mode (fp);
+
+ /* This is very tricky. We have to adjust those
+ pointers before we call _IO_SYSREAD () since
+ we may longjump () out while waiting for
+ input. Those pointers may be screwed up. H.J. */
+ fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_buf_base;
+ fp->_IO_read_end = fp->_IO_buf_base;
+ fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end
+ = fp->_IO_buf_base;
+
+ count = _IO_SYSREAD (fp, fp->_IO_buf_base,
+ fp->_IO_buf_end - fp->_IO_buf_base);
+ if (count <= 0)
+ {
+ if (count == 0)
+ fp->_flags |= _IO_EOF_SEEN;
+ else
+ fp->_flags |= _IO_ERR_SEEN, count = 0;
+ }
+ fp->_IO_read_end += count;
+ if (count == 0)
+ return EOF;
+ if (fp->_offset != _IO_pos_BAD)
+ _IO_pos_adjust (fp->_offset, count);
+ return *(unsigned char *) fp->_IO_read_ptr;
+}
+
+int
+_IO_new_file_overflow (f, ch)
+ _IO_FILE *f;
+ int ch;
+{
+ if (f->_flags & _IO_NO_WRITES) /* SET ERROR */
+ {
+ f->_flags |= _IO_ERR_SEEN;
+ __set_errno (EBADF);
+ return EOF;
+ }
+ /* If currently reading or no buffer allocated. */
+ if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0 || f->_IO_write_base == 0)
+ {
+ /* Allocate a buffer if needed. */
+ if (f->_IO_write_base == 0)
+ {
+ _IO_doallocbuf (f);
+ _IO_setg (f, f->_IO_buf_base, f->_IO_buf_base, f->_IO_buf_base);
+ }
+ /* Otherwise must be currently reading.
+ If _IO_read_ptr (and hence also _IO_read_end) is at the buffer end,
+ logically slide the buffer forwards one block (by setting the
+ read pointers to all point at the beginning of the block). This
+ makes room for subsequent output.
+ Otherwise, set the read pointers to _IO_read_end (leaving that
+ alone, so it can continue to correspond to the external position). */
+ if (f->_IO_read_ptr == f->_IO_buf_end)
+ f->_IO_read_end = f->_IO_read_ptr = f->_IO_buf_base;
+ f->_IO_write_ptr = f->_IO_read_ptr;
+ f->_IO_write_base = f->_IO_write_ptr;
+ f->_IO_write_end = f->_IO_buf_end;
+ f->_IO_read_base = f->_IO_read_ptr = f->_IO_read_end;
+
+ f->_flags |= _IO_CURRENTLY_PUTTING;
+ if (f->_mode < 0 && f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
+ f->_IO_write_end = f->_IO_write_ptr;
+ }
+ if (ch == EOF)
+ return _IO_new_do_write(f, f->_IO_write_base,
+ f->_IO_write_ptr - f->_IO_write_base);
+ if (f->_IO_write_ptr == f->_IO_buf_end ) /* Buffer is really full */
+ if (_IO_do_flush (f) == EOF)
+ return EOF;
+ *f->_IO_write_ptr++ = ch;
+ if ((f->_flags & _IO_UNBUFFERED)
+ || ((f->_flags & _IO_LINE_BUF) && ch == '\n'))
+ if (_IO_new_do_write(f, f->_IO_write_base,
+ f->_IO_write_ptr - f->_IO_write_base) == EOF)
+ return EOF;
+ return (unsigned char) ch;
+}
+
+int
+_IO_new_file_sync (fp)
+ _IO_FILE *fp;
+{
+ _IO_ssize_t delta;
+ int retval = 0;
+
+ /* char* ptr = cur_ptr(); */
+ if (fp->_IO_write_ptr > fp->_IO_write_base)
+ if (_IO_do_flush(fp)) return EOF;
+ delta = fp->_IO_read_ptr - fp->_IO_read_end;
+ if (delta != 0)
+ {
+#ifdef TODO
+ if (_IO_in_backup (fp))
+ delta -= eGptr () - Gbase ();
+#endif
+ _IO_off64_t new_pos = _IO_SYSSEEK (fp, delta, 1);
+ if (new_pos != (_IO_off64_t) EOF)
+ fp->_IO_read_end = fp->_IO_read_ptr;
+#ifdef ESPIPE
+ else if (errno == ESPIPE)
+ ; /* Ignore error from unseekable devices. */
+#endif
+ else
+ retval = EOF;
+ }
+ if (retval != EOF)
+ fp->_offset = _IO_pos_BAD;
+ /* FIXME: Cleanup - can this be shared? */
+ /* setg(base(), ptr, ptr); */
+ return retval;
+}
+
+_IO_off64_t
+_IO_new_file_seekoff (fp, offset, dir, mode)
+ _IO_FILE *fp;
+ _IO_off64_t offset;
+ int dir;
+ int mode;
+{
+ _IO_off64_t result;
+ _IO_off64_t delta, new_offset;
+ long count;
+ /* POSIX.1 8.2.3.7 says that after a call the fflush() the file
+ offset of the underlying file must be exact. */
+ int must_be_exact = (fp->_IO_read_base == fp->_IO_read_end
+ && fp->_IO_write_base == fp->_IO_write_ptr);
+
+ if (mode == 0)
+ dir = _IO_seek_cur, offset = 0; /* Don't move any pointers. */
+
+ /* Flush unwritten characters.
+ (This may do an unneeded write if we seek within the buffer.
+ But to be able to switch to reading, we would need to set
+ egptr to ptr. That can't be done in the current design,
+ which assumes file_ptr() is eGptr. Anyway, since we probably
+ end up flushing when we close(), it doesn't make much difference.)
+ FIXME: simulate mem-papped files. */
+
+ if (fp->_IO_write_ptr > fp->_IO_write_base || _IO_in_put_mode (fp))
+ if (_IO_switch_to_get_mode (fp))
+ return EOF;
+
+ if (fp->_IO_buf_base == NULL)
+ {
+ /* It could be that we already have a pushback buffer. */
+ if (fp->_IO_read_base != NULL)
+ {
+ free (fp->_IO_read_base);
+ fp->_flags &= ~_IO_IN_BACKUP;
+ }
+ _IO_doallocbuf (fp);
+ _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+ _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
+ }
+
+ switch (dir)
+ {
+ case _IO_seek_cur:
+ /* Adjust for read-ahead (bytes is buffer). */
+ offset -= fp->_IO_read_end - fp->_IO_read_ptr;
+ if (fp->_offset == _IO_pos_BAD)
+ goto dumb;
+ /* Make offset absolute, assuming current pointer is file_ptr(). */
+ offset += fp->_offset;
+
+ dir = _IO_seek_set;
+ break;
+ case _IO_seek_set:
+ break;
+ case _IO_seek_end:
+ {
+ struct _G_stat64 st;
+ if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode))
+ {
+ offset += st.st_size;
+ dir = _IO_seek_set;
+ }
+ else
+ goto dumb;
+ }
+ }
+ /* At this point, dir==_IO_seek_set. */
+
+ /* If we are only interested in the current position we've found it now. */
+ if (mode == 0)
+ return offset;
+
+ /* If destination is within current buffer, optimize: */
+ if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
+ && !_IO_in_backup (fp))
+ {
+ /* Offset relative to start of main get area. */
+ _IO_off64_t rel_offset = (offset - fp->_offset
+ + (fp->_IO_read_end - fp->_IO_read_base));
+ if (rel_offset >= 0)
+ {
+#if 0
+ if (_IO_in_backup (fp))
+ _IO_switch_to_main_get_area (fp);
+#endif
+ if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base)
+ {
+ _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset,
+ fp->_IO_read_end);
+ _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+ {
+ _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
+ goto resync;
+ }
+ }
+#ifdef TODO
+ /* If we have streammarkers, seek forward by reading ahead. */
+ if (_IO_have_markers (fp))
+ {
+ int to_skip = rel_offset
+ - (fp->_IO_read_ptr - fp->_IO_read_base);
+ if (ignore (to_skip) != to_skip)
+ goto dumb;
+ _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
+ goto resync;
+ }
+#endif
+ }
+#ifdef TODO
+ if (rel_offset < 0 && rel_offset >= Bbase () - Bptr ())
+ {
+ if (!_IO_in_backup (fp))
+ _IO_switch_to_backup_area (fp);
+ gbump (fp->_IO_read_end + rel_offset - fp->_IO_read_ptr);
+ _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
+ goto resync;
+ }
+#endif
+ }
+
+#ifdef TODO
+ _IO_unsave_markers (fp);
+#endif
+
+ if (fp->_flags & _IO_NO_READS)
+ goto dumb;
+
+ /* Try to seek to a block boundary, to improve kernel page management. */
+ new_offset = offset & ~(fp->_IO_buf_end - fp->_IO_buf_base - 1);
+ delta = offset - new_offset;
+ if (delta > fp->_IO_buf_end - fp->_IO_buf_base)
+ {
+ new_offset = offset;
+ delta = 0;
+ }
+ result = _IO_SYSSEEK (fp, new_offset, 0);
+ if (result < 0)
+ return EOF;
+ if (delta == 0)
+ count = 0;
+ else
+ {
+ count = _IO_SYSREAD (fp, fp->_IO_buf_base,
+ (must_be_exact
+ ? delta : fp->_IO_buf_end - fp->_IO_buf_base));
+ if (count < delta)
+ {
+ /* We weren't allowed to read, but try to seek the remainder. */
+ offset = count == EOF ? delta : delta-count;
+ dir = _IO_seek_cur;
+ goto dumb;
+ }
+ }
+ _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + delta,
+ fp->_IO_buf_base + count);
+ _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+ fp->_offset = result + count;
+ _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
+ return offset;
+ dumb:
+
+ _IO_unsave_markers (fp);
+ result = _IO_SYSSEEK (fp, offset, dir);
+ if (result != EOF)
+ {
+ _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
+ fp->_offset = result;
+ _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
+ _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+ }
+ return result;
+
+resync:
+ /* We need to do it since it is possible that the file offset in
+ the kernel may be changed behind our back. It may happen when
+ we fopen a file and then do a fork. One process may access the
+ the file and the kernel file offset will be changed. */
+ if (fp->_offset >= 0)
+ _IO_SYSSEEK (fp, fp->_offset, 0);
+
+ return offset;
+}
+
+_IO_ssize_t
+_IO_file_read (fp, buf, size)
+ _IO_FILE *fp;
+ void *buf;
+ _IO_ssize_t size;
+{
+ return read (fp->_fileno, buf, size);
+}
+
+_IO_off64_t
+_IO_file_seek (fp, offset, dir)
+ _IO_FILE *fp;
+ _IO_off64_t offset;
+ int dir;
+{
+#ifdef _G_LSEEK64
+ return _G_LSEEK64 (fp->_fileno, offset, dir);
+#else
+ return lseek (fp->_fileno, offset, dir);
+#endif
+}
+
+int
+_IO_file_stat (fp, st)
+ _IO_FILE *fp;
+ void *st;
+{
+#ifdef _G_FSTAT64
+ return _G_FSTAT64 (fp->_fileno, (struct _G_stat64 *) st);
+#else
+ return fstat (fp->_fileno, (struct stat *) st);
+#endif
+}
+
+int
+_IO_file_close (fp)
+ _IO_FILE *fp;
+{
+ return close (fp->_fileno);
+}
+
+_IO_ssize_t
+_IO_new_file_write (f, data, n)
+ _IO_FILE *f;
+ const void *data;
+ _IO_ssize_t n;
+{
+ _IO_ssize_t to_do = n;
+ while (to_do > 0)
+ {
+ _IO_ssize_t count = write (f->_fileno, data, to_do);
+ if (count < 0)
+ {
+ f->_flags |= _IO_ERR_SEEN;
+ break;
+ }
+ to_do -= count;
+ data = (void *) ((char *) data + count);
+ }
+ n -= to_do;
+ if (f->_offset >= 0)
+ f->_offset += n;
+ return n;
+}
+
+_IO_size_t
+_IO_new_file_xsputn (f, data, n)
+ _IO_FILE *f;
+ const void *data;
+ _IO_size_t n;
+{
+ register const char *s = (const char *) data;
+ _IO_size_t to_do = n;
+ int must_flush = 0;
+ _IO_size_t count;
+
+ if (n <= 0)
+ return 0;
+ /* This is an optimized implementation.
+ If the amount to be written straddles a block boundary
+ (or the filebuf is unbuffered), use sys_write directly. */
+
+ /* First figure out how much space is available in the buffer. */
+ count = f->_IO_write_end - f->_IO_write_ptr; /* Space available. */
+ if ((f->_flags & _IO_LINE_BUF) && (f->_flags & _IO_CURRENTLY_PUTTING))
+ {
+ count = f->_IO_buf_end - f->_IO_write_ptr;
+ if (count >= n)
+ {
+ register const char *p;
+ for (p = s + n; p > s; )
+ {
+ if (*--p == '\n')
+ {
+ count = p - s + 1;
+ must_flush = 1;
+ break;
+ }
+ }
+ }
+ }
+ /* Then fill the buffer. */
+ if (count > 0)
+ {
+ if (count > to_do)
+ count = to_do;
+ if (count > 20)
+ {
+#ifdef _LIBC
+ f->_IO_write_ptr = __mempcpy (f->_IO_write_ptr, s, count);
+#else
+ memcpy (f->_IO_write_ptr, s, count);
+ f->_IO_write_ptr += count;
+#endif
+ s += count;
+ }
+ else
+ {
+ register char *p = f->_IO_write_ptr;
+ register int i = (int) count;
+ while (--i >= 0)
+ *p++ = *s++;
+ f->_IO_write_ptr = p;
+ }
+ to_do -= count;
+ }
+ if (to_do + must_flush > 0)
+ {
+ _IO_size_t block_size, do_write;
+ /* Next flush the (full) buffer. */
+ if (_IO_OVERFLOW (f, EOF) == EOF)
+ return n - to_do;
+
+ /* Try to maintain alignment: write a whole number of blocks.
+ dont_write is what gets left over. */
+ block_size = f->_IO_buf_end - f->_IO_buf_base;
+ do_write = to_do - (block_size >= 128 ? to_do % block_size : 0);
+
+ if (do_write)
+ {
+ count = new_do_write (f, s, do_write);
+ to_do -= count;
+ if (count < do_write)
+ return n - to_do;
+ }
+
+ /* Now write out the remainder. Normally, this will fit in the
+ buffer, but it's somewhat messier for line-buffered files,
+ so we let _IO_default_xsputn handle the general case. */
+ if (to_do)
+ to_do -= _IO_default_xsputn (f, s+do_write, to_do);
+ }
+ return n - to_do;
+}
+
+_IO_size_t
+_IO_file_xsgetn (fp, data, n)
+ _IO_FILE *fp;
+ void *data;
+ _IO_size_t n;
+{
+ register _IO_size_t want, have;
+ register _IO_ssize_t count;
+ register char *s = data;
+
+ want = n;
+
+ if (fp->_IO_buf_base == NULL)
+ {
+ /* Maybe we already have a push back pointer. */
+ if (fp->_IO_save_base != NULL)
+ {
+ free (fp->_IO_save_base);
+ fp->_flags &= ~_IO_IN_BACKUP;
+ }
+ _IO_doallocbuf (fp);
+ }
+
+ while (want > 0)
+ {
+ have = fp->_IO_read_end - fp->_IO_read_ptr;
+ if (want <= have)
+ {
+ memcpy (s, fp->_IO_read_ptr, want);
+ fp->_IO_read_ptr += want;
+ want = 0;
+ }
+ else
+ {
+ if (have > 0)
+ {
+#ifdef _LIBC
+ s = __mempcpy (s, fp->_IO_read_ptr, have);
+#else
+ memcpy (s, fp->_IO_read_ptr, have);
+ s += have;
+#endif
+ want -= have;
+ fp->_IO_read_ptr += have;
+ }
+
+ /* Check for backup and repeat */
+ if (_IO_in_backup (fp))
+ {
+ _IO_switch_to_main_get_area (fp);
+ continue;
+ }
+
+ /* If we now want less than a buffer, underflow and repeat
+ the copy. Otherwise, _IO_SYSREAD directly to
+ the user buffer. */
+ if (fp->_IO_buf_base && want < fp->_IO_buf_end - fp->_IO_buf_base)
+ {
+ if (__underflow (fp) == EOF)
+ break;
+
+ continue;
+ }
+
+ /* These must be set before the sysread as we might longjmp out
+ waiting for input. */
+ _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
+ _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+
+ /* Try to maintain alignment: read a whole number of blocks. */
+ count = want;
+ if (fp->_IO_buf_base)
+ {
+ _IO_size_t block_size = fp->_IO_buf_end - fp->_IO_buf_base;
+ if (block_size >= 128)
+ count -= want % block_size;
+ }
+
+ count = _IO_SYSREAD (fp, s, count);
+ if (count <= 0)
+ {
+ if (count == 0)
+ fp->_flags |= _IO_EOF_SEEN;
+ else
+ fp->_flags |= _IO_ERR_SEEN;
+
+ break;
+ }
+
+ s += count;
+ want -= count;
+ if (fp->_offset != _IO_pos_BAD)
+ _IO_pos_adjust (fp->_offset, count);
+ }
+ }
+
+ return n - want;
+}
+
+struct _IO_jump_t _IO_file_jumps =
+{
+ JUMP_INIT_DUMMY,
+ JUMP_INIT(finish, _IO_new_file_finish),
+ JUMP_INIT(overflow, _IO_new_file_overflow),
+ JUMP_INIT(underflow, _IO_new_file_underflow),
+ JUMP_INIT(uflow, _IO_default_uflow),
+ JUMP_INIT(pbackfail, _IO_default_pbackfail),
+ JUMP_INIT(xsputn, _IO_new_file_xsputn),
+ JUMP_INIT(xsgetn, _IO_file_xsgetn),
+ JUMP_INIT(seekoff, _IO_new_file_seekoff),
+ JUMP_INIT(seekpos, _IO_default_seekpos),
+ JUMP_INIT(setbuf, _IO_new_file_setbuf),
+ JUMP_INIT(sync, _IO_new_file_sync),
+ JUMP_INIT(doallocate, _IO_file_doallocate),
+ JUMP_INIT(read, _IO_file_read),
+ JUMP_INIT(write, _IO_new_file_write),
+ JUMP_INIT(seek, _IO_file_seek),
+ JUMP_INIT(close, _IO_file_close),
+ JUMP_INIT(stat, _IO_file_stat),
+ JUMP_INIT(showmanyc, _IO_default_showmanyc),
+ JUMP_INIT(imbue, _IO_default_imbue)
+};
+
+#ifdef _LIBC
+versioned_symbol (libc, _IO_new_do_write, _IO_do_write, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_attach, _IO_file_attach, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_close_it, _IO_file_close_it, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_finish, _IO_file_finish, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_fopen, _IO_file_fopen, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_init, _IO_file_init, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_setbuf, _IO_file_setbuf, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_sync, _IO_file_sync, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_overflow, _IO_file_overflow, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_seekoff, _IO_file_seekoff, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_underflow, _IO_file_underflow, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_write, _IO_file_write, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_xsputn, _IO_file_xsputn, GLIBC_2_1);
+#endif
diff --git a/contrib/libstdc++/libio/genops.c b/contrib/libstdc++/libio/genops.c
new file mode 100644
index 0000000..b1ae5af
--- /dev/null
+++ b/contrib/libstdc++/libio/genops.c
@@ -0,0 +1,1123 @@
+/* Copyright (C) 1993, 1995, 1997-1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* Generic or default I/O operations. */
+
+#include "libioP.h"
+#ifdef __STDC__
+#include <stdlib.h>
+#endif
+#include <string.h>
+
+#ifdef _IO_MTSAFE_IO
+static _IO_lock_t list_all_lock = _IO_lock_initializer;
+#endif
+
+void
+_IO_un_link (fp)
+ struct _IO_FILE_plus *fp;
+{
+ if (fp->file._flags & _IO_LINKED)
+ {
+ struct _IO_FILE_plus **f;
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_lock (list_all_lock);
+#endif
+ for (f = &_IO_list_all; *f; f = (struct _IO_FILE_plus **) &(*f)->file._chain)
+ {
+ if (*f == fp)
+ {
+ *f = (struct _IO_FILE_plus *) fp->file._chain;
+ break;
+ }
+ }
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_unlock (list_all_lock);
+#endif
+ fp->file._flags &= ~_IO_LINKED;
+ }
+}
+
+void
+_IO_link_in (fp)
+ struct _IO_FILE_plus *fp;
+{
+ if ((fp->file._flags & _IO_LINKED) == 0)
+ {
+ fp->file._flags |= _IO_LINKED;
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_lock (list_all_lock);
+#endif
+ fp->file._chain = (_IO_FILE *) _IO_list_all;
+ _IO_list_all = fp;
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_unlock (list_all_lock);
+#endif
+ }
+}
+
+/* Return minimum _pos markers
+ Assumes the current get area is the main get area. */
+_IO_ssize_t _IO_least_marker __P ((_IO_FILE *fp, char *end_p));
+
+_IO_ssize_t
+_IO_least_marker (fp, end_p)
+ _IO_FILE *fp;
+ char *end_p;
+{
+ _IO_ssize_t least_so_far = end_p - fp->_IO_read_base;
+ struct _IO_marker *mark;
+ for (mark = fp->_markers; mark != NULL; mark = mark->_next)
+ if (mark->_pos < least_so_far)
+ least_so_far = mark->_pos;
+ return least_so_far;
+}
+
+/* Switch current get area from backup buffer to (start of) main get area. */
+
+void
+_IO_switch_to_main_get_area (fp)
+ _IO_FILE *fp;
+{
+ char *tmp;
+ fp->_flags &= ~_IO_IN_BACKUP;
+ /* Swap _IO_read_end and _IO_save_end. */
+ tmp = fp->_IO_read_end;
+ fp->_IO_read_end = fp->_IO_save_end;
+ fp->_IO_save_end= tmp;
+ /* Swap _IO_read_base and _IO_save_base. */
+ tmp = fp->_IO_read_base;
+ fp->_IO_read_base = fp->_IO_save_base;
+ fp->_IO_save_base = tmp;
+ /* Set _IO_read_ptr. */
+ fp->_IO_read_ptr = fp->_IO_read_base;
+}
+
+/* Switch current get area from main get area to (end of) backup area. */
+
+void
+_IO_switch_to_backup_area (fp)
+ _IO_FILE *fp;
+{
+ char *tmp;
+ fp->_flags |= _IO_IN_BACKUP;
+ /* Swap _IO_read_end and _IO_save_end. */
+ tmp = fp->_IO_read_end;
+ fp->_IO_read_end = fp->_IO_save_end;
+ fp->_IO_save_end = tmp;
+ /* Swap _IO_read_base and _IO_save_base. */
+ tmp = fp->_IO_read_base;
+ fp->_IO_read_base = fp->_IO_save_base;
+ fp->_IO_save_base = tmp;
+ /* Set _IO_read_ptr. */
+ fp->_IO_read_ptr = fp->_IO_read_end;
+}
+
+int
+_IO_switch_to_get_mode (fp)
+ _IO_FILE *fp;
+{
+ if (fp->_IO_write_ptr > fp->_IO_write_base)
+ if (_IO_OVERFLOW (fp, EOF) == EOF)
+ return EOF;
+ if (_IO_in_backup (fp))
+ fp->_IO_read_base = fp->_IO_backup_base;
+ else
+ {
+ fp->_IO_read_base = fp->_IO_buf_base;
+ if (fp->_IO_write_ptr > fp->_IO_read_end)
+ fp->_IO_read_end = fp->_IO_write_ptr;
+ }
+ fp->_IO_read_ptr = fp->_IO_write_ptr;
+
+ fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end = fp->_IO_read_ptr;
+
+ fp->_flags &= ~_IO_CURRENTLY_PUTTING;
+ return 0;
+}
+
+void
+_IO_free_backup_area (fp)
+ _IO_FILE *fp;
+{
+ if (_IO_in_backup (fp))
+ _IO_switch_to_main_get_area (fp); /* Just in case. */
+ free (fp->_IO_save_base);
+ fp->_IO_save_base = NULL;
+ fp->_IO_save_end = NULL;
+ fp->_IO_backup_base = NULL;
+}
+
+#if 0
+int
+_IO_switch_to_put_mode (fp)
+ _IO_FILE *fp;
+{
+ fp->_IO_write_base = fp->_IO_read_ptr;
+ fp->_IO_write_ptr = fp->_IO_read_ptr;
+ /* Following is wrong if line- or un-buffered? */
+ fp->_IO_write_end = (fp->_flags & _IO_IN_BACKUP
+ ? fp->_IO_read_end : fp->_IO_buf_end);
+
+ fp->_IO_read_ptr = fp->_IO_read_end;
+ fp->_IO_read_base = fp->_IO_read_end;
+
+ fp->_flags |= _IO_CURRENTLY_PUTTING;
+ return 0;
+}
+#endif
+
+int
+__overflow (f, ch)
+ _IO_FILE *f;
+ int ch;
+{
+ /* This is a single-byte stream. */
+ if (f->_mode == 0)
+ _IO_fwide (f, -1);
+ return _IO_OVERFLOW (f, ch);
+}
+
+static int save_for_backup __P ((_IO_FILE *fp, char *end_p))
+#ifdef _LIBC
+ internal_function
+#endif
+ ;
+
+static int
+#ifdef _LIBC
+internal_function
+#endif
+save_for_backup (fp, end_p)
+ _IO_FILE *fp;
+ char *end_p;
+{
+ /* Append [_IO_read_base..end_p] to backup area. */
+ _IO_ssize_t least_mark = _IO_least_marker (fp, end_p);
+ /* needed_size is how much space we need in the backup area. */
+ _IO_size_t needed_size = (end_p - fp->_IO_read_base) - least_mark;
+ /* FIXME: Dubious arithmetic if pointers are NULL */
+ _IO_size_t current_Bsize = fp->_IO_save_end - fp->_IO_save_base;
+ _IO_size_t avail; /* Extra space available for future expansion. */
+ _IO_ssize_t delta;
+ struct _IO_marker *mark;
+ if (needed_size > current_Bsize)
+ {
+ char *new_buffer;
+ avail = 100;
+ new_buffer = (char *) malloc (avail + needed_size);
+ if (new_buffer == NULL)
+ return EOF; /* FIXME */
+ if (least_mark < 0)
+ {
+#ifdef _LIBC
+ __mempcpy (__mempcpy (new_buffer + avail,
+ fp->_IO_save_end + least_mark,
+ -least_mark),
+ fp->_IO_read_base,
+ end_p - fp->_IO_read_base);
+#else
+ memcpy (new_buffer + avail,
+ fp->_IO_save_end + least_mark,
+ -least_mark);
+ memcpy (new_buffer + avail - least_mark,
+ fp->_IO_read_base,
+ end_p - fp->_IO_read_base);
+#endif
+ }
+ else
+ memcpy (new_buffer + avail,
+ fp->_IO_read_base + least_mark,
+ needed_size);
+ if (fp->_IO_save_base)
+ free (fp->_IO_save_base);
+ fp->_IO_save_base = new_buffer;
+ fp->_IO_save_end = new_buffer + avail + needed_size;
+ }
+ else
+ {
+ avail = current_Bsize - needed_size;
+ if (least_mark < 0)
+ {
+ memmove (fp->_IO_save_base + avail,
+ fp->_IO_save_end + least_mark,
+ -least_mark);
+ memcpy (fp->_IO_save_base + avail - least_mark,
+ fp->_IO_read_base,
+ end_p - fp->_IO_read_base);
+ }
+ else if (needed_size > 0)
+ memcpy (fp->_IO_save_base + avail,
+ fp->_IO_read_base + least_mark,
+ needed_size);
+ }
+ fp->_IO_backup_base = fp->_IO_save_base + avail;
+ /* Adjust all the streammarkers. */
+ delta = end_p - fp->_IO_read_base;
+ for (mark = fp->_markers; mark != NULL; mark = mark->_next)
+ mark->_pos -= delta;
+ return 0;
+}
+
+int
+__underflow (fp)
+ _IO_FILE *fp;
+{
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+ if (fp->_vtable_offset == 0 && _IO_fwide (fp, -1) != -1)
+ return EOF;
+#endif
+
+ if (fp->_mode == 0)
+ _IO_fwide (fp, -1);
+ if (_IO_in_put_mode (fp))
+ if (_IO_switch_to_get_mode (fp) == EOF)
+ return EOF;
+ if (fp->_IO_read_ptr < fp->_IO_read_end)
+ return *(unsigned char *) fp->_IO_read_ptr;
+ if (_IO_in_backup (fp))
+ {
+ _IO_switch_to_main_get_area (fp);
+ if (fp->_IO_read_ptr < fp->_IO_read_end)
+ return *(unsigned char *) fp->_IO_read_ptr;
+ }
+ if (_IO_have_markers (fp))
+ {
+ if (save_for_backup (fp, fp->_IO_read_end))
+ return EOF;
+ }
+ else if (_IO_have_backup (fp))
+ _IO_free_backup_area (fp);
+ return _IO_UNDERFLOW (fp);
+}
+
+int
+__uflow (fp)
+ _IO_FILE *fp;
+{
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+ if (fp->_vtable_offset == 0 && _IO_fwide (fp, -1) != -1)
+ return EOF;
+#endif
+
+ if (fp->_mode == 0)
+ _IO_fwide (fp, -11);
+ if (_IO_in_put_mode (fp))
+ if (_IO_switch_to_get_mode (fp) == EOF)
+ return EOF;
+ if (fp->_IO_read_ptr < fp->_IO_read_end)
+ return *(unsigned char *) fp->_IO_read_ptr++;
+ if (_IO_in_backup (fp))
+ {
+ _IO_switch_to_main_get_area (fp);
+ if (fp->_IO_read_ptr < fp->_IO_read_end)
+ return *(unsigned char *) fp->_IO_read_ptr++;
+ }
+ if (_IO_have_markers (fp))
+ {
+ if (save_for_backup (fp, fp->_IO_read_end))
+ return EOF;
+ }
+ else if (_IO_have_backup (fp))
+ _IO_free_backup_area (fp);
+ return _IO_UFLOW (fp);
+}
+
+void
+_IO_setb (f, b, eb, a)
+ _IO_FILE *f;
+ char *b;
+ char *eb;
+ int a;
+{
+ if (f->_IO_buf_base && !(f->_flags & _IO_USER_BUF))
+ FREE_BUF (f->_IO_buf_base, _IO_blen (f));
+ f->_IO_buf_base = b;
+ f->_IO_buf_end = eb;
+ if (a)
+ f->_flags &= ~_IO_USER_BUF;
+ else
+ f->_flags |= _IO_USER_BUF;
+}
+
+void
+_IO_doallocbuf (fp)
+ _IO_FILE *fp;
+{
+ if (fp->_IO_buf_base)
+ return;
+ if (!(fp->_flags & _IO_UNBUFFERED))
+ if (_IO_DOALLOCATE (fp) != EOF)
+ return;
+ _IO_setb (fp, fp->_shortbuf, fp->_shortbuf+1, 0);
+}
+
+int
+_IO_default_underflow (fp)
+ _IO_FILE *fp;
+{
+ return EOF;
+}
+
+int
+_IO_default_uflow (fp)
+ _IO_FILE *fp;
+{
+ int ch = _IO_UNDERFLOW (fp);
+ if (ch == EOF)
+ return EOF;
+ return *(unsigned char *) fp->_IO_read_ptr++;
+}
+
+_IO_size_t
+_IO_default_xsputn (f, data, n)
+ _IO_FILE *f;
+ const void *data;
+ _IO_size_t n;
+{
+ const char *s = (char *) data;
+ _IO_size_t more = n;
+ if (more <= 0)
+ return 0;
+ for (;;)
+ {
+ /* Space available. */
+ _IO_ssize_t count = f->_IO_write_end - f->_IO_write_ptr;
+ if (count > 0)
+ {
+ if ((_IO_size_t) count > more)
+ count = more;
+ if (count > 20)
+ {
+#ifdef _LIBC
+ f->_IO_write_ptr = __mempcpy (f->_IO_write_ptr, s, count);
+#else
+ memcpy (f->_IO_write_ptr, s, count);
+ f->_IO_write_ptr += count;
+#endif
+ s += count;
+ }
+ else if (count <= 0)
+ count = 0;
+ else
+ {
+ char *p = f->_IO_write_ptr;
+ _IO_ssize_t i;
+ for (i = count; --i >= 0; )
+ *p++ = *s++;
+ f->_IO_write_ptr = p;
+ }
+ more -= count;
+ }
+ if (more == 0 || _IO_OVERFLOW (f, (unsigned char) *s++) == EOF)
+ break;
+ more--;
+ }
+ return n - more;
+}
+
+_IO_size_t
+_IO_sgetn (fp, data, n)
+ _IO_FILE *fp;
+ void *data;
+ _IO_size_t n;
+{
+ /* FIXME handle putback buffer here! */
+ return _IO_XSGETN (fp, data, n);
+}
+
+_IO_size_t
+_IO_default_xsgetn (fp, data, n)
+ _IO_FILE *fp;
+ void *data;
+ _IO_size_t n;
+{
+ _IO_size_t more = n;
+ char *s = (char*) data;
+ for (;;)
+ {
+ /* Data available. */
+ _IO_ssize_t count = fp->_IO_read_end - fp->_IO_read_ptr;
+ if (count > 0)
+ {
+ if ((_IO_size_t) count > more)
+ count = more;
+ if (count > 20)
+ {
+#ifdef _LIBC
+ s = __mempcpy (s, fp->_IO_read_ptr, count);
+#else
+ memcpy (s, fp->_IO_read_ptr, count);
+ s += count;
+#endif
+ fp->_IO_read_ptr += count;
+ }
+ else if (count <= 0)
+ count = 0;
+ else
+ {
+ char *p = fp->_IO_read_ptr;
+ int i = (int) count;
+ while (--i >= 0)
+ *s++ = *p++;
+ fp->_IO_read_ptr = p;
+ }
+ more -= count;
+ }
+ if (more == 0 || __underflow (fp) == EOF)
+ break;
+ }
+ return n - more;
+}
+
+#if 0
+/* Seems not to be needed. --drepper */
+int
+_IO_sync (fp)
+ _IO_FILE *fp;
+{
+ return 0;
+}
+#endif
+
+_IO_FILE *
+_IO_default_setbuf (fp, p, len)
+ _IO_FILE *fp;
+ char *p;
+ _IO_ssize_t len;
+{
+ if (_IO_SYNC (fp) == EOF)
+ return NULL;
+ if (p == NULL || len == 0)
+ {
+ fp->_flags |= _IO_UNBUFFERED;
+ _IO_setb (fp, fp->_shortbuf, fp->_shortbuf+1, 0);
+ }
+ else
+ {
+ fp->_flags &= ~_IO_UNBUFFERED;
+ _IO_setb (fp, p, p+len, 0);
+ }
+ fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end = 0;
+ fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end = 0;
+ return fp;
+}
+
+_IO_off64_t
+_IO_default_seekpos (fp, pos, mode)
+ _IO_FILE *fp;
+ _IO_off64_t pos;
+ int mode;
+{
+ return _IO_SEEKOFF (fp, pos, 0, mode);
+}
+
+int
+_IO_default_doallocate (fp)
+ _IO_FILE *fp;
+{
+ char *buf;
+
+ ALLOC_BUF (buf, _IO_BUFSIZ, EOF);
+ _IO_setb (fp, buf, buf+_IO_BUFSIZ, 1);
+ return 1;
+}
+
+void
+_IO_init (fp, flags)
+ _IO_FILE *fp;
+ int flags;
+{
+ _IO_no_init (fp, flags, -1, NULL, NULL);
+}
+
+void
+_IO_no_init (fp, flags, orientation, wd, jmp)
+ _IO_FILE *fp;
+ int flags;
+ int orientation;
+ struct _IO_wide_data *wd;
+ struct _IO_jump_t *jmp;
+{
+ fp->_flags = _IO_MAGIC|flags;
+ fp->_IO_buf_base = NULL;
+ fp->_IO_buf_end = NULL;
+ fp->_IO_read_base = NULL;
+ fp->_IO_read_ptr = NULL;
+ fp->_IO_read_end = NULL;
+ fp->_IO_write_base = NULL;
+ fp->_IO_write_ptr = NULL;
+ fp->_IO_write_end = NULL;
+ fp->_chain = NULL; /* Not necessary. */
+
+ fp->_IO_save_base = NULL;
+ fp->_IO_backup_base = NULL;
+ fp->_IO_save_end = NULL;
+ fp->_markers = NULL;
+ fp->_cur_column = 0;
+#if _IO_JUMPS_OFFSET
+ fp->_vtable_offset = 0;
+#endif
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_init (*fp->_lock);
+#endif
+ fp->_mode = orientation;
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+ if (orientation >= 0)
+ {
+ fp->_wide_data = wd;
+ fp->_wide_data->_IO_buf_base = NULL;
+ fp->_wide_data->_IO_buf_end = NULL;
+ fp->_wide_data->_IO_read_base = NULL;
+ fp->_wide_data->_IO_read_ptr = NULL;
+ fp->_wide_data->_IO_read_end = NULL;
+ fp->_wide_data->_IO_write_base = NULL;
+ fp->_wide_data->_IO_write_ptr = NULL;
+ fp->_wide_data->_IO_write_end = NULL;
+ fp->_wide_data->_IO_save_base = NULL;
+ fp->_wide_data->_IO_backup_base = NULL;
+ fp->_wide_data->_IO_save_end = NULL;
+
+ fp->_wide_data->_wide_vtable = jmp;
+ }
+#endif
+}
+
+int
+_IO_default_sync (fp)
+ _IO_FILE *fp;
+{
+ return 0;
+}
+
+/* The way the C++ classes are mapped into the C functions in the
+ current implementation, this function can get called twice! */
+
+void
+_IO_default_finish (fp, dummy)
+ _IO_FILE *fp;
+ int dummy;
+{
+ struct _IO_marker *mark;
+ if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF))
+ {
+ FREE_BUF (fp->_IO_buf_base, _IO_blen (fp));
+ fp->_IO_buf_base = fp->_IO_buf_end = NULL;
+ }
+
+ for (mark = fp->_markers; mark != NULL; mark = mark->_next)
+ mark->_sbuf = NULL;
+
+ if (fp->_IO_save_base)
+ {
+ free (fp->_IO_save_base);
+ fp->_IO_save_base = NULL;
+ }
+
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_fini (*fp->_lock);
+#endif
+
+ _IO_un_link ((struct _IO_FILE_plus *) fp);
+}
+
+_IO_off64_t
+_IO_default_seekoff (fp, offset, dir, mode)
+ _IO_FILE *fp;
+ _IO_off64_t offset;
+ int dir;
+ int mode;
+{
+ return _IO_pos_BAD;
+}
+
+int
+_IO_sputbackc (fp, c)
+ _IO_FILE *fp;
+ int c;
+{
+ int result;
+
+ if (fp->_IO_read_ptr > fp->_IO_read_base
+ && (unsigned char)fp->_IO_read_ptr[-1] == (unsigned char)c)
+ {
+ fp->_IO_read_ptr--;
+ result = (unsigned char) c;
+ }
+ else
+ result = _IO_PBACKFAIL (fp, c);
+
+ if (result != EOF)
+ fp->_flags &= ~_IO_EOF_SEEN;
+
+ return result;
+}
+
+int
+_IO_sungetc (fp)
+ _IO_FILE *fp;
+{
+ int result;
+
+ if (fp->_IO_read_ptr > fp->_IO_read_base)
+ {
+ fp->_IO_read_ptr--;
+ result = (unsigned char) *fp->_IO_read_ptr;
+ }
+ else
+ result = _IO_PBACKFAIL (fp, EOF);
+
+ if (result != EOF)
+ fp->_flags &= ~_IO_EOF_SEEN;
+
+ return result;
+}
+
+#if 0 /* Work in progress */
+/* Seems not to be needed. */
+#if 0
+void
+_IO_set_column (fp, c)
+ _IO_FILE *fp;
+ int c;
+{
+ if (c == -1)
+ fp->_column = -1;
+ else
+ fp->_column = c - (fp->_IO_write_ptr - fp->_IO_write_base);
+}
+#else
+int
+_IO_set_column (fp, i)
+ _IO_FILE *fp;
+ int i;
+{
+ fp->_cur_column = i + 1;
+ return 0;
+}
+#endif
+#endif
+
+
+unsigned
+_IO_adjust_column (start, line, count)
+ unsigned start;
+ const char *line;
+ int count;
+{
+ const char *ptr = line + count;
+ while (ptr > line)
+ if (*--ptr == '\n')
+ return line + count - ptr - 1;
+ return start + count;
+}
+
+#if 0
+/* Seems not to be needed. --drepper */
+int
+_IO_get_column (fp)
+ _IO_FILE *fp;
+{
+ if (fp->_cur_column)
+ return _IO_adjust_column (fp->_cur_column - 1,
+ fp->_IO_write_base,
+ fp->_IO_write_ptr - fp->_IO_write_base);
+ return -1;
+}
+#endif
+
+int
+_IO_flush_all ()
+{
+ int result = 0;
+ struct _IO_FILE *fp;
+ for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
+ if (((fp->_mode < 0 && fp->_IO_write_ptr > fp->_IO_write_base)
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+ || (fp->_vtable_offset == 0
+ && fp->_mode > 0 && (fp->_wide_data->_IO_write_ptr
+ > fp->_wide_data->_IO_write_base))
+#endif
+ )
+ && _IO_OVERFLOW (fp, EOF) == EOF)
+ result = EOF;
+ return result;
+}
+
+void
+_IO_flush_all_linebuffered ()
+{
+ struct _IO_FILE *fp;
+ for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
+ if ((fp->_flags & _IO_NO_WRITES) == 0 && fp->_flags & _IO_LINE_BUF)
+ _IO_OVERFLOW (fp, EOF);
+}
+
+static void _IO_unbuffer_write __P ((void));
+
+static void
+_IO_unbuffer_write ()
+{
+ struct _IO_FILE *fp;
+ for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
+ if (! (fp->_flags & _IO_UNBUFFERED)
+ && (! (fp->_flags & _IO_NO_WRITES)
+ || (fp->_flags & _IO_IS_APPENDING))
+ /* Iff stream is un-orientated, it wasn't used. */
+ && fp->_mode != 0)
+ _IO_SETBUF (fp, NULL, 0);
+}
+
+int
+_IO_cleanup ()
+{
+ int result = _IO_flush_all ();
+
+ /* We currently don't have a reliable mechanism for making sure that
+ C++ static destructors are executed in the correct order.
+ So it is possible that other static destructors might want to
+ write to cout - and they're supposed to be able to do so.
+
+ The following will make the standard streambufs be unbuffered,
+ which forces any output from late destructors to be written out. */
+ _IO_unbuffer_write ();
+
+ return result;
+}
+
+
+void
+_IO_init_marker (marker, fp)
+ struct _IO_marker *marker;
+ _IO_FILE *fp;
+{
+ marker->_sbuf = fp;
+ if (_IO_in_put_mode (fp))
+ _IO_switch_to_get_mode (fp);
+ if (_IO_in_backup (fp))
+ marker->_pos = fp->_IO_read_ptr - fp->_IO_read_end;
+ else
+ marker->_pos = fp->_IO_read_ptr - fp->_IO_read_base;
+
+ /* Should perhaps sort the chain? */
+ marker->_next = fp->_markers;
+ fp->_markers = marker;
+}
+
+void
+_IO_remove_marker (marker)
+ struct _IO_marker *marker;
+{
+ /* Unlink from sb's chain. */
+ struct _IO_marker **ptr = &marker->_sbuf->_markers;
+ for (; ; ptr = &(*ptr)->_next)
+ {
+ if (*ptr == NULL)
+ break;
+ else if (*ptr == marker)
+ {
+ *ptr = marker->_next;
+ return;
+ }
+ }
+#if 0
+ if _sbuf has a backup area that is no longer needed, should we delete
+ it now, or wait until the next underflow?
+#endif
+}
+
+#define BAD_DELTA EOF
+
+int
+_IO_marker_difference (mark1, mark2)
+ struct _IO_marker *mark1;
+ struct _IO_marker *mark2;
+{
+ return mark1->_pos - mark2->_pos;
+}
+
+/* Return difference between MARK and current position of MARK's stream. */
+int
+_IO_marker_delta (mark)
+ struct _IO_marker *mark;
+{
+ int cur_pos;
+ if (mark->_sbuf == NULL)
+ return BAD_DELTA;
+ if (_IO_in_backup (mark->_sbuf))
+ cur_pos = mark->_sbuf->_IO_read_ptr - mark->_sbuf->_IO_read_end;
+ else
+ cur_pos = mark->_sbuf->_IO_read_ptr - mark->_sbuf->_IO_read_base;
+ return mark->_pos - cur_pos;
+}
+
+int
+_IO_seekmark (fp, mark, delta)
+ _IO_FILE *fp;
+ struct _IO_marker *mark;
+ int delta;
+{
+ if (mark->_sbuf != fp)
+ return EOF;
+ if (mark->_pos >= 0)
+ {
+ if (_IO_in_backup (fp))
+ _IO_switch_to_main_get_area (fp);
+ fp->_IO_read_ptr = fp->_IO_read_base + mark->_pos;
+ }
+ else
+ {
+ if (!_IO_in_backup (fp))
+ _IO_switch_to_backup_area (fp);
+ fp->_IO_read_ptr = fp->_IO_read_end + mark->_pos;
+ }
+ return 0;
+}
+
+void
+_IO_unsave_markers (fp)
+ _IO_FILE *fp;
+{
+ struct _IO_marker *mark = fp->_markers;
+ if (mark)
+ {
+#ifdef TODO
+ streampos offset = seekoff (0, ios::cur, ios::in);
+ if (offset != EOF)
+ {
+ offset += eGptr () - Gbase ();
+ for ( ; mark != NULL; mark = mark->_next)
+ mark->set_streampos (mark->_pos + offset);
+ }
+ else
+ {
+ for ( ; mark != NULL; mark = mark->_next)
+ mark->set_streampos (EOF);
+ }
+#endif
+ fp->_markers = 0;
+ }
+
+ if (_IO_have_backup (fp))
+ _IO_free_backup_area (fp);
+}
+
+#if 0
+/* Seems not to be needed. --drepper */
+int
+_IO_nobackup_pbackfail (fp, c)
+ _IO_FILE *fp;
+ int c;
+{
+ if (fp->_IO_read_ptr > fp->_IO_read_base)
+ fp->_IO_read_ptr--;
+ if (c != EOF && *fp->_IO_read_ptr != c)
+ *fp->_IO_read_ptr = c;
+ return (unsigned char) c;
+}
+#endif
+
+int
+_IO_default_pbackfail (fp, c)
+ _IO_FILE *fp;
+ int c;
+{
+ if (fp->_IO_read_ptr > fp->_IO_read_base && !_IO_in_backup (fp)
+ && (unsigned char) fp->_IO_read_ptr[-1] == c)
+ --fp->_IO_read_ptr;
+ else
+ {
+ /* Need to handle a filebuf in write mode (switch to read mode). FIXME!*/
+ if (!_IO_in_backup (fp))
+ {
+ /* We need to keep the invariant that the main get area
+ logically follows the backup area. */
+ if (fp->_IO_read_ptr > fp->_IO_read_base && _IO_have_backup (fp))
+ {
+ if (save_for_backup (fp, fp->_IO_read_ptr))
+ return EOF;
+ }
+ else if (!_IO_have_backup (fp))
+ {
+ /* No backup buffer: allocate one. */
+ /* Use nshort buffer, if unused? (probably not) FIXME */
+ int backup_size = 128;
+ char *bbuf = (char *) malloc (backup_size);
+ if (bbuf == NULL)
+ return EOF;
+ fp->_IO_save_base = bbuf;
+ fp->_IO_save_end = fp->_IO_save_base + backup_size;
+ fp->_IO_backup_base = fp->_IO_save_end;
+ }
+ fp->_IO_read_base = fp->_IO_read_ptr;
+ _IO_switch_to_backup_area (fp);
+ }
+ else if (fp->_IO_read_ptr <= fp->_IO_read_base)
+ {
+ /* Increase size of existing backup buffer. */
+ _IO_size_t new_size;
+ _IO_size_t old_size = fp->_IO_read_end - fp->_IO_read_base;
+ char *new_buf;
+ new_size = 2 * old_size;
+ new_buf = (char *) malloc (new_size);
+ if (new_buf == NULL)
+ return EOF;
+ memcpy (new_buf + (new_size - old_size), fp->_IO_read_base,
+ old_size);
+ free (fp->_IO_read_base);
+ _IO_setg (fp, new_buf, new_buf + (new_size - old_size),
+ new_buf + new_size);
+ fp->_IO_backup_base = fp->_IO_read_ptr;
+ }
+
+ *--fp->_IO_read_ptr = c;
+ }
+ return (unsigned char) c;
+}
+
+_IO_off64_t
+_IO_default_seek (fp, offset, dir)
+ _IO_FILE *fp;
+ _IO_off64_t offset;
+ int dir;
+{
+ return _IO_pos_BAD;
+}
+
+int
+_IO_default_stat (fp, st)
+ _IO_FILE *fp;
+ void* st;
+{
+ return EOF;
+}
+
+_IO_ssize_t
+_IO_default_read (fp, data, n)
+ _IO_FILE* fp;
+ void *data;
+ _IO_ssize_t n;
+{
+ return -1;
+}
+
+_IO_ssize_t
+_IO_default_write (fp, data, n)
+ _IO_FILE *fp;
+ const void *data;
+ _IO_ssize_t n;
+{
+ return 0;
+}
+
+int
+_IO_default_showmanyc (fp)
+ _IO_FILE *fp;
+{
+ return -1;
+}
+
+void
+_IO_default_imbue (fp, locale)
+ _IO_FILE *fp;
+ void *locale;
+{
+}
+
+_IO_ITER
+_IO_iter_begin()
+{
+ return (_IO_ITER) _IO_list_all;
+}
+
+_IO_ITER
+_IO_iter_end()
+{
+ return NULL;
+}
+
+_IO_ITER
+_IO_iter_next(iter)
+ _IO_ITER iter;
+{
+ return iter->_chain;
+}
+
+_IO_FILE *
+_IO_iter_file(iter)
+ _IO_ITER iter;
+{
+ return iter;
+}
+
+void
+_IO_list_lock()
+{
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_lock (list_all_lock);
+#endif
+}
+
+void
+_IO_list_unlock()
+{
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_unlock (list_all_lock);
+#endif
+}
+
+void
+_IO_list_resetlock()
+{
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_init (list_all_lock);
+#endif
+}
+
+
+#ifdef TODO
+#if defined(linux)
+#define IO_CLEANUP ;
+#endif
+
+#ifdef IO_CLEANUP
+ IO_CLEANUP
+#else
+struct __io_defs {
+ __io_defs() { }
+ ~__io_defs() { _IO_cleanup (); }
+};
+__io_defs io_defs__;
+#endif
+
+#endif /* TODO */
+
+#ifdef weak_alias
+weak_alias (_IO_cleanup, _cleanup)
+#endif
+
+#ifdef text_set_element
+text_set_element(__libc_atexit, _cleanup);
+#endif
diff --git a/contrib/libstdc++/libio/iofclose.c b/contrib/libstdc++/libio/iofclose.c
new file mode 100644
index 0000000..43a3f58
--- /dev/null
+++ b/contrib/libstdc++/libio/iofclose.c
@@ -0,0 +1,97 @@
+/* Copyright (C) 1993, 1995, 1997-1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#include "libioP.h"
+#ifdef __STDC__
+#include <stdlib.h>
+#endif
+#if _LIBC
+# include "../iconv/gconv_int.h"
+# include <shlib-compat.h>
+#else
+# define SHLIB_COMPAT(a, b, c) 0
+# define _IO_new_fclose fclose
+#endif
+
+int
+_IO_new_fclose (fp)
+ _IO_FILE *fp;
+{
+ int status;
+
+ CHECK_FILE(fp, EOF);
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+ /* We desperately try to help programs which are using streams in a
+ strange way and mix old and new functions. Detect old streams
+ here. */
+ if (fp->_vtable_offset != 0)
+ return _IO_old_fclose (fp);
+#endif
+
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+ _IO_flockfile (fp);
+ if (fp->_IO_file_flags & _IO_IS_FILEBUF)
+ status = _IO_file_close_it (fp);
+ else
+ status = fp->_flags & _IO_ERR_SEEN ? -1 : 0;
+ _IO_FINISH (fp);
+ _IO_funlockfile (fp);
+ if (fp->_mode > 0)
+ {
+#if _LIBC
+ /* This stream has a wide orientation. This means we have to free
+ the conversion functions. */
+ struct _IO_codecvt *cc = fp->_codecvt;
+
+ if (cc->__cd_in.__cd.__steps->__shlib_handle != NULL)
+ {
+ --cc->__cd_in.__cd.__steps->__counter;
+ __gconv_close_transform (cc->__cd_in.__cd.__steps, 1);
+ }
+ if (cc->__cd_out.__cd.__steps->__shlib_handle != NULL)
+ {
+ --cc->__cd_out.__cd.__steps->__counter;
+ __gconv_close_transform (cc->__cd_out.__cd.__steps, 1);
+ }
+#endif
+ }
+ _IO_cleanup_region_end (0);
+ if (_IO_have_backup (fp))
+ _IO_free_backup_area (fp);
+ if (fp != _IO_stdin && fp != _IO_stdout && fp != _IO_stderr)
+ {
+ fp->_IO_file_flags = 0;
+ free(fp);
+ }
+
+ return status;
+}
+
+#ifdef _LIBC
+versioned_symbol (libc, _IO_new_fclose, _IO_fclose, GLIBC_2_1);
+strong_alias (_IO_new_fclose, __new_fclose)
+versioned_symbol (libc, __new_fclose, fclose, GLIBC_2_1);
+#endif
diff --git a/contrib/libstdc++/libio/iofopen.c b/contrib/libstdc++/libio/iofopen.c
new file mode 100644
index 0000000..2dcdee0
--- /dev/null
+++ b/contrib/libstdc++/libio/iofopen.c
@@ -0,0 +1,78 @@
+/* Copyright (C) 1993, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#include "libioP.h"
+#ifdef __STDC__
+#include <stdlib.h>
+#endif
+#ifdef _LIBC
+# include <shlib-compat.h>
+#else
+# define _IO_new_fopen fopen
+#endif
+
+_IO_FILE *
+_IO_new_fopen (filename, mode)
+ const char *filename;
+ const char *mode;
+{
+ struct locked_FILE
+ {
+ struct _IO_FILE_plus fp;
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_t lock;
+#endif
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+ struct _IO_wide_data wd;
+#endif /* !(defined _LIBC || defined _GLIBCPP_USE_WCHAR_T) */
+ } *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
+
+ if (new_f == NULL)
+ return NULL;
+#ifdef _IO_MTSAFE_IO
+ new_f->fp.file._lock = &new_f->lock;
+#endif
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+ _IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, &_IO_wfile_jumps);
+#else
+ _IO_no_init (&new_f->fp.file, 1, 0, NULL, NULL);
+#endif
+ _IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
+ _IO_file_init (&new_f->fp);
+#if !_IO_UNIFIED_JUMPTABLES
+ new_f->fp.vtable = NULL;
+#endif
+ if (_IO_file_fopen ((_IO_FILE *) new_f, filename, mode, 1) != NULL)
+ return (_IO_FILE *) &new_f->fp;
+ _IO_un_link (&new_f->fp);
+ free (new_f);
+ return NULL;
+}
+
+#ifdef _LIBC
+strong_alias (_IO_new_fopen, __new_fopen)
+versioned_symbol (libc, _IO_new_fopen, _IO_fopen, GLIBC_2_1);
+versioned_symbol (libc, __new_fopen, fopen, GLIBC_2_1);
+#endif
diff --git a/contrib/libstdc++/libio/iofwide.c b/contrib/libstdc++/libio/iofwide.c
new file mode 100644
index 0000000..76a20ce
--- /dev/null
+++ b/contrib/libstdc++/libio/iofwide.c
@@ -0,0 +1,476 @@
+/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#include <libioP.h>
+#ifdef _LIBC
+# include <dlfcn.h>
+# include <wchar.h>
+# include <locale/localeinfo.h>
+# include <wcsmbs/wcsmbsload.h>
+# include <iconv/gconv_int.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+
+#if defined(_LIBC) || defined(_GLIBCPP_USE_WCHAR_T)
+# include <langinfo.h>
+#endif
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+/* Prototypes of libio's codecvt functions. */
+static enum __codecvt_result do_out (struct _IO_codecvt *codecvt,
+ __c_mbstate_t *statep,
+ const wchar_t *from_start,
+ const wchar_t *from_end,
+ const wchar_t **from_stop, char *to_start,
+ char *to_end, char **to_stop);
+static enum __codecvt_result do_unshift (struct _IO_codecvt *codecvt,
+ __c_mbstate_t *statep, char *to_start,
+ char *to_end, char **to_stop);
+static enum __codecvt_result do_in (struct _IO_codecvt *codecvt,
+ __c_mbstate_t *statep,
+ const char *from_start,
+ const char *from_end,
+ const char **from_stop, wchar_t *to_start,
+ wchar_t *to_end, wchar_t **to_stop);
+static int do_encoding (struct _IO_codecvt *codecvt);
+static int do_length (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
+ const char *from_start,
+ const char *from_end, _IO_size_t max);
+static int do_max_length (struct _IO_codecvt *codecvt);
+static int do_always_noconv (struct _IO_codecvt *codecvt);
+
+
+/* The functions used in `codecvt' for libio are always the same. */
+struct _IO_codecvt __libio_codecvt =
+{
+ .__codecvt_destr = NULL, /* Destructor, never used. */
+ .__codecvt_do_out = do_out,
+ .__codecvt_do_unshift = do_unshift,
+ .__codecvt_do_in = do_in,
+ .__codecvt_do_encoding = do_encoding,
+ .__codecvt_do_always_noconv = do_always_noconv,
+ .__codecvt_do_length = do_length,
+ .__codecvt_do_max_length = do_max_length
+};
+
+
+#ifdef _LIBC
+static struct __gconv_trans_data libio_translit =
+{
+ .__trans_fct = __gconv_transliterate
+};
+#endif
+#endif /* defined(GLIBCPP_USE_WCHAR_T) */
+
+/* Return orientation of stream. If mode is nonzero try to change
+ the orientation first. */
+#undef _IO_fwide
+int
+_IO_fwide (fp, mode)
+ _IO_FILE *fp;
+ int mode;
+{
+ /* Normalize the value. */
+ mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1);
+
+ if (mode == 0 || fp->_mode != 0)
+ /* The caller simply wants to know about the current orientation
+ or the orientation already has been determined. */
+ return fp->_mode;
+
+ /* Set the orientation appropriately. */
+ if (mode > 0)
+ {
+#ifdef _GLIBCPP_USE_WCHAR_T
+ struct _IO_codecvt *cc = fp->_codecvt;
+
+ fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
+ fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_write_base;
+
+#ifdef _LIBC
+ /* Get the character conversion functions based on the currently
+ selected locale for LC_CTYPE. */
+ {
+ struct gconv_fcts fcts;
+
+ /* Clear the state. We start all over again. */
+ memset (&fp->_wide_data->_IO_state, '\0', sizeof (__c_mbstate_t));
+ memset (&fp->_wide_data->_IO_last_state, '\0', sizeof (__c_mbstate_t));
+
+ __wcsmbs_clone_conv (&fcts);
+
+ /* The functions are always the same. */
+ *cc = __libio_codecvt;
+
+ cc->__cd_in.__cd.__nsteps = 1; /* Only one step allowed. */
+ cc->__cd_in.__cd.__steps = fcts.towc;
+
+ cc->__cd_in.__cd.__data[0].__invocation_counter = 0;
+ cc->__cd_in.__cd.__data[0].__internal_use = 1;
+ cc->__cd_in.__cd.__data[0].__flags = __GCONV_IS_LAST;
+ cc->__cd_in.__cd.__data[0].__statep = &fp->_wide_data->_IO_state;
+
+ /* XXX For now no transliteration. */
+ cc->__cd_in.__cd.__data[0].__trans = NULL;
+
+ cc->__cd_out.__cd.__nsteps = 1; /* Only one step allowed. */
+ cc->__cd_out.__cd.__steps = fcts.tomb;
+
+ cc->__cd_out.__cd.__data[0].__invocation_counter = 0;
+ cc->__cd_out.__cd.__data[0].__internal_use = 1;
+ cc->__cd_out.__cd.__data[0].__flags = __GCONV_IS_LAST;
+ cc->__cd_out.__cd.__data[0].__statep = &fp->_wide_data->_IO_state;
+
+ /* And now the transliteration. */
+ cc->__cd_out.__cd.__data[0].__trans = &libio_translit;
+ }
+#else
+# ifdef _GLIBCPP_USE_WCHAR_T
+ {
+ /* Determine internal and external character sets.
+ XXX For now we make our life easy: we assume a fixed internal
+ encoding (as most sane systems have; hi HP/UX!). If somebody
+ cares about systems which changing internal charsets they
+ should come up with a solution for the determination of the
+ currently used internal character set. */
+#if 0
+ const char *internal_ccs = _G_INTERNAL_CCS;
+ const char *external_ccs = nl_langinfo(CODESET);
+
+ if (external_ccs == NULL)
+ external_ccs = "ISO-8859-1";
+
+ cc->__cd_in = iconv_open (internal_ccs, external_ccs);
+ if (cc->__cd_in != (iconv_t) -1)
+ cc->__cd_out = iconv_open (external_ccs, internal_ccs);
+#endif
+ }
+# else
+# error "somehow determine this from LC_CTYPE"
+# endif
+#endif
+
+ /* From now on use the wide character callback functions. */
+ ((struct _IO_FILE_plus *) fp)->vtable = fp->_wide_data->_wide_vtable;
+#else /* !defined(_GLIBCPP_USE_WCHAR_T) */
+ mode = fp->_mode;
+#endif /* !defined(_GLIBCPP_USE_WCHAR_T) */
+ }
+
+ /* Set the mode now. */
+ fp->_mode = mode;
+
+ return mode;
+}
+
+#ifdef weak_alias
+weak_alias (_IO_fwide, fwide)
+#endif
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+
+static enum __codecvt_result
+do_out (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
+ const wchar_t *from_start, const wchar_t *from_end,
+ const wchar_t **from_stop, char *to_start, char *to_end,
+ char **to_stop)
+{
+ enum __codecvt_result result;
+
+#ifdef _LIBC
+ struct __gconv_step *gs = codecvt->__cd_out.__cd.__steps;
+ int status;
+ size_t dummy;
+ const unsigned char *from_start_copy = (unsigned char *) from_start;
+
+ codecvt->__cd_out.__cd.__data[0].__outbuf = to_start;
+ codecvt->__cd_out.__cd.__data[0].__outbufend = to_end;
+ codecvt->__cd_out.__cd.__data[0].__statep = statep;
+
+ status = DL_CALL_FCT (gs->__fct,
+ (gs, codecvt->__cd_out.__cd.__data, &from_start_copy,
+ (const unsigned char *) from_end, NULL,
+ &dummy, 0, 0));
+
+ *from_stop = (wchar_t *) from_start_copy;
+ *to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf;
+
+ switch (status)
+ {
+ case __GCONV_OK:
+ case __GCONV_EMPTY_INPUT:
+ result = __codecvt_ok;
+ break;
+
+ case __GCONV_FULL_OUTPUT:
+ case __GCONV_INCOMPLETE_INPUT:
+ result = __codecvt_partial;
+ break;
+
+ default:
+ result = __codecvt_error;
+ break;
+ }
+#else
+# ifdef _GLIBCPP_USE_WCHAR_T
+ size_t res;
+ const char *from_start_copy = (const char *) from_start;
+ size_t from_len = from_end - from_start;
+ char *to_start_copy = to_start;
+ size_t to_len = to_end - to_start;
+ res = iconv (codecvt->__cd_out, &from_start_copy, &from_len,
+ &to_start_copy, &to_len);
+
+ if (res == 0 || from_len == 0)
+ result = __codecvt_ok;
+ else if (to_len < codecvt->__codecvt_do_max_length (codecvt))
+ result = __codecvt_partial;
+ else
+ result = __codecvt_error;
+
+# else
+ /* Decide what to do. */
+ result = __codecvt_error;
+# endif
+#endif
+
+ return result;
+}
+
+
+static enum __codecvt_result
+do_unshift (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
+ char *to_start, char *to_end, char **to_stop)
+{
+ enum __codecvt_result result;
+
+#ifdef _LIBC
+ struct __gconv_step *gs = codecvt->__cd_out.__cd.__steps;
+ int status;
+ size_t dummy;
+
+ codecvt->__cd_out.__cd.__data[0].__outbuf = to_start;
+ codecvt->__cd_out.__cd.__data[0].__outbufend = to_end;
+ codecvt->__cd_out.__cd.__data[0].__statep = statep;
+
+ status = DL_CALL_FCT (gs->__fct,
+ (gs, codecvt->__cd_out.__cd.__data, NULL, NULL,
+ NULL, &dummy, 1, 0));
+
+ *to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf;
+
+ switch (status)
+ {
+ case __GCONV_OK:
+ case __GCONV_EMPTY_INPUT:
+ result = __codecvt_ok;
+ break;
+
+ case __GCONV_FULL_OUTPUT:
+ case __GCONV_INCOMPLETE_INPUT:
+ result = __codecvt_partial;
+ break;
+
+ default:
+ result = __codecvt_error;
+ break;
+ }
+#else
+# ifdef _GLIBCPP_USE_WCHAR_T
+ size_t res;
+ char *to_start_copy = (char *) to_start;
+ size_t to_len = to_end - to_start;
+
+ res = iconv (codecvt->__cd_out, NULL, NULL, &to_start_copy, &to_len);
+
+ if (res == 0)
+ result = __codecvt_ok;
+ else if (to_len < codecvt->__codecvt_do_max_length (codecvt))
+ result = __codecvt_partial;
+ else
+ result = __codecvt_error;
+# else
+ /* Decide what to do. */
+ result = __codecvt_error;
+# endif
+#endif
+
+ return result;
+}
+
+
+static enum __codecvt_result
+do_in (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
+ const char *from_start, const char *from_end, const char **from_stop,
+ wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop)
+{
+ enum __codecvt_result result;
+
+#ifdef _LIBC
+ struct __gconv_step *gs = codecvt->__cd_in.__cd.__steps;
+ int status;
+ size_t dummy;
+ const unsigned char *from_start_copy = (unsigned char *) from_start;
+
+ codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_start;
+ codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) to_end;
+ codecvt->__cd_in.__cd.__data[0].__statep = statep;
+
+ status = DL_CALL_FCT (gs->__fct,
+ (gs, codecvt->__cd_in.__cd.__data, &from_start_copy,
+ from_end, NULL, &dummy, 0, 0));
+
+ *from_stop = from_start_copy;
+ *to_stop = (wchar_t *) codecvt->__cd_in.__cd.__data[0].__outbuf;
+
+ switch (status)
+ {
+ case __GCONV_OK:
+ case __GCONV_EMPTY_INPUT:
+ result = __codecvt_ok;
+ break;
+
+ case __GCONV_FULL_OUTPUT:
+ case __GCONV_INCOMPLETE_INPUT:
+ result = __codecvt_partial;
+ break;
+
+ default:
+ result = __codecvt_error;
+ break;
+ }
+#else
+# ifdef _GLIBCPP_USE_WCHAR_T
+ size_t res;
+ const char *from_start_copy = (const char *) from_start;
+ size_t from_len = from_end - from_start;
+ char *to_start_copy = (char *) from_start;
+ size_t to_len = to_end - to_start;
+
+ res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
+ &to_start_copy, &to_len);
+
+ if (res == 0)
+ result = __codecvt_ok;
+ else if (to_len == 0)
+ result = __codecvt_partial;
+ else if (from_len < codecvt->__codecvt_do_max_length (codecvt))
+ result = __codecvt_partial;
+ else
+ result = __codecvt_error;
+# else
+ /* Decide what to do. */
+ result = __codecvt_error;
+# endif
+#endif
+
+ return result;
+}
+
+
+static int
+do_encoding (struct _IO_codecvt *codecvt)
+{
+#ifdef _LIBC
+ /* See whether the encoding is stateful. */
+ if (codecvt->__cd_in.__cd.__steps[0].__stateful)
+ return -1;
+ /* Fortunately not. Now determine the input bytes for the conversion
+ necessary for each wide character. */
+ if (codecvt->__cd_in.__cd.__steps[0].__min_needed_from
+ != codecvt->__cd_in.__cd.__steps[0].__max_needed_from)
+ /* Not a constant value. */
+ return 0;
+
+ return codecvt->__cd_in.__cd.__steps[0].__min_needed_from;
+#else
+ /* Worst case scenario. */
+ return -1;
+#endif
+}
+
+
+static int
+do_always_noconv (struct _IO_codecvt *codecvt)
+{
+ return 0;
+}
+
+
+static int
+do_length (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
+ const char *from_start, const char *from_end, _IO_size_t max)
+{
+ int result;
+#ifdef _LIBC
+ const unsigned char *cp = (const unsigned char *) from_start;
+ wchar_t to_buf[max];
+ struct __gconv_step *gs = codecvt->__cd_in.__cd.__steps;
+ int status;
+ size_t dummy;
+
+ codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_buf;
+ codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) &to_buf[max];
+ codecvt->__cd_in.__cd.__data[0].__statep = statep;
+
+ status = DL_CALL_FCT (gs->__fct,
+ (gs, codecvt->__cd_in.__cd.__data, &cp, from_end,
+ NULL, &dummy, 0, 0));
+
+ result = cp - (const unsigned char *) from_start;
+#else
+# ifdef _GLIBCPP_USE_WCHAR_T
+ const char *from_start_copy = (const char *) from_start;
+ size_t from_len = from_end - from_start;
+ wchar_t to_buf[max];
+ size_t res;
+ char *to_start = (char *) to_buf;
+
+ res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
+ &to_start, &max);
+
+ result = from_start_copy - (char *) from_start;
+# else
+ /* Decide what to do. */
+ result = 0;
+# endif
+#endif
+
+ return result;
+}
+
+
+static int
+do_max_length (struct _IO_codecvt *codecvt)
+{
+#ifdef _LIBC
+ return codecvt->__cd_in.__cd.__steps[0].__max_needed_from;
+#else
+ return MB_CUR_MAX;
+#endif
+}
+
+#endif /* defined(_GLIBCPP_USE_WCHAR_T) */
diff --git a/contrib/libstdc++/libio/iolibio.h b/contrib/libstdc++/libio/iolibio.h
new file mode 100644
index 0000000..61be4b73
--- /dev/null
+++ b/contrib/libstdc++/libio/iolibio.h
@@ -0,0 +1,82 @@
+#include "libio.h"
+
+/* These emulate stdio functionality, but with a different name
+ (_IO_ungetc instead of ungetc), and using _IO_FILE instead of FILE. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int _IO_fclose __P((_IO_FILE*));
+extern int _IO_new_fclose __P((_IO_FILE*));
+extern int _IO_old_fclose __P((_IO_FILE*));
+extern _IO_FILE *_IO_fdopen __P((int, const char*));
+extern _IO_FILE *_IO_old_fdopen __P((int, const char*));
+extern _IO_FILE *_IO_new_fdopen __P((int, const char*));
+extern int _IO_fflush __P((_IO_FILE*));
+extern int _IO_fgetpos __P((_IO_FILE*, _IO_fpos_t*));
+extern int _IO_fgetpos64 __P((_IO_FILE*, _IO_fpos64_t*));
+extern char* _IO_fgets __P((char*, int, _IO_FILE*));
+extern _IO_FILE *_IO_fopen __P((const char*, const char*));
+extern _IO_FILE *_IO_old_fopen __P((const char*, const char*));
+extern _IO_FILE *_IO_new_fopen __P((const char*, const char*));
+extern _IO_FILE *_IO_fopen64 __P((const char*, const char*));
+extern int _IO_fprintf __P((_IO_FILE*, const char*, ...));
+extern int _IO_fputs __P((const char*, _IO_FILE*));
+extern int _IO_fsetpos __P((_IO_FILE*, const _IO_fpos_t *));
+extern int _IO_fsetpos64 __P((_IO_FILE*, const _IO_fpos64_t *));
+extern long int _IO_ftell __P((_IO_FILE*));
+extern _IO_size_t _IO_fread __P((void*, _IO_size_t, _IO_size_t, _IO_FILE*));
+extern _IO_size_t _IO_fwrite __P((const void*,
+ _IO_size_t, _IO_size_t, _IO_FILE*));
+extern char* _IO_gets __P((char*));
+extern void _IO_perror __P((const char*));
+extern int _IO_printf __P((const char*, ...));
+extern int _IO_puts __P((const char*));
+extern int _IO_scanf __P((const char*, ...));
+extern void _IO_setbuffer __P((_IO_FILE *, char*, _IO_size_t));
+extern int _IO_setvbuf __P((_IO_FILE*, char*, int, _IO_size_t));
+extern int _IO_sscanf __P((const char*, const char*, ...));
+extern int _IO_sprintf __P((char *, const char*, ...));
+extern int _IO_ungetc __P((int, _IO_FILE*));
+extern int _IO_vsscanf __P((const char *, const char *, _IO_va_list));
+extern int _IO_vsprintf __P((char*, const char*, _IO_va_list));
+extern int _IO_vswprintf __P((wchar_t*, _IO_size_t, const wchar_t*,
+ _IO_va_list));
+
+struct obstack;
+extern int _IO_obstack_vprintf __P ((struct obstack *, const char *,
+ _IO_va_list));
+extern int _IO_obstack_printf __P ((struct obstack *, const char *, ...));
+#ifndef _IO_pos_BAD
+#define _IO_pos_BAD ((_IO_off64_t)(-1))
+#endif
+#define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN))
+#define _IO_fseek(__fp, __offset, __whence) \
+ (_IO_seekoff(__fp, __offset, __whence, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD ? EOF : 0)
+#define _IO_rewind(FILE) (void)_IO_seekoff(FILE, 0, 0, _IOS_INPUT|_IOS_OUTPUT)
+#define _IO_vprintf(FORMAT, ARGS) _IO_vfprintf(_IO_stdout, FORMAT, ARGS)
+#define _IO_freopen(FILENAME, MODE, FP) \
+ (_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE, 0))
+#define _IO_old_freopen(FILENAME, MODE, FP) \
+ (_IO_old_file_close_it (FP), _IO_old_file_fopen(FP, FILENAME, MODE))
+#define _IO_freopen64(FILENAME, MODE, FP) \
+ (_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE, 1))
+#define _IO_fileno(FP) ((FP)->_fileno)
+extern _IO_FILE* _IO_popen __P((const char*, const char*));
+extern _IO_FILE* _IO_new_popen __P((const char*, const char*));
+extern _IO_FILE* _IO_old_popen __P((const char*, const char*));
+extern int __new_pclose __P((_IO_FILE *));
+extern int __old_pclose __P((_IO_FILE *));
+#define _IO_pclose _IO_fclose
+#define _IO_setbuf(_FP, _BUF) _IO_setbuffer(_FP, _BUF, _IO_BUFSIZ)
+#define _IO_setlinebuf(_FP) _IO_setvbuf(_FP, NULL, 1, 0)
+
+_IO_FILE *__new_freopen __P ((const char *, const char *, _IO_FILE *));
+_IO_FILE *__old_freopen __P ((const char *, const char *, _IO_FILE *));
+
+#ifdef __cplusplus
+}
+#endif
+
+
diff --git a/contrib/libstdc++/libio/libio.h b/contrib/libstdc++/libio/libio.h
new file mode 100644
index 0000000..e2a2a15
--- /dev/null
+++ b/contrib/libstdc++/libio/libio.h
@@ -0,0 +1,511 @@
+/* Copyright (C) 1991,92,93,94,95,97,98,99,2000,2001 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+ Written by Per Bothner <bothner@cygnus.com>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#ifndef _IO_STDIO_H
+#define _IO_STDIO_H
+
+#include <_G_config.h>
+/* ALL of these should be defined in _G_config.h */
+#define _IO_pos_t _G_fpos_t /* obsolete */
+#define _IO_fpos_t _G_fpos_t
+#define _IO_fpos64_t _G_fpos64_t
+#define _IO_size_t _G_size_t
+#define _IO_ssize_t _G_ssize_t
+#define _IO_off_t _G_off_t
+#define _IO_off64_t _G_off64_t
+#define _IO_pid_t _G_pid_t
+#define _IO_uid_t _G_uid_t
+#define _IO_iconv_t _G_iconv_t
+#define _IO_HAVE_SYS_WAIT _G_HAVE_SYS_WAIT
+#define _IO_HAVE_ST_BLKSIZE _G_HAVE_ST_BLKSIZE
+#define _IO_BUFSIZ _G_BUFSIZ
+#define _IO_va_list _G_va_list
+#define _IO_wint_t _G_wint_t
+
+#ifdef _G_NEED_STDARG_H
+/* This define avoids name pollution if we're using GNU stdarg.h */
+# define __need___va_list
+# include <stdarg.h>
+# ifdef __GNUC_VA_LIST
+# undef _IO_va_list
+# define _IO_va_list __gnuc_va_list
+# endif /* __GNUC_VA_LIST */
+#endif
+
+#ifndef __THROW
+# ifdef __cplusplus
+# define __THROW throw ()
+# else
+# define __THROW
+# endif
+#endif /* not __THROW */
+
+#ifndef __P
+# define __P(p) p __THROW
+#endif /* not __P */
+
+#ifndef __PMT
+# define __PMT(p) p
+#endif /* not __PMT */
+
+/* For backward compatibility */
+#ifndef _PARAMS
+# define _PARAMS(protos) __P(protos)
+#endif /*!_PARAMS*/
+
+#ifndef __STDC__
+# ifndef const
+# define const
+# endif
+#endif
+#define _IO_UNIFIED_JUMPTABLES 1
+#ifndef _G_HAVE_PRINTF_FP
+# define _IO_USE_DTOA 1
+#endif
+
+#ifndef EOF
+# define EOF (-1)
+#endif
+#ifndef NULL
+# if defined __GNUG__ && \
+ (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
+# define NULL (__null)
+# else
+# if !defined(__cplusplus)
+# define NULL ((void*)0)
+# else
+# define NULL (0)
+# endif
+# endif
+#endif
+
+#define _IOS_INPUT 1
+#define _IOS_OUTPUT 2
+#define _IOS_ATEND 4
+#define _IOS_APPEND 8
+#define _IOS_TRUNC 16
+#define _IOS_NOCREATE 32
+#define _IOS_NOREPLACE 64
+#define _IOS_BIN 128
+
+/* Magic numbers and bits for the _flags field.
+ The magic numbers use the high-order bits of _flags;
+ the remaining bits are available for variable flags.
+ Note: The magic numbers must all be negative if stdio
+ emulation is desired. */
+
+#define _IO_MAGIC 0xFBAD0000 /* Magic number */
+#define _OLD_STDIO_MAGIC 0xFABC0000 /* Emulate old stdio. */
+#define _IO_MAGIC_MASK 0xFFFF0000
+#define _IO_USER_BUF 1 /* User owns buffer; don't delete it on close. */
+#define _IO_UNBUFFERED 2
+#define _IO_NO_READS 4 /* Reading not allowed */
+#define _IO_NO_WRITES 8 /* Writing not allowd */
+#define _IO_EOF_SEEN 0x10
+#define _IO_ERR_SEEN 0x20
+#define _IO_DELETE_DONT_CLOSE 0x40 /* Don't call close(_fileno) on cleanup. */
+#define _IO_LINKED 0x80 /* Set if linked (using _chain) to streambuf::_list_all.*/
+#define _IO_IN_BACKUP 0x100
+#define _IO_LINE_BUF 0x200
+#define _IO_TIED_PUT_GET 0x400 /* Set if put and get pointer logicly tied. */
+#define _IO_CURRENTLY_PUTTING 0x800
+#define _IO_IS_APPENDING 0x1000
+#define _IO_IS_FILEBUF 0x2000
+#define _IO_BAD_SEEN 0x4000
+#define _IO_USER_LOCK 0x8000
+
+/* These are "formatting flags" matching the iostream fmtflags enum values. */
+#define _IO_SKIPWS 01
+#define _IO_LEFT 02
+#define _IO_RIGHT 04
+#define _IO_INTERNAL 010
+#define _IO_DEC 020
+#define _IO_OCT 040
+#define _IO_HEX 0100
+#define _IO_SHOWBASE 0200
+#define _IO_SHOWPOINT 0400
+#define _IO_UPPERCASE 01000
+#define _IO_SHOWPOS 02000
+#define _IO_SCIENTIFIC 04000
+#define _IO_FIXED 010000
+#define _IO_UNITBUF 020000
+#define _IO_STDIO 040000
+#define _IO_DONT_CLOSE 0100000
+#define _IO_BOOLALPHA 0200000
+
+
+struct _IO_jump_t; struct _IO_FILE;
+
+/* Handle lock. */
+#ifdef _IO_MTSAFE_IO
+# if defined __GLIBC__ && __GLIBC__ >= 2
+# if __GLIBC_MINOR__ == 0
+# include <stdio-lock.h>
+# else
+# include <bits/stdio-lock.h>
+# endif
+# else
+/*# include <comthread.h>*/
+# endif
+#else
+typedef void _IO_lock_t;
+#endif
+
+
+/* A streammarker remembers a position in a buffer. */
+
+struct _IO_marker {
+ struct _IO_marker *_next;
+ struct _IO_FILE *_sbuf;
+ /* If _pos >= 0
+ it points to _buf->Gbase()+_pos. FIXME comment */
+ /* if _pos < 0, it points to _buf->eBptr()+_pos. FIXME comment */
+ int _pos;
+#if 0
+ void set_streampos(streampos sp) { _spos = sp; }
+ void set_offset(int offset) { _pos = offset; _spos = (streampos)(-2); }
+ public:
+ streammarker(streambuf *sb);
+ ~streammarker();
+ int saving() { return _spos == -2; }
+ int delta(streammarker&);
+ int delta();
+#endif
+};
+
+/* This is the structure from the libstdc++ codecvt class. */
+enum __codecvt_result
+{
+ __codecvt_ok,
+ __codecvt_partial,
+ __codecvt_error,
+ __codecvt_noconv
+};
+
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+/* The order of the elements in the following struct must match the order
+ of the virtual functions in the libstdc++ codecvt class. */
+struct _IO_codecvt
+{
+ void (*__codecvt_destr) (struct _IO_codecvt *);
+ enum __codecvt_result (*__codecvt_do_out) (struct _IO_codecvt *,
+ __c_mbstate_t *,
+ const wchar_t *,
+ const wchar_t *,
+ const wchar_t **, char *,
+ char *, char **);
+ enum __codecvt_result (*__codecvt_do_unshift) (struct _IO_codecvt *,
+ __c_mbstate_t *, char *,
+ char *, char **);
+ enum __codecvt_result (*__codecvt_do_in) (struct _IO_codecvt *,
+ __c_mbstate_t *,
+ const char *, const char *,
+ const char **, wchar_t *,
+ wchar_t *, wchar_t **);
+ int (*__codecvt_do_encoding) (struct _IO_codecvt *);
+ int (*__codecvt_do_always_noconv) (struct _IO_codecvt *);
+ int (*__codecvt_do_length) (struct _IO_codecvt *, __c_mbstate_t *,
+ const char *, const char *, _IO_size_t);
+ int (*__codecvt_do_max_length) (struct _IO_codecvt *);
+
+ _IO_iconv_t __cd_in;
+ _IO_iconv_t __cd_out;
+};
+
+/* Extra data for wide character streams. */
+struct _IO_wide_data
+{
+ wchar_t *_IO_read_ptr; /* Current read pointer */
+ wchar_t *_IO_read_end; /* End of get area. */
+ wchar_t *_IO_read_base; /* Start of putback+get area. */
+ wchar_t *_IO_write_base; /* Start of put area. */
+ wchar_t *_IO_write_ptr; /* Current put pointer. */
+ wchar_t *_IO_write_end; /* End of put area. */
+ wchar_t *_IO_buf_base; /* Start of reserve area. */
+ wchar_t *_IO_buf_end; /* End of reserve area. */
+ /* The following fields are used to support backing up and undo. */
+ wchar_t *_IO_save_base; /* Pointer to start of non-current get area. */
+ wchar_t *_IO_backup_base; /* Pointer to first valid character of
+ backup area */
+ wchar_t *_IO_save_end; /* Pointer to end of non-current get area. */
+
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+ __c_mbstate_t _IO_state;
+ __c_mbstate_t _IO_last_state;
+#endif
+ struct _IO_codecvt _codecvt;
+
+ wchar_t _shortbuf[1];
+
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+ struct _IO_jump_t *_wide_vtable;
+#endif
+};
+#else /* !(defined _LIBC || defined _GLIBCPP_USE_WCHAR_T) */
+/* Because _IO_no_init unconditionally takes a `_IO_wide_data*' as its
+ last parameter we must still define this type. We intentionally
+ leave it incomplete to prevent any use of this type when we are not
+ supporting wide characters. */
+struct _IO_wide_data;
+#endif /* !(defined _LIBC || defined _GLIBCPP_USE_WCHAR_T) */
+
+struct _IO_FILE {
+ int _flags; /* High-order word is _IO_MAGIC; rest is flags. */
+#define _IO_file_flags _flags
+
+ /* The following pointers correspond to the C++ streambuf protocol. */
+ /* Note: Tk uses the _IO_read_ptr and _IO_read_end fields directly. */
+ char* _IO_read_ptr; /* Current read pointer */
+ char* _IO_read_end; /* End of get area. */
+ char* _IO_read_base; /* Start of putback+get area. */
+ char* _IO_write_base; /* Start of put area. */
+ char* _IO_write_ptr; /* Current put pointer. */
+ char* _IO_write_end; /* End of put area. */
+ char* _IO_buf_base; /* Start of reserve area. */
+ char* _IO_buf_end; /* End of reserve area. */
+ /* The following fields are used to support backing up and undo. */
+ char *_IO_save_base; /* Pointer to start of non-current get area. */
+ char *_IO_backup_base; /* Pointer to first valid character of backup area */
+ char *_IO_save_end; /* Pointer to end of non-current get area. */
+
+ struct _IO_marker *_markers;
+
+ struct _IO_FILE *_chain;
+
+ int _fileno;
+ int _blksize;
+ _IO_off_t _old_offset; /* This used to be _offset but it's too small. */
+
+#define __HAVE_COLUMN /* temporary */
+ /* 1+column number of pbase(); 0 is unknown. */
+ unsigned short _cur_column;
+ signed char _vtable_offset;
+ char _shortbuf[1];
+
+ /* char* _save_gptr; char* _save_egptr; */
+
+ _IO_lock_t *_lock;
+#ifdef _IO_USE_OLD_IO_FILE
+};
+
+struct _IO_FILE_complete
+{
+ struct _IO_FILE _file;
+#endif
+#if defined _G_IO_IO_FILE_VERSION && _G_IO_IO_FILE_VERSION == 0x20001
+ _IO_off64_t _offset;
+# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+ /* Wide character stream stuff. */
+ struct _IO_codecvt *_codecvt;
+ struct _IO_wide_data *_wide_data;
+# else
+ void *__pad1;
+ void *__pad2;
+# endif
+ int _mode;
+ /* Make sure we don't get into trouble again. */
+ char _unused2[15 * sizeof (int) - 2 * sizeof (void *)];
+#endif
+};
+
+#ifndef __cplusplus
+typedef struct _IO_FILE _IO_FILE;
+#endif
+
+struct _IO_FILE_plus;
+
+extern struct _IO_FILE_plus _IO_2_1_stdin_;
+extern struct _IO_FILE_plus _IO_2_1_stdout_;
+extern struct _IO_FILE_plus _IO_2_1_stderr_;
+#ifndef _LIBC
+#define _IO_stdin ((_IO_FILE*)(&_IO_2_1_stdin_))
+#define _IO_stdout ((_IO_FILE*)(&_IO_2_1_stdout_))
+#define _IO_stderr ((_IO_FILE*)(&_IO_2_1_stderr_))
+#else
+extern _IO_FILE *_IO_stdin;
+extern _IO_FILE *_IO_stdout;
+extern _IO_FILE *_IO_stderr;
+#endif
+
+
+/* Functions to do I/O and file management for a stream. */
+
+/* Read NBYTES bytes from COOKIE into a buffer pointed to by BUF.
+ Return number of bytes read. */
+typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
+
+/* Write N bytes pointed to by BUF to COOKIE. Write all N bytes
+ unless there is an error. Return number of bytes written, or -1 if
+ there is an error without writing anything. If the file has been
+ opened for append (__mode.__append set), then set the file pointer
+ to the end of the file and then do the write; if not, just write at
+ the current file pointer. */
+typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
+ size_t __n);
+
+/* Move COOKIE's file position to *POS bytes from the
+ beginning of the file (if W is SEEK_SET),
+ the current position (if W is SEEK_CUR),
+ or the end of the file (if W is SEEK_END).
+ Set *POS to the new file position.
+ Returns zero if successful, nonzero if not. */
+typedef int __io_seek_fn (void *__cookie, _IO_off64_t *__pos, int __w);
+
+/* Close COOKIE. */
+typedef int __io_close_fn (void *__cookie);
+
+
+#ifdef _GNU_SOURCE
+/* User-visible names for the above. */
+typedef __io_read_fn cookie_read_function_t;
+typedef __io_write_fn cookie_write_function_t;
+typedef __io_seek_fn cookie_seek_function_t;
+typedef __io_close_fn cookie_close_function_t;
+
+/* The structure with the cookie function pointers. */
+typedef struct
+{
+ __io_read_fn *read; /* Read bytes. */
+ __io_write_fn *write; /* Write bytes. */
+ __io_seek_fn *seek; /* Seek/tell file position. */
+ __io_close_fn *close; /* Close file. */
+} _IO_cookie_io_functions_t;
+typedef _IO_cookie_io_functions_t cookie_io_functions_t;
+
+struct _IO_cookie_file;
+
+/* Initialize one of those. */
+extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write,
+ void *__cookie, _IO_cookie_io_functions_t __fns);
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int __underflow (_IO_FILE *) __THROW;
+extern int __uflow (_IO_FILE *) __THROW;
+extern int __overflow (_IO_FILE *, int) __THROW;
+extern _IO_wint_t __wunderflow (_IO_FILE *) __THROW;
+extern _IO_wint_t __wuflow (_IO_FILE *) __THROW;
+extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t) __THROW;
+
+#define _IO_getc_unlocked(_fp) \
+ ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end ? __uflow (_fp) \
+ : *(unsigned char *) (_fp)->_IO_read_ptr++)
+#define _IO_peekc_unlocked(_fp) \
+ ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end \
+ && __underflow (_fp) == EOF ? EOF \
+ : *(unsigned char *) (_fp)->_IO_read_ptr)
+#define _IO_putc_unlocked(_ch, _fp) \
+ (((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end) \
+ ? __overflow (_fp, (unsigned char) (_ch)) \
+ : (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch)))
+
+#define _IO_getwc_unlocked(_fp) \
+ ((_fp)->_wide_data->_IO_read_ptr >= (_fp)->_wide_data->_IO_read_end \
+ ? __wuflow (_fp) : (_IO_wint_t) *(_fp)->_wide_data->_IO_read_ptr++)
+#define _IO_putwc_unlocked(_wch, _fp) \
+ ((_fp)->_wide_data->_IO_write_ptr >= (_fp)->_wide_data->_IO_write_end \
+ ? __woverflow (_fp, _wch) \
+ : (_IO_wint_t) (*(_fp)->_wide_data->_IO_write_ptr++ = (_wch)))
+
+#define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0)
+#define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0)
+
+extern int _IO_getc (_IO_FILE *__fp) __THROW;
+extern int _IO_putc (int __c, _IO_FILE *__fp) __THROW;
+extern int _IO_feof (_IO_FILE *__fp) __THROW;
+extern int _IO_ferror (_IO_FILE *__fp) __THROW;
+
+extern int _IO_peekc_locked (_IO_FILE *__fp) __THROW;
+
+/* This one is for Emacs. */
+#define _IO_PENDING_OUTPUT_COUNT(_fp) \
+ ((_fp)->_IO_write_ptr - (_fp)->_IO_write_base)
+
+extern void _IO_flockfile (_IO_FILE *) __THROW;
+extern void _IO_funlockfile (_IO_FILE *) __THROW;
+extern int _IO_ftrylockfile (_IO_FILE *) __THROW;
+
+#ifdef _IO_MTSAFE_IO
+# define _IO_peekc(_fp) _IO_peekc_locked (_fp)
+#else
+# define _IO_peekc(_fp) _IO_peekc_unlocked (_fp)
+# define _IO_flockfile(_fp) /**/
+# define _IO_funlockfile(_fp) /**/
+# define _IO_ftrylockfile(_fp) /**/
+# define _IO_cleanup_region_start(_fct, _fp) /**/
+# define _IO_cleanup_region_end(_Doit) /**/
+#endif /* !_IO_MTSAFE_IO */
+
+extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
+ _IO_va_list, int *__restrict) __THROW;
+extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
+ _IO_va_list) __THROW;
+extern _IO_ssize_t _IO_padn (_IO_FILE *, int, _IO_ssize_t) __THROW;
+extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t) __THROW;
+
+extern _IO_off64_t _IO_seekoff (_IO_FILE *, _IO_off64_t, int, int) __THROW;
+extern _IO_off64_t _IO_seekpos (_IO_FILE *, _IO_off64_t, int) __THROW;
+
+extern void _IO_free_backup_area (_IO_FILE *) __THROW;
+
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+extern _IO_wint_t _IO_getwc (_IO_FILE *__fp) __THROW;
+extern _IO_wint_t _IO_putwc (wchar_t __wc, _IO_FILE *__fp) __THROW;
+extern int _IO_fwide (_IO_FILE *__fp, int __mode) __THROW;
+# if __GNUC__ >= 2
+/* A special optimized version of the function above. It optimizes the
+ case of initializing an unoriented byte stream. */
+# define _IO_fwide(__fp, __mode) \
+ ({ int __result = (__mode); \
+ if (__result < 0) \
+ { \
+ if ((__fp)->_mode == 0) \
+ /* We know that all we have to do is to set the flag. */ \
+ (__fp)->_mode = -1; \
+ __result = (__fp)->_mode; \
+ } \
+ else \
+ __result = _IO_fwide (__fp, __result); \
+ __result; })
+# endif
+
+extern int _IO_vfwscanf (_IO_FILE * __restrict, const wchar_t * __restrict,
+ _IO_va_list, int *__restrict) __THROW;
+extern int _IO_vfwprintf (_IO_FILE *__restrict, const wchar_t *__restrict,
+ _IO_va_list) __THROW;
+extern _IO_ssize_t _IO_wpadn (_IO_FILE *, wint_t, _IO_ssize_t) __THROW;
+extern void _IO_free_wbackup_area (_IO_FILE *) __THROW;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IO_STDIO_H */
diff --git a/contrib/libstdc++/libio/libioP.h b/contrib/libstdc++/libio/libioP.h
new file mode 100644
index 0000000..4aecf4e
--- /dev/null
+++ b/contrib/libstdc++/libio/libioP.h
@@ -0,0 +1,821 @@
+/* Copyright (C) 1993, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+# include <errno.h>
+
+#ifndef __set_errno
+# define __set_errno(Val) errno = (Val)
+#endif
+#if defined __GLIBC__ && __GLIBC__ >= 2
+# include <bits/libc-lock.h>
+#else
+/*# include <comthread.h>*/
+#endif
+
+#include "iolibio.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define _IO_seek_set 0
+#define _IO_seek_cur 1
+#define _IO_seek_end 2
+
+/* THE JUMPTABLE FUNCTIONS.
+
+ * The _IO_FILE type is used to implement the FILE type in GNU libc,
+ * as well as the streambuf class in GNU iostreams for C++.
+ * These are all the same, just used differently.
+ * An _IO_FILE (or FILE) object is allows followed by a pointer to
+ * a jump table (of pointers to functions). The pointer is accessed
+ * with the _IO_JUMPS macro. The jump table has a eccentric format,
+ * so as to be compatible with the layout of a C++ virtual function table.
+ * (as implemented by g++). When a pointer to a streambuf object is
+ * coerced to an (_IO_FILE*), then _IO_JUMPS on the result just
+ * happens to point to the virtual function table of the streambuf.
+ * Thus the _IO_JUMPS function table used for C stdio/libio does
+ * double duty as the virtual function table for C++ streambuf.
+ *
+ * The entries in the _IO_JUMPS function table (and hence also the
+ * virtual functions of a streambuf) are described below.
+ * The first parameter of each function entry is the _IO_FILE/streambuf
+ * object being acted on (i.e. the 'this' parameter).
+ */
+
+#if (!defined _IO_USE_OLD_IO_FILE \
+ && (!defined _G_IO_NO_BACKWARD_COMPAT || _G_IO_NO_BACKWARD_COMPAT == 0))
+# define _IO_JUMPS_OFFSET 1
+#endif
+
+#define _IO_JUMPS(THIS) (THIS)->vtable
+#define _IO_WIDE_JUMPS(THIS) ((struct _IO_FILE *) (THIS))->_wide_data->_wide_vtable
+#define _IO_CHECK_WIDE(THIS) (((struct _IO_FILE *) (THIS))->_wide_data != NULL)
+
+#if _IO_JUMPS_OFFSET
+# define _IO_JUMPS_FUNC(THIS) \
+ (*(struct _IO_jump_t **) ((void *) &_IO_JUMPS ((struct _IO_FILE_plus *) (THIS)) \
+ + (THIS)->_vtable_offset))
+#else
+# define _IO_JUMPS_FUNC(THIS) _IO_JUMPS ((struct _IO_FILE_plus *) (THIS))
+#endif
+#define _IO_WIDE_JUMPS_FUNC(THIS) _IO_WIDE_JUMPS(THIS)
+#if _G_USING_THUNKS
+# define JUMP_FIELD(TYPE, NAME) TYPE NAME
+# define JUMP0(FUNC, THIS) _IO_JUMPS_FUNC(THIS)->FUNC (THIS)
+# define JUMP1(FUNC, THIS, X1) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1)
+# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1, X2)
+# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1,X2, X3)
+# define JUMP_INIT(NAME, VALUE) VALUE
+# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0), JUMP_INIT (dummy2, 0)
+
+# define WJUMP0(FUNC, THIS) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS)
+# define WJUMP1(FUNC, THIS, X1) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS, X1)
+# define WJUMP2(FUNC, THIS, X1, X2) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS, X1, X2)
+# define WJUMP3(FUNC, THIS, X1,X2,X3) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS, X1,X2, X3)
+#else
+/* These macros will change when we re-implement vtables to use "thunks"! */
+# define JUMP_FIELD(TYPE, NAME) struct { short delta1, delta2; TYPE pfn; } NAME
+# define JUMP0(FUNC, THIS) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS)
+# define JUMP1(FUNC, THIS, X1) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1)
+# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1, X2)
+# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1,X2,X3)
+# define JUMP_INIT(NAME, VALUE) {0, 0, VALUE}
+# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0)
+
+# define WJUMP0(FUNC, THIS) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS)
+# define WJUMP1(FUNC, THIS, X1) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1)
+# define WJUMP2(FUNC, THIS, X1, X2) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1, X2)
+# define WJUMP3(FUNC, THIS, X1,X2,X3) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1,X2,X3)
+#endif
+
+/* The 'finish' function does any final cleaning up of an _IO_FILE object.
+ It does not delete (free) it, but does everything else to finalize it.
+ It matches the streambuf::~streambuf virtual destructor. */
+typedef void (*_IO_finish_t) __PMT ((_IO_FILE *, int)); /* finalize */
+#define _IO_FINISH(FP) JUMP1 (__finish, FP, 0)
+#define _IO_WFINISH(FP) WJUMP1 (__finish, FP, 0)
+
+/* The 'overflow' hook flushes the buffer.
+ The second argument is a character, or EOF.
+ It matches the streambuf::overflow virtual function. */
+typedef int (*_IO_overflow_t) __PMT ((_IO_FILE *, int));
+#define _IO_OVERFLOW(FP, CH) JUMP1 (__overflow, FP, CH)
+#define _IO_WOVERFLOW(FP, CH) WJUMP1 (__overflow, FP, CH)
+
+/* The 'underflow' hook tries to fills the get buffer.
+ It returns the next character (as an unsigned char) or EOF. The next
+ character remains in the get buffer, and the get position is not changed.
+ It matches the streambuf::underflow virtual function. */
+typedef int (*_IO_underflow_t) __PMT ((_IO_FILE *));
+#define _IO_UNDERFLOW(FP) JUMP0 (__underflow, FP)
+#define _IO_WUNDERFLOW(FP) WJUMP0 (__underflow, FP)
+
+/* The 'uflow' hook returns the next character in the input stream
+ (cast to unsigned char), and increments the read position;
+ EOF is returned on failure.
+ It matches the streambuf::uflow virtual function, which is not in the
+ cfront implementation, but was added to C++ by the ANSI/ISO committee. */
+#define _IO_UFLOW(FP) JUMP0 (__uflow, FP)
+#define _IO_WUFLOW(FP) WJUMP0 (__uflow, FP)
+
+/* The 'pbackfail' hook handles backing up.
+ It matches the streambuf::pbackfail virtual function. */
+typedef int (*_IO_pbackfail_t) __PMT ((_IO_FILE *, int));
+#define _IO_PBACKFAIL(FP, CH) JUMP1 (__pbackfail, FP, CH)
+#define _IO_WPBACKFAIL(FP, CH) WJUMP1 (__pbackfail, FP, CH)
+
+/* The 'xsputn' hook writes upto N characters from buffer DATA.
+ Returns the number of character actually written.
+ It matches the streambuf::xsputn virtual function. */
+typedef _IO_size_t (*_IO_xsputn_t) __PMT ((_IO_FILE *FP, const void *DATA,
+ _IO_size_t N));
+#define _IO_XSPUTN(FP, DATA, N) JUMP2 (__xsputn, FP, DATA, N)
+#define _IO_WXSPUTN(FP, DATA, N) WJUMP2 (__xsputn, FP, DATA, N)
+
+/* The 'xsgetn' hook reads upto N characters into buffer DATA.
+ Returns the number of character actually read.
+ It matches the streambuf::xsgetn virtual function. */
+typedef _IO_size_t (*_IO_xsgetn_t) __PMT ((_IO_FILE *FP, void *DATA,
+ _IO_size_t N));
+#define _IO_XSGETN(FP, DATA, N) JUMP2 (__xsgetn, FP, DATA, N)
+#define _IO_WXSGETN(FP, DATA, N) WJUMP2 (__xsgetn, FP, DATA, N)
+
+/* The 'seekoff' hook moves the stream position to a new position
+ relative to the start of the file (if DIR==0), the current position
+ (MODE==1), or the end of the file (MODE==2).
+ It matches the streambuf::seekoff virtual function.
+ It is also used for the ANSI fseek function. */
+typedef _IO_off64_t (*_IO_seekoff_t) __PMT ((_IO_FILE *FP, _IO_off64_t OFF,
+ int DIR, int MODE));
+#define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3 (__seekoff, FP, OFF, DIR, MODE)
+#define _IO_WSEEKOFF(FP, OFF, DIR, MODE) WJUMP3 (__seekoff, FP, OFF, DIR, MODE)
+
+/* The 'seekpos' hook also moves the stream position,
+ but to an absolute position given by a fpos64_t (seekpos).
+ It matches the streambuf::seekpos virtual function.
+ It is also used for the ANSI fgetpos and fsetpos functions. */
+/* The _IO_seek_cur and _IO_seek_end options are not allowed. */
+typedef _IO_off64_t (*_IO_seekpos_t) __PMT ((_IO_FILE *, _IO_off64_t, int));
+#define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2 (__seekpos, FP, POS, FLAGS)
+#define _IO_WSEEKPOS(FP, POS, FLAGS) WJUMP2 (__seekpos, FP, POS, FLAGS)
+
+/* The 'setbuf' hook gives a buffer to the file.
+ It matches the streambuf::setbuf virtual function. */
+typedef _IO_FILE* (*_IO_setbuf_t) __PMT ((_IO_FILE *, char *, _IO_ssize_t));
+#define _IO_SETBUF(FP, BUFFER, LENGTH) JUMP2 (__setbuf, FP, BUFFER, LENGTH)
+#define _IO_WSETBUF(FP, BUFFER, LENGTH) WJUMP2 (__setbuf, FP, BUFFER, LENGTH)
+
+/* The 'sync' hook attempts to synchronize the internal data structures
+ of the file with the external state.
+ It matches the streambuf::sync virtual function. */
+typedef int (*_IO_sync_t) __PMT ((_IO_FILE *));
+#define _IO_SYNC(FP) JUMP0 (__sync, FP)
+#define _IO_WSYNC(FP) WJUMP0 (__sync, FP)
+
+/* The 'doallocate' hook is used to tell the file to allocate a buffer.
+ It matches the streambuf::doallocate virtual function, which is not
+ in the ANSI/ISO C++ standard, but is part traditional implementations. */
+typedef int (*_IO_doallocate_t) __PMT ((_IO_FILE *));
+#define _IO_DOALLOCATE(FP) JUMP0 (__doallocate, FP)
+#define _IO_WDOALLOCATE(FP) WJUMP0 (__doallocate, FP)
+
+/* The following four hooks (sysread, syswrite, sysclose, sysseek, and
+ sysstat) are low-level hooks specific to this implementation.
+ There is no correspondence in the ANSI/ISO C++ standard library.
+ The hooks basically correspond to the Unix system functions
+ (read, write, close, lseek, and stat) except that a _IO_FILE*
+ parameter is used instead of a integer file descriptor; the default
+ implementation used for normal files just calls those functions.
+ The advantage of overriding these functions instead of the higher-level
+ ones (underflow, overflow etc) is that you can leave all the buffering
+ higher-level functions. */
+
+/* The 'sysread' hook is used to read data from the external file into
+ an existing buffer. It generalizes the Unix read(2) function.
+ It matches the streambuf::sys_read virtual function, which is
+ specific to this implementation. */
+typedef _IO_ssize_t (*_IO_read_t) __PMT ((_IO_FILE *, void *, _IO_ssize_t));
+#define _IO_SYSREAD(FP, DATA, LEN) JUMP2 (__read, FP, DATA, LEN)
+#define _IO_WSYSREAD(FP, DATA, LEN) WJUMP2 (__read, FP, DATA, LEN)
+
+/* The 'syswrite' hook is used to write data from an existing buffer
+ to an external file. It generalizes the Unix write(2) function.
+ It matches the streambuf::sys_write virtual function, which is
+ specific to this implementation. */
+typedef _IO_ssize_t (*_IO_write_t) __PMT ((_IO_FILE *, const void *,
+ _IO_ssize_t));
+#define _IO_SYSWRITE(FP, DATA, LEN) JUMP2 (__write, FP, DATA, LEN)
+#define _IO_WSYSWRITE(FP, DATA, LEN) WJUMP2 (__write, FP, DATA, LEN)
+
+/* The 'sysseek' hook is used to re-position an external file.
+ It generalizes the Unix lseek(2) function.
+ It matches the streambuf::sys_seek virtual function, which is
+ specific to this implementation. */
+typedef _IO_off64_t (*_IO_seek_t) __PMT ((_IO_FILE *, _IO_off64_t, int));
+#define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2 (__seek, FP, OFFSET, MODE)
+#define _IO_WSYSSEEK(FP, OFFSET, MODE) WJUMP2 (__seek, FP, OFFSET, MODE)
+
+/* The 'sysclose' hook is used to finalize (close, finish up) an
+ external file. It generalizes the Unix close(2) function.
+ It matches the streambuf::sys_close virtual function, which is
+ specific to this implementation. */
+typedef int (*_IO_close_t) __PMT ((_IO_FILE *)); /* finalize */
+#define _IO_SYSCLOSE(FP) JUMP0 (__close, FP)
+#define _IO_WSYSCLOSE(FP) WJUMP0 (__close, FP)
+
+/* The 'sysstat' hook is used to get information about an external file
+ into a struct stat buffer. It generalizes the Unix fstat(2) call.
+ It matches the streambuf::sys_stat virtual function, which is
+ specific to this implementation. */
+typedef int (*_IO_stat_t) __PMT ((_IO_FILE *, void *));
+#define _IO_SYSSTAT(FP, BUF) JUMP1 (__stat, FP, BUF)
+#define _IO_WSYSSTAT(FP, BUF) WJUMP1 (__stat, FP, BUF)
+
+/* The 'showmany' hook can be used to get an image how much input is
+ available. In many cases the answer will be 0 which means unknown
+ but some cases one can provide real information. */
+typedef int (*_IO_showmanyc_t) __PMT ((_IO_FILE *));
+#define _IO_SHOWMANYC(FP) JUMP0 (__showmanyc, FP)
+#define _IO_WSHOWMANYC(FP) WJUMP0 (__showmanyc, FP)
+
+/* The 'imbue' hook is used to get information about the currently
+ installed locales. */
+typedef void (*_IO_imbue_t) __PMT ((_IO_FILE *, void *));
+#define _IO_IMBUE(FP, LOCALE) JUMP1 (__imbue, FP, LOCALE)
+#define _IO_WIMBUE(FP, LOCALE) WJUMP1 (__imbue, FP, LOCALE)
+
+
+#define _IO_CHAR_TYPE char /* unsigned char ? */
+#define _IO_INT_TYPE int
+
+struct _IO_jump_t
+{
+ JUMP_FIELD(_G_size_t, __dummy);
+#if _G_USING_THUNKS
+ JUMP_FIELD(_G_size_t, __dummy2);
+#endif
+ JUMP_FIELD(_IO_finish_t, __finish);
+ JUMP_FIELD(_IO_overflow_t, __overflow);
+ JUMP_FIELD(_IO_underflow_t, __underflow);
+ JUMP_FIELD(_IO_underflow_t, __uflow);
+ JUMP_FIELD(_IO_pbackfail_t, __pbackfail);
+ /* showmany */
+ JUMP_FIELD(_IO_xsputn_t, __xsputn);
+ JUMP_FIELD(_IO_xsgetn_t, __xsgetn);
+ JUMP_FIELD(_IO_seekoff_t, __seekoff);
+ JUMP_FIELD(_IO_seekpos_t, __seekpos);
+ JUMP_FIELD(_IO_setbuf_t, __setbuf);
+ JUMP_FIELD(_IO_sync_t, __sync);
+ JUMP_FIELD(_IO_doallocate_t, __doallocate);
+ JUMP_FIELD(_IO_read_t, __read);
+ JUMP_FIELD(_IO_write_t, __write);
+ JUMP_FIELD(_IO_seek_t, __seek);
+ JUMP_FIELD(_IO_close_t, __close);
+ JUMP_FIELD(_IO_stat_t, __stat);
+ JUMP_FIELD(_IO_showmanyc_t, __showmanyc);
+ JUMP_FIELD(_IO_imbue_t, __imbue);
+#if 0
+ get_column;
+ set_column;
+#endif
+};
+
+/* We always allocate an extra word following an _IO_FILE.
+ This contains a pointer to the function jump table used.
+ This is for compatibility with C++ streambuf; the word can
+ be used to smash to a pointer to a virtual function table. */
+
+struct _IO_FILE_plus
+{
+ _IO_FILE file;
+ const struct _IO_jump_t *vtable;
+};
+
+/* Special file type for fopencookie function. */
+struct _IO_cookie_file
+{
+ struct _IO_FILE_plus __fp;
+ void *__cookie;
+ _IO_cookie_io_functions_t __io_functions;
+};
+
+/* Iterator type for walking global linked list of _IO_FILE objects. */
+
+typedef struct _IO_FILE *_IO_ITER;
+
+/* Generic functions */
+
+extern void _IO_switch_to_main_get_area __P ((_IO_FILE *));
+extern void _IO_switch_to_backup_area __P ((_IO_FILE *));
+extern int _IO_switch_to_get_mode __P ((_IO_FILE *));
+extern void _IO_init __P ((_IO_FILE *, int));
+extern int _IO_sputbackc __P ((_IO_FILE *, int));
+extern int _IO_sungetc __P ((_IO_FILE *));
+extern void _IO_un_link __P ((struct _IO_FILE_plus *));
+extern void _IO_link_in __P ((struct _IO_FILE_plus *));
+extern void _IO_doallocbuf __P ((_IO_FILE *));
+extern void _IO_unsave_markers __P ((_IO_FILE *));
+extern void _IO_setb __P ((_IO_FILE *, char *, char *, int));
+extern unsigned _IO_adjust_column __P ((unsigned, const char *, int));
+#define _IO_sputn(__fp, __s, __n) _IO_XSPUTN (__fp, __s, __n)
+
+extern void _IO_switch_to_main_wget_area __P ((_IO_FILE *));
+extern void _IO_switch_to_wbackup_area __P ((_IO_FILE *));
+extern int _IO_switch_to_wget_mode __P ((_IO_FILE *));
+extern void _IO_wsetb __P ((_IO_FILE *, wchar_t *, wchar_t *, int));
+extern wint_t _IO_sputbackwc __P ((_IO_FILE *, wint_t));
+extern wint_t _IO_sungetwc __P ((_IO_FILE *));
+extern void _IO_wdoallocbuf __P ((_IO_FILE *));
+extern void _IO_unsave_wmarkers __P ((_IO_FILE *));
+extern unsigned _IO_adjust_wcolumn __P ((unsigned, const wchar_t *, int));
+
+/* Marker-related function. */
+
+extern void _IO_init_marker __P ((struct _IO_marker *, _IO_FILE *));
+extern void _IO_init_wmarker __P ((struct _IO_marker *, _IO_FILE *));
+extern void _IO_remove_marker __P ((struct _IO_marker *));
+extern int _IO_marker_difference __P ((struct _IO_marker *,
+ struct _IO_marker *));
+extern int _IO_marker_delta __P ((struct _IO_marker *));
+extern int _IO_wmarker_delta __P ((struct _IO_marker *));
+extern int _IO_seekmark __P ((_IO_FILE *, struct _IO_marker *, int));
+extern int _IO_seekwmark __P ((_IO_FILE *, struct _IO_marker *, int));
+
+/* Functions for iterating global list and dealing with
+ its lock */
+
+extern _IO_ITER _IO_iter_begin __P ((void));
+extern _IO_ITER _IO_iter_end __P ((void));
+extern _IO_ITER _IO_iter_next __P ((_IO_ITER));
+extern _IO_FILE *_IO_iter_file __P ((_IO_ITER));
+extern void _IO_list_lock __P ((void));
+extern void _IO_list_unlock __P ((void));
+extern void _IO_list_resetlock __P ((void));
+
+/* Default jumptable functions. */
+
+extern int _IO_default_underflow __P ((_IO_FILE *));
+extern int _IO_default_uflow __P ((_IO_FILE *));
+extern wint_t _IO_wdefault_uflow __P ((_IO_FILE *));
+extern int _IO_default_doallocate __P ((_IO_FILE *));
+extern int _IO_wdefault_doallocate __P ((_IO_FILE *));
+extern void _IO_default_finish __P ((_IO_FILE *, int));
+extern void _IO_wdefault_finish __P ((_IO_FILE *, int));
+extern int _IO_default_pbackfail __P ((_IO_FILE *, int));
+extern wint_t _IO_wdefault_pbackfail __P ((_IO_FILE *, wint_t));
+extern _IO_FILE* _IO_default_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
+extern _IO_FILE* _IO_wdefault_setbuf __P ((_IO_FILE *, wchar_t *,
+ _IO_ssize_t));
+extern _IO_size_t _IO_default_xsputn __P ((_IO_FILE *, const void *,
+ _IO_size_t));
+extern _IO_size_t _IO_wdefault_xsputn __P ((_IO_FILE *, const void *,
+ _IO_size_t));
+extern _IO_size_t _IO_default_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
+extern _IO_size_t _IO_wdefault_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
+extern _IO_off64_t _IO_default_seekoff __P ((_IO_FILE *,
+ _IO_off64_t, int, int));
+extern _IO_off64_t _IO_default_seekpos __P ((_IO_FILE *, _IO_off64_t, int));
+extern _IO_ssize_t _IO_default_write __P ((_IO_FILE *, const void *,
+ _IO_ssize_t));
+extern _IO_ssize_t _IO_default_read __P ((_IO_FILE *, void *, _IO_ssize_t));
+extern int _IO_default_stat __P ((_IO_FILE *, void *));
+extern _IO_off64_t _IO_default_seek __P ((_IO_FILE *, _IO_off64_t, int));
+extern int _IO_default_sync __P ((_IO_FILE *));
+#define _IO_default_close ((_IO_close_t) _IO_default_sync)
+extern int _IO_default_showmanyc __P ((_IO_FILE *));
+extern void _IO_default_imbue __P ((_IO_FILE *, void *));
+
+extern struct _IO_jump_t _IO_file_jumps;
+extern struct _IO_jump_t _IO_wfile_jumps;
+extern struct _IO_jump_t _IO_old_file_jumps;
+extern struct _IO_jump_t _IO_streambuf_jumps;
+extern struct _IO_jump_t _IO_proc_jumps;
+extern struct _IO_jump_t _IO_old_proc_jumps;
+extern struct _IO_jump_t _IO_str_jumps;
+extern struct _IO_jump_t _IO_wstr_jumps;
+extern struct _IO_codecvt __libio_codecvt;
+extern int _IO_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
+extern int _IO_new_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
+extern int _IO_old_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
+extern int _IO_wdo_write __P ((_IO_FILE *, const wchar_t *, _IO_size_t));
+extern int _IO_flush_all __P ((void));
+extern int _IO_cleanup __P ((void));
+extern void _IO_flush_all_linebuffered __P ((void));
+extern int _IO_new_fgetpos __P ((_IO_FILE *, _IO_fpos_t *));
+extern int _IO_old_fgetpos __P ((_IO_FILE *, _IO_fpos_t *));
+extern int _IO_new_fsetpos __P ((_IO_FILE *, const _IO_fpos_t *));
+extern int _IO_old_fsetpos __P ((_IO_FILE *, const _IO_fpos_t *));
+extern int _IO_new_fgetpos64 __P ((_IO_FILE *, _IO_fpos64_t *));
+extern int _IO_old_fgetpos64 __P ((_IO_FILE *, _IO_fpos64_t *));
+extern int _IO_new_fsetpos64 __P ((_IO_FILE *, const _IO_fpos64_t *));
+extern int _IO_old_fsetpos64 __P ((_IO_FILE *, const _IO_fpos64_t *));
+
+
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+# define _IO_do_flush(_f) \
+ ((_f)->_mode <= 0 \
+ ? _IO_do_write(_f, (_f)->_IO_write_base, \
+ (_f)->_IO_write_ptr-(_f)->_IO_write_base) \
+ : _IO_wdo_write(_f, (_f)->_wide_data->_IO_write_base, \
+ ((_f)->_wide_data->_IO_write_ptr \
+ - (_f)->_wide_data->_IO_write_base)))
+#else
+# define _IO_do_flush(_f) \
+ _IO_do_write(_f, (_f)->_IO_write_base, \
+ (_f)->_IO_write_ptr-(_f)->_IO_write_base)
+#endif
+#define _IO_old_do_flush(_f) \
+ _IO_old_do_write(_f, (_f)->_IO_write_base, \
+ (_f)->_IO_write_ptr-(_f)->_IO_write_base)
+#define _IO_in_put_mode(_fp) ((_fp)->_flags & _IO_CURRENTLY_PUTTING)
+#define _IO_mask_flags(fp, f, mask) \
+ ((fp)->_flags = ((fp)->_flags & ~(mask)) | ((f) & (mask)))
+#define _IO_setg(fp, eb, g, eg) ((fp)->_IO_read_base = (eb),\
+ (fp)->_IO_read_ptr = (g), (fp)->_IO_read_end = (eg))
+#define _IO_wsetg(fp, eb, g, eg) ((fp)->_wide_data->_IO_read_base = (eb),\
+ (fp)->_wide_data->_IO_read_ptr = (g), \
+ (fp)->_wide_data->_IO_read_end = (eg))
+#define _IO_setp(__fp, __p, __ep) \
+ ((__fp)->_IO_write_base = (__fp)->_IO_write_ptr \
+ = __p, (__fp)->_IO_write_end = (__ep))
+#define _IO_wsetp(__fp, __p, __ep) \
+ ((__fp)->_wide_data->_IO_write_base \
+ = (__fp)->_wide_data->_IO_write_ptr = __p, \
+ (__fp)->_wide_data->_IO_write_end = (__ep))
+#define _IO_have_backup(fp) ((fp)->_IO_save_base != NULL)
+#define _IO_have_wbackup(fp) ((fp)->_wide_data->_IO_save_base != NULL)
+#define _IO_in_backup(fp) ((fp)->_flags & _IO_IN_BACKUP)
+#define _IO_have_markers(fp) ((fp)->_markers != NULL)
+#define _IO_blen(fp) ((fp)->_IO_buf_end - (fp)->_IO_buf_base)
+#define _IO_wblen(fp) ((fp)->_wide_data->_IO_buf_end \
+ - (fp)->_wide_data->_IO_buf_base)
+
+/* Jumptable functions for files. */
+
+extern int _IO_file_doallocate __P ((_IO_FILE *));
+extern _IO_FILE* _IO_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
+extern _IO_off64_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern _IO_size_t _IO_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t));
+extern _IO_size_t _IO_file_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
+extern int _IO_file_stat __P ((_IO_FILE *, void *));
+extern int _IO_file_close __P ((_IO_FILE *));
+extern int _IO_file_underflow __P ((_IO_FILE *));
+extern int _IO_file_overflow __P ((_IO_FILE *, int));
+#define _IO_file_is_open(__fp) ((__fp)->_fileno != -1)
+extern void _IO_file_init __P ((struct _IO_FILE_plus *));
+extern _IO_FILE* _IO_file_attach __P ((_IO_FILE *, int));
+extern _IO_FILE* _IO_file_open __P ((_IO_FILE *, const char *, int, int,
+ int, int));
+extern _IO_FILE* _IO_file_fopen __P ((_IO_FILE *, const char *, const char *,
+ int));
+extern _IO_ssize_t _IO_file_write __P ((_IO_FILE *, const void *,
+ _IO_ssize_t));
+extern _IO_ssize_t _IO_file_read __P ((_IO_FILE *, void *, _IO_ssize_t));
+extern int _IO_file_sync __P ((_IO_FILE *));
+extern int _IO_file_close_it __P ((_IO_FILE *));
+extern _IO_off64_t _IO_file_seek __P ((_IO_FILE *, _IO_off64_t, int));
+extern void _IO_file_finish __P ((_IO_FILE *, int));
+
+extern _IO_FILE* _IO_new_file_attach __P ((_IO_FILE *, int));
+extern int _IO_new_file_close_it __P ((_IO_FILE *));
+extern void _IO_new_file_finish __P ((_IO_FILE *, int));
+extern _IO_FILE* _IO_new_file_fopen __P ((_IO_FILE *, const char *, const char *,
+ int));
+extern void _IO_no_init __P ((_IO_FILE *, int, int, struct _IO_wide_data *,
+ struct _IO_jump_t *));
+extern void _IO_new_file_init __P ((struct _IO_FILE_plus *));
+extern _IO_FILE* _IO_new_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
+extern int _IO_new_file_sync __P ((_IO_FILE *));
+extern int _IO_new_file_underflow __P ((_IO_FILE *));
+extern int _IO_new_file_overflow __P ((_IO_FILE *, int));
+extern _IO_off64_t _IO_new_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern _IO_ssize_t _IO_new_file_write __P ((_IO_FILE *, const void *,
+ _IO_ssize_t));
+extern _IO_size_t _IO_new_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t));
+
+extern _IO_FILE* _IO_old_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
+extern _IO_off64_t _IO_old_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int,
+ int));
+extern _IO_size_t _IO_old_file_xsputn __P ((_IO_FILE *, const void *,
+ _IO_size_t));
+extern int _IO_old_file_underflow __P ((_IO_FILE *));
+extern int _IO_old_file_overflow __P ((_IO_FILE *, int));
+extern void _IO_old_file_init __P ((struct _IO_FILE_plus *));
+extern _IO_FILE* _IO_old_file_attach __P ((_IO_FILE *, int));
+extern _IO_FILE* _IO_old_file_fopen __P ((_IO_FILE *, const char *,
+ const char *));
+extern _IO_ssize_t _IO_old_file_write __P ((_IO_FILE *, const void *,
+ _IO_ssize_t));
+extern int _IO_old_file_sync __P ((_IO_FILE *));
+extern int _IO_old_file_close_it __P ((_IO_FILE *));
+extern void _IO_old_file_finish __P ((_IO_FILE *, int));
+
+extern int _IO_wfile_doallocate __P ((_IO_FILE *));
+extern _IO_size_t _IO_wfile_xsputn __P ((_IO_FILE *, const void *,
+ _IO_size_t));
+extern _IO_FILE* _IO_wfile_setbuf __P ((_IO_FILE *, wchar_t *, _IO_ssize_t));
+extern wint_t _IO_wfile_sync __P ((_IO_FILE *));
+extern wint_t _IO_wfile_underflow __P ((_IO_FILE *));
+extern wint_t _IO_wfile_overflow __P ((_IO_FILE *, wint_t));
+extern _IO_off64_t _IO_wfile_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+
+/* Jumptable functions for proc_files. */
+extern _IO_FILE* _IO_proc_open __P ((_IO_FILE *, const char *, const char *));
+extern _IO_FILE* _IO_new_proc_open __P ((_IO_FILE *, const char *, const char *));
+extern _IO_FILE* _IO_old_proc_open __P ((_IO_FILE *, const char *, const char *));
+extern int _IO_proc_close __P ((_IO_FILE *));
+extern int _IO_new_proc_close __P ((_IO_FILE *));
+extern int _IO_old_proc_close __P ((_IO_FILE *));
+
+/* Jumptable functions for strfiles. */
+extern int _IO_str_underflow __P ((_IO_FILE *));
+extern int _IO_str_overflow __P ((_IO_FILE *, int));
+extern int _IO_str_pbackfail __P ((_IO_FILE *, int));
+extern _IO_off64_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern void _IO_str_finish __P ((_IO_FILE *, int));
+
+/* Other strfile functions */
+struct _IO_strfile_;
+extern void _IO_str_init_static __P ((struct _IO_strfile_ *, char *, int, char *));
+extern void _IO_str_init_readonly __P ((struct _IO_strfile_ *, const char *, int));
+extern _IO_ssize_t _IO_str_count __P ((_IO_FILE *));
+
+/* And the wide character versions. */
+extern void _IO_wstr_init_static __P ((_IO_FILE *, wchar_t *, int, wchar_t *));
+extern void _IO_wstr_init_readonly __P ((_IO_FILE *, const char *, int));
+extern _IO_ssize_t _IO_wstr_count __P ((_IO_FILE *));
+extern _IO_wint_t _IO_wstr_overflow __P ((_IO_FILE *, _IO_wint_t));
+extern _IO_wint_t _IO_wstr_underflow __P ((_IO_FILE *));
+extern _IO_off64_t _IO_wstr_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern _IO_wint_t _IO_wstr_pbackfail __P ((_IO_FILE *, _IO_wint_t));
+extern void _IO_wstr_finish __P ((_IO_FILE *, int));
+
+extern int _IO_vasprintf __P ((char **result_ptr, __const char *format,
+ _IO_va_list args));
+extern int _IO_vdprintf __P ((int d, __const char *format, _IO_va_list arg));
+extern int _IO_vsnprintf __P ((char *string, _IO_size_t maxlen,
+ __const char *format, _IO_va_list args));
+
+
+extern _IO_size_t _IO_getline __P ((_IO_FILE *,char *, _IO_size_t, int, int));
+extern _IO_size_t _IO_getline_info __P ((_IO_FILE *,char *, _IO_size_t,
+ int, int, int *));
+extern _IO_ssize_t _IO_getdelim __P ((char **, _IO_size_t *, int, _IO_FILE *));
+extern _IO_size_t _IO_getwline __P ((_IO_FILE *,wchar_t *, _IO_size_t, wint_t,
+ int));
+extern _IO_size_t _IO_getwline_info __P ((_IO_FILE *,wchar_t *, _IO_size_t,
+ wint_t, int, wint_t *));
+extern double _IO_strtod __P ((const char *, char **));
+extern char *_IO_dtoa __P ((double __d, int __mode, int __ndigits,
+ int *__decpt, int *__sign, char **__rve));
+extern int _IO_outfloat __P ((double __value, _IO_FILE *__sb, int __type,
+ int __width, int __precision, int __flags,
+ int __sign_mode, int __fill));
+
+extern struct _IO_FILE_plus *_IO_list_all;
+extern void (*_IO_cleanup_registration_needed) __PMT ((void));
+
+#ifndef EOF
+# define EOF (-1)
+#endif
+#ifndef NULL
+# if defined __GNUG__ && \
+ (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
+# define NULL (__null)
+# else
+# if !defined(__cplusplus)
+# define NULL ((void*)0)
+# else
+# define NULL (0)
+# endif
+# endif
+#endif
+
+#if _G_HAVE_MMAP
+
+#ifdef __cplusplus
+}
+#endif
+
+# include <unistd.h>
+# include <fcntl.h>
+# include <sys/mman.h>
+# include <sys/param.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+# if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+# define MAP_ANONYMOUS MAP_ANON
+# endif
+
+# if !defined(MAP_ANONYMOUS) || !defined(EXEC_PAGESIZE)
+# undef _G_HAVE_MMAP
+# define _G_HAVE_MMAP 0
+# endif
+
+#endif /* _G_HAVE_MMAP */
+
+#if _G_HAVE_MMAP
+
+# ifdef _LIBC
+/* When using this code in the GNU libc we must not pollute the name space. */
+# define mmap __mmap
+# define munmap __munmap
+# define ftruncate __ftruncate
+# endif
+
+# define ROUND_TO_PAGE(_S) \
+ (((_S) + EXEC_PAGESIZE - 1) & ~(EXEC_PAGESIZE - 1))
+
+# define FREE_BUF(_B, _S) \
+ munmap ((_B), ROUND_TO_PAGE (_S))
+# define ALLOC_BUF(_B, _S, _R) \
+ do { \
+ (_B) = (char *) mmap (0, ROUND_TO_PAGE (_S), \
+ PROT_READ | PROT_WRITE, \
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
+ if ((_B) == (char *) MAP_FAILED) \
+ return (_R); \
+ } while (0)
+# define ALLOC_WBUF(_B, _S, _R) \
+ do { \
+ (_B) = (wchar_t *) mmap (0, ROUND_TO_PAGE (_S), \
+ PROT_READ | PROT_WRITE, \
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
+ if ((_B) == (wchar_t *) MAP_FAILED) \
+ return (_R); \
+ } while (0)
+
+#else /* _G_HAVE_MMAP */
+
+# define FREE_BUF(_B, _S) \
+ free(_B)
+# define ALLOC_BUF(_B, _S, _R) \
+ do { \
+ (_B) = (char*)malloc(_S); \
+ if ((_B) == NULL) \
+ return (_R); \
+ } while (0)
+# define ALLOC_WBUF(_B, _S, _R) \
+ do { \
+ (_B) = (wchar_t *)malloc(_S); \
+ if ((_B) == NULL) \
+ return (_R); \
+ } while (0)
+
+#endif /* _G_HAVE_MMAP */
+
+#ifndef OS_FSTAT
+# define OS_FSTAT fstat
+#endif
+struct stat;
+extern _IO_ssize_t _IO_read __P ((int, void *, _IO_size_t));
+extern _IO_ssize_t _IO_write __P ((int, const void *, _IO_size_t));
+extern _IO_off64_t _IO_lseek __P ((int, _IO_off64_t, int));
+extern int _IO_close __P ((int));
+extern int _IO_fstat __P ((int, struct stat *));
+extern int _IO_vscanf __P ((const char *, _IO_va_list));
+
+/* _IO_pos_BAD is an _IO_off64_t value indicating error, unknown, or EOF. */
+#ifndef _IO_pos_BAD
+# define _IO_pos_BAD ((_IO_off64_t) -1)
+#endif
+/* _IO_pos_adjust adjust an _IO_off64_t by some number of bytes. */
+#ifndef _IO_pos_adjust
+# define _IO_pos_adjust(pos, delta) ((pos) += (delta))
+#endif
+/* _IO_pos_0 is an _IO_off64_t value indicating beginning of file. */
+#ifndef _IO_pos_0
+# define _IO_pos_0 ((_IO_off64_t) 0)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef _IO_MTSAFE_IO
+/* check following! */
+# ifdef _IO_USE_OLD_IO_FILE
+# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
+ { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+ 0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock }
+# else
+# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
+ { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+ 0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
+ NULL, WDP, 0 }
+# else
+# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
+ { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+ 0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
+ 0 }
+# endif
+# endif
+#else
+# ifdef _IO_USE_OLD_IO_FILE
+# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
+ { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+ 0, _IO_pos_BAD }
+# else
+# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
+ { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+ 0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
+ NULL, WDP, 0 }
+# else
+# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
+ { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+ 0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
+ 0 }
+# endif
+# endif
+#endif
+
+/* VTABLE_LABEL defines NAME as of the CLASS class.
+ CNLENGTH is strlen(#CLASS). */
+#ifdef __GNUC__
+# if _G_VTABLE_LABEL_HAS_LENGTH
+# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
+ extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CNLENGTH #CLASS);
+# else
+# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
+ extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CLASS);
+# endif
+#endif /* __GNUC__ */
+
+#if !defined(builtinbuf_vtable) && defined(__cplusplus)
+# ifdef __GNUC__
+VTABLE_LABEL(builtinbuf_vtable, builtinbuf, 10)
+# else
+# if _G_VTABLE_LABEL_HAS_LENGTH
+# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##10builtinbuf
+# else
+# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##builtinbuf
+# endif
+# endif
+#endif /* !defined(builtinbuf_vtable) && defined(__cplusplus) */
+
+#if defined(__STDC__) || defined(__cplusplus)
+# define _IO_va_start(args, last) va_start(args, last)
+#else
+# define _IO_va_start(args, last) va_start(args)
+#endif
+
+extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
+
+#if 1
+# define COERCE_FILE(FILE) /* Nothing */
+#else
+/* This is part of the kludge for binary compatibility with old stdio. */
+# define COERCE_FILE(FILE) \
+ (((FILE)->_IO_file_flags & _IO_MAGIC_MASK) == _OLD_MAGIC_MASK \
+ && (FILE) = *(FILE**)&((int*)fp)[1])
+#endif
+
+#ifdef EINVAL
+# define MAYBE_SET_EINVAL __set_errno (EINVAL)
+#else
+# define MAYBE_SET_EINVAL /* nothing */
+#endif
+
+#ifdef IO_DEBUG
+# define CHECK_FILE(FILE, RET) \
+ if ((FILE) == NULL) { MAYBE_SET_EINVAL; return RET; } \
+ else { COERCE_FILE(FILE); \
+ if (((FILE)->_IO_file_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \
+ { MAYBE_SET_EINVAL; return RET; }}
+#else
+# define CHECK_FILE(FILE, RET) COERCE_FILE (FILE)
+#endif
diff --git a/contrib/libstdc++/libio/stdfiles.c b/contrib/libstdc++/libio/stdfiles.c
new file mode 100644
index 0000000..b81fef8
--- /dev/null
+++ b/contrib/libstdc++/libio/stdfiles.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 1993, 1994, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+
+/* This file provides definitions of _IO_stdin, _IO_stdout, and _IO_stderr
+ for C code. Compare stdstreams.cc.
+ (The difference is that here the vtable field is set to 0,
+ so the objects defined are not valid C++ objects. On the other
+ hand, we don't need a C++ compiler to build this file.) */
+
+#include "libioP.h"
+
+#ifdef _IO_MTSAFE_IO
+# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
+ static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
+ static struct _IO_wide_data _IO_wide_data_##FD \
+ = { ._wide_vtable = &_IO_wfile_jumps }; \
+ struct _IO_FILE_plus NAME \
+ = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
+ &_IO_file_jumps};
+# else
+# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
+ static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
+ struct _IO_FILE_plus NAME \
+ = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
+ &_IO_file_jumps};
+# endif
+#else
+# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
+ static struct _IO_wide_data _IO_wide_data_##FD \
+ = { ._wide_vtable = &_IO_wfile_jumps }; \
+ struct _IO_FILE_plus NAME \
+ = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
+ &_IO_file_jumps};
+# else
+# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
+ struct _IO_FILE_plus NAME \
+ = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
+ &_IO_file_jumps};
+# endif
+#endif
+
+DEF_STDFILE(_IO_2_1_stdin_, 0, 0, _IO_NO_WRITES);
+DEF_STDFILE(_IO_2_1_stdout_, 1, &_IO_2_1_stdin_, _IO_NO_READS);
+DEF_STDFILE(_IO_2_1_stderr_, 2, &_IO_2_1_stdout_, _IO_NO_READS+_IO_UNBUFFERED);
+
+struct _IO_FILE_plus *_IO_list_all = &_IO_2_1_stderr_;
diff --git a/contrib/libstdc++/libio/stdio.c b/contrib/libstdc++/libio/stdio.c
new file mode 100644
index 0000000..3b897ce
--- /dev/null
+++ b/contrib/libstdc++/libio/stdio.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1993, 1994, 1996, 1997, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#include "libioP.h"
+#include "stdio.h"
+
+#undef stdin
+#undef stdout
+#undef stderr
+_IO_FILE *stdin = (FILE *) &_IO_2_1_stdin_;
+_IO_FILE *stdout = (FILE *) &_IO_2_1_stdout_;
+_IO_FILE *stderr = (FILE *) &_IO_2_1_stderr_;
+
+#undef _IO_stdin
+#undef _IO_stdout
+#undef _IO_stderr
+#ifdef _LIBC
+strong_alias (stdin, _IO_stdin);
+strong_alias (stdout, _IO_stdout);
+strong_alias (stderr, _IO_stderr);
+#endif
diff --git a/contrib/libstdc++/libio/wfiledoalloc.c b/contrib/libstdc++/libio/wfiledoalloc.c
new file mode 100644
index 0000000..9c05162
--- /dev/null
+++ b/contrib/libstdc++/libio/wfiledoalloc.c
@@ -0,0 +1,108 @@
+/* Copyright (C) 1993, 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/*
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley. The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+/* Modified for GNU iostream by Per Bothner 1991, 1992. */
+
+#ifndef _POSIX_SOURCE
+# define _POSIX_SOURCE
+#endif
+#include "libioP.h"
+#ifdef _GLIBCPP_USE_WCHAR_T
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef __STDC__
+#include <stdlib.h>
+#include <unistd.h>
+#endif
+
+#ifdef _LIBC
+# undef isatty
+# define isatty(Fd) __isatty (Fd)
+#endif
+
+/*
+ * Allocate a file buffer, or switch to unbuffered I/O.
+ * Per the ANSI C standard, ALL tty devices default to line buffered.
+ *
+ * As a side effect, we set __SOPT or __SNPT (en/dis-able fseek
+ * optimisation) right after the _fstat() that finds the buffer size.
+ */
+
+int
+_IO_wfile_doallocate (fp)
+ _IO_FILE *fp;
+{
+ _IO_size_t size;
+ int couldbetty;
+ wchar_t *p;
+ struct _G_stat64 st;
+
+ /* Allocate room for the external buffer. */
+ if (fp->_IO_buf_base == NULL)
+ _IO_file_doallocate (fp);
+
+ if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0)
+ {
+ couldbetty = 0;
+ size = _IO_BUFSIZ;
+#if 0
+ /* do not try to optimise fseek() */
+ fp->_flags |= __SNPT;
+#endif
+ }
+ else
+ {
+ couldbetty = S_ISCHR (st.st_mode);
+#if _IO_HAVE_ST_BLKSIZE
+ size = st.st_blksize <= 0 ? _IO_BUFSIZ : st.st_blksize;
+#else
+ size = _IO_BUFSIZ;
+#endif
+ }
+ ALLOC_WBUF (p, size * sizeof (wchar_t), EOF);
+ _IO_wsetb (fp, p, p + size, 1);
+ if (couldbetty && isatty (fp->_fileno))
+ fp->_flags |= _IO_LINE_BUF;
+ return 1;
+}
+
+#endif /* _GLIBCPP_USE_WCHAR_T */
diff --git a/contrib/libstdc++/libio/wfileops.c b/contrib/libstdc++/libio/wfileops.c
new file mode 100644
index 0000000..1dd524a
--- /dev/null
+++ b/contrib/libstdc++/libio/wfileops.c
@@ -0,0 +1,754 @@
+/* Copyright (C) 1993, 95, 97, 98, 99, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+ Written by Ulrich Drepper <drepper@cygnus.com>.
+ Based on the single byte version by Per Bothner <bothner@cygnus.com>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#include <assert.h>
+#include <libioP.h>
+#ifdef _GLIBCPP_USE_WCHAR_T
+#include <wchar.h>
+#ifdef HAVE_GCONV_H
+# include <gconv.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+
+
+#ifndef _LIBC
+# define _IO_new_do_write _IO_do_write
+# define _IO_new_file_attach _IO_file_attach
+# define _IO_new_file_close_it _IO_file_close_it
+# define _IO_new_file_finish _IO_file_finish
+# define _IO_new_file_fopen _IO_file_fopen
+# define _IO_new_file_init _IO_file_init
+# define _IO_new_file_setbuf _IO_file_setbuf
+# define _IO_new_file_sync _IO_file_sync
+# define _IO_new_file_overflow _IO_file_overflow
+# define _IO_new_file_seekoff _IO_file_seekoff
+# define _IO_new_file_underflow _IO_file_underflow
+# define _IO_new_file_write _IO_file_write
+# define _IO_new_file_xsputn _IO_file_xsputn
+#endif
+
+
+_IO_FILE *
+_IO_wfile_setbuf (fp, p, len)
+ _IO_FILE *fp;
+ wchar_t *p;
+ _IO_ssize_t len;
+{
+ if (_IO_wdefault_setbuf (fp, p, len) == NULL)
+ return NULL;
+
+ fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr =
+ fp->_wide_data->_IO_write_end = fp->_wide_data->_IO_buf_base;
+ _IO_wsetg (fp, fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base,
+ fp->_wide_data->_IO_buf_base);
+
+ return fp;
+}
+
+
+/* Convert TO_DO wide character from DATA to FP.
+ Then mark FP as having empty buffers. */
+int
+_IO_wdo_write (fp, data, to_do)
+ _IO_FILE *fp;
+ const wchar_t *data;
+ _IO_size_t to_do;
+{
+ struct _IO_codecvt *cc = fp->_codecvt;
+
+ if (to_do > 0)
+ {
+ if (fp->_IO_write_end == fp->_IO_write_ptr
+ && fp->_IO_write_end != fp->_IO_write_base)
+ {
+ if (_IO_new_do_write (fp, fp->_IO_write_base,
+ fp->_IO_write_ptr - fp->_IO_write_base) == EOF)
+ return EOF;
+ }
+
+ do
+ {
+ enum __codecvt_result result;
+ const wchar_t *new_data;
+
+ /* Now convert from the internal format into the external buffer. */
+ result = (*cc->__codecvt_do_out) (cc, &fp->_wide_data->_IO_state,
+ data, data + to_do, &new_data,
+ fp->_IO_write_ptr,
+ fp->_IO_buf_end,
+ &fp->_IO_write_ptr);
+
+ /* Write out what we produced so far. */
+ if (_IO_new_do_write (fp, fp->_IO_write_base,
+ fp->_IO_write_ptr - fp->_IO_write_base) == EOF)
+ /* Something went wrong. */
+ return EOF;
+
+ to_do -= new_data - data;
+
+ /* Next see whether we had problems during the conversion. If yes,
+ we cannot go on. */
+ if (result != __codecvt_ok
+ && (result != __codecvt_partial || new_data - data == 0))
+ break;
+
+ data = new_data;
+ }
+ while (to_do > 0);
+ }
+
+ _IO_wsetg (fp, fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base,
+ fp->_wide_data->_IO_buf_base);
+ fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr
+ = fp->_wide_data->_IO_buf_base;
+ fp->_wide_data->_IO_write_end = ((fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
+ ? fp->_wide_data->_IO_buf_base
+ : fp->_wide_data->_IO_buf_end);
+
+ return to_do == 0 ? 0 : WEOF;
+}
+
+
+wint_t
+_IO_wfile_underflow (fp)
+ _IO_FILE *fp;
+{
+ struct _IO_codecvt *cd;
+ enum __codecvt_result status;
+ _IO_ssize_t count;
+ int tries;
+ const char *read_ptr_copy;
+
+ if (fp->_flags & _IO_NO_READS)
+ {
+ fp->_flags |= _IO_ERR_SEEN;
+ __set_errno (EBADF);
+ return WEOF;
+ }
+ if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
+ return *fp->_wide_data->_IO_read_ptr;
+
+ cd = fp->_codecvt;
+
+ /* Maybe there is something left in the external buffer. */
+ if (fp->_IO_read_ptr < fp->_IO_read_end)
+ {
+ /* Convert it. */
+ size_t avail_bytes = fp->_IO_read_end - fp->_IO_read_ptr;
+
+ if (avail_bytes >= (*cd->__codecvt_do_max_length) (cd))
+ {
+ /* There is more in the external. */
+ const char *read_stop = (const char *) fp->_IO_read_ptr;
+
+ fp->_wide_data->_IO_last_state = fp->_wide_data->_IO_state;
+ status = (*cd->__codecvt_do_in) (cd, &fp->_wide_data->_IO_state,
+ fp->_IO_read_ptr, fp->_IO_read_end,
+ &read_stop,
+ fp->_wide_data->_IO_read_end,
+ fp->_wide_data->_IO_buf_end,
+ &fp->_wide_data->_IO_read_end);
+
+ fp->_IO_read_ptr = (char *) read_stop;
+
+ /* If we managed to generate some text return the next character. */
+ if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
+ return *fp->_wide_data->_IO_read_ptr;
+
+ if (status == __codecvt_error)
+ {
+ __set_errno (EILSEQ);
+ fp->_flags |= _IO_ERR_SEEN;
+ return WEOF;
+ }
+ }
+
+ /* Move the remaining content of the read buffer to the beginning. */
+ memmove (fp->_IO_buf_base, fp->_IO_read_ptr,
+ fp->_IO_read_end - fp->_IO_read_ptr);
+ fp->_IO_read_end = (fp->_IO_buf_base
+ + (fp->_IO_read_end - fp->_IO_read_ptr));
+ fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_buf_base;
+ }
+ else
+ fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end =
+ fp->_IO_buf_base;
+
+ if (fp->_IO_buf_base == NULL)
+ {
+ /* Maybe we already have a push back pointer. */
+ if (fp->_IO_save_base != NULL)
+ {
+ free (fp->_IO_save_base);
+ fp->_flags &= ~_IO_IN_BACKUP;
+ }
+ _IO_doallocbuf (fp);
+
+ fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end =
+ fp->_IO_buf_base;
+ }
+
+ fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end =
+ fp->_IO_buf_base;
+
+ if (fp->_wide_data->_IO_buf_base == NULL)
+ {
+ /* Maybe we already have a push back pointer. */
+ if (fp->_wide_data->_IO_save_base != NULL)
+ {
+ free (fp->_wide_data->_IO_save_base);
+ fp->_flags &= ~_IO_IN_BACKUP;
+ }
+ _IO_wdoallocbuf (fp);
+ }
+
+ /* Flush all line buffered files before reading. */
+ /* FIXME This can/should be moved to genops ?? */
+ if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
+ _IO_flush_all_linebuffered ();
+
+ _IO_switch_to_get_mode (fp);
+
+ fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_ptr =
+ fp->_wide_data->_IO_buf_base;
+ fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_buf_base;
+ fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr =
+ fp->_wide_data->_IO_write_end = fp->_wide_data->_IO_buf_base;
+
+ tries = 0;
+ again:
+ count = _IO_SYSREAD (fp, fp->_IO_read_end,
+ fp->_IO_buf_end - fp->_IO_read_end);
+ if (count <= 0)
+ {
+ if (count == 0 && tries == 0)
+ fp->_flags |= _IO_EOF_SEEN;
+ else
+ fp->_flags |= _IO_ERR_SEEN, count = 0;
+ }
+ fp->_IO_read_end += count;
+ if (count == 0)
+ {
+ if (tries != 0)
+ /* There are some bytes in the external buffer but they don't
+ convert to anything. */
+ __set_errno (EILSEQ);
+ return WEOF;
+ }
+ if (fp->_offset != _IO_pos_BAD)
+ _IO_pos_adjust (fp->_offset, count);
+
+ /* Now convert the read input. */
+ fp->_wide_data->_IO_last_state = fp->_wide_data->_IO_state;
+ fp->_IO_read_base = fp->_IO_read_ptr;
+ status = (*cd->__codecvt_do_in) (cd, &fp->_wide_data->_IO_state,
+ fp->_IO_read_ptr, fp->_IO_read_end,
+ &read_ptr_copy,
+ fp->_wide_data->_IO_read_end,
+ fp->_wide_data->_IO_buf_end,
+ &fp->_wide_data->_IO_read_end);
+
+ fp->_IO_read_ptr = (char *) read_ptr_copy;
+ if (fp->_wide_data->_IO_read_end == fp->_wide_data->_IO_buf_base)
+ {
+ if (status == __codecvt_error || fp->_IO_read_end == fp->_IO_buf_end)
+ {
+ __set_errno (EILSEQ);
+ fp->_flags |= _IO_ERR_SEEN;
+ return WEOF;
+ }
+
+ /* The read bytes make no complete character. Try reading again. */
+ assert (status == __codecvt_partial);
+ ++tries;
+ goto again;
+ }
+
+ return *fp->_wide_data->_IO_read_ptr;
+}
+
+
+wint_t
+_IO_wfile_overflow (f, wch)
+ _IO_FILE *f;
+ wint_t wch;
+{
+ if (f->_flags & _IO_NO_WRITES) /* SET ERROR */
+ {
+ f->_flags |= _IO_ERR_SEEN;
+ __set_errno (EBADF);
+ return WEOF;
+ }
+ /* If currently reading or no buffer allocated. */
+ if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0)
+ {
+ /* Allocate a buffer if needed. */
+ if (f->_wide_data->_IO_write_base == 0)
+ {
+ _IO_wdoallocbuf (f);
+ _IO_wsetg (f, f->_wide_data->_IO_buf_base,
+ f->_wide_data->_IO_buf_base, f->_wide_data->_IO_buf_base);
+
+ if (f->_IO_write_base == NULL)
+ {
+ _IO_doallocbuf (f);
+ _IO_setg (f, f->_IO_buf_base, f->_IO_buf_base, f->_IO_buf_base);
+ }
+ }
+ else
+ {
+ /* Otherwise must be currently reading. If _IO_read_ptr
+ (and hence also _IO_read_end) is at the buffer end,
+ logically slide the buffer forwards one block (by setting
+ the read pointers to all point at the beginning of the
+ block). This makes room for subsequent output.
+ Otherwise, set the read pointers to _IO_read_end (leaving
+ that alone, so it can continue to correspond to the
+ external position). */
+ if (f->_wide_data->_IO_read_ptr == f->_wide_data->_IO_buf_end)
+ {
+ f->_IO_read_end = f->_IO_read_ptr = f->_IO_buf_base;
+ f->_wide_data->_IO_read_end = f->_wide_data->_IO_read_ptr =
+ f->_wide_data->_IO_buf_base;
+ }
+ }
+ f->_wide_data->_IO_write_ptr = f->_wide_data->_IO_read_ptr;
+ f->_wide_data->_IO_write_base = f->_wide_data->_IO_write_ptr;
+ f->_wide_data->_IO_write_end = f->_wide_data->_IO_buf_end;
+ f->_wide_data->_IO_read_base = f->_wide_data->_IO_read_ptr =
+ f->_wide_data->_IO_read_end;
+
+ f->_IO_write_ptr = f->_IO_read_ptr;
+ f->_IO_write_base = f->_IO_write_ptr;
+ f->_IO_write_end = f->_IO_buf_end;
+ f->_IO_read_base = f->_IO_read_ptr = f->_IO_read_end;
+
+ f->_flags |= _IO_CURRENTLY_PUTTING;
+ if (f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
+ f->_wide_data->_IO_write_end = f->_wide_data->_IO_write_ptr;
+ }
+ if (wch == WEOF)
+ return _IO_do_flush (f);
+ if (f->_wide_data->_IO_write_ptr == f->_wide_data->_IO_buf_end)
+ /* Buffer is really full */
+ if (_IO_do_flush (f) == WEOF)
+ return WEOF;
+ *f->_wide_data->_IO_write_ptr++ = wch;
+ if ((f->_flags & _IO_UNBUFFERED)
+ || ((f->_flags & _IO_LINE_BUF) && wch == L'\n'))
+ if (_IO_do_flush (f) == WEOF)
+ return WEOF;
+ return wch;
+}
+
+wint_t
+_IO_wfile_sync (fp)
+ _IO_FILE *fp;
+{
+ _IO_ssize_t delta;
+ wint_t retval = 0;
+
+ /* char* ptr = cur_ptr(); */
+ if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base)
+ if (_IO_do_flush (fp))
+ return WEOF;
+ delta = fp->_wide_data->_IO_read_ptr - fp->_wide_data->_IO_read_end;
+ if (delta != 0)
+ {
+ /* We have to find out how many bytes we have to go back in the
+ external buffer. */
+ struct _IO_codecvt *cv = fp->_codecvt;
+ _IO_off64_t new_pos;
+
+ int clen = (*cv->__codecvt_do_encoding) (cv);
+
+ if (clen > 0)
+ /* It is easy, a fixed number of input bytes are used for each
+ wide character. */
+ delta *= clen;
+ else
+ {
+ /* We have to find out the hard way how much to back off.
+ To do this we determine how much input we needed to
+ generate the wide characters up to the current reading
+ position. */
+ int nread;
+
+ fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
+ nread = (*cv->__codecvt_do_length) (cv, &fp->_wide_data->_IO_state,
+ fp->_IO_read_base,
+ fp->_IO_read_end, delta);
+ fp->_IO_read_ptr = fp->_IO_read_base + nread;
+ delta = -(fp->_IO_read_end - fp->_IO_read_base - nread);
+ }
+
+ new_pos = _IO_SYSSEEK (fp, delta, 1);
+ if (new_pos != (_IO_off64_t) EOF)
+ {
+ fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_read_ptr;
+ fp->_IO_read_end = fp->_IO_read_ptr;
+ }
+#ifdef ESPIPE
+ else if (errno == ESPIPE)
+ ; /* Ignore error from unseekable devices. */
+#endif
+ else
+ retval = WEOF;
+ }
+ if (retval != WEOF)
+ fp->_offset = _IO_pos_BAD;
+ /* FIXME: Cleanup - can this be shared? */
+ /* setg(base(), ptr, ptr); */
+ return retval;
+}
+
+_IO_off64_t
+_IO_wfile_seekoff (fp, offset, dir, mode)
+ _IO_FILE *fp;
+ _IO_off64_t offset;
+ int dir;
+ int mode;
+{
+ _IO_off64_t result;
+ _IO_off64_t delta, new_offset;
+ long int count;
+ /* POSIX.1 8.2.3.7 says that after a call the fflush() the file
+ offset of the underlying file must be exact. */
+ int must_be_exact = ((fp->_wide_data->_IO_read_base
+ == fp->_wide_data->_IO_read_end)
+ && (fp->_wide_data->_IO_write_base
+ == fp->_wide_data->_IO_write_ptr));
+
+ if (mode == 0)
+ dir = _IO_seek_cur, offset = 0; /* Don't move any pointers. */
+
+ /* Flush unwritten characters.
+ (This may do an unneeded write if we seek within the buffer.
+ But to be able to switch to reading, we would need to set
+ egptr to ptr. That can't be done in the current design,
+ which assumes file_ptr() is eGptr. Anyway, since we probably
+ end up flushing when we close(), it doesn't make much difference.)
+ FIXME: simulate mem-papped files. */
+
+ if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base
+ || _IO_in_put_mode (fp))
+ if (_IO_switch_to_wget_mode (fp))
+ return WEOF;
+
+ if (fp->_wide_data->_IO_buf_base == NULL)
+ {
+ /* It could be that we already have a pushback buffer. */
+ if (fp->_wide_data->_IO_read_base != NULL)
+ {
+ free (fp->_wide_data->_IO_read_base);
+ fp->_flags &= ~_IO_IN_BACKUP;
+ }
+ _IO_doallocbuf (fp);
+ _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+ _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
+ _IO_wsetp (fp, fp->_wide_data->_IO_buf_base,
+ fp->_wide_data->_IO_buf_base);
+ _IO_wsetg (fp, fp->_wide_data->_IO_buf_base,
+ fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base);
+ }
+
+ switch (dir)
+ {
+ struct _IO_codecvt *cv;
+ int clen;
+
+ case _IO_seek_cur:
+ /* Adjust for read-ahead (bytes is buffer). To do this we must
+ find out which position in the external buffer corresponds to
+ the current position in the internal buffer. */
+ cv = fp->_codecvt;
+ clen = (*cv->__codecvt_do_encoding) (cv);
+
+ if (clen > 0)
+ offset -= (fp->_wide_data->_IO_read_end
+ - fp->_wide_data->_IO_read_ptr) * clen;
+ else
+ {
+ int nread;
+
+ delta = fp->_wide_data->_IO_read_ptr - fp->_wide_data->_IO_read_end;
+ fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
+ nread = (*cv->__codecvt_do_length) (cv, &fp->_wide_data->_IO_state,
+ fp->_IO_read_base,
+ fp->_IO_read_end, delta);
+ fp->_IO_read_ptr = fp->_IO_read_base + nread;
+ offset -= fp->_IO_read_end - fp->_IO_read_base - nread;
+ }
+
+ if (fp->_offset == _IO_pos_BAD)
+ goto dumb;
+ /* Make offset absolute, assuming current pointer is file_ptr(). */
+ offset += fp->_offset;
+
+ dir = _IO_seek_set;
+ break;
+ case _IO_seek_set:
+ break;
+ case _IO_seek_end:
+ {
+ struct _G_stat64 st;
+ if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode))
+ {
+ offset += st.st_size;
+ dir = _IO_seek_set;
+ }
+ else
+ goto dumb;
+ }
+ }
+ /* At this point, dir==_IO_seek_set. */
+
+ /* If we are only interested in the current position we've found it now. */
+ if (mode == 0)
+ return offset;
+
+ /* If destination is within current buffer, optimize: */
+ if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
+ && !_IO_in_backup (fp))
+ {
+ /* Offset relative to start of main get area. */
+ _IO_off64_t rel_offset = (offset - fp->_offset
+ + (fp->_IO_read_end - fp->_IO_read_base));
+ if (rel_offset >= 0)
+ {
+#if 0
+ if (_IO_in_backup (fp))
+ _IO_switch_to_main_get_area (fp);
+#endif
+ if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base)
+ {
+ fp->_IO_read_ptr = fp->_IO_read_base + rel_offset;
+ _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+
+ /* Now set the pointer for the internal buffer. This
+ might be an iterative process. Though the read
+ pointer is somewhere in the current external buffer
+ this does not mean we can convert this whole buffer
+ at once fitting in the internal buffer. */
+ do
+ {
+
+ }
+ while (0);
+
+ _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
+ goto resync;
+ }
+#ifdef TODO
+ /* If we have streammarkers, seek forward by reading ahead. */
+ if (_IO_have_markers (fp))
+ {
+ int to_skip = rel_offset
+ - (fp->_IO_read_ptr - fp->_IO_read_base);
+ if (ignore (to_skip) != to_skip)
+ goto dumb;
+ _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
+ goto resync;
+ }
+#endif
+ }
+#ifdef TODO
+ if (rel_offset < 0 && rel_offset >= Bbase () - Bptr ())
+ {
+ if (!_IO_in_backup (fp))
+ _IO_switch_to_backup_area (fp);
+ gbump (fp->_IO_read_end + rel_offset - fp->_IO_read_ptr);
+ _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
+ goto resync;
+ }
+#endif
+ }
+
+#ifdef TODO
+ _IO_unsave_markers (fp);
+#endif
+
+ if (fp->_flags & _IO_NO_READS)
+ goto dumb;
+
+ /* Try to seek to a block boundary, to improve kernel page management. */
+ new_offset = offset & ~(fp->_IO_buf_end - fp->_IO_buf_base - 1);
+ delta = offset - new_offset;
+ if (delta > fp->_IO_buf_end - fp->_IO_buf_base)
+ {
+ new_offset = offset;
+ delta = 0;
+ }
+ result = _IO_SYSSEEK (fp, new_offset, 0);
+ if (result < 0)
+ return EOF;
+ if (delta == 0)
+ count = 0;
+ else
+ {
+ count = _IO_SYSREAD (fp, fp->_IO_buf_base,
+ (must_be_exact
+ ? delta : fp->_IO_buf_end - fp->_IO_buf_base));
+ if (count < delta)
+ {
+ /* We weren't allowed to read, but try to seek the remainder. */
+ offset = count == EOF ? delta : delta-count;
+ dir = _IO_seek_cur;
+ goto dumb;
+ }
+ }
+ _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + delta,
+ fp->_IO_buf_base + count);
+ _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+ fp->_offset = result + count;
+ _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
+ return offset;
+ dumb:
+
+ _IO_unsave_markers (fp);
+ result = _IO_SYSSEEK (fp, offset, dir);
+ if (result != EOF)
+ {
+ _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
+ fp->_offset = result;
+ _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
+ _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+ }
+ return result;
+
+resync:
+ /* We need to do it since it is possible that the file offset in
+ the kernel may be changed behind our back. It may happen when
+ we fopen a file and then do a fork. One process may access the
+ the file and the kernel file offset will be changed. */
+ if (fp->_offset >= 0)
+ _IO_SYSSEEK (fp, fp->_offset, 0);
+
+ return offset;
+}
+
+
+_IO_size_t
+_IO_wfile_xsputn (f, data, n)
+ _IO_FILE *f;
+ const void *data;
+ _IO_size_t n;
+{
+ register const wchar_t *s = (const wchar_t *) data;
+ _IO_size_t to_do = n;
+ int must_flush = 0;
+ _IO_size_t count;
+
+ if (n <= 0)
+ return 0;
+ /* This is an optimized implementation.
+ If the amount to be written straddles a block boundary
+ (or the filebuf is unbuffered), use sys_write directly. */
+
+ /* First figure out how much space is available in the buffer. */
+ count = f->_wide_data->_IO_write_end - f->_wide_data->_IO_write_ptr;
+ if ((f->_flags & _IO_LINE_BUF) && (f->_flags & _IO_CURRENTLY_PUTTING))
+ {
+ count = f->_wide_data->_IO_buf_end - f->_wide_data->_IO_write_ptr;
+ if (count >= n)
+ {
+ register const wchar_t *p;
+ for (p = s + n; p > s; )
+ {
+ if (*--p == L'\n')
+ {
+ count = p - s + 1;
+ must_flush = 1;
+ break;
+ }
+ }
+ }
+ }
+ /* Then fill the buffer. */
+ if (count > 0)
+ {
+ if (count > to_do)
+ count = to_do;
+ if (count > 20)
+ {
+#ifdef _LIBC
+ f->_wide_data->_IO_write_ptr =
+ __wmempcpy (f->_wide_data->_IO_write_ptr, s, count);
+#else
+ wmemcpy (f->_wide_data->_IO_write_ptr, s, count);
+ f->_wide_data->_IO_write_ptr += count;
+#endif
+ s += count;
+ }
+ else
+ {
+ register wchar_t *p = f->_wide_data->_IO_write_ptr;
+ register int i = (int) count;
+ while (--i >= 0)
+ *p++ = *s++;
+ f->_wide_data->_IO_write_ptr = p;
+ }
+ to_do -= count;
+ }
+ if (to_do > 0)
+ to_do -= _IO_wdefault_xsputn (f, s, to_do);
+ if (must_flush
+ && f->_wide_data->_IO_write_ptr != f->_wide_data->_IO_write_base)
+ _IO_wdo_write (f, f->_wide_data->_IO_write_base,
+ f->_wide_data->_IO_write_ptr
+ - f->_wide_data->_IO_write_base);
+
+ return n - to_do;
+}
+
+
+struct _IO_jump_t _IO_wfile_jumps =
+{
+ JUMP_INIT_DUMMY,
+ JUMP_INIT(finish, _IO_new_file_finish),
+ JUMP_INIT(overflow, (_IO_overflow_t) _IO_wfile_overflow),
+ JUMP_INIT(underflow, (_IO_underflow_t) _IO_wfile_underflow),
+ JUMP_INIT(uflow, (_IO_underflow_t) _IO_wdefault_uflow),
+ JUMP_INIT(pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
+ JUMP_INIT(xsputn, _IO_wfile_xsputn),
+ JUMP_INIT(xsgetn, _IO_file_xsgetn),
+ JUMP_INIT(seekoff, _IO_wfile_seekoff),
+ JUMP_INIT(seekpos, _IO_default_seekpos),
+ JUMP_INIT(setbuf, _IO_new_file_setbuf),
+ JUMP_INIT(sync, (_IO_sync_t) _IO_wfile_sync),
+ JUMP_INIT(doallocate, _IO_wfile_doallocate),
+ JUMP_INIT(read, _IO_file_read),
+ JUMP_INIT(write, _IO_new_file_write),
+ JUMP_INIT(seek, _IO_file_seek),
+ JUMP_INIT(close, _IO_file_close),
+ JUMP_INIT(stat, _IO_file_stat),
+ JUMP_INIT(showmanyc, _IO_default_showmanyc),
+ JUMP_INIT(imbue, _IO_default_imbue)
+};
+
+#endif /* _GLIBCPP_USE_WCHAR_T */
diff --git a/contrib/libstdc++/libio/wgenops.c b/contrib/libstdc++/libio/wgenops.c
new file mode 100644
index 0000000..7485452
--- /dev/null
+++ b/contrib/libstdc++/libio/wgenops.c
@@ -0,0 +1,756 @@
+/* Copyright (C) 1993, 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+ Written by Ulrich Drepper <drepper@cygnus.com>.
+ Based on the single byte version by Per Bothner <bothner@cygnus.com>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* Generic or default I/O operations. */
+
+#include "libioP.h"
+#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef __STDC__
+#include <stdlib.h>
+#endif
+#include <string.h>
+#include <wchar.h>
+
+
+#ifndef _LIBC
+# define __wmemcpy(dst, src, n) wmemcpy (dst, src, n)
+#endif
+
+
+static int save_for_wbackup __P ((_IO_FILE *fp, wchar_t *end_p))
+#ifdef _LIBC
+ internal_function
+#endif
+ ;
+
+/* Return minimum _pos markers
+ Assumes the current get area is the main get area. */
+_IO_ssize_t _IO_least_wmarker __P ((_IO_FILE *fp, wchar_t *end_p));
+
+_IO_ssize_t
+_IO_least_wmarker (fp, end_p)
+ _IO_FILE *fp;
+ wchar_t *end_p;
+{
+ _IO_ssize_t least_so_far = end_p - fp->_wide_data->_IO_read_base;
+ struct _IO_marker *mark;
+ for (mark = fp->_markers; mark != NULL; mark = mark->_next)
+ if (mark->_pos < least_so_far)
+ least_so_far = mark->_pos;
+ return least_so_far;
+}
+
+/* Switch current get area from backup buffer to (start of) main get area. */
+void
+_IO_switch_to_main_wget_area (fp)
+ _IO_FILE *fp;
+{
+ wchar_t *tmp;
+ fp->_flags &= ~_IO_IN_BACKUP;
+ /* Swap _IO_read_end and _IO_save_end. */
+ tmp = fp->_wide_data->_IO_read_end;
+ fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_save_end;
+ fp->_wide_data->_IO_save_end= tmp;
+ /* Swap _IO_read_base and _IO_save_base. */
+ tmp = fp->_wide_data->_IO_read_base;
+ fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_save_base;
+ fp->_wide_data->_IO_save_base = tmp;
+ /* Set _IO_read_ptr. */
+ fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_base;
+}
+
+
+/* Switch current get area from main get area to (end of) backup area. */
+void
+_IO_switch_to_wbackup_area (fp)
+ _IO_FILE *fp;
+{
+ wchar_t *tmp;
+ fp->_flags |= _IO_IN_BACKUP;
+ /* Swap _IO_read_end and _IO_save_end. */
+ tmp = fp->_wide_data->_IO_read_end;
+ fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_save_end;
+ fp->_wide_data->_IO_save_end = tmp;
+ /* Swap _IO_read_base and _IO_save_base. */
+ tmp = fp->_wide_data->_IO_read_base;
+ fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_save_base;
+ fp->_wide_data->_IO_save_base = tmp;
+ /* Set _IO_read_ptr. */
+ fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
+}
+
+
+void
+_IO_wsetb (f, b, eb, a)
+ _IO_FILE *f;
+ wchar_t *b;
+ wchar_t *eb;
+ int a;
+{
+ if (f->_wide_data->_IO_buf_base && !(f->_flags & _IO_USER_BUF))
+ FREE_BUF (f->_wide_data->_IO_buf_base, _IO_wblen (f));
+ f->_wide_data->_IO_buf_base = b;
+ f->_wide_data->_IO_buf_end = eb;
+ if (a)
+ f->_flags &= ~_IO_USER_BUF;
+ else
+ f->_flags |= _IO_USER_BUF;
+}
+
+
+wint_t
+_IO_wdefault_pbackfail (fp, c)
+ _IO_FILE *fp;
+ wint_t c;
+{
+ if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base
+ && !_IO_in_backup (fp)
+ && (wint_t) fp->_IO_read_ptr[-1] == c)
+ --fp->_IO_read_ptr;
+ else
+ {
+ /* Need to handle a filebuf in write mode (switch to read mode). FIXME!*/
+ if (!_IO_in_backup (fp))
+ {
+ /* We need to keep the invariant that the main get area
+ logically follows the backup area. */
+ if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base
+ && _IO_have_wbackup (fp))
+ {
+ if (save_for_wbackup (fp, fp->_wide_data->_IO_read_ptr))
+ return WEOF;
+ }
+ else if (!_IO_have_wbackup (fp))
+ {
+ /* No backup buffer: allocate one. */
+ /* Use nshort buffer, if unused? (probably not) FIXME */
+ int backup_size = 128;
+ wchar_t *bbuf = (wchar_t *) malloc (backup_size
+ * sizeof (wchar_t));
+ if (bbuf == NULL)
+ return WEOF;
+ fp->_wide_data->_IO_save_base = bbuf;
+ fp->_wide_data->_IO_save_end = (fp->_wide_data->_IO_save_base
+ + backup_size);
+ fp->_wide_data->_IO_backup_base = fp->_wide_data->_IO_save_end;
+ }
+ fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_ptr;
+ _IO_switch_to_wbackup_area (fp);
+ }
+ else if (fp->_wide_data->_IO_read_ptr <= fp->_wide_data->_IO_read_base)
+ {
+ /* Increase size of existing backup buffer. */
+ _IO_size_t new_size;
+ _IO_size_t old_size = (fp->_wide_data->_IO_read_end
+ - fp->_wide_data->_IO_read_base);
+ wchar_t *new_buf;
+ new_size = 2 * old_size;
+ new_buf = (wchar_t *) malloc (new_size * sizeof (wchar_t));
+ if (new_buf == NULL)
+ return WEOF;
+ __wmemcpy (new_buf + (new_size - old_size),
+ fp->_wide_data->_IO_read_base, old_size);
+ free (fp->_wide_data->_IO_read_base);
+ _IO_wsetg (fp, new_buf, new_buf + (new_size - old_size),
+ new_buf + new_size);
+ fp->_wide_data->_IO_backup_base = fp->_wide_data->_IO_read_ptr;
+ }
+
+ *--fp->_wide_data->_IO_read_ptr = c;
+ }
+ return c;
+}
+
+
+void
+_IO_wdefault_finish (fp, dummy)
+ _IO_FILE *fp;
+ int dummy;
+{
+ struct _IO_marker *mark;
+ if (fp->_wide_data->_IO_buf_base && !(fp->_flags & _IO_USER_BUF))
+ {
+ FREE_BUF (fp->_wide_data->_IO_buf_base,
+ _IO_wblen (fp) * sizeof (wchar_t));
+ fp->_wide_data->_IO_buf_base = fp->_wide_data->_IO_buf_end = NULL;
+ }
+
+ for (mark = fp->_markers; mark != NULL; mark = mark->_next)
+ mark->_sbuf = NULL;
+
+ if (fp->_IO_save_base)
+ {
+ free (fp->_wide_data->_IO_save_base);
+ fp->_IO_save_base = NULL;
+ }
+
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_fini (*fp->_lock);
+#endif
+
+ _IO_un_link ((struct _IO_FILE_plus *) fp);
+}
+
+
+wint_t
+_IO_wdefault_uflow (fp)
+ _IO_FILE *fp;
+{
+ wint_t wch;
+ wch = _IO_UNDERFLOW (fp);
+ if (wch == WEOF)
+ return WEOF;
+ return *fp->_wide_data->_IO_read_ptr++;
+}
+
+
+wint_t
+__woverflow (f, wch)
+ _IO_FILE *f;
+ wint_t wch;
+{
+ if (f->_mode == 0)
+ _IO_fwide (f, 1);
+ return _IO_OVERFLOW (f, wch);
+}
+
+
+wint_t
+__wuflow (fp)
+ _IO_FILE *fp;
+{
+ if (fp->_mode < 0 || (fp->_mode == 0 && _IO_fwide (fp, 1) != 1))
+ return WEOF;
+
+ if (fp->_mode == 0)
+ _IO_fwide (fp, 1);
+ if (_IO_in_put_mode (fp))
+ if (_IO_switch_to_wget_mode (fp) == EOF)
+ return WEOF;
+ if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
+ return *fp->_wide_data->_IO_read_ptr++;
+ if (_IO_in_backup (fp))
+ {
+ _IO_switch_to_main_wget_area (fp);
+ if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
+ return *fp->_wide_data->_IO_read_ptr++;
+ }
+ if (_IO_have_markers (fp))
+ {
+ if (save_for_wbackup (fp, fp->_wide_data->_IO_read_end))
+ return WEOF;
+ }
+ else if (_IO_have_wbackup (fp))
+ _IO_free_wbackup_area (fp);
+ return _IO_UFLOW (fp);
+}
+
+
+wint_t
+__wunderflow (fp)
+ _IO_FILE *fp;
+{
+ if (fp->_mode < 0 || (fp->_mode == 0 && _IO_fwide (fp, 1) != 1))
+ return WEOF;
+
+ if (fp->_mode == 0)
+ _IO_fwide (fp, 1);
+ if (_IO_in_put_mode (fp))
+ if (_IO_switch_to_wget_mode (fp) == EOF)
+ return WEOF;
+ if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
+ return *fp->_wide_data->_IO_read_ptr;
+ if (_IO_in_backup (fp))
+ {
+ _IO_switch_to_main_wget_area (fp);
+ if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
+ return *fp->_wide_data->_IO_read_ptr;
+ }
+ if (_IO_have_markers (fp))
+ {
+ if (save_for_wbackup (fp, fp->_wide_data->_IO_read_end))
+ return WEOF;
+ }
+ else if (_IO_have_backup (fp))
+ _IO_free_wbackup_area (fp);
+ return _IO_UNDERFLOW (fp);
+}
+
+
+_IO_size_t
+_IO_wdefault_xsputn (f, data, n)
+ _IO_FILE *f;
+ const void *data;
+ _IO_size_t n;
+{
+ const wchar_t *s = (const wchar_t *) data;
+ _IO_size_t more = n;
+ if (more <= 0)
+ return 0;
+ for (;;)
+ {
+ /* Space available. */
+ _IO_ssize_t count = (f->_wide_data->_IO_write_end
+ - f->_wide_data->_IO_write_ptr);
+ if (count > 0)
+ {
+ if ((_IO_size_t) count > more)
+ count = more;
+ if (count > 20)
+ {
+#ifdef _LIBC
+ f->_wide_data->_IO_write_ptr =
+ __wmempcpy (f->_wide_data->_IO_write_ptr, s, count);
+#else
+ memcpy (f->_wide_data->_IO_write_ptr, s, count);
+ f->_wide_data->_IO_write_ptr += count;
+#endif
+ s += count;
+ }
+ else if (count <= 0)
+ count = 0;
+ else
+ {
+ wchar_t *p = f->_wide_data->_IO_write_ptr;
+ _IO_ssize_t i;
+ for (i = count; --i >= 0; )
+ *p++ = *s++;
+ f->_wide_data->_IO_write_ptr = p;
+ }
+ more -= count;
+ }
+ if (more == 0 || __woverflow (f, *s++) == WEOF)
+ break;
+ more--;
+ }
+ return n - more;
+}
+
+
+_IO_size_t
+_IO_wdefault_xsgetn (fp, data, n)
+ _IO_FILE *fp;
+ void *data;
+ _IO_size_t n;
+{
+ _IO_size_t more = n;
+ wchar_t *s = (wchar_t*) data;
+ for (;;)
+ {
+ /* Data available. */
+ _IO_ssize_t count = (fp->_wide_data->_IO_read_end
+ - fp->_wide_data->_IO_read_ptr);
+ if (count > 0)
+ {
+ if ((_IO_size_t) count > more)
+ count = more;
+ if (count > 20)
+ {
+#ifdef _LIBC
+ s = __wmempcpy (s, fp->_wide_data->_IO_read_ptr, count);
+#else
+ memcpy (s, fp->_wide_data->_IO_read_ptr, count);
+ s += count;
+#endif
+ fp->_wide_data->_IO_read_ptr += count;
+ }
+ else if (count <= 0)
+ count = 0;
+ else
+ {
+ wchar_t *p = fp->_wide_data->_IO_read_ptr;
+ int i = (int) count;
+ while (--i >= 0)
+ *s++ = *p++;
+ fp->_wide_data->_IO_read_ptr = p;
+ }
+ more -= count;
+ }
+ if (more == 0 || __wunderflow (fp) == WEOF)
+ break;
+ }
+ return n - more;
+}
+
+
+void
+_IO_wdoallocbuf (fp)
+ _IO_FILE *fp;
+{
+ if (fp->_wide_data->_IO_buf_base)
+ return;
+ if (!(fp->_flags & _IO_UNBUFFERED))
+ if (_IO_DOALLOCATE (fp) != WEOF)
+ return;
+ _IO_wsetb (fp, fp->_wide_data->_shortbuf, fp->_wide_data->_shortbuf + 1, 0);
+}
+
+
+_IO_FILE *
+_IO_wdefault_setbuf (fp, p, len)
+ _IO_FILE *fp;
+ wchar_t *p;
+ _IO_ssize_t len;
+{
+ if (_IO_SYNC (fp) == EOF)
+ return NULL;
+ if (p == NULL || len == 0)
+ {
+ fp->_flags |= _IO_UNBUFFERED;
+ _IO_wsetb (fp, fp->_wide_data->_shortbuf, fp->_wide_data->_shortbuf + 1,
+ 0);
+ }
+ else
+ {
+ fp->_flags &= ~_IO_UNBUFFERED;
+ _IO_wsetb (fp, p, p + len, 0);
+ }
+ fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr
+ = fp->_wide_data->_IO_write_end = 0;
+ fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_ptr
+ = fp->_wide_data->_IO_read_end = 0;
+ return fp;
+}
+
+
+int
+_IO_wdefault_doallocate (fp)
+ _IO_FILE *fp;
+{
+ wchar_t *buf;
+
+ ALLOC_WBUF (buf, _IO_BUFSIZ, EOF);
+ _IO_wsetb (fp, buf, buf + _IO_BUFSIZ, 1);
+ return 1;
+}
+
+
+int
+_IO_switch_to_wget_mode (fp)
+ _IO_FILE *fp;
+{
+ if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base)
+ if (_IO_OVERFLOW (fp, WEOF) == WEOF)
+ return EOF;
+ if (_IO_in_backup (fp))
+ fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_backup_base;
+ else
+ {
+ fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_buf_base;
+ if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_read_end)
+ fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_write_ptr;
+ }
+ fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_write_ptr;
+
+ fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr
+ = fp->_wide_data->_IO_write_end = fp->_wide_data->_IO_read_ptr;
+
+ fp->_flags &= ~_IO_CURRENTLY_PUTTING;
+ return 0;
+}
+
+void
+_IO_free_wbackup_area (fp)
+ _IO_FILE *fp;
+{
+ if (_IO_in_backup (fp))
+ _IO_switch_to_main_wget_area (fp); /* Just in case. */
+ free (fp->_wide_data->_IO_save_base);
+ fp->_wide_data->_IO_save_base = NULL;
+ fp->_wide_data->_IO_save_end = NULL;
+ fp->_wide_data->_IO_backup_base = NULL;
+}
+
+#if 0
+int
+_IO_switch_to_wput_mode (fp)
+ _IO_FILE *fp;
+{
+ fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_read_ptr;
+ fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_read_ptr;
+ /* Following is wrong if line- or un-buffered? */
+ fp->_wide_data->_IO_write_end = (fp->_flags & _IO_IN_BACKUP
+ ? fp->_wide_data->_IO_read_end
+ : fp->_wide_data->_IO_buf_end);
+
+ fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
+ fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_end;
+
+ fp->_flags |= _IO_CURRENTLY_PUTTING;
+ return 0;
+}
+#endif
+
+
+static int
+#ifdef _LIBC
+internal_function
+#endif
+save_for_wbackup (fp, end_p)
+ _IO_FILE *fp;
+ wchar_t *end_p;
+{
+ /* Append [_IO_read_base..end_p] to backup area. */
+ _IO_ssize_t least_mark = _IO_least_wmarker (fp, end_p);
+ /* needed_size is how much space we need in the backup area. */
+ _IO_size_t needed_size = ((end_p - fp->_wide_data->_IO_read_base)
+ - least_mark);
+ /* FIXME: Dubious arithmetic if pointers are NULL */
+ _IO_size_t current_Bsize = (fp->_wide_data->_IO_save_end
+ - fp->_wide_data->_IO_save_base);
+ _IO_size_t avail; /* Extra space available for future expansion. */
+ _IO_ssize_t delta;
+ struct _IO_marker *mark;
+ if (needed_size > current_Bsize)
+ {
+ wchar_t *new_buffer;
+ avail = 100;
+ new_buffer = (wchar_t *) malloc ((avail + needed_size)
+ * sizeof (wchar_t));
+ if (new_buffer == NULL)
+ return EOF; /* FIXME */
+ if (least_mark < 0)
+ {
+#ifdef _LIBC
+ __wmempcpy (__wmempcpy (new_buffer + avail,
+ fp->_wide_data->_IO_save_end + least_mark,
+ -least_mark),
+ fp->_wide_data->_IO_read_base,
+ end_p - fp->_wide_data->_IO_read_base);
+#else
+ memcpy (new_buffer + avail,
+ fp->_wide_data->_IO_save_end + least_mark,
+ -least_mark * sizeof (wchar_t));
+ memcpy (new_buffer + avail - least_mark,
+ fp->_wide_data->_IO_read_base,
+ (end_p - fp->_wide_data->_IO_read_base) * sizeof (wchar_t));
+#endif
+ }
+ else
+ {
+#ifdef _LIBC
+ __wmemcpy (new_buffer + avail,
+ fp->_wide_data->_IO_read_base + least_mark,
+ needed_size);
+#else
+ memcpy (new_buffer + avail,
+ fp->_wide_data->_IO_read_base + least_mark,
+ needed_size * sizeof (wchar_t));
+#endif
+ }
+ if (fp->_wide_data->_IO_save_base)
+ free (fp->_wide_data->_IO_save_base);
+ fp->_wide_data->_IO_save_base = new_buffer;
+ fp->_wide_data->_IO_save_end = new_buffer + avail + needed_size;
+ }
+ else
+ {
+ avail = current_Bsize - needed_size;
+ if (least_mark < 0)
+ {
+#ifdef _LIBC
+ __wmemmove (fp->_wide_data->_IO_save_base + avail,
+ fp->_wide_data->_IO_save_end + least_mark,
+ -least_mark);
+ __wmemcpy (fp->_wide_data->_IO_save_base + avail - least_mark,
+ fp->_wide_data->_IO_read_base,
+ end_p - fp->_wide_data->_IO_read_base);
+#else
+ memmove (fp->_wide_data->_IO_save_base + avail,
+ fp->_wide_data->_IO_save_end + least_mark,
+ -least_mark * sizeof (wchar_t));
+ memcpy (fp->_wide_data->_IO_save_base + avail - least_mark,
+ fp->_wide_data->_IO_read_base,
+ (end_p - fp->_wide_data->_IO_read_base) * sizeof (wchar_t));
+#endif
+ }
+ else if (needed_size > 0)
+#ifdef _LIBC
+ __wmemcpy (fp->_wide_data->_IO_save_base + avail,
+ fp->_wide_data->_IO_read_base + least_mark,
+ needed_size);
+#else
+ memcpy (fp->_wide_data->_IO_save_base + avail,
+ fp->_wide_data->_IO_read_base + least_mark,
+ needed_size * sizeof (wchar_t));
+#endif
+ }
+ fp->_wide_data->_IO_backup_base = fp->_wide_data->_IO_save_base + avail;
+ /* Adjust all the streammarkers. */
+ delta = end_p - fp->_wide_data->_IO_read_base;
+ for (mark = fp->_markers; mark != NULL; mark = mark->_next)
+ mark->_pos -= delta;
+ return 0;
+}
+
+wint_t
+_IO_sputbackwc (fp, c)
+ _IO_FILE *fp;
+ wint_t c;
+{
+ wint_t result;
+
+ if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base
+ && (wchar_t)fp->_wide_data->_IO_read_ptr[-1] == (wchar_t) c)
+ {
+ fp->_wide_data->_IO_read_ptr--;
+ result = c;
+ }
+ else
+ result = _IO_PBACKFAIL (fp, c);
+
+ if (result != EOF)
+ fp->_flags &= ~_IO_EOF_SEEN;
+
+ return result;
+}
+
+wint_t
+_IO_sungetwc (fp)
+ _IO_FILE *fp;
+{
+ int result;
+
+ if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base)
+ {
+ fp->_wide_data->_IO_read_ptr--;
+ result = *fp->_wide_data->_IO_read_ptr;
+ }
+ else
+ result = _IO_PBACKFAIL (fp, EOF);
+
+ if (result != WEOF)
+ fp->_flags &= ~_IO_EOF_SEEN;
+
+ return result;
+}
+
+
+unsigned
+_IO_adjust_wcolumn (start, line, count)
+ unsigned start;
+ const wchar_t *line;
+ int count;
+{
+ const wchar_t *ptr = line + count;
+ while (ptr > line)
+ if (*--ptr == L'\n')
+ return line + count - ptr - 1;
+ return start + count;
+}
+
+void
+_IO_init_wmarker (marker, fp)
+ struct _IO_marker *marker;
+ _IO_FILE *fp;
+{
+ marker->_sbuf = fp;
+ if (_IO_in_put_mode (fp))
+ _IO_switch_to_wget_mode (fp);
+ if (_IO_in_backup (fp))
+ marker->_pos = fp->_wide_data->_IO_read_ptr - fp->_wide_data->_IO_read_end;
+ else
+ marker->_pos = (fp->_wide_data->_IO_read_ptr
+ - fp->_wide_data->_IO_read_base);
+
+ /* Should perhaps sort the chain? */
+ marker->_next = fp->_markers;
+ fp->_markers = marker;
+}
+
+#define BAD_DELTA EOF
+
+/* Return difference between MARK and current position of MARK's stream. */
+int
+_IO_wmarker_delta (mark)
+ struct _IO_marker *mark;
+{
+ int cur_pos;
+ if (mark->_sbuf == NULL)
+ return BAD_DELTA;
+ if (_IO_in_backup (mark->_sbuf))
+ cur_pos = (mark->_sbuf->_wide_data->_IO_read_ptr
+ - mark->_sbuf->_wide_data->_IO_read_end);
+ else
+ cur_pos = (mark->_sbuf->_wide_data->_IO_read_ptr
+ - mark->_sbuf->_wide_data->_IO_read_base);
+ return mark->_pos - cur_pos;
+}
+
+int
+_IO_seekwmark (fp, mark, delta)
+ _IO_FILE *fp;
+ struct _IO_marker *mark;
+ int delta;
+{
+ if (mark->_sbuf != fp)
+ return EOF;
+ if (mark->_pos >= 0)
+ {
+ if (_IO_in_backup (fp))
+ _IO_switch_to_main_wget_area (fp);
+ fp->_wide_data->_IO_read_ptr = (fp->_wide_data->_IO_read_base
+ + mark->_pos);
+ }
+ else
+ {
+ if (!_IO_in_backup (fp))
+ _IO_switch_to_wbackup_area (fp);
+ fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end + mark->_pos;
+ }
+ return 0;
+}
+
+void
+_IO_unsave_wmarkers (fp)
+ _IO_FILE *fp;
+{
+ struct _IO_marker *mark = fp->_markers;
+ if (mark)
+ {
+#ifdef TODO
+ streampos offset = seekoff (0, ios::cur, ios::in);
+ if (offset != EOF)
+ {
+ offset += eGptr () - Gbase ();
+ for ( ; mark != NULL; mark = mark->_next)
+ mark->set_streampos (mark->_pos + offset);
+ }
+ else
+ {
+ for ( ; mark != NULL; mark = mark->_next)
+ mark->set_streampos (EOF);
+ }
+#endif
+ fp->_markers = 0;
+ }
+
+ if (_IO_have_backup (fp))
+ _IO_free_wbackup_area (fp);
+}
+
+#endif /* _GLIBCPP_USE_WCHAR_T */
OpenPOWER on IntegriCloud