This package is an in-progess implementation of the C++ iostream library, as well as an implementation of C stdio. The entire package is Copyright Per Bothner 1992, except where explicitly noted. Note that some code is derived from the Chris Torek's stdio implementation for BSD 4.4, developed by the University of California, Berkeley. I have not put copyright notices in all of the files yet. The licensing terms are those of the GNU Library License. If those terms are unacceptable, contact me; we can probably work out an alternative. The package is far from complete, but it allows useful work. See the TODO file for list of things missing. FEATURES: * Full implementation of ANSI C stdio. * Full implementation of the streambuf layer of AT&T's iostream library for C++. (Mostly done.) * Impementation of most of the iostream layer of AT&T's iostream library. I will track the ANSI standard, and implement more as the details get firmer. * If you use the stdio library, you get full compatibility between stdio and streambufs. All stdio routines are implemented by coering the (FILE*) argument to a (streambuf*), and then doing streambuf operations. You can do the same: For example, if you have a streambuf* sb, you can do fprintf((FILE*)sb, ...). Also, (streambuf*)stdin == cin->rdbuf(), so you never need to synchonize streams and stdio. * Binary compatibility with the old _iob implementation of stdio. Thus you can link with libraries compiled for old C libraries. (There is also binary compatibility with the unreleased GNU libc.) * A parsebuf sub-class of streambuf that is tailored for parsing and scanning text: It keeps track of line numbers, and provides full access to the current input line with arbitrary seeks and unget/putback within the current line. * A string buffer class using an Emacs-style buffer gap. It provides first-class sub-strings and buffer markers. There is also an editbuf sub-class of streambuf that allows any number of streams to read or write in a buffer or a sub-string. INSTALLATION: If you have complete distribution of libg++, it will configure iostreams for you (as part of configuring libg++), so you can just do a: make If you have a standalone distribution of iostream (not part of libg++), then do: configure where might be (say) sun4: configure sun4 Then just: make Send bug reports to Per Bothner, bothner@cygnus.com. STDIO The stdio sub-directory contains a mostly complete implementation of ANSI-compatible stdio. It uses the iostream library. By default, this implementation is not installed, nor made part of libio.a or libg++.a, because most people probably prefer to use the existing stdio in their libc. If you do want to this this implementation of stdio, note there is a "binary compatibilty feature" that allows it to work with object files and libraries that have been compiled for a different stdio implementation. However, this uses an unportable trick that assumes a "traditional" layout of (struct _iob). See the file stdio/emulate.C for details. Also, there is still a problem if when linking you search libio.a before libc.a, if you use routines in libc.a that need stdio routines that you don't call directly. In that case the libc version of the stdio routine will be linked in, and it might not work here. Some hacking may be needed to avoid these propblems. Furthermore, the emulation may be slower (it works by tricking putc and getc to call a subroutine on each character. Ideally, iostream should be be integrated with a complete libc implementation, replacing the stdio portion of the library; this has been done in the Linux system. You may also need to hack streambuf.C if you prefer an alternative way to forcing flushes (via the call to flush_all()) on exit(). The current scheme uses a static destructor for the variable io_defs__ which is of the dummy class __io_defs. The disadvantage is that it requires that the main program be a C++ file (unless you use gcc-2.x), so this is not suitable if you want to use iostream as the default implementation of stdio (again, unless you're using gcc-2.x).