OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [services/] [compress/] [zlib/] [v2_0/] [src/] [zutil.h] - Blame information for rev 584

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.