source: umon/main/zlib/zutil.h @ 87db514

Last change on this file since 87db514 was 87db514, checked in by Amar Takhar <amar@…>, on 04/16/15 at 19:26:21

Initial commit of the umon repository.

Prior to this three changes were made:

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