1 /* zconf.h -- configuration of the zlib compression library
2  * Copyright (C) 1995-2005 Jean-loup Gailly.
3  * For conditions of distribution and use, see copyright notice in zlib.h
4  */
5 
6 
7 /* $Id: zconf.h,v 1.17.2.5 2007/03/23 11:08:30 rjs Exp $ */
8 /* @(#) $Id: zconf.h,v 1.17.2.5 2007/03/23 11:08:30 rjs Exp $ */
9 
10 #ifndef ZCONF_H
11 #define ZCONF_H
12 
13 #include "pc_config.h"
14 #include "zprefix.h"
15 
16 #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
17 #  define WIN32
18 #endif
19 
20 #if defined(__MSDOS__) && !defined(MSDOS)
21 #  define MSDOS
22 #endif
23 #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
24 #  define OS2
25 #endif
26 #if defined(_WINDOWS) && !defined(WINDOWS)
27 #  define WINDOWS
28 #endif
29 #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
30 #  ifndef WIN32
31 #    define WIN32
32 #  endif
33 #endif
34 #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
35 #  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
36 #    ifndef SYS16BIT
37 #      define SYS16BIT
38 #    endif
39 #  endif
40 #endif
41 
42 /* PDFlib GmbH: Windows CE portability */
43 #ifdef _WIN32_WCE
44 #define NO_ERRNO_H
45 #endif
46 
47 /*
48  * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
49  * than 64k bytes at a time (needed on systems with 16-bit int).
50  */
51 #ifdef SYS16BIT
52 #  define MAXSEG_64K
53 #endif
54 #ifdef MSDOS
55 #  define UNALIGNED_OK
56 #endif
57 
58 #ifndef STDC	/* PDFlib GmbH: we require ANSI C anyway */
59 #define STDC
60 #endif
61 
62 /* Some Mac compilers merge all .h files incorrectly: */
63 #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
64 #  define NO_DUMMY_DECL
65 #endif
66 
67 /* Maximum value for memLevel in deflateInit2 */
68 #ifndef MAX_MEM_LEVEL
69 #  ifdef MAXSEG_64K
70 #    define MAX_MEM_LEVEL 8
71 #  else
72 #    define MAX_MEM_LEVEL 9
73 #  endif
74 #endif
75 
76 /* Maximum value for windowBits in deflateInit2 and inflateInit2.
77  * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
78  * created by gzip. (Files created by minigzip can still be extracted by
79  * gzip.)
80  */
81 #ifndef MAX_WBITS
82 #  define MAX_WBITS   15 /* 32K LZ77 window */
83 #endif
84 
85 /* The memory requirements for deflate are (in bytes):
86             (1 << (windowBits+2)) +  (1 << (memLevel+9))
87  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
88  plus a few kilobytes for small objects. For example, if you want to reduce
89  the default memory requirements from 256K to 128K, compile with
90      make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
91  Of course this will generally degrade compression (there's no free lunch).
92 
93    The memory requirements for inflate are (in bytes) 1 << windowBits
94  that is, 32K for windowBits=15 (default value) plus a few kilobytes
95  for small objects.
96 */
97 
98                         /* Type declarations */
99 
100 #ifndef OF /* function prototypes */
101 #  ifdef STDC
102 #    define OF(args)  args
103 #  else
104 #    define OF(args)  ()
105 #  endif
106 #endif
107 
108 /* The following definitions for FAR are needed only for MSDOS mixed
109  * model programming (small or medium model with some far allocations).
110  * This was tested only with MSC; for other MSDOS compilers you may have
111  * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
112  * just define FAR to be empty.
113  */
114 #ifdef SYS16BIT
115 #  if defined(M_I86SM) || defined(M_I86MM)
116      /* MSC small or medium model */
117 #    define SMALL_MEDIUM
118 #    ifdef _MSC_VER
119 #      define FAR _far
120 #    else
121 #      define FAR far
122 #    endif
123 #  endif
124 #  if (defined(__SMALL__) || defined(__MEDIUM__))
125      /* Turbo C small or medium model */
126 #    define SMALL_MEDIUM
127 #    ifdef __BORLANDC__
128 #      define FAR _far
129 #    else
130 #      define FAR far
131 #    endif
132 #  endif
133 #endif
134 
135 #if defined(WINDOWS) || defined(WIN32)
136    /* If building or using zlib as a DLL, define ZLIB_DLL.
137     * This is not mandatory, but it offers a little performance increase.
138     */
139 #  ifdef ZLIB_DLL
140 #    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
141 #      ifdef ZLIB_INTERNAL
142 #        define ZEXTERN extern __declspec(dllexport)
143 #      else
144 #        define ZEXTERN extern __declspec(dllimport)
145 #      endif
146 #    endif
147 #  endif  /* ZLIB_DLL */
148    /* If building or using zlib with the WINAPI/WINAPIV calling convention,
149     * define ZLIB_WINAPI.
150     * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
151     */
152 #  ifdef ZLIB_WINAPI
153 #    ifdef FAR
154 #      undef FAR
155 #    endif
156 #    include <windows.h>
157      /* No need for _export, use ZLIB.DEF instead. */
158      /* For complete Windows compatibility, use WINAPI, not __stdcall. */
159 #    define ZEXPORT WINAPI
160 #    ifdef WIN32
161 #      define ZEXPORTVA WINAPIV
162 #    else
163 #      define ZEXPORTVA FAR CDECL
164 #    endif
165 #  endif
166 #endif
167 
168 #if defined (__BEOS__)
169 #  ifdef ZLIB_DLL
170 #    ifdef ZLIB_INTERNAL
171 #      define ZEXPORT   __declspec(dllexport)
172 #      define ZEXPORTVA __declspec(dllexport)
173 #    else
174 #      define ZEXPORT   __declspec(dllimport)
175 #      define ZEXPORTVA __declspec(dllimport)
176 #    endif
177 #  endif
178 #endif
179 
180 #ifndef ZEXTERN
181 #  define ZEXTERN extern
182 #endif
183 #ifndef ZEXPORT
184 #  define ZEXPORT
185 #endif
186 #ifndef ZEXPORTVA
187 #  define ZEXPORTVA
188 #endif
189 
190 #ifndef FAR
191 #  define FAR
192 #endif
193 
194 /* PDFlib GmbH: also do the typedef on the Mac
195 #if defined(MAC) || defined(MACOSX)
196 #include <MacTypes.h>
197 #else
198 */
199 #if !defined(__MACTYPES__)
200 typedef unsigned char  Byte;  /* 8 bits */
201 #endif
202 
203 typedef unsigned int   uInt;  /* 16 bits or more */
204 typedef unsigned long  uLong; /* 32 bits or more */
205 
206 #ifdef SMALL_MEDIUM
207    /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
208 #  define Bytef Byte FAR
209 #else
210    typedef Byte  FAR Bytef;
211 #endif
212 typedef char  FAR charf;
213 typedef int   FAR intf;
214 typedef uInt  FAR uIntf;
215 typedef uLong FAR uLongf;
216 
217 #ifdef STDC
218    typedef void const *voidpc;
219    typedef void FAR   *voidpf;
220    typedef void       *voidp;
221 #else
222    typedef Byte const *voidpc;
223    typedef Byte FAR   *voidpf;
224    typedef Byte       *voidp;
225 #endif
226 
227 /* PDFlib GmbH: Windows portability */
228 #if !defined(WIN32) && !defined(OS2) && !defined(MAC)
229 #  include <sys/types.h> /* for off_t */
230 #  include <unistd.h>    /* for SEEK_* and off_t */
231 #  ifdef VMS
232 #    include <unixio.h>   /* for off_t */
233 #  endif
234 #  define z_off_t off_t
235 #endif
236 
237 #ifndef SEEK_SET
238 #  define SEEK_SET        0       /* Seek from beginning of file.  */
239 #  define SEEK_CUR        1       /* Seek from current position.  */
240 #  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
241 #endif
242 #ifndef z_off_t
243 #  define z_off_t long
244 #endif
245 
246 #if defined(__OS400__)
247 #  define NO_vsnprintf
248 #endif
249 
250 #if defined(__MVS__)
251 #  define NO_vsnprintf
252 #  ifdef FAR
253 #    undef FAR
254 #    define FAR
255 #  endif
256 #endif
257 
258 /* MVS linker does not support external names larger than 8 bytes */
259 
260 /* PDFlib GmbH: This is not true anymore....
261 ** But it won't hurt anything to do it .
262 */
263 
264 #if defined(__MVS__)
265 #   pragma map(deflateInit_,"DEIN")
266 #   pragma map(deflateInit2_,"DEIN2")
267 #   pragma map(deflateEnd,"DEEND")
268 #   pragma map(deflateBound,"DEBND")
269 #   pragma map(inflateInit_,"ININ")
270 #   pragma map(inflateInit2_,"ININ2")
271 #   pragma map(inflateEnd,"INEND")
272 #   pragma map(inflateSync,"INSY")
273 #   pragma map(inflateSetDictionary,"INSEDI")
274 #   pragma map(compressBound,"CMBND")
275 #   pragma map(inflate_table,"INTABL")
276 #   pragma map(inflate_fast,"INFA")
277 #   pragma map(inflate_copyright,"INCOPY")
278 #endif
279 
280 #endif /* ZCONF_H */
281