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 D ZLIB_VERSION C '1.2.1' Header's version
24 D ZLIB_VERNUM C X'1210'
45 D Z_BEST_COMPRESSION...
47 D Z_DEFAULT_COMPRESSION...
53 D Z_DEFAULT_STRATEGY...
64 **************************************************************************
66 **************************************************************************
68 D z_streamp S * Stream struct ptr
69 D gzFile S * File pointer
70 D z_off_t S 10i 0 Stream offsets
72 **************************************************************************
74 **************************************************************************
76 * The GZIP encode/decode stream support structure.
78 D z_stream DS align based(z_streamp)
79 D zs_next_in * Next input byte
80 D zs_avail_in 10U 0 Byte cnt at next_in
81 D zs_total_in 10U 0 Total bytes read
82 D zs_next_out * Output buffer ptr
83 D zs_avail_out 10U 0 Room left @ next_out
84 D zs_total_out 10U 0 Total bytes written
85 D zs_msg * Last errmsg or null
86 D zs_state * Internal state
87 D zs_zalloc * procptr Int. state allocator
88 D zs_free * procptr Int. state dealloc.
89 D zs_opaque * Private alloc. data
90 D zs_data_type 10i 0 ASC/BIN best guess
91 D zs_adler 10u 0 Uncompr. adler32 val
93 D 10U 0 Ptr. alignment
95 **************************************************************************
96 * Utility function prototypes
97 **************************************************************************
99 D compress PR 10I 0 extproc('compress')
100 D dest 32767 options(*varsize) Destination buffer
101 D destLen 10U 0 Destination length
102 D source 32767 const options(*varsize) Source buffer
103 D sourceLen 10u 0 value Source length
105 D compress2 PR 10I 0 extproc('compress2')
106 D dest 32767 options(*varsize) Destination buffer
107 D destLen 10U 0 Destination length
108 D source 32767 const options(*varsize) Source buffer
109 D sourceLen 10U 0 value Source length
110 D level 10I 0 value Compression level
112 D compressBound PR 10U 0 extproc('compressBound')
113 D sourceLen 10U 0 value
115 D uncompress PR 10I 0 extproc('uncompress')
116 D dest 32767 options(*varsize) Destination buffer
117 D destLen 10U 0 Destination length
118 D source 32767 const options(*varsize) Source buffer
119 D sourceLen 10U 0 value Source length
121 D gzopen PR extproc('gzopen')
123 D path * value options(*string) File pathname
124 D mode * value options(*string) Open mode
126 D gzdopen PR extproc('gzdopen')
128 D fd 10i 0 value File descriptor
129 D mode * value options(*string) Open mode
131 D gzsetparams PR 10I 0 extproc('gzsetparams')
132 D file value like(gzFile) File pointer
134 D strategy 10i 0 value
136 D gzread PR 10I 0 extproc('gzread')
137 D file value like(gzFile) File pointer
138 D buf 32767 options(*varsize) Buffer
139 D len 10u 0 value Buffer length
141 D gzwrite PR 10I 0 extproc('gzwrite')
142 D file value like(gzFile) File pointer
143 D buf 32767 const options(*varsize) Buffer
144 D len 10u 0 value Buffer length
146 D gzputs PR 10I 0 extproc('gzputs')
147 D file value like(gzFile) File pointer
148 D s * value options(*string) String to output
150 D gzgets PR * extproc('gzgets')
151 D file value like(gzFile) File pointer
152 D buf 32767 options(*varsize) Read buffer
153 D len 10i 0 value Buffer length
155 D gzflush PR 10i 0 extproc('gzflush')
156 D file value like(gzFile) File pointer
157 D flush 10I 0 value Type of flush
159 D gzseek PR extproc('gzseek')
161 D file value like(gzFile) File pointer
162 D offset value like(z_off_t) Offset
163 D whence 10i 0 value Origin
165 D gzrewind PR 10i 0 extproc('gzrewind')
166 D file value like(gzFile) File pointer
168 D gztell PR extproc('gztell')
170 D file value like(gzFile) File pointer
172 D gzeof PR 10i 0 extproc('gzeof')
173 D file value like(gzFile) File pointer
175 D gzclose PR 10i 0 extproc('gzclose')
176 D file value like(gzFile) File pointer
178 D gzerror PR * extproc('gzerror') Error string
179 D file value like(gzFile) File pointer
180 D errnum 10I 0 Error code
182 D gzclearerr PR extproc('gzclearerr')
183 D file value like(gzFile) File pointer
185 **************************************************************************
186 * Basic function prototypes
187 **************************************************************************
189 D zlibVersion PR * extproc('zlibVersion') Version string
191 D deflateInit PR 10I 0 extproc('deflateInit_') Init. compression
192 D strm like(z_stream) Compression stream
193 D level 10I 0 value Compression level
194 D version * value options(*string) Version string
195 D stream_size 10i 0 value Stream struct. size
197 D deflate PR 10I 0 extproc('deflate') Compress data
198 D strm like(z_stream) Compression stream
199 D flush 10I 0 value Flush type required
201 D deflateEnd PR 10I 0 extproc('deflateEnd') Termin. compression
202 D strm like(z_stream) Compression stream
204 D inflateInit PR 10I 0 extproc('inflateInit_') Init. expansion
205 D strm like(z_stream) Expansion stream
206 D version * value options(*string) Version string
207 D stream_size 10i 0 value Stream struct. size
209 D inflate PR 10I 0 extproc('inflate') Expand data
210 D strm like(z_stream) Expansion stream
211 D flush 10I 0 value Flush type required
213 D inflateEnd PR 10I 0 extproc('inflateEnd') Termin. expansion
214 D strm like(z_stream) Expansion stream
216 **************************************************************************
217 * Advanced function prototypes
218 **************************************************************************
220 D deflateInit2 PR 10I 0 extproc('deflateInit2_') Init. compression
221 D strm like(z_stream) Compression stream
222 D level 10I 0 value Compression level
223 D method 10I 0 value Compression method
224 D windowBits 10I 0 value log2(window size)
225 D memLevel 10I 0 value Mem/cmpress tradeoff
226 D strategy 10I 0 value Compression stategy
227 D version * value options(*string) Version string
228 D stream_size 10i 0 value Stream struct. size
230 D deflateSetDictionary...
231 D PR 10I 0 extproc('deflateSetDictionary') Init. dictionary
232 D strm like(z_stream) Compression stream
233 D dictionary 32767 const options(*varsize) Dictionary bytes
234 D dictLength 10U 0 value Dictionary length
236 D deflateCopy PR 10I 0 extproc('deflateCopy') Compress strm 2 strm
237 D dest like(z_stream) Destination stream
238 D source like(z_stream) Source stream
240 D deflateReset PR 10I 0 extproc('deflateReset') End and init. stream
241 D strm like(z_stream) Compression stream
243 D deflateParams PR 10I 0 extproc('deflateParams') Change level & strat
244 D strm like(z_stream) Compression stream
245 D level 10I 0 value Compression level
246 D strategy 10I 0 value Compression stategy
248 D deflateBound PR 10U 0 extproc('deflateBound') Change level & strat
249 D strm like(z_stream) Compression stream
250 D sourcelen 10U 0 value Compression level
252 D deflatePrime PR 10I 0 extproc('deflatePrime') Change level & strat
253 D strm like(z_stream) Compression stream
254 D bits 10I 0 value Number of bits to insert
255 D value 10I 0 value Bits to insert
257 D inflateInit2 PR 10I 0 extproc('inflateInit2_') Init. expansion
258 D strm like(z_stream) Expansion stream
259 D windowBits 10I 0 value log2(window size)
260 D version * value options(*string) Version string
261 D stream_size 10i 0 value Stream struct. size
263 D inflateSetDictionary...
264 D PR 10I 0 extproc('inflateSetDictionary') Init. dictionary
265 D strm like(z_stream) Expansion stream
266 D dictionary 32767 const options(*varsize) Dictionary bytes
267 D dictLength 10U 0 value Dictionary length
269 D inflateSync PR 10I 0 extproc('inflateSync') Sync. expansion
270 D strm like(z_stream) Expansion stream
272 D inflateCopy PR 10I 0 extproc('inflateCopy')
273 D dest like(z_stream) Destination stream
274 D source like(z_stream) Source stream
276 D inflateReset PR 10I 0 extproc('inflateReset') End and init. stream
277 D strm like(z_stream) Expansion stream
280 D PR 10I 0 extproc('inflateBackInit_')
281 D strm like(z_stream) Expansion stream
282 D windowBits 10I 0 value Log2(buffer size)
283 D window 32767 options(*varsize) Buffer
284 D version * value options(*string) Version string
285 D stream_size 10i 0 value Stream struct. size
287 D inflateBack PR 10I 0 extproc('inflateBack')
288 D strm like(z_stream) Expansion stream
289 D in * value procptr Input function
290 D in_desc * value Input descriptor
291 D out * value procptr Output function
292 D out_desc * value Output descriptor
294 D inflateBackEnd PR 10I 0 extproc('inflateBackEnd')
295 D strm like(z_stream) Expansion stream
297 D zlibCompileFlags...
298 D PR 10U 0 extproc('zlibCompileFlags')
300 **************************************************************************
301 * Checksum function prototypes
302 **************************************************************************
304 D adler32 PR 10U 0 extproc('adler32') New checksum
305 D adler 10U 0 value Old checksum
306 D buf 32767 const options(*varsize) Bytes to accumulate
307 D len 10U 0 value Buffer length
309 D crc32 PR 10U 0 extproc('crc32') New checksum
310 D crc 10U 0 value Old checksum
311 D buf 32767 const options(*varsize) Bytes to accumulate
312 D len 10U 0 value Buffer length
314 **************************************************************************
315 * Miscellaneous function prototypes
316 **************************************************************************
318 D zError PR * extproc('zError') Error string
319 D err 10I 0 value Error code
321 D inflateSyncPoint...
322 D PR 10I 0 extproc('inflateSyncPoint')
323 D strm like(z_stream) Expansion stream
325 D get_crc_table PR * extproc('get_crc_table') Ptr to ulongs