00001
00002
00036 #ifndef LZOCONF_H
00037 #define LZOCONF_H
00038
00039 #define LZO_VERSION 0x1080
00040 #define LZO_VERSION_STRING "1.08"
00041 #define LZO_VERSION_DATE "Jul 12 2002"
00042
00043
00044 #if defined(LZO_HAVE_CONFIG_H)
00045 # include <config.h>
00046 #endif
00047 #include <limits.h>
00048
00049 #ifdef __cplusplus
00050 extern "C" {
00051 #endif
00052
00053
00054
00055
00056
00057
00058 #if !defined(CHAR_BIT) || (CHAR_BIT != 8)
00059 # error "invalid CHAR_BIT"
00060 #endif
00061 #if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
00062 # error "check your compiler installation"
00063 #endif
00064 #if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
00065 # error "your limits.h macros are broken"
00066 #endif
00067
00068
00069 #define LZO_0xffffffffL 4294967295ul
00070
00071 #if !defined(LZO_UINT32_C)
00072 # if (UINT_MAX < LZO_0xffffffffL)
00073 # define LZO_UINT32_C(c) c ## UL
00074 # else
00075 # define LZO_UINT32_C(c) c ## U
00076 # endif
00077 #endif
00078
00079
00080
00081
00082
00083
00084 #if !defined(__LZO_WIN) && !defined(__LZO_DOS) && !defined(__LZO_OS2)
00085 # if defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows)
00086 # define __LZO_WIN
00087 # elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
00088 # define __LZO_WIN
00089 # elif defined(__NT__) || defined(__NT_DLL__) || defined(__WINDOWS_386__)
00090 # define __LZO_WIN
00091 # elif defined(__DOS__) || defined(__MSDOS__) || defined(MSDOS)
00092 # define __LZO_DOS
00093 # elif defined(__OS2__) || defined(__OS2V2__) || defined(OS2)
00094 # define __LZO_OS2
00095 # elif defined(__palmos__)
00096 # define __LZO_PALMOS
00097 # elif defined(__TOS__) || defined(__atarist__)
00098 # define __LZO_TOS
00099 # endif
00100 #endif
00101
00102 #if (UINT_MAX < LZO_0xffffffffL)
00103 # if defined(__LZO_WIN)
00104 # define __LZO_WIN16
00105 # elif defined(__LZO_DOS)
00106 # define __LZO_DOS16
00107 # elif defined(__LZO_PALMOS)
00108 # define __LZO_PALMOS16
00109 # elif defined(__LZO_TOS)
00110 # define __LZO_TOS16
00111 # elif defined(__C166__)
00112 # else
00113
00114
00115 # error "16-bit target not supported - contact me for porting hints"
00116 # endif
00117 #endif
00118
00119 #if !defined(__LZO_i386)
00120 # if defined(__LZO_DOS) || defined(__LZO_WIN16)
00121 # define __LZO_i386
00122 # elif defined(__i386__) || defined(__386__) || defined(_M_IX86)
00123 # define __LZO_i386
00124 # endif
00125 #endif
00126
00127 #if defined(__LZO_STRICT_16BIT)
00128 # if (UINT_MAX < LZO_0xffffffffL)
00129 # include <lzo16bit.h>
00130 # endif
00131 #endif
00132
00133
00134 #if !defined(__LZO_CHECKER)
00135 # if defined(__BOUNDS_CHECKING_ON)
00136 # define __LZO_CHECKER
00137 # elif defined(__CHECKER__)
00138 # define __LZO_CHECKER
00139 # elif defined(__INSURE__)
00140 # define __LZO_CHECKER
00141 # elif defined(__PURIFY__)
00142 # define __LZO_CHECKER
00143 # endif
00144 #endif
00145
00146
00147
00148
00149
00150
00151
00152 #if !defined(LZO_UINT32_MAX)
00153 # if (UINT_MAX >= LZO_0xffffffffL)
00154 typedef unsigned int lzo_uint32;
00155 typedef int lzo_int32;
00156 # define LZO_UINT32_MAX UINT_MAX
00157 # define LZO_INT32_MAX INT_MAX
00158 # define LZO_INT32_MIN INT_MIN
00159 # elif (ULONG_MAX >= LZO_0xffffffffL)
00160 typedef unsigned long lzo_uint32;
00161 typedef long lzo_int32;
00162 # define LZO_UINT32_MAX ULONG_MAX
00163 # define LZO_INT32_MAX LONG_MAX
00164 # define LZO_INT32_MIN LONG_MIN
00165 # else
00166 # error "lzo_uint32"
00167 # endif
00168 #endif
00169
00170
00171 #if !defined(LZO_UINT_MAX)
00172 # if (UINT_MAX >= LZO_0xffffffffL)
00173 typedef unsigned int lzo_uint;
00174 typedef int lzo_int;
00175 # define LZO_UINT_MAX UINT_MAX
00176 # define LZO_INT_MAX INT_MAX
00177 # define LZO_INT_MIN INT_MIN
00178 # elif (ULONG_MAX >= LZO_0xffffffffL)
00179 typedef unsigned long lzo_uint;
00180 typedef long lzo_int;
00181 # define LZO_UINT_MAX ULONG_MAX
00182 # define LZO_INT_MAX LONG_MAX
00183 # define LZO_INT_MIN LONG_MIN
00184 # else
00185 # error "lzo_uint"
00186 # endif
00187 #endif
00188
00189 typedef int lzo_bool;
00190
00191
00192
00193
00194
00195
00196
00197 #if !defined(__LZO_CMODEL)
00198 # if defined(__LZO_DOS16) || defined(__LZO_WIN16)
00199 # define __LZO_CMODEL __far
00200 # elif defined(__LZO_i386) && defined(__WATCOMC__)
00201 # define __LZO_CMODEL __near
00202 # else
00203 # define __LZO_CMODEL
00204 # endif
00205 #endif
00206
00207
00208 #if !defined(__LZO_DMODEL)
00209 # if defined(__LZO_DOS16) || defined(__LZO_WIN16)
00210 # define __LZO_DMODEL __far
00211 # elif defined(__LZO_i386) && defined(__WATCOMC__)
00212 # define __LZO_DMODEL __near
00213 # else
00214 # define __LZO_DMODEL
00215 # endif
00216 #endif
00217
00218
00219 #if !defined(__LZO_MMODEL)
00220 # if (LZO_UINT_MAX <= UINT_MAX)
00221 # define __LZO_MMODEL
00222 # elif defined(__LZO_DOS16) || defined(__LZO_WIN16)
00223 # define __LZO_MMODEL __huge
00224 # define LZO_999_UNSUPPORTED
00225 # elif defined(__LZO_PALMOS16) || defined(__LZO_TOS16)
00226 # define __LZO_MMODEL
00227 # else
00228 # error "__LZO_MMODEL"
00229 # endif
00230 #endif
00231
00232
00233 #define lzo_byte unsigned char __LZO_MMODEL
00234 #define lzo_bytep unsigned char __LZO_MMODEL *
00235 #define lzo_charp char __LZO_MMODEL *
00236 #define lzo_voidp void __LZO_MMODEL *
00237 #define lzo_shortp short __LZO_MMODEL *
00238 #define lzo_ushortp unsigned short __LZO_MMODEL *
00239 #define lzo_uint32p lzo_uint32 __LZO_MMODEL *
00240 #define lzo_int32p lzo_int32 __LZO_MMODEL *
00241 #define lzo_uintp lzo_uint __LZO_MMODEL *
00242 #define lzo_intp lzo_int __LZO_MMODEL *
00243 #define lzo_voidpp lzo_voidp __LZO_MMODEL *
00244 #define lzo_bytepp lzo_bytep __LZO_MMODEL *
00245
00246 #ifndef lzo_sizeof_dict_t
00247 # define lzo_sizeof_dict_t sizeof(lzo_bytep)
00248 #endif
00249
00250
00251
00252
00253
00254
00255
00256 #if !defined(__LZO_EXTERN_C)
00257 # ifdef __cplusplus
00258 # define __LZO_EXTERN_C extern "C"
00259 # else
00260 # define __LZO_EXTERN_C extern
00261 # endif
00262 #endif
00263
00264
00265 #if !defined(__LZO_CDECL)
00266 # if defined(__LZO_DOS16) || defined(__LZO_WIN16)
00267 # define __LZO_CDECL __LZO_CMODEL __cdecl
00268 # elif defined(__LZO_i386) && defined(_MSC_VER)
00269 # define __LZO_CDECL __LZO_CMODEL __cdecl
00270 # elif defined(__LZO_i386) && defined(__WATCOMC__)
00271 # define __LZO_CDECL __LZO_CMODEL __cdecl
00272 # else
00273 # define __LZO_CDECL __LZO_CMODEL
00274 # endif
00275 #endif
00276 #if !defined(__LZO_ENTRY)
00277 # define __LZO_ENTRY __LZO_CDECL
00278 #endif
00279
00280
00281 #if !defined(__cplusplus)
00282 # undef LZO_NOTHROW
00283 # define LZO_NOTHROW
00284 #elif !defined(LZO_NOTHROW)
00285 # define LZO_NOTHROW
00286 #endif
00287
00288
00289 typedef int
00290 (__LZO_ENTRY *lzo_compress_t) ( const lzo_byte *src, lzo_uint src_len,
00291 lzo_byte *dst, lzo_uintp dst_len,
00292 lzo_voidp wrkmem );
00293
00294 typedef int
00295 (__LZO_ENTRY *lzo_decompress_t) ( const lzo_byte *src, lzo_uint src_len,
00296 lzo_byte *dst, lzo_uintp dst_len,
00297 lzo_voidp wrkmem );
00298
00299 typedef int
00300 (__LZO_ENTRY *lzo_optimize_t) ( lzo_byte *src, lzo_uint src_len,
00301 lzo_byte *dst, lzo_uintp dst_len,
00302 lzo_voidp wrkmem );
00303
00304 typedef int
00305 (__LZO_ENTRY *lzo_compress_dict_t)(const lzo_byte *src, lzo_uint src_len,
00306 lzo_byte *dst, lzo_uintp dst_len,
00307 lzo_voidp wrkmem,
00308 const lzo_byte *dict, lzo_uint dict_len );
00309
00310 typedef int
00311 (__LZO_ENTRY *lzo_decompress_dict_t)(const lzo_byte *src, lzo_uint src_len,
00312 lzo_byte *dst, lzo_uintp dst_len,
00313 lzo_voidp wrkmem,
00314 const lzo_byte *dict, lzo_uint dict_len );
00315
00316
00317
00318 typedef int
00319 (__LZO_CDECL *lzo_compress_asm_t)( const lzo_byte *src, lzo_uint src_len,
00320 lzo_byte *dst, lzo_uintp dst_len,
00321 lzo_voidp wrkmem );
00322
00323 typedef int
00324 (__LZO_CDECL *lzo_decompress_asm_t)( const lzo_byte *src, lzo_uint src_len,
00325 lzo_byte *dst, lzo_uintp dst_len,
00326 lzo_voidp wrkmem );
00327
00328
00329
00330 typedef void (__LZO_ENTRY *lzo_progress_callback_t) (lzo_uint, lzo_uint);
00331
00332
00333
00334
00335
00336
00337
00338 #if !defined(__LZO_EXPORT1)
00339 # define __LZO_EXPORT1
00340 #endif
00341 #if !defined(__LZO_EXPORT2)
00342 # define __LZO_EXPORT2
00343 #endif
00344
00345
00346 #if !defined(LZO_PUBLIC)
00347 # define LZO_PUBLIC(_rettype) \
00348 __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_ENTRY
00349 #endif
00350 #if !defined(LZO_EXTERN)
00351 # define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
00352 #endif
00353 #if !defined(LZO_PRIVATE)
00354 # define LZO_PRIVATE(_rettype) static _rettype __LZO_ENTRY
00355 #endif
00356
00357
00358 #if !defined(LZO_PUBLIC_CDECL)
00359 # define LZO_PUBLIC_CDECL(_rettype) \
00360 __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
00361 #endif
00362 #if !defined(LZO_EXTERN_CDECL)
00363 # define LZO_EXTERN_CDECL(_rettype) __LZO_EXTERN_C LZO_PUBLIC_CDECL(_rettype)
00364 #endif
00365
00366
00367
00368 #if !defined(LZO_PUBLIC_VAR)
00369 # define LZO_PUBLIC_VAR(_type) \
00370 __LZO_EXPORT1 _type __LZO_EXPORT2 __LZO_DMODEL
00371 #endif
00372 #if !defined(LZO_EXTERN_VAR)
00373 # define LZO_EXTERN_VAR(_type) extern LZO_PUBLIC_VAR(_type)
00374 #endif
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385 #define LZO_E_OK 0
00386 #define LZO_E_ERROR (-1)
00387 #define LZO_E_OUT_OF_MEMORY (-2)
00388 #define LZO_E_NOT_COMPRESSIBLE (-3)
00389 #define LZO_E_INPUT_OVERRUN (-4)
00390 #define LZO_E_OUTPUT_OVERRUN (-5)
00391 #define LZO_E_LOOKBEHIND_OVERRUN (-6)
00392 #define LZO_E_EOF_NOT_FOUND (-7)
00393 #define LZO_E_INPUT_NOT_CONSUMED (-8)
00394
00395
00396
00397
00398
00399
00400
00401
00402 #define lzo_init() __lzo_init2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
00403 (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
00404 (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
00405 (int)sizeof(lzo_compress_t))
00406 LZO_EXTERN(int) __lzo_init2(unsigned,int,int,int,int,int,int,int,int,int);
00407
00408
00409 LZO_EXTERN(unsigned) lzo_version();
00410 LZO_EXTERN(const char *) lzo_version_string();
00411 LZO_EXTERN(const char *) lzo_version_date();
00412 LZO_EXTERN(const lzo_charp) _lzo_version_string();
00413 LZO_EXTERN(const lzo_charp) _lzo_version_date();
00414
00415
00416 LZO_EXTERN(int)
00417 lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len);
00418 LZO_EXTERN(lzo_voidp)
00419 lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
00420 LZO_EXTERN(lzo_voidp)
00421 lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
00422 LZO_EXTERN(lzo_voidp)
00423 lzo_memset(lzo_voidp _s, int _c, lzo_uint _len);
00424
00425
00426 LZO_EXTERN(lzo_uint32)
00427 lzo_adler32(lzo_uint32 _adler, const lzo_byte *_buf, lzo_uint _len);
00428 LZO_EXTERN(lzo_uint32)
00429 lzo_crc32(lzo_uint32 _c, const lzo_byte *_buf, lzo_uint _len);
00430
00431
00432 LZO_EXTERN(lzo_bool) lzo_assert(int _expr);
00433 LZO_EXTERN(int) _lzo_config_check();
00434 typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
00435 typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
00436 typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t;
00437
00438
00439 LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size);
00440 #define LZO_PTR_ALIGN_UP(_ptr,_size) \
00441 ((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size)))
00442
00443
00444 #define LZO_ALIGN(_ptr,_size) LZO_PTR_ALIGN_UP(_ptr,_size)
00445
00446
00447 #ifdef __cplusplus
00448 }
00449 #endif
00450
00451 #endif