1 #ifndef LIBRARIES_Z_H 2 #define LIBRARIES_Z_H 3 4 /* 5 6 MorphOS Shared ZLib 7 8 z.library include 9 10 Copyright © 2003-2024 The MorphOS Development Team, All Rights Reserved. 11 12 */ 13 14 15 /* 16 17 These first parts mimic zconf.h 18 19 */ 20 21 #include <sys/types.h> 22 #include <unistd.h> 23 24 25 #if defined(__GNUC__) 26 #ifndef __32BIT__ 27 #define __32BIT__ 28 #endif 29 #endif 30 31 #if defined(__STDC__) || defined(__cplusplus) 32 #ifndef STDC 33 #define STDC 34 #endif 35 #endif 36 37 typedef size_t z_size_t; 38 39 #define OF(args) args 40 41 #undef MAX_MEM_LEVEL 42 #undef DEF_MEM_LEVEL 43 #define MAX_MEM_LEVEL 9 44 #define DEF_MEM_LEVEL 9 45 46 #undef MAX_WBITS 47 #undef DEF_WBITS 48 #define MAX_WBITS 15 49 #define DEF_WBITS 15 50 51 #define z_off_t int32_t 52 #define z_off64_t int64_t 53 54 typedef unsigned char Byte; 55 typedef unsigned int uInt; 56 typedef unsigned long uLong; 57 58 typedef Byte Bytef; 59 typedef char charf; 60 typedef int intf; 61 typedef uInt uIntf; 62 typedef uLong uLongf; 63 64 typedef const void *voidpc; 65 typedef void *voidpf; 66 typedef void *voidp; 67 68 typedef u_int32_t z_crc_t; 69 70 /* 71 72 This part is a cleaned-up version of zlib.h 73 74 For the documentation that was contained here, please see the 75 original zlib distribution, or the documentation with the 76 MorphOS SDK (when it's done) 77 78 */ 79 80 81 #ifdef __cplusplus 82 extern "C" { 83 #endif 84 85 86 #define ZLIB_VERSION "1.3.2" 87 #define ZLIB_VERNUM 0x1320 88 #define ZLIB_VER_MAJOR 1 89 #define ZLIB_VER_MINOR 3 90 #define ZLIB_VER_REVISION 2 91 #define ZLIB_VER_SUBREVISION 0 92 93 94 typedef voidpf (*alloc_func)(voidpf opaque, uInt items, uInt size); 95 typedef void (*free_func)(voidpf opaque, voidpf address); 96 97 typedef unsigned (*in_func)(void *, unsigned char **); 98 typedef int (*out_func)(void *, unsigned char *, unsigned); 99 100 struct internal_state; 101 102 typedef struct z_stream_s { 103 Bytef *next_in; /* next input byte */ 104 uInt avail_in; /* number of bytes available at next_in */ 105 uLong total_in; /* total nb of input bytes read so far */ 106 107 Bytef *next_out; /* next output byte should be put there */ 108 uInt avail_out; /* remaining free space at next_out */ 109 uLong total_out; /* total nb of bytes output so far */ 110 111 char *msg; /* last error message, NULL if no error */ 112 struct internal_state *state; /* not visible by applications */ 113 114 alloc_func zalloc; /* used to allocate the internal state */ 115 free_func zfree; /* used to free the internal state */ 116 voidpf opaque; /* private data object passed to zalloc and zfree */ 117 118 int data_type; /* best guess about the data type: binary or text */ 119 uLong adler; /* adler32 value of the uncompressed data */ 120 uLong reserved; /* reserved for future use */ 121 } z_stream; 122 123 typedef z_stream *z_streamp; 124 125 /* 126 gzip header information passed to and from zlib routines. See RFC 1952 127 for more details on the meanings of these fields. 128 */ 129 typedef struct gz_header_s { 130 int text; /* true if compressed data believed to be text */ 131 uLong time; /* modification time */ 132 int xflags; /* extra flags (not used when writing a gzip file) */ 133 int os; /* operating system */ 134 Bytef *extra; /* pointer to extra field or Z_NULL if none */ 135 uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ 136 uInt extra_max; /* space at extra (only when reading header) */ 137 Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ 138 uInt name_max; /* space at name (only when reading header) */ 139 Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ 140 uInt comm_max; /* space at comment (only when reading header) */ 141 int hcrc; /* true if there was or will be a header crc */ 142 int done; /* true when done reading gzip header (not used 143 when writing a gzip file) */ 144 } gz_header; 145 146 typedef gz_header *gz_headerp; 147 148 typedef voidp gzFile; 149 150 151 #define Z_NO_FLUSH 0 152 #define Z_PARTIAL_FLUSH 1 153 #define Z_SYNC_FLUSH 2 154 #define Z_FULL_FLUSH 3 155 #define Z_FINISH 4 156 #define Z_BLOCK 5 157 #define Z_TREES 6 158 159 #define Z_OK 0 160 #define Z_STREAM_END 1 161 #define Z_NEED_DICT 2 162 #define Z_ERRNO (-1) 163 #define Z_STREAM_ERROR (-2) 164 #define Z_DATA_ERROR (-3) 165 #define Z_MEM_ERROR (-4) 166 #define Z_BUF_ERROR (-5) 167 #define Z_VERSION_ERROR (-6) 168 169 #define Z_NO_COMPRESSION 0 170 #define Z_BEST_SPEED 1 171 #define Z_BEST_COMPRESSION 9 172 #define Z_DEFAULT_COMPRESSION (-1) 173 174 #define Z_FILTERED 1 175 #define Z_HUFFMAN_ONLY 2 176 #define Z_RLE 3 177 #define Z_FIXED 4 178 #define Z_DEFAULT_STRATEGY 0 179 180 #define Z_BINARY 0 181 #define Z_TEXT 1 182 #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ 183 #define Z_UNKNOWN 2 184 185 #define Z_DEFLATED 8 186 187 #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ 188 189 190 #define zlib_version zlibVersion() 191 192 193 typedef unsigned (*blast_in)(void *how, unsigned char **buf); 194 typedef int (*blast_out)(void *how, unsigned char *buf, unsigned len); 195 196 197 #ifdef __cplusplus 198 } 199 #endif 200 201 #endif /* LIBRARIES_Z_H */