00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef __LZOCONF_H_INCLUDED
00038 #define __LZOCONF_H_INCLUDED
00039
00040 #define LZO_VERSION 0x2020
00041 #define LZO_VERSION_STRING "2.02"
00042 #define LZO_VERSION_DATE "Oct 17 2005"
00043
00044
00045 #if defined(LZO_HAVE_CONFIG_H)
00046 # include <config.h>
00047 #endif
00048 #include <limits.h>
00049 #include <stddef.h>
00050
00051
00052
00053
00054
00055
00056 #if !defined(CHAR_BIT) || (CHAR_BIT != 8)
00057 # error "invalid CHAR_BIT"
00058 #endif
00059 #if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
00060 # error "check your compiler installation"
00061 #endif
00062 #if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
00063 # error "your limits.h macros are broken"
00064 #endif
00065
00066
00067 #ifndef __LZODEFS_H_INCLUDED
00068 #include "lzodefs.h"
00069 #endif
00070
00071
00072 #ifdef __cplusplus
00073 extern "C" {
00074 #endif
00075
00076
00077
00078
00079
00080
00081 #if !defined(LZO_UINT32_C)
00082 # if (UINT_MAX < LZO_0xffffffffL)
00083 # define LZO_UINT32_C(c) c ## UL
00084 # else
00085 # define LZO_UINT32_C(c) ((c) + 0U)
00086 # endif
00087 #endif
00088
00089
00090 #if !defined(__LZO_CHECKER)
00091 # if defined(__BOUNDS_CHECKING_ON)
00092 # define __LZO_CHECKER 1
00093 # elif defined(__CHECKER__)
00094 # define __LZO_CHECKER 1
00095 # elif defined(__INSURE__)
00096 # define __LZO_CHECKER 1
00097 # elif defined(__PURIFY__)
00098 # define __LZO_CHECKER 1
00099 # endif
00100 #endif
00101
00102
00103
00104
00105
00106
00107
00108 #if !defined(LZO_UINT_MAX)
00109 # if defined(LZO_ABI_LLP64)
00110 # if defined(LZO_OS_WIN64)
00111 typedef unsigned __int64 lzo_uint;
00112 typedef __int64 lzo_int;
00113 # else
00114 typedef unsigned long long lzo_uint;
00115 typedef long long lzo_int;
00116 # endif
00117 # define LZO_UINT_MAX 0xffffffffffffffffull
00118 # define LZO_INT_MAX 9223372036854775807LL
00119 # define LZO_INT_MIN (-1LL - LZO_INT_MAX)
00120 # elif defined(LZO_ABI_IP32L64)
00121 typedef unsigned int lzo_uint;
00122 typedef int lzo_int;
00123 # define LZO_UINT_MAX UINT_MAX
00124 # define LZO_INT_MAX INT_MAX
00125 # define LZO_INT_MIN INT_MIN
00126 # elif (ULONG_MAX >= LZO_0xffffffffL)
00127 typedef unsigned long lzo_uint;
00128 typedef long lzo_int;
00129 # define LZO_UINT_MAX ULONG_MAX
00130 # define LZO_INT_MAX LONG_MAX
00131 # define LZO_INT_MIN LONG_MIN
00132 # else
00133 # error "lzo_uint"
00134 # endif
00135 #endif
00136
00137
00138 #if !defined(LZO_UINT32_MAX)
00139 # if (UINT_MAX >= LZO_0xffffffffL)
00140 typedef unsigned int lzo_uint32;
00141 typedef int lzo_int32;
00142 # define LZO_UINT32_MAX UINT_MAX
00143 # define LZO_INT32_MAX INT_MAX
00144 # define LZO_INT32_MIN INT_MIN
00145 # elif (ULONG_MAX >= LZO_0xffffffffL)
00146 typedef unsigned long lzo_uint32;
00147 typedef long lzo_int32;
00148 # define LZO_UINT32_MAX ULONG_MAX
00149 # define LZO_INT32_MAX LONG_MAX
00150 # define LZO_INT32_MIN LONG_MIN
00151 # else
00152 # error "lzo_uint32"
00153 # endif
00154 #endif
00155
00156
00157 #if (LZO_UINT_MAX >= LZO_UINT32_MAX)
00158 # define lzo_xint lzo_uint
00159 #else
00160 # define lzo_xint lzo_uint32
00161 #endif
00162
00163
00164 #if !defined(__LZO_MMODEL)
00165 # if (LZO_UINT_MAX <= UINT_MAX)
00166 # define __LZO_MMODEL
00167 # elif defined(LZO_HAVE_MM_HUGE_PTR)
00168 # define __LZO_MMODEL_HUGE 1
00169 # define __LZO_MMODEL __huge
00170 # else
00171 # define __LZO_MMODEL
00172 # endif
00173 #endif
00174
00175
00176 #define lzo_bytep unsigned char __LZO_MMODEL *
00177 #define lzo_charp char __LZO_MMODEL *
00178 #define lzo_voidp void __LZO_MMODEL *
00179 #define lzo_shortp short __LZO_MMODEL *
00180 #define lzo_ushortp unsigned short __LZO_MMODEL *
00181 #define lzo_uint32p lzo_uint32 __LZO_MMODEL *
00182 #define lzo_int32p lzo_int32 __LZO_MMODEL *
00183 #define lzo_uintp lzo_uint __LZO_MMODEL *
00184 #define lzo_intp lzo_int __LZO_MMODEL *
00185 #define lzo_xintp lzo_xint __LZO_MMODEL *
00186 #define lzo_voidpp lzo_voidp __LZO_MMODEL *
00187 #define lzo_bytepp lzo_bytep __LZO_MMODEL *
00188
00189 #define lzo_byte unsigned char __LZO_MMODEL
00190
00191 typedef int lzo_bool;
00192
00193
00194
00195
00196
00197
00198
00199 #if !defined(__LZO_EXTERN_C)
00200 # ifdef __cplusplus
00201 # define __LZO_EXTERN_C extern "C"
00202 # else
00203 # define __LZO_EXTERN_C extern
00204 # endif
00205 #endif
00206
00207
00208 #if !defined(__LZO_CDECL)
00209 # define __LZO_CDECL __lzo_cdecl
00210 #endif
00211
00212
00213 #if !defined(__LZO_EXPORT1)
00214 # define __LZO_EXPORT1
00215 #endif
00216 #if !defined(__LZO_EXPORT2)
00217 # define __LZO_EXPORT2
00218 #endif
00219
00220
00221 #if !defined(LZO_PUBLIC)
00222 # define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
00223 #endif
00224 #if !defined(LZO_EXTERN)
00225 # define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
00226 #endif
00227 #if !defined(LZO_PRIVATE)
00228 # define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL
00229 #endif
00230
00231
00232 typedef int
00233 (__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len,
00234 lzo_bytep dst, lzo_uintp dst_len,
00235 lzo_voidp wrkmem );
00236
00237 typedef int
00238 (__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len,
00239 lzo_bytep dst, lzo_uintp dst_len,
00240 lzo_voidp wrkmem );
00241
00242 typedef int
00243 (__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len,
00244 lzo_bytep dst, lzo_uintp dst_len,
00245 lzo_voidp wrkmem );
00246
00247 typedef int
00248 (__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len,
00249 lzo_bytep dst, lzo_uintp dst_len,
00250 lzo_voidp wrkmem,
00251 const lzo_bytep dict, lzo_uint dict_len );
00252
00253 typedef int
00254 (__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len,
00255 lzo_bytep dst, lzo_uintp dst_len,
00256 lzo_voidp wrkmem,
00257 const lzo_bytep dict, lzo_uint dict_len );
00258
00259
00260
00261
00262
00263 struct lzo_callback_t;
00264 typedef struct lzo_callback_t lzo_callback_t;
00265 #define lzo_callback_p lzo_callback_t __LZO_MMODEL *
00266
00267
00268 typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
00269 (lzo_callback_p self, lzo_uint items, lzo_uint size);
00270 typedef void (__LZO_CDECL *lzo_free_func_t)
00271 (lzo_callback_p self, lzo_voidp ptr);
00272
00273
00274 typedef void (__LZO_CDECL *lzo_progress_func_t)
00275 (lzo_callback_p, lzo_uint, lzo_uint, int);
00276
00277 struct lzo_callback_t
00278 {
00279
00280 lzo_alloc_func_t nalloc;
00281 lzo_free_func_t nfree;
00282
00283
00284 lzo_progress_func_t nprogress;
00285
00286
00287
00288
00289 lzo_voidp user1;
00290 lzo_xint user2;
00291 lzo_xint user3;
00292 };
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303 #define LZO_E_OK 0
00304 #define LZO_E_ERROR (-1)
00305 #define LZO_E_OUT_OF_MEMORY (-2)
00306 #define LZO_E_NOT_COMPRESSIBLE (-3)
00307 #define LZO_E_INPUT_OVERRUN (-4)
00308 #define LZO_E_OUTPUT_OVERRUN (-5)
00309 #define LZO_E_LOOKBEHIND_OVERRUN (-6)
00310 #define LZO_E_EOF_NOT_FOUND (-7)
00311 #define LZO_E_INPUT_NOT_CONSUMED (-8)
00312 #define LZO_E_NOT_YET_IMPLEMENTED (-9)
00313
00314
00315 #ifndef lzo_sizeof_dict_t
00316 # define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep))
00317 #endif
00318
00319
00320
00321
00322
00323
00324
00325 #define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
00326 (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
00327 (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
00328 (int)sizeof(lzo_callback_t))
00329 LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
00330
00331
00332 LZO_EXTERN(unsigned) lzo_version(void);
00333 LZO_EXTERN(const char *) lzo_version_string(void);
00334 LZO_EXTERN(const char *) lzo_version_date(void);
00335 LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
00336 LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
00337
00338
00339 LZO_EXTERN(int)
00340 lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len);
00341 LZO_EXTERN(lzo_voidp)
00342 lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
00343 LZO_EXTERN(lzo_voidp)
00344 lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
00345 LZO_EXTERN(lzo_voidp)
00346 lzo_memset(lzo_voidp _s, int _c, lzo_uint _len);
00347
00348
00349 LZO_EXTERN(lzo_uint32)
00350 lzo_adler32(lzo_uint32 _adler, const lzo_bytep _buf, lzo_uint _len);
00351 LZO_EXTERN(lzo_uint32)
00352 lzo_crc32(lzo_uint32 _c, const lzo_bytep _buf, lzo_uint _len);
00353 LZO_EXTERN(const lzo_uint32p)
00354 lzo_get_crc32_table(void);
00355
00356
00357 LZO_EXTERN(int) _lzo_config_check(void);
00358 typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
00359 typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
00360 typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t;
00361
00362
00363 LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size);
00364 #define LZO_PTR_ALIGN_UP(_ptr,_size) \
00365 ((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size)))
00366
00367
00368
00369
00370
00371
00372 #if defined(LZO_CFG_COMPAT)
00373
00374 #define __LZOCONF_H 1
00375
00376 #if defined(LZO_ARCH_I086)
00377 # define __LZO_i386 1
00378 #elif defined(LZO_ARCH_I386)
00379 # define __LZO_i386 1
00380 #endif
00381
00382 #if defined(LZO_OS_DOS16)
00383 # define __LZO_DOS 1
00384 # define __LZO_DOS16 1
00385 #elif defined(LZO_OS_DOS32)
00386 # define __LZO_DOS 1
00387 #elif defined(LZO_OS_WIN16)
00388 # define __LZO_WIN 1
00389 # define __LZO_WIN16 1
00390 #elif defined(LZO_OS_WIN32)
00391 # define __LZO_WIN 1
00392 #endif
00393
00394 #define __LZO_CMODEL
00395 #define __LZO_DMODEL
00396 #define __LZO_ENTRY __LZO_CDECL
00397 #define LZO_EXTERN_CDECL LZO_EXTERN
00398 #define LZO_ALIGN LZO_PTR_ALIGN_UP
00399
00400 #define lzo_compress_asm_t lzo_compress_t
00401 #define lzo_decompress_asm_t lzo_decompress_t
00402
00403 #endif
00404
00405
00406 #ifdef __cplusplus
00407 }
00408 #endif
00409
00410 #endif
00411
00412
00413