Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenzutil.h
Go to the documentation of this file.
00001 /* zutil.h -- internal interface and configuration of the compression library 00002 * Copyright (C) 1995-2002 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 _Z_UTIL_H 00014 #define _Z_UTIL_H 00015 00016 #include "zlib.h" 00017 00018 #ifdef STDC 00019 # include <stddef.h> 00020 # include <string.h> 00021 # include <stdlib.h> 00022 #endif 00023 #ifdef NO_ERRNO_H 00024 extern int errno; 00025 #else 00026 # include <errno.h> 00027 #endif 00028 00029 #ifndef local 00030 # define local static 00031 #endif 00032 /* compile with -Dlocal if your debugger can't find static symbols */ 00033 00034 typedef unsigned char uch; 00035 typedef uch FAR uchf; 00036 typedef unsigned short ush; 00037 typedef ush FAR ushf; 00038 typedef unsigned long ulg; 00039 00040 00041 #define ERR_RETURN(strm,err) \ 00042 return (strm->msg = (char*)ERR_MSG(err), (err)) 00043 /* To be used only when the state is known to be valid */ 00044 00045 /* common constants */ 00046 00047 #ifndef DEF_WBITS 00048 # define DEF_WBITS MAX_WBITS 00049 #endif 00050 /* default windowBits for decompression. MAX_WBITS is for compression only */ 00051 00052 #if MAX_MEM_LEVEL >= 8 00053 # define DEF_MEM_LEVEL 8 00054 #else 00055 # define DEF_MEM_LEVEL MAX_MEM_LEVEL 00056 #endif 00057 /* default memLevel */ 00058 00059 #define STORED_BLOCK 0 00060 #define STATIC_TREES 1 00061 #define DYN_TREES 2 00062 /* The three kinds of block type */ 00063 00064 #define MIN_MATCH 3 00065 #define MAX_MATCH 258 00066 /* The minimum and maximum match lengths */ 00067 00068 #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ 00069 00070 /* target dependencies */ 00071 00072 #ifdef MSDOS 00073 # define OS_CODE 0x00 00074 # if defined(__TURBOC__) || defined(__BORLANDC__) 00075 # if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) 00076 /* Allow compilation with ANSI keywords only enabled */ 00077 void _Cdecl farfree( void *block ); 00078 void *_Cdecl farmalloc( unsigned long nbytes ); 00079 # else 00080 # include <alloc.h> 00081 # endif 00082 # else /* MSC or DJGPP */ 00083 # endif 00084 #endif 00085 00086 #ifdef OS2 00087 # define OS_CODE 0x06 00088 #endif 00089 00090 #ifdef WIN32 /* Window 95 & Windows NT */ 00091 # define OS_CODE 0x0b 00092 #endif 00093 00094 #if defined(VAXC) || defined(VMS) 00095 # define OS_CODE 0x02 00096 # define F_OPEN(name, mode) \ 00097 ft_fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") 00098 #endif 00099 00100 #ifdef AMIGA 00101 # define OS_CODE 0x01 00102 #endif 00103 00104 #if defined(ATARI) || defined(atarist) 00105 # define OS_CODE 0x05 00106 #endif 00107 00108 #if defined(MACOS) || defined(TARGET_OS_MAC) 00109 # define OS_CODE 0x07 00110 # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os 00111 # include <unix.h> /* for fdopen */ 00112 # else 00113 # ifndef fdopen 00114 # define fdopen(fd,mode) NULL /* No fdopen() */ 00115 # endif 00116 # endif 00117 #endif 00118 00119 #ifdef __50SERIES /* Prime/PRIMOS */ 00120 # define OS_CODE 0x0F 00121 #endif 00122 00123 #ifdef TOPS20 00124 # define OS_CODE 0x0a 00125 #endif 00126 00127 #if defined(_BEOS_) || defined(RISCOS) 00128 # define fdopen(fd,mode) NULL /* No fdopen() */ 00129 #endif 00130 00131 #if (defined(_MSC_VER) && (_MSC_VER > 600)) 00132 # define fdopen(fd,type) _fdopen(fd,type) 00133 #endif 00134 00135 00136 /* Common defaults */ 00137 00138 #ifndef OS_CODE 00139 # define OS_CODE 0x03 /* assume Unix */ 00140 #endif 00141 00142 #ifndef F_OPEN 00143 # define F_OPEN(name, mode) ft_fopen((name), (mode)) 00144 #endif 00145 00146 /* functions */ 00147 00148 #ifdef HAVE_STRERROR 00149 extern char *strerror OF((int)); 00150 # define zstrerror(errnum) strerror(errnum) 00151 #else 00152 # define zstrerror(errnum) "" 00153 #endif 00154 00155 #if defined(pyr) 00156 # define NO_MEMCPY 00157 #endif 00158 #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) 00159 /* Use our own functions for small and medium model with MSC <= 5.0. 00160 * You may have to use the same strategy for Borland C (untested). 00161 * The __SC__ check is for Symantec. 00162 */ 00163 # define NO_MEMCPY 00164 #endif 00165 #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) 00166 # define HAVE_MEMCPY 00167 #endif 00168 #ifdef HAVE_MEMCPY 00169 # ifdef SMALL_MEDIUM /* MSDOS small or medium model */ 00170 # define zmemcpy _fmemcpy 00171 # define zmemcmp _fmemcmp 00172 # define zmemzero(dest, len) _fmemset(dest, 0, len) 00173 # else 00174 # define zmemcpy ft_memcpy 00175 # define zmemcmp ft_memcmp 00176 # define zmemzero(dest, len) ft_memset(dest, 0, len) 00177 # endif 00178 #else 00179 extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); 00180 extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); 00181 extern void zmemzero OF((Bytef* dest, uInt len)); 00182 #endif 00183 00184 /* Diagnostic functions */ 00185 #ifdef DEBUG 00186 # include <stdio.h> 00187 extern int z_verbose; 00188 extern void z_error OF((char *m)); 00189 # define Assert(cond,msg) {if(!(cond)) z_error(msg);} 00190 # define Trace(x) {if (z_verbose>=0) fprintf x ;} 00191 # define Tracev(x) {if (z_verbose>0) fprintf x ;} 00192 # define Tracevv(x) {if (z_verbose>1) fprintf x ;} 00193 # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} 00194 # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} 00195 #else 00196 # define Assert(cond,msg) 00197 # define Trace(x) 00198 # define Tracev(x) 00199 # define Tracevv(x) 00200 # define Tracec(c,x) 00201 # define Tracecv(c,x) 00202 #endif 00203 00204 00205 typedef uLong (*check_func) OF((uLong check, const Bytef *buf, 00206 uInt len)); 00207 local voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); 00208 local void zcfree OF((voidpf opaque, voidpf ptr)); 00209 00210 #define ZALLOC(strm, items, size) \ 00211 (*((strm)->zalloc))((strm)->opaque, (items), (size)) 00212 #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) 00213 #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} 00214 00215 #endif /* _Z_UTIL_H */ Generated on Sun May 27 2012 04:33:17 for ReactOS by
1.7.6.1
|