Drop main() prototype. Syncs with NetBSD-8
[minix.git] / external / bsd / bzip2 / dist / bzlib.h
blob03f81563631d770029bff4deef274cd3025da375
1 /* $NetBSD: bzlib.h,v 1.1.1.2 2012/05/07 00:41:46 wiz Exp $ */
4 /*-------------------------------------------------------------*/
5 /*--- Public header file for the library. ---*/
6 /*--- bzlib.h ---*/
7 /*-------------------------------------------------------------*/
9 /* ------------------------------------------------------------------
10 This file is part of bzip2/libbzip2, a program and library for
11 lossless, block-sorting data compression.
13 bzip2/libbzip2 version 1.0.6 of 6 September 2010
14 Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
16 Please read the WARNING, DISCLAIMER and PATENTS sections in the
17 README file.
19 This program is released under the terms of the license contained
20 in the file LICENSE.
21 ------------------------------------------------------------------ */
24 #ifndef _BZLIB_H
25 #define _BZLIB_H
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
31 #define BZ_RUN 0
32 #define BZ_FLUSH 1
33 #define BZ_FINISH 2
35 #define BZ_OK 0
36 #define BZ_RUN_OK 1
37 #define BZ_FLUSH_OK 2
38 #define BZ_FINISH_OK 3
39 #define BZ_STREAM_END 4
40 #define BZ_SEQUENCE_ERROR (-1)
41 #define BZ_PARAM_ERROR (-2)
42 #define BZ_MEM_ERROR (-3)
43 #define BZ_DATA_ERROR (-4)
44 #define BZ_DATA_ERROR_MAGIC (-5)
45 #define BZ_IO_ERROR (-6)
46 #define BZ_UNEXPECTED_EOF (-7)
47 #define BZ_OUTBUFF_FULL (-8)
48 #define BZ_CONFIG_ERROR (-9)
50 typedef
51 struct {
52 char *next_in;
53 unsigned int avail_in;
54 unsigned int total_in_lo32;
55 unsigned int total_in_hi32;
57 char *next_out;
58 unsigned int avail_out;
59 unsigned int total_out_lo32;
60 unsigned int total_out_hi32;
62 void *state;
64 void *(*bzalloc)(void *,int,int);
65 void (*bzfree)(void *,void *);
66 void *opaque;
68 bz_stream;
71 #ifndef BZ_IMPORT
72 #define BZ_EXPORT
73 #endif
75 #ifndef BZ_NO_STDIO
76 /* Need a definitition for FILE */
77 #include <stdio.h>
78 #endif
80 #ifdef _WIN32
81 # include <windows.h>
82 # ifdef small
83 /* windows.h define small to char */
84 # undef small
85 # endif
86 # ifdef BZ_EXPORT
87 # define BZ_API(func) WINAPI func
88 # define BZ_EXTERN extern
89 # else
90 /* import windows dll dynamically */
91 # define BZ_API(func) (WINAPI * func)
92 # define BZ_EXTERN
93 # endif
94 #else
95 # define BZ_API(func) func
96 # define BZ_EXTERN extern
97 #endif
100 /*-- Core (low-level) library functions --*/
102 BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
103 bz_stream* strm,
104 int blockSize100k,
105 int verbosity,
106 int workFactor
109 BZ_EXTERN int BZ_API(BZ2_bzCompress) (
110 bz_stream* strm,
111 int action
114 BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
115 bz_stream* strm
118 BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
119 bz_stream *strm,
120 int verbosity,
121 int small
124 BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
125 bz_stream* strm
128 BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
129 bz_stream *strm
134 /*-- High(er) level library functions --*/
136 #ifndef BZ_NO_STDIO
137 #define BZ_MAX_UNUSED 5000
139 typedef void BZFILE;
141 BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
142 int* bzerror,
143 FILE* f,
144 int verbosity,
145 int small,
146 void* unused,
147 int nUnused
150 BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
151 int* bzerror,
152 BZFILE* b
155 BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
156 int* bzerror,
157 BZFILE* b,
158 void** unused,
159 int* nUnused
162 BZ_EXTERN int BZ_API(BZ2_bzRead) (
163 int* bzerror,
164 BZFILE* b,
165 void* buf,
166 int len
169 BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
170 int* bzerror,
171 FILE* f,
172 int blockSize100k,
173 int verbosity,
174 int workFactor
177 BZ_EXTERN void BZ_API(BZ2_bzWrite) (
178 int* bzerror,
179 BZFILE* b,
180 void* buf,
181 int len
184 BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
185 int* bzerror,
186 BZFILE* b,
187 int abandon,
188 unsigned int* nbytes_in,
189 unsigned int* nbytes_out
192 BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
193 int* bzerror,
194 BZFILE* b,
195 int abandon,
196 unsigned int* nbytes_in_lo32,
197 unsigned int* nbytes_in_hi32,
198 unsigned int* nbytes_out_lo32,
199 unsigned int* nbytes_out_hi32
201 #endif
204 /*-- Utility functions --*/
206 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
207 char* dest,
208 unsigned int* destLen,
209 char* source,
210 unsigned int sourceLen,
211 int blockSize100k,
212 int verbosity,
213 int workFactor
216 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
217 char* dest,
218 unsigned int* destLen,
219 char* source,
220 unsigned int sourceLen,
221 int small,
222 int verbosity
226 /*--
227 Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
228 to support better zlib compatibility.
229 This code is not _officially_ part of libbzip2 (yet);
230 I haven't tested it, documented it, or considered the
231 threading-safeness of it.
232 If this code breaks, please contact both Yoshioka and me.
233 --*/
235 BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
236 void
239 #ifndef BZ_NO_STDIO
240 BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
241 const char *path,
242 const char *mode
245 BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
246 int fd,
247 const char *mode
250 BZ_EXTERN int BZ_API(BZ2_bzread) (
251 BZFILE* b,
252 void* buf,
253 int len
256 BZ_EXTERN int BZ_API(BZ2_bzwrite) (
257 BZFILE* b,
258 void* buf,
259 int len
262 BZ_EXTERN int BZ_API(BZ2_bzflush) (
263 BZFILE* b
266 BZ_EXTERN void BZ_API(BZ2_bzclose) (
267 BZFILE* b
270 BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
271 BZFILE *b,
272 int *errnum
274 #endif
276 #ifdef __cplusplus
278 #endif
280 #endif
282 /*-------------------------------------------------------------*/
283 /*--- end bzlib.h ---*/
284 /*-------------------------------------------------------------*/