Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

bzlib.h

Go to the documentation of this file.
00001 
00002 /*-------------------------------------------------------------*/
00003 /*--- Public header file for the library.                   ---*/
00004 /*---                                               bzlib.h ---*/
00005 /*-------------------------------------------------------------*/
00006 
00007 /*--
00008   This file is a part of bzip2 and/or libbzip2, a program and
00009   library for lossless, block-sorting data compression.
00010 
00011   Copyright (C) 1996-1999 Julian R Seward.  All rights reserved.
00012 
00013   Redistribution and use in source and binary forms, with or without
00014   modification, are permitted provided that the following conditions
00015   are met:
00016 
00017   1. Redistributions of source code must retain the above copyright
00018      notice, this list of conditions and the following disclaimer.
00019 
00020   2. The origin of this software must not be misrepresented; you must 
00021      not claim that you wrote the original software.  If you use this 
00022      software in a product, an acknowledgment in the product 
00023      documentation would be appreciated but is not required.
00024 
00025   3. Altered source versions must be plainly marked as such, and must
00026      not be misrepresented as being the original software.
00027 
00028   4. The name of the author may not be used to endorse or promote 
00029      products derived from this software without specific prior written 
00030      permission.
00031 
00032   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
00033   OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00034   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00035   ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
00036   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00037   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00038   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00039   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00040   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00041   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00042   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00043 
00044   Julian Seward, Cambridge, UK.
00045   jseward@acm.org
00046   bzip2/libbzip2 version 0.9.5 of 24 May 1999
00047 
00048   This program is based on (at least) the work of:
00049      Mike Burrows
00050      David Wheeler
00051      Peter Fenwick
00052      Alistair Moffat
00053      Radford Neal
00054      Ian H. Witten
00055      Robert Sedgewick
00056      Jon L. Bentley
00057 
00058   For more information on these sources, see the manual.
00059 --*/
00060 
00061 
00062 #ifndef _BZLIB_H
00063 #define _BZLIB_H
00064 
00065 #ifdef __cplusplus
00066 extern "C" {
00067 #endif
00068 
00069 #define BZ_RUN               0
00070 #define BZ_FLUSH             1
00071 #define BZ_FINISH            2
00072 
00073 #define BZ_OK                0
00074 #define BZ_RUN_OK            1
00075 #define BZ_FLUSH_OK          2
00076 #define BZ_FINISH_OK         3
00077 #define BZ_STREAM_END        4
00078 #define BZ_SEQUENCE_ERROR    (-1)
00079 #define BZ_PARAM_ERROR       (-2)
00080 #define BZ_MEM_ERROR         (-3)
00081 #define BZ_DATA_ERROR        (-4)
00082 #define BZ_DATA_ERROR_MAGIC  (-5)
00083 #define BZ_IO_ERROR          (-6)
00084 #define BZ_UNEXPECTED_EOF    (-7)
00085 #define BZ_OUTBUFF_FULL      (-8)
00086 
00087 typedef 
00088    struct {
00089       char *next_in;
00090       unsigned int avail_in;
00091       unsigned int total_in;
00092 
00093       char *next_out;
00094       unsigned int avail_out;
00095       unsigned int total_out;
00096 
00097       void *state;
00098 
00099       void *(*bzalloc)(void *,int,int);
00100       void (*bzfree)(void *,void *);
00101       void *opaque;
00102    } 
00103    bz_stream;
00104 
00105 
00106 #ifndef BZ_IMPORT
00107 #define BZ_EXPORT
00108 #endif
00109 
00110 #ifdef _WIN32
00111 #   include <stdio.h>
00112 #   include <windows.h>
00113 #   ifdef small
00114       /* windows.h define small to char */
00115 #      undef small
00116 #   endif
00117 #   ifdef BZ_EXPORT
00118 #   define BZ_API(func) WINAPI func
00119 #   define BZ_EXTERN extern
00120 #   else
00121    /* import windows dll dynamically */
00122 #   define BZ_API(func) (WINAPI * func)
00123 #   define BZ_EXTERN
00124 #   endif
00125 #else
00126 #   define BZ_API(func) func
00127 #   define BZ_EXTERN extern
00128 #endif
00129 
00130 
00131 /*-- Core (low-level) library functions --*/
00132 
00133 BZ_EXTERN int BZ_API(bzCompressInit) (
00134 //int bzCompressInit(
00135       bz_stream* strm, 
00136       int        blockSize100k, 
00137       int        verbosity, 
00138       int        workFactor 
00139    );
00140 
00141 BZ_EXTERN int BZ_API(bzCompress) ( 
00142       bz_stream* strm, 
00143       int action 
00144    );
00145 
00146 BZ_EXTERN int BZ_API(bzCompressEnd) ( 
00147       bz_stream* strm 
00148    );
00149 
00150 BZ_EXTERN int BZ_API(bzDecompressInit) ( 
00151       bz_stream *strm, 
00152       int       verbosity, 
00153       int       small
00154    );
00155 
00156 BZ_EXTERN int BZ_API(bzDecompress) ( 
00157       bz_stream* strm 
00158    );
00159 
00160 BZ_EXTERN int BZ_API(bzDecompressEnd) ( 
00161       bz_stream *strm 
00162    );
00163 
00164 
00165 
00166 /*-- High(er) level library functions --*/
00167 
00168 #ifndef BZ_NO_STDIO
00169 #define BZ_MAX_UNUSED 5000
00170 
00171 typedef void BZFILE;
00172 
00173 BZ_EXTERN BZFILE* BZ_API(bzReadOpen) ( 
00174       int*  bzerror,   
00175       FILE* f, 
00176       int   verbosity, 
00177       int   small,
00178       void* unused,    
00179       int   nUnused 
00180    );
00181 
00182 BZ_EXTERN void BZ_API(bzReadClose) ( 
00183       int*    bzerror, 
00184       BZFILE* b 
00185    );
00186 
00187 BZ_EXTERN void BZ_API(bzReadGetUnused) ( 
00188       int*    bzerror, 
00189       BZFILE* b, 
00190       void**  unused,  
00191       int*    nUnused 
00192    );
00193 
00194 BZ_EXTERN int BZ_API(bzRead) ( 
00195       int*    bzerror, 
00196       BZFILE* b, 
00197       void*   buf, 
00198       int     len 
00199    );
00200 
00201 BZ_EXTERN BZFILE* BZ_API(bzWriteOpen) ( 
00202       int*  bzerror,      
00203       FILE* f, 
00204       int   blockSize100k, 
00205       int   verbosity, 
00206       int   workFactor 
00207    );
00208 
00209 BZ_EXTERN void BZ_API(bzWrite) ( 
00210       int*    bzerror, 
00211       BZFILE* b, 
00212       void*   buf, 
00213       int     len 
00214    );
00215 
00216 BZ_EXTERN void BZ_API(bzWriteClose) ( 
00217       int*          bzerror, 
00218       BZFILE*       b, 
00219       int           abandon, 
00220       unsigned int* nbytes_in, 
00221       unsigned int* nbytes_out 
00222    );
00223 #endif
00224 
00225 
00226 /*-- Utility functions --*/
00227 
00228 BZ_EXTERN int BZ_API(bzBuffToBuffCompress) ( 
00229       char*         dest, 
00230       unsigned int* destLen,
00231       char*         source, 
00232       unsigned int  sourceLen,
00233       int           blockSize100k, 
00234       int           verbosity, 
00235       int           workFactor 
00236    );
00237 
00238 BZ_EXTERN int BZ_API(bzBuffToBuffDecompress) ( 
00239       char*         dest, 
00240       unsigned int* destLen,
00241       char*         source, 
00242       unsigned int  sourceLen,
00243       int           small, 
00244       int           verbosity 
00245    );
00246 
00247 
00248 /*--
00249    Code contributed by Yoshioka Tsuneo
00250    (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp),
00251    to support better zlib compatibility.
00252    This code is not _officially_ part of libbzip2 (yet);
00253    I haven't tested it, documented it, or considered the
00254    threading-safeness of it.
00255    If this code breaks, please contact both Yoshioka and me.
00256 --*/
00257 
00258 BZ_EXTERN const char * BZ_API(bzlibVersion) (
00259       void
00260    );
00261 
00262 #ifndef BZ_NO_STDIO
00263 BZ_EXTERN BZFILE * BZ_API(bzopen) (
00264       const char *path,
00265       const char *mode
00266    );
00267 
00268 BZ_EXTERN BZFILE * BZ_API(bzdopen) (
00269       int        fd,
00270       const char *mode
00271    );
00272          
00273 BZ_EXTERN int BZ_API(bzread) (
00274       BZFILE* b, 
00275       void* buf, 
00276       int len 
00277    );
00278 
00279 BZ_EXTERN int BZ_API(bzwrite) (
00280       BZFILE* b, 
00281       void*   buf, 
00282       int     len 
00283    );
00284 
00285 BZ_EXTERN int BZ_API(bzflush) (
00286       BZFILE* b
00287    );
00288 
00289 BZ_EXTERN void BZ_API(bzclose) (
00290       BZFILE* b
00291    );
00292 
00293 BZ_EXTERN const char * BZ_API(bzerror) (
00294       BZFILE *b, 
00295       int    *errnum
00296    );
00297 #endif
00298 
00299 #ifdef __cplusplus
00300 }
00301 #endif
00302 
00303 #endif
00304 
00305 /*-------------------------------------------------------------*/
00306 /*--- end                                           bzlib.h ---*/
00307 /*-------------------------------------------------------------*/

Generated on Sat Oct 13 16:08:34 2001 for XMILL by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001