pcg@aber-cs.UUCP (Piercarlo Grandi) (12/05/89)
----------------------------------cut here----------------------------------
#! /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 <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 2 (of 3)."
# Contents: Makefile _iobuf/Makefile c++-echo.C istream.H
# istream/Makefile istream/cons-stream.C istream/rsh-white.C
# istream/scan.C ostream.H ostream/Makefile ostream/form.C stdio.H
# stream.h stream/clear.C stream/close.C stream/cons-stream.C
# stream/cons-string.C stream/destruct.C stream/error.C stream/get.C
# stream/getline.C stream/open-fd.C stream/open-mode.C stream/put.C
# stream/read.C stream/readline.C stream/remove.C stream/restart.C
# stream/seek.C stream/setbuf-buf.C stream/setbuf-flags.C
# stream/setname.C stream/streamName.C stream/write.C
# Wrapped by piercarl@aware on Mon Dec 4 14:14:26 1989
echo '
Copyright 1989 Piercarlo Grandi. All rights reserved.
This shar archive is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 1, or (at
your option) any later version.
This shar archive is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You may have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
'
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(865 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X.SUFFIXES: .C .a .s .o
X
CFLAGS =-O
X
X# To compile with this library
C++FLAGS =$(CFLAGS) -I.
LIBS =libistream.a libostream.a libstream.a lib_iobuf.a
X# To compile with the libg++
X#C++FLAGS =$(CFLAGS)
X#LIBS =/usr/local/lib/libg++.a
X
CC =time cc
CC++ =time g++ -dm
LD =time g++
LDFLAGS =-s
X
X.C.s:; $(CC++) $(C++FLAGS) -S $*.C
X.C.o:; $(CC++) $(C++FLAGS) -c $*.C
X.C:; $(CC++) $(C++FLAGS) $(LDFLAGS) $*.C $(LIBS) -o $@
X
all: c-echo c-cat c++-echo c++-cat
X size c-echo c++-echo c-cat c++-cat
X time ./c-echo */* >/dev/null
X time ./c++-echo */* >/dev/null
X time ./c-cat </etc/termcap >/dev/null
X time ./c++-cat </etc/termcap >/dev/null
X
clean:
X rm -f *.a *.o c-cat c-echo c++-cat c++-echo
X
X# stdio.H: _iobuf.H
X# stream.H: _iobuf.H
X# istream.H: stream.H
X# ostream.H: stream.H
X
c++-echo.o: _iobuf.H stream.H ostream.H
c++-cat.o: _iobuf.H stream.H istream.H ostream.H
END_OF_FILE
if test 865 -ne `wc -c <'Makefile'`; then
echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f '_iobuf/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'_iobuf/Makefile'\"
else
echo shar: Extracting \"'_iobuf/Makefile'\" \(423 characters\)
sed "s/^X//" >'_iobuf/Makefile' <<'END_OF_FILE'
X.SUFFIXES: .C .a .s .o
X
I =../
CFLAGS =-O
C++FLAGS =$(CFLAGS) -I$(I)
CC++ =g++
LD =g++
LDFLAGS =-s
X
X.C.s:; $(CC++) $(C++FLAGS) -S $*.C
X.C.o:; $(CC++) $(C++FLAGS) -c $*.C
X.C:; $(CC++) $(C++FLAGS) -c $*.C -o $@
X
SRCS =clearerr.C fileno.C
OBJS =clearerr.o fileno.o
X
LIB =../lib_iobuf.a
X
X$(LIB): $(OBJS)
X rm -f $(LIB) && ar r $(LIB) $(OBJS)
X
clean:
X rm -f $(LIB) *.o
X
clearerr.o: $(I)_iobuf.H
fileno.o: $(I)_iobuf.H
END_OF_FILE
if test 423 -ne `wc -c <'_iobuf/Makefile'`; then
echo shar: \"'_iobuf/Makefile'\" unpacked with wrong size!
fi
# end of '_iobuf/Makefile'
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'\" \(299 characters\)
sed "s/^X//" >'c++-echo.C' <<'END_OF_FILE'
X#ifndef _stream_h
X# include <stream.h>
X#endif
X
extern signed main
X(
X auto signed argc,
X auto const char **argv
X)
X{
X cout.form("%s: ",argv[0]);
X
X for (--argc, argv++; argc && cout << *argv++; --argc)
X if (argc > 1) cout.put(' ');
X cout.put('\n');
X
X return cout.bad();
X}
END_OF_FILE
if test 299 -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 -f 'istream.H' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'istream.H'\"
else
echo shar: Extracting \"'istream.H'\" \(1353 characters\)
sed "s/^X//" >'istream.H' <<'END_OF_FILE'
X#ifndef istream_H
X#define istream_H
X#if __STDC__
X# pragma once
X#endif
X
X#ifndef stream_H
X# include "stream.H"
X#endif
X
class ostream;
class whitespace;
X
class istream: public stream
X{
protected:
X
X ostream *tiedTo;
X void flush();
X
public:
X
X construct istream();
X construct istream(const char *,streamType,streamMode);
X construct istream(const char *,const char *);
X construct istream(signed,streamType = streamRead);
X construct istream(const _iobuf *);
X construct istream(signed,char *);
X
X destruct ~istream();
X
X convert operator void *();
X
X ostream *tie(ostream *);
X
X istream &scan(const char *,...);
X
X istream &operator >>(char &);
X
X istream &operator >>(short unsigned &);
X istream &operator >>(unsigned &);
X istream &operator >>(long unsigned &);
X
X istream &operator >>(short signed &);
X istream &operator >>(signed &);
X istream &operator >>(long signed &);
X
X istream &operator >>(float &);
X istream &operator >>(double &);
X
X istream &operator >>(char *);
X
X istream &operator >>(const whitespace &);
X};
X
static inline convert istream::operator void *()
X{
X return (this->disabled) ? nil(void *) : (void *) this;
X}
X
extern istream cin;
X
class whitespace
X{
X};
X
extern whitespace WS;
X
extern void eatwhite(istream &);
X
X#endif
END_OF_FILE
if test 1353 -ne `wc -c <'istream.H'`; then
echo shar: \"'istream.H'\" unpacked with wrong size!
fi
# end of 'istream.H'
fi
if test -f 'istream/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'istream/Makefile'\"
else
echo shar: Extracting \"'istream/Makefile'\" \(1545 characters\)
sed "s/^X//" >'istream/Makefile' <<'END_OF_FILE'
X.SUFFIXES: .C .a .s .o
X
I =../
CFLAGS =-O
C++FLAGS =$(CFLAGS) -I$(I)
CC++ =g++
LD =g++
LDFLAGS =-s
X
X.C.s:; $(CC++) $(C++FLAGS) -S $*.C
X.C.o:; $(CC++) $(C++FLAGS) -c $*.C
X.C:; $(CC++) $(C++FLAGS) -c $*.C -o $@
X
SRCS =cons-empty.C cons-fd.C cons-mode.C \
X cons-stdio.C cons-stream.C cons-string.C \
X destruct.C eatwhite.C flush.C \
X rsh-char.C rsh-double.C rsh-float.C \
X rsh-i-s.C rsh-i-u.C rsh-l-s.C \
X rsh-l-u.C rsh-s-s.C rsh-s-u.C \
X rsh-string.C rsh-white.C scan.C \
X tie.C
X
OBJS =cons-empty.o cons-fd.o cons-mode.o \
X cons-stdio.o cons-stream.o cons-string.o \
X destruct.o eatwhite.o flush.o \
X rsh-char.o rsh-double.o rsh-float.o \
X rsh-i-s.o rsh-i-u.o rsh-l-s.o \
X rsh-l-u.o rsh-s-s.o rsh-s-u.o \
X rsh-string.o rsh-white.o scan.o \
X tie.o
X
LIB =../libistream.a
X
X$(LIB): $(OBJS)
X rm -f $(LIB) && ar r $(LIB) $(OBJS)
X
clean:
X rm -f $(LIB) *.o
X
cons-empty.C: $(I)istream.H
cons-fd.C: $(I)stream.H $(I)istream.H
cons-mode.C: $(I)stream.H $(I)istream.H
cons-stdio.C: $(I)stdio.H $(I)stream.H $(I)istream.H
cons-stream.C: $(I)stream.H $(I)istream.H
cons-string.C: $(I)stream.H $(I)istream.H
destruct.C: $(I)istream.H
eatwhite.C: $(I)istream.H
flush.C: $(I)ostream.H $(I)istream.H
rsh-char.C: $(I)istream.H
rsh-double.C: $(I)istream.H
rsh-float.C: $(I)istream.H
rsh-i-s.C: $(I)istream.H
rsh-i-u.C: $(I)istream.H
rsh-l-s.C: $(I)istream.H
rsh-l-u.C: $(I)istream.H
rsh-s-s.C: $(I)istream.H
rsh-s-u.C: $(I)istream.H
rsh-string.C: $(I)istream.H
rsh-white.C: $(I)istream.H
tie.C: $(I)ostream.H $(I)istream.H
END_OF_FILE
if test 1545 -ne `wc -c <'istream/Makefile'`; then
echo shar: \"'istream/Makefile'\" unpacked with wrong size!
fi
# end of 'istream/Makefile'
fi
if test -f 'istream/cons-stream.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'istream/cons-stream.C'\"
else
echo shar: Extracting \"'istream/cons-stream.C'\" \(243 characters\)
sed "s/^X//" >'istream/cons-stream.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 streamType type,
X auto streamMode mode
X)
X: stream(filename,type,mode)
X{
X tiedTo = nil(ostream *);
X}
END_OF_FILE
if test 243 -ne `wc -c <'istream/cons-stream.C'`; then
echo shar: \"'istream/cons-stream.C'\" unpacked with wrong size!
fi
# end of 'istream/cons-stream.C'
fi
if test -f 'istream/rsh-white.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'istream/rsh-white.C'\"
else
echo shar: Extracting \"'istream/rsh-white.C'\" \(281 characters\)
sed "s/^X//" >'istream/rsh-white.C' <<'END_OF_FILE'
extern "C"
X{
X#include <ctype.h>
X}
X
X#include "istream.H"
X
extern istream &istream::operator >>
X(
X auto whitespace &
X)
X{
X this->flush();
X
X {
X auto char ch;
X
X while (this->get(ch) && isspace(ch));
X
X if (this->good())
X this->unget(ch);
X }
X
X return *this;
X}
END_OF_FILE
if test 281 -ne `wc -c <'istream/rsh-white.C'`; then
echo shar: \"'istream/rsh-white.C'\" unpacked with wrong size!
fi
# end of 'istream/rsh-white.C'
fi
if test -f 'istream/scan.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'istream/scan.C'\"
else
echo shar: Extracting \"'istream/scan.C'\" \(561 characters\)
sed "s/^X//" >'istream/scan.C' <<'END_OF_FILE'
X#ifndef _stdarg_h
X# include <stdarg.h>
X#endif
X#ifndef _iobuf_H
X# include "_iobuf.H"
X#endif
X#ifndef stream_H
X# include "stream.H"
X#endif
X#ifndef istream_H
X# include "istream.H"
X#endif
X
extern "C"
X{
extern signed _doscan(struct _iobuf *,const char *,...);
X}
X
extern istream &istream::scan
X(
X auto const char *format,
X ...
X)
X{
X auto va_list parms;
X
X this->flush();
X
X va_start(parms,format);
X this->disabled = !this->readable()
X || (this->count = ::_doscan(this->stdio,format,parms) < 0);
X va_end(parms);
X
X return *this;
X}
END_OF_FILE
if test 561 -ne `wc -c <'istream/scan.C'`; then
echo shar: \"'istream/scan.C'\" unpacked with wrong size!
fi
# end of 'istream/scan.C'
fi
if test -f 'ostream.H' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'ostream.H'\"
else
echo shar: Extracting \"'ostream.H'\" \(1214 characters\)
sed "s/^X//" >'ostream.H' <<'END_OF_FILE'
X#ifndef ostream_H
X#define ostream_H
X#if __STDC__
X# pragma once
X#endif
X
X#ifndef stream_H
X# include "stream.H"
X#endif
X
class ostream: public stream
X{
public:
X
X construct ostream();
X construct ostream(const char *,streamType,streamMode);
X construct ostream(const char *,const char *);
X construct ostream(signed,streamType = streamWrite);
X construct ostream(const _iobuf *);
X construct ostream(signed,const char *);
X
X convert operator void *();
X
X ostream &form(const char *,...);
X
X ostream &operator <<(char);
X
X ostream &operator <<(short unsigned);
X ostream &operator <<(unsigned);
X ostream &operator <<(long unsigned);
X
X ostream &operator <<(short signed);
X ostream &operator <<(signed);
X ostream &operator <<(long signed);
X
X ostream &operator <<(float);
X ostream &operator <<(double);
X
X ostream &operator <<(const char *);
X
X destruct ~ostream();
X};
X
static inline ostream &ostream::operator <<
X(
X auto const char ch
X)
X{
X return (ostream &) this->put(ch);
X}
X
static inline convert ostream::operator void *()
X{
X return (this->disabled) ? nil(void *) : (void *) this;
X}
X
extern ostream cout;
extern ostream cerr;
X
X#endif
END_OF_FILE
if test 1214 -ne `wc -c <'ostream.H'`; then
echo shar: \"'ostream.H'\" unpacked with wrong size!
fi
# end of 'ostream.H'
fi
if test -f 'ostream/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'ostream/Makefile'\"
else
echo shar: Extracting \"'ostream/Makefile'\" \(1357 characters\)
sed "s/^X//" >'ostream/Makefile' <<'END_OF_FILE'
X.SUFFIXES: .C .a .s .o
X
I =../
CFLAGS =-O
C++FLAGS =$(CFLAGS) -I$(I)
CC++ =g++
LD =g++
LDFLAGS =-s
X
X.C.s:; $(CC++) $(C++FLAGS) -S $*.C
X.C.o:; $(CC++) $(C++FLAGS) -c $*.C
X.C:; $(CC++) $(C++FLAGS) -c $*.C -o $@
X
SRCS =cons-empty.C cons-fd.C cons-mode.C \
X cons-stdio.C cons-stream.C cons-string.C \
X destruct.C form.C lsh-double.C \
X lsh-float.C lsh-i-s.C lsh-i-u.C \
X lsh-l-s.C lsh-l-u.C lsh-s-s.C \
X lsh-s-u.C lsh-string.C
X
OBJS =cons-empty.o cons-fd.o cons-mode.o \
X cons-stdio.o cons-stream.o cons-string.o \
X destruct.o form.o lsh-double.o \
X lsh-float.o lsh-i-s.o lsh-i-u.o \
X lsh-l-s.o lsh-l-u.o lsh-s-s.o \
X lsh-s-u.o lsh-string.o
X
LIB =../libostream.a
X
X$(LIB): $(OBJS)
X rm -f $(LIB) && ar r $(LIB) $(OBJS)
X
clean:
X rm -f $(LIB) *.o
X
cons-empty.C: $(I)ostream.H
cons-fd.C: $(I)stream.H
cons-fd.C: $(I)ostream.H
cons-mode.C: $(I)stream.H
cons-mode.C: $(I)ostream.H
cons-stdio.C: $(I)stdio.H
cons-stdio.C: $(I)stream.H
cons-stdio.C: $(I)ostream.H
cons-stream.C: $(I)stream.H
cons-stream.C: $(I)ostream.H
cons-string.C: $(I)stream.H
cons-string.C: $(I)ostream.H
destruct.C: $(I)ostream.H
lsh-double.C: $(I)ostream.H
lsh-float.C: $(I)ostream.H
lsh-i-s.C: $(I)ostream.H
lsh-i-u.C: $(I)ostream.H
lsh-l-s.C: $(I)ostream.H
lsh-l-u.C: $(I)ostream.H
lsh-s-s.C: $(I)ostream.H
lsh-s-u.C: $(I)ostream.H
lsh-string.C: $(I)ostream.H
END_OF_FILE
if test 1357 -ne `wc -c <'ostream/Makefile'`; then
echo shar: \"'ostream/Makefile'\" unpacked with wrong size!
fi
# end of 'ostream/Makefile'
fi
if test -f 'ostream/form.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'ostream/form.C'\"
else
echo shar: Extracting \"'ostream/form.C'\" \(694 characters\)
sed "s/^X//" >'ostream/form.C' <<'END_OF_FILE'
X#ifndef _stdarg_h
X# include <stdarg.h>
X#endif
X#ifndef _iobuf_H
X# include "_iobuf.H"
X#endif
X#ifndef stream_H
X# include "stream.H"
X#endif
X#ifndef ostream_H
X# include "ostream.H"
X#endif
X
extern "C"
X{
X#if (_iobufVPRINTF)
X extern signed vfprintf(struct _iobuf *,const char *,va_list);
X#else
X# define vfprintf(s,f,p) _doprnt(f,p,s)
X extern signed _doprnt(const char *,va_list,struct _iobuf *);
X#endif
X}
X
extern ostream &ostream::form
X(
X auto const char *const format,
X ...
X)
X{
X auto va_list parms;
X
X va_start(parms,format);
X this->disabled = !this->writable()
X || (this->count = vfprintf(this->stdio,format,parms)) < 0;
X va_end(parms);
X
X return *this;
X}
END_OF_FILE
if test 694 -ne `wc -c <'ostream/form.C'`; then
echo shar: \"'ostream/form.C'\" unpacked with wrong size!
fi
# end of 'ostream/form.C'
fi
if test -f 'stdio.H' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stdio.H'\"
else
echo shar: Extracting \"'stdio.H'\" \(1157 characters\)
sed "s/^X//" >'stdio.H' <<'END_OF_FILE'
X#ifndef stdio_H
X#define stdio_H
X#if __STDC__
X# pragma once
X#endif
X
X#ifndef _iobuf_H
X# include "_iobuf.H"
X#endif
X
extern "C"
X{
extern struct _iobuf _iob[];
X
extern struct _iobuf *fopen(const char *,const char *);
extern struct _iobuf *fdopen(signed,const char *);
extern const char *fputs(const char *,struct _iobuf *);
extern const char *fgets(char *,signed,struct _iobuf *);
extern signed fread(void *,signed,signed,struct _iobuf *);
extern signed fwrite(const void *,signed,signed,struct _iobuf *);
extern signed fseek(_iobuf *,long,signed);
extern signed ungetc(char,_iobuf *);
extern signed setbuf(struct _iobuf *,char *);
extern signed setbuffer(struct _iobuf *,char *,signed);
extern signed setvbuf(struct _iobuf *,char *,_iobufFlags,signed);
X}
X
typedef _iobuf FILE;
X
X#ifndef NULL
static const signed NULL = 0;
X#endif
static const signed BUFSIZ = 1024;
X
static _iobuf *const stdin = _iob+0;
static _iobuf *const stdout = _iob+1;
static _iobuf *const stderr = _iob+2;
X
static inline signed getchar()
X{
X return ::getc(::stdin);
X}
X
static inline signed putchar
X(
X auto const char ch
X)
X{
X return ::putc(ch,::stdout);
X}
X
X#endif
END_OF_FILE
if test 1157 -ne `wc -c <'stdio.H'`; then
echo shar: \"'stdio.H'\" unpacked with wrong size!
fi
# end of 'stdio.H'
fi
if test -f 'stream.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream.h'\"
else
echo shar: Extracting \"'stream.h'\" \(563 characters\)
sed "s/^X//" >'stream.h' <<'END_OF_FILE'
X#ifndef _stream_h
X#define _stream_h
X#if __STDC__
X# pragma once
X#endif
X
X#ifndef _iobuf_H
X# include "_iobuf.H"
X#endif
X#ifndef stream_H
X# include "stream.H"
X#endif
X
X#define verbose_File_error_handler stream::verboseHandler
X#define quiet_File_error_handler stream::quietHandler
X#define fatal_File_error_handler stream::fatalHandler
X#define File_error_handler stream:handler
X#define set_File_error_handler stream:setHandler
X
X#ifndef ostream_H
X# include "ostream.H"
X#endif
X#ifndef istream_H
X# include "istream.H"
X#endif
X
X#endif /* _stream_h */
END_OF_FILE
if test 563 -ne `wc -c <'stream.h'`; then
echo shar: \"'stream.h'\" unpacked with wrong size!
fi
# end of 'stream.h'
fi
if test -f 'stream/clear.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/clear.C'\"
else
echo shar: Extracting \"'stream/clear.C'\" \(410 characters\)
sed "s/^X//" >'stream/clear.C' <<'END_OF_FILE'
X#include "stream.H"
X#include "_iobuf.H"
X
extern void stream::clear
X(
X auto const streamState flags = streamGood
X)
X{
X register _iobuf *const stdio = this->stdio;
X
X this->disabled = (flags & (streamFail|streamBad)) != 0;
X
X stdio->flags &=~ (_iobufError|_iobufEof);
X
X if (flags & streamEof)
X stdio->flags |= _iobufEof;
X
X if (flags & (streamBad|streamFail))
X stdio->flags |= _iobufError;
X}
END_OF_FILE
if test 410 -ne `wc -c <'stream/clear.C'`; then
echo shar: \"'stream/clear.C'\" unpacked with wrong size!
fi
# end of 'stream/clear.C'
fi
if test -f 'stream/close.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/close.C'\"
else
echo shar: Extracting \"'stream/close.C'\" \(412 characters\)
sed "s/^X//" >'stream/close.C' <<'END_OF_FILE'
X#include "stream.H"
X#include "_iobuf.H"
X
extern "C"
X{
extern signed fclose(struct _iobuf *);
X}
X
extern stream &stream::close()
X{
X if (this->stdio != nil(_iobuf *))
X {
X if (this->dispose)
X (void) ::fclose(this->stdio);
X else
X {
X *this->stdio->hand = '\0';
X delete this->stdio;
X }
X
X this->stdio = nil(_iobuf *);
X }
X
X this->disabled = 1;
X this->dispose = 0;
X
X return *this;
X}
END_OF_FILE
if test 412 -ne `wc -c <'stream/close.C'`; then
echo shar: \"'stream/close.C'\" unpacked with wrong size!
fi
# end of 'stream/close.C'
fi
if test -f 'stream/cons-stream.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/cons-stream.C'\"
else
echo shar: Extracting \"'stream/cons-stream.C'\" \(235 characters\)
sed "s/^X//" >'stream/cons-stream.C' <<'END_OF_FILE'
X#include "stream.H"
X
extern construct stream::stream
X(
X auto const char *const filename,
X auto const streamType type,
X auto const streamMode mode
X)
X{
X this->initialize();
X this->open(filename,type,mode);
X}
END_OF_FILE
if test 235 -ne `wc -c <'stream/cons-stream.C'`; then
echo shar: \"'stream/cons-stream.C'\" unpacked with wrong size!
fi
# end of 'stream/cons-stream.C'
fi
if test -f 'stream/cons-string.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/cons-string.C'\"
else
echo shar: Extracting \"'stream/cons-string.C'\" \(1182 characters\)
sed "s/^X//" >'stream/cons-string.C' <<'END_OF_FILE'
X#include "stream.H"
X#include "_iobuf.H"
X
X#ifdef _NFILE
extern "C"
X{
extern unsigned char *_bufendtab[];
X}
X#endif
X
extern construct stream::stream
X(
X auto const signed bytes,
X auto char *area,
X auto const streamType type
X)
X{
X if (type != streamRead && type != streamWrite)
X (*stream::handler)("invalid streamType for string IO");
X
X this->initialize();
X
X this->stdio = new _iobuf;
X this->dispose = 1;
X
X this->stdio->hand = this->stdio->buffer = (char unsigned *) area;
X
X#ifndef _NFILE
X this->stdio->fd = 255;
X#else
X this->stdio->fd = _NFILE-1;
X _bufendtab[this->stdio->fd] = (unsigned char *) (bytes+area-1);
X#endif
X
X#if (!_iobufUSG)
X this->stdio->capacity = bytes;
X#endif
X
X if (type == streamRead)
X {
X register unsigned i;
X
X for (i = 0; i < bytes && area[i] != '\0'; i++);
X
X /*
X Are we sure we want to zap the last byte?
X */
X if (i == bytes)
X area[bytes-1] = '\0';
X
X this->stdio->rest = i;
X this->stdio->flags = (_iobufReadable|_iobufString|_iobufUserBuffer);
X }
X else
X {
X this->stdio->rest = bytes-1;
X this->stdio->flags = (_iobufWritable|_iobufString|_iobufUserBuffer);
X }
X
X this->restart(nil(char *));
X}
END_OF_FILE
if test 1182 -ne `wc -c <'stream/cons-string.C'`; then
echo shar: \"'stream/cons-string.C'\" unpacked with wrong size!
fi
# end of 'stream/cons-string.C'
fi
if test -f 'stream/destruct.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/destruct.C'\"
else
echo shar: Extracting \"'stream/destruct.C'\" \(284 characters\)
sed "s/^X//" >'stream/destruct.C' <<'END_OF_FILE'
X#include "stream.H"
X#include "stdio.H"
X
extern destruct stream::~stream()
X{
X if (this->fileName != nil(char *))
X delete this->fileName;
X
X if (this->stdio == stdin || this->stdio == stdout || this->stdio == stderr)
X this->flush();
X else if (this->isopen())
X this->close();
X}
END_OF_FILE
if test 284 -ne `wc -c <'stream/destruct.C'`; then
echo shar: \"'stream/destruct.C'\" unpacked with wrong size!
fi
# end of 'stream/destruct.C'
fi
if test -f 'stream/error.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/error.C'\"
else
echo shar: Extracting \"'stream/error.C'\" \(502 characters\)
sed "s/^X//" >'stream/error.C' <<'END_OF_FILE'
X#ifndef stdio_H
X# include "stdio.H"
X#endif
X#ifndef stream_H
X# include "stream.H"
X#endif
X
extern const char *streamName(const char *,_iobuf *,signed);
X
extern "C"
X{
extern signed errno;
extern signed sprintf(char *,const char *,...);
X}
X
extern void stream::error()
X{
X auto char msg[BUFSIZ];
X
X this->disabled = 1;
X
X if (::errno != 0)
X {
X (void) ::sprintf(msg,"\nerror in stream %s\n",
X streamName(this->fileName,this->stdio,this->dispose));
X
X (*stream::handler)(msg);
X }
X}
END_OF_FILE
if test 502 -ne `wc -c <'stream/error.C'`; then
echo shar: \"'stream/error.C'\" unpacked with wrong size!
fi
# end of 'stream/error.C'
fi
if test -f 'stream/get.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/get.C'\"
else
echo shar: Extracting \"'stream/get.C'\" \(497 characters\)
sed "s/^X//" >'stream/get.C' <<'END_OF_FILE'
X#include "stream.H"
X
extern stream &stream::get
X(
X register char *s,
X auto const signed n,
X auto const char eos
X)
X{
X register unsigned chars;
X auto char ch;
X
X if (!this->readable())
X this->disabled = 1;
X else
X {
X for (chars = 0; chars < n && this->get(ch) && (*s++ = ch) != eos; chars++)
X
X if (chars < n && this->good() && ch == eos)
X this->unget(ch), --s;
X
X this->count = chars;
X this->disabled = n != 0 && chars == n;
X }
X
X return *this;
X}
END_OF_FILE
if test 497 -ne `wc -c <'stream/get.C'`; then
echo shar: \"'stream/get.C'\" unpacked with wrong size!
fi
# end of 'stream/get.C'
fi
if test -f 'stream/getline.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/getline.C'\"
else
echo shar: Extracting \"'stream/getline.C'\" \(412 characters\)
sed "s/^X//" >'stream/getline.C' <<'END_OF_FILE'
X#include "stream.H"
X
extern stream &stream::getline
X(
X register char *s,
X auto signed n,
X auto char eos
X)
X{
X register signed chars;
X char ch;
X
X if (!this->readable())
X this->disabled = 1;
X else
X {
X for (chars = 0; chars < n && this->get(ch) && (*s++ = ch) != eos; chars++);
X
X this->count = chars;
X this->disabled = n != 0 && chars == n;
X }
X
X return *this;
X}
END_OF_FILE
if test 412 -ne `wc -c <'stream/getline.C'`; then
echo shar: \"'stream/getline.C'\" unpacked with wrong size!
fi
# end of 'stream/getline.C'
fi
if test -f 'stream/open-fd.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/open-fd.C'\"
else
echo shar: Extracting \"'stream/open-fd.C'\" \(715 characters\)
sed "s/^X//" >'stream/open-fd.C' <<'END_OF_FILE'
X#include "stream.H"
X
extern "C"
X{
extern struct _iobuf *fdopen(signed,const char *);
X}
X
static const char *stream_iobufModes
X(
X auto streamType type
X)
X{
X switch (type)
X {
X case streamRead: return "r";
X case streamWrite: return "w";
X case streamUpdate: return "r+";
X case streamAppend: return "a";
X case streamExtend: return "a+";
X
X default: return nil(char *);
X }
X}
X
extern stream &stream::open
X(
X auto const signed fd,
X auto const streamType type
X)
X{
X this->close();
X
X if (fd >= 0)
X {
X this->stdio = ::fdopen(fd,stream_iobufModes(type));
X if (this->stdio != nil(_iobuf *))
X this->restart(nil(char *));
X }
X
X return *this;
X}
END_OF_FILE
if test 715 -ne `wc -c <'stream/open-fd.C'`; then
echo shar: \"'stream/open-fd.C'\" unpacked with wrong size!
fi
# end of 'stream/open-fd.C'
fi
if test -f 'stream/open-mode.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/open-mode.C'\"
else
echo shar: Extracting \"'stream/open-mode.C'\" \(351 characters\)
sed "s/^X//" >'stream/open-mode.C' <<'END_OF_FILE'
X#include "stream.H"
X
extern "C"
X{
extern struct _iobuf *fopen(const char *,const char *);
X}
X
extern stream &stream::open
X(
X auto const char *const filename,
X auto const char *const mode
X)
X{
X this->close();
X this->stdio = ::fopen(filename,mode);
X this->restart(filename);
X
X return *this;
X}
END_OF_FILE
if test 351 -ne `wc -c <'stream/open-mode.C'`; then
echo shar: \"'stream/open-mode.C'\" unpacked with wrong size!
fi
# end of 'stream/open-mode.C'
fi
if test -f 'stream/put.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/put.C'\"
else
echo shar: Extracting \"'stream/put.C'\" \(271 characters\)
sed "s/^X//" >'stream/put.C' <<'END_OF_FILE'
X#include "stream.H"
X
extern "C"
X{
extern const char *fputs(const char *,struct _iobuf *);
X}
X
extern stream &stream::put
X(
X auto const char *const s
X)
X{
X if (!this->disabled)
X this->disabled = ::fputs(s,this->stdio) == nil(char *);
X
X return *this;
X}
END_OF_FILE
if test 271 -ne `wc -c <'stream/put.C'`; then
echo shar: \"'stream/put.C'\" unpacked with wrong size!
fi
# end of 'stream/put.C'
fi
if test -f 'stream/read.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/read.C'\"
else
echo shar: Extracting \"'stream/read.C'\" \(359 characters\)
sed "s/^X//" >'stream/read.C' <<'END_OF_FILE'
X#include "stream.H"
X#include "_iobuf.H"
X
extern "C"
X{
extern signed fread(void *,signed,signed,struct _iobuf *);
X}
X
extern stream &stream::read
X(
X auto void *area,
X auto const signed bytes,
X auto const signed n
X)
X{
X if (!this->disabled)
X this->disabled = (this->count = ::fread(area,bytes,n,this->stdio)) != n;
X return *this;
X}
END_OF_FILE
if test 359 -ne `wc -c <'stream/read.C'`; then
echo shar: \"'stream/read.C'\" unpacked with wrong size!
fi
# end of 'stream/read.C'
fi
if test -f 'stream/readline.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/readline.C'\"
else
echo shar: Extracting \"'stream/readline.C'\" \(816 characters\)
sed "s/^X//" >'stream/readline.C' <<'END_OF_FILE'
X#include "stream.H"
X
X#define streamCHUNKSZ 512
X
extern char *stream::readline
X(
X auto const signed chunkno,
X auto const char eos
X)
X{
X char buf[streamCHUNKSZ];
X register char *bufptr = buf;
X register char *ptr;
X char ch;
X signed cont;
X
X while ((cont = this->get(ch)) && ch != eos)
X {
X *bufptr++ = ch;
X
X if ((bufptr - buf) >= streamCHUNKSZ)
X {
X if (ptr = this->readline(chunkno + 1,eos))
X for (; bufptr != buf; *--ptr = *--bufptr);
X
X return ptr;
X }
X }
X
X if (!cont && bufptr == buf)
X return nil(char *);
X
X signed size = (chunkno*streamCHUNKSZ + bufptr - buf) + 1;
X
X if ((ptr = new char[size]) == nil(char *))
X return nil(char *);
X
X for (*(ptr += (size - 1)) = '\0'; bufptr != buf; *--ptr = *--bufptr);
X
X return ptr;
X}
END_OF_FILE
if test 816 -ne `wc -c <'stream/readline.C'`; then
echo shar: \"'stream/readline.C'\" unpacked with wrong size!
fi
# end of 'stream/readline.C'
fi
if test -f 'stream/remove.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/remove.C'\"
else
echo shar: Extracting \"'stream/remove.C'\" \(270 characters\)
sed "s/^X//" >'stream/remove.C' <<'END_OF_FILE'
X#include "stream.H"
X
extern "C"
X{
extern signed unlink(const char *);
X}
X
extern stream &stream::remove()
X{
X this->close();
X
X if (!this->disabled)
X this->disabled = this->fileName == nil(char *)
X || ::unlink(this->fileName) < 0;
X
X return *this;
X}
END_OF_FILE
if test 270 -ne `wc -c <'stream/remove.C'`; then
echo shar: \"'stream/remove.C'\" unpacked with wrong size!
fi
# end of 'stream/remove.C'
fi
if test -f 'stream/restart.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/restart.C'\"
else
echo shar: Extracting \"'stream/restart.C'\" \(405 characters\)
sed "s/^X//" >'stream/restart.C' <<'END_OF_FILE'
X#include "stream.H"
X#include "_iobuf.H"
X
extern const char *streamName(const char *,const _iobuf *,signed);
X
extern void stream::restart
X(
X auto const char *const filename
X)
X{
X if (this->disabled = (this->stdio == nil(_iobuf *)))
X this->error();
X else
X {
X ::clearerr(this->stdio);
X
X if (filename != nil(char *))
X this->setname(streamName(filename,this->stdio,this->dispose));
X }
X}
END_OF_FILE
if test 405 -ne `wc -c <'stream/restart.C'`; then
echo shar: \"'stream/restart.C'\" unpacked with wrong size!
fi
# end of 'stream/restart.C'
fi
if test -f 'stream/seek.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/seek.C'\"
else
echo shar: Extracting \"'stream/seek.C'\" \(314 characters\)
sed "s/^X//" >'stream/seek.C' <<'END_OF_FILE'
X#include "stream.H"
X#include "_iobuf.H"
X
extern "C"
X{
extern signed fseek(_iobuf *,long,signed);
X}
X
extern stream &stream::seek
X(
X auto const long signed where,
X auto const signed origin
X)
X{
X if (!this->disabled)
X this->disabled = ::fseek(this->stdio,where,origin) < 0;
X return *this;
X}
END_OF_FILE
if test 314 -ne `wc -c <'stream/seek.C'`; then
echo shar: \"'stream/seek.C'\" unpacked with wrong size!
fi
# end of 'stream/seek.C'
fi
if test -f 'stream/setbuf-buf.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/setbuf-buf.C'\"
else
echo shar: Extracting \"'stream/setbuf-buf.C'\" \(519 characters\)
sed "s/^X//" >'stream/setbuf-buf.C' <<'END_OF_FILE'
X#include "stream.H"
X#include "_iobuf.H"
X
extern "C"
X{
extern signed setbuf(struct _iobuf *,char *);
extern signed setbuffer(struct _iobuf *,char *,signed);
extern signed setvbuf(struct _iobuf *,char *,_iobufFlags,signed);
X}
X
extern stream &stream::setbuf
X(
X auto signed bytes,
X auto char *area
X)
X{
X if (!this->disabled && !this->dispose)
X {
X# if (_iobufSETVBUF)
X ::setvbuf(this->stdio,area,_iobufBuffered,bytes);
X# else
X ::setbuf(this->stdio,area);
X# endif
X }
X
X return *this;
X
X}
END_OF_FILE
if test 519 -ne `wc -c <'stream/setbuf-buf.C'`; then
echo shar: \"'stream/setbuf-buf.C'\" unpacked with wrong size!
fi
# end of 'stream/setbuf-buf.C'
fi
if test -f 'stream/setbuf-flags.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/setbuf-flags.C'\"
else
echo shar: Extracting \"'stream/setbuf-flags.C'\" \(832 characters\)
sed "s/^X//" >'stream/setbuf-flags.C' <<'END_OF_FILE'
X#include "stream.H"
X#include "_iobuf.H"
X
extern "C"
X{
extern signed setbuf(struct _iobuf *,char *);
extern signed setbuffer(struct _iobuf *,char *,signed);
extern signed setvbuf(struct _iobuf *,char *,_iobufFlags,signed);
X}
X
extern stream &stream::setbuf
X(
X auto const _iobufFlags buffering
X)
X{
X if (!this->disabled && !this->dispose)
X switch (buffering)
X {
X case _iobufUnbuffered:
X (void) ::setbuf(this->stdio,nil(char *));
X break;
X
X# if (_iobufSETLINEBUF)
X case _iobufLineBuffer:
X (void) ::setlinebuf(this->stdio);
X break;
X# endif
X
X# if (_iobufSETVBUF)
X case _iobufLineBuffer:
X (void) ::setvbuf(this->stdio,nil(char *),_iobufLineBuffer,0);
X break;
X
X case _iobufBuffered:
X (void) ::setvbuf(this->stdio,nil(char *),_iobufBuffered,0);
X break;
X# endif
X }
X
X return *this;
X}
END_OF_FILE
if test 832 -ne `wc -c <'stream/setbuf-flags.C'`; then
echo shar: \"'stream/setbuf-flags.C'\" unpacked with wrong size!
fi
# end of 'stream/setbuf-flags.C'
fi
if test -f 'stream/setname.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/setname.C'\"
else
echo shar: Extracting \"'stream/setname.C'\" \(424 characters\)
sed "s/^X//" >'stream/setname.C' <<'END_OF_FILE'
X#include "stream.H"
X
extern "C"
X{
extern char *strcpy(char *,const char *);
extern signed strlen(const char *);
X}
X
extern void stream::setname
X(
X const char *newname
X)
X{
X if (this->fileName != nil(char *))
X delete this->fileName;
X
X if (newname == nil(char *))
X this->fileName = nil(char *);
X else
X {
X this->fileName = new char[::strlen(newname) + 1];
X (void) ::strcpy(this->fileName,newname);
X }
X}
END_OF_FILE
if test 424 -ne `wc -c <'stream/setname.C'`; then
echo shar: \"'stream/setname.C'\" unpacked with wrong size!
fi
# end of 'stream/setname.C'
fi
if test -f 'stream/streamName.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/streamName.C'\"
else
echo shar: Extracting \"'stream/streamName.C'\" \(439 characters\)
sed "s/^X//" >'stream/streamName.C' <<'END_OF_FILE'
X#include "stream.H"
X#include "_iobuf.H"
X#include "stdio.H"
X
extern const char *streamName
X(
X auto const char *const filename,
X register const _iobuf *const stdio,
X auto const signed incore
X)
X{
X return
X (filename != nil(char *)) ? filename
X : incore ? "(string)"
X : (stdio == stdin) ? "(stdin)"
X : (stdio == stdout) ? "(stdout)"
X : (stdio == stderr) ? "(stderr)"
X : "(unnamed)";
X}
END_OF_FILE
if test 439 -ne `wc -c <'stream/streamName.C'`; then
echo shar: \"'stream/streamName.C'\" unpacked with wrong size!
fi
# end of 'stream/streamName.C'
fi
if test -f 'stream/write.C' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'stream/write.C'\"
else
echo shar: Extracting \"'stream/write.C'\" \(366 characters\)
sed "s/^X//" >'stream/write.C' <<'END_OF_FILE'
X#include "stream.H"
X#include "_iobuf.H"
X
extern "C"
X{
extern signed fwrite(const void *,signed,signed,struct _iobuf *);
X}
X
extern stream &stream::write
X(
X auto void *area,
X auto const signed bytes,
X auto const signed n
X)
X{
X if (!this->disabled)
X this->disabled = (this->count=::fwrite(area,bytes,n,this->stdio)) != n;
X return *this;
X}
END_OF_FILE
if test 366 -ne `wc -c <'stream/write.C'`; then
echo shar: \"'stream/write.C'\" unpacked with wrong size!
fi
# end of 'stream/write.C'
fi
echo shar: End of archive 2 \(of 3\).
cp /dev/null ark2isdone
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