1 /* lzoconf.h -- configuration for the LZO real-time data compression library
3 This file is part of the LZO real-time data compression library.
5 Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
6 Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
7 Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
8 Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
9 Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
10 Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
11 Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
12 Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
13 Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
14 Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
17 The LZO library is free software; you can redistribute it and/or
18 modify it under the terms of the GNU General Public License,
19 version 2, as published by the Free Software Foundation.
21 The LZO library is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
26 You should have received a copy of the GNU General Public License
27 along with the LZO library; see the file COPYING.
28 If not, write to the Free Software Foundation, Inc.,
29 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 Markus F.X.J. Oberhumer
32 <markus@oberhumer.com>
33 http://www.oberhumer.com/opensource/lzo/
37 #ifndef __LZOCONF_H_INCLUDED
38 #define __LZOCONF_H_INCLUDED
40 #define LZO_VERSION 0x2020
41 #define LZO_VERSION_STRING "2.02"
42 #define LZO_VERSION_DATE "Oct 17 2005"
44 /* internal Autoconf configuration file - only used when building LZO */
45 #if defined(LZO_HAVE_CONFIG_H)
52 /***********************************************************************
53 // LZO requires a conforming <limits.h>
54 ************************************************************************/
56 #if !defined(CHAR_BIT) || (CHAR_BIT != 8)
57 # error "invalid CHAR_BIT"
59 #if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
60 # error "check your compiler installation"
62 #if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
63 # error "your limits.h macros are broken"
66 /* get OS and architecture defines */
67 #ifndef __LZODEFS_H_INCLUDED
77 /***********************************************************************
79 ************************************************************************/
81 #if !defined(LZO_UINT32_C)
82 # if (UINT_MAX < LZO_0xffffffffL)
83 # define LZO_UINT32_C(c) c ## UL
85 # define LZO_UINT32_C(c) ((c) + 0U)
90 #if !defined(__LZO_CHECKER)
91 # if defined(__BOUNDS_CHECKING_ON)
92 # define __LZO_CHECKER 1
93 # elif defined(__CHECKER__)
94 # define __LZO_CHECKER 1
95 # elif defined(__INSURE__)
96 # define __LZO_CHECKER 1
97 # elif defined(__PURIFY__)
98 # define __LZO_CHECKER 1
103 /***********************************************************************
104 // integral and pointer types
105 ************************************************************************/
107 /* lzo_uint should match size_t */
108 #if !defined(LZO_UINT_MAX)
109 # if defined(LZO_ABI_LLP64) /* WIN64 */
110 # if defined(LZO_OS_WIN64)
111 typedef unsigned __int64 lzo_uint
;
112 typedef __int64 lzo_int
;
114 typedef unsigned long long lzo_uint
;
115 typedef long long lzo_int
;
117 # define LZO_UINT_MAX 0xffffffffffffffffull
118 # define LZO_INT_MAX 9223372036854775807LL
119 # define LZO_INT_MIN (-1LL - LZO_INT_MAX)
120 # elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */
121 typedef unsigned int lzo_uint
;
123 # define LZO_UINT_MAX UINT_MAX
124 # define LZO_INT_MAX INT_MAX
125 # define LZO_INT_MIN INT_MIN
126 # elif (ULONG_MAX >= LZO_0xffffffffL)
127 typedef unsigned long lzo_uint
;
128 typedef long lzo_int
;
129 # define LZO_UINT_MAX ULONG_MAX
130 # define LZO_INT_MAX LONG_MAX
131 # define LZO_INT_MIN LONG_MIN
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
156 /* The larger type of lzo_uint and lzo_uint32. */
157 #if (LZO_UINT_MAX >= LZO_UINT32_MAX)
158 # define lzo_xint lzo_uint
160 # define lzo_xint lzo_uint32
163 /* Memory model that allows to access memory at offsets of lzo_uint. */
164 #if !defined(__LZO_MMODEL)
165 # if (LZO_UINT_MAX <= UINT_MAX)
166 # define __LZO_MMODEL
167 # elif defined(LZO_HAVE_MM_HUGE_PTR)
168 # define __LZO_MMODEL_HUGE 1
169 # define __LZO_MMODEL __huge
171 # define __LZO_MMODEL
175 /* no typedef here because of const-pointer issues */
176 #define lzo_bytep unsigned char __LZO_MMODEL *
177 #define lzo_charp char __LZO_MMODEL *
178 #define lzo_voidp void __LZO_MMODEL *
179 #define lzo_shortp short __LZO_MMODEL *
180 #define lzo_ushortp unsigned short __LZO_MMODEL *
181 #define lzo_uint32p lzo_uint32 __LZO_MMODEL *
182 #define lzo_int32p lzo_int32 __LZO_MMODEL *
183 #define lzo_uintp lzo_uint __LZO_MMODEL *
184 #define lzo_intp lzo_int __LZO_MMODEL *
185 #define lzo_xintp lzo_xint __LZO_MMODEL *
186 #define lzo_voidpp lzo_voidp __LZO_MMODEL *
187 #define lzo_bytepp lzo_bytep __LZO_MMODEL *
188 /* deprecated - use `lzo_bytep' instead of `lzo_byte *' */
189 #define lzo_byte unsigned char __LZO_MMODEL
191 typedef int lzo_bool
;
194 /***********************************************************************
196 ************************************************************************/
199 #if !defined(__LZO_EXTERN_C)
201 # define __LZO_EXTERN_C extern "C"
203 # define __LZO_EXTERN_C extern
207 /* calling convention */
208 #if !defined(__LZO_CDECL)
209 # define __LZO_CDECL __lzo_cdecl
212 /* DLL export information */
213 #if !defined(__LZO_EXPORT1)
214 # define __LZO_EXPORT1
216 #if !defined(__LZO_EXPORT2)
217 # define __LZO_EXPORT2
220 /* __cdecl calling convention for public C and assembly functions */
221 #if !defined(LZO_PUBLIC)
222 # define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
224 #if !defined(LZO_EXTERN)
225 # define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
227 #if !defined(LZO_PRIVATE)
228 # define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL
233 (__LZO_CDECL
*lzo_compress_t
) ( const lzo_bytep src
, lzo_uint src_len
,
234 lzo_bytep dst
, lzo_uintp dst_len
,
238 (__LZO_CDECL
*lzo_decompress_t
) ( const lzo_bytep src
, lzo_uint src_len
,
239 lzo_bytep dst
, lzo_uintp dst_len
,
243 (__LZO_CDECL
*lzo_optimize_t
) ( lzo_bytep src
, lzo_uint src_len
,
244 lzo_bytep dst
, lzo_uintp dst_len
,
248 (__LZO_CDECL
*lzo_compress_dict_t
)(const lzo_bytep src
, lzo_uint src_len
,
249 lzo_bytep dst
, lzo_uintp dst_len
,
251 const lzo_bytep dict
, lzo_uint dict_len
);
254 (__LZO_CDECL
*lzo_decompress_dict_t
)(const lzo_bytep src
, lzo_uint src_len
,
255 lzo_bytep dst
, lzo_uintp dst_len
,
257 const lzo_bytep dict
, lzo_uint dict_len
);
260 /* Callback interface. Currently only the progress indicator ("nprogress")
261 * is used, but this may change in a future release. */
263 struct lzo_callback_t
;
264 typedef struct lzo_callback_t lzo_callback_t
;
265 #define lzo_callback_p lzo_callback_t __LZO_MMODEL *
267 /* malloc & free function types */
268 typedef lzo_voidp (__LZO_CDECL
*lzo_alloc_func_t
)
269 (lzo_callback_p self
, lzo_uint items
, lzo_uint size
);
270 typedef void (__LZO_CDECL
*lzo_free_func_t
)
271 (lzo_callback_p self
, lzo_voidp ptr
);
273 /* a progress indicator callback function */
274 typedef void (__LZO_CDECL
*lzo_progress_func_t
)
275 (lzo_callback_p
, lzo_uint
, lzo_uint
, int);
277 struct lzo_callback_t
279 /* custom allocators (set to 0 to disable) */
280 lzo_alloc_func_t nalloc
; /* [not used right now] */
281 lzo_free_func_t nfree
; /* [not used right now] */
283 /* a progress indicator callback function (set to 0 to disable) */
284 lzo_progress_func_t nprogress
;
286 /* NOTE: the first parameter "self" of the nalloc/nfree/nprogress
287 * callbacks points back to this struct, so you are free to store
288 * some extra info in the following variables. */
295 /***********************************************************************
296 // error codes and prototypes
297 ************************************************************************/
299 /* Error codes for the compression/decompression functions. Negative
300 * values are errors, positive values will be used for special but
304 #define LZO_E_ERROR (-1)
305 #define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */
306 #define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */
307 #define LZO_E_INPUT_OVERRUN (-4)
308 #define LZO_E_OUTPUT_OVERRUN (-5)
309 #define LZO_E_LOOKBEHIND_OVERRUN (-6)
310 #define LZO_E_EOF_NOT_FOUND (-7)
311 #define LZO_E_INPUT_NOT_CONSUMED (-8)
312 #define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */
315 #ifndef lzo_sizeof_dict_t
316 # define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep))
319 /* lzo_init() should be the first function you call.
320 * Check the return code !
322 * lzo_init() is a macro to allow checking that the library and the
323 * compiler's view of various types are consistent.
325 #define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
326 (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
327 (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
328 (int)sizeof(lzo_callback_t))
329 LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
331 /* version functions (useful for shared libraries) */
332 LZO_EXTERN(unsigned) lzo_version(void);
333 LZO_EXTERN(const char *) lzo_version_string(void);
334 LZO_EXTERN(const char *) lzo_version_date(void);
335 LZO_EXTERN(const lzo_charp
) _lzo_version_string(void);
336 LZO_EXTERN(const lzo_charp
) _lzo_version_date(void);
338 /* string functions */
340 lzo_memcmp(const lzo_voidp _s1
, const lzo_voidp _s2
, lzo_uint _len
);
341 LZO_EXTERN(lzo_voidp
)
342 lzo_memcpy(lzo_voidp _dest
, const lzo_voidp _src
, lzo_uint _len
);
343 LZO_EXTERN(lzo_voidp
)
344 lzo_memmove(lzo_voidp _dest
, const lzo_voidp _src
, lzo_uint _len
);
345 LZO_EXTERN(lzo_voidp
)
346 lzo_memset(lzo_voidp _s
, int _c
, lzo_uint _len
);
348 /* checksum functions */
349 LZO_EXTERN(lzo_uint32
)
350 lzo_adler32(lzo_uint32 _adler
, const lzo_bytep _buf
, lzo_uint _len
);
351 LZO_EXTERN(lzo_uint32
)
352 lzo_crc32(lzo_uint32 _c
, const lzo_bytep _buf
, lzo_uint _len
);
353 LZO_EXTERN(const lzo_uint32p
)
354 lzo_get_crc32_table(void);
357 LZO_EXTERN(int) _lzo_config_check(void);
358 typedef union { lzo_bytep p
; lzo_uint u
; } __lzo_pu_u
;
359 typedef union { lzo_bytep p
; lzo_uint32 u32
; } __lzo_pu32_u
;
360 typedef union { void *vp
; lzo_bytep bp
; lzo_uint32 u32
; long l
; } lzo_align_t
;
362 /* align a char pointer on a boundary that is a multiple of `size' */
363 LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr
, lzo_uint _size
);
364 #define LZO_PTR_ALIGN_UP(_ptr,_size) \
365 ((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size)))
368 /***********************************************************************
369 // deprecated macros - only for backward compatibility with LZO v1.xx
370 ************************************************************************/
372 #if defined(LZO_CFG_COMPAT)
374 #define __LZOCONF_H 1
376 #if defined(LZO_ARCH_I086)
377 # define __LZO_i386 1
378 #elif defined(LZO_ARCH_I386)
379 # define __LZO_i386 1
382 #if defined(LZO_OS_DOS16)
384 # define __LZO_DOS16 1
385 #elif defined(LZO_OS_DOS32)
387 #elif defined(LZO_OS_WIN16)
389 # define __LZO_WIN16 1
390 #elif defined(LZO_OS_WIN32)
396 #define __LZO_ENTRY __LZO_CDECL
397 #define LZO_EXTERN_CDECL LZO_EXTERN
398 #define LZO_ALIGN LZO_PTR_ALIGN_UP
400 #define lzo_compress_asm_t lzo_compress_t
401 #define lzo_decompress_asm_t lzo_decompress_t
403 #endif /* LZO_CFG_COMPAT */
410 #endif /* already included */
413 /* vim:set ts=4 et: */