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.3'
26 D ZLIB_VERNUM C X'1230'
49 D Z_BEST_COMPRESSION...
51 D Z_DEFAULT_COMPRESSION...
57 D Z_DEFAULT_STRATEGY...
68 **************************************************************************
70 **************************************************************************
72 D z_streamp S * Stream struct ptr
73 D gzFile S * File pointer
74 D z_off_t S 10i 0 Stream offsets
76 **************************************************************************
78 **************************************************************************
80 * The GZIP encode/decode stream support structure.
82 D z_stream DS align based(z_streamp)
83 D zs_next_in * Next input byte
84 D zs_avail_in 10U 0 Byte cnt at next_in
85 D zs_total_in 10U 0 Total bytes read
86 D zs_next_out * Output buffer ptr
87 D zs_avail_out 10U 0 Room left @ next_out
88 D zs_total_out 10U 0 Total bytes written
89 D zs_msg * Last errmsg or null
90 D zs_state * Internal state
91 D zs_zalloc * procptr Int. state allocator
92 D zs_free * procptr Int. state dealloc.
93 D zs_opaque * Private alloc. data
94 D zs_data_type 10i 0 ASC/BIN best guess
95 D zs_adler 10u 0 Uncompr. adler32 val
97 D 10U 0 Ptr. alignment
99 **************************************************************************
100 * Utility function prototypes
101 **************************************************************************
103 D compress PR 10I 0 extproc('compress')
104 D dest 32767 options(*varsize) Destination buffer
105 D destLen 10U 0 Destination length
106 D source 32767 const options(*varsize) Source buffer
107 D sourceLen 10u 0 value Source length
109 D compress2 PR 10I 0 extproc('compress2')
110 D dest 32767 options(*varsize) Destination buffer
111 D destLen 10U 0 Destination length
112 D source 32767 const options(*varsize) Source buffer
113 D sourceLen 10U 0 value Source length
114 D level 10I 0 value Compression level
116 D compressBound PR 10U 0 extproc('compressBound')
117 D sourceLen 10U 0 value
119 D uncompress PR 10I 0 extproc('uncompress')
120 D dest 32767 options(*varsize) Destination buffer
121 D destLen 10U 0 Destination length
122 D source 32767 const options(*varsize) Source buffer
123 D sourceLen 10U 0 value Source length
125 D gzopen PR extproc('gzopen')
127 D path * value options(*string) File pathname
128 D mode * value options(*string) Open mode
130 D gzdopen PR extproc('gzdopen')
132 D fd 10i 0 value File descriptor
133 D mode * value options(*string) Open mode
135 D gzsetparams PR 10I 0 extproc('gzsetparams')
136 D file value like(gzFile) File pointer
138 D strategy 10i 0 value
140 D gzread PR 10I 0 extproc('gzread')
141 D file value like(gzFile) File pointer
142 D buf 32767 options(*varsize) Buffer
143 D len 10u 0 value Buffer length
145 D gzwrite PR 10I 0 extproc('gzwrite')
146 D file value like(gzFile) File pointer
147 D buf 32767 const options(*varsize) Buffer
148 D len 10u 0 value Buffer length
150 D gzputs PR 10I 0 extproc('gzputs')
151 D file value like(gzFile) File pointer
152 D s * value options(*string) String to output
154 D gzgets PR * extproc('gzgets')
155 D file value like(gzFile) File pointer
156 D buf 32767 options(*varsize) Read buffer
157 D len 10i 0 value Buffer length
159 D gzflush PR 10i 0 extproc('gzflush')
160 D file value like(gzFile) File pointer
161 D flush 10I 0 value Type of flush
163 D gzseek PR extproc('gzseek')
165 D file value like(gzFile) File pointer
166 D offset value like(z_off_t) Offset
167 D whence 10i 0 value Origin
169 D gzrewind PR 10i 0 extproc('gzrewind')
170 D file value like(gzFile) File pointer
172 D gztell PR extproc('gztell')
174 D file value like(gzFile) File pointer
176 D gzeof PR 10i 0 extproc('gzeof')
177 D file value like(gzFile) File pointer
179 D gzclose PR 10i 0 extproc('gzclose')
180 D file value like(gzFile) File pointer
182 D gzerror PR * extproc('gzerror') Error string
183 D file value like(gzFile) File pointer
184 D errnum 10I 0 Error code
186 D gzclearerr PR extproc('gzclearerr')
187 D file value like(gzFile) File pointer
189 **************************************************************************
190 * Basic function prototypes
191 **************************************************************************
193 D zlibVersion PR * extproc('zlibVersion') Version string
195 D deflateInit PR 10I 0 extproc('deflateInit_') Init. compression
196 D strm like(z_stream) Compression stream
197 D level 10I 0 value Compression level
198 D version * value options(*string) Version string
199 D stream_size 10i 0 value Stream struct. size
201 D deflate PR 10I 0 extproc('deflate') Compress data
202 D strm like(z_stream) Compression stream
203 D flush 10I 0 value Flush type required
205 D deflateEnd PR 10I 0 extproc('deflateEnd') Termin. compression
206 D strm like(z_stream) Compression stream
208 D inflateInit PR 10I 0 extproc('inflateInit_') Init. expansion
209 D strm like(z_stream) Expansion stream
210 D version * value options(*string) Version string
211 D stream_size 10i 0 value Stream struct. size
213 D inflate PR 10I 0 extproc('inflate') Expand data
214 D strm like(z_stream) Expansion stream
215 D flush 10I 0 value Flush type required
217 D inflateEnd PR 10I 0 extproc('inflateEnd') Termin. expansion
218 D strm like(z_stream) Expansion stream
220 **************************************************************************
221 * Advanced function prototypes
222 **************************************************************************
224 D deflateInit2 PR 10I 0 extproc('deflateInit2_') Init. compression
225 D strm like(z_stream) Compression stream
226 D level 10I 0 value Compression level
227 D method 10I 0 value Compression method
228 D windowBits 10I 0 value log2(window size)
229 D memLevel 10I 0 value Mem/cmpress tradeoff
230 D strategy 10I 0 value Compression stategy
231 D version * value options(*string) Version string
232 D stream_size 10i 0 value Stream struct. size
234 D deflateSetDictionary...
235 D PR 10I 0 extproc('deflateSetDictionary') Init. dictionary
236 D strm like(z_stream) Compression stream
237 D dictionary 32767 const options(*varsize) Dictionary bytes
238 D dictLength 10U 0 value Dictionary length
240 D deflateCopy PR 10I 0 extproc('deflateCopy') Compress strm 2 strm
241 D dest like(z_stream) Destination stream
242 D source like(z_stream) Source stream
244 D deflateReset PR 10I 0 extproc('deflateReset') End and init. stream
245 D strm like(z_stream) Compression stream
247 D deflateParams PR 10I 0 extproc('deflateParams') Change level & strat
248 D strm like(z_stream) Compression stream
249 D level 10I 0 value Compression level
250 D strategy 10I 0 value Compression stategy
252 D deflateBound PR 10U 0 extproc('deflateBound') Change level & strat
253 D strm like(z_stream) Compression stream
254 D sourcelen 10U 0 value Compression level
256 D deflatePrime PR 10I 0 extproc('deflatePrime') Change level & strat
257 D strm like(z_stream) Compression stream
258 D bits 10I 0 value Number of bits to insert
259 D value 10I 0 value Bits to insert
261 D inflateInit2 PR 10I 0 extproc('inflateInit2_') Init. expansion
262 D strm like(z_stream) Expansion stream
263 D windowBits 10I 0 value log2(window size)
264 D version * value options(*string) Version string
265 D stream_size 10i 0 value Stream struct. size
267 D inflateSetDictionary...
268 D PR 10I 0 extproc('inflateSetDictionary') Init. dictionary
269 D strm like(z_stream) Expansion stream
270 D dictionary 32767 const options(*varsize) Dictionary bytes
271 D dictLength 10U 0 value Dictionary length
273 D inflateSync PR 10I 0 extproc('inflateSync') Sync. expansion
274 D strm like(z_stream) Expansion stream
276 D inflateCopy PR 10I 0 extproc('inflateCopy')
277 D dest like(z_stream) Destination stream
278 D source like(z_stream) Source stream
280 D inflateReset PR 10I 0 extproc('inflateReset') End and init. stream
281 D strm like(z_stream) Expansion stream
284 D PR 10I 0 extproc('inflateBackInit_')
285 D strm like(z_stream) Expansion stream
286 D windowBits 10I 0 value Log2(buffer size)
287 D window 32767 options(*varsize) Buffer
288 D version * value options(*string) Version string
289 D stream_size 10i 0 value Stream struct. size
291 D inflateBack PR 10I 0 extproc('inflateBack')
292 D strm like(z_stream) Expansion stream
293 D in * value procptr Input function
294 D in_desc * value Input descriptor
295 D out * value procptr Output function
296 D out_desc * value Output descriptor
298 D inflateBackEnd PR 10I 0 extproc('inflateBackEnd')
299 D strm like(z_stream) Expansion stream
301 D zlibCompileFlags...
302 D PR 10U 0 extproc('zlibCompileFlags')
304 **************************************************************************
305 * Checksum function prototypes
306 **************************************************************************
308 D adler32 PR 10U 0 extproc('adler32') New checksum
309 D adler 10U 0 value Old checksum
310 D buf 32767 const options(*varsize) Bytes to accumulate
311 D len 10U 0 value Buffer length
313 D crc32 PR 10U 0 extproc('crc32') New checksum
314 D crc 10U 0 value Old checksum
315 D buf 32767 const options(*varsize) Bytes to accumulate
316 D len 10U 0 value Buffer length
318 **************************************************************************
319 * Miscellaneous function prototypes
320 **************************************************************************
322 D zError PR * extproc('zError') Error string
323 D err 10I 0 value Error code
325 D inflateSyncPoint...
326 D PR 10I 0 extproc('inflateSyncPoint')
327 D strm like(z_stream) Expansion stream
329 D get_crc_table PR * extproc('get_crc_table') Ptr to ulongs