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