Point Cloud Library (PCL)
1.7.0
|
00001 /* zutil.h -- internal interface and configuration of the compression library 00002 * Copyright (C) 1995-2005 Jean-loup Gailly. 00003 * For conditions of distribution and use, see copyright notice in zlib.h 00004 */ 00005 00006 /* WARNING: this file should *not* be used by applications. It is 00007 part of the implementation of the compression library and is 00008 subject to change. Applications should only use zlib.h. 00009 */ 00010 00011 /* @(#) $Id$ */ 00012 00013 #ifndef ZUTIL_H 00014 #define ZUTIL_H 00015 00016 #define ZLIB_INTERNAL 00017 #include "zlib.h" 00018 00019 #ifdef STDC 00020 # ifndef _WIN32_WCE 00021 # include <stddef.h> 00022 # endif 00023 # include <string.h> 00024 # include <stdlib.h> 00025 #endif 00026 #ifdef NO_ERRNO_H 00027 # ifdef _WIN32_WCE 00028 /* The Microsoft C Run-Time Library for Windows CE doesn't have 00029 * errno. We define it as a global variable to simplify porting. 00030 * Its value is always 0 and should not be used. We rename it to 00031 * avoid conflict with other libraries that use the same workaround. 00032 */ 00033 # define errno z_errno 00034 # endif 00035 extern int errno; 00036 #else 00037 # ifndef _WIN32_WCE 00038 # include <errno.h> 00039 # endif 00040 #endif 00041 00042 #ifndef local 00043 # define local static 00044 #endif 00045 /* compile with -Dlocal if your debugger can't find static symbols */ 00046 00047 typedef unsigned char uch; 00048 typedef uch FAR uchf; 00049 typedef unsigned short ush; 00050 typedef ush FAR ushf; 00051 typedef unsigned int ulg; 00052 00053 extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ 00054 /* (size given to avoid silly warnings with Visual C++) */ 00055 00056 #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] 00057 00058 #define ERR_RETURN(strm,err) \ 00059 return (strm->msg = (char*)ERR_MSG(err), (err)) 00060 /* To be used only when the state is known to be valid */ 00061 00062 /* common constants */ 00063 00064 #ifndef DEF_WBITS 00065 # define DEF_WBITS MAX_WBITS 00066 #endif 00067 /* default windowBits for decompression. MAX_WBITS is for compression only */ 00068 00069 #if MAX_MEM_LEVEL >= 8 00070 # define DEF_MEM_LEVEL 8 00071 #else 00072 # define DEF_MEM_LEVEL MAX_MEM_LEVEL 00073 #endif 00074 /* default memLevel */ 00075 00076 #define STORED_BLOCK 0 00077 #define STATIC_TREES 1 00078 #define DYN_TREES 2 00079 /* The three kinds of block type */ 00080 00081 #define MIN_MATCH 3 00082 #define MAX_MATCH 258 00083 /* The minimum and maximum match lengths */ 00084 00085 #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ 00086 00087 /* target dependencies */ 00088 00089 #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32) && !defined(WIN64)) 00090 # define OS_CODE 0x00 00091 # if defined(__TURBOC__) || defined(__BORLANDC__) 00092 # if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) 00093 /* Allow compilation with ANSI keywords only enabled */ 00094 void _Cdecl farfree( void *block ); 00095 void *_Cdecl farmalloc( unsigned int nbytes ); 00096 # else 00097 # include <alloc.h> 00098 # endif 00099 # else /* MSC or DJGPP */ 00100 # include <malloc.h> 00101 # endif 00102 #endif 00103 00104 #ifdef AMIGA 00105 # define OS_CODE 0x01 00106 #endif 00107 00108 #if defined(VAXC) || defined(VMS) 00109 # define OS_CODE 0x02 00110 # define F_OPEN(name, mode) \ 00111 fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") 00112 #endif 00113 00114 #if defined(ATARI) || defined(atarist) 00115 # define OS_CODE 0x05 00116 #endif 00117 00118 #ifdef OS2 00119 # define OS_CODE 0x06 00120 # ifdef M_I86 00121 #include <malloc.h> 00122 # endif 00123 #endif 00124 00125 #if defined(MACOS) || defined(TARGET_OS_MAC) 00126 # define OS_CODE 0x07 00127 # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os 00128 # include <unix.h> /* for fdopen */ 00129 # else 00130 # ifndef fdopen 00131 # define fdopen(fd,mode) NULL /* No fdopen() */ 00132 # endif 00133 # endif 00134 #endif 00135 00136 #ifdef TOPS20 00137 # define OS_CODE 0x0a 00138 #endif 00139 00140 #if defined(WIN32) || defined(WIN64) 00141 # ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ 00142 # define OS_CODE 0x0b 00143 # endif 00144 #endif 00145 00146 #ifdef __50SERIES /* Prime/PRIMOS */ 00147 # define OS_CODE 0x0f 00148 #endif 00149 00150 #if defined(_BEOS_) || defined(RISCOS) 00151 # define fdopen(fd,mode) NULL /* No fdopen() */ 00152 #endif 00153 00154 #if (defined(_MSC_VER) && (_MSC_VER > 600)) 00155 # if defined(_WIN32_WCE) 00156 # define fdopen(fd,mode) NULL /* No fdopen() */ 00157 # ifndef _PTRDIFF_T_DEFINED 00158 typedef int ptrdiff_t; 00159 # define _PTRDIFF_T_DEFINED 00160 # endif 00161 # else 00162 # define fdopen(fd,type) _fdopen(fd,type) 00163 # endif 00164 #endif 00165 00166 /* common defaults */ 00167 00168 #ifndef OS_CODE 00169 # define OS_CODE 0x03 /* assume Unix */ 00170 #endif 00171 00172 #ifndef F_OPEN 00173 # define F_OPEN(name, mode) fopen((name), (mode)) 00174 #endif 00175 00176 /* functions */ 00177 00178 #if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) 00179 # ifndef HAVE_VSNPRINTF 00180 # define HAVE_VSNPRINTF 00181 # endif 00182 #endif 00183 #if defined(__CYGWIN__) 00184 # ifndef HAVE_VSNPRINTF 00185 # define HAVE_VSNPRINTF 00186 # endif 00187 #endif 00188 #ifndef HAVE_VSNPRINTF 00189 # ifdef MSDOS 00190 /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), 00191 but for now we just assume it doesn't. */ 00192 # define NO_vsnprintf 00193 # endif 00194 # ifdef __TURBOC__ 00195 # define NO_vsnprintf 00196 # endif 00197 # if defined(WIN32) || defined(WIN64) 00198 /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ 00199 # if !defined(vsnprintf) && !defined(NO_vsnprintf) 00200 # define vsnprintf _vsnprintf 00201 # endif 00202 # endif 00203 # ifdef __SASC 00204 # define NO_vsnprintf 00205 # endif 00206 #endif 00207 #ifdef VMS 00208 # define NO_vsnprintf 00209 #endif 00210 00211 #if defined(pyr) 00212 # define NO_MEMCPY 00213 #endif 00214 #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) 00215 /* Use our own functions for small and medium model with MSC <= 5.0. 00216 * You may have to use the same strategy for Borland C (untested). 00217 * The __SC__ check is for Symantec. 00218 */ 00219 # define NO_MEMCPY 00220 #endif 00221 #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) 00222 # define HAVE_MEMCPY 00223 #endif 00224 #ifdef HAVE_MEMCPY 00225 # ifdef SMALL_MEDIUM /* MSDOS small or medium model */ 00226 # define zmemcpy _fmemcpy 00227 # define zmemcmp _fmemcmp 00228 # define zmemzero(dest, len) _fmemset(dest, 0, len) 00229 # else 00230 # define zmemcpy memcpy 00231 # define zmemcmp memcmp 00232 # define zmemzero(dest, len) memset(dest, 0, len) 00233 # endif 00234 #else 00235 extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); 00236 extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); 00237 extern void zmemzero OF((Bytef* dest, uInt len)); 00238 #endif 00239 00240 /* Diagnostic functions */ 00241 #ifdef DEBUG 00242 # include <stdio.h> 00243 extern int z_verbose; 00244 extern void z_error OF((char *m)); 00245 # define Assert(cond,msg) {if(!(cond)) z_error(msg);} 00246 # define Trace(x) {if (z_verbose>=0) fprintf x ;} 00247 # define Tracev(x) {if (z_verbose>0) fprintf x ;} 00248 # define Tracevv(x) {if (z_verbose>1) fprintf x ;} 00249 # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} 00250 # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} 00251 #else 00252 # define Assert(cond,msg) 00253 # define Trace(x) 00254 # define Tracev(x) 00255 # define Tracevv(x) 00256 # define Tracec(c,x) 00257 # define Tracecv(c,x) 00258 #endif 00259 00260 00261 voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); 00262 void zcfree OF((voidpf opaque, voidpf ptr)); 00263 00264 #define ZALLOC(strm, items, size) \ 00265 (*((strm)->zalloc))((strm)->opaque, (items), (size)) 00266 #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) 00267 #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} 00268 00269 #endif /* ZUTIL_H */