include/util/compress/bzip2/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-2002 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 1.0 of 21 March 2000
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 #define BZ_CONFIG_ERROR      (-9)
00087 
00088 typedef 
00089    struct {
00090       char *next_in;
00091       unsigned int avail_in;
00092       unsigned int total_in_lo32;
00093       unsigned int total_in_hi32;
00094 
00095       char *next_out;
00096       unsigned int avail_out;
00097       unsigned int total_out_lo32;
00098       unsigned int total_out_hi32;
00099 
00100       void *state;
00101 
00102       void *(*bzalloc)(void *,int,int);
00103       void (*bzfree)(void *,void *);
00104       void *opaque;
00105    } 
00106    bz_stream;
00107 
00108 
00109 #ifndef BZ_IMPORT
00110 #define BZ_EXPORT
00111 #endif
00112 
00113 /* Need a definitition for FILE */
00114 #include <stdio.h>
00115 
00116 #ifdef _WIN32
00117 #   include <windows.h>
00118 #   ifdef small
00119       /* windows.h define small to char */
00120 #      undef small
00121 #   endif
00122 #   ifdef BZ_EXPORT
00123 #   define BZ_API(func) WINAPI func
00124 #   define BZ_EXTERN extern
00125 #   else
00126    /* import windows dll dynamically */
00127 #   define BZ_API(func) (WINAPI * func)
00128 #   define BZ_EXTERN
00129 #   endif
00130 #else
00131 #   define BZ_API(func) func
00132 #   define BZ_EXTERN extern
00133 #endif
00134 
00135 
00136 /*-- Core (low-level) library functions --*/
00137 
00138 BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( 
00139       bz_stream* strm, 
00140       int        blockSize100k, 
00141       int        verbosity, 
00142       int        workFactor 
00143    );
00144 
00145 BZ_EXTERN int BZ_API(BZ2_bzCompress) ( 
00146       bz_stream* strm, 
00147       int action 
00148    );
00149 
00150 BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( 
00151       bz_stream* strm 
00152    );
00153 
00154 BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( 
00155       bz_stream *strm, 
00156       int       verbosity, 
00157       int       small
00158    );
00159 
00160 BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( 
00161       bz_stream* strm 
00162    );
00163 
00164 BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( 
00165       bz_stream *strm 
00166    );
00167 
00168 
00169 
00170 /*-- High(er) level library functions --*/
00171 
00172 #ifndef BZ_NO_STDIO
00173 #define BZ_MAX_UNUSED 5000
00174 
00175 typedef void BZFILE;
00176 
00177 BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( 
00178       int*  bzerror,   
00179       FILE* f, 
00180       int   verbosity, 
00181       int   small,
00182       void* unused,    
00183       int   nUnused 
00184    );
00185 
00186 BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( 
00187       int*    bzerror, 
00188       BZFILE* b 
00189    );
00190 
00191 BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( 
00192       int*    bzerror, 
00193       BZFILE* b, 
00194       void**  unused,  
00195       int*    nUnused 
00196    );
00197 
00198 BZ_EXTERN int BZ_API(BZ2_bzRead) ( 
00199       int*    bzerror, 
00200       BZFILE* b, 
00201       void*   buf, 
00202       int     len 
00203    );
00204 
00205 BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( 
00206       int*  bzerror,      
00207       FILE* f, 
00208       int   blockSize100k, 
00209       int   verbosity, 
00210       int   workFactor 
00211    );
00212 
00213 BZ_EXTERN void BZ_API(BZ2_bzWrite) ( 
00214       int*    bzerror, 
00215       BZFILE* b, 
00216       void*   buf, 
00217       int     len 
00218    );
00219 
00220 BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( 
00221       int*          bzerror, 
00222       BZFILE*       b, 
00223       int           abandon, 
00224       unsigned int* nbytes_in, 
00225       unsigned int* nbytes_out 
00226    );
00227 
00228 BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( 
00229       int*          bzerror, 
00230       BZFILE*       b, 
00231       int           abandon, 
00232       unsigned int* nbytes_in_lo32, 
00233       unsigned int* nbytes_in_hi32, 
00234       unsigned int* nbytes_out_lo32, 
00235       unsigned int* nbytes_out_hi32
00236    );
00237 #endif
00238 
00239 
00240 /*-- Utility functions --*/
00241 
00242 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( 
00243       char*         dest, 
00244       unsigned int* destLen,
00245       char*         source, 
00246       unsigned int  sourceLen,
00247       int           blockSize100k, 
00248       int           verbosity, 
00249       int           workFactor 
00250    );
00251 
00252 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( 
00253       char*         dest, 
00254       unsigned int* destLen,
00255       char*         source, 
00256       unsigned int  sourceLen,
00257       int           small, 
00258       int           verbosity 
00259    );
00260 
00261 
00262 /*--
00263    Code contributed by Yoshioka Tsuneo
00264    (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp),
00265    to support better zlib compatibility.
00266    This code is not _officially_ part of libbzip2 (yet);
00267    I haven't tested it, documented it, or considered the
00268    threading-safeness of it.
00269    If this code breaks, please contact both Yoshioka and me.
00270 --*/
00271 
00272 BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
00273       void
00274    );
00275 
00276 #ifndef BZ_NO_STDIO
00277 BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
00278       const char *path,
00279       const char *mode
00280    );
00281 
00282 BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
00283       int        fd,
00284       const char *mode
00285    );
00286          
00287 BZ_EXTERN int BZ_API(BZ2_bzread) (
00288       BZFILE* b, 
00289       void* buf, 
00290       int len 
00291    );
00292 
00293 BZ_EXTERN int BZ_API(BZ2_bzwrite) (
00294       BZFILE* b, 
00295       void*   buf, 
00296       int     len 
00297    );
00298 
00299 BZ_EXTERN int BZ_API(BZ2_bzflush) (
00300       BZFILE* b
00301    );
00302 
00303 BZ_EXTERN void BZ_API(BZ2_bzclose) (
00304       BZFILE* b
00305    );
00306 
00307 BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
00308       BZFILE *b, 
00309       int    *errnum
00310    );
00311 #endif
00312 
00313 #ifdef __cplusplus
00314 }
00315 #endif
00316 
00317 #endif
00318 
00319 /*-------------------------------------------------------------*/
00320 /*--- end                                           bzlib.h ---*/
00321 /*-------------------------------------------------------------*/
00322 
00323 

Generated on Wed Apr 29 21:35:31 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Wed Apr 29 23:25:27 2009 by modify_doxy.py rev. 117643