1 * ZLIB.INC - Interface to the general purpose compression library
3 * ILE RPG400 version by Patrick Monnerat, DATASPHERE.
10 * two additional arguments:
11 * the package version
string and the stream control structure.
12 *
size. This is needed because RPG lacks some macro feature.
13 * Call these procedures as:
16 /if not defined(ZLIB_H_)
19 **************************************************************************
21 **************************************************************************
23 * Versioning information.
77 **************************************************************************
79 **************************************************************************
82 D gzFile S * File pointer
83 D
z_off_t S 10i 0 Stream offsets
86 **************************************************************************
88 **************************************************************************
90 * The
GZIP encode/
decode stream support structure.
93 D zs_next_in * Next input byte
94 D zs_avail_in 10U 0
Byte cnt at next_in
95 D zs_total_in 10U 0 Total bytes
read 96 D zs_next_out * Output buffer ptr
97 D zs_avail_out 10U 0 Room left @ next_out
98 D zs_total_out 10U 0 Total bytes written
99 D zs_msg * Last errmsg or null
100 D zs_state * Internal
state 101 D zs_zalloc * procptr Int.
state allocator
102 D zs_free * procptr Int.
state dealloc.
103 D zs_opaque * Private alloc. data
104 D zs_data_type 10i 0 ASC/BIN best guess
105 D zs_adler 10u 0 Uncompr.
adler32 val
107 D 10U 0 Ptr. alignment
109 **************************************************************************
110 * Utility function prototypes
111 **************************************************************************
114 D dest 65535 options(*varsize) Destination buffer
115 D destLen 10U 0 Destination length
116 D source 65535
const options(*varsize) Source buffer
117 D sourceLen 10u 0 value Source length
120 D dest 65535 options(*varsize) Destination buffer
121 D destLen 10U 0 Destination length
122 D source 65535
const options(*varsize) Source buffer
123 D sourceLen 10U 0 value Source length
124 D level 10I 0 value Compression level
127 D sourceLen 10U 0 value
130 D dest 65535 options(*varsize) Destination buffer
131 D destLen 10U 0 Destination length
132 D source 65535
const options(*varsize) Source buffer
133 D sourceLen 10U 0 value Source length
135 /if not defined(LARGE_FILES)
138 D path * value options(*
string) File pathname
139 D mode * value options(*
string) Open mode
143 D path * value options(*
string) File pathname
144 D mode * value options(*
string) Open mode
148 D path * value options(*
string) File pathname
149 D mode * value options(*
string) Open mode
154 D fd 10I 0 value File descriptor
155 D mode * value options(*
string) Open mode
158 D
file value like(gzFile) File pointer
162 D
file value like(gzFile) File pointer
164 D strategy 10I 0 value
167 D
file value like(gzFile) File pointer
168 D buf 65535 options(*varsize) Buffer
169 D len 10u 0 value Buffer length
172 D
file value like(gzFile) File pointer
173 D buf 65535
const options(*varsize) Buffer
174 D len 10u 0 value Buffer length
177 D
file value like(gzFile) File pointer
178 D s * value options(*
string) String to output
181 D
file value like(gzFile) File pointer
182 D buf 65535 options(*varsize)
Read buffer
183 D len 10i 0 value Buffer length
186 D
file value like(gzFile) File pointer
187 D c 10I 0 value Character to
write 190 D
file value like(gzFile) File pointer
193 D
file value like(gzFile) File pointer
196 D c 10I 0 value Character to
push 197 D
file value like(gzFile) File pointer
200 D
file value like(gzFile) File pointer
201 D flush 10I 0 value Type of flush
203 /if not defined(LARGE_FILES)
206 D
file value like(gzFile) File pointer
207 D offset value like(
z_off_t) Offset
208 D whence 10i 0 value Origin
212 D
file value like(gzFile) File pointer
213 D offset value like(
z_off_t) Offset
214 D whence 10i 0 value Origin
218 D
file value like(gzFile) File pointer
220 D whence 10i 0 value Origin
224 D
file value like(gzFile) File pointer
226 /if not defined(LARGE_FILES)
229 D
file value like(gzFile) File pointer
233 D
file value like(gzFile) File pointer
237 D
file value like(gzFile) File pointer
240 /if not defined(LARGE_FILES)
243 D
file value like(gzFile) File pointer
247 D
file value like(gzFile) File pointer
251 D
file value like(gzFile) File pointer
255 D
file value like(gzFile) File pointer
258 D
file value like(gzFile) File pointer
261 D
file value like(gzFile) File pointer
264 D
file value like(gzFile) File pointer
267 D
file value like(gzFile) File pointer
268 D errnum 10I 0 Error
code 271 D
file value like(gzFile) File pointer
273 **************************************************************************
274 * Basic function prototypes
275 **************************************************************************
280 D strm like(
z_stream) Compression stream
281 D level 10I 0 value Compression level
282 D version * value options(*
string) Version
string 283 D stream_size 10i 0 value Stream struct.
size 286 D strm like(
z_stream) Compression stream
287 D flush 10I 0 value Flush type required
290 D strm like(
z_stream) Compression stream
293 D strm like(
z_stream) Expansion stream
294 D version * value options(*
string) Version
string 295 D stream_size 10i 0 value Stream struct.
size 298 D strm like(
z_stream) Expansion stream
299 D flush 10I 0 value Flush type required
302 D strm like(
z_stream) Expansion stream
304 **************************************************************************
305 * Advanced function prototypes
306 **************************************************************************
309 D strm like(
z_stream) Compression stream
310 D level 10I 0 value Compression level
311 D method 10I 0 value Compression method
312 D windowBits 10I 0 value log2(window
size)
313 D memLevel 10I 0 value Mem/cmpress tradeoff
314 D strategy 10I 0 value Compression stategy
315 D version * value options(*
string) Version
string 316 D stream_size 10i 0 value Stream struct.
size 320 D strm like(
z_stream) Compression stream
322 D dictLength 10U 0 value Dictionary length
325 D dest like(
z_stream) Destination stream
326 D source like(
z_stream) Source stream
329 D strm like(
z_stream) Compression stream
332 D strm like(
z_stream) Compression stream
333 D level 10I 0 value Compression level
334 D strategy 10I 0 value Compression stategy
337 D strm like(
z_stream) Compression stream
338 D sourcelen 10U 0 value Compression level
341 D strm like(
z_stream) Compression stream
342 D pending 10U 0 Pending bytes
346 D strm like(
z_stream) Compression stream
347 D
bits 10I 0 value
# of bits to insert 348 D value 10I 0 value Bits to insert
350 D
inflateInit2 PR 10I 0 extproc(
'inflateInit2_') Init. expansion
351 D strm like(
z_stream) Expansion stream
352 D windowBits 10I 0 value log2(window
size)
353 D version * value options(*
string) Version
string 354 D stream_size 10i 0 value Stream struct.
size 358 D strm like(
z_stream) Expansion stream
360 D dictLength 10U 0 value Dictionary length
364 D strm like(
z_stream) Expansion stream
365 D
dictionary 65535 options(*varsize) Dictionary bytes
366 D dictLength 10U 0 Dictionary length
369 D strm like(
z_stream) Expansion stream
372 D dest like(
z_stream) Destination stream
373 D source like(
z_stream) Source stream
376 D strm like(
z_stream) Expansion stream
379 D strm like(
z_stream) Expansion stream
380 D windowBits 10I 0 value Log2(buffer
size)
383 D strm like(
z_stream) Expansion stream
385 D value 10I 0 value Bits to insert
388 D strm like(
z_stream) Expansion stream
392 D strm like(
z_stream) Expansion stream
393 D windowBits 10I 0 value Log2(buffer
size)
394 D window 65535 options(*varsize) Buffer
395 D version * value options(*
string) Version
string 396 D stream_size 10i 0 value Stream struct.
size 399 D strm like(
z_stream) Expansion stream
400 D
in * value procptr Input function
401 D in_desc * value Input descriptor
402 D
out * value procptr Output function
403 D out_desc * value Output descriptor
406 D strm like(
z_stream) Expansion stream
411 **************************************************************************
412 * Checksum function prototypes
413 **************************************************************************
416 D adler 10U 0 value Old checksum
417 D buf 65535
const options(*varsize) Bytes to accumulate
418 D len 10U 0 value Buffer length
420 D
crc32 PR 10U 0 extproc('
crc32') New checksum
421 D crc 10U 0 value Old checksum
422 D buf 65535
const options(*varsize) Bytes to accumulate
423 D len 10U 0 value Buffer length
425 **************************************************************************
426 * Miscellaneous function prototypes
427 **************************************************************************
430 D err 10I 0 value Error
code 434 D strm like(
z_stream) Expansion stream
440 D strm like(
z_stream) Expansion stream
441 D arg 10I 0 value Error
code 445 D strm like(
z_stream) Expansion stream
449 D strm like(
z_stream) Expansion stream
int compress2(Bytef *dest, uLongf *destLen, Bytef *source, uLong sourceLen, int level)
static int push(void *desc, unsigned char *buf, unsigned len)
int deflateSetDictionary(z_streamp strm, Bytef *dictionary, uInt dictLength)
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy)
int inflateUndermine(z_streamp strm, int subvert)
int uncompress(Bytef *dest, uLongf *destLen, Bytef *source, uLong sourceLen)
int deflateResetKeep(z_streamp strm)
char * gzgets(gzFile file, char *buf, int len)
int gzflush(gzFile file, int flush)
int deflateEnd(z_streamp strm)
long gzseek(gzFile file, long offset, int whence)
#define Z_BEST_COMPRESSION
long gzoffset(gzFile file)
int gzbuffer(gzFile file, unsigned size)
int gzread(gzFile file, voidp buf, unsigned len)
int gzputc(gzFile file, int c)
gzFile gzopen(char *path, char *mode)
int inflateReset2(z_streamp strm, int windowBits)
int inflateResetKeep(z_streamp strm)
void gzclearerr(gzFile file)
int gzungetc(int c, gzFile file)
z_crc_t * get_crc_table()
unsigned long crc32(unsigned long crc, unsigned char *buf, uInt len)
int inflateCopy(z_streamp dest, z_streamp source)
uLong compressBound(uLong sourceLen)
int compress(Bytef *dest, uLongf *destLen, Bytef *source, uLong sourceLen)
int gzclose_r(gzFile file)
#define inflateInit2(strm, windowBits)
int write(ozstream &zs, const T *x, Items items)
int inflateBackInit_(z_streamp strm, int windowBits, unsigned char *window, char *version, int stream_size)
int gzsetparams(gzFile file, int level, int strategy)
int gzclose_w(gzFile file)
int deflatePrime(z_streamp strm, int bits, int value)
static int out(void *out_desc, unsigned char *buf, unsigned len)
int deflateReset(z_streamp strm)
uLong adler32(uLong adler, Bytef *buf, uInt len)
int inflateBack(z_streamp strm, in_func in, void *in_desc, out_func out, void *out_desc)
int deflateInit2_(z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, char *version, int stream_size)
long inflateMark(z_streamp strm)
gzFile gzdopen(int fd, char *mode)
int read(izstream &zs, T *x, Items items)
int gzputs(gzFile file, char *str)
int inflateSetDictionary(z_streamp strm, Bytef *dictionary, uInt dictLength)
int inflateBackEnd(z_streamp strm)
int inflatePrime(z_streamp strm, int bits, int value)
int gzrewind(gzFile file)
Feature< D > Read(const std::string &filename)
Reads data from file and initializes a Feature vector with it.
int inflateReset(z_streamp strm)
#define ZLIB_VER_REVISION
int inflateSync(z_streamp strm)
int deflateCopy(z_streamp dest, z_streamp source)
int inflateGetDictionary(z_streamp strm, Bytef *dictionary, uInt *dictLength)
static int decode(struct state *s, struct huffman *h)
int inflateInit_(z_streamp strm, char *version, int stream_size)
static unsigned in(void *in_desc, z_const unsigned char **buf)
uLong deflateBound(z_streamp strm, uLong sourceLen)
#define deflateInit(strm, level)
#define inflateInit(strm)
static int bits(struct state *s, int need)
int deflateParams(z_streamp strm, int level, int strategy)
int inflateEnd(z_streamp strm)
int inflate(z_streamp strm, int flush)
int deflateInit_(z_streamp strm, int level, char *version, int stream_size)
#define ZLIB_VER_SUBREVISION
#define Z_DEFAULT_STRATEGY
int gzwrite(gzFile file, voidpc buf, unsigned len)
int inflateSyncPoint(z_streamp strm)
char * gzerror(gzFile file, int *errnum)
#define inflateBackInit(strm, windowBits, window)
int deflate(z_streamp strm, int flush)
#define Z_DEFAULT_COMPRESSION
int deflatePending(z_streamp strm, unsigned *pending, int *bits)
static big_t count(int syms, int len, int left)