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