.MW "long vddelta(Vddisc_t* source, Vddisc_t* target, Vddisc_t* delta);" .MW "long vdupdate(Vddisc_t* source, Vddisc_t* target, Vddisc_t* delta);" .MW "int vdsqueeze(Void_t* target, int n, Void_t* delta);" .MW "int vdexpand(Void_t* target, int n, Void_t* delta);"
Vddelta computes a transformation (encoded as the byte stream \f5delta) that maps the source byte stream \f5source to the target byte stream \f5target. If the source stream is empty (\f5source is \f5NULL or \f5source->size is non-positive), vddelta acts like a compression routine. Vddelta returns the length of the transformation byte stream.
Vdupdate applies a transformation \f5delta generated by vddelta to the source byte stream \f5source and emits the target byte stream \f5target. Vdupdate returns the length of the target byte stream.
Vdsqueeze compresses the string \f5target of length \f5n and outputs the compressed data to the string \f5delta. Vdsqueeze returns the length of the compressed data.
Vdexpand decompresses compressed data in \f5delta into the \f5target area which is of size \f5n. Vdexpand returns the length of the decompressed data.
The handling of data for a data stream is defined by a discipline structure of type \f5Vddisc_t. This type contains the following members:
.MW "long size;" .MW "Void_t* data;" .MW "int (*readf)(Void_t* buf, int n, long offset, Vddisc_t* disc);" .MW "int (*writef)Void_t* buf, int n, long offset, Vddisc_t* disc);"
\f5size defines the length of the respective data stream.
\f5data, if not \f5NULL, is an array that either contains the entire data for a read stream or is large enough to store the entire generated data. For example, in the vddelta call, \f5target->size defines the length of the target stream. In this case, if \f5target->data is not \f5NULL, it is assumed to contain all of the target data (therefore, \f5target->readf is not required.)
.MW readf points to a function that reads at most \f5n bytes into \f5buf from position \f5offset in the byte stream specified by the as described above, and returns the number of bytes actually read, or -1 on error. The argument \f5disc is the containing discipline structure.
.MW writef is identical to \f5readf except that it writes rather than reads bytes.
\f5Void_t is \f5#defined as \f5void if possible, otherwise \f5char.
David G. Korn, dgk@research.att.com, AT&T Bell Laboratories