1 /* zutil.h -- internal interface and configuration of the compression library
2 * Copyright (C) 1995 Jean-loup Gailly.
3 * For conditions of distribution and use, see copyright notice in zlib.h
6 /* WARNING: this file should *not* be used by applications. It is
7 part of the implementation of the compression library and is
8 subject to change. Applications should only use zlib.h.
11 /* $Id: zutil.h,v 1.9 1995/05/03 17:27:12 jloup Exp $ */
18 #if defined(MSDOS) || defined(VMS)
31 /* compile with -Dlocal if your debugger can't find static symbols */
33 typedef unsigned char uch;
35 typedef unsigned short ush;
37 typedef unsigned long ulg;
39 extern char *z_errmsg[]; /* indexed by 1-zlib_error */
41 #define ERR_RETURN(strm,err) return (strm->msg=z_errmsg[1-err], err)
42 /* To be used only when the state is known to be valid */
44 /* common constants */
51 /* default windowBits for decompression. MAX_WBITS is for compression only */
53 #if MAX_MEM_LEVEL >= 8
54 # define DEF_MEM_LEVEL 8
56 # define DEF_MEM_LEVEL MAX_MEM_LEVEL
58 /* default memLevel */
60 #define STORED_BLOCK 0
61 #define STATIC_TREES 1
63 /* The three kinds of block type */
67 /* The minimum and maximum match lengths */
69 /* target dependencies */
84 #ifdef WIN32 /* Windows NT */
88 #if defined(VAXC) || defined(VMS)
90 # define FOPEN(name, mode) \
91 fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
98 #if defined(ATARI) || defined(atarist)
103 # define OS_CODE 0x07
106 #ifdef __50SERIES /* Prime/PRIMOS */
107 # define OS_CODE 0x0F
111 # define OS_CODE 0x0a
114 /* Common defaults */
117 # define OS_CODE 0x03 /* assume Unix */
121 # define FOPEN(name, mode) fopen((name), (mode))
127 extern char *strerror OF((int));
128 # define zstrerror(errnum) strerror(errnum)
130 # define zstrerror(errnum) ""
133 #if defined(pyr) && !defined(NO_MEMCPY)
136 #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
140 # ifdef M_I86MM /* MSC medium model */
141 # define zmemcpy _fmemcpy
142 # define zmemzero(dest, len) _fmemset(dest, 0, len)
144 # define zmemcpy memcpy
145 # define zmemzero(dest, len) memset(dest, 0, len)
148 extern void zmemcpy OF((Byte* dest, Byte* source, uInt len));
149 extern void zmemzero OF((Byte* dest, uInt len));
152 /* Diagnostic functions */
158 # define Assert(cond,msg) {if(!(cond)) z_error(msg);}
159 # define Trace(x) fprintf x
160 # define Tracev(x) {if (verbose) fprintf x ;}
161 # define Tracevv(x) {if (verbose>1) fprintf x ;}
162 # define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
163 # define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
165 # define Assert(cond,msg)
170 # define Tracecv(c,x)
174 typedef uLong (*check_func) OF((uLong check, Bytef *buf, uInt len));
176 extern void z_error OF((char *m));
178 voidp zcalloc OF((voidp opaque, unsigned items, unsigned size));
179 void zcfree OF((voidp opaque, voidp ptr));
181 #define ZALLOC(strm, items, size) \
182 (*((strm)->zalloc))((strm)->opaque, (items), (size))
183 #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidp)(addr))
184 #define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
186 #endif /* _Z_UTIL_H */