source: trunk/include/lzoconf.h@ 209

Last change on this file since 209 was 1, checked in by katerina, 19 years ago

Initial import

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