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.7 1995/04/30 10:55:33 jloup Exp $ */
30 /* compile with -Dlocal if your debugger can't find static symbols */
32 typedef unsigned char uch;
33 typedef unsigned short ush;
34 typedef unsigned long ulg;
36 extern char *z_errmsg[]; /* indexed by 1-zlib_error */
38 #define ERR_RETURN(strm,err) return (strm->msg=z_errmsg[1-err], err)
39 /* To be used only when the state is known to be valid */
41 /* common constants */
46 /* default WBITS for decompression. MAX_WBITS is useful for compression only */
48 #define STORED_BLOCK 0
49 #define STATIC_TREES 1
51 /* The three kinds of block type */
55 /* The minimum and maximum match lengths */
57 /* target dependencies */
72 #ifdef WIN32 /* Windows NT */
76 #if defined(VAXC) || defined(VMS)
78 # define FOPEN(name, mode) \
79 fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
86 #if defined(ATARI) || defined(atarist)
94 #ifdef __50SERIES /* Prime/PRIMOS */
102 /* Common defaults */
105 # define OS_CODE 0x03 /* assume Unix */
109 # define FOPEN(name, mode) fopen((name), (mode))
115 extern char *strerror __P((int));
116 # define zstrerror(errnum) strerror(errnum)
118 # define zstrerror(errnum) ""
121 #if defined(STDC) && !defined(HAVE_MEMCPY)
125 # define zmemcpy memcpy
126 # define zmemzero(dest, len) memset(dest, 0, len)
128 extern void zmemcpy __P((Byte* dest, Byte* source, uInt len));
129 extern void zmemzero __P((Byte* dest, uInt len));
132 /* Diagnostic functions */
138 # define Assert(cond,msg) {if(!(cond)) z_error(msg);}
139 # define Trace(x) fprintf x
140 # define Tracev(x) {if (verbose) fprintf x ;}
141 # define Tracevv(x) {if (verbose>1) fprintf x ;}
142 # define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
143 # define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
145 # define Assert(cond,msg)
150 # define Tracecv(c,x)
154 typedef uLong (*check_func) __P((uLong check, Byte *buf, uInt len));
156 extern void z_error __P((char *m));
158 voidp zcalloc __P((voidp opaque, unsigned items, unsigned size));
159 void zcfree __P((voidp opaque, voidp ptr));
161 #define ZALLOC(strm, items, size) \
162 (*((strm)->zalloc))((strm)->opaque, (items), (size))
163 #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidp)(addr))
164 #define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
166 #endif /* _Z_UTIL_H */