Dependencies:   emwin_lib

Fork of DMemWin by Embedded Artists

Committer:
destinyXfate
Date:
Thu Jun 02 04:52:54 2016 +0000
Revision:
2:0e2ef1edf01b
;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
destinyXfate 2:0e2ef1edf01b 1 /* zutil.h -- internal interface and configuration of the compression library
destinyXfate 2:0e2ef1edf01b 2 * Copyright (C) 1995-2005 Jean-loup Gailly.
destinyXfate 2:0e2ef1edf01b 3 * For conditions of distribution and use, see copyright notice in zlib.h
destinyXfate 2:0e2ef1edf01b 4 */
destinyXfate 2:0e2ef1edf01b 5
destinyXfate 2:0e2ef1edf01b 6 /* WARNING: this file should *not* be used by applications. It is
destinyXfate 2:0e2ef1edf01b 7 part of the implementation of the compression library and is
destinyXfate 2:0e2ef1edf01b 8 subject to change. Applications should only use zlib.h.
destinyXfate 2:0e2ef1edf01b 9 */
destinyXfate 2:0e2ef1edf01b 10
destinyXfate 2:0e2ef1edf01b 11 /* @(#) $Id$ */
destinyXfate 2:0e2ef1edf01b 12
destinyXfate 2:0e2ef1edf01b 13 #ifndef ZUTIL_H
destinyXfate 2:0e2ef1edf01b 14 #define ZUTIL_H
destinyXfate 2:0e2ef1edf01b 15
destinyXfate 2:0e2ef1edf01b 16 #define ZLIB_INTERNAL
destinyXfate 2:0e2ef1edf01b 17 #include "zlib.h"
destinyXfate 2:0e2ef1edf01b 18
destinyXfate 2:0e2ef1edf01b 19 #ifdef STDC
destinyXfate 2:0e2ef1edf01b 20 # ifndef _WIN32_WCE
destinyXfate 2:0e2ef1edf01b 21 # include <stddef.h>
destinyXfate 2:0e2ef1edf01b 22 # endif
destinyXfate 2:0e2ef1edf01b 23 # include <string.h>
destinyXfate 2:0e2ef1edf01b 24 # include <stdlib.h>
destinyXfate 2:0e2ef1edf01b 25 #endif
destinyXfate 2:0e2ef1edf01b 26 #ifdef NO_ERRNO_H
destinyXfate 2:0e2ef1edf01b 27 # ifdef _WIN32_WCE
destinyXfate 2:0e2ef1edf01b 28 /* The Microsoft C Run-Time Library for Windows CE doesn't have
destinyXfate 2:0e2ef1edf01b 29 * errno. We define it as a global variable to simplify porting.
destinyXfate 2:0e2ef1edf01b 30 * Its value is always 0 and should not be used. We rename it to
destinyXfate 2:0e2ef1edf01b 31 * avoid conflict with other libraries that use the same workaround.
destinyXfate 2:0e2ef1edf01b 32 */
destinyXfate 2:0e2ef1edf01b 33 # define errno z_errno
destinyXfate 2:0e2ef1edf01b 34 # endif
destinyXfate 2:0e2ef1edf01b 35 extern int errno;
destinyXfate 2:0e2ef1edf01b 36 #else
destinyXfate 2:0e2ef1edf01b 37 # ifndef _WIN32_WCE
destinyXfate 2:0e2ef1edf01b 38 # include <errno.h>
destinyXfate 2:0e2ef1edf01b 39 # endif
destinyXfate 2:0e2ef1edf01b 40 #endif
destinyXfate 2:0e2ef1edf01b 41
destinyXfate 2:0e2ef1edf01b 42 #ifndef local
destinyXfate 2:0e2ef1edf01b 43 # define local static
destinyXfate 2:0e2ef1edf01b 44 #endif
destinyXfate 2:0e2ef1edf01b 45 /* compile with -Dlocal if your debugger can't find static symbols */
destinyXfate 2:0e2ef1edf01b 46
destinyXfate 2:0e2ef1edf01b 47 typedef unsigned char uch;
destinyXfate 2:0e2ef1edf01b 48 typedef uch FAR uchf;
destinyXfate 2:0e2ef1edf01b 49 typedef unsigned short ush;
destinyXfate 2:0e2ef1edf01b 50 typedef ush FAR ushf;
destinyXfate 2:0e2ef1edf01b 51 typedef unsigned long ulg;
destinyXfate 2:0e2ef1edf01b 52
destinyXfate 2:0e2ef1edf01b 53 extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
destinyXfate 2:0e2ef1edf01b 54 /* (size given to avoid silly warnings with Visual C++) */
destinyXfate 2:0e2ef1edf01b 55
destinyXfate 2:0e2ef1edf01b 56 #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
destinyXfate 2:0e2ef1edf01b 57
destinyXfate 2:0e2ef1edf01b 58 #define ERR_RETURN(strm,err) \
destinyXfate 2:0e2ef1edf01b 59 return (strm->msg = (char*)ERR_MSG(err), (err))
destinyXfate 2:0e2ef1edf01b 60 /* To be used only when the state is known to be valid */
destinyXfate 2:0e2ef1edf01b 61
destinyXfate 2:0e2ef1edf01b 62 /* common constants */
destinyXfate 2:0e2ef1edf01b 63
destinyXfate 2:0e2ef1edf01b 64 #ifndef DEF_WBITS
destinyXfate 2:0e2ef1edf01b 65 # define DEF_WBITS MAX_WBITS
destinyXfate 2:0e2ef1edf01b 66 #endif
destinyXfate 2:0e2ef1edf01b 67 /* default windowBits for decompression. MAX_WBITS is for compression only */
destinyXfate 2:0e2ef1edf01b 68
destinyXfate 2:0e2ef1edf01b 69 #if MAX_MEM_LEVEL >= 8
destinyXfate 2:0e2ef1edf01b 70 # define DEF_MEM_LEVEL 8
destinyXfate 2:0e2ef1edf01b 71 #else
destinyXfate 2:0e2ef1edf01b 72 # define DEF_MEM_LEVEL MAX_MEM_LEVEL
destinyXfate 2:0e2ef1edf01b 73 #endif
destinyXfate 2:0e2ef1edf01b 74 /* default memLevel */
destinyXfate 2:0e2ef1edf01b 75
destinyXfate 2:0e2ef1edf01b 76 #define STORED_BLOCK 0
destinyXfate 2:0e2ef1edf01b 77 #define STATIC_TREES 1
destinyXfate 2:0e2ef1edf01b 78 #define DYN_TREES 2
destinyXfate 2:0e2ef1edf01b 79 /* The three kinds of block type */
destinyXfate 2:0e2ef1edf01b 80
destinyXfate 2:0e2ef1edf01b 81 #define MIN_MATCH 3
destinyXfate 2:0e2ef1edf01b 82 #define MAX_MATCH 258
destinyXfate 2:0e2ef1edf01b 83 /* The minimum and maximum match lengths */
destinyXfate 2:0e2ef1edf01b 84
destinyXfate 2:0e2ef1edf01b 85 #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
destinyXfate 2:0e2ef1edf01b 86
destinyXfate 2:0e2ef1edf01b 87 /* target dependencies */
destinyXfate 2:0e2ef1edf01b 88
destinyXfate 2:0e2ef1edf01b 89 #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
destinyXfate 2:0e2ef1edf01b 90 # define OS_CODE 0x00
destinyXfate 2:0e2ef1edf01b 91 # if defined(__TURBOC__) || defined(__BORLANDC__)
destinyXfate 2:0e2ef1edf01b 92 # if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
destinyXfate 2:0e2ef1edf01b 93 /* Allow compilation with ANSI keywords only enabled */
destinyXfate 2:0e2ef1edf01b 94 void _Cdecl farfree( void *block );
destinyXfate 2:0e2ef1edf01b 95 void *_Cdecl farmalloc( unsigned long nbytes );
destinyXfate 2:0e2ef1edf01b 96 # else
destinyXfate 2:0e2ef1edf01b 97 # include <alloc.h>
destinyXfate 2:0e2ef1edf01b 98 # endif
destinyXfate 2:0e2ef1edf01b 99 # else /* MSC or DJGPP */
destinyXfate 2:0e2ef1edf01b 100 # include <malloc.h>
destinyXfate 2:0e2ef1edf01b 101 # endif
destinyXfate 2:0e2ef1edf01b 102 #endif
destinyXfate 2:0e2ef1edf01b 103
destinyXfate 2:0e2ef1edf01b 104 #ifdef AMIGA
destinyXfate 2:0e2ef1edf01b 105 # define OS_CODE 0x01
destinyXfate 2:0e2ef1edf01b 106 #endif
destinyXfate 2:0e2ef1edf01b 107
destinyXfate 2:0e2ef1edf01b 108 #if defined(VAXC) || defined(VMS)
destinyXfate 2:0e2ef1edf01b 109 # define OS_CODE 0x02
destinyXfate 2:0e2ef1edf01b 110 # define F_OPEN(name, mode) \
destinyXfate 2:0e2ef1edf01b 111 fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
destinyXfate 2:0e2ef1edf01b 112 #endif
destinyXfate 2:0e2ef1edf01b 113
destinyXfate 2:0e2ef1edf01b 114 #if defined(ATARI) || defined(atarist)
destinyXfate 2:0e2ef1edf01b 115 # define OS_CODE 0x05
destinyXfate 2:0e2ef1edf01b 116 #endif
destinyXfate 2:0e2ef1edf01b 117
destinyXfate 2:0e2ef1edf01b 118 #ifdef OS2
destinyXfate 2:0e2ef1edf01b 119 # define OS_CODE 0x06
destinyXfate 2:0e2ef1edf01b 120 # ifdef M_I86
destinyXfate 2:0e2ef1edf01b 121 #include <malloc.h>
destinyXfate 2:0e2ef1edf01b 122 # endif
destinyXfate 2:0e2ef1edf01b 123 #endif
destinyXfate 2:0e2ef1edf01b 124
destinyXfate 2:0e2ef1edf01b 125 #if defined(MACOS) || defined(TARGET_OS_MAC)
destinyXfate 2:0e2ef1edf01b 126 # define OS_CODE 0x07
destinyXfate 2:0e2ef1edf01b 127 # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
destinyXfate 2:0e2ef1edf01b 128 # include <unix.h> /* for fdopen */
destinyXfate 2:0e2ef1edf01b 129 # else
destinyXfate 2:0e2ef1edf01b 130 # ifndef fdopen
destinyXfate 2:0e2ef1edf01b 131 # define fdopen(fd,mode) NULL /* No fdopen() */
destinyXfate 2:0e2ef1edf01b 132 # endif
destinyXfate 2:0e2ef1edf01b 133 # endif
destinyXfate 2:0e2ef1edf01b 134 #endif
destinyXfate 2:0e2ef1edf01b 135
destinyXfate 2:0e2ef1edf01b 136 #ifdef TOPS20
destinyXfate 2:0e2ef1edf01b 137 # define OS_CODE 0x0a
destinyXfate 2:0e2ef1edf01b 138 #endif
destinyXfate 2:0e2ef1edf01b 139
destinyXfate 2:0e2ef1edf01b 140 #ifdef WIN32
destinyXfate 2:0e2ef1edf01b 141 # ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */
destinyXfate 2:0e2ef1edf01b 142 # define OS_CODE 0x0b
destinyXfate 2:0e2ef1edf01b 143 # endif
destinyXfate 2:0e2ef1edf01b 144 #endif
destinyXfate 2:0e2ef1edf01b 145
destinyXfate 2:0e2ef1edf01b 146 #ifdef __50SERIES /* Prime/PRIMOS */
destinyXfate 2:0e2ef1edf01b 147 # define OS_CODE 0x0f
destinyXfate 2:0e2ef1edf01b 148 #endif
destinyXfate 2:0e2ef1edf01b 149
destinyXfate 2:0e2ef1edf01b 150 #if defined(_BEOS_) || defined(RISCOS)
destinyXfate 2:0e2ef1edf01b 151 # define fdopen(fd,mode) NULL /* No fdopen() */
destinyXfate 2:0e2ef1edf01b 152 #endif
destinyXfate 2:0e2ef1edf01b 153
destinyXfate 2:0e2ef1edf01b 154 #if (defined(_MSC_VER) && (_MSC_VER > 600))
destinyXfate 2:0e2ef1edf01b 155 # if defined(_WIN32_WCE)
destinyXfate 2:0e2ef1edf01b 156 # define fdopen(fd,mode) NULL /* No fdopen() */
destinyXfate 2:0e2ef1edf01b 157 # ifndef _PTRDIFF_T_DEFINED
destinyXfate 2:0e2ef1edf01b 158 typedef int ptrdiff_t;
destinyXfate 2:0e2ef1edf01b 159 # define _PTRDIFF_T_DEFINED
destinyXfate 2:0e2ef1edf01b 160 # endif
destinyXfate 2:0e2ef1edf01b 161 # else
destinyXfate 2:0e2ef1edf01b 162 # define fdopen(fd,type) _fdopen(fd,type)
destinyXfate 2:0e2ef1edf01b 163 # endif
destinyXfate 2:0e2ef1edf01b 164 #endif
destinyXfate 2:0e2ef1edf01b 165
destinyXfate 2:0e2ef1edf01b 166 /* common defaults */
destinyXfate 2:0e2ef1edf01b 167
destinyXfate 2:0e2ef1edf01b 168 #ifndef OS_CODE
destinyXfate 2:0e2ef1edf01b 169 # define OS_CODE 0x03 /* assume Unix */
destinyXfate 2:0e2ef1edf01b 170 #endif
destinyXfate 2:0e2ef1edf01b 171
destinyXfate 2:0e2ef1edf01b 172 #ifndef F_OPEN
destinyXfate 2:0e2ef1edf01b 173 # define F_OPEN(name, mode) fopen((name), (mode))
destinyXfate 2:0e2ef1edf01b 174 #endif
destinyXfate 2:0e2ef1edf01b 175
destinyXfate 2:0e2ef1edf01b 176 /* functions */
destinyXfate 2:0e2ef1edf01b 177
destinyXfate 2:0e2ef1edf01b 178 #if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
destinyXfate 2:0e2ef1edf01b 179 # ifndef HAVE_VSNPRINTF
destinyXfate 2:0e2ef1edf01b 180 # define HAVE_VSNPRINTF
destinyXfate 2:0e2ef1edf01b 181 # endif
destinyXfate 2:0e2ef1edf01b 182 #endif
destinyXfate 2:0e2ef1edf01b 183 #if defined(__CYGWIN__)
destinyXfate 2:0e2ef1edf01b 184 # ifndef HAVE_VSNPRINTF
destinyXfate 2:0e2ef1edf01b 185 # define HAVE_VSNPRINTF
destinyXfate 2:0e2ef1edf01b 186 # endif
destinyXfate 2:0e2ef1edf01b 187 #endif
destinyXfate 2:0e2ef1edf01b 188 #ifndef HAVE_VSNPRINTF
destinyXfate 2:0e2ef1edf01b 189 # ifdef MSDOS
destinyXfate 2:0e2ef1edf01b 190 /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
destinyXfate 2:0e2ef1edf01b 191 but for now we just assume it doesn't. */
destinyXfate 2:0e2ef1edf01b 192 # define NO_vsnprintf
destinyXfate 2:0e2ef1edf01b 193 # endif
destinyXfate 2:0e2ef1edf01b 194 # ifdef __TURBOC__
destinyXfate 2:0e2ef1edf01b 195 # define NO_vsnprintf
destinyXfate 2:0e2ef1edf01b 196 # endif
destinyXfate 2:0e2ef1edf01b 197 # ifdef WIN32
destinyXfate 2:0e2ef1edf01b 198 /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
destinyXfate 2:0e2ef1edf01b 199 # if !defined(vsnprintf) && !defined(NO_vsnprintf)
destinyXfate 2:0e2ef1edf01b 200 # define vsnprintf _vsnprintf
destinyXfate 2:0e2ef1edf01b 201 # endif
destinyXfate 2:0e2ef1edf01b 202 # endif
destinyXfate 2:0e2ef1edf01b 203 # ifdef __SASC
destinyXfate 2:0e2ef1edf01b 204 # define NO_vsnprintf
destinyXfate 2:0e2ef1edf01b 205 # endif
destinyXfate 2:0e2ef1edf01b 206 #endif
destinyXfate 2:0e2ef1edf01b 207 #ifdef VMS
destinyXfate 2:0e2ef1edf01b 208 # define NO_vsnprintf
destinyXfate 2:0e2ef1edf01b 209 #endif
destinyXfate 2:0e2ef1edf01b 210
destinyXfate 2:0e2ef1edf01b 211 #if defined(pyr)
destinyXfate 2:0e2ef1edf01b 212 # define NO_MEMCPY
destinyXfate 2:0e2ef1edf01b 213 #endif
destinyXfate 2:0e2ef1edf01b 214 #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
destinyXfate 2:0e2ef1edf01b 215 /* Use our own functions for small and medium model with MSC <= 5.0.
destinyXfate 2:0e2ef1edf01b 216 * You may have to use the same strategy for Borland C (untested).
destinyXfate 2:0e2ef1edf01b 217 * The __SC__ check is for Symantec.
destinyXfate 2:0e2ef1edf01b 218 */
destinyXfate 2:0e2ef1edf01b 219 # define NO_MEMCPY
destinyXfate 2:0e2ef1edf01b 220 #endif
destinyXfate 2:0e2ef1edf01b 221 #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
destinyXfate 2:0e2ef1edf01b 222 # define HAVE_MEMCPY
destinyXfate 2:0e2ef1edf01b 223 #endif
destinyXfate 2:0e2ef1edf01b 224 #ifdef HAVE_MEMCPY
destinyXfate 2:0e2ef1edf01b 225 # ifdef SMALL_MEDIUM /* MSDOS small or medium model */
destinyXfate 2:0e2ef1edf01b 226 # define zmemcpy _fmemcpy
destinyXfate 2:0e2ef1edf01b 227 # define zmemcmp _fmemcmp
destinyXfate 2:0e2ef1edf01b 228 # define zmemzero(dest, len) _fmemset(dest, 0, len)
destinyXfate 2:0e2ef1edf01b 229 # else
destinyXfate 2:0e2ef1edf01b 230 # define zmemcpy memcpy
destinyXfate 2:0e2ef1edf01b 231 # define zmemcmp memcmp
destinyXfate 2:0e2ef1edf01b 232 # define zmemzero(dest, len) memset(dest, 0, len)
destinyXfate 2:0e2ef1edf01b 233 # endif
destinyXfate 2:0e2ef1edf01b 234 #else
destinyXfate 2:0e2ef1edf01b 235 extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
destinyXfate 2:0e2ef1edf01b 236 extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
destinyXfate 2:0e2ef1edf01b 237 extern void zmemzero OF((Bytef* dest, uInt len));
destinyXfate 2:0e2ef1edf01b 238 #endif
destinyXfate 2:0e2ef1edf01b 239
destinyXfate 2:0e2ef1edf01b 240 /* Diagnostic functions */
destinyXfate 2:0e2ef1edf01b 241 #ifdef DEBUG
destinyXfate 2:0e2ef1edf01b 242 # include <stdio.h>
destinyXfate 2:0e2ef1edf01b 243 extern int z_verbose;
destinyXfate 2:0e2ef1edf01b 244 extern void z_error OF((char *m));
destinyXfate 2:0e2ef1edf01b 245 # define Assert(cond,msg) {if(!(cond)) z_error(msg);}
destinyXfate 2:0e2ef1edf01b 246 # define Trace(x) {if (z_verbose>=0) fprintf x ;}
destinyXfate 2:0e2ef1edf01b 247 # define Tracev(x) {if (z_verbose>0) fprintf x ;}
destinyXfate 2:0e2ef1edf01b 248 # define Tracevv(x) {if (z_verbose>1) fprintf x ;}
destinyXfate 2:0e2ef1edf01b 249 # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
destinyXfate 2:0e2ef1edf01b 250 # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
destinyXfate 2:0e2ef1edf01b 251 #else
destinyXfate 2:0e2ef1edf01b 252 # define Assert(cond,msg)
destinyXfate 2:0e2ef1edf01b 253 # define Trace(x)
destinyXfate 2:0e2ef1edf01b 254 # define Tracev(x)
destinyXfate 2:0e2ef1edf01b 255 # define Tracevv(x)
destinyXfate 2:0e2ef1edf01b 256 # define Tracec(c,x)
destinyXfate 2:0e2ef1edf01b 257 # define Tracecv(c,x)
destinyXfate 2:0e2ef1edf01b 258 #endif
destinyXfate 2:0e2ef1edf01b 259
destinyXfate 2:0e2ef1edf01b 260
destinyXfate 2:0e2ef1edf01b 261 voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
destinyXfate 2:0e2ef1edf01b 262 void zcfree OF((voidpf opaque, voidpf ptr));
destinyXfate 2:0e2ef1edf01b 263
destinyXfate 2:0e2ef1edf01b 264 #define ZALLOC(strm, items, size) \
destinyXfate 2:0e2ef1edf01b 265 (*((strm)->zalloc))((strm)->opaque, (items), (size))
destinyXfate 2:0e2ef1edf01b 266 #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
destinyXfate 2:0e2ef1edf01b 267 #define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
destinyXfate 2:0e2ef1edf01b 268
destinyXfate 2:0e2ef1edf01b 269 #endif /* ZUTIL_H */
destinyXfate 2:0e2ef1edf01b 270