Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/*
2
 * THIS FILE IS NOT IDENTICAL TO THE ORIGINAL
3
 * FROM THE BZIP2 DISTRIBUTION.
4
 *
5
 * It has been modified, mainly to break the library
6
 * into smaller pieces.
7
 *
8
 * Russ Cox
9
 * rsc@plan9.bell-labs.com
10
 * July 2000
11
 */
12
 
13
 
14
/*-------------------------------------------------------------*/
15
/*--- Public header file for the library.                   ---*/
16
/*---                                               bzlib.h ---*/
17
/*-------------------------------------------------------------*/
18
 
19
/*--
20
  This file is a part of bzip2 and/or libbzip2, a program and
21
  library for lossless, block-sorting data compression.
22
 
23
  Copyright (C) 1996-2000 Julian R Seward.  All rights reserved.
24
 
25
  Redistribution and use in source and binary forms, with or without
26
  modification, are permitted provided that the following conditions
27
  are met:
28
 
29
  1. Redistributions of source code must retain the above copyright
30
     notice, this list of conditions and the following disclaimer.
31
 
32
  2. The origin of this software must not be misrepresented; you must 
33
     not claim that you wrote the original software.  If you use this 
34
     software in a product, an acknowledgment in the product 
35
     documentation would be appreciated but is not required.
36
 
37
  3. Altered source versions must be plainly marked as such, and must
38
     not be misrepresented as being the original software.
39
 
40
  4. The name of the author may not be used to endorse or promote 
41
     products derived from this software without specific prior written 
42
     permission.
43
 
44
  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
45
  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
46
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
47
  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
48
  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
49
  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
50
  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
51
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
52
  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
53
  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
54
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55
 
56
  Julian Seward, Cambridge, UK.
57
  jseward@acm.org
58
  bzip2/libbzip2 version 1.0 of 21 March 2000
59
 
60
  This program is based on (at least) the work of:
61
     Mike Burrows
62
     David Wheeler
63
     Peter Fenwick
64
     Alistair Moffat
65
     Radford Neal
66
     Ian H. Witten
67
     Robert Sedgewick
68
     Jon L. Bentley
69
 
70
  For more information on these sources, see the manual.
71
--*/
72
 
73
#ifndef _BZLIB_H
74
#define _BZLIB_H
75
 
76
#ifdef __cplusplus
77
extern "C" {
78
#endif
79
 
80
#define BZ_RUN               0
81
#define BZ_FLUSH             1
82
#define BZ_FINISH            2
83
 
84
#define BZ_OK                0
85
#define BZ_RUN_OK            1
86
#define BZ_FLUSH_OK          2
87
#define BZ_FINISH_OK         3
88
#define BZ_STREAM_END        4
89
#define BZ_SEQUENCE_ERROR    (-1)
90
#define BZ_PARAM_ERROR       (-2)
91
#define BZ_MEM_ERROR         (-3)
92
#define BZ_DATA_ERROR        (-4)
93
#define BZ_DATA_ERROR_MAGIC  (-5)
94
#define BZ_IO_ERROR          (-6)
95
#define BZ_UNEXPECTED_EOF    (-7)
96
#define BZ_OUTBUFF_FULL      (-8)
97
#define BZ_CONFIG_ERROR      (-9)
98
 
99
typedef 
100
   struct {
101
      char *next_in;
102
      unsigned int avail_in;
103
      unsigned int total_in_lo32;
104
      unsigned int total_in_hi32;
105
 
106
      char *next_out;
107
      unsigned int avail_out;
108
      unsigned int total_out_lo32;
109
      unsigned int total_out_hi32;
110
 
111
      void *state;
112
 
113
      void *(*bzalloc)(void *,int,int);
114
      void (*bzfree)(void *,void *);
115
      void *opaque;
116
   } 
117
   bz_stream;
118
 
119
 
120
#ifndef BZ_IMPORT
121
#define BZ_EXPORT
122
#endif
123
 
124
#ifdef _WIN32
125
#   include <stdio.h>
126
#   include <windows.h>
127
#   ifdef small
128
      /* windows.h define small to char */
129
#      undef small
130
#   endif
131
#   ifdef BZ_EXPORT
132
#   define BZ_API(func) WINAPI func
133
#   define BZ_EXTERN extern
134
#   else
135
   /* import windows dll dynamically */
136
#   define BZ_API(func) (WINAPI * func)
137
#   define BZ_EXTERN
138
#   endif
139
#else
140
#   define BZ_API(func) func
141
#   define BZ_EXTERN extern
142
#endif
143
 
144
 
145
/*-- Core (low-level) library functions --*/
146
 
147
BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( 
148
      bz_stream* strm, 
149
      int        blockSize100k, 
150
      int        verbosity, 
151
      int        workFactor 
152
   );
153
 
154
BZ_EXTERN int BZ_API(BZ2_bzCompress) ( 
155
      bz_stream* strm, 
156
      int action 
157
   );
158
 
159
BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( 
160
      bz_stream* strm 
161
   );
162
 
163
BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( 
164
      bz_stream *strm, 
165
      int       verbosity, 
166
      int       small
167
   );
168
 
169
BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( 
170
      bz_stream* strm 
171
   );
172
 
173
BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( 
174
      bz_stream *strm 
175
   );
176
 
177
 
178
 
179
/*-- Utility functions --*/
180
 
181
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( 
182
      char*         dest, 
183
      unsigned int* destLen,
184
      char*         source, 
185
      unsigned int  sourceLen,
186
      int           blockSize100k, 
187
      int           verbosity, 
188
      int           workFactor 
189
   );
190
 
191
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( 
192
      char*         dest, 
193
      unsigned int* destLen,
194
      char*         source, 
195
      unsigned int  sourceLen,
196
      int           small, 
197
      int           verbosity 
198
   );
199
 
200
 
201
/*--
202
   Code contributed by Yoshioka Tsuneo
203
   (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp),
204
   to support better zlib compatibility.
205
   This code is not _officially_ part of libbzip2 (yet);
206
   I haven't tested it, documented it, or considered the
207
   threading-safeness of it.
208
   If this code breaks, please contact both Yoshioka and me.
209
--*/
210
 
211
BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
212
      void
213
   );
214
 
215
#ifdef __cplusplus
216
}
217
#endif
218
 
219
#endif
220
 
221
/*-------------------------------------------------------------*/
222
/*--- end                                           bzlib.h ---*/
223
/*-------------------------------------------------------------*/