|
Odamex
Setting the Standard in Multiplayer Doom
|
00001 // Emacs style mode select -*- C++ -*- 00002 //----------------------------------------------------------------------------- 00003 // 00004 // $Id: lzoconf.h 1084 2008-08-14 02:48:40Z russellrice $ 00005 // 00006 // lzoconf.h -- configuration for the LZO real-time data compression library 00007 // 00008 // This file is part of the LZO real-time data compression library. 00009 // 00010 // Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer 00011 // Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer 00012 // Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer 00013 // Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer 00014 // Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer 00015 // Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer 00016 // Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer 00017 // Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer 00018 // Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer 00019 // Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer 00020 // All Rights Reserved. 00021 // 00022 // The LZO library is free software; you can redistribute it and/or 00023 // modify it under the terms of the GNU General Public License, 00024 // version 2, as published by the Free Software Foundation. 00025 // 00026 // The LZO library is distributed in the hope that it will be useful, 00027 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00028 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00029 // GNU General Public License for more details. 00030 // 00031 // You should have received a copy of the GNU General Public License 00032 // along with the LZO library; see the file COPYING. 00033 // If not, write to the Free Software Foundation, Inc., 00034 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00035 // 00036 // Markus F.X.J. Oberhumer 00037 // <markus@oberhumer.com> 00038 // http://www.oberhumer.com/opensource/lzo/ 00039 // 00040 //----------------------------------------------------------------------------- 00041 00042 00043 #ifndef __LZOCONF_H_INCLUDED 00044 #define __LZOCONF_H_INCLUDED 00045 00046 #define LZO_VERSION 0x2020 00047 #define LZO_VERSION_STRING "2.02" 00048 #define LZO_VERSION_DATE "Oct 17 2005" 00049 00050 /* internal Autoconf configuration file - only used when building LZO */ 00051 #if defined(LZO_HAVE_CONFIG_H) 00052 # include <config.h> 00053 #endif 00054 #include <limits.h> 00055 #include <stddef.h> 00056 00057 00058 /*********************************************************************** 00059 // LZO requires a conforming <limits.h> 00060 ************************************************************************/ 00061 00062 #if !defined(CHAR_BIT) || (CHAR_BIT != 8) 00063 # error "invalid CHAR_BIT" 00064 #endif 00065 #if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX) 00066 # error "check your compiler installation" 00067 #endif 00068 #if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1) 00069 # error "your limits.h macros are broken" 00070 #endif 00071 00072 /* get OS and architecture defines */ 00073 #ifndef __LZODEFS_H_INCLUDED 00074 #include "lzodefs.h" 00075 #endif 00076 00077 00078 #ifdef __cplusplus 00079 extern "C" { 00080 #endif 00081 00082 00083 /*********************************************************************** 00084 // some core defines 00085 ************************************************************************/ 00086 00087 #if !defined(LZO_UINT32_C) 00088 # if (UINT_MAX < LZO_0xffffffffL) 00089 # define LZO_UINT32_C(c) c ## UL 00090 # else 00091 # define LZO_UINT32_C(c) ((c) + 0U) 00092 # endif 00093 #endif 00094 00095 /* memory checkers */ 00096 #if !defined(__LZO_CHECKER) 00097 # if defined(__BOUNDS_CHECKING_ON) 00098 # define __LZO_CHECKER 1 00099 # elif defined(__CHECKER__) 00100 # define __LZO_CHECKER 1 00101 # elif defined(__INSURE__) 00102 # define __LZO_CHECKER 1 00103 # elif defined(__PURIFY__) 00104 # define __LZO_CHECKER 1 00105 # endif 00106 #endif 00107 00108 00109 /*********************************************************************** 00110 // integral and pointer types 00111 ************************************************************************/ 00112 00113 /* lzo_uint should match size_t */ 00114 #if !defined(LZO_UINT_MAX) 00115 # if defined(LZO_ABI_LLP64) /* WIN64 */ 00116 # if defined(LZO_OS_WIN64) 00117 typedef unsigned __int64 lzo_uint; 00118 typedef __int64 lzo_int; 00119 # else 00120 typedef unsigned long long lzo_uint; 00121 typedef long long lzo_int; 00122 # endif 00123 # define LZO_UINT_MAX 0xffffffffffffffffull 00124 # define LZO_INT_MAX 9223372036854775807LL 00125 # define LZO_INT_MIN (-1LL - LZO_INT_MAX) 00126 # elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */ 00127 typedef unsigned int lzo_uint; 00128 typedef int lzo_int; 00129 # define LZO_UINT_MAX UINT_MAX 00130 # define LZO_INT_MAX INT_MAX 00131 # define LZO_INT_MIN INT_MIN 00132 # elif (ULONG_MAX >= LZO_0xffffffffL) 00133 typedef unsigned long lzo_uint; 00134 typedef long lzo_int; 00135 # define LZO_UINT_MAX ULONG_MAX 00136 # define LZO_INT_MAX LONG_MAX 00137 # define LZO_INT_MIN LONG_MIN 00138 # else 00139 # error "lzo_uint" 00140 # endif 00141 #endif 00142 00143 /* Integral types with 32 bits or more. */ 00144 #if !defined(LZO_UINT32_MAX) 00145 # if (UINT_MAX >= LZO_0xffffffffL) 00146 typedef unsigned int lzo_uint32; 00147 typedef int lzo_int32; 00148 # define LZO_UINT32_MAX UINT_MAX 00149 # define LZO_INT32_MAX INT_MAX 00150 # define LZO_INT32_MIN INT_MIN 00151 # elif (ULONG_MAX >= LZO_0xffffffffL) 00152 typedef unsigned long lzo_uint32; 00153 typedef long lzo_int32; 00154 # define LZO_UINT32_MAX ULONG_MAX 00155 # define LZO_INT32_MAX LONG_MAX 00156 # define LZO_INT32_MIN LONG_MIN 00157 # else 00158 # error "lzo_uint32" 00159 # endif 00160 #endif 00161 00162 /* The larger type of lzo_uint and lzo_uint32. */ 00163 #if (LZO_UINT_MAX >= LZO_UINT32_MAX) 00164 # define lzo_xint lzo_uint 00165 #else 00166 # define lzo_xint lzo_uint32 00167 #endif 00168 00169 /* Memory model that allows to access memory at offsets of lzo_uint. */ 00170 #if !defined(__LZO_MMODEL) 00171 # if (LZO_UINT_MAX <= UINT_MAX) 00172 # define __LZO_MMODEL 00173 # elif defined(LZO_HAVE_MM_HUGE_PTR) 00174 # define __LZO_MMODEL_HUGE 1 00175 # define __LZO_MMODEL __huge 00176 # else 00177 # define __LZO_MMODEL 00178 # endif 00179 #endif 00180 00181 /* no typedef here because of const-pointer issues */ 00182 #define lzo_bytep unsigned char __LZO_MMODEL * 00183 #define lzo_charp char __LZO_MMODEL * 00184 #define lzo_voidp void __LZO_MMODEL * 00185 #define lzo_shortp short __LZO_MMODEL * 00186 #define lzo_ushortp unsigned short __LZO_MMODEL * 00187 #define lzo_uint32p lzo_uint32 __LZO_MMODEL * 00188 #define lzo_int32p lzo_int32 __LZO_MMODEL * 00189 #define lzo_uintp lzo_uint __LZO_MMODEL * 00190 #define lzo_intp lzo_int __LZO_MMODEL * 00191 #define lzo_xintp lzo_xint __LZO_MMODEL * 00192 #define lzo_voidpp lzo_voidp __LZO_MMODEL * 00193 #define lzo_bytepp lzo_bytep __LZO_MMODEL * 00194 /* deprecated - use `lzo_bytep' instead of `lzo_byte *' */ 00195 #define lzo_byte unsigned char __LZO_MMODEL 00196 00197 typedef int lzo_bool; 00198 00199 00200 /*********************************************************************** 00201 // function types 00202 ************************************************************************/ 00203 00204 /* name mangling */ 00205 #if !defined(__LZO_EXTERN_C) 00206 # ifdef __cplusplus 00207 # define __LZO_EXTERN_C extern "C" 00208 # else 00209 # define __LZO_EXTERN_C extern 00210 # endif 00211 #endif 00212 00213 /* calling convention */ 00214 #if !defined(__LZO_CDECL) 00215 # define __LZO_CDECL __lzo_cdecl 00216 #endif 00217 00218 /* DLL export information */ 00219 #if !defined(__LZO_EXPORT1) 00220 # define __LZO_EXPORT1 00221 #endif 00222 #if !defined(__LZO_EXPORT2) 00223 # define __LZO_EXPORT2 00224 #endif 00225 00226 /* __cdecl calling convention for public C and assembly functions */ 00227 #if !defined(LZO_PUBLIC) 00228 # define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL 00229 #endif 00230 #if !defined(LZO_EXTERN) 00231 # define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype) 00232 #endif 00233 #if !defined(LZO_PRIVATE) 00234 # define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL 00235 #endif 00236 00237 /* function types */ 00238 typedef int 00239 (__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len, 00240 lzo_bytep dst, lzo_uintp dst_len, 00241 lzo_voidp wrkmem ); 00242 00243 typedef int 00244 (__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len, 00245 lzo_bytep dst, lzo_uintp dst_len, 00246 lzo_voidp wrkmem ); 00247 00248 typedef int 00249 (__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len, 00250 lzo_bytep dst, lzo_uintp dst_len, 00251 lzo_voidp wrkmem ); 00252 00253 typedef int 00254 (__LZO_CDECL *lzo_compress_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 typedef int 00260 (__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len, 00261 lzo_bytep dst, lzo_uintp dst_len, 00262 lzo_voidp wrkmem, 00263 const lzo_bytep dict, lzo_uint dict_len ); 00264 00265 00266 /* Callback interface. Currently only the progress indicator ("nprogress") 00267 * is used, but this may change in a future release. */ 00268 00269 struct lzo_callback_t; 00270 typedef struct lzo_callback_t lzo_callback_t; 00271 #define lzo_callback_p lzo_callback_t __LZO_MMODEL * 00272 00273 /* malloc & free function types */ 00274 typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t) 00275 (lzo_callback_p self, lzo_uint items, lzo_uint size); 00276 typedef void (__LZO_CDECL *lzo_free_func_t) 00277 (lzo_callback_p self, lzo_voidp ptr); 00278 00279 /* a progress indicator callback function */ 00280 typedef void (__LZO_CDECL *lzo_progress_func_t) 00281 (lzo_callback_p, lzo_uint, lzo_uint, int); 00282 00283 struct lzo_callback_t 00284 { 00285 /* custom allocators (set to 0 to disable) */ 00286 lzo_alloc_func_t nalloc; /* [not used right now] */ 00287 lzo_free_func_t nfree; /* [not used right now] */ 00288 00289 /* a progress indicator callback function (set to 0 to disable) */ 00290 lzo_progress_func_t nprogress; 00291 00292 /* NOTE: the first parameter "self" of the nalloc/nfree/nprogress 00293 * callbacks points back to this struct, so you are free to store 00294 * some extra info in the following variables. */ 00295 lzo_voidp user1; 00296 lzo_xint user2; 00297 lzo_xint user3; 00298 }; 00299 00300 00301 /*********************************************************************** 00302 // error codes and prototypes 00303 ************************************************************************/ 00304 00305 /* Error codes for the compression/decompression functions. Negative 00306 * values are errors, positive values will be used for special but 00307 * normal events. 00308 */ 00309 #define LZO_E_OK 0 00310 #define LZO_E_ERROR (-1) 00311 #define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */ 00312 #define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */ 00313 #define LZO_E_INPUT_OVERRUN (-4) 00314 #define LZO_E_OUTPUT_OVERRUN (-5) 00315 #define LZO_E_LOOKBEHIND_OVERRUN (-6) 00316 #define LZO_E_EOF_NOT_FOUND (-7) 00317 #define LZO_E_INPUT_NOT_CONSUMED (-8) 00318 #define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */ 00319 00320 00321 #ifndef lzo_sizeof_dict_t 00322 # define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep)) 00323 #endif 00324 00325 /* lzo_init() should be the first function you call. 00326 * Check the return code ! 00327 * 00328 * lzo_init() is a macro to allow checking that the library and the 00329 * compiler's view of various types are consistent. 00330 */ 00331 #define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\ 00332 (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\ 00333 (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\ 00334 (int)sizeof(lzo_callback_t)) 00335 LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int); 00336 00337 /* version functions (useful for shared libraries) */ 00338 LZO_EXTERN(unsigned) lzo_version(void); 00339 LZO_EXTERN(const char *) lzo_version_string(void); 00340 LZO_EXTERN(const char *) lzo_version_date(void); 00341 LZO_EXTERN(const lzo_charp) _lzo_version_string(void); 00342 LZO_EXTERN(const lzo_charp) _lzo_version_date(void); 00343 00344 /* string functions */ 00345 LZO_EXTERN(int) 00346 lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len); 00347 LZO_EXTERN(lzo_voidp) 00348 lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len); 00349 LZO_EXTERN(lzo_voidp) 00350 lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len); 00351 LZO_EXTERN(lzo_voidp) 00352 lzo_memset(lzo_voidp _s, int _c, lzo_uint _len); 00353 00354 /* checksum functions */ 00355 LZO_EXTERN(lzo_uint32) 00356 lzo_adler32(lzo_uint32 _adler, const lzo_bytep _buf, lzo_uint _len); 00357 LZO_EXTERN(lzo_uint32) 00358 lzo_crc32(lzo_uint32 _c, const lzo_bytep _buf, lzo_uint _len); 00359 LZO_EXTERN(const lzo_uint32p) 00360 lzo_get_crc32_table(void); 00361 00362 /* misc. */ 00363 LZO_EXTERN(int) _lzo_config_check(void); 00364 typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u; 00365 typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u; 00366 typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t; 00367 00368 /* align a char pointer on a boundary that is a multiple of `size' */ 00369 LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size); 00370 #define LZO_PTR_ALIGN_UP(_ptr,_size) \ 00371 ((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size))) 00372 00373 00374 /*********************************************************************** 00375 // deprecated macros - only for backward compatibility with LZO v1.xx 00376 ************************************************************************/ 00377 00378 #if defined(LZO_CFG_COMPAT) 00379 00380 #define __LZOCONF_H 1 00381 00382 #if defined(LZO_ARCH_I086) 00383 # define __LZO_i386 1 00384 #elif defined(LZO_ARCH_I386) 00385 # define __LZO_i386 1 00386 #endif 00387 00388 #if defined(LZO_OS_DOS16) 00389 # define __LZO_DOS 1 00390 # define __LZO_DOS16 1 00391 #elif defined(LZO_OS_DOS32) 00392 # define __LZO_DOS 1 00393 #elif defined(LZO_OS_WIN16) 00394 # define __LZO_WIN 1 00395 # define __LZO_WIN16 1 00396 #elif defined(LZO_OS_WIN32) 00397 # define __LZO_WIN 1 00398 #endif 00399 00400 #define __LZO_CMODEL 00401 #define __LZO_DMODEL 00402 #define __LZO_ENTRY __LZO_CDECL 00403 #define LZO_EXTERN_CDECL LZO_EXTERN 00404 #define LZO_ALIGN LZO_PTR_ALIGN_UP 00405 00406 #define lzo_compress_asm_t lzo_compress_t 00407 #define lzo_decompress_asm_t lzo_decompress_t 00408 00409 #endif /* LZO_CFG_COMPAT */ 00410 00411 00412 #ifdef __cplusplus 00413 } /* extern "C" */ 00414 #endif 00415 00416 #endif /* already included */ 00417 00418 00419 /* vim:set ts=4 et: */