1 // BlinkenSisters - Hunt for the Lost Pixels
2 //     Bringing back the fun of the 80s
3 //
4 // (C) 2005-07 Rene Schickbauer, Wolfgang Dautermann
5 //
6 // See License.txt for licensing information
7 //
8 // This file includes also material from other authors, see bellow
9 //
10 
11 /* lzoconf.h -- configuration for the LZO real-time data compression library
12 
13    This file is part of the LZO real-time data compression library.
14 
15    Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
16    Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
17    Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
18    Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
19    Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
20    Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
21    Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
22    Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
23    Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
24    Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
25    All Rights Reserved.
26 
27    The LZO library is free software; you can redistribute it and/or
28    modify it under the terms of the GNU General Public License,
29    version 2, as published by the Free Software Foundation.
30 
31    The LZO library is distributed in the hope that it will be useful,
32    but WITHOUT ANY WARRANTY; without even the implied warranty of
33    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
34    GNU General Public License for more details.
35 
36    You should have received a copy of the GNU General Public License
37    along with the LZO library; see the file COPYING.
38    If not, write to the Free Software Foundation, Inc.,
39    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
40 
41    Markus F.X.J. Oberhumer
42    <markus@oberhumer.com>
43    http://www.oberhumer.com/opensource/lzo/
44  */
45 
46 
47 #ifndef __LZOCONF_H_INCLUDED
48 #define __LZOCONF_H_INCLUDED
49 
50 #define LZO_VERSION             0x2020
51 #define LZO_VERSION_STRING      "2.02"
52 #define LZO_VERSION_DATE        "Oct 17 2005"
53 
54 /* internal Autoconf configuration file - only used when building LZO */
55 #if defined(LZO_HAVE_CONFIG_H)
56 #  include <config.h>
57 #endif
58 #include <limits.h>
59 #include <stddef.h>
60 
61 
62 /***********************************************************************
63 // LZO requires a conforming <limits.h>
64 ************************************************************************/
65 
66 #if !defined(CHAR_BIT) || (CHAR_BIT != 8)
67 #  error "invalid CHAR_BIT"
68 #endif
69 #if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
70 #  error "check your compiler installation"
71 #endif
72 #if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
73 #  error "your limits.h macros are broken"
74 #endif
75 
76 /* get OS and architecture defines */
77 #ifndef __LZODEFS_H_INCLUDED
78 #include "lzodefs.h"
79 #endif
80 
81 
82 #ifdef __cplusplus
83 extern "C" {
84 #endif
85 
86 
87 /***********************************************************************
88 // some core defines
89 ************************************************************************/
90 
91 #if !defined(LZO_UINT32_C)
92 #  if (UINT_MAX < LZO_0xffffffffL)
93 #    define LZO_UINT32_C(c)     c ## UL
94 #  else
95 #    define LZO_UINT32_C(c)     ((c) + 0U)
96 #  endif
97 #endif
98 
99 /* memory checkers */
100 #if !defined(__LZO_CHECKER)
101 #  if defined(__BOUNDS_CHECKING_ON)
102 #    define __LZO_CHECKER       1
103 #  elif defined(__CHECKER__)
104 #    define __LZO_CHECKER       1
105 #  elif defined(__INSURE__)
106 #    define __LZO_CHECKER       1
107 #  elif defined(__PURIFY__)
108 #    define __LZO_CHECKER       1
109 #  endif
110 #endif
111 
112 
113 /***********************************************************************
114 // integral and pointer types
115 ************************************************************************/
116 
117 /* lzo_uint should match size_t */
118 #if !defined(LZO_UINT_MAX)
119 #  if defined(LZO_ABI_LLP64) /* WIN64 */
120 #    if defined(LZO_OS_WIN64)
121      typedef unsigned __int64   lzo_uint;
122      typedef __int64            lzo_int;
123 #    else
124      typedef unsigned long long lzo_uint;
125      typedef long long          lzo_int;
126 #    endif
127 #    define LZO_UINT_MAX        0xffffffffffffffffull
128 #    define LZO_INT_MAX         9223372036854775807LL
129 #    define LZO_INT_MIN         (-1LL - LZO_INT_MAX)
130 #  elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */
131      typedef unsigned int       lzo_uint;
132      typedef int                lzo_int;
133 #    define LZO_UINT_MAX        UINT_MAX
134 #    define LZO_INT_MAX         INT_MAX
135 #    define LZO_INT_MIN         INT_MIN
136 #  elif (ULONG_MAX >= LZO_0xffffffffL)
137      typedef unsigned long      lzo_uint;
138      typedef long               lzo_int;
139 #    define LZO_UINT_MAX        ULONG_MAX
140 #    define LZO_INT_MAX         LONG_MAX
141 #    define LZO_INT_MIN         LONG_MIN
142 #  else
143 #    error "lzo_uint"
144 #  endif
145 #endif
146 
147 /* Integral types with 32 bits or more. */
148 #if !defined(LZO_UINT32_MAX)
149 #  if (UINT_MAX >= LZO_0xffffffffL)
150      typedef unsigned int       lzo_uint32;
151      typedef int                lzo_int32;
152 #    define LZO_UINT32_MAX      UINT_MAX
153 #    define LZO_INT32_MAX       INT_MAX
154 #    define LZO_INT32_MIN       INT_MIN
155 #  elif (ULONG_MAX >= LZO_0xffffffffL)
156      typedef unsigned long      lzo_uint32;
157      typedef long               lzo_int32;
158 #    define LZO_UINT32_MAX      ULONG_MAX
159 #    define LZO_INT32_MAX       LONG_MAX
160 #    define LZO_INT32_MIN       LONG_MIN
161 #  else
162 #    error "lzo_uint32"
163 #  endif
164 #endif
165 
166 /* The larger type of lzo_uint and lzo_uint32. */
167 #if (LZO_UINT_MAX >= LZO_UINT32_MAX)
168 #  define lzo_xint              lzo_uint
169 #else
170 #  define lzo_xint              lzo_uint32
171 #endif
172 
173 /* Memory model that allows to access memory at offsets of lzo_uint. */
174 #if !defined(__LZO_MMODEL)
175 #  if (LZO_UINT_MAX <= UINT_MAX)
176 #    define __LZO_MMODEL
177 #  elif defined(LZO_HAVE_MM_HUGE_PTR)
178 #    define __LZO_MMODEL_HUGE   1
179 #    define __LZO_MMODEL        __huge
180 #  else
181 #    define __LZO_MMODEL
182 #  endif
183 #endif
184 
185 /* no typedef here because of const-pointer issues */
186 #define lzo_bytep               unsigned char __LZO_MMODEL *
187 #define lzo_charp               char __LZO_MMODEL *
188 #define lzo_voidp               void __LZO_MMODEL *
189 #define lzo_shortp              short __LZO_MMODEL *
190 #define lzo_ushortp             unsigned short __LZO_MMODEL *
191 #define lzo_uint32p             lzo_uint32 __LZO_MMODEL *
192 #define lzo_int32p              lzo_int32 __LZO_MMODEL *
193 #define lzo_uintp               lzo_uint __LZO_MMODEL *
194 #define lzo_intp                lzo_int __LZO_MMODEL *
195 #define lzo_xintp               lzo_xint __LZO_MMODEL *
196 #define lzo_voidpp              lzo_voidp __LZO_MMODEL *
197 #define lzo_bytepp              lzo_bytep __LZO_MMODEL *
198 /* deprecated - use `lzo_bytep' instead of `lzo_byte *' */
199 #define lzo_byte                unsigned char __LZO_MMODEL
200 
201 typedef int lzo_bool;
202 
203 
204 /***********************************************************************
205 // function types
206 ************************************************************************/
207 
208 /* name mangling */
209 #if !defined(__LZO_EXTERN_C)
210 #  ifdef __cplusplus
211 #    define __LZO_EXTERN_C      extern "C"
212 #  else
213 #    define __LZO_EXTERN_C      extern
214 #  endif
215 #endif
216 
217 /* calling convention */
218 #if !defined(__LZO_CDECL)
219 #  define __LZO_CDECL           __lzo_cdecl
220 #endif
221 
222 /* DLL export information */
223 #if !defined(__LZO_EXPORT1)
224 #  define __LZO_EXPORT1
225 #endif
226 #if !defined(__LZO_EXPORT2)
227 #  define __LZO_EXPORT2
228 #endif
229 
230 /* __cdecl calling convention for public C and assembly functions */
231 #if !defined(LZO_PUBLIC)
232 #  define LZO_PUBLIC(_rettype)  __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
233 #endif
234 #if !defined(LZO_EXTERN)
235 #  define LZO_EXTERN(_rettype)  __LZO_EXTERN_C LZO_PUBLIC(_rettype)
236 #endif
237 #if !defined(LZO_PRIVATE)
238 #  define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL
239 #endif
240 
241 /* function types */
242 typedef int
243 (__LZO_CDECL *lzo_compress_t)   ( const lzo_bytep src, lzo_uint  src_len,
244                                         lzo_bytep dst, lzo_uintp dst_len,
245                                         lzo_voidp wrkmem );
246 
247 typedef int
248 (__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint  src_len,
249                                         lzo_bytep dst, lzo_uintp dst_len,
250                                         lzo_voidp wrkmem );
251 
252 typedef int
253 (__LZO_CDECL *lzo_optimize_t)   (       lzo_bytep src, lzo_uint  src_len,
254                                         lzo_bytep dst, lzo_uintp dst_len,
255                                         lzo_voidp wrkmem );
256 
257 typedef int
258 (__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint  src_len,
259                                          lzo_bytep dst, lzo_uintp dst_len,
260                                          lzo_voidp wrkmem,
261                                    const lzo_bytep dict, lzo_uint dict_len );
262 
263 typedef int
264 (__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint  src_len,
265                                            lzo_bytep dst, lzo_uintp dst_len,
266                                            lzo_voidp wrkmem,
267                                      const lzo_bytep dict, lzo_uint dict_len );
268 
269 
270 /* Callback interface. Currently only the progress indicator ("nprogress")
271  * is used, but this may change in a future release. */
272 
273 struct lzo_callback_t;
274 typedef struct lzo_callback_t lzo_callback_t;
275 #define lzo_callback_p lzo_callback_t __LZO_MMODEL *
276 
277 /* malloc & free function types */
278 typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
279     (lzo_callback_p self, lzo_uint items, lzo_uint size);
280 typedef void      (__LZO_CDECL *lzo_free_func_t)
281     (lzo_callback_p self, lzo_voidp ptr);
282 
283 /* a progress indicator callback function */
284 typedef void (__LZO_CDECL *lzo_progress_func_t)
285     (lzo_callback_p, lzo_uint, lzo_uint, int);
286 
287 struct lzo_callback_t
288 {
289     /* custom allocators (set to 0 to disable) */
290     lzo_alloc_func_t nalloc;                /* [not used right now] */
291     lzo_free_func_t nfree;                  /* [not used right now] */
292 
293     /* a progress indicator callback function (set to 0 to disable) */
294     lzo_progress_func_t nprogress;
295 
296     /* NOTE: the first parameter "self" of the nalloc/nfree/nprogress
297      * callbacks points back to this struct, so you are free to store
298      * some extra info in the following variables. */
299     lzo_voidp user1;
300     lzo_xint user2;
301     lzo_xint user3;
302 };
303 
304 
305 /***********************************************************************
306 // error codes and prototypes
307 ************************************************************************/
308 
309 /* Error codes for the compression/decompression functions. Negative
310  * values are errors, positive values will be used for special but
311  * normal events.
312  */
313 #define LZO_E_OK                    0
314 #define LZO_E_ERROR                 (-1)
315 #define LZO_E_OUT_OF_MEMORY         (-2)    /* [not used right now] */
316 #define LZO_E_NOT_COMPRESSIBLE      (-3)    /* [not used right now] */
317 #define LZO_E_INPUT_OVERRUN         (-4)
318 #define LZO_E_OUTPUT_OVERRUN        (-5)
319 #define LZO_E_LOOKBEHIND_OVERRUN    (-6)
320 #define LZO_E_EOF_NOT_FOUND         (-7)
321 #define LZO_E_INPUT_NOT_CONSUMED    (-8)
322 #define LZO_E_NOT_YET_IMPLEMENTED   (-9)    /* [not used right now] */
323 
324 
325 #ifndef lzo_sizeof_dict_t
326 #  define lzo_sizeof_dict_t     ((unsigned)sizeof(lzo_bytep))
327 #endif
328 
329 /* lzo_init() should be the first function you call.
330  * Check the return code !
331  *
332  * lzo_init() is a macro to allow checking that the library and the
333  * compiler's view of various types are consistent.
334  */
335 #define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
336     (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
337     (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
338     (int)sizeof(lzo_callback_t))
339 LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
340 
341 /* version functions (useful for shared libraries) */
342 LZO_EXTERN(unsigned) lzo_version(void);
343 LZO_EXTERN(const char *) lzo_version_string(void);
344 LZO_EXTERN(const char *) lzo_version_date(void);
345 LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
346 LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
347 
348 /* string functions */
349 LZO_EXTERN(int)
350 lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len);
351 LZO_EXTERN(lzo_voidp)
352 lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
353 LZO_EXTERN(lzo_voidp)
354 lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
355 LZO_EXTERN(lzo_voidp)
356 lzo_memset(lzo_voidp _s, int _c, lzo_uint _len);
357 
358 /* checksum functions */
359 LZO_EXTERN(lzo_uint32)
360 lzo_adler32(lzo_uint32 _adler, const lzo_bytep _buf, lzo_uint _len);
361 LZO_EXTERN(lzo_uint32)
362 lzo_crc32(lzo_uint32 _c, const lzo_bytep _buf, lzo_uint _len);
363 LZO_EXTERN(const lzo_uint32p)
364 lzo_get_crc32_table(void);
365 
366 /* misc. */
367 LZO_EXTERN(int) _lzo_config_check(void);
368 typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
369 typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
370 typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t;
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 
378 /***********************************************************************
379 // deprecated macros - only for backward compatibility with LZO v1.xx
380 ************************************************************************/
381 
382 #if defined(LZO_CFG_COMPAT)
383 
384 #define __LZOCONF_H 1
385 
386 #if defined(LZO_ARCH_I086)
387 #  define __LZO_i386 1
388 #elif defined(LZO_ARCH_I386)
389 #  define __LZO_i386 1
390 #endif
391 
392 #if defined(LZO_OS_DOS16)
393 #  define __LZO_DOS 1
394 #  define __LZO_DOS16 1
395 #elif defined(LZO_OS_DOS32)
396 #  define __LZO_DOS 1
397 #elif defined(LZO_OS_WIN16)
398 #  define __LZO_WIN 1
399 #  define __LZO_WIN16 1
400 #elif defined(LZO_OS_WIN32)
401 #  define __LZO_WIN 1
402 #endif
403 
404 #define __LZO_CMODEL
405 #define __LZO_DMODEL
406 #define __LZO_ENTRY             __LZO_CDECL
407 #define LZO_EXTERN_CDECL        LZO_EXTERN
408 #define LZO_ALIGN               LZO_PTR_ALIGN_UP
409 
410 #define lzo_compress_asm_t      lzo_compress_t
411 #define lzo_decompress_asm_t    lzo_decompress_t
412 
413 #endif /* LZO_CFG_COMPAT */
414 
415 
416 #ifdef __cplusplus
417 } /* extern "C" */
418 #endif
419 
420 #endif /* already included */
421 
422 
423 /* vim:set ts=4 et: */
424