• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* zconf.h -- configuration of the zlib compression library
2  * Copyright (C) 1995-2003 Jean-loup Gailly.
3  * For conditions of distribution and use, see copyright notice in zlib.h
4  */
5 
6 
7 #ifndef ZCONF_H
8 #define ZCONF_H
9 
10 /*
11  * If you *really* need a unique prefix for all types and library functions,
12  * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
13  */
14 #ifdef Z_PREFIX
15 #  define deflateInit_  z_deflateInit_
16 #  define deflate       z_deflate
17 #  define deflateEnd    z_deflateEnd
18 #  define inflateInit_  z_inflateInit_
19 #  define inflate       z_inflate
20 #  define inflateEnd    z_inflateEnd
21 #  define deflateInit2_ z_deflateInit2_
22 #  define deflateSetDictionary z_deflateSetDictionary
23 #  define deflateCopy   z_deflateCopy
24 #  define deflateReset  z_deflateReset
25 #  define deflatePrime  z_deflatePrime
26 #  define deflateParams z_deflateParams
27 #  define deflateBound  z_deflateBound
28 #  define inflateInit2_ z_inflateInit2_
29 #  define inflateSetDictionary z_inflateSetDictionary
30 #  define inflateSync   z_inflateSync
31 #  define inflateSyncPoint z_inflateSyncPoint
32 #  define inflateCopy   z_inflateCopy
33 #  define inflateReset  z_inflateReset
34 #  define compress      z_compress
35 #  define compress2     z_compress2
36 #  define compressBound z_compressBound
37 #  define uncompress    z_uncompress
38 #  define adler32       z_adler32
39 #  define crc32         z_crc32
40 #  define get_crc_table z_get_crc_table
41 
42 #  define Byte          z_Byte
43 #  define uInt          z_uInt
44 #  define uLong         z_uLong
45 #  define Bytef         z_Bytef
46 #  define charf         z_charf
47 #  define intf          z_intf
48 #  define uIntf         z_uIntf
49 #  define uLongf        z_uLongf
50 #  define voidpf        z_voidpf
51 #  define voidp         z_voidp
52 #endif
53 
54 #if defined(__MSDOS__) && !defined(MSDOS)
55 #  define MSDOS
56 #endif
57 #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
58 #  define OS2
59 #endif
60 #if defined(_WINDOWS) && !defined(WINDOWS)
61 #  define WINDOWS
62 #endif
63 #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
64 #  define WIN32
65 #endif
66 #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
67 #  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
68 #    ifndef SYS16BIT
69 #      define SYS16BIT
70 #    endif
71 #  endif
72 #endif
73 
74 /*
75  * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
76  * than 64k bytes at a time (needed on systems with 16-bit int).
77  */
78 #ifdef SYS16BIT
79 #  define MAXSEG_64K
80 #endif
81 #ifdef MSDOS
82 #  define UNALIGNED_OK
83 #endif
84 
85 #ifdef __STDC_VERSION__
86 #  ifndef STDC
87 #    define STDC
88 #  endif
89 #  if __STDC_VERSION__ >= 199901L
90 #    ifndef STDC99
91 #      define STDC99
92 #    endif
93 #  endif
94 #endif
95 #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
96 #  define STDC
97 #endif
98 #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
99 #  define STDC
100 #endif
101 #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
102 #  define STDC
103 #endif
104 #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
105 #  define STDC
106 #endif
107 
108 #if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
109 #  define STDC
110 #endif
111 
112 #ifndef STDC
113 #  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
114 #    define const       /* note: need a more gentle solution here */
115 #  endif
116 #endif
117 
118 /* Some Mac compilers merge all .h files incorrectly: */
119 #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
120 #  define NO_DUMMY_DECL
121 #endif
122 
123 /* Maximum value for memLevel in deflateInit2 */
124 #ifndef MAX_MEM_LEVEL
125 #  ifdef MAXSEG_64K
126 #    define MAX_MEM_LEVEL 8
127 #  else
128 #    define MAX_MEM_LEVEL 9
129 #  endif
130 #endif
131 
132 /* Maximum value for windowBits in deflateInit2 and inflateInit2.
133  * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
134  * created by gzip. (Files created by minigzip can still be extracted by
135  * gzip.)
136  */
137 #ifndef MAX_WBITS
138 #  define MAX_WBITS   15 /* 32K LZ77 window */
139 #endif
140 
141 /* The memory requirements for deflate are (in bytes):
142             (1 << (windowBits+2)) +  (1 << (memLevel+9))
143  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
144  plus a few kilobytes for small objects. For example, if you want to reduce
145  the default memory requirements from 256K to 128K, compile with
146      make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
147  Of course this will generally degrade compression (there's no free lunch).
148 
149    The memory requirements for inflate are (in bytes) 1 << windowBits
150  that is, 32K for windowBits=15 (default value) plus a few kilobytes
151  for small objects.
152 */
153 
154                         /* Type declarations */
155 
156 #ifndef OF /* function prototypes */
157 #  ifdef STDC
158 #    define OF(args)  args
159 #  else
160 #    define OF(args)  ()
161 #  endif
162 #endif
163 
164 /* The following definitions for FAR are needed only for MSDOS mixed
165  * model programming (small or medium model with some far allocations).
166  * This was tested only with MSC; for other MSDOS compilers you may have
167  * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
168  * just define FAR to be empty.
169  */
170 #ifdef SYS16BIT
171 #  if defined(M_I86SM) || defined(M_I86MM)
172      /* MSC small or medium model */
173 #    define SMALL_MEDIUM
174 #    ifdef _MSC_VER
175 #      define FAR _far
176 #    else
177 #      define FAR far
178 #    endif
179 #  endif
180 #  if (defined(__SMALL__) || defined(__MEDIUM__))
181      /* Turbo C small or medium model */
182 #    define SMALL_MEDIUM
183 #    ifdef __BORLANDC__
184 #      define FAR _far
185 #    else
186 #      define FAR far
187 #    endif
188 #  endif
189 #endif
190 
191 #if defined(WINDOWS) || defined(WIN32)
192    /* If building or using zlib as a DLL, define ZLIB_DLL.
193     * This is not mandatory, but it offers a little performance increase.
194     */
195 #  ifdef ZLIB_DLL
196 #    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
197 #      ifdef ZLIB_INTERNAL
198 #        define ZEXTERN extern __declspec(dllexport)
199 #      else
200 #        define ZEXTERN extern __declspec(dllimport)
201 #      endif
202 #    endif
203 #  endif  /* ZLIB_DLL */
204    /* If building or using zlib with the WINAPI/WINAPIV calling convention,
205     * define ZLIB_WINAPI.
206     * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
207     */
208 #  ifdef ZLIB_WINAPI
209 #    ifdef FAR
210 #      undef FAR
211 #    endif
212 #    include <windows.h>
213      /* No need for _export, use ZLIB.DEF instead. */
214      /* For complete Windows compatibility, use WINAPI, not __stdcall. */
215 #    define ZEXPORT WINAPI
216 #    ifdef WIN32
217 #      define ZEXPORTVA WINAPIV
218 #    else
219 #      define ZEXPORTVA FAR CDECL
220 #    endif
221 #  endif
222 #endif
223 
224 #if defined (__BEOS__)
225 #  ifdef ZLIB_DLL
226 #    ifdef ZLIB_INTERNAL
227 #      define ZEXPORT   __declspec(dllexport)
228 #      define ZEXPORTVA __declspec(dllexport)
229 #    else
230 #      define ZEXPORT   __declspec(dllimport)
231 #      define ZEXPORTVA __declspec(dllimport)
232 #    endif
233 #  endif
234 #endif
235 
236 #ifndef ZEXTERN
237 #  define ZEXTERN extern
238 #endif
239 #ifndef ZEXPORT
240 #  define ZEXPORT
241 #endif
242 #ifndef ZEXPORTVA
243 #  define ZEXPORTVA
244 #endif
245 
246 #ifndef FAR
247 #  define FAR
248 #endif
249 
250 #if !defined(__MACTYPES__)
251 typedef unsigned char  Byte;  /* 8 bits */
252 #endif
253 typedef unsigned int   uInt;  /* 16 bits or more */
254 typedef unsigned long  uLong; /* 32 bits or more */
255 
256 #ifdef SMALL_MEDIUM
257    /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
258 #  define Bytef Byte FAR
259 #else
260    typedef Byte  FAR Bytef;
261 #endif
262 typedef char  FAR charf;
263 typedef int   FAR intf;
264 typedef uInt  FAR uIntf;
265 typedef uLong FAR uLongf;
266 
267 #ifdef STDC
268    typedef void const *voidpc;
269    typedef void FAR   *voidpf;
270    typedef void       *voidp;
271 #else
272    typedef Byte const *voidpc;
273    typedef Byte FAR   *voidpf;
274    typedef Byte       *voidp;
275 #endif
276 
277 #if 0           /* HAVE_UNISTD_H -- this line is updated by ./configure */
278 #  include <sys/types.h> /* for off_t */
279 #  include <unistd.h>    /* for SEEK_* and off_t */
280 #  ifdef VMS
281 #    include <unixio.h>   /* for off_t */
282 #  endif
283 #  define z_off_t  off_t
284 #endif
285 #ifndef SEEK_SET
286 #  define SEEK_SET        0       /* Seek from beginning of file.  */
287 #  define SEEK_CUR        1       /* Seek from current position.  */
288 #  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
289 #endif
290 #ifndef z_off_t
291 #  define  z_off_t long
292 #endif
293 
294 #if defined(__OS400__)
295 #define NO_vsnprintf
296 #endif
297 
298 #if defined(__MVS__)
299 #  define NO_vsnprintf
300 #  ifdef FAR
301 #    undef FAR
302 #  endif
303 #endif
304 
305 /* MVS linker does not support external names larger than 8 bytes */
306 #if defined(__MVS__)
307 #   pragma map(deflateInit_,"DEIN")
308 #   pragma map(deflateInit2_,"DEIN2")
309 #   pragma map(deflateEnd,"DEEND")
310 #   pragma map(deflateBound,"DEBND")
311 #   pragma map(inflateInit_,"ININ")
312 #   pragma map(inflateInit2_,"ININ2")
313 #   pragma map(inflateEnd,"INEND")
314 #   pragma map(inflateSync,"INSY")
315 #   pragma map(inflateSetDictionary,"INSEDI")
316 #   pragma map(compressBound,"CMBND")
317 #   pragma map(inflate_table,"INTABL")
318 #   pragma map(inflate_fast,"INFA")
319 #   pragma map(inflate_copyright,"INCOPY")
320 #endif
321 
322 #endif /* ZCONF_H */
323