1 * ZLIB.INC - Interface to the general purpose compression library
3 * ILE RPG400 version by Patrick Monnerat, DATASPHERE.
8 * Procedures inflateInit(), inflateInit2(), deflateInit(),
9 * deflateInit2() and inflateBackInit() need to be called with
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:
14 * inflateInit(...: ZLIB_VERSION: %size(z_stream))
16 /if not defined(ZLIB_H_)
19 **************************************************************************
21 **************************************************************************
23 * Versioning information.
25 D ZLIB_VERSION C '1.2.11'
26 D ZLIB_VERNUM C X'12a0'
29 D ZLIB_VER_REVISION...
31 D ZLIB_VER_SUBREVISION...
53 D Z_VERSION_ERROR C -6
58 D Z_BEST_COMPRESSION...
60 D Z_DEFAULT_COMPRESSION...
66 D Z_DEFAULT_STRATEGY...
77 **************************************************************************
79 **************************************************************************
81 D z_streamp S * Stream struct ptr
82 D gzFile S * File pointer
84 D z_off_t S 10i 0 Stream offsets
85 D z_off64_t S 20i 0 Stream offsets
87 **************************************************************************
89 **************************************************************************
91 * The GZIP encode/decode stream support structure.
93 D z_stream DS align based(z_streamp)
94 D zs_next_in * Next input byte
95 D zs_avail_in 10U 0 Byte cnt at next_in
96 D zs_total_in 10U 0 Total bytes read
97 D zs_next_out * Output buffer ptr
98 D zs_avail_out 10U 0 Room left @ next_out
99 D zs_total_out 10U 0 Total bytes written
100 D zs_msg * Last errmsg or null
101 D zs_state * Internal state
102 D zs_zalloc * procptr Int. state allocator
103 D zs_free * procptr Int. state dealloc.
104 D zs_opaque * Private alloc. data
105 D zs_data_type 10i 0 ASC/BIN best guess
106 D zs_adler 10u 0 Uncompr. adler32 val
108 D 10U 0 Ptr. alignment
110 **************************************************************************
111 * Utility function prototypes
112 **************************************************************************
114 D compress PR 10I 0 extproc('compress')
115 D dest 65535 options(*varsize) Destination buffer
116 D destLen 10U 0 Destination length
117 D source 65535 const options(*varsize) Source buffer
118 D sourceLen 10u 0 value Source length
120 D compress2 PR 10I 0 extproc('compress2')
121 D dest 65535 options(*varsize) Destination buffer
122 D destLen 10U 0 Destination length
123 D source 65535 const options(*varsize) Source buffer
124 D sourceLen 10U 0 value Source length
125 D level 10I 0 value Compression level
127 D compressBound PR 10U 0 extproc('compressBound')
128 D sourceLen 10U 0 value
130 D uncompress PR 10I 0 extproc('uncompress')
131 D dest 65535 options(*varsize) Destination buffer
132 D destLen 10U 0 Destination length
133 D source 65535 const options(*varsize) Source buffer
134 D sourceLen 10U 0 value Source length
136 D uncompress2 PR 10I 0 extproc('uncompress2')
137 D dest 65535 options(*varsize) Destination buffer
138 D destLen 10U 0 Destination length
139 D source 65535 const options(*varsize) Source buffer
140 D sourceLen 10U 0 Source length
142 /if not defined(LARGE_FILES)
143 D gzopen PR extproc('gzopen')
145 D path * value options(*string) File pathname
146 D mode * value options(*string) Open mode
148 D gzopen PR extproc('gzopen64')
150 D path * value options(*string) File pathname
151 D mode * value options(*string) Open mode
153 D gzopen64 PR extproc('gzopen64')
155 D path * value options(*string) File pathname
156 D mode * value options(*string) Open mode
159 D gzdopen PR extproc('gzdopen')
161 D fd 10I 0 value File descriptor
162 D mode * value options(*string) Open mode
164 D gzbuffer PR 10I 0 extproc('gzbuffer')
165 D file value like(gzFile) File pointer
168 D gzsetparams PR 10I 0 extproc('gzsetparams')
169 D file value like(gzFile) File pointer
171 D strategy 10I 0 value
173 D gzread PR 10I 0 extproc('gzread')
174 D file value like(gzFile) File pointer
175 D buf 65535 options(*varsize) Buffer
176 D len 10u 0 value Buffer length
178 D gzfread PR 20I 0 extproc('gzfread')
179 D buf 65535 options(*varsize) Buffer
180 D size 20u 0 value Buffer length
181 D nitems 20u 0 value Buffer length
182 D file value like(gzFile) File pointer
184 D gzwrite PR 10I 0 extproc('gzwrite')
185 D file value like(gzFile) File pointer
186 D buf 65535 const options(*varsize) Buffer
187 D len 10u 0 value Buffer length
189 D gzfwrite PR 20I 0 extproc('gzfwrite')
190 D buf 65535 options(*varsize) Buffer
191 D size 20u 0 value Buffer length
192 D nitems 20u 0 value Buffer length
193 D file value like(gzFile) File pointer
195 D gzputs PR 10I 0 extproc('gzputs')
196 D file value like(gzFile) File pointer
197 D s * value options(*string) String to output
199 D gzgets PR * extproc('gzgets')
200 D file value like(gzFile) File pointer
201 D buf 65535 options(*varsize) Read buffer
202 D len 10i 0 value Buffer length
204 D gzputc PR 10i 0 extproc('gzputc')
205 D file value like(gzFile) File pointer
206 D c 10I 0 value Character to write
208 D gzgetc PR 10i 0 extproc('gzgetc')
209 D file value like(gzFile) File pointer
211 D gzgetc_ PR 10i 0 extproc('gzgetc_')
212 D file value like(gzFile) File pointer
214 D gzungetc PR 10i 0 extproc('gzungetc')
215 D c 10I 0 value Character to push
216 D file value like(gzFile) File pointer
218 D gzflush PR 10i 0 extproc('gzflush')
219 D file value like(gzFile) File pointer
220 D flush 10I 0 value Type of flush
222 /if not defined(LARGE_FILES)
223 D gzseek PR extproc('gzseek')
225 D file value like(gzFile) File pointer
226 D offset value like(z_off_t) Offset
227 D whence 10i 0 value Origin
229 D gzseek PR extproc('gzseek64')
231 D file value like(gzFile) File pointer
232 D offset value like(z_off_t) Offset
233 D whence 10i 0 value Origin
235 D gzseek64 PR extproc('gzseek64')
237 D file value like(gzFile) File pointer
238 D offset value like(z_off64_t) Offset
239 D whence 10i 0 value Origin
242 D gzrewind PR 10i 0 extproc('gzrewind')
243 D file value like(gzFile) File pointer
245 /if not defined(LARGE_FILES)
246 D gztell PR extproc('gztell')
248 D file value like(gzFile) File pointer
250 D gztell PR extproc('gztell64')
252 D file value like(gzFile) File pointer
254 D gztell64 PR extproc('gztell64')
256 D file value like(gzFile) File pointer
259 /if not defined(LARGE_FILES)
260 D gzoffset PR extproc('gzoffset')
262 D file value like(gzFile) File pointer
264 D gzoffset PR extproc('gzoffset64')
266 D file value like(gzFile) File pointer
268 D gzoffset64 PR extproc('gzoffset64')
270 D file value like(gzFile) File pointer
273 D gzeof PR 10i 0 extproc('gzeof')
274 D file value like(gzFile) File pointer
276 D gzdirect PR 10i 0 extproc('gzdirect')
277 D file value like(gzFile) File pointer
279 D gzclose_r PR 10i 0 extproc('gzclose_r')
280 D file value like(gzFile) File pointer
282 D gzclose_w PR 10i 0 extproc('gzclose_w')
283 D file value like(gzFile) File pointer
285 D gzclose PR 10i 0 extproc('gzclose')
286 D file value like(gzFile) File pointer
288 D gzerror PR * extproc('gzerror') Error string
289 D file value like(gzFile) File pointer
290 D errnum 10I 0 Error code
292 D gzclearerr PR extproc('gzclearerr')
293 D file value like(gzFile) File pointer
295 **************************************************************************
296 * Basic function prototypes
297 **************************************************************************
299 D zlibVersion PR * extproc('zlibVersion') Version string
301 D deflateInit PR 10I 0 extproc('deflateInit_') Init. compression
302 D strm like(z_stream) Compression stream
303 D level 10I 0 value Compression level
304 D version * value options(*string) Version string
305 D stream_size 10i 0 value Stream struct. size
307 D deflate PR 10I 0 extproc('deflate') Compress data
308 D strm like(z_stream) Compression stream
309 D flush 10I 0 value Flush type required
311 D deflateEnd PR 10I 0 extproc('deflateEnd') Termin. compression
312 D strm like(z_stream) Compression stream
314 D inflateInit PR 10I 0 extproc('inflateInit_') Init. expansion
315 D strm like(z_stream) Expansion stream
316 D version * value options(*string) Version string
317 D stream_size 10i 0 value Stream struct. size
319 D inflate PR 10I 0 extproc('inflate') Expand data
320 D strm like(z_stream) Expansion stream
321 D flush 10I 0 value Flush type required
323 D inflateEnd PR 10I 0 extproc('inflateEnd') Termin. expansion
324 D strm like(z_stream) Expansion stream
326 **************************************************************************
327 * Advanced function prototypes
328 **************************************************************************
330 D deflateInit2 PR 10I 0 extproc('deflateInit2_') Init. compression
331 D strm like(z_stream) Compression stream
332 D level 10I 0 value Compression level
333 D method 10I 0 value Compression method
334 D windowBits 10I 0 value log2(window size)
335 D memLevel 10I 0 value Mem/cmpress tradeoff
336 D strategy 10I 0 value Compression strategy
337 D version * value options(*string) Version string
338 D stream_size 10i 0 value Stream struct. size
340 D deflateSetDictionary...
341 D PR 10I 0 extproc('deflateSetDictionary') Init. dictionary
342 D strm like(z_stream) Compression stream
343 D dictionary 65535 const options(*varsize) Dictionary bytes
344 D dictLength 10U 0 value Dictionary length
346 D deflateCopy PR 10I 0 extproc('deflateCopy') Compress strm 2 strm
347 D dest like(z_stream) Destination stream
348 D source like(z_stream) Source stream
350 D deflateReset PR 10I 0 extproc('deflateReset') End and init. stream
351 D strm like(z_stream) Compression stream
353 D deflateParams PR 10I 0 extproc('deflateParams') Change level & strat
354 D strm like(z_stream) Compression stream
355 D level 10I 0 value Compression level
356 D strategy 10I 0 value Compression strategy
358 D deflateTune PR 10I 0 extproc('deflateTune')
359 D strm like(z_stream) Compression stream
365 D deflateBound PR 10U 0 extproc('deflateBound') Change level & strat
366 D strm like(z_stream) Compression stream
367 D sourcelen 10U 0 value Compression level
369 D deflatePending PR 10I 0 extproc('deflatePending') Change level & strat
370 D strm like(z_stream) Compression stream
371 D pending 10U 0 Pending bytes
372 D bits 10I 0 Pending bits
374 D deflatePrime PR 10I 0 extproc('deflatePrime') Change level & strat
375 D strm like(z_stream) Compression stream
376 D bits 10I 0 value # of bits to insert
377 D value 10I 0 value Bits to insert
379 D inflateInit2 PR 10I 0 extproc('inflateInit2_') Init. expansion
380 D strm like(z_stream) Expansion stream
381 D windowBits 10I 0 value log2(window size)
382 D version * value options(*string) Version string
383 D stream_size 10i 0 value Stream struct. size
385 D inflateSetDictionary...
386 D PR 10I 0 extproc('inflateSetDictionary') Init. dictionary
387 D strm like(z_stream) Expansion stream
388 D dictionary 65535 const options(*varsize) Dictionary bytes
389 D dictLength 10U 0 value Dictionary length
391 D inflateGetDictionary...
392 D PR 10I 0 extproc('inflateGetDictionary') Get dictionary
393 D strm like(z_stream) Expansion stream
394 D dictionary 65535 options(*varsize) Dictionary bytes
395 D dictLength 10U 0 Dictionary length
397 D deflateGetDictionary...
398 D PR 10I 0 extproc('deflateGetDictionary') Get dictionary
399 D strm like(z_stream) Expansion stream
400 D dictionary 65535 options(*varsize) Dictionary bytes
401 D dictLength 10U 0 Dictionary length
403 D inflateSync PR 10I 0 extproc('inflateSync') Sync. expansion
404 D strm like(z_stream) Expansion stream
406 D inflateCopy PR 10I 0 extproc('inflateCopy')
407 D dest like(z_stream) Destination stream
408 D source like(z_stream) Source stream
410 D inflateReset PR 10I 0 extproc('inflateReset') End and init. stream
411 D strm like(z_stream) Expansion stream
413 D inflateReset2 PR 10I 0 extproc('inflateReset2') End and init. stream
414 D strm like(z_stream) Expansion stream
415 D windowBits 10I 0 value Log2(buffer size)
417 D inflatePrime PR 10I 0 extproc('inflatePrime') Insert bits
418 D strm like(z_stream) Expansion stream
419 D bits 10I 0 value Bit count
420 D value 10I 0 value Bits to insert
422 D inflateMark PR 10I 0 extproc('inflateMark') Get inflate info
423 D strm like(z_stream) Expansion stream
425 D inflateCodesUsed...
426 PR 20U 0 extproc('inflateCodesUsed')
427 D strm like(z_stream) Expansion stream
430 PR 20U 0 extproc('inflateValidate')
431 D strm like(z_stream) Expansion stream
434 D inflateGetHeader...
435 PR 10U 0 extproc('inflateGetHeader')
436 D strm like(z_stream) Expansion stream
437 D head like(gz_headerp)
439 D deflateSetHeader...
440 PR 10U 0 extproc('deflateSetHeader')
441 D strm like(z_stream) Expansion stream
442 D head like(gz_headerp)
445 D PR 10I 0 extproc('inflateBackInit_')
446 D strm like(z_stream) Expansion stream
447 D windowBits 10I 0 value Log2(buffer size)
448 D window 65535 options(*varsize) Buffer
449 D version * value options(*string) Version string
450 D stream_size 10i 0 value Stream struct. size
452 D inflateBack PR 10I 0 extproc('inflateBack')
453 D strm like(z_stream) Expansion stream
454 D in * value procptr Input function
455 D in_desc * value Input descriptor
456 D out * value procptr Output function
457 D out_desc * value Output descriptor
459 D inflateBackEnd PR 10I 0 extproc('inflateBackEnd')
460 D strm like(z_stream) Expansion stream
462 D zlibCompileFlags...
463 D PR 10U 0 extproc('zlibCompileFlags')
465 **************************************************************************
466 * Checksum function prototypes
467 **************************************************************************
469 D adler32 PR 10U 0 extproc('adler32') New checksum
470 D adler 10U 0 value Old checksum
471 D buf 65535 const options(*varsize) Bytes to accumulate
472 D len 10U 0 value Buffer length
475 PR 10U 0 extproc('adler32_combine') New checksum
476 D adler1 10U 0 value Old checksum
477 D adler2 10U 0 value Old checksum
478 D len2 20U 0 value Buffer length
480 D adler32_z PR 10U 0 extproc('adler32_z') New checksum
481 D adler 10U 0 value Old checksum
482 D buf 65535 const options(*varsize) Bytes to accumulate
483 D len 20U 0 value Buffer length
485 D crc32 PR 10U 0 extproc('crc32') New checksum
486 D crc 10U 0 value Old checksum
487 D buf 65535 const options(*varsize) Bytes to accumulate
488 D len 10U 0 value Buffer length
491 PR 10U 0 extproc('crc32_combine') New checksum
492 D crc1 10U 0 value Old checksum
493 D crc2 10U 0 value Old checksum
494 D len2 20U 0 value Buffer length
496 D crc32_z PR 10U 0 extproc('crc32_z') New checksum
497 D crc 10U 0 value Old checksum
498 D buf 65535 const options(*varsize) Bytes to accumulate
499 D len 20U 0 value Buffer length
501 **************************************************************************
502 * Miscellaneous function prototypes
503 **************************************************************************
505 D zError PR * extproc('zError') Error string
506 D err 10I 0 value Error code
508 D inflateSyncPoint...
509 D PR 10I 0 extproc('inflateSyncPoint')
510 D strm like(z_stream) Expansion stream
512 D get_crc_table PR * extproc('get_crc_table') Ptr to ulongs
514 D inflateUndermine...
515 D PR 10I 0 extproc('inflateUndermine')
516 D strm like(z_stream) Expansion stream
517 D arg 10I 0 value Error code
519 D inflateResetKeep...
520 D PR 10I 0 extproc('inflateResetKeep') End and init. stream
521 D strm like(z_stream) Expansion stream
523 D deflateResetKeep...
524 D PR 10I 0 extproc('deflateResetKeep') End and init. stream
525 D strm like(z_stream) Expansion stream