abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
bzlib.h
Go to the documentation of this file.
1 
2 /*-------------------------------------------------------------*/
3 /*--- Public header file for the library. ---*/
4 /*--- bzlib.h ---*/
5 /*-------------------------------------------------------------*/
6 
7 /* ------------------------------------------------------------------
8  This file is part of bzip2/libbzip2, a program and library for
9  lossless, block-sorting data compression.
10 
11  bzip2/libbzip2 version 1.0.5 of 10 December 2007
12  Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
13 
14  Please read the WARNING, DISCLAIMER and PATENTS sections in the
15  README file.
16 
17  This program is released under the terms of the license contained
18  in the file LICENSE.
19  ------------------------------------------------------------------ */
20 
21 #ifdef _WIN32
22 #ifdef __STDC__
23 #undef __STDC__
24 #endif
25 #endif
26 
27 #ifndef ABC__misc__bzlib__bzlib_h
28 #define ABC__misc__bzlib__bzlib_h
29 
30 #define BZ_RUN 0
31 #define BZ_FLUSH 1
32 #define BZ_FINISH 2
33 
34 #define BZ_OK 0
35 #define BZ_RUN_OK 1
36 #define BZ_FLUSH_OK 2
37 #define BZ_FINISH_OK 3
38 #define BZ_STREAM_END 4
39 #define BZ_SEQUENCE_ERROR (-1)
40 #define BZ_PARAM_ERROR (-2)
41 #define BZ_MEM_ERROR (-3)
42 #define BZ_DATA_ERROR (-4)
43 #define BZ_DATA_ERROR_MAGIC (-5)
44 #define BZ_IO_ERROR (-6)
45 #define BZ_UNEXPECTED_EOF (-7)
46 #define BZ_OUTBUFF_FULL (-8)
47 #define BZ_CONFIG_ERROR (-9)
48 
49 typedef
50  struct {
51  char *next_in;
52  unsigned int avail_in;
53  unsigned int total_in_lo32;
54  unsigned int total_in_hi32;
55 
56  char *next_out;
57  unsigned int avail_out;
58  unsigned int total_out_lo32;
59  unsigned int total_out_hi32;
60 
61  void *state;
62 
63  void *(*bzalloc)(void *,int,int);
64  void (*bzfree)(void *,void *);
65  void *opaque;
66  }
67  bz_stream;
68 
69 
70 #ifndef BZ_IMPORT
71 #define BZ_EXPORT
72 #endif
73 
74 #ifndef BZ_NO_STDIO
75 /* Need a definitition for FILE */
76 #include <stdio.h>
77 #endif
78 
79 #ifdef _WIN32
80 # include <windows.h>
81 # ifdef small
82  /* windows.h define small to char */
83 # undef small
84 # endif
85 # ifdef BZ_EXPORT
86 # define BZ_API(func) WINAPI func
87 # define BZ_EXTERN extern
88 # else
89  /* import windows dll dynamically */
90 # define BZ_API(func) (WINAPI * func)
91 # define BZ_EXTERN
92 # endif
93 #else
94 # define BZ_API(func) func
95 # define BZ_EXTERN extern
96 #endif
97 
98 #include <stdio.h>
99 #include "misc/util/abc_global.h"
100 
102 
103 /*-- Core (low-level) library functions --*/
104 
106  bz_stream* strm,
107  int blockSize100k,
108  int verbosity,
109  int workFactor
110  );
111 
113  bz_stream* strm,
114  int action
115  );
116 
118  bz_stream* strm
119  );
120 
122  bz_stream *strm,
123  int verbosity,
124  int small
125  );
126 
128  bz_stream* strm
129  );
130 
132  bz_stream *strm
133  );
134 
135 
136 
137 /*-- High(er) level library functions --*/
138 
139 #ifndef BZ_NO_STDIO
140 #define BZ_MAX_UNUSED 5000
141 
142 typedef void BZFILE;
143 
145  int* bzerror,
146  FILE* f,
147  int verbosity,
148  int small,
149  void* unused,
150  int nUnused
151  );
152 
154  int* bzerror,
155  BZFILE* b
156  );
157 
159  int* bzerror,
160  BZFILE* b,
161  void** unused,
162  int* nUnused
163  );
164 
166  int* bzerror,
167  BZFILE* b,
168  void* buf,
169  int len
170  );
171 
173  int* bzerror,
174  FILE* f,
175  int blockSize100k,
176  int verbosity,
177  int workFactor
178  );
179 
181  int* bzerror,
182  BZFILE* b,
183  void* buf,
184  int len
185  );
186 
188  int* bzerror,
189  BZFILE* b,
190  int abandon,
191  unsigned int* nbytes_in,
192  unsigned int* nbytes_out
193  );
194 
196  int* bzerror,
197  BZFILE* b,
198  int abandon,
199  unsigned int* nbytes_in_lo32,
200  unsigned int* nbytes_in_hi32,
201  unsigned int* nbytes_out_lo32,
202  unsigned int* nbytes_out_hi32
203  );
204 #endif
205 
206 
207 /*-- Utility functions --*/
208 
210  char* dest,
211  unsigned int* destLen,
212  char* source,
213  unsigned int sourceLen,
214  int blockSize100k,
215  int verbosity,
216  int workFactor
217  );
218 
220  char* dest,
221  unsigned int* destLen,
222  char* source,
223  unsigned int sourceLen,
224  int small,
225  int verbosity
226  );
227 
228 
229 /*--
230  Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
231  to support better zlib compatibility.
232  This code is not _officially_ part of libbzip2 (yet);
233  I haven't tested it, documented it, or considered the
234  threading-safeness of it.
235  If this code breaks, please contact both Yoshioka and me.
236 --*/
237 
238 BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
239  void
240  );
241 
242 #ifndef BZ_NO_STDIO
244  const char *path,
245  const char *mode
246  );
247 
249  int fd,
250  const char *mode
251  );
252 
254  BZFILE* b,
255  void* buf,
256  int len
257  );
258 
260  BZFILE* b,
261  void* buf,
262  int len
263  );
264 
266  BZFILE* b
267  );
268 
270  BZFILE* b
271  );
272 
273 BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
274  BZFILE *b,
275  int *errnum
276  );
277 #endif
278 
279 
281 
282 
283 #endif
284 
285 /*-------------------------------------------------------------*/
286 /*--- end bzlib.h ---*/
287 /*-------------------------------------------------------------*/
#define BZ_API(func)
Definition: bzlib.h:94
BZ_EXTERN const char *BZ_API() BZ2_bzerror(BZFILE *b, int *errnum)
Definition: bzlib.c:1570
BZ_EXTERN BZFILE *BZ_API() BZ2_bzdopen(int fd, const char *mode)
Definition: bzlib.c:1481
unsigned int total_in_hi32
Definition: bzlib.h:54
BZ_EXTERN void BZ_API() BZ2_bzWrite(int *bzerror, BZFILE *b, void *buf, int len)
Definition: bzlib.c:976
unsigned int avail_in
Definition: bzlib.h:52
BZ_EXTERN BZFILE *BZ_API() BZ2_bzopen(const char *path, const char *mode)
Definition: bzlib.c:1472
unsigned int total_out_hi32
Definition: bzlib.h:59
BZ_EXTERN void BZ_API() BZ2_bzReadClose(int *bzerror, BZFILE *b)
Definition: bzlib.c:1154
BZ_EXTERN int BZ_API() BZ2_bzRead(int *bzerror, BZFILE *b, void *buf, int len)
Definition: bzlib.c:1173
unsigned int total_in_lo32
Definition: bzlib.h:53
BZ_EXTERN BZFILE *BZ_API() BZ2_bzWriteOpen(int *bzerror, FILE *f, int blockSize100k, int verbosity, int workFactor)
Definition: bzlib.c:928
unsigned int total_out_lo32
Definition: bzlib.h:58
#define BZ_EXTERN
Definition: bzlib.h:95
BZ_EXTERN void BZ_API() BZ2_bzclose(BZFILE *b)
Definition: bzlib.c:1525
BZ_EXTERN void BZ_API() BZ2_bzReadGetUnused(int *bzerror, BZFILE *b, void **unused, int *nUnused)
Definition: bzlib.c:1233
BZ_EXTERN int BZ_API() BZ2_bzDecompressEnd(bz_stream *strm)
Definition: bzlib.c:873
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
Definition: abc_global.h:105
BZ_EXTERN int BZ_API() BZ2_bzCompressEnd(bz_stream *strm)
Definition: bzlib.c:479
#define ABC_NAMESPACE_HEADER_END
Definition: abc_global.h:106
BZ_EXTERN int BZ_API() BZ2_bzBuffToBuffDecompress(char *dest, unsigned int *destLen, char *source, unsigned int sourceLen, int small, int verbosity)
Definition: bzlib.c:1311
void * state
Definition: bzlib.h:61
BZ_EXTERN int BZ_API() BZ2_bzflush(BZFILE *b)
Definition: bzlib.c:1517
BZ_EXTERN int BZ_API() BZ2_bzDecompress(bz_stream *strm)
Definition: bzlib.c:819
BZ_EXTERN int BZ_API() BZ2_bzread(BZFILE *b, void *buf, int len)
Definition: bzlib.c:1489
BZ_EXTERN void BZ_API() BZ2_bzWriteClose(int *bzerror, BZFILE *b, int abandon, unsigned int *nbytes_in, unsigned int *nbytes_out)
Definition: bzlib.c:1021
BZ_EXTERN int BZ_API() BZ2_bzDecompressInit(bz_stream *strm, int verbosity, int small)
Definition: bzlib.c:504
BZ_EXTERN int BZ_API() BZ2_bzwrite(BZFILE *b, void *buf, int len)
Definition: bzlib.c:1503
ABC_NAMESPACE_HEADER_START BZ_EXTERN int BZ_API() BZ2_bzCompressInit(bz_stream *strm, int blockSize100k, int verbosity, int workFactor)
Definition: bzlib.c:160
unsigned int avail_out
Definition: bzlib.h:57
void * opaque
Definition: bzlib.h:65
BZ_EXTERN int BZ_API() BZ2_bzBuffToBuffCompress(char *dest, unsigned int *destLen, char *source, unsigned int sourceLen, int blockSize100k, int verbosity, int workFactor)
Definition: bzlib.c:1259
BZ_EXTERN BZFILE *BZ_API() BZ2_bzReadOpen(int *bzerror, FILE *f, int verbosity, int small, void *unused, int nUnused)
Definition: bzlib.c:1099
char * next_out
Definition: bzlib.h:56
void BZFILE
Definition: bzlib.h:142
BZ_EXTERN int BZ_API() BZ2_bzCompress(bz_stream *strm, int action)
Definition: bzlib.c:418
BZ_EXTERN void BZ_API() BZ2_bzWriteClose64(int *bzerror, BZFILE *b, int abandon, unsigned int *nbytes_in_lo32, unsigned int *nbytes_in_hi32, unsigned int *nbytes_out_lo32, unsigned int *nbytes_out_hi32)
Definition: bzlib.c:1033
char * next_in
Definition: bzlib.h:51
BZ_EXTERN const char *BZ_API() BZ2_bzlibVersion(void)
Definition: bzlib.c:1377