annotate src/zlib-1.2.7/contrib/blast/blast.h @ 89:8a15ff55d9af

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