Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!samsung!emory!cambridge.apple.com!bloom-beacon!eru!luth!sunic!mcsun!ukc!dcl-cs!aber-cs!pcg From: pcg@aber-cs.UUCP (Piercarlo Grandi) Newsgroups: comp.lang.c++ Subject: A stream library clone, Part 01 Summary: The source to a proof of concept "fast" and small stream library Keywords: stream C++ clone libg++ Message-ID: <1503@aber-cs.UUCP> Date: 4 Dec 89 21:40:56 GMT Reply-To: pcg@cs.aber.ac.uk (Piercarlo Grandi) Organization: Dept of CS, UCW Aberystwyth (Disclaimer: my statements are purely personal) Lines: 1517 I have expended some small effort into building, as a proof that it could be done, a fast and small clone of "stream" package of the GNU C++ LIB 1.35, which in turn is more or less compatible with the 1.2 C++ library. This library is more or less 100% compatible, and is several times smaller and faster (under many interesting aspects) than the 1.35 libg++ original. It is also not much slower and is somewhat smaller than the stdio library, at least for those parts not built on top of it. It is a demonstration of how things needs not be elephantine, even under C++, even with overhead encouraging environments. The library has been written over a period of months with a very low intensity effort, and as such has rough edges. It should be quite viable though. Care has been taken to make it quite economical of resources, both time and space, at both compile and run time; more extendive tuning could have been done. Coding style is also not at all careless (e.g. portability should be fairly good), even if somewhat less sophisticated than my normal standards. The library was developed on a 386 clone running ENIX 5.3.2 rev A (now ESIX), and with GNU C++ 1.35.0; if you have a non system V os, you may want to have a look at some definitions in "_iobuf.H"; also stream/setbuf*.C should be revised a little. Some problems with the existing GNU C++ (and no doubts not just it) handling of sources split up in many files in various directories may well exist. Also, if you do not have a compiler that supports constant member functions (pre C++ 2.0), add "-Dconst=" to the "C++FLAGS" in the makefiles... I hope you like it; it is free software, and like other FSF inspired software it comes with no warranty, etc... Please note that it is not public domain sw, but rather comes under the FSF General Public License. I gratefully acknowledge the ability afforded me by my employer to have network access and thus post such material. Now an important disclaimer: This work has been performed entirely by me on my own time at my own expense on my own computer and using my own resources, as an adjunct of my own research activities. In no way the University College of Wales, my employer, has aided, authorized, funded, abetted, supported or sponsored such work (or even officially knows of its existence), and it is not part of any research activity performed within the CS Dept. of the UCW, by myself, or by any other party. ========== Unpacking: this is the first fo three shar archives, packed by the makekit program, one of Larry Wall's many contributions to the community. Create a directory for holding the sources, and "cd" to it and run the various parts thru "sh" or "unshar" or whatever other thing you use for that purpose. ------------------------------cut there--------------------------------------- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'MANIFEST' <<'END_OF_FILE' X File Name Archive # Description X----------------------------------------------------------- X MANIFEST 1 X Makefile 2 X README 1 X _iobuf 1 X _iobuf.H 3 X _iobuf/Makefile 2 X _iobuf/clearerr.C 1 X _iobuf/fileno.C 1 X c++-cat.C 1 X c++-echo.C 2 X c-cat.c 1 X c-echo.c 1 X istream 1 X istream.H 2 X istream/Makefile 2 X istream/cons-empty.C 1 X istream/cons-fd.C 1 X istream/cons-mode.C 1 X istream/cons-stdio.C 1 X istream/cons-stream.C 2 X istream/cons-string.C 1 X istream/destruct.C 1 X istream/eatwhite.C 1 X istream/flush.C 1 X istream/rsh-char.C 1 X istream/rsh-double.C 1 X istream/rsh-float.C 1 X istream/rsh-i-s.C 1 X istream/rsh-i-u.C 1 X istream/rsh-l-s.C 1 X istream/rsh-l-u.C 1 X istream/rsh-s-s.C 1 X istream/rsh-s-u.C 1 X istream/rsh-string.C 1 X istream/rsh-white.C 2 X istream/scan.C 2 X istream/tie.C 1 X ostream 1 X ostream.H 2 X ostream/Makefile 2 X ostream/cons-empty.C 1 X ostream/cons-fd.C 1 X ostream/cons-mode.C 1 X ostream/cons-stdio.C 1 X ostream/cons-stream.C 1 X ostream/cons-string.C 1 X ostream/destruct.C 1 X ostream/form.C 2 X ostream/lsh-double.C 1 X ostream/lsh-float.C 1 X ostream/lsh-i-s.C 1 X ostream/lsh-i-u.C 1 X ostream/lsh-l-s.C 1 X ostream/lsh-l-u.C 1 X ostream/lsh-s-s.C 1 X ostream/lsh-s-u.C 1 X ostream/lsh-string.C 1 X stdio.H 2 X stream 1 X stream.H 3 X stream.h 2 X stream/Makefile 3 X stream/clear.C 2 X stream/close.C 2 X stream/cons-empty.C 1 X stream/cons-fd.C 1 X stream/cons-mode.C 1 X stream/cons-stdio.C 1 X stream/cons-stream.C 2 X stream/cons-string.C 2 X stream/destruct.C 2 X stream/error.C 2 X stream/fileno.C 1 X stream/flush.C 1 X stream/get.C 2 X stream/getline.C 2 X stream/gets.C 1 X stream/initialize.C 1 X stream/iocount.C 1 X stream/isopen.C 1 X stream/name.C 1 X stream/open-fd.C 2 X stream/open-mode.C 2 X stream/open-stdio.C 1 X stream/open-stream.C 3 X stream/put.C 2 X stream/putback.C 1 X stream/raw.C 1 X stream/read.C 2 X stream/readline.C 2 X stream/remove.C 2 X stream/restart.C 2 X stream/seek.C 2 X stream/setHandler.C 3 X stream/setbuf-buf.C 2 X stream/setbuf-flags.C 2 X stream/setname.C 2 X stream/streamName.C 2 X stream/tell.C 1 X stream/unget.C 1 X stream/write.C 2 END_OF_FILE if test 3227 -ne `wc -c <'MANIFEST'`; then echo shar: \"'MANIFEST'\" unpacked with wrong size! fi # end of 'MANIFEST' fi if test -f 'README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'README'\" else echo shar: Extracting \"'README'\" \(2936 characters\) sed "s/^X//" >'README' <<'END_OF_FILE' X Copyright 1989 Piercarlo Grandi. All rights reserved. X X This library is free software; you can redistribute it and/or modify X it under the terms of the GNU General Public License as published by X the Free Software Foundation; either version 1, or (at your option) X any later version. X X This library is distributed in the hope that it will be useful, but X WITHOUT ANY WARRANTY; without even the implied warranty of X MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU X General Public License for more details. X X You may have received a copy of the GNU General Public License along X with this library; if not, write to the Free Software Foundation, X Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X This library is a streamlined, sped up clone of the "stream" package included in the GNU C++ library version 1.35; as such it is a near clone of the C++ 1.2 "stream" package. X It has been written as a demonstration of the ability to write libraries that are efficient both at compile time and execution time both in space and speed, and that still are neatly written. It is interesting to compare this library with both the C "stdio" one, and the GNU C++ LIB 1.35 "stream" one. It would also probably be interesting to compare it with the AT&T 2.0 stream package and the GNU C++ LIB 1.36, or the various Zortech versions. X XEach procedure in this library (actually there are four library archives) has been compiled in its own separate file, to make clients of the library only link in the procedures actually used. As a result, this library contains files with the same name but in different directories. This may cause problems with the mangling scheme for global constructors or destructors... Under GNU C++ 1.35.0 I had to manually alter the contents of the assembly output from "cons-stdio.C" in directory "istream". X Better, more sophisticated mechanisms are clearly needed for C++ than for C, but it will be a long time before we get there... Even if Modula 2 systems largely are there already (but then they make you use an ad hoc linker, etc..., as the standard ones are not good enough). X Some additional disclaimers: this library has been written merely as a proof of concept, over a period of some months, working rarely and in small bouts; as such it has some rough edges (e.g. incompletely tested, crude Makefiles, some details are less efficient than they should be, ...) and is not representative of my "production" programming style. X In particular, I would not want to base a production C++ library on the X"stream" model, and even if so, I would not really implement it as a layer on top of "stdio" (even if this has a couple of attractions). X I think I will eventually do a C++ library based on the Algol 68 Revised Report transput model, and implemented along the lines of the sample code by Prof. Van Vliet. Don't hold your breath waiting for it... END_OF_FILE if test 2936 -ne `wc -c <'README'`; then echo shar: \"'README'\" unpacked with wrong size! fi # end of 'README' fi if test ! -d '_iobuf' ; then echo shar: Creating directory \"'_iobuf'\" mkdir '_iobuf' fi if test -f '_iobuf/clearerr.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'_iobuf/clearerr.C'\" else echo shar: Extracting \"'_iobuf/clearerr.C'\" \(128 characters\) sed "s/^X//" >'_iobuf/clearerr.C' <<'END_OF_FILE' X#include "_iobuf.H" X extern void clearerr X( X register _iobuf *stdio X) X{ X stdio->flags &=~ (_iobufError|_iobufEof); X} END_OF_FILE if test 128 -ne `wc -c <'_iobuf/clearerr.C'`; then echo shar: \"'_iobuf/clearerr.C'\" unpacked with wrong size! fi # end of '_iobuf/clearerr.C' fi if test -f '_iobuf/fileno.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'_iobuf/fileno.C'\" else echo shar: Extracting \"'_iobuf/fileno.C'\" \(114 characters\) sed "s/^X//" >'_iobuf/fileno.C' <<'END_OF_FILE' X#include "_iobuf.H" X extern signed fileno X( X register const _iobuf *const stdio X) X{ X return stdio->fd; X} END_OF_FILE if test 114 -ne `wc -c <'_iobuf/fileno.C'`; then echo shar: \"'_iobuf/fileno.C'\" unpacked with wrong size! fi # end of '_iobuf/fileno.C' fi if test -f 'c++-cat.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'c++-cat.C'\" else echo shar: Extracting \"'c++-cat.C'\" \(246 characters\) sed "s/^X//" >'c++-cat.C' <<'END_OF_FILE' X#ifndef _stream_h X# include X#endif X extern signed main X( X auto signed argc, X auto const char **argv X) X{ X char ch; X X while (cin.get(ch)) X cout.put(ch); X X return (cin.bad() && !cin.eof()) || cout.bad(); X} END_OF_FILE if test 246 -ne `wc -c <'c++-cat.C'`; then echo shar: \"'c++-cat.C'\" unpacked with wrong size! fi # end of 'c++-cat.C' fi if test -f 'c-cat.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'c-cat.c'\" else echo shar: Extracting \"'c-cat.c'\" \(232 characters\) sed "s/^X//" >'c-cat.c' <<'END_OF_FILE' X#include X extern int main(argc,argv) X int argc; X char **argv; X{ X char ch; X X while ((ch = getc(stdin)) != EOF) X putc(ch,stdout); X X return (ferror(stdin) && !feof(stdin)) || ferror(stdout); X} END_OF_FILE if test 232 -ne `wc -c <'c-cat.c'`; then echo shar: \"'c-cat.c'\" unpacked with wrong size! fi # end of 'c-cat.c' fi if test -f 'c-echo.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'c-echo.c'\" else echo shar: Extracting \"'c-echo.c'\" \(265 characters\) sed "s/^X//" >'c-echo.c' <<'END_OF_FILE' X#include X extern int main(argc,argv) X int argc; X char **argv; X{ X for (--argc, argv++; argc && (fputs(*argv++,stdout), !ferror(stdout)); --argc) X if (argc > 1) putc(' ',stdout); X putc('\n',stdout); X X return ferror(stdout); X} END_OF_FILE if test 265 -ne `wc -c <'c-echo.c'`; then echo shar: \"'c-echo.c'\" unpacked with wrong size! fi # end of 'c-echo.c' fi if test ! -d 'istream' ; then echo shar: Creating directory \"'istream'\" mkdir 'istream' fi if test -f 'istream/cons-empty.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/cons-empty.C'\" else echo shar: Extracting \"'istream/cons-empty.C'\" \(93 characters\) sed "s/^X//" >'istream/cons-empty.C' <<'END_OF_FILE' X#include "istream.H" X extern construct istream::istream() X{ X tiedTo = nil(ostream *); X} END_OF_FILE if test 93 -ne `wc -c <'istream/cons-empty.C'`; then echo shar: \"'istream/cons-empty.C'\" unpacked with wrong size! fi # end of 'istream/cons-empty.C' fi if test -f 'istream/cons-fd.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/cons-fd.C'\" else echo shar: Extracting \"'istream/cons-fd.C'\" \(203 characters\) sed "s/^X//" >'istream/cons-fd.C' <<'END_OF_FILE' X#include "stream.H" X X#include "istream.H" X extern construct istream::istream X( X auto signed fd, X auto streamType type = streamRead X) X: stream(fd,type) X{ X tiedTo = nil(ostream *); X} END_OF_FILE if test 203 -ne `wc -c <'istream/cons-fd.C'`; then echo shar: \"'istream/cons-fd.C'\" unpacked with wrong size! fi # end of 'istream/cons-fd.C' fi if test -f 'istream/cons-mode.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/cons-mode.C'\" else echo shar: Extracting \"'istream/cons-mode.C'\" \(206 characters\) sed "s/^X//" >'istream/cons-mode.C' <<'END_OF_FILE' X#include "stream.H" X X#include "istream.H" X extern construct istream::istream X( X auto const char *filename, X auto const char *mode X) X: stream(filename,mode) X{ X tiedTo = nil(ostream *); X} END_OF_FILE if test 206 -ne `wc -c <'istream/cons-mode.C'`; then echo shar: \"'istream/cons-mode.C'\" unpacked with wrong size! fi # end of 'istream/cons-mode.C' fi if test -f 'istream/cons-stdio.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/cons-stdio.C'\" else echo shar: Extracting \"'istream/cons-stdio.C'\" \(215 characters\) sed "s/^X//" >'istream/cons-stdio.C' <<'END_OF_FILE' X#include "stdio.H" X#include "stream.H" X X#include "istream.H" X extern istream cin(stdin); X extern construct istream::istream X( X auto struct _iobuf *stdio X) X: stream(stdio) X{ X tiedTo = nil(ostream *); X} END_OF_FILE if test 215 -ne `wc -c <'istream/cons-stdio.C'`; then echo shar: \"'istream/cons-stdio.C'\" unpacked with wrong size! fi # end of 'istream/cons-stdio.C' fi if test -f 'istream/cons-string.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/cons-string.C'\" else echo shar: Extracting \"'istream/cons-string.C'\" \(202 characters\) sed "s/^X//" >'istream/cons-string.C' <<'END_OF_FILE' X#include "stream.H" X X#include "istream.H" X extern construct istream::istream X( X auto signed bytes, X auto char *area X) X: stream(bytes,area,streamRead) X{ X tiedTo = nil(ostream *); X} END_OF_FILE if test 202 -ne `wc -c <'istream/cons-string.C'`; then echo shar: \"'istream/cons-string.C'\" unpacked with wrong size! fi # end of 'istream/cons-string.C' fi if test -f 'istream/destruct.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/destruct.C'\" else echo shar: Extracting \"'istream/destruct.C'\" \(63 characters\) sed "s/^X//" >'istream/destruct.C' <<'END_OF_FILE' X#include "istream.H" X extern destruct istream::~istream() X{ X} END_OF_FILE if test 63 -ne `wc -c <'istream/destruct.C'`; then echo shar: \"'istream/destruct.C'\" unpacked with wrong size! fi # end of 'istream/destruct.C' fi if test -f 'istream/eatwhite.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/eatwhite.C'\" else echo shar: Extracting \"'istream/eatwhite.C'\" \(106 characters\) sed "s/^X//" >'istream/eatwhite.C' <<'END_OF_FILE' X#include "istream.H" X whitespace WS; X extern void eatwhite X( X auto istream &i X) X{ X i >> WS; X} END_OF_FILE if test 106 -ne `wc -c <'istream/eatwhite.C'`; then echo shar: \"'istream/eatwhite.C'\" unpacked with wrong size! fi # end of 'istream/eatwhite.C' fi if test -f 'istream/flush.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/flush.C'\" else echo shar: Extracting \"'istream/flush.C'\" \(130 characters\) sed "s/^X//" >'istream/flush.C' <<'END_OF_FILE' X#include "ostream.H" X X#include "istream.H" X extern void istream::flush() X{ X if (tiedTo != nil(ostream *)) X tiedTo->flush(); X} END_OF_FILE if test 130 -ne `wc -c <'istream/flush.C'`; then echo shar: \"'istream/flush.C'\" unpacked with wrong size! fi # end of 'istream/flush.C' fi if test -f 'istream/rsh-char.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/rsh-char.C'\" else echo shar: Extracting \"'istream/rsh-char.C'\" \(207 characters\) sed "s/^X//" >'istream/rsh-char.C' <<'END_OF_FILE' extern "C" X{ X#include X} X X#include "istream.H" X extern istream &istream::operator >> X( X auto char &ch X) X{ X this->flush(); X X while (this->get(ch) && isspace(ch)); X X return *this; X} END_OF_FILE if test 207 -ne `wc -c <'istream/rsh-char.C'`; then echo shar: \"'istream/rsh-char.C'\" unpacked with wrong size! fi # end of 'istream/rsh-char.C' fi if test -f 'istream/rsh-double.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/rsh-double.C'\" else echo shar: Extracting \"'istream/rsh-double.C'\" \(127 characters\) sed "s/^X//" >'istream/rsh-double.C' <<'END_OF_FILE' X#include "istream.H" X extern istream &istream::operator >> X( X auto double &n X) X{ X return this->scan("%lf",&n); X} END_OF_FILE if test 127 -ne `wc -c <'istream/rsh-double.C'`; then echo shar: \"'istream/rsh-double.C'\" unpacked with wrong size! fi # end of 'istream/rsh-double.C' fi if test -f 'istream/rsh-float.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/rsh-float.C'\" else echo shar: Extracting \"'istream/rsh-float.C'\" \(125 characters\) sed "s/^X//" >'istream/rsh-float.C' <<'END_OF_FILE' X#include "istream.H" X extern istream &istream::operator >> X( X auto float &n X) X{ X return this->scan("%f",&n); X} END_OF_FILE if test 125 -ne `wc -c <'istream/rsh-float.C'`; then echo shar: \"'istream/rsh-float.C'\" unpacked with wrong size! fi # end of 'istream/rsh-float.C' fi if test -f 'istream/rsh-i-s.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/rsh-i-s.C'\" else echo shar: Extracting \"'istream/rsh-i-s.C'\" \(126 characters\) sed "s/^X//" >'istream/rsh-i-s.C' <<'END_OF_FILE' X#include "istream.H" X extern istream &istream::operator >> X( X auto signed &n X) X{ X return this->scan("%d",&n); X} END_OF_FILE if test 126 -ne `wc -c <'istream/rsh-i-s.C'`; then echo shar: \"'istream/rsh-i-s.C'\" unpacked with wrong size! fi # end of 'istream/rsh-i-s.C' fi if test -f 'istream/rsh-i-u.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/rsh-i-u.C'\" else echo shar: Extracting \"'istream/rsh-i-u.C'\" \(127 characters\) sed "s/^X//" >'istream/rsh-i-u.C' <<'END_OF_FILE' X#include "istream.H" X extern istream &istream::operator >> X( X auto unsigned &n X) X{ X return this->scan("%u",&n); X} END_OF_FILE if test 127 -ne `wc -c <'istream/rsh-i-u.C'`; then echo shar: \"'istream/rsh-i-u.C'\" unpacked with wrong size! fi # end of 'istream/rsh-i-u.C' fi if test -f 'istream/rsh-l-s.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/rsh-l-s.C'\" else echo shar: Extracting \"'istream/rsh-l-s.C'\" \(131 characters\) sed "s/^X//" >'istream/rsh-l-s.C' <<'END_OF_FILE' X#include "istream.H" X extern istream &istream::operator >> X( X auto long signed &n X) X{ X return this->scan("%ld",&n); X} END_OF_FILE if test 131 -ne `wc -c <'istream/rsh-l-s.C'`; then echo shar: \"'istream/rsh-l-s.C'\" unpacked with wrong size! fi # end of 'istream/rsh-l-s.C' fi if test -f 'istream/rsh-l-u.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/rsh-l-u.C'\" else echo shar: Extracting \"'istream/rsh-l-u.C'\" \(133 characters\) sed "s/^X//" >'istream/rsh-l-u.C' <<'END_OF_FILE' X#include "istream.H" X extern istream &istream::operator >> X( X auto long unsigned &n X) X{ X return this->scan("%lu",&n); X} END_OF_FILE if test 133 -ne `wc -c <'istream/rsh-l-u.C'`; then echo shar: \"'istream/rsh-l-u.C'\" unpacked with wrong size! fi # end of 'istream/rsh-l-u.C' fi if test -f 'istream/rsh-s-s.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/rsh-s-s.C'\" else echo shar: Extracting \"'istream/rsh-s-s.C'\" \(132 characters\) sed "s/^X//" >'istream/rsh-s-s.C' <<'END_OF_FILE' X#include "istream.H" X extern istream &istream::operator >> X( X auto short signed &n X) X{ X return this->scan("%hd",&n); X} END_OF_FILE if test 132 -ne `wc -c <'istream/rsh-s-s.C'`; then echo shar: \"'istream/rsh-s-s.C'\" unpacked with wrong size! fi # end of 'istream/rsh-s-s.C' fi if test -f 'istream/rsh-s-u.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/rsh-s-u.C'\" else echo shar: Extracting \"'istream/rsh-s-u.C'\" \(134 characters\) sed "s/^X//" >'istream/rsh-s-u.C' <<'END_OF_FILE' X#include "istream.H" X extern istream &istream::operator >> X( X auto short unsigned &n X) X{ X return this->scan("%hu",&n); X} END_OF_FILE if test 134 -ne `wc -c <'istream/rsh-s-u.C'`; then echo shar: \"'istream/rsh-s-u.C'\" unpacked with wrong size! fi # end of 'istream/rsh-s-u.C' fi if test -f 'istream/rsh-string.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/rsh-string.C'\" else echo shar: Extracting \"'istream/rsh-string.C'\" \(123 characters\) sed "s/^X//" >'istream/rsh-string.C' <<'END_OF_FILE' X#include "istream.H" X extern istream &istream::operator >> X( X auto char *s X) X{ X return this->scan("%s",s); X} END_OF_FILE if test 123 -ne `wc -c <'istream/rsh-string.C'`; then echo shar: \"'istream/rsh-string.C'\" unpacked with wrong size! fi # end of 'istream/rsh-string.C' fi if test -f 'istream/tie.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'istream/tie.C'\" else echo shar: Extracting \"'istream/tie.C'\" \(191 characters\) sed "s/^X//" >'istream/tie.C' <<'END_OF_FILE' X#include "ostream.H" X X#include "istream.H" X extern ostream *istream::tie X( X auto ostream *newTie X) X{ X ostream *oldTie = tiedTo; X X tiedTo = newTie; X return oldTie; X} END_OF_FILE if test 191 -ne `wc -c <'istream/tie.C'`; then echo shar: \"'istream/tie.C'\" unpacked with wrong size! fi # end of 'istream/tie.C' fi if test ! -d 'ostream' ; then echo shar: Creating directory \"'ostream'\" mkdir 'ostream' fi if test -f 'ostream/cons-empty.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/cons-empty.C'\" else echo shar: Extracting \"'ostream/cons-empty.C'\" \(62 characters\) sed "s/^X//" >'ostream/cons-empty.C' <<'END_OF_FILE' X#include "ostream.H" X extern construct ostream::ostream() X{ X} END_OF_FILE if test 62 -ne `wc -c <'ostream/cons-empty.C'`; then echo shar: \"'ostream/cons-empty.C'\" unpacked with wrong size! fi # end of 'ostream/cons-empty.C' fi if test -f 'ostream/cons-fd.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/cons-fd.C'\" else echo shar: Extracting \"'ostream/cons-fd.C'\" \(163 characters\) sed "s/^X//" >'ostream/cons-fd.C' <<'END_OF_FILE' X#include "stream.H" X X#include "ostream.H" X extern construct ostream::ostream X( X auto signed fd, X auto const streamType type X) X: stream(fd,type) X{ X} END_OF_FILE if test 163 -ne `wc -c <'ostream/cons-fd.C'`; then echo shar: \"'ostream/cons-fd.C'\" unpacked with wrong size! fi # end of 'ostream/cons-fd.C' fi if test -f 'ostream/cons-mode.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/cons-mode.C'\" else echo shar: Extracting \"'ostream/cons-mode.C'\" \(188 characters\) sed "s/^X//" >'ostream/cons-mode.C' <<'END_OF_FILE' X#include "stream.H" X X#include "ostream.H" X extern construct ostream::ostream X( X auto const char *const filename, X auto const char *const mode X) X: stream(filename,mode) X{ X} END_OF_FILE if test 188 -ne `wc -c <'ostream/cons-mode.C'`; then echo shar: \"'ostream/cons-mode.C'\" unpacked with wrong size! fi # end of 'ostream/cons-mode.C' fi if test -f 'ostream/cons-stdio.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/cons-stdio.C'\" else echo shar: Extracting \"'ostream/cons-stdio.C'\" \(217 characters\) sed "s/^X//" >'ostream/cons-stdio.C' <<'END_OF_FILE' X#include "stdio.H" X#include "stream.H" X X#include "ostream.H" X extern ostream cout(stdout); extern ostream cerr(stderr); X extern construct ostream::ostream X( X auto _iobuf *const stdio X) X: stream(stdio) X{ X} END_OF_FILE if test 217 -ne `wc -c <'ostream/cons-stdio.C'`; then echo shar: \"'ostream/cons-stdio.C'\" unpacked with wrong size! fi # end of 'ostream/cons-stdio.C' fi if test -f 'ostream/cons-stream.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/cons-stream.C'\" else echo shar: Extracting \"'ostream/cons-stream.C'\" \(224 characters\) sed "s/^X//" >'ostream/cons-stream.C' <<'END_OF_FILE' X#include "stream.H" X X#include "ostream.H" X extern construct ostream::ostream X( X auto const char *const filename, X auto const streamType type, X auto const streamMode mode X) X: stream(filename,type,mode) X{ X} END_OF_FILE if test 224 -ne `wc -c <'ostream/cons-stream.C'`; then echo shar: \"'ostream/cons-stream.C'\" unpacked with wrong size! fi # end of 'ostream/cons-stream.C' fi if test -f 'ostream/cons-string.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/cons-string.C'\" else echo shar: Extracting \"'ostream/cons-string.C'\" \(184 characters\) sed "s/^X//" >'ostream/cons-string.C' <<'END_OF_FILE' X#include "stream.H" X X#include "ostream.H" X extern construct ostream::ostream X( X auto const signed bytes, X auto char *const area X) X: stream(bytes,area,streamWrite) X{ X} END_OF_FILE if test 184 -ne `wc -c <'ostream/cons-string.C'`; then echo shar: \"'ostream/cons-string.C'\" unpacked with wrong size! fi # end of 'ostream/cons-string.C' fi if test -f 'ostream/destruct.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/destruct.C'\" else echo shar: Extracting \"'ostream/destruct.C'\" \(63 characters\) sed "s/^X//" >'ostream/destruct.C' <<'END_OF_FILE' X#include "ostream.H" X extern destruct ostream::~ostream() X{ X} END_OF_FILE if test 63 -ne `wc -c <'ostream/destruct.C'`; then echo shar: \"'ostream/destruct.C'\" unpacked with wrong size! fi # end of 'ostream/destruct.C' fi if test -f 'ostream/lsh-double.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/lsh-double.C'\" else echo shar: Extracting \"'ostream/lsh-double.C'\" \(119 characters\) sed "s/^X//" >'ostream/lsh-double.C' <<'END_OF_FILE' X#include "ostream.H" X extern ostream &ostream::operator<< X( X auto const double n X) X{ X this->form("%g",n); X} END_OF_FILE if test 119 -ne `wc -c <'ostream/lsh-double.C'`; then echo shar: \"'ostream/lsh-double.C'\" unpacked with wrong size! fi # end of 'ostream/lsh-double.C' fi if test -f 'ostream/lsh-float.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/lsh-float.C'\" else echo shar: Extracting \"'ostream/lsh-float.C'\" \(127 characters\) sed "s/^X//" >'ostream/lsh-float.C' <<'END_OF_FILE' X#include "ostream.H" X extern ostream &ostream::operator<< X( X auto const float n X) X{ X this->form("%g",(double) n); X} END_OF_FILE if test 127 -ne `wc -c <'ostream/lsh-float.C'`; then echo shar: \"'ostream/lsh-float.C'\" unpacked with wrong size! fi # end of 'ostream/lsh-float.C' fi if test -f 'ostream/lsh-i-s.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/lsh-i-s.C'\" else echo shar: Extracting \"'ostream/lsh-i-s.C'\" \(126 characters\) sed "s/^X//" >'ostream/lsh-i-s.C' <<'END_OF_FILE' X#include "ostream.H" X extern ostream &ostream::operator<< X( X auto const signed n X) X{ X return this->form("%d",n); X} END_OF_FILE if test 126 -ne `wc -c <'ostream/lsh-i-s.C'`; then echo shar: \"'ostream/lsh-i-s.C'\" unpacked with wrong size! fi # end of 'ostream/lsh-i-s.C' fi if test -f 'ostream/lsh-i-u.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/lsh-i-u.C'\" else echo shar: Extracting \"'ostream/lsh-i-u.C'\" \(121 characters\) sed "s/^X//" >'ostream/lsh-i-u.C' <<'END_OF_FILE' X#include "ostream.H" X extern ostream &ostream::operator<< X( X auto const unsigned n X) X{ X this->form("%u",n); X} END_OF_FILE if test 121 -ne `wc -c <'ostream/lsh-i-u.C'`; then echo shar: \"'ostream/lsh-i-u.C'\" unpacked with wrong size! fi # end of 'ostream/lsh-i-u.C' fi if test -f 'ostream/lsh-l-s.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/lsh-l-s.C'\" else echo shar: Extracting \"'ostream/lsh-l-s.C'\" \(129 characters\) sed "s/^X//" >'ostream/lsh-l-s.C' <<'END_OF_FILE' X#include "ostream.H" X extern ostream &ostream::operator<< X( X auto const long signed n X) X{ X return this->form("%ld",n); X} END_OF_FILE if test 129 -ne `wc -c <'ostream/lsh-l-s.C'`; then echo shar: \"'ostream/lsh-l-s.C'\" unpacked with wrong size! fi # end of 'ostream/lsh-l-s.C' fi if test -f 'ostream/lsh-l-u.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/lsh-l-u.C'\" else echo shar: Extracting \"'ostream/lsh-l-u.C'\" \(123 characters\) sed "s/^X//" >'ostream/lsh-l-u.C' <<'END_OF_FILE' X#include "ostream.H" X extern ostream &ostream::operator<< X( X auto const long unsigned n X) X{ X this->form("%lu",n); X} END_OF_FILE if test 123 -ne `wc -c <'ostream/lsh-l-u.C'`; then echo shar: \"'ostream/lsh-l-u.C'\" unpacked with wrong size! fi # end of 'ostream/lsh-l-u.C' fi if test -f 'ostream/lsh-s-s.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/lsh-s-s.C'\" else echo shar: Extracting \"'ostream/lsh-s-s.C'\" \(129 characters\) sed "s/^X//" >'ostream/lsh-s-s.C' <<'END_OF_FILE' X#include "ostream.H" X extern ostream &ostream::operator<< X( X auto const short signed n X) X{ X return this->form("%hd",n); X} END_OF_FILE if test 129 -ne `wc -c <'ostream/lsh-s-s.C'`; then echo shar: \"'ostream/lsh-s-s.C'\" unpacked with wrong size! fi # end of 'ostream/lsh-s-s.C' fi if test -f 'ostream/lsh-s-u.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/lsh-s-u.C'\" else echo shar: Extracting \"'ostream/lsh-s-u.C'\" \(124 characters\) sed "s/^X//" >'ostream/lsh-s-u.C' <<'END_OF_FILE' X#include "ostream.H" X extern ostream &ostream::operator<< X( X auto const short unsigned n X) X{ X this->form("%hu",n); X} END_OF_FILE if test 124 -ne `wc -c <'ostream/lsh-s-u.C'`; then echo shar: \"'ostream/lsh-s-u.C'\" unpacked with wrong size! fi # end of 'ostream/lsh-s-u.C' fi if test -f 'ostream/lsh-string.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ostream/lsh-string.C'\" else echo shar: Extracting \"'ostream/lsh-string.C'\" \(130 characters\) sed "s/^X//" >'ostream/lsh-string.C' <<'END_OF_FILE' X#include "ostream.H" X extern ostream &ostream::operator<< X( X auto const char *s X) X{ X this->put(s); X return *this; X} END_OF_FILE if test 130 -ne `wc -c <'ostream/lsh-string.C'`; then echo shar: \"'ostream/lsh-string.C'\" unpacked with wrong size! fi # end of 'ostream/lsh-string.C' fi if test ! -d 'stream' ; then echo shar: Creating directory \"'stream'\" mkdir 'stream' fi if test -f 'stream/cons-empty.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/cons-empty.C'\" else echo shar: Extracting \"'stream/cons-empty.C'\" \(84 characters\) sed "s/^X//" >'stream/cons-empty.C' <<'END_OF_FILE' X#include "stream.H" X extern construct stream::stream() X{ X this->initialize(); X} END_OF_FILE if test 84 -ne `wc -c <'stream/cons-empty.C'`; then echo shar: \"'stream/cons-empty.C'\" unpacked with wrong size! fi # end of 'stream/cons-empty.C' fi if test -f 'stream/cons-fd.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/cons-fd.C'\" else echo shar: Extracting \"'stream/cons-fd.C'\" \(176 characters\) sed "s/^X//" >'stream/cons-fd.C' <<'END_OF_FILE' X#include "stream.H" X extern construct stream::stream X( X auto const signed fd, X auto const streamType type X) X{ X this->initialize(); X this->open(fd,type); X} END_OF_FILE if test 176 -ne `wc -c <'stream/cons-fd.C'`; then echo shar: \"'stream/cons-fd.C'\" unpacked with wrong size! fi # end of 'stream/cons-fd.C' fi if test -f 'stream/cons-mode.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/cons-mode.C'\" else echo shar: Extracting \"'stream/cons-mode.C'\" \(199 characters\) sed "s/^X//" >'stream/cons-mode.C' <<'END_OF_FILE' X#include "stream.H" X extern construct stream::stream X( X auto const char *const filename, X auto const char *const mode X) X{ X this->initialize(); X this->open(filename,mode); X} END_OF_FILE if test 199 -ne `wc -c <'stream/cons-mode.C'`; then echo shar: \"'stream/cons-mode.C'\" unpacked with wrong size! fi # end of 'stream/cons-mode.C' fi if test -f 'stream/cons-stdio.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/cons-stdio.C'\" else echo shar: Extracting \"'stream/cons-stdio.C'\" \(170 characters\) sed "s/^X//" >'stream/cons-stdio.C' <<'END_OF_FILE' X#include "stream.H" X#include "_iobuf.H" X extern construct stream::stream X( X auto const _iobuf *const stdio X) X{ X this->initialize(); X this->open(stdio); X} END_OF_FILE if test 170 -ne `wc -c <'stream/cons-stdio.C'`; then echo shar: \"'stream/cons-stdio.C'\" unpacked with wrong size! fi # end of 'stream/cons-stdio.C' fi if test -f 'stream/fileno.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/fileno.C'\" else echo shar: Extracting \"'stream/fileno.C'\" \(122 characters\) sed "s/^X//" >'stream/fileno.C' <<'END_OF_FILE' X#include "stream.H" X#include "_iobuf.H" X extern signed stream::fileno() X const X{ X return ::fileno(this->stdio); X} END_OF_FILE if test 122 -ne `wc -c <'stream/fileno.C'`; then echo shar: \"'stream/fileno.C'\" unpacked with wrong size! fi # end of 'stream/fileno.C' fi if test -f 'stream/flush.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/flush.C'\" else echo shar: Extracting \"'stream/flush.C'\" \(205 characters\) sed "s/^X//" >'stream/flush.C' <<'END_OF_FILE' X#include "stream.H" X extern "C" X{ extern signed fflush(_iobuf *); X} X extern stream &stream::flush() X{ X if (!this->disabled) X this->disabled = ::fflush(this->stdio) == EOF; X return *this; X} END_OF_FILE if test 205 -ne `wc -c <'stream/flush.C'`; then echo shar: \"'stream/flush.C'\" unpacked with wrong size! fi # end of 'stream/flush.C' fi if test -f 'stream/gets.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/gets.C'\" else echo shar: Extracting \"'stream/gets.C'\" \(208 characters\) sed "s/^X//" >'stream/gets.C' <<'END_OF_FILE' X#include "stream.H" X extern stream &stream::gets X( X char **s, X char const eos X) X{ X this->disabled = !this->readable() X || (*s = this->readline(0,eos)) == nil(char *); X X return *this; X} END_OF_FILE if test 208 -ne `wc -c <'stream/gets.C'`; then echo shar: \"'stream/gets.C'\" unpacked with wrong size! fi # end of 'stream/gets.C' fi if test -f 'stream/initialize.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/initialize.C'\" else echo shar: Extracting \"'stream/initialize.C'\" \(196 characters\) sed "s/^X//" >'stream/initialize.C' <<'END_OF_FILE' X#include "stream.H" X#include "_iobuf.H" X extern void stream::initialize() X{ X this->disabled = 1; X this->dispose = 0; X X this->stdio = nil(_iobuf *); X this->fileName = nil(char *); X} END_OF_FILE if test 196 -ne `wc -c <'stream/initialize.C'`; then echo shar: \"'stream/initialize.C'\" unpacked with wrong size! fi # end of 'stream/initialize.C' fi if test -f 'stream/iocount.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/iocount.C'\" else echo shar: Extracting \"'stream/iocount.C'\" \(96 characters\) sed "s/^X//" >'stream/iocount.C' <<'END_OF_FILE' X#include "stream.H" X extern long signed stream::iocount() X const X{ X return this->count; X} END_OF_FILE if test 96 -ne `wc -c <'stream/iocount.C'`; then echo shar: \"'stream/iocount.C'\" unpacked with wrong size! fi # end of 'stream/iocount.C' fi if test -f 'stream/isopen.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/isopen.C'\" else echo shar: Extracting \"'stream/isopen.C'\" \(128 characters\) sed "s/^X//" >'stream/isopen.C' <<'END_OF_FILE' X#include "stream.H" X#include "_iobuf.H" X extern signed stream::isopen() X const X{ X return this->stdio != nil(_iobuf *); X} END_OF_FILE if test 128 -ne `wc -c <'stream/isopen.C'`; then echo shar: \"'stream/isopen.C'\" unpacked with wrong size! fi # end of 'stream/isopen.C' fi if test -f 'stream/name.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/name.C'\" else echo shar: Extracting \"'stream/name.C'\" \(97 characters\) sed "s/^X//" >'stream/name.C' <<'END_OF_FILE' X#include "stream.H" X extern const char *stream::name() X const X{ X return this->fileName; X} END_OF_FILE if test 97 -ne `wc -c <'stream/name.C'`; then echo shar: \"'stream/name.C'\" unpacked with wrong size! fi # end of 'stream/name.C' fi if test -f 'stream/open-stdio.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/open-stdio.C'\" else echo shar: Extracting \"'stream/open-stdio.C'\" \(211 characters\) sed "s/^X//" >'stream/open-stdio.C' <<'END_OF_FILE' X#include "stream.H" X#include "_iobuf.H" X extern stream &stream::open X( X auto const _iobuf *const stdio X) X{ X this->close(); X this->stdio = stdio; X this->restart(nil(char *)); X return *this; X} END_OF_FILE if test 211 -ne `wc -c <'stream/open-stdio.C'`; then echo shar: \"'stream/open-stdio.C'\" unpacked with wrong size! fi # end of 'stream/open-stdio.C' fi if test -f 'stream/putback.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/putback.C'\" else echo shar: Extracting \"'stream/putback.C'\" \(242 characters\) sed "s/^X//" >'stream/putback.C' <<'END_OF_FILE' X#include "stream.H" X extern "C" X{ extern signed ungetc(char,_iobuf *); X} X extern stream &stream::putback X( X auto const char ch X) X{ X if (!this->disabled) X this->disabled = ::ungetc(ch,this->stdio) == EOF; X return *this; X} END_OF_FILE if test 242 -ne `wc -c <'stream/putback.C'`; then echo shar: \"'stream/putback.C'\" unpacked with wrong size! fi # end of 'stream/putback.C' fi if test -f 'stream/raw.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/raw.C'\" else echo shar: Extracting \"'stream/raw.C'\" \(118 characters\) sed "s/^X//" >'stream/raw.C' <<'END_OF_FILE' X#include "stream.H" X#include "_iobuf.H" X extern stream &stream::raw() X{ X return this->setbuf(_iobufUnbuffered); X} END_OF_FILE if test 118 -ne `wc -c <'stream/raw.C'`; then echo shar: \"'stream/raw.C'\" unpacked with wrong size! fi # end of 'stream/raw.C' fi if test -f 'stream/tell.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/tell.C'\" else echo shar: Extracting \"'stream/tell.C'\" \(237 characters\) sed "s/^X//" >'stream/tell.C' <<'END_OF_FILE' X#include "stream.H" X extern "C" X{ extern long ftell(const _iobuf *); X} X extern long signed stream::tell() X{ X if (this->disabled) X return -1L; X X this->disabled = (this->count = ::ftell(this->stdio)) < 0; X X return this->count; X} END_OF_FILE if test 237 -ne `wc -c <'stream/tell.C'`; then echo shar: \"'stream/tell.C'\" unpacked with wrong size! fi # end of 'stream/tell.C' fi if test -f 'stream/unget.C' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stream/unget.C'\" else echo shar: Extracting \"'stream/unget.C'\" \(245 characters\) sed "s/^X//" >'stream/unget.C' <<'END_OF_FILE' X#include "stream.H" X extern "C" X{ extern signed ungetc(char,_iobuf *); X} X extern stream &stream::unget X( X auto const char ch X) X{ X if (!this->disabled) X this->disabled = ::ungetc(ch,this->stdio) == EOF; X return *this; X} END_OF_FILE if test 245 -ne `wc -c <'stream/unget.C'`; then echo shar: \"'stream/unget.C'\" unpacked with wrong size! fi # end of 'stream/unget.C' fi echo shar: End of archive 1 \(of 3\). cp /dev/null ark1isdone MISSING="" for I in 1 2 3 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 3 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Piercarlo "Peter" Grandi | ARPA: pcg%cs.aber.ac.uk@nsfnet-relay.ac.uk Dept of CS, UCW Aberystwyth | UUCP: ...!mcvax!ukc!aber-cs!pcg Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk