diff options
Diffstat (limited to 'as400')
-rw-r--r-- | as400/bndsrc | 183 | ||||
-rw-r--r-- | as400/compile.clp | 110 | ||||
-rw-r--r-- | as400/readme.txt | 115 | ||||
-rw-r--r-- | as400/zlib.inc | 423 |
4 files changed, 831 insertions, 0 deletions
diff --git a/as400/bndsrc b/as400/bndsrc new file mode 100644 index 0000000..06c3f43 --- /dev/null +++ b/as400/bndsrc | |||
@@ -0,0 +1,183 @@ | |||
1 | STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB') | ||
2 | |||
3 | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ | ||
4 | /* Version 1.1.3 entry points. */ | ||
5 | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ | ||
6 | |||
7 | /********************************************************************/ | ||
8 | /* *MODULE ADLER32 ZLIB 01/02/01 00:15:09 */ | ||
9 | /********************************************************************/ | ||
10 | |||
11 | EXPORT SYMBOL("adler32") | ||
12 | |||
13 | /********************************************************************/ | ||
14 | /* *MODULE COMPRESS ZLIB 01/02/01 00:15:09 */ | ||
15 | /********************************************************************/ | ||
16 | |||
17 | EXPORT SYMBOL("compress") | ||
18 | EXPORT SYMBOL("compress2") | ||
19 | |||
20 | /********************************************************************/ | ||
21 | /* *MODULE CRC32 ZLIB 01/02/01 00:15:09 */ | ||
22 | /********************************************************************/ | ||
23 | |||
24 | EXPORT SYMBOL("crc32") | ||
25 | EXPORT SYMBOL("get_crc_table") | ||
26 | |||
27 | /********************************************************************/ | ||
28 | /* *MODULE DEFLATE ZLIB 01/02/01 00:15:09 */ | ||
29 | /********************************************************************/ | ||
30 | |||
31 | EXPORT SYMBOL("deflate") | ||
32 | EXPORT SYMBOL("deflateEnd") | ||
33 | EXPORT SYMBOL("deflateSetDictionary") | ||
34 | EXPORT SYMBOL("deflateCopy") | ||
35 | EXPORT SYMBOL("deflateReset") | ||
36 | EXPORT SYMBOL("deflateParams") | ||
37 | EXPORT SYMBOL("deflatePending") | ||
38 | EXPORT SYMBOL("deflatePrime") | ||
39 | EXPORT SYMBOL("deflateInit_") | ||
40 | EXPORT SYMBOL("deflateInit2_") | ||
41 | |||
42 | /********************************************************************/ | ||
43 | /* *MODULE GZIO ZLIB 01/02/01 00:15:09 */ | ||
44 | /********************************************************************/ | ||
45 | |||
46 | EXPORT SYMBOL("gzopen") | ||
47 | EXPORT SYMBOL("gzdopen") | ||
48 | EXPORT SYMBOL("gzsetparams") | ||
49 | EXPORT SYMBOL("gzread") | ||
50 | EXPORT SYMBOL("gzwrite") | ||
51 | EXPORT SYMBOL("gzprintf") | ||
52 | EXPORT SYMBOL("gzputs") | ||
53 | EXPORT SYMBOL("gzgets") | ||
54 | EXPORT SYMBOL("gzputc") | ||
55 | EXPORT SYMBOL("gzgetc") | ||
56 | EXPORT SYMBOL("gzflush") | ||
57 | EXPORT SYMBOL("gzseek") | ||
58 | EXPORT SYMBOL("gzrewind") | ||
59 | EXPORT SYMBOL("gztell") | ||
60 | EXPORT SYMBOL("gzeof") | ||
61 | EXPORT SYMBOL("gzclose") | ||
62 | EXPORT SYMBOL("gzerror") | ||
63 | |||
64 | /********************************************************************/ | ||
65 | /* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */ | ||
66 | /********************************************************************/ | ||
67 | |||
68 | EXPORT SYMBOL("inflate") | ||
69 | EXPORT SYMBOL("inflateEnd") | ||
70 | EXPORT SYMBOL("inflateSetDictionary") | ||
71 | EXPORT SYMBOL("inflateSync") | ||
72 | EXPORT SYMBOL("inflateReset") | ||
73 | EXPORT SYMBOL("inflateInit_") | ||
74 | EXPORT SYMBOL("inflateInit2_") | ||
75 | EXPORT SYMBOL("inflateSyncPoint") | ||
76 | |||
77 | /********************************************************************/ | ||
78 | /* *MODULE UNCOMPR ZLIB 01/02/01 00:15:09 */ | ||
79 | /********************************************************************/ | ||
80 | |||
81 | EXPORT SYMBOL("uncompress") | ||
82 | |||
83 | /********************************************************************/ | ||
84 | /* *MODULE ZUTIL ZLIB 01/02/01 00:15:09 */ | ||
85 | /********************************************************************/ | ||
86 | |||
87 | EXPORT SYMBOL("zlibVersion") | ||
88 | EXPORT SYMBOL("zError") | ||
89 | |||
90 | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ | ||
91 | /* Version 1.2.1 additional entry points. */ | ||
92 | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ | ||
93 | |||
94 | /********************************************************************/ | ||
95 | /* *MODULE COMPRESS ZLIB 01/02/01 00:15:09 */ | ||
96 | /********************************************************************/ | ||
97 | |||
98 | EXPORT SYMBOL("compressBound") | ||
99 | |||
100 | /********************************************************************/ | ||
101 | /* *MODULE DEFLATE ZLIB 01/02/01 00:15:09 */ | ||
102 | /********************************************************************/ | ||
103 | |||
104 | EXPORT SYMBOL("deflateBound") | ||
105 | |||
106 | /********************************************************************/ | ||
107 | /* *MODULE GZIO ZLIB 01/02/01 00:15:09 */ | ||
108 | /********************************************************************/ | ||
109 | |||
110 | EXPORT SYMBOL("gzungetc") | ||
111 | EXPORT SYMBOL("gzclearerr") | ||
112 | |||
113 | /********************************************************************/ | ||
114 | /* *MODULE INFBACK ZLIB 01/02/01 00:15:09 */ | ||
115 | /********************************************************************/ | ||
116 | |||
117 | EXPORT SYMBOL("inflateBack") | ||
118 | EXPORT SYMBOL("inflateBackEnd") | ||
119 | EXPORT SYMBOL("inflateBackInit_") | ||
120 | |||
121 | /********************************************************************/ | ||
122 | /* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */ | ||
123 | /********************************************************************/ | ||
124 | |||
125 | EXPORT SYMBOL("inflateCopy") | ||
126 | |||
127 | /********************************************************************/ | ||
128 | /* *MODULE ZUTIL ZLIB 01/02/01 00:15:09 */ | ||
129 | /********************************************************************/ | ||
130 | |||
131 | EXPORT SYMBOL("zlibCompileFlags") | ||
132 | |||
133 | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ | ||
134 | /* Version 1.2.5 additional entry points. */ | ||
135 | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ | ||
136 | |||
137 | /********************************************************************/ | ||
138 | /* *MODULE ADLER32 ZLIB 01/02/01 00:15:09 */ | ||
139 | /********************************************************************/ | ||
140 | |||
141 | EXPORT SYMBOL("adler32_combine") | ||
142 | EXPORT SYMBOL("adler32_combine64") | ||
143 | |||
144 | /********************************************************************/ | ||
145 | /* *MODULE CRC32 ZLIB 01/02/01 00:15:09 */ | ||
146 | /********************************************************************/ | ||
147 | |||
148 | EXPORT SYMBOL("crc32_combine") | ||
149 | EXPORT SYMBOL("crc32_combine64") | ||
150 | |||
151 | /********************************************************************/ | ||
152 | /* *MODULE GZLIB ZLIB 01/02/01 00:15:09 */ | ||
153 | /********************************************************************/ | ||
154 | |||
155 | EXPORT SYMBOL("gzbuffer") | ||
156 | EXPORT SYMBOL("gzoffset") | ||
157 | EXPORT SYMBOL("gzoffset64") | ||
158 | EXPORT SYMBOL("gzopen64") | ||
159 | EXPORT SYMBOL("gzseek64") | ||
160 | EXPORT SYMBOL("gztell64") | ||
161 | |||
162 | /********************************************************************/ | ||
163 | /* *MODULE GZREAD ZLIB 01/02/01 00:15:09 */ | ||
164 | /********************************************************************/ | ||
165 | |||
166 | EXPORT SYMBOL("gzclose_r") | ||
167 | |||
168 | /********************************************************************/ | ||
169 | /* *MODULE GZWRITE ZLIB 01/02/01 00:15:09 */ | ||
170 | /********************************************************************/ | ||
171 | |||
172 | EXPORT SYMBOL("gzclose_w") | ||
173 | |||
174 | /********************************************************************/ | ||
175 | /* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */ | ||
176 | /********************************************************************/ | ||
177 | |||
178 | EXPORT SYMBOL("inflateMark") | ||
179 | EXPORT SYMBOL("inflatePrime") | ||
180 | EXPORT SYMBOL("inflateReset2") | ||
181 | EXPORT SYMBOL("inflateUndermine") | ||
182 | |||
183 | ENDPGMEXP | ||
diff --git a/as400/compile.clp b/as400/compile.clp new file mode 100644 index 0000000..2f34936 --- /dev/null +++ b/as400/compile.clp | |||
@@ -0,0 +1,110 @@ | |||
1 | /******************************************************************************/ | ||
2 | /* */ | ||
3 | /* ZLIB */ | ||
4 | /* */ | ||
5 | /* Compile sources into modules and link them into a service program. */ | ||
6 | /* */ | ||
7 | /******************************************************************************/ | ||
8 | |||
9 | PGM | ||
10 | |||
11 | /* Configuration adjustable parameters. */ | ||
12 | |||
13 | DCL VAR(&SRCLIB) TYPE(*CHAR) LEN(10) + | ||
14 | VALUE('ZLIB') /* Source library. */ | ||
15 | DCL VAR(&SRCFILE) TYPE(*CHAR) LEN(10) + | ||
16 | VALUE('SOURCES') /* Source member file. */ | ||
17 | DCL VAR(&CTLFILE) TYPE(*CHAR) LEN(10) + | ||
18 | VALUE('TOOLS') /* Control member file. */ | ||
19 | |||
20 | DCL VAR(&MODLIB) TYPE(*CHAR) LEN(10) + | ||
21 | VALUE('ZLIB') /* Module library. */ | ||
22 | |||
23 | DCL VAR(&SRVLIB) TYPE(*CHAR) LEN(10) + | ||
24 | VALUE('LGPL') /* Service program library. */ | ||
25 | |||
26 | DCL VAR(&CFLAGS) TYPE(*CHAR) + | ||
27 | VALUE('OPTIMIZE(40)') /* Compile options. */ | ||
28 | |||
29 | DCL VAR(&TGTRLS) TYPE(*CHAR) + | ||
30 | VALUE('V5R3M0') /* Target release. */ | ||
31 | |||
32 | |||
33 | /* Working storage. */ | ||
34 | |||
35 | DCL VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(300) /* Command length. */ | ||
36 | DCL VAR(&CMD) TYPE(*CHAR) LEN(512) | ||
37 | DCL VAR(&FIXDCMD) TYPE(*CHAR) LEN(512) | ||
38 | |||
39 | |||
40 | /* Compile sources into modules. */ | ||
41 | |||
42 | CHGVAR VAR(&FIXDCMD) VALUE('CRTCMOD' *BCAT &CFLAGS *BCAT + | ||
43 | 'SYSIFCOPT(*IFS64IO)' *BCAT + | ||
44 | 'DEFINE(''_LARGEFILE64_SOURCE''' *BCAT + | ||
45 | '''_LFS64_LARGEFILE=1'') TGTRLS(' *TCAT &TGTRLS *TCAT + | ||
46 | ') SRCFILE(' *TCAT &SRCLIB *TCAT '/' *TCAT + | ||
47 | &SRCFILE *TCAT ') MODULE(' *TCAT &MODLIB *TCAT '/') | ||
48 | |||
49 | |||
50 | CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'ADLER32)') | ||
51 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
52 | |||
53 | CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'COMPRESS)') | ||
54 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
55 | |||
56 | CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'CRC32)') | ||
57 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
58 | |||
59 | CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'DEFLATE)') | ||
60 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
61 | |||
62 | CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZCLOSE)') | ||
63 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
64 | |||
65 | CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZLIB)') | ||
66 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
67 | |||
68 | CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZREAD)') | ||
69 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
70 | |||
71 | CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZWRITE)') | ||
72 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
73 | |||
74 | CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFBACK)') | ||
75 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
76 | |||
77 | CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFFAST)') | ||
78 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
79 | |||
80 | CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFLATE)') | ||
81 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
82 | |||
83 | CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFTREES)') | ||
84 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
85 | |||
86 | CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'TREES)') | ||
87 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
88 | |||
89 | CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'UNCOMPR)') | ||
90 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
91 | |||
92 | CHGVAR VAR(&CMD) VALUE(&FIXDCMD *TCAT 'ZUTIL)') | ||
93 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
94 | |||
95 | |||
96 | /* Link modules into a service program. */ | ||
97 | |||
98 | CRTSRVPGM SRVPGM(&SRVLIB/ZLIB) + | ||
99 | MODULE(&MODLIB/ADLER32 &MODLIB/COMPRESS + | ||
100 | &MODLIB/CRC32 &MODLIB/DEFLATE + | ||
101 | &MODLIB/GZCLOSE &MODLIB/GZLIB + | ||
102 | &MODLIB/GZREAD &MODLIB/GZWRITE + | ||
103 | &MODLIB/INFBACK &MODLIB/INFFAST + | ||
104 | &MODLIB/INFLATE &MODLIB/INFTREES + | ||
105 | &MODLIB/TREES &MODLIB/UNCOMPR + | ||
106 | &MODLIB/ZUTIL) + | ||
107 | SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC) + | ||
108 | TEXT('ZLIB 1.2.5.1') TGTRLS(&TGTRLS) | ||
109 | |||
110 | ENDPGM | ||
diff --git a/as400/readme.txt b/as400/readme.txt new file mode 100644 index 0000000..5b96cec --- /dev/null +++ b/as400/readme.txt | |||
@@ -0,0 +1,115 @@ | |||
1 | ZLIB version 1.2.5.1 for AS400 installation instructions | ||
2 | |||
3 | I) From an AS400 *SAVF file: | ||
4 | |||
5 | 1) Unpacking archive to an AS400 save file | ||
6 | |||
7 | On the AS400: | ||
8 | |||
9 | _ Create the ZLIB AS400 library: | ||
10 | |||
11 | CRTLIB LIB(ZLIB) TYPE(PROD) TEXT('ZLIB compression API library') | ||
12 | |||
13 | _ Create a work save file, for example: | ||
14 | |||
15 | CRTSAVF FILE(ZLIB/ZLIBSAVF) | ||
16 | |||
17 | On a PC connected to the target AS400: | ||
18 | |||
19 | _ Unpack the save file image to a PC file "ZLIBSAVF" | ||
20 | _ Upload this file into the save file on the AS400, for example | ||
21 | using ftp in BINARY mode. | ||
22 | |||
23 | |||
24 | 2) Populating the ZLIB AS400 source library | ||
25 | |||
26 | On the AS400: | ||
27 | |||
28 | _ Extract the saved objects into the ZLIB AS400 library using: | ||
29 | |||
30 | RSTOBJ OBJ(*ALL) SAVLIB(ZLIB) DEV(*SAVF) SAVF(ZLIB/ZLIBSAVF) RSTLIB(ZLIB) | ||
31 | |||
32 | |||
33 | 3) Customize installation: | ||
34 | |||
35 | _ Edit CL member ZLIB/TOOLS(COMPILE) and change parameters if needed, | ||
36 | according to the comments. | ||
37 | |||
38 | _ Compile this member with: | ||
39 | |||
40 | CRTCLPGM PGM(ZLIB/COMPILE) SRCFILE(ZLIB/TOOLS) SRCMBR(COMPILE) | ||
41 | |||
42 | |||
43 | 4) Compile and generate the service program: | ||
44 | |||
45 | _ This can now be done by executing: | ||
46 | |||
47 | CALL PGM(ZLIB/COMPILE) | ||
48 | |||
49 | |||
50 | |||
51 | II) From the original source distribution: | ||
52 | |||
53 | 1) On the AS400, create the source library: | ||
54 | |||
55 | CRTLIB LIB(ZLIB) TYPE(PROD) TEXT('ZLIB compression API library') | ||
56 | |||
57 | 2) Create the source files: | ||
58 | |||
59 | CRTSRCPF FILE(ZLIB/SOURCES) RCDLEN(112) TEXT('ZLIB library modules') | ||
60 | CRTSRCPF FILE(ZLIB/H) RCDLEN(112) TEXT('ZLIB library includes') | ||
61 | CRTSRCPF FILE(ZLIB/TOOLS) RCDLEN(112) TEXT('ZLIB library control utilities') | ||
62 | |||
63 | 3) From the machine hosting the distribution files, upload them (with | ||
64 | FTP in text mode, for example) according to the following table: | ||
65 | |||
66 | Original AS400 AS400 AS400 AS400 | ||
67 | file file member type description | ||
68 | SOURCES Original ZLIB C subprogram sources | ||
69 | adler32.c ADLER32 C ZLIB - Compute the Adler-32 checksum of a dta strm | ||
70 | compress.c COMPRESS C ZLIB - Compress a memory buffer | ||
71 | crc32.c CRC32 C ZLIB - Compute the CRC-32 of a data stream | ||
72 | deflate.c DEFLATE C ZLIB - Compress data using the deflation algorithm | ||
73 | gzclose.c GZCLOSE C ZLIB - Close .gz files | ||
74 | gzlib.c GZLIB C ZLIB - Miscellaneous .gz files IO support | ||
75 | gzread.c GZREAD C ZLIB - Read .gz files | ||
76 | gzwrite.c GZWRITE C ZLIB - Write .gz files | ||
77 | infback.c INFBACK C ZLIB - Inflate using a callback interface | ||
78 | inffast.c INFFAST C ZLIB - Fast proc. literals & length/distance pairs | ||
79 | inflate.c INFLATE C ZLIB - Interface to inflate modules | ||
80 | inftrees.c INFTREES C ZLIB - Generate Huffman trees for efficient decode | ||
81 | trees.c TREES C ZLIB - Output deflated data using Huffman coding | ||
82 | uncompr.c UNCOMPR C ZLIB - Decompress a memory buffer | ||
83 | zutil.c ZUTIL C ZLIB - Target dependent utility functions | ||
84 | H Original ZLIB C and ILE/RPG include files | ||
85 | crc32.h CRC32 C ZLIB - CRC32 tables | ||
86 | deflate.h DEFLATE C ZLIB - Internal compression state | ||
87 | gzguts.h GZGUTS C ZLIB - Definitions for the gzclose module | ||
88 | inffast.h INFFAST C ZLIB - Header to use inffast.c | ||
89 | inffixed.h INFFIXED C ZLIB - Table for decoding fixed codes | ||
90 | inflate.h INFLATE C ZLIB - Internal inflate state definitions | ||
91 | inftrees.h INFTREES C ZLIB - Header to use inftrees.c | ||
92 | trees.h TREES C ZLIB - Created automatically with -DGEN_TREES_H | ||
93 | zconf.h ZCONF C ZLIB - Compression library configuration | ||
94 | zlib.h ZLIB C ZLIB - Compression library C user interface | ||
95 | as400/zlib.inc ZLIB.INC RPGLE ZLIB - Compression library ILE RPG user interface | ||
96 | zutil.h ZUTIL C ZLIB - Internal interface and configuration | ||
97 | TOOLS Building source software & AS/400 README | ||
98 | as400/bndsrc BNDSRC Entry point exportation list | ||
99 | as400/compile.clp COMPILE CLP Compile sources & generate service program | ||
100 | as400/readme.txt README TXT Installation instructions | ||
101 | |||
102 | 4) Continue as in I)3). | ||
103 | |||
104 | |||
105 | |||
106 | |||
107 | Notes: For AS400 ILE RPG programmers, a /copy member defining the ZLIB | ||
108 | API prototypes for ILE RPG can be found in ZLIB/H(ZLIB.INC). | ||
109 | Please read comments in this member for more information. | ||
110 | |||
111 | Remember that most foreign textual data are ASCII coded: this | ||
112 | implementation does not handle conversion from/to ASCII, so | ||
113 | text data code conversions must be done explicitely. | ||
114 | |||
115 | Mainly for the reason above, always open zipped files in binary mode. | ||
diff --git a/as400/zlib.inc b/as400/zlib.inc new file mode 100644 index 0000000..d492ef3 --- /dev/null +++ b/as400/zlib.inc | |||
@@ -0,0 +1,423 @@ | |||
1 | * ZLIB.INC - Interface to the general purpose compression library | ||
2 | * | ||
3 | * ILE RPG400 version by Patrick Monnerat, DATASPHERE. | ||
4 | * Version 1.2.5.1 | ||
5 | * | ||
6 | * | ||
7 | * WARNING: | ||
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)) | ||
15 | * | ||
16 | /if not defined(ZLIB_H_) | ||
17 | /define ZLIB_H_ | ||
18 | * | ||
19 | ************************************************************************** | ||
20 | * Constants | ||
21 | ************************************************************************** | ||
22 | * | ||
23 | * Versioning information. | ||
24 | * | ||
25 | D ZLIB_VERSION C '1.2.5.1' | ||
26 | D ZLIB_VERNUM C X'1251' | ||
27 | D ZLIB_VER_MAJOR C 1 | ||
28 | D ZLIB_VER_MINOR C 2 | ||
29 | D ZLIB_VER_REVISION... | ||
30 | D C 5 | ||
31 | D ZLIB_VER_SUBREVISION... | ||
32 | D C 0 | ||
33 | * | ||
34 | * Other equates. | ||
35 | * | ||
36 | D Z_NO_FLUSH C 0 | ||
37 | D Z_PARTIAL_FLUSH... | ||
38 | D C 1 | ||
39 | D Z_SYNC_FLUSH C 2 | ||
40 | D Z_FULL_FLUSH C 3 | ||
41 | D Z_FINISH C 4 | ||
42 | D Z_BLOCK C 5 | ||
43 | D Z_TREES C 6 | ||
44 | * | ||
45 | D Z_OK C 0 | ||
46 | D Z_STREAM_END C 1 | ||
47 | D Z_NEED_DICT C 2 | ||
48 | D Z_ERRNO C -1 | ||
49 | D Z_STREAM_ERROR C -2 | ||
50 | D Z_DATA_ERROR C -3 | ||
51 | D Z_MEM_ERROR C -4 | ||
52 | D Z_BUF_ERROR C -5 | ||
53 | DZ_VERSION_ERROR C -6 | ||
54 | * | ||
55 | D Z_NO_COMPRESSION... | ||
56 | D C 0 | ||
57 | D Z_BEST_SPEED C 1 | ||
58 | D Z_BEST_COMPRESSION... | ||
59 | D C 9 | ||
60 | D Z_DEFAULT_COMPRESSION... | ||
61 | D C -1 | ||
62 | * | ||
63 | D Z_FILTERED C 1 | ||
64 | D Z_HUFFMAN_ONLY C 2 | ||
65 | D Z_RLE C 3 | ||
66 | D Z_DEFAULT_STRATEGY... | ||
67 | D C 0 | ||
68 | * | ||
69 | D Z_BINARY C 0 | ||
70 | D Z_ASCII C 1 | ||
71 | D Z_UNKNOWN C 2 | ||
72 | * | ||
73 | D Z_DEFLATED C 8 | ||
74 | * | ||
75 | D Z_NULL C 0 | ||
76 | * | ||
77 | ************************************************************************** | ||
78 | * Types | ||
79 | ************************************************************************** | ||
80 | * | ||
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 | ||
85 | * | ||
86 | ************************************************************************** | ||
87 | * Structures | ||
88 | ************************************************************************** | ||
89 | * | ||
90 | * The GZIP encode/decode stream support structure. | ||
91 | * | ||
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 | ||
106 | D 10U 0 Reserved | ||
107 | D 10U 0 Ptr. alignment | ||
108 | * | ||
109 | ************************************************************************** | ||
110 | * Utility function prototypes | ||
111 | ************************************************************************** | ||
112 | * | ||
113 | D compress PR 10I 0 extproc('compress') | ||
114 | D dest 32767 options(*varsize) Destination buffer | ||
115 | D destLen 10U 0 Destination length | ||
116 | D source 32767 const options(*varsize) Source buffer | ||
117 | D sourceLen 10u 0 value Source length | ||
118 | * | ||
119 | D compress2 PR 10I 0 extproc('compress2') | ||
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 | ||
124 | D level 10I 0 value Compression level | ||
125 | * | ||
126 | D compressBound PR 10U 0 extproc('compressBound') | ||
127 | D sourceLen 10U 0 value | ||
128 | * | ||
129 | D uncompress PR 10I 0 extproc('uncompress') | ||
130 | D dest 32767 options(*varsize) Destination buffer | ||
131 | D destLen 10U 0 Destination length | ||
132 | D source 32767 const options(*varsize) Source buffer | ||
133 | D sourceLen 10U 0 value Source length | ||
134 | * | ||
135 | /if not defined(LARGE_FILES) | ||
136 | D gzopen PR extproc('gzopen') | ||
137 | D like(gzFile) | ||
138 | D path * value options(*string) File pathname | ||
139 | D mode * value options(*string) Open mode | ||
140 | /else | ||
141 | D gzopen PR extproc('gzopen64') | ||
142 | D like(gzFile) | ||
143 | D path * value options(*string) File pathname | ||
144 | D mode * value options(*string) Open mode | ||
145 | * | ||
146 | D gzopen64 PR extproc('gzopen64') | ||
147 | D like(gzFile) | ||
148 | D path * value options(*string) File pathname | ||
149 | D mode * value options(*string) Open mode | ||
150 | /endif | ||
151 | * | ||
152 | D gzdopen PR extproc('gzdopen') | ||
153 | D like(gzFile) | ||
154 | D fd 10I 0 value File descriptor | ||
155 | D mode * value options(*string) Open mode | ||
156 | * | ||
157 | D gzbuffer PR 10I 0 extproc('gzbuffer') | ||
158 | D file value like(gzFile) File pointer | ||
159 | D size 10U 0 value | ||
160 | * | ||
161 | D gzsetparams PR 10I 0 extproc('gzsetparams') | ||
162 | D file value like(gzFile) File pointer | ||
163 | D level 10I 0 value | ||
164 | D strategy 10I 0 value | ||
165 | * | ||
166 | D gzread PR 10I 0 extproc('gzread') | ||
167 | D file value like(gzFile) File pointer | ||
168 | D buf 32767 options(*varsize) Buffer | ||
169 | D len 10u 0 value Buffer length | ||
170 | * | ||
171 | D gzwrite PR 10I 0 extproc('gzwrite') | ||
172 | D file value like(gzFile) File pointer | ||
173 | D buf 32767 const options(*varsize) Buffer | ||
174 | D len 10u 0 value Buffer length | ||
175 | * | ||
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 | ||
179 | * | ||
180 | D gzgets PR * extproc('gzgets') | ||
181 | D file value like(gzFile) File pointer | ||
182 | D buf 32767 options(*varsize) Read buffer | ||
183 | D len 10i 0 value Buffer length | ||
184 | * | ||
185 | D gzflush PR 10i 0 extproc('gzflush') | ||
186 | D file value like(gzFile) File pointer | ||
187 | D flush 10I 0 value Type of flush | ||
188 | * | ||
189 | /if not defined(LARGE_FILES) | ||
190 | D gzseek PR extproc('gzseek') | ||
191 | D like(z_off_t) | ||
192 | D file value like(gzFile) File pointer | ||
193 | D offset value like(z_off_t) Offset | ||
194 | D whence 10i 0 value Origin | ||
195 | /else | ||
196 | D gzseek PR extproc('gzseek64') | ||
197 | D like(z_off_t) | ||
198 | D file value like(gzFile) File pointer | ||
199 | D offset value like(z_off_t) Offset | ||
200 | D whence 10i 0 value Origin | ||
201 | * | ||
202 | D gzseek64 PR extproc('gzseek64') | ||
203 | D like(z_off64_t) | ||
204 | D file value like(gzFile) File pointer | ||
205 | D offset value like(z_off64_t) Offset | ||
206 | D whence 10i 0 value Origin | ||
207 | /endif | ||
208 | * | ||
209 | D gzrewind PR 10i 0 extproc('gzrewind') | ||
210 | D file value like(gzFile) File pointer | ||
211 | * | ||
212 | /if not defined(LARGE_FILES) | ||
213 | D gztell PR extproc('gztell') | ||
214 | D like(z_off_t) | ||
215 | D file value like(gzFile) File pointer | ||
216 | /else | ||
217 | D gztell PR extproc('gztell64') | ||
218 | D like(z_off_t) | ||
219 | D file value like(gzFile) File pointer | ||
220 | * | ||
221 | D gztell64 PR extproc('gztell64') | ||
222 | D like(z_off64_t) | ||
223 | D file value like(gzFile) File pointer | ||
224 | /endif | ||
225 | * | ||
226 | /if not defined(LARGE_FILES) | ||
227 | D gzoffset PR extproc('gzoffset') | ||
228 | D like(z_off_t) | ||
229 | D file value like(gzFile) File pointer | ||
230 | /else | ||
231 | D gzoffset PR extproc('gzoffset64') | ||
232 | D like(z_off_t) | ||
233 | D file value like(gzFile) File pointer | ||
234 | * | ||
235 | D gzoffset64 PR extproc('gzoffset64') | ||
236 | D like(z_off64_t) | ||
237 | D file value like(gzFile) File pointer | ||
238 | /endif | ||
239 | * | ||
240 | D gzeof PR 10i 0 extproc('gzeof') | ||
241 | D file value like(gzFile) File pointer | ||
242 | * | ||
243 | D gzclose_r PR 10i 0 extproc('gzclose_r') | ||
244 | D file value like(gzFile) File pointer | ||
245 | * | ||
246 | D gzclose_w PR 10i 0 extproc('gzclose_w') | ||
247 | D file value like(gzFile) File pointer | ||
248 | * | ||
249 | D gzclose PR 10i 0 extproc('gzclose') | ||
250 | D file value like(gzFile) File pointer | ||
251 | * | ||
252 | D gzerror PR * extproc('gzerror') Error string | ||
253 | D file value like(gzFile) File pointer | ||
254 | D errnum 10I 0 Error code | ||
255 | * | ||
256 | D gzclearerr PR extproc('gzclearerr') | ||
257 | D file value like(gzFile) File pointer | ||
258 | * | ||
259 | ************************************************************************** | ||
260 | * Basic function prototypes | ||
261 | ************************************************************************** | ||
262 | * | ||
263 | D zlibVersion PR * extproc('zlibVersion') Version string | ||
264 | * | ||
265 | D deflateInit PR 10I 0 extproc('deflateInit_') Init. compression | ||
266 | D strm like(z_stream) Compression stream | ||
267 | D level 10I 0 value Compression level | ||
268 | D version * value options(*string) Version string | ||
269 | D stream_size 10i 0 value Stream struct. size | ||
270 | * | ||
271 | D deflate PR 10I 0 extproc('deflate') Compress data | ||
272 | D strm like(z_stream) Compression stream | ||
273 | D flush 10I 0 value Flush type required | ||
274 | * | ||
275 | D deflateEnd PR 10I 0 extproc('deflateEnd') Termin. compression | ||
276 | D strm like(z_stream) Compression stream | ||
277 | * | ||
278 | D inflateInit PR 10I 0 extproc('inflateInit_') Init. expansion | ||
279 | D strm like(z_stream) Expansion stream | ||
280 | D version * value options(*string) Version string | ||
281 | D stream_size 10i 0 value Stream struct. size | ||
282 | * | ||
283 | D inflate PR 10I 0 extproc('inflate') Expand data | ||
284 | D strm like(z_stream) Expansion stream | ||
285 | D flush 10I 0 value Flush type required | ||
286 | * | ||
287 | D inflateEnd PR 10I 0 extproc('inflateEnd') Termin. expansion | ||
288 | D strm like(z_stream) Expansion stream | ||
289 | * | ||
290 | ************************************************************************** | ||
291 | * Advanced function prototypes | ||
292 | ************************************************************************** | ||
293 | * | ||
294 | D deflateInit2 PR 10I 0 extproc('deflateInit2_') Init. compression | ||
295 | D strm like(z_stream) Compression stream | ||
296 | D level 10I 0 value Compression level | ||
297 | D method 10I 0 value Compression method | ||
298 | D windowBits 10I 0 value log2(window size) | ||
299 | D memLevel 10I 0 value Mem/cmpress tradeoff | ||
300 | D strategy 10I 0 value Compression stategy | ||
301 | D version * value options(*string) Version string | ||
302 | D stream_size 10i 0 value Stream struct. size | ||
303 | * | ||
304 | D deflateSetDictionary... | ||
305 | D PR 10I 0 extproc('deflateSetDictionary') Init. dictionary | ||
306 | D strm like(z_stream) Compression stream | ||
307 | D dictionary 32767 const options(*varsize) Dictionary bytes | ||
308 | D dictLength 10U 0 value Dictionary length | ||
309 | * | ||
310 | D deflateCopy PR 10I 0 extproc('deflateCopy') Compress strm 2 strm | ||
311 | D dest like(z_stream) Destination stream | ||
312 | D source like(z_stream) Source stream | ||
313 | * | ||
314 | D deflateReset PR 10I 0 extproc('deflateReset') End and init. stream | ||
315 | D strm like(z_stream) Compression stream | ||
316 | * | ||
317 | D deflateParams PR 10I 0 extproc('deflateParams') Change level & strat | ||
318 | D strm like(z_stream) Compression stream | ||
319 | D level 10I 0 value Compression level | ||
320 | D strategy 10I 0 value Compression stategy | ||
321 | * | ||
322 | D deflateBound PR 10U 0 extproc('deflateBound') Change level & strat | ||
323 | D strm like(z_stream) Compression stream | ||
324 | D sourcelen 10U 0 value Compression level | ||
325 | * | ||
326 | D deflatePending PR 10I 0 extproc('deflatePending') Change level & strat | ||
327 | D strm like(z_stream) Compression stream | ||
328 | D pending 10U 0 Pending bytes | ||
329 | D bits 10I 0 Pending bits | ||
330 | * | ||
331 | D deflatePrime PR 10I 0 extproc('deflatePrime') Change level & strat | ||
332 | D strm like(z_stream) Compression stream | ||
333 | D bits 10I 0 value Number of bits to insert | ||
334 | D value 10I 0 value Bits to insert | ||
335 | * | ||
336 | D inflateInit2 PR 10I 0 extproc('inflateInit2_') Init. expansion | ||
337 | D strm like(z_stream) Expansion stream | ||
338 | D windowBits 10I 0 value log2(window size) | ||
339 | D version * value options(*string) Version string | ||
340 | D stream_size 10i 0 value Stream struct. size | ||
341 | * | ||
342 | D inflateSetDictionary... | ||
343 | D PR 10I 0 extproc('inflateSetDictionary') Init. dictionary | ||
344 | D strm like(z_stream) Expansion stream | ||
345 | D dictionary 32767 const options(*varsize) Dictionary bytes | ||
346 | D dictLength 10U 0 value Dictionary length | ||
347 | * | ||
348 | D inflateSync PR 10I 0 extproc('inflateSync') Sync. expansion | ||
349 | D strm like(z_stream) Expansion stream | ||
350 | * | ||
351 | D inflateCopy PR 10I 0 extproc('inflateCopy') | ||
352 | D dest like(z_stream) Destination stream | ||
353 | D source like(z_stream) Source stream | ||
354 | * | ||
355 | D inflateReset PR 10I 0 extproc('inflateReset') End and init. stream | ||
356 | D strm like(z_stream) Expansion stream | ||
357 | * | ||
358 | D inflateReset2 PR 10I 0 extproc('inflateReset2') End and init. stream | ||
359 | D strm like(z_stream) Expansion stream | ||
360 | D windowBits 10I 0 value Log2(buffer size) | ||
361 | * | ||
362 | D inflatePrime PR 10I 0 extproc('inflatePrime') Insert bits | ||
363 | D strm like(z_stream) Expansion stream | ||
364 | D bits 10I 0 value Bit count | ||
365 | D value 10I 0 value Bits to insert | ||
366 | * | ||
367 | D inflateMark PR 10I 0 extproc('inflateMark') Get inflate info | ||
368 | D strm like(z_stream) Expansion stream | ||
369 | * | ||
370 | D inflateBackInit... | ||
371 | D PR 10I 0 extproc('inflateBackInit_') | ||
372 | D strm like(z_stream) Expansion stream | ||
373 | D windowBits 10I 0 value Log2(buffer size) | ||
374 | D window 32767 options(*varsize) Buffer | ||
375 | D version * value options(*string) Version string | ||
376 | D stream_size 10i 0 value Stream struct. size | ||
377 | * | ||
378 | D inflateBack PR 10I 0 extproc('inflateBack') | ||
379 | D strm like(z_stream) Expansion stream | ||
380 | D in * value procptr Input function | ||
381 | D in_desc * value Input descriptor | ||
382 | D out * value procptr Output function | ||
383 | D out_desc * value Output descriptor | ||
384 | * | ||
385 | D inflateBackEnd PR 10I 0 extproc('inflateBackEnd') | ||
386 | D strm like(z_stream) Expansion stream | ||
387 | * | ||
388 | D zlibCompileFlags... | ||
389 | D PR 10U 0 extproc('zlibCompileFlags') | ||
390 | * | ||
391 | ************************************************************************** | ||
392 | * Checksum function prototypes | ||
393 | ************************************************************************** | ||
394 | * | ||
395 | D adler32 PR 10U 0 extproc('adler32') New checksum | ||
396 | D adler 10U 0 value Old checksum | ||
397 | D buf 32767 const options(*varsize) Bytes to accumulate | ||
398 | D len 10U 0 value Buffer length | ||
399 | * | ||
400 | D crc32 PR 10U 0 extproc('crc32') New checksum | ||
401 | D crc 10U 0 value Old checksum | ||
402 | D buf 32767 const options(*varsize) Bytes to accumulate | ||
403 | D len 10U 0 value Buffer length | ||
404 | * | ||
405 | ************************************************************************** | ||
406 | * Miscellaneous function prototypes | ||
407 | ************************************************************************** | ||
408 | * | ||
409 | D zError PR * extproc('zError') Error string | ||
410 | D err 10I 0 value Error code | ||
411 | * | ||
412 | D inflateSyncPoint... | ||
413 | D PR 10I 0 extproc('inflateSyncPoint') | ||
414 | D strm like(z_stream) Expansion stream | ||
415 | * | ||
416 | D get_crc_table PR * extproc('get_crc_table') Ptr to ulongs | ||
417 | * | ||
418 | D inflateUndermine... | ||
419 | D PR 10I 0 extproc('inflateUndermine') | ||
420 | D strm like(z_stream) Expansion stream | ||
421 | D arg 10I 0 value Error code | ||
422 | * | ||
423 | /endif | ||