3803
|
1 /* lzoconf.h -- configuration for the LZO real-time data compression library
|
|
2
|
|
3 This file is part of the LZO real-time data compression library.
|
|
4
|
|
5 Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
|
6 Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
|
|
7 Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
|
|
8 Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
|
|
9 Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
|
10
|
|
11 The LZO library is free software; you can redistribute it and/or
|
|
12 modify it under the terms of the GNU General Public License as
|
|
13 published by the Free Software Foundation; either version 2 of
|
|
14 the License, or (at your option) any later version.
|
|
15
|
|
16 The LZO library is distributed in the hope that it will be useful,
|
|
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19 GNU General Public License for more details.
|
|
20
|
|
21 You should have received a copy of the GNU General Public License
|
|
22 along with the LZO library; see the file COPYING.
|
|
23 If not, write to the Free Software Foundation, Inc.,
|
|
24 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
25
|
|
26 Markus F.X.J. Oberhumer
|
|
27 <markus.oberhumer@jk.uni-linz.ac.at>
|
|
28 http://wildsau.idv.uni-linz.ac.at/mfx/lzo.html
|
|
29 */
|
|
30
|
|
31
|
|
32 #ifndef __LZOCONF_H
|
|
33 #define __LZOCONF_H
|
|
34
|
|
35 #define LZO_VERSION 0x1070
|
|
36 #define LZO_VERSION_STRING "1.07"
|
|
37 #define LZO_VERSION_DATE "Oct 18 2000"
|
|
38
|
|
39 /* internal Autoconf configuration file - only used when building LZO */
|
|
40 #if defined(LZO_HAVE_CONFIG_H)
|
|
41 # include <config.h>
|
|
42 #endif
|
|
43 #include <limits.h>
|
|
44
|
|
45 #ifdef __cplusplus
|
|
46 extern "C" {
|
|
47 #endif
|
|
48
|
|
49
|
|
50 /***********************************************************************
|
|
51 // LZO requires a conforming <limits.h>
|
|
52 ************************************************************************/
|
|
53
|
|
54 #if !defined(CHAR_BIT) || (CHAR_BIT != 8)
|
|
55 # error "invalid CHAR_BIT"
|
|
56 #endif
|
|
57 #if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
|
|
58 # error "check your compiler installation"
|
|
59 #endif
|
|
60 #if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
|
|
61 # error "your limits.h macros are broken"
|
|
62 #endif
|
|
63
|
|
64 /* workaround a cpp bug under hpux 10.20 */
|
|
65 #define LZO_0xffffffffL 4294967295ul
|
|
66
|
|
67
|
|
68 /***********************************************************************
|
|
69 // architecture defines
|
|
70 ************************************************************************/
|
|
71
|
|
72 #if !defined(__LZO_WIN) && !defined(__LZO_DOS) && !defined(__LZO_OS2)
|
|
73 # if defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows)
|
|
74 # define __LZO_WIN
|
|
75 # elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
|
|
76 # define __LZO_WIN
|
|
77 # elif defined(__NT__) || defined(__NT_DLL__) || defined(__WINDOWS_386__)
|
|
78 # define __LZO_WIN
|
|
79 # elif defined(__DOS__) || defined(__MSDOS__) || defined(MSDOS)
|
|
80 # define __LZO_DOS
|
|
81 # elif defined(__OS2__) || defined(__OS2V2__) || defined(OS2)
|
|
82 # define __LZO_OS2
|
|
83 # elif defined(__palmos__)
|
|
84 # define __LZO_PALMOS
|
|
85 # elif defined(__TOS__) || defined(__atarist__)
|
|
86 # define __LZO_TOS
|
|
87 # endif
|
|
88 #endif
|
|
89
|
|
90 #if (UINT_MAX < LZO_0xffffffffL)
|
|
91 # if defined(__LZO_WIN)
|
|
92 # define __LZO_WIN16
|
|
93 # elif defined(__LZO_DOS)
|
|
94 # define __LZO_DOS16
|
|
95 # elif defined(__LZO_PALMOS)
|
|
96 # define __LZO_PALMOS16
|
|
97 # elif defined(__LZO_TOS)
|
|
98 # define __LZO_TOS16
|
|
99 # elif defined(__C166__)
|
|
100 # else
|
|
101 # error "16-bit target not supported - contact me for porting hints"
|
|
102 # endif
|
|
103 #endif
|
|
104
|
|
105 #if !defined(__LZO_i386)
|
|
106 # if defined(__LZO_DOS) || defined(__LZO_WIN16)
|
|
107 # define __LZO_i386
|
|
108 # elif defined(__i386__) || defined(__386__) || defined(_M_IX86)
|
|
109 # define __LZO_i386
|
|
110 # endif
|
|
111 #endif
|
|
112
|
|
113 #if defined(__LZO_STRICT_16BIT)
|
|
114 # if (UINT_MAX < LZO_0xffffffffL)
|
|
115 # include <lzo16bit.h>
|
|
116 # endif
|
|
117 #endif
|
|
118
|
|
119 /* memory checkers */
|
|
120 #if !defined(__LZO_CHECKER)
|
|
121 # if defined(__BOUNDS_CHECKING_ON)
|
|
122 # define __LZO_CHECKER
|
|
123 # elif defined(__CHECKER__)
|
|
124 # define __LZO_CHECKER
|
|
125 # elif defined(__INSURE__)
|
|
126 # define __LZO_CHECKER
|
|
127 # elif defined(__PURIFY__)
|
|
128 # define __LZO_CHECKER
|
|
129 # endif
|
|
130 #endif
|
|
131
|
|
132
|
|
133 /***********************************************************************
|
|
134 // integral and pointer types
|
|
135 ************************************************************************/
|
|
136
|
|
137 /* Integral types with 32 bits or more */
|
|
138 #if !defined(LZO_UINT32_MAX)
|
|
139 # if (UINT_MAX >= LZO_0xffffffffL)
|
|
140 typedef unsigned int lzo_uint32;
|
|
141 typedef int lzo_int32;
|
|
142 # define LZO_UINT32_MAX UINT_MAX
|
|
143 # define LZO_INT32_MAX INT_MAX
|
|
144 # define LZO_INT32_MIN INT_MIN
|
|
145 # elif (ULONG_MAX >= LZO_0xffffffffL)
|
|
146 typedef unsigned long lzo_uint32;
|
|
147 typedef long lzo_int32;
|
|
148 # define LZO_UINT32_MAX ULONG_MAX
|
|
149 # define LZO_INT32_MAX LONG_MAX
|
|
150 # define LZO_INT32_MIN LONG_MIN
|
|
151 # else
|
|
152 # error "lzo_uint32"
|
|
153 # endif
|
|
154 #endif
|
|
155
|
|
156 /* lzo_uint is used like size_t */
|
|
157 #if !defined(LZO_UINT_MAX)
|
|
158 # if (UINT_MAX >= LZO_0xffffffffL)
|
|
159 typedef unsigned int lzo_uint;
|
|
160 typedef int lzo_int;
|
|
161 # define LZO_UINT_MAX UINT_MAX
|
|
162 # define LZO_INT_MAX INT_MAX
|
|
163 # define LZO_INT_MIN INT_MIN
|
|
164 # elif (ULONG_MAX >= LZO_0xffffffffL)
|
|
165 typedef unsigned long lzo_uint;
|
|
166 typedef long lzo_int;
|
|
167 # define LZO_UINT_MAX ULONG_MAX
|
|
168 # define LZO_INT_MAX LONG_MAX
|
|
169 # define LZO_INT_MIN LONG_MIN
|
|
170 # else
|
|
171 # error "lzo_uint"
|
|
172 # endif
|
|
173 #endif
|
|
174
|
|
175
|
|
176 /* Memory model that allows to access memory at offsets of lzo_uint. */
|
|
177 #if !defined(__LZO_MMODEL)
|
|
178 # if (LZO_UINT_MAX <= UINT_MAX)
|
|
179 # define __LZO_MMODEL
|
|
180 # elif defined(__LZO_DOS16) || defined(__LZO_WIN16)
|
|
181 # define __LZO_MMODEL __huge
|
|
182 # define LZO_999_UNSUPPORTED
|
|
183 # elif defined(__LZO_PALMOS16) || defined(__LZO_TOS16)
|
|
184 # define __LZO_MMODEL
|
|
185 # else
|
|
186 # error "__LZO_MMODEL"
|
|
187 # endif
|
|
188 #endif
|
|
189
|
|
190 /* no typedef here because of const-pointer issues */
|
|
191 #define lzo_byte unsigned char __LZO_MMODEL
|
|
192 #define lzo_bytep unsigned char __LZO_MMODEL *
|
|
193 #define lzo_charp char __LZO_MMODEL *
|
|
194 #define lzo_voidp void __LZO_MMODEL *
|
|
195 #define lzo_shortp short __LZO_MMODEL *
|
|
196 #define lzo_ushortp unsigned short __LZO_MMODEL *
|
|
197 #define lzo_uint32p lzo_uint32 __LZO_MMODEL *
|
|
198 #define lzo_int32p lzo_int32 __LZO_MMODEL *
|
|
199 #define lzo_uintp lzo_uint __LZO_MMODEL *
|
|
200 #define lzo_intp lzo_int __LZO_MMODEL *
|
|
201 #define lzo_voidpp lzo_voidp __LZO_MMODEL *
|
|
202 #define lzo_bytepp lzo_bytep __LZO_MMODEL *
|
|
203
|
|
204 typedef int lzo_bool;
|
|
205
|
|
206 #ifndef lzo_sizeof_dict_t
|
|
207 # define lzo_sizeof_dict_t sizeof(lzo_bytep)
|
|
208 #endif
|
|
209
|
|
210
|
|
211 /***********************************************************************
|
|
212 // function types
|
|
213 ************************************************************************/
|
|
214
|
|
215 /* linkage */
|
|
216 #if !defined(__LZO_EXTERN_C)
|
|
217 # ifdef __cplusplus
|
|
218 # define __LZO_EXTERN_C extern "C"
|
|
219 # else
|
|
220 # define __LZO_EXTERN_C extern
|
|
221 # endif
|
|
222 #endif
|
|
223
|
|
224 /* calling conventions */
|
|
225 #if !defined(__LZO_CDECL)
|
|
226 # if defined(__LZO_DOS16) || defined(__LZO_WIN16)
|
|
227 # define __LZO_CDECL __far __cdecl
|
|
228 # elif defined(__LZO_i386) && defined(_MSC_VER)
|
|
229 # define __LZO_CDECL __cdecl
|
|
230 # elif defined(__LZO_i386) && defined(__WATCOMC__)
|
|
231 # define __LZO_CDECL __near __cdecl
|
|
232 # else
|
|
233 # define __LZO_CDECL
|
|
234 # endif
|
|
235 #endif
|
|
236 #if !defined(__LZO_ENTRY)
|
|
237 # define __LZO_ENTRY __LZO_CDECL
|
|
238 #endif
|
|
239
|
|
240 /* DLL export information */
|
|
241 #if !defined(__LZO_EXPORT1)
|
|
242 # define __LZO_EXPORT1
|
|
243 #endif
|
|
244 #if !defined(__LZO_EXPORT2)
|
|
245 # define __LZO_EXPORT2
|
|
246 #endif
|
|
247
|
|
248 /* calling convention for C functions */
|
|
249 #if !defined(LZO_PUBLIC)
|
|
250 # define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_ENTRY
|
|
251 #endif
|
|
252 #if !defined(LZO_EXTERN)
|
|
253 # define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
|
|
254 #endif
|
|
255 #if !defined(LZO_PRIVATE)
|
|
256 # define LZO_PRIVATE(_rettype) static _rettype __LZO_ENTRY
|
|
257 #endif
|
|
258
|
|
259 /* cdecl calling convention for assembler functions */
|
|
260 #if !defined(LZO_PUBLIC_CDECL)
|
|
261 # define LZO_PUBLIC_CDECL(_rettype) \
|
|
262 __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
|
|
263 #endif
|
|
264 #if !defined(LZO_EXTERN_CDECL)
|
|
265 # define LZO_EXTERN_CDECL(_rettype) __LZO_EXTERN_C LZO_PUBLIC_CDECL(_rettype)
|
|
266 #endif
|
|
267
|
|
268
|
|
269 typedef int
|
|
270 (__LZO_ENTRY *lzo_compress_t) ( const lzo_byte *src, lzo_uint src_len,
|
|
271 lzo_byte *dst, lzo_uint *dst_len,
|
|
272 lzo_voidp wrkmem );
|
|
273
|
|
274 typedef int
|
|
275 (__LZO_ENTRY *lzo_decompress_t) ( const lzo_byte *src, lzo_uint src_len,
|
|
276 lzo_byte *dst, lzo_uint *dst_len,
|
|
277 lzo_voidp wrkmem );
|
|
278
|
|
279 typedef int
|
|
280 (__LZO_ENTRY *lzo_optimize_t) ( lzo_byte *src, lzo_uint src_len,
|
|
281 lzo_byte *dst, lzo_uint *dst_len,
|
|
282 lzo_voidp wrkmem );
|
|
283
|
|
284 typedef int
|
|
285 (__LZO_ENTRY *lzo_compress_dict_t)(const lzo_byte *src, lzo_uint src_len,
|
|
286 lzo_byte *dst, lzo_uint *dst_len,
|
|
287 lzo_voidp wrkmem,
|
|
288 const lzo_byte *dict, lzo_uint dict_len );
|
|
289
|
|
290 typedef int
|
|
291 (__LZO_ENTRY *lzo_decompress_dict_t)(const lzo_byte *src, lzo_uint src_len,
|
|
292 lzo_byte *dst, lzo_uint *dst_len,
|
|
293 lzo_voidp wrkmem,
|
|
294 const lzo_byte *dict, lzo_uint dict_len );
|
|
295
|
|
296
|
|
297 /* a progress indicator callback function */
|
|
298 typedef void (__LZO_ENTRY *lzo_progress_callback_t) (lzo_uint, lzo_uint);
|
|
299
|
|
300
|
|
301 /***********************************************************************
|
|
302 // error codes and prototypes
|
|
303 ************************************************************************/
|
|
304
|
|
305 /* Error codes for the compression/decompression functions. Negative
|
|
306 * values are errors, positive values will be used for special but
|
|
307 * normal events.
|
|
308 */
|
|
309 #define LZO_E_OK 0
|
|
310 #define LZO_E_ERROR (-1)
|
|
311 #define LZO_E_OUT_OF_MEMORY (-2) /* not used right now */
|
|
312 #define LZO_E_NOT_COMPRESSIBLE (-3) /* not used right now */
|
|
313 #define LZO_E_INPUT_OVERRUN (-4)
|
|
314 #define LZO_E_OUTPUT_OVERRUN (-5)
|
|
315 #define LZO_E_LOOKBEHIND_OVERRUN (-6)
|
|
316 #define LZO_E_EOF_NOT_FOUND (-7)
|
|
317 #define LZO_E_INPUT_NOT_CONSUMED (-8)
|
|
318
|
|
319
|
|
320 /* lzo_init() should be the first function you call.
|
|
321 * Check the return code !
|
|
322 *
|
|
323 * lzo_init() is a macro to allow checking that the library and the
|
|
324 * compiler's view of various types are consistent.
|
|
325 */
|
|
326 #define lzo_init() __lzo_init2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
|
|
327 (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
|
|
328 (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
|
|
329 (int)sizeof(lzo_compress_t))
|
|
330 LZO_EXTERN(int) __lzo_init2(unsigned,int,int,int,int,int,int,int,int,int);
|
|
331
|
|
332 /* version functions (useful for shared libraries) */
|
|
333 LZO_EXTERN(unsigned) lzo_version(void);
|
|
334 LZO_EXTERN(const char *) lzo_version_string(void);
|
|
335 LZO_EXTERN(const char *) lzo_version_date(void);
|
|
336 LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
|
|
337 LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
|
|
338
|
|
339 /* string functions */
|
|
340 LZO_EXTERN(int)
|
|
341 lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len);
|
|
342 LZO_EXTERN(lzo_voidp)
|
|
343 lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
|
|
344 LZO_EXTERN(lzo_voidp)
|
|
345 lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
|
|
346 LZO_EXTERN(lzo_voidp)
|
|
347 lzo_memset(lzo_voidp _s, int _c, lzo_uint _len);
|
|
348
|
|
349 /* checksum functions */
|
|
350 LZO_EXTERN(lzo_uint32)
|
|
351 lzo_adler32(lzo_uint32 _adler, const lzo_byte *_buf, lzo_uint _len);
|
|
352 LZO_EXTERN(lzo_uint32)
|
|
353 lzo_crc32(lzo_uint32 _c, const lzo_byte *_buf, lzo_uint _len);
|
|
354
|
|
355 /* memory allocation functions */
|
|
356 LZO_EXTERN(lzo_bytep) lzo_alloc(lzo_uint _nelems, lzo_uint _size);
|
|
357 LZO_EXTERN(lzo_bytep) lzo_malloc(lzo_uint _size);
|
|
358 LZO_EXTERN(void) lzo_free(lzo_voidp _ptr);
|
|
359
|
|
360 typedef lzo_bytep (__LZO_ENTRY *lzo_alloc_hook_t) (lzo_uint, lzo_uint);
|
|
361 typedef void (__LZO_ENTRY *lzo_free_hook_t) (lzo_voidp);
|
|
362
|
|
363 extern lzo_alloc_hook_t lzo_alloc_hook;
|
|
364 extern lzo_free_hook_t lzo_free_hook;
|
|
365
|
|
366 /* misc. */
|
|
367 LZO_EXTERN(lzo_bool) lzo_assert(int _expr);
|
|
368 LZO_EXTERN(int) _lzo_config_check(void);
|
|
369 typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
|
|
370 typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
|
|
371
|
|
372 /* align a char pointer on a boundary that is a multiple of `size' */
|
|
373 LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size);
|
|
374 #define LZO_PTR_ALIGN_UP(_ptr,_size) \
|
|
375 ((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size)))
|
|
376
|
|
377 /* deprecated - only for backward compatibility */
|
|
378 #define LZO_ALIGN(_ptr,_size) LZO_PTR_ALIGN_UP(_ptr,_size)
|
|
379
|
|
380
|
|
381 #ifdef __cplusplus
|
|
382 } /* extern "C" */
|
|
383 #endif
|
|
384
|
|
385 #endif /* already included */
|
|
386
|