Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

lzoconf.h

Go to the documentation of this file.
00001 /* lzoconf.h -- configuration for the LZO real-time data compression library
00002 
00003    This file is part of the LZO real-time data compression library.
00004 
00005    Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
00006    Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
00007    Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
00008    Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
00009    Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
00010    Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
00011    Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
00012    All Rights Reserved.
00013 
00014    The LZO library is free software; you can redistribute it and/or
00015    modify it under the terms of the GNU General Public License as
00016    published by the Free Software Foundation; either version 2 of
00017    the License, or (at your option) any later version.
00018 
00019    The LZO library is distributed in the hope that it will be useful,
00020    but WITHOUT ANY WARRANTY; without even the implied warranty of
00021    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022    GNU General Public License for more details.
00023 
00024    You should have received a copy of the GNU General Public License
00025    along with the LZO library; see the file COPYING.
00026    If not, write to the Free Software Foundation, Inc.,
00027    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00028 
00029    Markus F.X.J. Oberhumer
00030    <markus@oberhumer.com>
00031    http://www.oberhumer.com/opensource/lzo/
00032  */
00033 
00034 
00035 #ifndef __LZOCONF_H
00036 #define __LZOCONF_H
00037 
00038 #define LZO_VERSION             0x1080
00039 #define LZO_VERSION_STRING      "1.08"
00040 #define LZO_VERSION_DATE        "Jul 12 2002"
00041 
00042 /* internal Autoconf configuration file - only used when building LZO */
00043 #if defined(LZO_HAVE_CONFIG_H)
00044 #  include <config.h>
00045 #endif
00046 #include <limits.h>
00047 
00048 #ifdef __cplusplus
00049 extern "C" {
00050 #endif
00051 
00052 
00053 /***********************************************************************
00054 // LZO requires a conforming <limits.h>
00055 ************************************************************************/
00056 
00057 #if !defined(CHAR_BIT) || (CHAR_BIT != 8)
00058 #  error "invalid CHAR_BIT"
00059 #endif
00060 #if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
00061 #  error "check your compiler installation"
00062 #endif
00063 #if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
00064 #  error "your limits.h macros are broken"
00065 #endif
00066 
00067 /* workaround a cpp bug under hpux 10.20 */
00068 #define LZO_0xffffffffL         4294967295ul
00069 
00070 #if !defined(LZO_UINT32_C)
00071 #  if (UINT_MAX < LZO_0xffffffffL)
00072 #    define LZO_UINT32_C(c)     c ## UL
00073 #  else
00074 #    define LZO_UINT32_C(c)     c ## U
00075 #  endif
00076 #endif
00077 
00078 
00079 /***********************************************************************
00080 // architecture defines
00081 ************************************************************************/
00082 
00083 #if !defined(__LZO_WIN) && !defined(__LZO_DOS) && !defined(__LZO_OS2)
00084 #  if defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows)
00085 #    define __LZO_WIN
00086 #  elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
00087 #    define __LZO_WIN
00088 #  elif defined(__NT__) || defined(__NT_DLL__) || defined(__WINDOWS_386__)
00089 #    define __LZO_WIN
00090 #  elif defined(__DOS__) || defined(__MSDOS__) || defined(MSDOS)
00091 #    define __LZO_DOS
00092 #  elif defined(__OS2__) || defined(__OS2V2__) || defined(OS2)
00093 #    define __LZO_OS2
00094 #  elif defined(__palmos__)
00095 #    define __LZO_PALMOS
00096 #  elif defined(__TOS__) || defined(__atarist__)
00097 #    define __LZO_TOS
00098 #  endif
00099 #endif
00100 
00101 #if (UINT_MAX < LZO_0xffffffffL)
00102 #  if defined(__LZO_WIN)
00103 #    define __LZO_WIN16
00104 #  elif defined(__LZO_DOS)
00105 #    define __LZO_DOS16
00106 #  elif defined(__LZO_PALMOS)
00107 #    define __LZO_PALMOS16
00108 #  elif defined(__LZO_TOS)
00109 #    define __LZO_TOS16
00110 #  elif defined(__C166__)
00111 #  else
00112         /* porting hint: for pure 16-bit architectures try compiling
00113          * everything with -D__LZO_STRICT_16BIT */
00114 #    error "16-bit target not supported - contact me for porting hints"
00115 #  endif
00116 #endif
00117 
00118 #if !defined(__LZO_i386)
00119 #  if defined(__LZO_DOS) || defined(__LZO_WIN16)
00120 #    define __LZO_i386
00121 #  elif defined(__i386__) || defined(__386__) || defined(_M_IX86)
00122 #    define __LZO_i386
00123 #  endif
00124 #endif
00125 
00126 #if defined(__LZO_STRICT_16BIT)
00127 #  if (UINT_MAX < LZO_0xffffffffL)
00128 #    include <lzo16bit.h>
00129 #  endif
00130 #endif
00131 
00132 /* memory checkers */
00133 #if !defined(__LZO_CHECKER)
00134 #  if defined(__BOUNDS_CHECKING_ON)
00135 #    define __LZO_CHECKER
00136 #  elif defined(__CHECKER__)
00137 #    define __LZO_CHECKER
00138 #  elif defined(__INSURE__)
00139 #    define __LZO_CHECKER
00140 #  elif defined(__PURIFY__)
00141 #    define __LZO_CHECKER
00142 #  endif
00143 #endif
00144 
00145 
00146 /***********************************************************************
00147 // integral and pointer types
00148 ************************************************************************/
00149 
00150 /* Integral types with 32 bits or more */
00151 #if !defined(LZO_UINT32_MAX)
00152 #  if (UINT_MAX >= LZO_0xffffffffL)
00153         typedef unsigned int       lzo_uint32;
00154         typedef int                lzo_int32;
00155 #    define LZO_UINT32_MAX      UINT_MAX
00156 #    define LZO_INT32_MAX       INT_MAX
00157 #    define LZO_INT32_MIN       INT_MIN
00158 #  elif (ULONG_MAX >= LZO_0xffffffffL)
00159         typedef unsigned long      lzo_uint32;
00160         typedef long               lzo_int32;
00161 #    define LZO_UINT32_MAX      ULONG_MAX
00162 #    define LZO_INT32_MAX       LONG_MAX
00163 #    define LZO_INT32_MIN       LONG_MIN
00164 #  else
00165 #    error "lzo_uint32"
00166 #  endif
00167 #endif
00168 
00169 /* lzo_uint is used like size_t */
00170 #if !defined(LZO_UINT_MAX)
00171 #  if (UINT_MAX >= LZO_0xffffffffL)
00172         typedef unsigned int       lzo_uint;
00173         typedef int                lzo_int;
00174 #    define LZO_UINT_MAX        UINT_MAX
00175 #    define LZO_INT_MAX         INT_MAX
00176 #    define LZO_INT_MIN         INT_MIN
00177 #  elif (ULONG_MAX >= LZO_0xffffffffL)
00178         typedef unsigned long      lzo_uint;
00179         typedef long               lzo_int;
00180 #    define LZO_UINT_MAX        ULONG_MAX
00181 #    define LZO_INT_MAX         LONG_MAX
00182 #    define LZO_INT_MIN         LONG_MIN
00183 #  else
00184 #    error "lzo_uint"
00185 #  endif
00186 #endif
00187 
00188 typedef int lzo_bool;
00189 
00190 
00191 /***********************************************************************
00192 // memory models
00193 ************************************************************************/
00194 
00195 /* Memory model for the public code segment. */
00196 #if !defined(__LZO_CMODEL)
00197 #  if defined(__LZO_DOS16) || defined(__LZO_WIN16)
00198 #    define __LZO_CMODEL        __far
00199 #  elif defined(__LZO_i386) && defined(__WATCOMC__)
00200 #    define __LZO_CMODEL        __near
00201 #  else
00202 #    define __LZO_CMODEL
00203 #  endif
00204 #endif
00205 
00206 /* Memory model for the public data segment. */
00207 #if !defined(__LZO_DMODEL)
00208 #  if defined(__LZO_DOS16) || defined(__LZO_WIN16)
00209 #    define __LZO_DMODEL        __far
00210 #  elif defined(__LZO_i386) && defined(__WATCOMC__)
00211 #    define __LZO_DMODEL        __near
00212 #  else
00213 #    define __LZO_DMODEL
00214 #  endif
00215 #endif
00216 
00217 /* Memory model that allows to access memory at offsets of lzo_uint. */
00218 #if !defined(__LZO_MMODEL)
00219 #  if (LZO_UINT_MAX <= UINT_MAX)
00220 #    define __LZO_MMODEL
00221 #  elif defined(__LZO_DOS16) || defined(__LZO_WIN16)
00222 #    define __LZO_MMODEL        __huge
00223 #    define LZO_999_UNSUPPORTED
00224 #  elif defined(__LZO_PALMOS16) || defined(__LZO_TOS16)
00225 #    define __LZO_MMODEL
00226 #  else
00227 #    error "__LZO_MMODEL"
00228 #  endif
00229 #endif
00230 
00231 /* no typedef here because of const-pointer issues */
00232 #define lzo_byte                unsigned char __LZO_MMODEL
00233 #define lzo_bytep               unsigned char __LZO_MMODEL *
00234 #define lzo_charp               char __LZO_MMODEL *
00235 #define lzo_voidp               void __LZO_MMODEL *
00236 #define lzo_shortp              short __LZO_MMODEL *
00237 #define lzo_ushortp             unsigned short __LZO_MMODEL *
00238 #define lzo_uint32p             lzo_uint32 __LZO_MMODEL *
00239 #define lzo_int32p              lzo_int32 __LZO_MMODEL *
00240 #define lzo_uintp               lzo_uint __LZO_MMODEL *
00241 #define lzo_intp                lzo_int __LZO_MMODEL *
00242 #define lzo_voidpp              lzo_voidp __LZO_MMODEL *
00243 #define lzo_bytepp              lzo_bytep __LZO_MMODEL *
00244 
00245 #ifndef lzo_sizeof_dict_t
00246 #  define lzo_sizeof_dict_t     sizeof(lzo_bytep)
00247 #endif
00248 
00249 
00250 /***********************************************************************
00251 // calling conventions and function types
00252 ************************************************************************/
00253 
00254 /* linkage */
00255 #if !defined(__LZO_EXTERN_C)
00256 #  ifdef __cplusplus
00257 #    define __LZO_EXTERN_C      extern "C"
00258 #  else
00259 #    define __LZO_EXTERN_C      extern
00260 #  endif
00261 #endif
00262 
00263 /* calling convention */
00264 #if !defined(__LZO_CDECL)
00265 #  if defined(__LZO_DOS16) || defined(__LZO_WIN16)
00266 #    define __LZO_CDECL         __LZO_CMODEL __cdecl
00267 #  elif defined(__LZO_i386) && defined(_MSC_VER)
00268 #    define __LZO_CDECL         __LZO_CMODEL __cdecl
00269 #  elif defined(__LZO_i386) && defined(__WATCOMC__)
00270 #    define __LZO_CDECL         __LZO_CMODEL __cdecl
00271 #  else
00272 #    define __LZO_CDECL         __LZO_CMODEL
00273 #  endif
00274 #endif
00275 #if !defined(__LZO_ENTRY)
00276 #  define __LZO_ENTRY           __LZO_CDECL
00277 #endif
00278 
00279 /* C++ exception specification for extern "C" function types */
00280 #if !defined(__cplusplus)
00281 #  undef LZO_NOTHROW
00282 #  define LZO_NOTHROW
00283 #elif !defined(LZO_NOTHROW)
00284 #  define LZO_NOTHROW
00285 #endif
00286 
00287 
00288 typedef int
00289 (__LZO_ENTRY *lzo_compress_t)   ( const lzo_byte *src, lzo_uint  src_len,
00290                                                                 lzo_byte *dst, lzo_uintp dst_len,
00291                                                                 lzo_voidp wrkmem );
00292 
00293 typedef int
00294 (__LZO_ENTRY *lzo_decompress_t) ( const lzo_byte *src, lzo_uint  src_len,
00295                                                                 lzo_byte *dst, lzo_uintp dst_len,
00296                                                                 lzo_voidp wrkmem );
00297 
00298 typedef int
00299 (__LZO_ENTRY *lzo_optimize_t)   (       lzo_byte *src, lzo_uint  src_len,
00300                                                                 lzo_byte *dst, lzo_uintp dst_len,
00301                                                                 lzo_voidp wrkmem );
00302 
00303 typedef int
00304 (__LZO_ENTRY *lzo_compress_dict_t)(const lzo_byte *src, lzo_uint  src_len,
00305                                                                 lzo_byte *dst, lzo_uintp dst_len,
00306                                                                 lzo_voidp wrkmem,
00307                                                     const lzo_byte *dict, lzo_uint dict_len );
00308 
00309 typedef int
00310 (__LZO_ENTRY *lzo_decompress_dict_t)(const lzo_byte *src, lzo_uint  src_len,
00311                                                                 lzo_byte *dst, lzo_uintp dst_len,
00312                                                                 lzo_voidp wrkmem,
00313                                                     const lzo_byte *dict, lzo_uint dict_len );
00314 
00315 
00316 /* assembler versions always use __cdecl */
00317 typedef int
00318 (__LZO_CDECL *lzo_compress_asm_t)( const lzo_byte *src, lzo_uint  src_len,
00319                                                                 lzo_byte *dst, lzo_uintp dst_len,
00320                                                                 lzo_voidp wrkmem );
00321 
00322 typedef int
00323 (__LZO_CDECL *lzo_decompress_asm_t)( const lzo_byte *src, lzo_uint  src_len,
00324                                                                 lzo_byte *dst, lzo_uintp dst_len,
00325                                                                 lzo_voidp wrkmem );
00326 
00327 
00328 /* a progress indicator callback function */
00329 typedef void (__LZO_ENTRY *lzo_progress_callback_t) (lzo_uint, lzo_uint);
00330 
00331 
00332 /***********************************************************************
00333 // export information
00334 ************************************************************************/
00335 
00336 /* DLL export information */
00337 #if !defined(__LZO_EXPORT1)
00338 #  define __LZO_EXPORT1
00339 #endif
00340 #if !defined(__LZO_EXPORT2)
00341 #  define __LZO_EXPORT2
00342 #endif
00343 
00344 /* exported calling convention for C functions */
00345 #if !defined(LZO_PUBLIC)
00346 #  define LZO_PUBLIC(_rettype) \
00347                          __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_ENTRY
00348 #endif
00349 #if !defined(LZO_EXTERN)
00350 #  define LZO_EXTERN(_rettype)          __LZO_EXTERN_C LZO_PUBLIC(_rettype)
00351 #endif
00352 #if !defined(LZO_PRIVATE)
00353 #  define LZO_PRIVATE(_rettype)         static _rettype __LZO_ENTRY
00354 #endif
00355 
00356 /* exported __cdecl calling convention for assembler functions */
00357 #if !defined(LZO_PUBLIC_CDECL)
00358 #  define LZO_PUBLIC_CDECL(_rettype) \
00359                          __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
00360 #endif
00361 #if !defined(LZO_EXTERN_CDECL)
00362 #  define LZO_EXTERN_CDECL(_rettype)    __LZO_EXTERN_C LZO_PUBLIC_CDECL(_rettype)
00363 #endif
00364 
00365 /* exported global variables (LZO currently uses no static variables and
00366  * is fully thread safe) */
00367 #if !defined(LZO_PUBLIC_VAR)
00368 #  define LZO_PUBLIC_VAR(_type) \
00369                          __LZO_EXPORT1 _type __LZO_EXPORT2 __LZO_DMODEL
00370 #endif
00371 #if !defined(LZO_EXTERN_VAR)
00372 #  define LZO_EXTERN_VAR(_type)         extern LZO_PUBLIC_VAR(_type)
00373 #endif
00374 
00375 
00376 /***********************************************************************
00377 // error codes and prototypes
00378 ************************************************************************/
00379 
00380 /* Error codes for the compression/decompression functions. Negative
00381  * values are errors, positive values will be used for special but
00382  * normal events.
00383  */
00384 #define LZO_E_OK                    0
00385 #define LZO_E_ERROR                 (-1)
00386 #define LZO_E_OUT_OF_MEMORY         (-2)    /* not used right now */
00387 #define LZO_E_NOT_COMPRESSIBLE      (-3)    /* not used right now */
00388 #define LZO_E_INPUT_OVERRUN         (-4)
00389 #define LZO_E_OUTPUT_OVERRUN        (-5)
00390 #define LZO_E_LOOKBEHIND_OVERRUN    (-6)
00391 #define LZO_E_EOF_NOT_FOUND         (-7)
00392 #define LZO_E_INPUT_NOT_CONSUMED    (-8)
00393 
00394 
00395 /* lzo_init() should be the first function you call.
00396  * Check the return code !
00397  *
00398  * lzo_init() is a macro to allow checking that the library and the
00399  * compiler's view of various types are consistent.
00400  */
00401 #define lzo_init() __lzo_init2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
00402     (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
00403     (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
00404     (int)sizeof(lzo_compress_t))
00405 LZO_EXTERN(int) __lzo_init2(unsigned,int,int,int,int,int,int,int,int,int);
00406 
00407 /* version functions (useful for shared libraries) */
00408 LZO_EXTERN(unsigned) lzo_version(void);
00409 LZO_EXTERN(const char *) lzo_version_string(void);
00410 LZO_EXTERN(const char *) lzo_version_date(void);
00411 LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
00412 LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
00413 
00414 /* string functions */
00415 LZO_EXTERN(int)
00416 lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len);
00417 LZO_EXTERN(lzo_voidp)
00418 lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
00419 LZO_EXTERN(lzo_voidp)
00420 lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
00421 LZO_EXTERN(lzo_voidp)
00422 lzo_memset(lzo_voidp _s, int _c, lzo_uint _len);
00423 
00424 /* checksum functions */
00425 LZO_EXTERN(lzo_uint32)
00426 lzo_adler32(lzo_uint32 _adler, const lzo_byte *_buf, lzo_uint _len);
00427 LZO_EXTERN(lzo_uint32)
00428 lzo_crc32(lzo_uint32 _c, const lzo_byte *_buf, lzo_uint _len);
00429 
00430 /* misc. */
00431 LZO_EXTERN(lzo_bool) lzo_assert(int _expr);
00432 LZO_EXTERN(int) _lzo_config_check(void);
00433 typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
00434 typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
00435 typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t;
00436 
00437 /* align a char pointer on a boundary that is a multiple of `size' */
00438 LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size);
00439 #define LZO_PTR_ALIGN_UP(_ptr,_size) \
00440     ((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size)))
00441 
00442 /* deprecated - only for backward compatibility */
00443 #define LZO_ALIGN(_ptr,_size) LZO_PTR_ALIGN_UP(_ptr,_size)
00444 
00445 
00446 #ifdef __cplusplus
00447 } /* extern "C" */
00448 #endif
00449 
00450 #endif /* already included */
00451 

Generated on Fri May 7 21:15:41 2004 by doxygen 1.3.5