/[LeafOK_CVS]/pvpgn-1.7.4/src/zlib/pvpgn_zutil.h
ViewVC logotype

Contents of /pvpgn-1.7.4/src/zlib/pvpgn_zutil.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Tue Jun 6 03:41:38 2006 UTC (19 years, 9 months ago) by sysadm
Branch: GNU, MAIN
CVS Tags: arelease, HEAD
Changes since 1.1: +0 -0 lines
Content type: text/x-chdr
no message

1 /* zutil.h -- internal interface and configuration of the compression library
2 * Copyright (C) 1995-2002 Jean-loup Gailly.
3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */
5
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.
9 */
10
11 #ifndef _Z_UTIL_H
12 #define _Z_UTIL_H
13
14 #include "common/setup_before.h"
15 #include "zlib/pvpgn_zlib.h"
16 #ifdef HAVE_STDDEF_H
17 # include <stddef.h>
18 #else
19 # ifndef NULL
20 # define NULL ((void *)0)
21 # endif
22 #endif
23 #ifdef HAVE_STRING_H
24 # include <string.h>
25 #else
26 # ifdef HAVE_STRINGS_H
27 # include <strings.h>
28 # endif
29 #endif
30 #ifdef STDC_HEADERS
31 # include <stdlib.h>
32 #else
33 # ifdef HAVE_MALLOC_H
34 # include <malloc.h>
35 # endif
36 #endif
37 #ifdef NO_ERRNO_H
38 extern int errno;
39 #else
40 # include <errno.h>
41 #endif
42
43 #ifndef local
44 # define local static
45 #endif
46 /* compile with -Dlocal if your debugger can't find static symbols */
47
48 typedef unsigned char uch;
49 typedef uch FAR uchf;
50 typedef unsigned short ush;
51 typedef ush FAR ushf;
52 typedef unsigned long ulg;
53
54 extern const char *pvpgn_z_errmsg[10]; /* indexed by 2-zlib_error */
55 /* (size given to avoid silly warnings with Visual C++) */
56
57 #define ERR_MSG(err) pvpgn_z_errmsg[Z_NEED_DICT-(err)]
58
59 #define ERR_RETURN(strm,err) \
60 return (strm->msg = (char*)ERR_MSG(err), (err))
61 /* To be used only when the state is known to be valid */
62
63 /* common constants */
64
65 #ifndef DEF_WBITS
66 # define DEF_WBITS MAX_WBITS
67 #endif
68 /* default windowBits for decompression. MAX_WBITS is for compression only */
69
70 #if MAX_MEM_LEVEL >= 8
71 # define DEF_MEM_LEVEL 8
72 #else
73 # define DEF_MEM_LEVEL MAX_MEM_LEVEL
74 #endif
75 /* default memLevel */
76
77 #define STORED_BLOCK 0
78 #define STATIC_TREES 1
79 #define DYN_TREES 2
80 /* The three kinds of block type */
81
82 #define MIN_MATCH 3
83 #define MAX_MATCH 258
84 /* The minimum and maximum match lengths */
85
86 #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
87
88 /* target dependencies */
89
90 #ifdef MSDOS
91 # define OS_CODE 0x00
92 # if defined(__TURBOC__) || defined(__BORLANDC__)
93 # if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
94 /* Allow compilation with ANSI keywords only enabled */
95 void _Cdecl farfree( void *block );
96 void *_Cdecl farmalloc( unsigned long nbytes );
97 # else
98 # include <alloc.h>
99 # endif
100 # else /* MSC or DJGPP */
101 # include <malloc.h>
102 # endif
103 #endif
104
105 #ifdef OS2
106 # define OS_CODE 0x06
107 #endif
108
109 #ifdef WIN32 /* Window 95 & Windows NT */
110 # define OS_CODE 0x0b
111 #endif
112
113 #if defined(VAXC) || defined(VMS)
114 # define OS_CODE 0x02
115 # define F_OPEN(name, mode) \
116 fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
117 #endif
118
119 #ifdef AMIGA
120 # define OS_CODE 0x01
121 #endif
122
123 #if defined(ATARI) || defined(atarist)
124 # define OS_CODE 0x05
125 #endif
126
127 #if defined(MACOS) || defined(TARGET_OS_MAC)
128 # define OS_CODE 0x07
129 # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
130 # include <unix.h> /* for fdopen */
131 # else
132 # ifndef fdopen
133 # define fdopen(fd,mode) NULL /* No fdopen() */
134 # endif
135 # endif
136 #endif
137
138 #ifdef __50SERIES /* Prime/PRIMOS */
139 # define OS_CODE 0x0F
140 #endif
141
142 #ifdef TOPS20
143 # define OS_CODE 0x0a
144 #endif
145
146 #if defined(_BEOS_) || defined(RISCOS)
147 # define fdopen(fd,mode) NULL /* No fdopen() */
148 #endif
149
150 #if (defined(_MSC_VER) && (_MSC_VER > 600))
151 # define fdopen(fd,type) _fdopen(fd,type)
152 #endif
153
154
155 /* Common defaults */
156
157 #ifndef OS_CODE
158 # define OS_CODE 0x03 /* assume Unix */
159 #endif
160
161 #ifndef F_OPEN
162 # define F_OPEN(name, mode) fopen((name), (mode))
163 #endif
164
165 /* functions */
166
167 #ifdef HAVE_STRERROR
168 extern char *strerror OF((int));
169 # define zstrerror(errnum) strerror(errnum)
170 #else
171 # define zstrerror(errnum) ""
172 #endif
173
174 #if defined(pyr)
175 # define NO_MEMCPY
176 #endif
177 #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
178 /* Use our own functions for small and medium model with MSC <= 5.0.
179 * You may have to use the same strategy for Borland C (untested).
180 * The __SC__ check is for Symantec.
181 */
182 # define NO_MEMCPY
183 #endif
184 #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
185 # define HAVE_MEMCPY
186 #endif
187 #ifdef HAVE_MEMCPY
188 # ifdef SMALL_MEDIUM /* MSDOS small or medium model */
189 # define zmemcpy _fmemcpy
190 # define zmemcmp _fmemcmp
191 # define zmemzero(dest, len) _fmemset(dest, 0, len)
192 # else
193 # define zmemcpy memcpy
194 # define zmemcmp memcmp
195 # define zmemzero(dest, len) memset(dest, 0, len)
196 # endif
197 #else
198 extern void pvpgn_zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
199 extern int pvpgn_zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
200 extern void pvpgn_zmemzero OF((Bytef* dest, uInt len));
201 #endif
202
203 /* Diagnostic functions */
204 #ifdef DEBUG
205 # include <stdio.h>
206 extern int pvpgn_z_verbose;
207 extern void pvpgn_z_error OF((char *m));
208 # define Assert(cond,msg) {if(!(cond)) z_error(msg);}
209 # define Trace(x) {if (z_verbose>=0) fprintf x ;}
210 # define Tracev(x) {if (z_verbose>0) fprintf x ;}
211 # define Tracevv(x) {if (z_verbose>1) fprintf x ;}
212 # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
213 # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
214 #else
215 # define Assert(cond,msg)
216 # define Trace(x)
217 # define Tracev(x)
218 # define Tracevv(x)
219 # define Tracec(c,x)
220 # define Tracecv(c,x)
221 #endif
222
223
224 typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf,
225 uInt len));
226 voidpf pvpgn_zcalloc OF((voidpf opaque, unsigned items, unsigned size));
227 void pvpgn_zcfree OF((voidpf opaque, voidpf ptr));
228
229 #define ZALLOC(strm, items, size) \
230 (*((strm)->zalloc))((strm)->opaque, (items), (size))
231 #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
232 #define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
233
234 #endif /* _Z_UTIL_H */

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1