<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>zutil.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> </center>
<hr><h1>zutil.h</h1><div class="fragment"><pre>00001 <font class="comment">/* zutil.h -- internal interface and configuration of the compression library</font>
00002 <font class="comment"> * Copyright (C) 1995-1998 Jean-loup Gailly.</font>
00003 <font class="comment"> * For conditions of distribution and use, see copyright notice in zlib.h</font>
00004 <font class="comment"> */</font>
00005
00006 <font class="comment">/* WARNING: this file should *not* be used by applications. It is</font>
00007 <font class="comment"> part of the implementation of the compression library and is</font>
00008 <font class="comment"> subject to change. Applications should only use zlib.h.</font>
00009 <font class="comment"> */</font>
00010
00011 <font class="comment">/* @(#) $Id: zutil_8h-source.html,v 1.3 2002/06/20 20:23:10 mgruner Exp $ */</font>
00012
00013 <font class="preprocessor">#ifndef _Z_UTIL_H</font>
00014 <font class="preprocessor"></font><font class="preprocessor">#define _Z_UTIL_H</font>
00015 <font class="preprocessor"></font>
00016 <font class="preprocessor">#include "zlib.h"</font>
00017
00018 <font class="preprocessor">#ifdef STDC</font>
00019 <font class="preprocessor"></font><font class="preprocessor"># include <stddef.h></font>
00020 <font class="preprocessor"># include <string.h></font>
00021 <font class="preprocessor"># include <stdlib.h></font>
00022 <font class="preprocessor">#endif</font>
00023 <font class="preprocessor"></font><font class="preprocessor">#ifdef NO_ERRNO_H</font>
00024 <font class="preprocessor"></font> <font class="keyword">extern</font> <font class="keywordtype">int</font> errno;
00025 <font class="preprocessor">#else</font>
00026 <font class="preprocessor"></font><font class="preprocessor"># include <errno.h></font>
00027 <font class="preprocessor">#endif</font>
00028 <font class="preprocessor"></font>
00029 <font class="preprocessor">#ifndef local</font>
00030 <font class="preprocessor"></font><font class="preprocessor"># define local static</font>
00031 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00032 <font class="preprocessor"></font><font class="comment">/* compile with -Dlocal if your debugger can't find static symbols */</font>
00033
00034 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> uch;
00035 <font class="keyword">typedef</font> uch FAR uchf;
00036 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">short</font> ush;
00037 <font class="keyword">typedef</font> ush FAR ushf;
00038 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> ulg;
00039
00040 <font class="keyword">extern</font> <font class="keyword">const</font> <font class="keywordtype">char</font> *z_errmsg[10]; <font class="comment">/* indexed by 2-zlib_error */</font>
00041 <font class="comment">/* (size given to avoid silly warnings with Visual C++) */</font>
00042
00043 <font class="preprocessor">#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]</font>
00044 <font class="preprocessor"></font>
00045 <font class="preprocessor">#define ERR_RETURN(strm,err) \</font>
00046 <font class="preprocessor"> return (strm->msg = (char*)ERR_MSG(err), (err))</font>
00047 <font class="preprocessor"></font><font class="comment">/* To be used only when the state is known to be valid */</font>
00048
00049 <font class="comment">/* common constants */</font>
00050
00051 <font class="preprocessor">#ifndef DEF_WBITS</font>
00052 <font class="preprocessor"></font><font class="preprocessor"># define DEF_WBITS MAX_WBITS</font>
00053 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00054 <font class="preprocessor"></font><font class="comment">/* default windowBits for decompression. MAX_WBITS is for compression only */</font>
00055
00056 <font class="preprocessor">#if MAX_MEM_LEVEL >= 8</font>
00057 <font class="preprocessor"></font><font class="preprocessor"># define DEF_MEM_LEVEL 8</font>
00058 <font class="preprocessor"></font><font class="preprocessor">#else</font>
00059 <font class="preprocessor"></font><font class="preprocessor"># define DEF_MEM_LEVEL MAX_MEM_LEVEL</font>
00060 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00061 <font class="preprocessor"></font><font class="comment">/* default memLevel */</font>
00062
00063 <font class="preprocessor">#define STORED_BLOCK 0</font>
00064 <font class="preprocessor"></font><font class="preprocessor">#define STATIC_TREES 1</font>
00065 <font class="preprocessor"></font><font class="preprocessor">#define DYN_TREES 2</font>
00066 <font class="preprocessor"></font><font class="comment">/* The three kinds of block type */</font>
00067
00068 <font class="preprocessor">#define MIN_MATCH 3</font>
00069 <font class="preprocessor"></font><font class="preprocessor">#define MAX_MATCH 258</font>
00070 <font class="preprocessor"></font><font class="comment">/* The minimum and maximum match lengths */</font>
00071
00072 <font class="preprocessor">#define PRESET_DICT 0x20 </font><font class="comment">/* preset dictionary flag in zlib header */</font>
00073
00074 <font class="comment">/* target dependencies */</font>
00075
00076 <font class="preprocessor">#ifdef MSDOS</font>
00077 <font class="preprocessor"></font><font class="preprocessor"># define OS_CODE 0x00</font>
00078 <font class="preprocessor"></font><font class="preprocessor"># if defined(__TURBOC__) || defined(__BORLANDC__)</font>
00079 <font class="preprocessor"></font><font class="preprocessor"># if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))</font>
00080 <font class="preprocessor"></font> <font class="comment">/* Allow compilation with ANSI keywords only enabled */</font>
00081 <font class="keywordtype">void</font> _Cdecl farfree( <font class="keywordtype">void</font> *block );
00082 <font class="keywordtype">void</font> *_Cdecl farmalloc( <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> nbytes );
00083 <font class="preprocessor"># else</font>
00084 <font class="preprocessor"></font><font class="preprocessor"># include <alloc.h></font>
00085 <font class="preprocessor"># endif</font>
00086 <font class="preprocessor"></font><font class="preprocessor"># else </font><font class="comment">/* MSC or DJGPP */</font>
00087 <font class="preprocessor"># include <malloc.h></font>
00088 <font class="preprocessor"># endif</font>
00089 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00090 <font class="preprocessor"></font>
00091 <font class="preprocessor">#ifdef OS2</font>
00092 <font class="preprocessor"></font><font class="preprocessor"># define OS_CODE 0x06</font>
00093 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00094 <font class="preprocessor"></font>
00095 <font class="preprocessor">#ifdef WIN32 </font><font class="comment">/* Window 95 & Windows NT */</font>
00096 <font class="preprocessor"># define OS_CODE 0x0b</font>
00097 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00098 <font class="preprocessor"></font>
00099 <font class="preprocessor">#if defined(VAXC) || defined(VMS)</font>
00100 <font class="preprocessor"></font><font class="preprocessor"># define OS_CODE 0x02</font>
00101 <font class="preprocessor"></font><font class="preprocessor"># define F_OPEN(name, mode) \</font>
00102 <font class="preprocessor"> fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")</font>
00103 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00104 <font class="preprocessor"></font>
00105 <font class="preprocessor">#ifdef AMIGA</font>
00106 <font class="preprocessor"></font><font class="preprocessor"># define OS_CODE 0x01</font>
00107 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00108 <font class="preprocessor"></font>
00109 <font class="preprocessor">#if defined(ATARI) || defined(atarist)</font>
00110 <font class="preprocessor"></font><font class="preprocessor"># define OS_CODE 0x05</font>
00111 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00112 <font class="preprocessor"></font>
00113 <font class="preprocessor">#if defined(MACOS) || defined(TARGET_OS_MAC)</font>
00114 <font class="preprocessor"></font><font class="preprocessor"># define OS_CODE 0x07</font>
00115 <font class="preprocessor"></font><font class="preprocessor"># if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os</font>
00116 <font class="preprocessor"></font><font class="preprocessor"># include <unix.h></font> <font class="comment">/* for fdopen */</font>
00117 <font class="preprocessor"># else</font>
00118 <font class="preprocessor"></font><font class="preprocessor"># ifndef fdopen</font>
00119 <font class="preprocessor"></font><font class="preprocessor"># define fdopen(fd,mode) NULL </font><font class="comment">/* No fdopen() */</font>
00120 <font class="preprocessor"># endif</font>
00121 <font class="preprocessor"></font><font class="preprocessor"># endif</font>
00122 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00123 <font class="preprocessor"></font>
00124 <font class="preprocessor">#ifdef __50SERIES </font><font class="comment">/* Prime/PRIMOS */</font>
00125 <font class="preprocessor"># define OS_CODE 0x0F</font>
00126 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00127 <font class="preprocessor"></font>
00128 <font class="preprocessor">#ifdef TOPS20</font>
00129 <font class="preprocessor"></font><font class="preprocessor"># define OS_CODE 0x0a</font>
00130 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00131 <font class="preprocessor"></font>
00132 <font class="preprocessor">#if defined(_BEOS_) || defined(RISCOS)</font>
00133 <font class="preprocessor"></font><font class="preprocessor"># define fdopen(fd,mode) NULL </font><font class="comment">/* No fdopen() */</font>
00134 <font class="preprocessor">#endif</font>
00135 <font class="preprocessor"></font>
00136 <font class="preprocessor">#if (defined(_MSC_VER) && (_MSC_VER > 600))</font>
00137 <font class="preprocessor"></font><font class="preprocessor"># define fdopen(fd,type) _fdopen(fd,type)</font>
00138 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00139 <font class="preprocessor"></font>
00140
00141 <font class="comment">/* Common defaults */</font>
00142
00143 <font class="preprocessor">#ifndef OS_CODE</font>
00144 <font class="preprocessor"></font><font class="preprocessor"># define OS_CODE 0x03 </font><font class="comment">/* assume Unix */</font>
00145 <font class="preprocessor">#endif</font>
00146 <font class="preprocessor"></font>
00147 <font class="preprocessor">#ifndef F_OPEN</font>
00148 <font class="preprocessor"></font><font class="preprocessor"># define F_OPEN(name, mode) fopen((name), (mode))</font>
00149 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00150 <font class="preprocessor"></font>
00151 <font class="comment">/* functions */</font>
00152
00153 <font class="preprocessor">#ifdef HAVE_STRERROR</font>
00154 <font class="preprocessor"></font> <font class="keyword">extern</font> <font class="keywordtype">char</font> *strerror OF((<font class="keywordtype">int</font>));
00155 <font class="preprocessor"># define zstrerror(errnum) strerror(errnum)</font>
00156 <font class="preprocessor"></font><font class="preprocessor">#else</font>
00157 <font class="preprocessor"></font><font class="preprocessor"># define zstrerror(errnum) ""</font>
00158 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00159 <font class="preprocessor"></font>
00160 <font class="preprocessor">#if defined(pyr)</font>
00161 <font class="preprocessor"></font><font class="preprocessor"># define NO_MEMCPY</font>
00162 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00163 <font class="preprocessor"></font><font class="preprocessor">#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)</font>
00164 <font class="preprocessor"></font> <font class="comment">/* Use our own functions for small and medium model with MSC <= 5.0.</font>
00165 <font class="comment"> * You may have to use the same strategy for Borland C (untested).</font>
00166 <font class="comment"> * The __SC__ check is for Symantec.</font>
00167 <font class="comment"> */</font>
00168 <font class="preprocessor"># define NO_MEMCPY</font>
00169 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00170 <font class="preprocessor"></font><font class="preprocessor">#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)</font>
00171 <font class="preprocessor"></font><font class="preprocessor"># define HAVE_MEMCPY</font>
00172 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00173 <font class="preprocessor"></font><font class="preprocessor">#ifdef HAVE_MEMCPY</font>
00174 <font class="preprocessor"></font><font class="preprocessor"># ifdef SMALL_MEDIUM </font><font class="comment">/* MSDOS small or medium model */</font>
00175 <font class="preprocessor"># define zmemcpy _fmemcpy</font>
00176 <font class="preprocessor"></font><font class="preprocessor"># define zmemcmp _fmemcmp</font>
00177 <font class="preprocessor"></font><font class="preprocessor"># define zmemzero(dest, len) _fmemset(dest, 0, len)</font>
00178 <font class="preprocessor"></font><font class="preprocessor"># else</font>
00179 <font class="preprocessor"></font><font class="preprocessor"># define zmemcpy memcpy</font>
00180 <font class="preprocessor"></font><font class="preprocessor"># define zmemcmp memcmp</font>
00181 <font class="preprocessor"></font><font class="preprocessor"># define zmemzero(dest, len) memset(dest, 0, len)</font>
00182 <font class="preprocessor"></font><font class="preprocessor"># endif</font>
00183 <font class="preprocessor"></font><font class="preprocessor">#else</font>
00184 <font class="preprocessor"></font> <font class="keyword">extern</font> <font class="keywordtype">void</font> zmemcpy OF((Bytef* dest, <font class="keyword">const</font> Bytef* source, uInt len));
00185 <font class="keyword">extern</font> <font class="keywordtype">int</font> zmemcmp OF((<font class="keyword">const</font> Bytef* s1, <font class="keyword">const</font> Bytef* s2, uInt len));
00186 <font class="keyword">extern</font> <font class="keywordtype">void</font> zmemzero OF((Bytef* dest, uInt len));
00187 <font class="preprocessor">#endif</font>
00188 <font class="preprocessor"></font>
00189 <font class="comment">/* Diagnostic functions */</font>
00190 <font class="preprocessor">#ifdef DEBUG</font>
00191 <font class="preprocessor"></font><font class="preprocessor"># include <stdio.h></font>
00192 <font class="keyword">extern</font> <font class="keywordtype">int</font> z_verbose;
00193 <font class="keyword">extern</font> <font class="keywordtype">void</font> z_error OF((<font class="keywordtype">char</font> *m));
00194 <font class="preprocessor"># define Assert(cond,msg) {if(!(cond)) z_error(msg);}</font>
00195 <font class="preprocessor"></font><font class="preprocessor"># define Trace(x) {if (z_verbose>=0) fprintf x ;}</font>
00196 <font class="preprocessor"></font><font class="preprocessor"># define Tracev(x) {if (z_verbose>0) fprintf x ;}</font>
00197 <font class="preprocessor"></font><font class="preprocessor"># define Tracevv(x) {if (z_verbose>1) fprintf x ;}</font>
00198 <font class="preprocessor"></font><font class="preprocessor"># define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}</font>
00199 <font class="preprocessor"></font><font class="preprocessor"># define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}</font>
00200 <font class="preprocessor"></font><font class="preprocessor">#else</font>
00201 <font class="preprocessor"></font><font class="preprocessor"># define Assert(cond,msg)</font>
00202 <font class="preprocessor"></font><font class="preprocessor"># define Trace(x)</font>
00203 <font class="preprocessor"></font><font class="preprocessor"># define Tracev(x)</font>
00204 <font class="preprocessor"></font><font class="preprocessor"># define Tracevv(x)</font>
00205 <font class="preprocessor"></font><font class="preprocessor"># define Tracec(c,x)</font>
00206 <font class="preprocessor"></font><font class="preprocessor"># define Tracecv(c,x)</font>
00207 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00208 <font class="preprocessor"></font>
00209
00210 <font class="keyword">typedef</font> uLong (ZEXPORT *check_func) OF((uLong check, <font class="keyword">const</font> Bytef *buf,
00211 uInt len));
00212 voidpf zcalloc OF((voidpf opaque, <font class="keywordtype">unsigned</font> items, <font class="keywordtype">unsigned</font> size));
00213 <font class="keywordtype">void</font> zcfree OF((voidpf opaque, voidpf ptr));
00214
00215 <font class="preprocessor">#define ZALLOC(strm, items, size) \</font>
00216 <font class="preprocessor"> (*((strm)->zalloc))((strm)->opaque, (items), (size))</font>
00217 <font class="preprocessor"></font><font class="preprocessor">#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))</font>
00218 <font class="preprocessor"></font><font class="preprocessor">#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}</font>
00219 <font class="preprocessor"></font>
00220 <font class="preprocessor">#endif </font><font class="comment">/* _Z_UTIL_H */</font>
</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:13:01 2002 for The Sword Project by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>