aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--os400/zlibfree.inc582
1 files changed, 582 insertions, 0 deletions
diff --git a/os400/zlibfree.inc b/os400/zlibfree.inc
new file mode 100644
index 00000000..5ae31baf
--- /dev/null
+++ b/os400/zlibfree.inc
@@ -0,0 +1,582 @@
1**free
2// ZLIB.INC - Interface to the general purpose compression library
3
4// ILE RPG400 version by Patrick Monnerat, DATASPHERE.
5// Version 1.3.1.1
6
7
8// WARNING:
9// Procedures inflateInit(), inflateInit2(), deflateInit(),
10// deflateInit2() and inflateBackInit() need to be called with
11// two additional arguments:
12// the package version string and the stream control structure.
13// size. This is needed because RPG lacks some macro feature.
14// Call these procedures as:
15// inflateInit(...: ZLIB_VERSION: %size(z_stream))
16
17/if not defined(ZLIB_H_)
18/define ZLIB_H_
19
20//*************************************************************************
21// Constants
22//*************************************************************************
23
24// Versioning information.
25
26Dcl-C ZLIB_VERSION '1.3.1.1';
27Dcl-C ZLIB_VERNUM X'12A0';
28Dcl-C ZLIB_VER_MAJOR 1;
29Dcl-C ZLIB_VER_MINOR 3;
30Dcl-C ZLIB_VER_REVISION 1;
31Dcl-C ZLIB_VER_SUBREVISION 1;
32
33// Other equates.
34
35Dcl-C Z_NO_FLUSH 0;
36Dcl-C Z_PARTIAL_FLUSH 1;
37Dcl-C Z_SYNC_FLUSH 2;
38Dcl-C Z_FULL_FLUSH 3;
39Dcl-C Z_FINISH 4;
40Dcl-C Z_BLOCK 5;
41Dcl-C Z_TREES 6;
42
43Dcl-C Z_OK 0;
44Dcl-C Z_STREAM_END 1;
45Dcl-C Z_NEED_DICT 2;
46Dcl-C Z_ERRNO -1;
47Dcl-C Z_STREAM_ERROR -2;
48Dcl-C Z_DATA_ERROR -3;
49Dcl-C Z_MEM_ERROR -4;
50Dcl-C Z_BUF_ERROR -5;
51Dcl-C Z_VERSION_ERROR -6;
52
53Dcl-C Z_NO_COMPRESSION 0;
54Dcl-C Z_BEST_SPEED 1;
55Dcl-C Z_BEST_COMPRESSION 9;
56Dcl-C Z_DEFAULT_COMPRESSION -1;
57
58Dcl-C Z_FILTERED 1;
59Dcl-C Z_HUFFMAN_ONLY 2;
60Dcl-C Z_RLE 3;
61Dcl-C Z_DEFAULT_STRATEGY 0;
62
63Dcl-C Z_BINARY 0;
64Dcl-C Z_ASCII 1;
65Dcl-C Z_UNKNOWN 2;
66
67Dcl-C Z_DEFLATED 8;
68
69Dcl-C Z_NULL 0;
70
71//*************************************************************************
72// Types
73//*************************************************************************
74
75Dcl-S z_streamp Pointer; // Stream struct ptr
76Dcl-S gzFile Pointer; // File pointer
77Dcl-S gz_headerp Pointer;
78Dcl-S z_off_t Int(10); // Stream offsets
79Dcl-S z_off64_t Int(20); // Stream offsets
80
81//*************************************************************************
82// Structures
83//*************************************************************************
84
85// The GZIP encode/decode stream support structure.
86
87Dcl-Ds z_stream Align Based(z_streamp);
88 zs_next_in Pointer; // Next input byte
89 zs_avail_in Uns(10); // Byte cnt at next_in
90 zs_total_in Uns(10); // Total bytes read
91 zs_next_out Pointer; // Output buffer ptr
92 zs_avail_out Uns(10); // Room left @ next_out
93 zs_total_out Uns(10); // Total bytes written
94 zs_msg Pointer; // Last errmsg or null
95 zs_state Pointer; // Internal state
96 zs_zalloc Pointer(*PROC); // Int. state allocator
97 zs_free Pointer(*PROC); // Int. state dealloc.
98 zs_opaque Pointer; // Private alloc. data
99 zs_data_type Int(10); // ASC/BIN best guess
100 zs_adler Uns(10); // Uncompr. adler32 val
101 *N Uns(10); // Reserved
102 *N Uns(10); // Ptr. alignment
103End-Ds;
104
105//*************************************************************************
106// Utility function prototypes
107//*************************************************************************
108
109Dcl-Pr compress Int(10) Extproc('compress');
110 dest Char(65535) Options(*VARSIZE); // Destination buffer
111 destLen Uns(10); // Destination length
112 source Char(65535) Const Options(*VARSIZE); // Source buffer
113 sourceLen Uns(10) Value; // Source length
114End-Pr;
115
116Dcl-Pr compress2 Int(10) Extproc('compress2');
117 dest Char(65535) Options(*VARSIZE); // Destination buffer
118 destLen Uns(10); // Destination length
119 source Char(65535) Const Options(*VARSIZE); // Source buffer
120 sourceLen Uns(10) Value; // Source length
121 level Int(10) Value; // Compression level
122End-Pr;
123
124Dcl-Pr compressBound Uns(10) Extproc('compressBound');
125 sourceLen Uns(10) Value;
126End-Pr;
127
128Dcl-Pr uncompress Int(10) Extproc('uncompress');
129 dest Char(65535) Options(*VARSIZE); // Destination buffer
130 destLen Uns(10); // Destination length
131 source Char(65535) Const Options(*VARSIZE); // Source buffer
132 sourceLen Uns(10) Value; // Source length
133End-Pr;
134
135Dcl-Pr uncompress2 Int(10) Extproc('uncompress2');
136 dest Char(65535) Options(*VARSIZE); // Destination buffer
137 destLen Uns(10); // Destination length
138 source Char(65535) Const Options(*VARSIZE); // Source buffer
139 sourceLen Uns(10); // Source length
140End-Pr;
141
142/if not defined(LARGE_FILES)
143 Dcl-Pr gzopen Extproc('gzopen') Like(gzFile);
144 path Pointer Value Options(*STRING); // File pathname
145 mode Pointer Value Options(*STRING); // Open mode
146 End-Pr;
147/else
148 Dcl-Pr gzopen Extproc('gzopen64') Like(gzFile);
149 path Pointer Value Options(*STRING); // File pathname
150 mode Pointer Value Options(*STRING); // Open mode
151 End-Pr;
152
153 Dcl-Pr gzopen64 Extproc('gzopen64') Like(gzFile);
154 path Pointer Value Options(*STRING); // File pathname
155 mode Pointer Value Options(*STRING); // Open mode
156 End-Pr;
157/endif
158
159Dcl-Pr gzdopen Extproc('gzdopen') Like(gzFile);
160 fd Int(10) Value; // File descriptor
161 mode Pointer Value Options(*STRING); // Open mode
162End-Pr;
163
164Dcl-Pr gzbuffer Int(10) Extproc('gzbuffer');
165 file Value Like(gzFile); // File pointer
166 size Uns(10) Value;
167End-Pr;
168
169Dcl-Pr gzsetparams Int(10) Extproc('gzsetparams');
170 file Value Like(gzFile); // File pointer
171 level Int(10) Value;
172 strategy Int(10) Value;
173End-Pr;
174
175Dcl-Pr gzread Int(10) Extproc('gzread');
176 file Value Like(gzFile); // File pointer
177 buf Char(65535) Options(*VARSIZE); // Buffer
178 len Uns(10) Value; // Buffer length
179End-Pr;
180
181Dcl-Pr gzfread Int(20) Extproc('gzfread');
182 buf Char(65535) Options(*VARSIZE); // Buffer
183 size Uns(20) Value; // Buffer length
184 nitems Uns(20) Value; // Buffer length
185 file Value Like(gzFile); // File pointer
186End-Pr;
187
188Dcl-Pr gzwrite Int(10) Extproc('gzwrite');
189 file Value Like(gzFile); // File pointer
190 buf Char(65535) Const Options(*VARSIZE); // Buffer
191 len Uns(10) Value; // Buffer length
192End-Pr;
193
194Dcl-Pr gzfwrite Int(20) Extproc('gzfwrite');
195 buf Char(65535) Options(*VARSIZE); // Buffer
196 size Uns(20) Value; // Buffer length
197 nitems Uns(20) Value; // Buffer length
198 file Value Like(gzFile); // File pointer
199End-Pr;
200
201Dcl-Pr gzputs Int(10) Extproc('gzputs');
202 file Value Like(gzFile); // File pointer
203 s Pointer Value Options(*STRING); // String to output
204End-Pr;
205
206Dcl-Pr gzgets Pointer Extproc('gzgets');
207 file Value Like(gzFile); // File pointer
208 buf Char(65535) Options(*VARSIZE); // Read buffer
209 len Int(10) Value; // Buffer length
210End-Pr;
211
212Dcl-Pr gzputc Int(10) Extproc('gzputc');
213 file Value Like(gzFile); // File pointer
214 c Int(10) Value; // Character to write
215End-Pr;
216
217Dcl-Pr gzgetc Int(10) Extproc('gzgetc');
218 file Value Like(gzFile); // File pointer
219End-Pr;
220
221Dcl-Pr gzgetc_ Int(10) Extproc('gzgetc_');
222 file Value Like(gzFile); // File pointer
223End-Pr;
224
225Dcl-Pr gzungetc Int(10) Extproc('gzungetc');
226 c Int(10) Value; // Character to push
227 file Value Like(gzFile); // File pointer
228End-Pr;
229
230Dcl-Pr gzflush Int(10) Extproc('gzflush');
231 file Value Like(gzFile); // File pointer
232 flush Int(10) Value; // Type of flush
233End-Pr;
234
235/if not defined(LARGE_FILES)
236 Dcl-Pr gzseek Extproc('gzseek') Like(z_off_t);
237 file Value Like(gzFile); // File pointer
238 offset Value Like(z_off_t); // Offset
239 whence Int(10) Value; // Origin
240 End-Pr;
241/else
242 Dcl-Pr gzseek Extproc('gzseek64') Like(z_off_t);
243 file Value Like(gzFile); // File pointer
244 offset Value Like(z_off_t); // Offset
245 whence Int(10) Value; // Origin
246 End-Pr;
247
248 Dcl-Pr gzseek64 Extproc('gzseek64') Like(z_off64_t);
249 file Value Like(gzFile); // File pointer
250 offset Value Like(z_off64_t); // Offset
251 whence Int(10) Value; // Origin
252 End-Pr;
253/endif
254
255Dcl-Pr gzrewind Int(10) Extproc('gzrewind');
256 file Value Like(gzFile); // File pointer
257End-Pr;
258
259/if not defined(LARGE_FILES)
260 Dcl-Pr gztell Extproc('gztell') Like(z_off_t);
261 file Value Like(gzFile); // File pointer
262 End-Pr;
263/else
264 Dcl-Pr gztell Extproc('gztell64') Like(z_off_t);
265 file Value Like(gzFile); // File pointer
266 End-Pr;
267
268 Dcl-Pr gztell64 Extproc('gztell64') Like(z_off64_t);
269 file Value Like(gzFile); // File pointer
270 End-Pr;
271/endif
272
273/if not defined(LARGE_FILES)
274 Dcl-Pr gzoffset Extproc('gzoffset') Like(z_off_t);
275 file Value Like(gzFile); // File pointer
276 End-Pr;
277/else
278 Dcl-Pr gzoffset Extproc('gzoffset64') Like(z_off_t);
279 file Value Like(gzFile); // File pointer
280 End-Pr;
281
282 Dcl-Pr gzoffset64 Extproc('gzoffset64') Like(z_off64_t);
283 file Value Like(gzFile); // File pointer
284 End-Pr;
285/endif
286
287Dcl-Pr gzeof Int(10) Extproc('gzeof');
288 file Value Like(gzFile); // File pointer
289End-Pr;
290
291Dcl-Pr gzdirect Int(10) Extproc('gzdirect');
292 file Value Like(gzFile); // File pointer
293End-Pr;
294
295Dcl-Pr gzclose_r Int(10) Extproc('gzclose_r');
296 file Value Like(gzFile); // File pointer
297End-Pr;
298
299Dcl-Pr gzclose_w Int(10) Extproc('gzclose_w');
300 file Value Like(gzFile); // File pointer
301End-Pr;
302
303Dcl-Pr gzclose Int(10) Extproc('gzclose');
304 file Value Like(gzFile); // File pointer
305End-Pr;
306
307Dcl-Pr gzerror Pointer Extproc('gzerror'); // Error string
308 file Value Like(gzFile); // File pointer
309 errnum Int(10); // Error code
310End-Pr;
311
312Dcl-Pr gzclearerr Extproc('gzclearerr');
313 file Value Like(gzFile); // File pointer
314End-Pr;
315
316//*************************************************************************
317// Basic function prototypes
318//*************************************************************************
319
320Dcl-Pr zlibVersion Pointer Extproc('zlibVersion'); // Version string
321End-Pr;
322
323Dcl-Pr deflateInit Int(10) Extproc('deflateInit_'); // Init. compression
324 strm Like(z_stream); // Compression stream
325 level Int(10) Value; // Compression level
326 version Pointer Value Options(*STRING); // Version string
327 stream_size Int(10) Value; // Stream struct. size
328End-Pr;
329
330Dcl-Pr deflate Int(10) Extproc('deflate'); // Compress data
331 strm Like(z_stream); // Compression stream
332 flush Int(10) Value; // Flush type required
333End-Pr;
334
335Dcl-Pr deflateEnd Int(10) Extproc('deflateEnd'); // Termin. compression
336 strm Like(z_stream); // Compression stream
337End-Pr;
338
339Dcl-Pr inflateInit Int(10) Extproc('inflateInit_'); // Init. expansion
340 strm Like(z_stream); // Expansion stream
341 version Pointer Value Options(*STRING); // Version string
342 stream_size Int(10) Value; // Stream struct. size
343End-Pr;
344
345Dcl-Pr inflate Int(10) Extproc('inflate'); // Expand data
346 strm Like(z_stream); // Expansion stream
347 flush Int(10) Value; // Flush type required
348End-Pr;
349
350Dcl-Pr inflateEnd Int(10) Extproc('inflateEnd'); // Termin. expansion
351 strm Like(z_stream); // Expansion stream
352End-Pr;
353
354//*************************************************************************
355// Advanced function prototypes
356//*************************************************************************
357
358Dcl-Pr deflateInit2 Int(10) Extproc('deflateInit2_'); // Init. compression
359 strm Like(z_stream); // Compression stream
360 level Int(10) Value; // Compression level
361 method Int(10) Value; // Compression method
362 windowBits Int(10) Value; // log2(window size)
363 memLevel Int(10) Value; // Mem/cmpress tradeoff
364 strategy Int(10) Value; // Compression strategy
365 version Pointer Value Options(*STRING); // Version string
366 stream_size Int(10) Value; // Stream struct. size
367End-Pr;
368
369Dcl-Pr deflateSetDictionary Int(10) Extproc('deflateSetDictionary'); // Init. dictionary
370 strm Like(z_stream); // Compression stream
371 dictionary Char(65535) Const Options(*VARSIZE); // Dictionary bytes
372 dictLength Uns(10) Value; // Dictionary length
373End-Pr;
374
375Dcl-Pr deflateCopy Int(10) Extproc('deflateCopy'); // Compress strm 2 strm
376 dest Like(z_stream); // Destination stream
377 source Like(z_stream); // Source stream
378End-Pr;
379
380Dcl-Pr deflateReset Int(10) Extproc('deflateReset'); // End and init. stream
381 strm Like(z_stream); // Compression stream
382End-Pr;
383
384Dcl-Pr deflateParams Int(10) Extproc('deflateParams'); // Change level & strat
385 strm Like(z_stream); // Compression stream
386 level Int(10) Value; // Compression level
387 strategy Int(10) Value; // Compression strategy
388End-Pr;
389
390Dcl-Pr deflateTune Int(10) Extproc('deflateTune');
391 strm Like(z_stream); // Compression stream
392 good Int(10) Value;
393 lazy Int(10) Value;
394 nice Int(10) Value;
395 chain_ Int(10) Value;
396End-Pr;
397
398Dcl-Pr deflateBound Uns(10) Extproc('deflateBound'); // Change level & strat
399 strm Like(z_stream); // Compression stream
400 sourcelen Uns(10) Value; // Compression level
401End-Pr;
402
403Dcl-Pr deflatePending Int(10) Extproc('deflatePending'); // Change level & strat
404 strm Like(z_stream); // Compression stream
405 pending Uns(10); // Pending bytes
406 bits Int(10); // Pending bits
407End-Pr;
408
409Dcl-Pr deflateUsed Int(10) Extproc('deflateUsed'); // Get used bits
410 strm Like(z_stream); // Compression stream
411 bits Int(10); // Used bits
412End-Pr;
413
414Dcl-Pr deflatePrime Int(10) Extproc('deflatePrime'); // Change level & strat
415 strm Like(z_stream); // Compression stream
416 bits Int(10) Value; // # of bits to insert
417 value Int(10) Value; // Bits to insert
418End-Pr;
419
420Dcl-Pr inflateInit2 Int(10) Extproc('inflateInit2_'); // Init. expansion
421 strm Like(z_stream); // Expansion stream
422 windowBits Int(10) Value; // log2(window size)
423 version Pointer Value Options(*STRING); // Version string
424 stream_size Int(10) Value; // Stream struct. size
425End-Pr;
426
427Dcl-Pr inflateSetDictionary Int(10) Extproc('inflateSetDictionary'); // Init. dictionary
428 strm Like(z_stream); // Expansion stream
429 dictionary Char(65535) Const Options(*VARSIZE); // Dictionary bytes
430 dictLength Uns(10) Value; // Dictionary length
431End-Pr;
432
433Dcl-Pr inflateGetDictionary Int(10) Extproc('inflateGetDictionary'); // Get dictionary
434 strm Like(z_stream); // Expansion stream
435 dictionary Char(65535) Options(*VARSIZE); // Dictionary bytes
436 dictLength Uns(10); // Dictionary length
437End-Pr;
438
439Dcl-Pr deflateGetDictionary Int(10) Extproc('deflateGetDictionary'); // Get dictionary
440 strm Like(z_stream); // Expansion stream
441 dictionary Char(65535) Options(*VARSIZE); // Dictionary bytes
442 dictLength Uns(10); // Dictionary length
443End-Pr;
444
445Dcl-Pr inflateSync Int(10) Extproc('inflateSync'); // Sync. expansion
446 strm Like(z_stream); // Expansion stream
447End-Pr;
448
449Dcl-Pr inflateCopy Int(10) Extproc('inflateCopy');
450 dest Like(z_stream); // Destination stream
451 source Like(z_stream); // Source stream
452End-Pr;
453
454Dcl-Pr inflateReset Int(10) Extproc('inflateReset'); // End and init. stream
455 strm Like(z_stream); // Expansion stream
456End-Pr;
457
458Dcl-Pr inflateReset2 Int(10) Extproc('inflateReset2'); // End and init. stream
459 strm Like(z_stream); // Expansion stream
460 windowBits Int(10) Value; // Log2(buffer size)
461End-Pr;
462
463Dcl-Pr inflatePrime Int(10) Extproc('inflatePrime'); // Insert bits
464 strm Like(z_stream); // Expansion stream
465 bits Int(10) Value; // Bit count
466 value Int(10) Value; // Bits to insert
467End-Pr;
468
469Dcl-Pr inflateMark Int(10) Extproc('inflateMark'); // Get inflate info
470 strm Like(z_stream); // Expansion stream
471End-Pr;
472
473Dcl-Pr inflateCodesUsed Uns(20) Extproc('inflateCodesUsed');
474 strm Like(z_stream); // Expansion stream
475End-Pr;
476
477Dcl-Pr inflateValidate Uns(20) Extproc('inflateValidate');
478 strm Like(z_stream); // Expansion stream
479 check Int(10) Value;
480End-Pr;
481
482Dcl-Pr inflateGetHeader Uns(10) Extproc('inflateGetHeader');
483 strm Like(z_stream); // Expansion stream
484 head Like(GZ_HEADERP);
485End-Pr;
486
487Dcl-Pr deflateSetHeader Uns(10) Extproc('deflateSetHeader');
488 strm Like(z_stream); // Expansion stream
489 head Like(GZ_HEADERP);
490End-Pr;
491
492Dcl-Pr inflateBackInit Int(10) Extproc('inflateBackInit_');
493 strm Like(z_stream); // Expansion stream
494 windowBits Int(10) Value; // Log2(buffer size)
495 window Char(65535) Options(*VARSIZE); // Buffer
496 version Pointer Value Options(*STRING); // Version string
497 stream_size Int(10) Value; // Stream struct. size
498End-Pr;
499
500Dcl-Pr inflateBack Int(10) Extproc('inflateBack');
501 strm Like(z_stream); // Expansion stream
502 in_ Pointer(*PROC) Value; // Input function
503 in_desc Pointer Value; // Input descriptor
504 out_ Pointer(*PROC) Value; // Output function
505 out_desc Pointer Value; // Output descriptor
506End-Pr;
507
508Dcl-Pr inflateBackEnd Int(10) Extproc('inflateBackend');
509 strm Like(z_stream); // Expansion stream
510End-Pr;
511
512Dcl-Pr zlibCompileFlags Uns(10) Extproc('zlibCompileFlags') End-Pr;
513
514//*************************************************************************
515// Checksum function prototypes
516//*************************************************************************
517
518Dcl-Pr adler32 Uns(10) Extproc('adler32'); // New checksum
519 adler Uns(10) Value; // Old checksum
520 buf Char(65535) Const Options(*VARSIZE); // Bytes to accumulate
521 len Uns(10) Value; // Buffer length
522End-Pr;
523
524Dcl-Pr adler32_combine Uns(10) Extproc('adler32_combine'); // New checksum
525 adler1 Uns(10) Value; // Old checksum
526 adler2 Uns(10) Value; // Old checksum
527 len2 Uns(20) Value; // Buffer length
528End-Pr;
529
530Dcl-Pr adler32_z Uns(10) Extproc('adler32_z'); // New checksum
531 adler Uns(10) Value; // Old checksum
532 buf Char(65535) Const Options(*VARSIZE); // Bytes to accumulate
533 len Uns(20) Value; // Buffer length
534End-Pr;
535
536Dcl-Pr crc32 Uns(10) Extproc('crc32'); // New checksum
537 crc Uns(10) Value; // Old checksum
538 buf Char(65535) Const Options(*VARSIZE); // Bytes to accumulate
539 len Uns(10) Value; // Buffer length
540End-Pr;
541
542Dcl-Pr crc32_combine Uns(10) Extproc('crc32_combine'); // New checksum
543 crc1 Uns(10) Value; // Old checksum
544 crc2 Uns(10) Value; // Old checksum
545 len2 Uns(20) Value; // Buffer length
546End-Pr;
547
548Dcl-Pr crc32_z Uns(10) Extproc('crc32_z'); // New checksum
549 crc Uns(10) Value; // Old checksum
550 buf Char(65535) Const Options(*VARSIZE); // Bytes to accumulate
551 len Uns(20) Value; // Buffer length
552End-Pr;
553
554//*************************************************************************
555// Miscellaneous function prototypes
556//*************************************************************************
557
558Dcl-Pr zError Pointer Extproc('zError'); // Error string
559 err Int(10) Value; // Error code
560End-Pr;
561
562Dcl-Pr inflateSyncPoint Int(10) Extproc('inflateSyncPoint');
563 strm Like(z_stream); // Expansion stream
564End-Pr;
565
566Dcl-Pr get_crc_table Pointer Extproc('get_crc_table'); // Ptr to ulongs
567End-Pr;
568
569Dcl-Pr inflateUndermine Int(10) Extproc('inflateUndermine');
570 strm Like(z_stream); // Expansion stream
571 arg Int(10) Value; // Error code
572End-Pr;
573
574Dcl-Pr inflateResetKeep Int(10) Extproc('inflateResetKeep'); // End and init. stream
575 strm Like(z_stream); // Expansion stream
576End-Pr;
577
578Dcl-Pr deflateResetKeep Int(10) Extproc('deflateResetKeep'); // End and init. stream
579 strm Like(z_stream); // Expansion stream
580End-Pr;
581
582/endif