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