aboutsummaryrefslogtreecommitdiff
path: root/os400
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2016-12-30 19:48:07 -0800
committerMark Adler <madler@alumni.caltech.edu>2016-12-30 20:00:57 -0800
commitd46546544a1ec20671c7e5a9135ad7c6e83bb927 (patch)
tree1a53b5523d77adb3e27a5bb3f09afe9f4e448b9a /os400
parentf12d3dc367e51bcefba80217c645fa5de05e699c (diff)
downloadzlib-d46546544a1ec20671c7e5a9135ad7c6e83bb927.tar.gz
zlib-d46546544a1ec20671c7e5a9135ad7c6e83bb927.tar.bz2
zlib-d46546544a1ec20671c7e5a9135ad7c6e83bb927.zip
Replace as400 with os400 for OS/400 support (Monnerat).
Diffstat (limited to 'os400')
-rw-r--r--os400/README40048
-rw-r--r--os400/bndsrc100
-rw-r--r--os400/make.sh366
-rw-r--r--os400/zlib.inc451
4 files changed, 965 insertions, 0 deletions
diff --git a/os400/README400 b/os400/README400
new file mode 100644
index 0000000..601f1ae
--- /dev/null
+++ b/os400/README400
@@ -0,0 +1,48 @@
1 ZLIB version 1.2.8 for OS/400 installation instructions
2
31) Download and unpack the zlib tarball to some IFS directory.
4 (i.e.: /path/to/the/zlib/ifs/source/directory)
5
6 If the installed IFS command suppors gzip format, this is straightforward,
7else you have to unpack first to some directory on a system supporting it,
8then move the whole directory to the IFS via the network (via SMB or FTP).
9
102) Edit the configuration parameters in the compilation script.
11
12 EDTF STMF('/path/to/the/zlib/ifs/source/directory/os400/make.sh')
13
14Tune the parameters according to your needs if not matching the defaults.
15Save the file and exit after edition.
16
173) Enter qshell, then work in the zlib OS/400 specific directory.
18
19 QSH
20 cd /path/to/the/zlib/ifs/source/directory/os400
21
224) Compile and install
23
24 sh make.sh
25
26The script will:
27- create the libraries, objects and IFS directories for the zlib environment,
28- compile all modules,
29- create a service program,
30- create a static and a dynamic binding directory,
31- install header files for C/C++ and for ILE/RPG, both for compilation in
32 DB2 and IFS environments.
33
34That's all.
35
36
37Notes: For OS/400 ILE RPG programmers, a /copy member defining the ZLIB
38 API prototypes for ILE RPG can be found in ZLIB/H(ZLIB.INC).
39 In the ILE environment, the same definitions are available from
40 file zlib.inc located in the same IFS include directory as the
41 C/C++ header files.
42 Please read comments in this member for more information.
43
44 Remember that most foreign textual data are ASCII coded: this
45 implementation does not handle conversion from/to ASCII, so
46 text data code conversions must be done explicitely.
47
48 Mainly for the reason above, always open zipped files in binary mode.
diff --git a/os400/bndsrc b/os400/bndsrc
new file mode 100644
index 0000000..934d781
--- /dev/null
+++ b/os400/bndsrc
@@ -0,0 +1,100 @@
1STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB')
2
3/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
4/* Version 1.1.3 entry points. */
5/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
6
7 EXPORT SYMBOL("adler32")
8 EXPORT SYMBOL("compress")
9 EXPORT SYMBOL("compress2")
10 EXPORT SYMBOL("crc32")
11 EXPORT SYMBOL("get_crc_table")
12 EXPORT SYMBOL("deflate")
13 EXPORT SYMBOL("deflateEnd")
14 EXPORT SYMBOL("deflateSetDictionary")
15 EXPORT SYMBOL("deflateCopy")
16 EXPORT SYMBOL("deflateReset")
17 EXPORT SYMBOL("deflateParams")
18 EXPORT SYMBOL("deflatePrime")
19 EXPORT SYMBOL("deflateInit_")
20 EXPORT SYMBOL("deflateInit2_")
21 EXPORT SYMBOL("gzopen")
22 EXPORT SYMBOL("gzdopen")
23 EXPORT SYMBOL("gzsetparams")
24 EXPORT SYMBOL("gzread")
25 EXPORT SYMBOL("gzwrite")
26 EXPORT SYMBOL("gzprintf")
27 EXPORT SYMBOL("gzputs")
28 EXPORT SYMBOL("gzgets")
29 EXPORT SYMBOL("gzputc")
30 EXPORT SYMBOL("gzgetc")
31 EXPORT SYMBOL("gzflush")
32 EXPORT SYMBOL("gzseek")
33 EXPORT SYMBOL("gzrewind")
34 EXPORT SYMBOL("gztell")
35 EXPORT SYMBOL("gzeof")
36 EXPORT SYMBOL("gzclose")
37 EXPORT SYMBOL("gzerror")
38 EXPORT SYMBOL("inflate")
39 EXPORT SYMBOL("inflateEnd")
40 EXPORT SYMBOL("inflateSetDictionary")
41 EXPORT SYMBOL("inflateSync")
42 EXPORT SYMBOL("inflateReset")
43 EXPORT SYMBOL("inflateInit_")
44 EXPORT SYMBOL("inflateInit2_")
45 EXPORT SYMBOL("inflateSyncPoint")
46 EXPORT SYMBOL("uncompress")
47 EXPORT SYMBOL("zlibVersion")
48 EXPORT SYMBOL("zError")
49
50/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
51/* Version 1.2.1 additional entry points. */
52/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
53
54 EXPORT SYMBOL("compressBound")
55 EXPORT SYMBOL("deflateBound")
56 EXPORT SYMBOL("gzungetc")
57 EXPORT SYMBOL("gzclearerr")
58 EXPORT SYMBOL("inflateBack")
59 EXPORT SYMBOL("inflateBackEnd")
60 EXPORT SYMBOL("inflateBackInit_")
61 EXPORT SYMBOL("inflateCopy")
62 EXPORT SYMBOL("zlibCompileFlags")
63
64/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
65/* Version 1.2.5 additional entry points. */
66/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
67
68 EXPORT SYMBOL("adler32_combine")
69 EXPORT SYMBOL("adler32_combine64")
70 EXPORT SYMBOL("crc32_combine")
71 EXPORT SYMBOL("crc32_combine64")
72 EXPORT SYMBOL("gzbuffer")
73 EXPORT SYMBOL("gzoffset")
74 EXPORT SYMBOL("gzoffset64")
75 EXPORT SYMBOL("gzopen64")
76 EXPORT SYMBOL("gzseek64")
77 EXPORT SYMBOL("gztell64")
78 EXPORT SYMBOL("gzclose_r")
79 EXPORT SYMBOL("gzclose_w")
80 EXPORT SYMBOL("inflateMark")
81 EXPORT SYMBOL("inflatePrime")
82 EXPORT SYMBOL("inflateReset2")
83 EXPORT SYMBOL("inflateUndermine")
84
85/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
86/* Version 1.2.6 additional entry points. */
87/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
88
89 EXPORT SYMBOL("deflateResetKeep")
90 EXPORT SYMBOL("deflatePending")
91 EXPORT SYMBOL("gzgetc_")
92 EXPORT SYMBOL("inflateResetKeep")
93
94/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
95/* Version 1.2.8 additional entry points. */
96/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
97
98 EXPORT SYMBOL("inflateGetDictionary")
99
100ENDPGMEXP
diff --git a/os400/make.sh b/os400/make.sh
new file mode 100644
index 0000000..ddbfb16
--- /dev/null
+++ b/os400/make.sh
@@ -0,0 +1,366 @@
1#!/bin/sh
2#
3# ZLIB compilation script for the OS/400.
4#
5#
6# This is a shell script since make is not a standard component of OS/400.
7
8
9################################################################################
10#
11# Tunable configuration parameters.
12#
13################################################################################
14
15TARGETLIB='ZLIB' # Target OS/400 program library
16STATBNDDIR='ZLIB_A' # Static binding directory.
17DYNBNDDIR='ZLIB' # Dynamic binding directory.
18SRVPGM="ZLIB" # Service program.
19IFSDIR='/zlib' # IFS support base directory.
20TGTCCSID='500' # Target CCSID of objects
21DEBUG='*NONE' # Debug level
22OPTIMIZE='40' # Optimisation level
23OUTPUT='*NONE' # Compilation output option.
24TGTRLS='V6R1M0' # Target OS release
25
26export TARGETLIB STATBNDDIR DYNBNDDIR SRVPGM IFSDIR
27export TGTCCSID DEBUG OPTIMIZE OUTPUT TGTRLS
28
29
30################################################################################
31#
32# OS/400 specific definitions.
33#
34################################################################################
35
36LIBIFSNAME="/QSYS.LIB/${TARGETLIB}.LIB"
37
38
39################################################################################
40#
41# Procedures.
42#
43################################################################################
44
45# action_needed dest [src]
46#
47# dest is an object to build
48# if specified, src is an object on which dest depends.
49#
50# exit 0 (succeeds) if some action has to be taken, else 1.
51
52action_needed()
53
54{
55 [ ! -e "${1}" ] && return 0
56 [ "${2}" ] || return 1
57 [ "${1}" -ot "${2}" ] && return 0
58 return 1
59}
60
61
62# make_module module_name source_name [additional_definitions]
63#
64# Compile source name into module if needed.
65# As side effect, append the module name to variable MODULES.
66# Set LINK to "YES" if the module has been compiled.
67
68make_module()
69
70{
71 MODULES="${MODULES} ${1}"
72 MODIFSNAME="${LIBIFSNAME}/${1}.MODULE"
73 CSRC="`basename \"${2}\"`"
74
75 if action_needed "${MODIFSNAME}" "${2}"
76 then :
77 elif [ ! "`sed -e \"/<source name=\\\"${CSRC}\\\">/,/<\\\\/source>/!d\" \
78 -e '/<depend /!d' \
79 -e 's/.* name=\"\\([^\"]*\\)\".*/\\1/' < \"${TOPDIR}/treebuild.xml\" |
80 while read HDR
81 do if action_needed \"${MODIFSNAME}\" \"${IFSDIR}/include/${HDR}\"
82 then echo recompile
83 break
84 fi
85 done`" ]
86 then return 0
87 fi
88
89 CMD="CRTCMOD MODULE(${TARGETLIB}/${1}) SRCSTMF('${2}')"
90 CMD="${CMD} SYSIFCOPT(*IFS64IO) OPTION(*INCDIRFIRST)"
91 CMD="${CMD} LOCALETYPE(*LOCALE) FLAG(10)"
92 CMD="${CMD} INCDIR('${IFSDIR}/include' ${INCLUDES})"
93 CMD="${CMD} TGTCCSID(${TGTCCSID}) TGTRLS(${TGTRLS})"
94 CMD="${CMD} OUTPUT(${OUTPUT})"
95 CMD="${CMD} OPTIMIZE(${OPTIMIZE})"
96 CMD="${CMD} DBGVIEW(${DEBUG})"
97 system "${CMD}"
98 LINK=YES
99}
100
101
102# Determine DB2 object name from IFS name.
103
104db2_name()
105
106{
107 basename "${1}" |
108 tr 'a-z-' 'A-Z_' |
109 sed -e 's/\..*//' \
110 -e 's/^\(.\).*\(.........\)$/\1\2/'
111}
112
113
114# Force enumeration types to be the same size as integers.
115
116copy_hfile()
117
118{
119 sed -e '1i\
120#pragma enum(int)\
121' "${@}" -e '$a\
122#pragma enum(pop)\
123'
124}
125
126
127################################################################################
128#
129# Script initialization.
130#
131################################################################################
132
133SCRIPTDIR=`dirname "${0}"`
134
135case "${SCRIPTDIR}" in
136/*) ;;
137*) SCRIPTDIR="`pwd`/${SCRIPTDIR}"
138esac
139
140while true
141do case "${SCRIPTDIR}" in
142 */.) SCRIPTDIR="${SCRIPTDIR%/.}";;
143 *) break;;
144 esac
145done
146
147# The script directory is supposed to be in ${TOPDIR}/os400.
148
149TOPDIR=`dirname "${SCRIPTDIR}"`
150export SCRIPTDIR TOPDIR
151cd "${TOPDIR}"
152
153
154# Extract the version from the master compilation XML file.
155
156VERSION=`sed -e '/^<package /!d' \
157 -e 's/^.* version="\([0-9.]*\)".*$/\1/' -e 'q' \
158 < treebuild.xml`
159export VERSION
160
161################################################################################
162
163
164# Create the OS/400 library if it does not exist.
165
166if action_needed "${LIBIFSNAME}"
167then CMD="CRTLIB LIB(${TARGETLIB}) TEXT('ZLIB: Data compression API')"
168 system "${CMD}"
169fi
170
171
172# Create the DOCS source file if it does not exist.
173
174if action_needed "${LIBIFSNAME}/DOCS.FILE"
175then CMD="CRTSRCPF FILE(${TARGETLIB}/DOCS) RCDLEN(112)"
176 CMD="${CMD} CCSID(${TGTCCSID}) TEXT('Documentation texts')"
177 system "${CMD}"
178fi
179
180# Copy some documentation files if needed.
181
182for TEXT in "${TOPDIR}/ChangeLog" "${TOPDIR}/FAQ" \
183 "${TOPDIR}/README" "${SCRIPTDIR}/README400"
184do MEMBER="${LIBIFSNAME}/DOCS.FILE/`db2_name \"${TEXT}\"`.MBR"
185
186 if action_needed "${MEMBER}" "${TEXT}"
187 then CMD="CPY OBJ('${TEXT}') TOOBJ('${MEMBER}') TOCCSID(${TGTCCSID})"
188 CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)"
189 system "${CMD}"
190 fi
191done
192
193
194# Create the OS/400 source program file for the C header files.
195
196SRCPF="${LIBIFSNAME}/H.FILE"
197
198if action_needed "${SRCPF}"
199then CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)"
200 CMD="${CMD} CCSID(${TGTCCSID}) TEXT('ZLIB: C/C++ header files')"
201 system "${CMD}"
202fi
203
204
205# Create the IFS directory for the C header files.
206
207if action_needed "${IFSDIR}/include"
208then mkdir -p "${IFSDIR}/include"
209fi
210
211# Copy the header files to DB2 library. Link from IFS include directory.
212
213for HFILE in "${TOPDIR}/"*.h
214do DEST="${SRCPF}/`db2_name \"${HFILE}\"`.MBR"
215
216 if action_needed "${DEST}" "${HFILE}"
217 then copy_hfile < "${HFILE}" > tmphdrfile
218
219 # Need to translate to target CCSID.
220
221 CMD="CPY OBJ('`pwd`/tmphdrfile') TOOBJ('${DEST}')"
222 CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
223 system "${CMD}"
224 # touch -r "${HFILE}" "${DEST}"
225 rm -f tmphdrfile
226 fi
227
228 IFSFILE="${IFSDIR}/include/`basename \"${HFILE}\"`"
229
230 if action_needed "${IFSFILE}" "${DEST}"
231 then rm -f "${IFSFILE}"
232 ln -s "${DEST}" "${IFSFILE}"
233 fi
234done
235
236
237# Install the ILE/RPG header file.
238
239
240HFILE="${SCRIPTDIR}/zlib.inc"
241DEST="${SRCPF}/ZLIB.INC.MBR"
242
243if action_needed "${DEST}" "${HFILE}"
244then CMD="CPY OBJ('${HFILE}') TOOBJ('${DEST}')"
245 CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
246 system "${CMD}"
247 # touch -r "${HFILE}" "${DEST}"
248fi
249
250IFSFILE="${IFSDIR}/include/`basename \"${HFILE}\"`"
251
252if action_needed "${IFSFILE}" "${DEST}"
253then rm -f "${IFSFILE}"
254 ln -s "${DEST}" "${IFSFILE}"
255fi
256
257
258# Create and compile the identification source file.
259
260echo '#pragma comment(user, "ZLIB version '"${VERSION}"'")' > os400.c
261echo '#pragma comment(user, __DATE__)' >> os400.c
262echo '#pragma comment(user, __TIME__)' >> os400.c
263echo '#pragma comment(copyright, "Copyright (C) 1995-2016 Jean-Loup Gailly, Mark Adler. OS/400 version by P. Monnerat.")' >> os400.c
264make_module OS400 os400.c
265LINK= # No need to rebuild service program yet.
266MODULES=
267
268
269# Get source list.
270
271CSOURCES=`sed -e '/<source name="/!d' \
272 -e 's/.* name="\([^"]*\)".*/\1/' < treebuild.xml`
273
274# Compile the sources into modules.
275
276for SRC in ${CSOURCES}
277do MODULE=`db2_name "${SRC}"`
278 make_module "${MODULE}" "${SRC}"
279done
280
281
282# If needed, (re)create the static binding directory.
283
284if action_needed "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
285then LINK=YES
286fi
287
288if [ "${LINK}" ]
289then rm -rf "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
290 CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${STATBNDDIR})"
291 CMD="${CMD} TEXT('ZLIB static binding directory')"
292 system "${CMD}"
293
294 for MODULE in ${MODULES}
295 do CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${STATBNDDIR})"
296 CMD="${CMD} OBJ((${TARGETLIB}/${MODULE} *MODULE))"
297 system "${CMD}"
298 done
299fi
300
301
302# The exportation file for service program creation must be in a DB2
303# source file, so make sure it exists.
304
305if action_needed "${LIBIFSNAME}/TOOLS.FILE"
306then CMD="CRTSRCPF FILE(${TARGETLIB}/TOOLS) RCDLEN(112)"
307 CMD="${CMD} CCSID(${TGTCCSID}) TEXT('ZLIB: build tools')"
308 system "${CMD}"
309fi
310
311
312DEST="${LIBIFSNAME}/TOOLS.FILE/BNDSRC.MBR"
313
314if action_needed "${SCRIPTDIR}/bndsrc" "${DEST}"
315then CMD="CPY OBJ('${SCRIPTDIR}/bndsrc') TOOBJ('${DEST}')"
316 CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
317 system "${CMD}"
318 # touch -r "${SCRIPTDIR}/bndsrc" "${DEST}"
319 LINK=YES
320fi
321
322
323# Build the service program if needed.
324
325if action_needed "${LIBIFSNAME}/${SRVPGM}.SRVPGM"
326then LINK=YES
327fi
328
329if [ "${LINK}" ]
330then CMD="CRTSRVPGM SRVPGM(${TARGETLIB}/${SRVPGM})"
331 CMD="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(BNDSRC)"
332 CMD="${CMD} MODULE(${TARGETLIB}/OS400)"
333 CMD="${CMD} BNDDIR(${TARGETLIB}/${STATBNDDIR})"
334 CMD="${CMD} TEXT('ZLIB ${VERSION} dynamic library')"
335 CMD="${CMD} TGTRLS(${TGTRLS})"
336 system "${CMD}"
337 LINK=YES
338
339 # Duplicate the service program for a versioned backup.
340
341 BACKUP=`echo "${SRVPGM}${VERSION}" |
342 sed -e 's/.*\(..........\)$/\1/' -e 's/\./_/g'`
343 BACKUP="`db2_name \"${BACKUP}\"`"
344 BKUPIFSNAME="${LIBIFSNAME}/${BACKUP}.SRVPGM"
345 rm -f "${BKUPIFSNAME}"
346 CMD="CRTDUPOBJ OBJ(${SRVPGM}) FROMLIB(${TARGETLIB})"
347 CMD="${CMD} OBJTYPE(*SRVPGM) NEWOBJ(${BACKUP})"
348 system "${CMD}"
349fi
350
351
352# If needed, (re)create the dynamic binding directory.
353
354if action_needed "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
355then LINK=YES
356fi
357
358if [ "${LINK}" ]
359then rm -rf "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
360 CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
361 CMD="${CMD} TEXT('ZLIB dynamic binding directory')"
362 system "${CMD}"
363 CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
364 CMD="${CMD} OBJ((*LIBL/${SRVPGM} *SRVPGM))"
365 system "${CMD}"
366fi
diff --git a/os400/zlib.inc b/os400/zlib.inc
new file mode 100644
index 0000000..7341a6d
--- /dev/null
+++ b/os400/zlib.inc
@@ -0,0 +1,451 @@
1 * ZLIB.INC - Interface to the general purpose compression library
2 *
3 * ILE RPG400 version by Patrick Monnerat, DATASPHERE.
4 * Version 1.2.8
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.8'
26 D ZLIB_VERNUM C X'1280'
27 D ZLIB_VER_MAJOR C 1
28 D ZLIB_VER_MINOR C 2
29 D ZLIB_VER_REVISION...
30 D C 8
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 65535 options(*varsize) Destination buffer
115 D destLen 10U 0 Destination length
116 D source 65535 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 65535 options(*varsize) Destination buffer
121 D destLen 10U 0 Destination length
122 D source 65535 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 65535 options(*varsize) Destination buffer
131 D destLen 10U 0 Destination length
132 D source 65535 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 65535 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 65535 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 65535 options(*varsize) Read buffer
183 D len 10i 0 value Buffer length
184 *
185 D gzputc PR 10i 0 extproc('gzputc')
186 D file value like(gzFile) File pointer
187 D c 10I 0 value Character to write
188 *
189 D gzgetc PR 10i 0 extproc('gzgetc')
190 D file value like(gzFile) File pointer
191 *
192 D gzgetc_ PR 10i 0 extproc('gzgetc_')
193 D file value like(gzFile) File pointer
194 *
195 D gzungetc PR 10i 0 extproc('gzungetc')
196 D c 10I 0 value Character to push
197 D file value like(gzFile) File pointer
198 *
199 D gzflush PR 10i 0 extproc('gzflush')
200 D file value like(gzFile) File pointer
201 D flush 10I 0 value Type of flush
202 *
203 /if not defined(LARGE_FILES)
204 D gzseek PR extproc('gzseek')
205 D like(z_off_t)
206 D file value like(gzFile) File pointer
207 D offset value like(z_off_t) Offset
208 D whence 10i 0 value Origin
209 /else
210 D gzseek PR extproc('gzseek64')
211 D like(z_off_t)
212 D file value like(gzFile) File pointer
213 D offset value like(z_off_t) Offset
214 D whence 10i 0 value Origin
215 *
216 D gzseek64 PR extproc('gzseek64')
217 D like(z_off64_t)
218 D file value like(gzFile) File pointer
219 D offset value like(z_off64_t) Offset
220 D whence 10i 0 value Origin
221 /endif
222 *
223 D gzrewind PR 10i 0 extproc('gzrewind')
224 D file value like(gzFile) File pointer
225 *
226 /if not defined(LARGE_FILES)
227 D gztell PR extproc('gztell')
228 D like(z_off_t)
229 D file value like(gzFile) File pointer
230 /else
231 D gztell PR extproc('gztell64')
232 D like(z_off_t)
233 D file value like(gzFile) File pointer
234 *
235 D gztell64 PR extproc('gztell64')
236 D like(z_off64_t)
237 D file value like(gzFile) File pointer
238 /endif
239 *
240 /if not defined(LARGE_FILES)
241 D gzoffset PR extproc('gzoffset')
242 D like(z_off_t)
243 D file value like(gzFile) File pointer
244 /else
245 D gzoffset PR extproc('gzoffset64')
246 D like(z_off_t)
247 D file value like(gzFile) File pointer
248 *
249 D gzoffset64 PR extproc('gzoffset64')
250 D like(z_off64_t)
251 D file value like(gzFile) File pointer
252 /endif
253 *
254 D gzeof PR 10i 0 extproc('gzeof')
255 D file value like(gzFile) File pointer
256 *
257 D gzclose_r PR 10i 0 extproc('gzclose_r')
258 D file value like(gzFile) File pointer
259 *
260 D gzclose_w PR 10i 0 extproc('gzclose_w')
261 D file value like(gzFile) File pointer
262 *
263 D gzclose PR 10i 0 extproc('gzclose')
264 D file value like(gzFile) File pointer
265 *
266 D gzerror PR * extproc('gzerror') Error string
267 D file value like(gzFile) File pointer
268 D errnum 10I 0 Error code
269 *
270 D gzclearerr PR extproc('gzclearerr')
271 D file value like(gzFile) File pointer
272 *
273 **************************************************************************
274 * Basic function prototypes
275 **************************************************************************
276 *
277 D zlibVersion PR * extproc('zlibVersion') Version string
278 *
279 D deflateInit PR 10I 0 extproc('deflateInit_') Init. compression
280 D strm like(z_stream) Compression stream
281 D level 10I 0 value Compression level
282 D version * value options(*string) Version string
283 D stream_size 10i 0 value Stream struct. size
284 *
285 D deflate PR 10I 0 extproc('deflate') Compress data
286 D strm like(z_stream) Compression stream
287 D flush 10I 0 value Flush type required
288 *
289 D deflateEnd PR 10I 0 extproc('deflateEnd') Termin. compression
290 D strm like(z_stream) Compression stream
291 *
292 D inflateInit PR 10I 0 extproc('inflateInit_') Init. expansion
293 D strm like(z_stream) Expansion stream
294 D version * value options(*string) Version string
295 D stream_size 10i 0 value Stream struct. size
296 *
297 D inflate PR 10I 0 extproc('inflate') Expand data
298 D strm like(z_stream) Expansion stream
299 D flush 10I 0 value Flush type required
300 *
301 D inflateEnd PR 10I 0 extproc('inflateEnd') Termin. expansion
302 D strm like(z_stream) Expansion stream
303 *
304 **************************************************************************
305 * Advanced function prototypes
306 **************************************************************************
307 *
308 D deflateInit2 PR 10I 0 extproc('deflateInit2_') Init. compression
309 D strm like(z_stream) Compression stream
310 D level 10I 0 value Compression level
311 D method 10I 0 value Compression method
312 D windowBits 10I 0 value log2(window size)
313 D memLevel 10I 0 value Mem/cmpress tradeoff
314 D strategy 10I 0 value Compression stategy
315 D version * value options(*string) Version string
316 D stream_size 10i 0 value Stream struct. size
317 *
318 D deflateSetDictionary...
319 D PR 10I 0 extproc('deflateSetDictionary') Init. dictionary
320 D strm like(z_stream) Compression stream
321 D dictionary 65535 const options(*varsize) Dictionary bytes
322 D dictLength 10U 0 value Dictionary length
323 *
324 D deflateCopy PR 10I 0 extproc('deflateCopy') Compress strm 2 strm
325 D dest like(z_stream) Destination stream
326 D source like(z_stream) Source stream
327 *
328 D deflateReset PR 10I 0 extproc('deflateReset') End and init. stream
329 D strm like(z_stream) Compression stream
330 *
331 D deflateParams PR 10I 0 extproc('deflateParams') Change level & strat
332 D strm like(z_stream) Compression stream
333 D level 10I 0 value Compression level
334 D strategy 10I 0 value Compression stategy
335 *
336 D deflateBound PR 10U 0 extproc('deflateBound') Change level & strat
337 D strm like(z_stream) Compression stream
338 D sourcelen 10U 0 value Compression level
339 *
340 D deflatePending PR 10I 0 extproc('deflatePending') Change level & strat
341 D strm like(z_stream) Compression stream
342 D pending 10U 0 Pending bytes
343 D bits 10I 0 Pending bits
344 *
345 D deflatePrime PR 10I 0 extproc('deflatePrime') Change level & strat
346 D strm like(z_stream) Compression stream
347 D bits 10I 0 value # of bits to insert
348 D value 10I 0 value Bits to insert
349 *
350 D inflateInit2 PR 10I 0 extproc('inflateInit2_') Init. expansion
351 D strm like(z_stream) Expansion stream
352 D windowBits 10I 0 value log2(window size)
353 D version * value options(*string) Version string
354 D stream_size 10i 0 value Stream struct. size
355 *
356 D inflateSetDictionary...
357 D PR 10I 0 extproc('inflateSetDictionary') Init. dictionary
358 D strm like(z_stream) Expansion stream
359 D dictionary 65535 const options(*varsize) Dictionary bytes
360 D dictLength 10U 0 value Dictionary length
361 *
362 D inflateGetDictionary...
363 D PR 10I 0 extproc('inflateGetDictionary') Get dictionary
364 D strm like(z_stream) Expansion stream
365 D dictionary 65535 options(*varsize) Dictionary bytes
366 D dictLength 10U 0 Dictionary length
367 *
368 D inflateSync PR 10I 0 extproc('inflateSync') Sync. expansion
369 D strm like(z_stream) Expansion stream
370 *
371 D inflateCopy PR 10I 0 extproc('inflateCopy')
372 D dest like(z_stream) Destination stream
373 D source like(z_stream) Source stream
374 *
375 D inflateReset PR 10I 0 extproc('inflateReset') End and init. stream
376 D strm like(z_stream) Expansion stream
377 *
378 D inflateReset2 PR 10I 0 extproc('inflateReset2') End and init. stream
379 D strm like(z_stream) Expansion stream
380 D windowBits 10I 0 value Log2(buffer size)
381 *
382 D inflatePrime PR 10I 0 extproc('inflatePrime') Insert bits
383 D strm like(z_stream) Expansion stream
384 D bits 10I 0 value Bit count
385 D value 10I 0 value Bits to insert
386 *
387 D inflateMark PR 10I 0 extproc('inflateMark') Get inflate info
388 D strm like(z_stream) Expansion stream
389 *
390 D inflateBackInit...
391 D PR 10I 0 extproc('inflateBackInit_')
392 D strm like(z_stream) Expansion stream
393 D windowBits 10I 0 value Log2(buffer size)
394 D window 65535 options(*varsize) Buffer
395 D version * value options(*string) Version string
396 D stream_size 10i 0 value Stream struct. size
397 *
398 D inflateBack PR 10I 0 extproc('inflateBack')
399 D strm like(z_stream) Expansion stream
400 D in * value procptr Input function
401 D in_desc * value Input descriptor
402 D out * value procptr Output function
403 D out_desc * value Output descriptor
404 *
405 D inflateBackEnd PR 10I 0 extproc('inflateBackEnd')
406 D strm like(z_stream) Expansion stream
407 *
408 D zlibCompileFlags...
409 D PR 10U 0 extproc('zlibCompileFlags')
410 *
411 **************************************************************************
412 * Checksum function prototypes
413 **************************************************************************
414 *
415 D adler32 PR 10U 0 extproc('adler32') New checksum
416 D adler 10U 0 value Old checksum
417 D buf 65535 const options(*varsize) Bytes to accumulate
418 D len 10U 0 value Buffer length
419 *
420 D crc32 PR 10U 0 extproc('crc32') New checksum
421 D crc 10U 0 value Old checksum
422 D buf 65535 const options(*varsize) Bytes to accumulate
423 D len 10U 0 value Buffer length
424 *
425 **************************************************************************
426 * Miscellaneous function prototypes
427 **************************************************************************
428 *
429 D zError PR * extproc('zError') Error string
430 D err 10I 0 value Error code
431 *
432 D inflateSyncPoint...
433 D PR 10I 0 extproc('inflateSyncPoint')
434 D strm like(z_stream) Expansion stream
435 *
436 D get_crc_table PR * extproc('get_crc_table') Ptr to ulongs
437 *
438 D inflateUndermine...
439 D PR 10I 0 extproc('inflateUndermine')
440 D strm like(z_stream) Expansion stream
441 D arg 10I 0 value Error code
442 *
443 D inflateResetKeep...
444 D PR 10I 0 extproc('inflateResetKeep') End and init. stream
445 D strm like(z_stream) Expansion stream
446 *
447 D deflateResetKeep...
448 D PR 10I 0 extproc('deflateResetKeep') End and init. stream
449 D strm like(z_stream) Expansion stream
450 *
451 /endif