Blame src/lib/libast/man/sfdisc.3

Packit Service a8c26c
.fp 5 CW
Packit Service a8c26c
.TH SFDISC 3 "16 June 1993"
Packit Service a8c26c
.SH NAME
Packit Service a8c26c
\fBsfdisc\fR \- \fBsfio\fP disciplines
Packit Service a8c26c
.SH SYNOPSIS
Packit Service a8c26c
.de Tp
Packit Service a8c26c
.fl
Packit Service a8c26c
.ne 2
Packit Service a8c26c
.TP
Packit Service a8c26c
..
Packit Service a8c26c
.de Ss
Packit Service a8c26c
.fl
Packit Service a8c26c
.ne 2
Packit Service a8c26c
.SS "\\$1"
Packit Service a8c26c
..
Packit Service a8c26c
.ta 1.0i 2.0i 3.0i 4.0i 5.0i
Packit Service a8c26c
.nf
Packit Service a8c26c
.ft 5
Packit Service a8c26c
#include	<sfdisc.h>
Packit Service a8c26c
Packit Service a8c26c
extern Sfdisc_t*	dcnewskable(Sfio_t* f);
Packit Service a8c26c
extern int		dcdelskable(Sfdisc_t* disc);
Packit Service a8c26c
Packit Service a8c26c
extern Sfdisc_t*	dcnewtee(Sfio_t* tee);
Packit Service a8c26c
extern int		dcdeltee(Sfdisc_t* disc);
Packit Service a8c26c
Packit Service a8c26c
extern Sfdisc_t*	dcnewfilter(char* cmd);
Packit Service a8c26c
extern int		dcdelfilter(Sfdisc_t* disc);
Packit Service a8c26c
Packit Service a8c26c
extern Sfdisc_t*	dcnewsubstream(Sfio_t* f, long offset, long extent);
Packit Service a8c26c
extern int		dcdelsubstream(Sfdisc_t* disc);
Packit Service a8c26c
Packit Service a8c26c
extern Sfdisc_t*	dcnewlzw(void);
Packit Service a8c26c
extern int		dcdellzw(Sfdisc_t* disc);
Packit Service a8c26c
Packit Service a8c26c
extern Sfdisc_t*	dcnewunion(Sfio_t** flist, int n);
Packit Service a8c26c
extern int		dcdelunion(Sfdisc_t* disc);
Packit Service a8c26c
.ft 1
Packit Service a8c26c
.fi
Packit Service a8c26c
.SH DESCRIPTION
Packit Service a8c26c
.PP
Packit Service a8c26c
I/O disciplines are used to extend the data processing power of
Packit Service a8c26c
\fIsfio\fP streams. The convention for using the disciplines
Packit Service a8c26c
in this package is to use the call \f5dcnewXXX()\fP to create
Packit Service a8c26c
a discipline of the type \f5XXX\fP and to use \f5dcdelXXX()\fP
Packit Service a8c26c
to destroy it.
Packit Service a8c26c
A discipline is enable by inserting it into the desired
Packit Service a8c26c
stream using the \f5sfdisc()\fP call. A discipline can be used on only
Packit Service a8c26c
one stream. It is unsafe to share a discipline on two or more streams
Packit Service a8c26c
since the discipline may maintain states between successive IO calls.
Packit Service a8c26c
For multiple uses, \f5dcnewXXX()\fP should be used
Packit Service a8c26c
to create a distinct discipline for each stream.
Packit Service a8c26c
Each discipline structure is equipped with an exception handler
Packit Service a8c26c
that causes self-destruction when the associated stream is closed.
Packit Service a8c26c
.PP
Packit Service a8c26c
.Ss "  Sfdisc_t* dcnewskable(Sfio_t* f);"
Packit Service a8c26c
.Ss "  int dcdelskable(Sfdisc_t* disc);"
Packit Service a8c26c
\f5dcnewskable()\fP creates a discipline that when inserted
Packit Service a8c26c
on the stream \f5f\fP will ensure that \f5f\fP is seekable.
Packit Service a8c26c
If \f5f\fP is originally unseekable, data will be shadowed
Packit Service a8c26c
in a temporary file stream to allow seekability.
Packit Service a8c26c
\f5dcnewskable()\fP returns the discipline on success and \f5NULL\fP on failure.
Packit Service a8c26c
Packit Service a8c26c
.Ss "  Sfdisc_t* dcnewtee(Sfio_t* tee);"
Packit Service a8c26c
.Ss "  int dcdeltee(Sfdisc_t* disc);"
Packit Service a8c26c
\f5dcnewtee()\fP creates a discipline that
Packit Service a8c26c
when inserted into a stream \f5f\fP will duplicate to the stream \f5tee\fP
Packit Service a8c26c
any data written to \f5f\fP.
Packit Service a8c26c
\f5dcnewtee()\fP returns the discipline on success and \f5NULL\fP on failure.
Packit Service a8c26c
Packit Service a8c26c
.Ss "  Sfdisc_t* dcnewfilter(char* cmd);"
Packit Service a8c26c
.Ss "  int dcdelfilter(Sfdisc_t* disc);"
Packit Service a8c26c
\f5dcnewfilter()\fP creates a discipline that
Packit Service a8c26c
when inserted into a stream \f5f\fP will run the command \f5cmd\fP
Packit Service a8c26c
to process any input data before making it available to the application.
Packit Service a8c26c
For example, \f5dcnewfilter("uncompress")\fP is an equivalent but slower
Packit Service a8c26c
alternative to the lzw discipline below.
Packit Service a8c26c
\f5dcnewfilter()\fP returns the discipline on success and \f5NULL\fP on failure.
Packit Service a8c26c
Packit Service a8c26c
.Ss "  Sfdisc_t* dcnewsubstream(Sfio_t* base, long offset, long extent);"
Packit Service a8c26c
.Ss "  int dcdelsubstream(Sfdisc_t* disc);"
Packit Service a8c26c
\f5dcnewsubstream()\fP creates a discipline that
Packit Service a8c26c
reserves a portion of the stream \f5base\fP starting at \f5offset\fP
Packit Service a8c26c
with length \f5extent\fP and makes this portion appear as if it is
Packit Service a8c26c
a stream. When this discipline is inserted into a stream, it will make
Packit Service a8c26c
cause all IO operations on this stream to take place in the reserved
Packit Service a8c26c
portion of the \f5base\fP stream.
Packit Service a8c26c
\f5dcnewsubstream()\fP returns the discipline on success and \f5NULL\fP on failure.
Packit Service a8c26c
Packit Service a8c26c
.Ss "  Sfdisc_t* dcnewlzw(void);
Packit Service a8c26c
.Ss "  int dcdellzw(Sfdisc_t* disc);"
Packit Service a8c26c
\f5dcnewlzw()\fP creates a discipline that when inserted into
Packit Service a8c26c
a stream \f5f\fP will run the \fBuncompress\fP algorithm
Packit Service a8c26c
on input data from \f5f\fP before making it available to the
Packit Service a8c26c
application. This is useful to allow applications to process
Packit Service a8c26c
data from a file packed with the UNIX \fBcompress\fP utility
Packit Service a8c26c
as if the data is in plain text.
Packit Service a8c26c
\f5dcnewlzw()\fP returns the discipline on success and \f5NULL\fP on failure.
Packit Service a8c26c
Packit Service a8c26c
.Ss "  Sfdisc_t* dcnewunion(Sfio_t** list, int n);
Packit Service a8c26c
.Ss "  int dcdelunion(Sfdisc_t* disc);"
Packit Service a8c26c
\f5dcnewunion()\fP creates a discipline that concatenates
Packit Service a8c26c
input data from all \f5n\fP streams in \f5list\fP.
Packit Service a8c26c
When inserted into a stream \f5f\fP, this discipline will cause
Packit Service a8c26c
all input operations on \f5f\fP to come from the merged data stream.
Packit Service a8c26c
\f5dcnewunion()\fP returns the discipline on success and \f5NULL\fP on failure.
Packit Service a8c26c
Packit Service a8c26c
.SH ACKNOWLEDGMENTS
Packit Service a8c26c
Dave Korn contributed the substream discipline.
Packit Service a8c26c
Jim Arnold contributed the lzw discipline.
Packit Service a8c26c
Packit Service a8c26c
.SH NOTES
Packit Service a8c26c
Since we are not sure of the legal responsibilities concerning the lzw patent,
Packit Service a8c26c
the lzw discipline is not currently distributed with any release of sfio
Packit Service a8c26c
outside of AT&T.
Packit Service a8c26c
Packit Service a8c26c
.SH AUTHOR
Packit Service a8c26c
Kiem-Phong Vo, kpv@research.att.com.