annotate src/zlib-1.2.7/contrib/blast/blast.h @ 23:619f715526df sv_v2.1

Update Vamp plugin SDK to 2.5
author Chris Cannam
date Thu, 09 May 2013 10:52:46 +0100
parents e13257ea84a4
children
rev   line source
Chris@4 1 /* blast.h -- interface for blast.c
Chris@4 2 Copyright (C) 2003 Mark Adler
Chris@4 3 version 1.1, 16 Feb 2003
Chris@4 4
Chris@4 5 This software is provided 'as-is', without any express or implied
Chris@4 6 warranty. In no event will the author be held liable for any damages
Chris@4 7 arising from the use of this software.
Chris@4 8
Chris@4 9 Permission is granted to anyone to use this software for any purpose,
Chris@4 10 including commercial applications, and to alter it and redistribute it
Chris@4 11 freely, subject to the following restrictions:
Chris@4 12
Chris@4 13 1. The origin of this software must not be misrepresented; you must not
Chris@4 14 claim that you wrote the original software. If you use this software
Chris@4 15 in a product, an acknowledgment in the product documentation would be
Chris@4 16 appreciated but is not required.
Chris@4 17 2. Altered source versions must be plainly marked as such, and must not be
Chris@4 18 misrepresented as being the original software.
Chris@4 19 3. This notice may not be removed or altered from any source distribution.
Chris@4 20
Chris@4 21 Mark Adler madler@alumni.caltech.edu
Chris@4 22 */
Chris@4 23
Chris@4 24
Chris@4 25 /*
Chris@4 26 * blast() decompresses the PKWare Data Compression Library (DCL) compressed
Chris@4 27 * format. It provides the same functionality as the explode() function in
Chris@4 28 * that library. (Note: PKWare overused the "implode" verb, and the format
Chris@4 29 * used by their library implode() function is completely different and
Chris@4 30 * incompatible with the implode compression method supported by PKZIP.)
Chris@4 31 */
Chris@4 32
Chris@4 33
Chris@4 34 typedef unsigned (*blast_in)(void *how, unsigned char **buf);
Chris@4 35 typedef int (*blast_out)(void *how, unsigned char *buf, unsigned len);
Chris@4 36 /* Definitions for input/output functions passed to blast(). See below for
Chris@4 37 * what the provided functions need to do.
Chris@4 38 */
Chris@4 39
Chris@4 40
Chris@4 41 int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow);
Chris@4 42 /* Decompress input to output using the provided infun() and outfun() calls.
Chris@4 43 * On success, the return value of blast() is zero. If there is an error in
Chris@4 44 * the source data, i.e. it is not in the proper format, then a negative value
Chris@4 45 * is returned. If there is not enough input available or there is not enough
Chris@4 46 * output space, then a positive error is returned.
Chris@4 47 *
Chris@4 48 * The input function is invoked: len = infun(how, &buf), where buf is set by
Chris@4 49 * infun() to point to the input buffer, and infun() returns the number of
Chris@4 50 * available bytes there. If infun() returns zero, then blast() returns with
Chris@4 51 * an input error. (blast() only asks for input if it needs it.) inhow is for
Chris@4 52 * use by the application to pass an input descriptor to infun(), if desired.
Chris@4 53 *
Chris@4 54 * The output function is invoked: err = outfun(how, buf, len), where the bytes
Chris@4 55 * to be written are buf[0..len-1]. If err is not zero, then blast() returns
Chris@4 56 * with an output error. outfun() is always called with len <= 4096. outhow
Chris@4 57 * is for use by the application to pass an output descriptor to outfun(), if
Chris@4 58 * desired.
Chris@4 59 *
Chris@4 60 * The return codes are:
Chris@4 61 *
Chris@4 62 * 2: ran out of input before completing decompression
Chris@4 63 * 1: output error before completing decompression
Chris@4 64 * 0: successful decompression
Chris@4 65 * -1: literal flag not zero or one
Chris@4 66 * -2: dictionary size not in 4..6
Chris@4 67 * -3: distance is too far back
Chris@4 68 *
Chris@4 69 * At the bottom of blast.c is an example program that uses blast() that can be
Chris@4 70 * compiled to produce a command-line decompression filter by defining TEST.
Chris@4 71 */