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.7'
26 D ZLIB_VERNUM C X'1270'
29 D ZLIB_VER_REVISION...
31 D ZLIB_VER_SUBREVISION...
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
83 D z_off_t S 10i 0 Stream offsets
84 D z_off64_t S 20i 0 Stream offsets
86 **************************************************************************
88 **************************************************************************
90 * The GZIP encode/decode stream support structure.
92 D z_stream DS align based(z_streamp)
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 **************************************************************************
113 D compress PR 10I 0 extproc('compress')
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
119 D compress2 PR 10I 0 extproc('compress2')
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
126 D compressBound PR 10U 0 extproc('compressBound')
127 D sourceLen 10U 0 value
129 D uncompress PR 10I 0 extproc('uncompress')
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)
136 D gzopen PR extproc('gzopen')
138 D path * value options(*string) File pathname
139 D mode * value options(*string) Open mode
141 D gzopen PR extproc('gzopen64')
143 D path * value options(*string) File pathname
144 D mode * value options(*string) Open mode
146 D gzopen64 PR extproc('gzopen64')
148 D path * value options(*string) File pathname
149 D mode * value options(*string) Open mode
152 D gzdopen PR extproc('gzdopen')
154 D fd 10I 0 value File descriptor
155 D mode * value options(*string) Open mode
157 D gzbuffer PR 10I 0 extproc('gzbuffer')
158 D file value like(gzFile) File pointer
161 D gzsetparams PR 10I 0 extproc('gzsetparams')
162 D file value like(gzFile) File pointer
164 D strategy 10I 0 value
166 D gzread PR 10I 0 extproc('gzread')
167 D file value like(gzFile) File pointer
168 D buf 65535 options(*varsize) Buffer
169 D len 10u 0 value Buffer length
171 D gzwrite PR 10I 0 extproc('gzwrite')
172 D file value like(gzFile) File pointer
173 D buf 65535 const options(*varsize) Buffer
174 D len 10u 0 value Buffer length
176 D gzputs PR 10I 0 extproc('gzputs')
177 D file value like(gzFile) File pointer
178 D s * value options(*string) String to output
180 D gzgets PR * extproc('gzgets')
181 D file value like(gzFile) File pointer
182 D buf 65535 options(*varsize) Read buffer
183 D len 10i 0 value Buffer length
185 D gzputc PR 10i 0 extproc('gzputc')
186 D file value like(gzFile) File pointer
187 D c 10I 0 value Character to write
189 D gzgetc PR 10i 0 extproc('gzgetc')
190 D file value like(gzFile) File pointer
192 D gzgetc_ PR 10i 0 extproc('gzgetc_')
193 D file value like(gzFile) File pointer
195 D gzungetc PR 10i 0 extproc('gzungetc')
196 D c 10I 0 value Character to push
197 D file value like(gzFile) File pointer
199 D gzflush PR 10i 0 extproc('gzflush')
200 D file value like(gzFile) File pointer
201 D flush 10I 0 value Type of flush
203 /if not defined(LARGE_FILES)
204 D gzseek PR extproc('gzseek')
206 D file value like(gzFile) File pointer
207 D offset value like(z_off_t) Offset
208 D whence 10i 0 value Origin
210 D gzseek PR extproc('gzseek64')
212 D file value like(gzFile) File pointer
213 D offset value like(z_off_t) Offset
214 D whence 10i 0 value Origin
216 D gzseek64 PR extproc('gzseek64')
218 D file value like(gzFile) File pointer
219 D offset value like(z_off64_t) Offset
220 D whence 10i 0 value Origin
223 D gzrewind PR 10i 0 extproc('gzrewind')
224 D file value like(gzFile) File pointer
226 /if not defined(LARGE_FILES)
227 D gztell PR extproc('gztell')
229 D file value like(gzFile) File pointer
231 D gztell PR extproc('gztell64')
233 D file value like(gzFile) File pointer
235 D gztell64 PR extproc('gztell64')
237 D file value like(gzFile) File pointer
240 /if not defined(LARGE_FILES)
241 D gzoffset PR extproc('gzoffset')
243 D file value like(gzFile) File pointer
245 D gzoffset PR extproc('gzoffset64')
247 D file value like(gzFile) File pointer
249 D gzoffset64 PR extproc('gzoffset64')
251 D file value like(gzFile) File pointer
254 D gzeof PR 10i 0 extproc('gzeof')
255 D file value like(gzFile) File pointer
257 D gzclose_r PR 10i 0 extproc('gzclose_r')
258 D file value like(gzFile) File pointer
260 D gzclose_w PR 10i 0 extproc('gzclose_w')
261 D file value like(gzFile) File pointer
263 D gzclose PR 10i 0 extproc('gzclose')
264 D file value like(gzFile) File pointer
266 D gzerror PR * extproc('gzerror') Error string
267 D file value like(gzFile) File pointer
268 D errnum 10I 0 Error code
270 D gzclearerr PR extproc('gzclearerr')
271 D file value like(gzFile) File pointer
273 **************************************************************************
274 * Basic function prototypes
275 **************************************************************************
277 D zlibVersion PR * extproc('zlibVersion') Version string
279 D deflateInit PR 10I 0 extproc('deflateInit_') Init. compression
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
285 D deflate PR 10I 0 extproc('deflate') Compress data
286 D strm like(z_stream) Compression stream
287 D flush 10I 0 value Flush type required
289 D deflateEnd PR 10I 0 extproc('deflateEnd') Termin. compression
290 D strm like(z_stream) Compression stream
292 D inflateInit PR 10I 0 extproc('inflateInit_') Init. expansion
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
297 D inflate PR 10I 0 extproc('inflate') Expand data
298 D strm like(z_stream) Expansion stream
299 D flush 10I 0 value Flush type required
301 D inflateEnd PR 10I 0 extproc('inflateEnd') Termin. expansion
302 D strm like(z_stream) Expansion stream
304 **************************************************************************
305 * Advanced function prototypes
306 **************************************************************************
308 D deflateInit2 PR 10I 0 extproc('deflateInit2_') Init. compression
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
318 D deflateSetDictionary...
319 D PR 10I 0 extproc('deflateSetDictionary') Init. dictionary
320 D strm like(z_stream) Compression stream
321 D dictionary 65535 const options(*varsize) Dictionary bytes
322 D dictLength 10U 0 value Dictionary length
324 D deflateCopy PR 10I 0 extproc('deflateCopy') Compress strm 2 strm
325 D dest like(z_stream) Destination stream
326 D source like(z_stream) Source stream
328 D deflateReset PR 10I 0 extproc('deflateReset') End and init. stream
329 D strm like(z_stream) Compression stream
331 D deflateParams PR 10I 0 extproc('deflateParams') Change level & strat
332 D strm like(z_stream) Compression stream
333 D level 10I 0 value Compression level
334 D strategy 10I 0 value Compression stategy
336 D deflateBound PR 10U 0 extproc('deflateBound') Change level & strat
337 D strm like(z_stream) Compression stream
338 D sourcelen 10U 0 value Compression level
340 D deflatePending PR 10I 0 extproc('deflatePending') Change level & strat
341 D strm like(z_stream) Compression stream
342 D pending 10U 0 Pending bytes
343 D bits 10I 0 Pending bits
345 D deflatePrime PR 10I 0 extproc('deflatePrime') Change level & strat
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
356 D inflateSetDictionary...
357 D PR 10I 0 extproc('inflateSetDictionary') Init. dictionary
358 D strm like(z_stream) Expansion stream
359 D dictionary 65535 const options(*varsize) Dictionary bytes
360 D dictLength 10U 0 value Dictionary length
362 D inflateSync PR 10I 0 extproc('inflateSync') Sync. expansion
363 D strm like(z_stream) Expansion stream
365 D inflateCopy PR 10I 0 extproc('inflateCopy')
366 D dest like(z_stream) Destination stream
367 D source like(z_stream) Source stream
369 D inflateReset PR 10I 0 extproc('inflateReset') End and init. stream
370 D strm like(z_stream) Expansion stream
372 D inflateReset2 PR 10I 0 extproc('inflateReset2') End and init. stream
373 D strm like(z_stream) Expansion stream
374 D windowBits 10I 0 value Log2(buffer size)
376 D inflatePrime PR 10I 0 extproc('inflatePrime') Insert bits
377 D strm like(z_stream) Expansion stream
378 D bits 10I 0 value Bit count
379 D value 10I 0 value Bits to insert
381 D inflateMark PR 10I 0 extproc('inflateMark') Get inflate info
382 D strm like(z_stream) Expansion stream
385 D PR 10I 0 extproc('inflateBackInit_')
386 D strm like(z_stream) Expansion stream
387 D windowBits 10I 0 value Log2(buffer size)
388 D window 65535 options(*varsize) Buffer
389 D version * value options(*string) Version string
390 D stream_size 10i 0 value Stream struct. size
392 D inflateBack PR 10I 0 extproc('inflateBack')
393 D strm like(z_stream) Expansion stream
394 D in * value procptr Input function
395 D in_desc * value Input descriptor
396 D out * value procptr Output function
397 D out_desc * value Output descriptor
399 D inflateBackEnd PR 10I 0 extproc('inflateBackEnd')
400 D strm like(z_stream) Expansion stream
402 D zlibCompileFlags...
403 D PR 10U 0 extproc('zlibCompileFlags')
405 **************************************************************************
406 * Checksum function prototypes
407 **************************************************************************
409 D adler32 PR 10U 0 extproc('adler32') New checksum
410 D adler 10U 0 value Old checksum
411 D buf 65535 const options(*varsize) Bytes to accumulate
412 D len 10U 0 value Buffer length
414 D crc32 PR 10U 0 extproc('crc32') New checksum
415 D crc 10U 0 value Old checksum
416 D buf 65535 const options(*varsize) Bytes to accumulate
417 D len 10U 0 value Buffer length
419 **************************************************************************
420 * Miscellaneous function prototypes
421 **************************************************************************
423 D zError PR * extproc('zError') Error string
424 D err 10I 0 value Error code
426 D inflateSyncPoint...
427 D PR 10I 0 extproc('inflateSyncPoint')
428 D strm like(z_stream) Expansion stream
430 D get_crc_table PR * extproc('get_crc_table') Ptr to ulongs
432 D inflateUndermine...
433 D PR 10I 0 extproc('inflateUndermine')
434 D strm like(z_stream) Expansion stream
435 D arg 10I 0 value Error code
437 D inflateResetKeep...
438 D PR 10I 0 extproc('inflateResetKeep') End and init. stream
439 D strm like(z_stream) Expansion stream
441 D deflateResetKeep...
442 D PR 10I 0 extproc('deflateResetKeep') End and init. stream
443 D strm like(z_stream) Expansion stream