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