diff options
Diffstat (limited to 'as400')
| -rw-r--r-- | as400/bndsrc | 132 | ||||
| -rw-r--r-- | as400/compile.clp | 123 | ||||
| -rw-r--r-- | as400/readme.txt | 111 | ||||
| -rw-r--r-- | as400/zlib.inc | 327 |
4 files changed, 693 insertions, 0 deletions
diff --git a/as400/bndsrc b/as400/bndsrc new file mode 100644 index 0000000..a963e3a --- /dev/null +++ b/as400/bndsrc | |||
| @@ -0,0 +1,132 @@ | |||
| 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("deflatePrime") | ||
| 38 | EXPORT SYMBOL("deflateInit_") | ||
| 39 | EXPORT SYMBOL("deflateInit2_") | ||
| 40 | |||
| 41 | /********************************************************************/ | ||
| 42 | /* *MODULE GZIO ZLIB 01/02/01 00:15:09 */ | ||
| 43 | /********************************************************************/ | ||
| 44 | |||
| 45 | EXPORT SYMBOL("gzopen") | ||
| 46 | EXPORT SYMBOL("gzdopen") | ||
| 47 | EXPORT SYMBOL("gzsetparams") | ||
| 48 | EXPORT SYMBOL("gzread") | ||
| 49 | EXPORT SYMBOL("gzwrite") | ||
| 50 | EXPORT SYMBOL("gzprintf") | ||
| 51 | EXPORT SYMBOL("gzputs") | ||
| 52 | EXPORT SYMBOL("gzgets") | ||
| 53 | EXPORT SYMBOL("gzputc") | ||
| 54 | EXPORT SYMBOL("gzgetc") | ||
| 55 | EXPORT SYMBOL("gzflush") | ||
| 56 | EXPORT SYMBOL("gzseek") | ||
| 57 | EXPORT SYMBOL("gzrewind") | ||
| 58 | EXPORT SYMBOL("gztell") | ||
| 59 | EXPORT SYMBOL("gzeof") | ||
| 60 | EXPORT SYMBOL("gzclose") | ||
| 61 | EXPORT SYMBOL("gzerror") | ||
| 62 | |||
| 63 | /********************************************************************/ | ||
| 64 | /* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */ | ||
| 65 | /********************************************************************/ | ||
| 66 | |||
| 67 | EXPORT SYMBOL("inflate") | ||
| 68 | EXPORT SYMBOL("inflateEnd") | ||
| 69 | EXPORT SYMBOL("inflateSetDictionary") | ||
| 70 | EXPORT SYMBOL("inflateSync") | ||
| 71 | EXPORT SYMBOL("inflateReset") | ||
| 72 | EXPORT SYMBOL("inflateInit_") | ||
| 73 | EXPORT SYMBOL("inflateInit2_") | ||
| 74 | EXPORT SYMBOL("inflateSyncPoint") | ||
| 75 | |||
| 76 | /********************************************************************/ | ||
| 77 | /* *MODULE UNCOMPR ZLIB 01/02/01 00:15:09 */ | ||
| 78 | /********************************************************************/ | ||
| 79 | |||
| 80 | EXPORT SYMBOL("uncompress") | ||
| 81 | |||
| 82 | /********************************************************************/ | ||
| 83 | /* *MODULE ZUTIL ZLIB 01/02/01 00:15:09 */ | ||
| 84 | /********************************************************************/ | ||
| 85 | |||
| 86 | EXPORT SYMBOL("zlibVersion") | ||
| 87 | EXPORT SYMBOL("zError") | ||
| 88 | |||
| 89 | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ | ||
| 90 | /* Version 1.2.0.7 additional entry points. */ | ||
| 91 | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ | ||
| 92 | |||
| 93 | /********************************************************************/ | ||
| 94 | /* *MODULE COMPRESS ZLIB 01/02/01 00:15:09 */ | ||
| 95 | /********************************************************************/ | ||
| 96 | |||
| 97 | EXPORT SYMBOL("compressBound") | ||
| 98 | |||
| 99 | /********************************************************************/ | ||
| 100 | /* *MODULE DEFLATE ZLIB 01/02/01 00:15:09 */ | ||
| 101 | /********************************************************************/ | ||
| 102 | |||
| 103 | EXPORT SYMBOL("deflateBound") | ||
| 104 | |||
| 105 | /********************************************************************/ | ||
| 106 | /* *MODULE GZIO ZLIB 01/02/01 00:15:09 */ | ||
| 107 | /********************************************************************/ | ||
| 108 | |||
| 109 | EXPORT SYMBOL("gzungetc") | ||
| 110 | EXPORT SYMBOL("gzclearerr") | ||
| 111 | |||
| 112 | /********************************************************************/ | ||
| 113 | /* *MODULE INFBACK ZLIB 01/02/01 00:15:09 */ | ||
| 114 | /********************************************************************/ | ||
| 115 | |||
| 116 | EXPORT SYMBOL("inflateBack") | ||
| 117 | EXPORT SYMBOL("inflateBackEnd") | ||
| 118 | EXPORT SYMBOL("inflateBackInit_") | ||
| 119 | |||
| 120 | /********************************************************************/ | ||
| 121 | /* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */ | ||
| 122 | /********************************************************************/ | ||
| 123 | |||
| 124 | EXPORT SYMBOL("inflateCopy") | ||
| 125 | |||
| 126 | /********************************************************************/ | ||
| 127 | /* *MODULE ZUTIL ZLIB 01/02/01 00:15:09 */ | ||
| 128 | /********************************************************************/ | ||
| 129 | |||
| 130 | EXPORT SYMBOL("zlibCompileFlags") | ||
| 131 | |||
| 132 | ENDPGMEXP | ||
diff --git a/as400/compile.clp b/as400/compile.clp new file mode 100644 index 0000000..4f8700c --- /dev/null +++ b/as400/compile.clp | |||
| @@ -0,0 +1,123 @@ | |||
| 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 | |||
| 30 | /* Working storage. */ | ||
| 31 | |||
| 32 | DCL VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(300) /* Command length. */ | ||
| 33 | DCL VAR(&CMD) TYPE(*CHAR) LEN(512) | ||
| 34 | |||
| 35 | |||
| 36 | /* Compile sources into modules. */ | ||
| 37 | |||
| 38 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
| 39 | '/ADLER32) SRCFILE(' *TCAT + | ||
| 40 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
| 41 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
| 42 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
| 43 | |||
| 44 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
| 45 | '/COMPRESS) SRCFILE(' *TCAT + | ||
| 46 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
| 47 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
| 48 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
| 49 | |||
| 50 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
| 51 | '/CRC32) SRCFILE(' *TCAT + | ||
| 52 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
| 53 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
| 54 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
| 55 | |||
| 56 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
| 57 | '/DEFLATE) SRCFILE(' *TCAT + | ||
| 58 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
| 59 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
| 60 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
| 61 | |||
| 62 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
| 63 | '/GZIO) SRCFILE(' *TCAT + | ||
| 64 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
| 65 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
| 66 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
| 67 | |||
| 68 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
| 69 | '/INFBACK) SRCFILE(' *TCAT + | ||
| 70 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
| 71 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
| 72 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
| 73 | |||
| 74 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
| 75 | '/INFFAST) SRCFILE(' *TCAT + | ||
| 76 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
| 77 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
| 78 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
| 79 | |||
| 80 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
| 81 | '/INFLATE) SRCFILE(' *TCAT + | ||
| 82 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
| 83 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
| 84 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
| 85 | |||
| 86 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
| 87 | '/INFTREES) SRCFILE(' *TCAT + | ||
| 88 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
| 89 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
| 90 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
| 91 | |||
| 92 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
| 93 | '/TREES) SRCFILE(' *TCAT + | ||
| 94 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
| 95 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
| 96 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
| 97 | |||
| 98 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
| 99 | '/UNCOMPR) SRCFILE(' *TCAT + | ||
| 100 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
| 101 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
| 102 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
| 103 | |||
| 104 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
| 105 | '/ZUTIL) SRCFILE(' *TCAT + | ||
| 106 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
| 107 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
| 108 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
| 109 | |||
| 110 | |||
| 111 | /* Link modules into a service program. */ | ||
| 112 | |||
| 113 | CRTSRVPGM SRVPGM(&SRVLIB/ZLIB) + | ||
| 114 | MODULE(&MODLIB/ADLER32 &MODLIB/COMPRESS + | ||
| 115 | &MODLIB/CRC32 &MODLIB/DEFLATE + | ||
| 116 | &MODLIB/GZIO &MODLIB/INFBACK + | ||
| 117 | &MODLIB/INFFAST &MODLIB/INFLATE + | ||
| 118 | &MODLIB/INFTREES &MODLIB/TREES + | ||
| 119 | &MODLIB/UNCOMPR &MODLIB/ZUTIL) + | ||
| 120 | SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC) + | ||
| 121 | TEXT('ZLIB 1.2.0.7') TGTRLS(V4R4M0) | ||
| 122 | |||
| 123 | ENDPGM | ||
diff --git a/as400/readme.txt b/as400/readme.txt new file mode 100644 index 0000000..7ce5ed1 --- /dev/null +++ b/as400/readme.txt | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | ZLIB version 1.2.0.7 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 | gzio.c GZIO C ZLIB - IO on .gz files | ||
| 74 | infback.c INFBACK C ZLIB - Inflate using a callback interface | ||
| 75 | inffast.c INFFAST C ZLIB - Fast proc. literals & length/distance pairs | ||
| 76 | inflate.c INFLATE C ZLIB - Interface to inflate modules | ||
| 77 | inftrees.c INFTREES C ZLIB - Generate Huffman trees for efficient decode | ||
| 78 | trees.c TREES C ZLIB - Output deflated data using Huffman coding | ||
| 79 | uncompr.c UNCOMPR C ZLIB - Decompress a memory buffer | ||
| 80 | zutil.c ZUTIL C ZLIB - Target dependent utility functions | ||
| 81 | H Original ZLIB C and ILE/RPG include files | ||
| 82 | crc32.h CRC32 C ZLIB - CRC32 tables | ||
| 83 | deflate.h DEFLATE C ZLIB - Internal compression state | ||
| 84 | inffast.h INFFAST C ZLIB - Header to use inffast.c | ||
| 85 | inffixed.h INFFIXED C ZLIB - Table for decoding fixed codes | ||
| 86 | inflate.h INFLATE C ZLIB - Internal inflate state definitions | ||
| 87 | inftrees.h INFTREES C ZLIB - Header to use inftrees.c | ||
| 88 | trees.h TREES C ZLIB - Created automatically with -DGEN_TREES_H | ||
| 89 | zconf.h ZCONF C ZLIB - Compression library configuration | ||
| 90 | zlib.h ZLIB C ZLIB - Compression library C user interface | ||
| 91 | as400/zlib.inc ZLIB.INC RPGLE ZLIB - Compression library ILE RPG user interface | ||
| 92 | zutil.h ZUTIL C ZLIB - Internal interface and configuration | ||
| 93 | TOOLS Building source software & AS/400 README | ||
| 94 | as400/bndsrc BNDSRC Entry point exportation list | ||
| 95 | as400/compile.clp COMPILE CLP Compile sources & generate service program | ||
| 96 | as400/readme.txt README TXT Installation instructions | ||
| 97 | |||
| 98 | 4) Continue as in I)3). | ||
| 99 | |||
| 100 | |||
| 101 | |||
| 102 | |||
| 103 | Notes: For AS400 ILE RPG programmers, a /copy member defining the ZLIB | ||
| 104 | API prototypes for ILE RPG can be found in ZLIB/H(ZLIB.INC). | ||
| 105 | Please read comments in this member for more information. | ||
| 106 | |||
| 107 | Remember that most foreign textual data are ASCII coded: this | ||
| 108 | implementation does not handle conversion from/to ASCII, so | ||
| 109 | text data code conversions must be done explicitely. | ||
| 110 | |||
| 111 | Always open zipped files in binary mode. | ||
diff --git a/as400/zlib.inc b/as400/zlib.inc new file mode 100644 index 0000000..9a0fc54 --- /dev/null +++ b/as400/zlib.inc | |||
| @@ -0,0 +1,327 @@ | |||
| 1 | * ZLIB.INC - Interface to the general purpose compression library | ||
| 2 | * | ||
| 3 | * ILE RPG400 version by Patrick Monnerat, DATASPHERE. | ||
| 4 | * Version 1.2.0.7 | ||
| 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 | D ZLIB_VERSION C '1.2.0.8' Header's version | ||
| 24 | D ZLIB_VERNUM C X'1208' | ||
| 25 | * | ||
| 26 | D Z_NO_FLUSH C 0 | ||
| 27 | D Z_SYNC_FLUSH C 2 | ||
| 28 | D Z_FULL_FLUSH C 3 | ||
| 29 | D Z_FINISH C 4 | ||
| 30 | D Z_BLOCK C 5 | ||
| 31 | * | ||
| 32 | D Z_OK C 0 | ||
| 33 | D Z_STREAM_END C 1 | ||
| 34 | D Z_NEED_DICT C 2 | ||
| 35 | D Z_ERRNO C -1 | ||
| 36 | D Z_STREAM_ERROR C -2 | ||
| 37 | D Z_DATA_ERROR C -3 | ||
| 38 | D Z_MEM_ERROR C -4 | ||
| 39 | D Z_BUF_ERROR C -5 | ||
| 40 | DZ_VERSION_ERROR C -6 | ||
| 41 | * | ||
| 42 | D Z_NO_COMPRESSION... | ||
| 43 | D C 0 | ||
| 44 | D Z_BEST_SPEED C 1 | ||
| 45 | D Z_BEST_COMPRESSION... | ||
| 46 | D C 9 | ||
| 47 | D Z_DEFAULT_COMPRESSION... | ||
| 48 | D C -1 | ||
| 49 | * | ||
| 50 | D Z_FILTERED C 1 | ||
| 51 | D Z_HUFFMAN_ONLY C 2 | ||
| 52 | D Z_RLE C 3 | ||
| 53 | D Z_DEFAULT_STRATEGY... | ||
| 54 | D C 0 | ||
| 55 | * | ||
| 56 | D Z_BINARY C 0 | ||
| 57 | D Z_ASCII C 1 | ||
| 58 | D Z_UNKNOWN C 2 | ||
| 59 | * | ||
| 60 | D Z_DEFLATED C 8 | ||
| 61 | * | ||
| 62 | D Z_NULL C 0 | ||
| 63 | * | ||
| 64 | ************************************************************************** | ||
| 65 | * Types | ||
| 66 | ************************************************************************** | ||
| 67 | * | ||
| 68 | D z_streamp S * Stream struct ptr | ||
| 69 | D gzFile S * File pointer | ||
| 70 | D z_off_t S 10i 0 Stream offsets | ||
| 71 | * | ||
| 72 | ************************************************************************** | ||
| 73 | * Structures | ||
| 74 | ************************************************************************** | ||
| 75 | * | ||
| 76 | * The GZIP encode/decode stream support structure. | ||
| 77 | * | ||
| 78 | D z_stream DS align based(z_streamp) | ||
| 79 | D zs_next_in * Next input byte | ||
| 80 | D zs_avail_in 10U 0 Byte cnt at next_in | ||
| 81 | D zs_total_in 10U 0 Total bytes read | ||
| 82 | D zs_next_out * Output buffer ptr | ||
| 83 | D zs_avail_out 10U 0 Room left @ next_out | ||
| 84 | D zs_total_out 10U 0 Total bytes written | ||
| 85 | D zs_msg * Last errmsg or null | ||
| 86 | D zs_state * Internal state | ||
| 87 | D zs_zalloc * procptr Int. state allocator | ||
| 88 | D zs_free * procptr Int. state dealloc. | ||
| 89 | D zs_opaque * Private alloc. data | ||
| 90 | D zs_data_type 10i 0 ASC/BIN best guess | ||
| 91 | D zs_adler 10u 0 Uncompr. adler32 val | ||
| 92 | D 10U 0 Reserved | ||
| 93 | D 10U 0 Ptr. alignment | ||
| 94 | * | ||
| 95 | ************************************************************************** | ||
| 96 | * Utility function prototypes | ||
| 97 | ************************************************************************** | ||
| 98 | * | ||
| 99 | D compress PR 10I 0 extproc('compress') | ||
| 100 | D dest 32767 options(*varsize) Destination buffer | ||
| 101 | D destLen 10U 0 Destination length | ||
| 102 | D source 32767 const options(*varsize) Source buffer | ||
| 103 | D sourceLen 10u 0 value Source length | ||
| 104 | * | ||
| 105 | D compress2 PR 10I 0 extproc('compress2') | ||
| 106 | D dest 32767 options(*varsize) Destination buffer | ||
| 107 | D destLen 10U 0 Destination length | ||
| 108 | D source 32767 const options(*varsize) Source buffer | ||
| 109 | D sourceLen 10U 0 value Source length | ||
| 110 | D level 10I 0 value Compression level | ||
| 111 | * | ||
| 112 | D compressBound PR 10U 0 extproc('compressBound') | ||
| 113 | D sourceLen 10U 0 value | ||
| 114 | * | ||
| 115 | D uncompress PR 10I 0 extproc('uncompress') | ||
| 116 | D dest 32767 options(*varsize) Destination buffer | ||
| 117 | D destLen 10U 0 Destination length | ||
| 118 | D source 32767 const options(*varsize) Source buffer | ||
| 119 | D sourceLen 10U 0 value Source length | ||
| 120 | * | ||
| 121 | D gzopen PR extproc('gzopen') | ||
| 122 | D like(gzFile) | ||
| 123 | D path * value options(*string) File pathname | ||
| 124 | D mode * value options(*string) Open mode | ||
| 125 | * | ||
| 126 | D gzdopen PR extproc('gzdopen') | ||
| 127 | D like(gzFile) | ||
| 128 | D fd 10i 0 value File descriptor | ||
| 129 | D mode * value options(*string) Open mode | ||
| 130 | * | ||
| 131 | D gzsetparams PR 10I 0 extproc('gzsetparams') | ||
| 132 | D file value like(gzFile) File pointer | ||
| 133 | D level 10I 0 value | ||
| 134 | D strategy 10i 0 value | ||
| 135 | * | ||
| 136 | D gzread PR 10I 0 extproc('gzread') | ||
| 137 | D file value like(gzFile) File pointer | ||
| 138 | D buf 32767 options(*varsize) Buffer | ||
| 139 | D len 10u 0 value Buffer length | ||
| 140 | * | ||
| 141 | D gzwrite PR 10I 0 extproc('gzwrite') | ||
| 142 | D file value like(gzFile) File pointer | ||
| 143 | D buf 32767 const options(*varsize) Buffer | ||
| 144 | D len 10u 0 value Buffer length | ||
| 145 | * | ||
| 146 | D gzputs PR 10I 0 extproc('gzputs') | ||
| 147 | D file value like(gzFile) File pointer | ||
| 148 | D s * value options(*string) String to output | ||
| 149 | * | ||
| 150 | D gzgets PR * extproc('gzgets') | ||
| 151 | D file value like(gzFile) File pointer | ||
| 152 | D buf 32767 options(*varsize) Read buffer | ||
| 153 | D len 10i 0 value Buffer length | ||
| 154 | * | ||
| 155 | D gzflush PR 10i 0 extproc('gzflush') | ||
| 156 | D file value like(gzFile) File pointer | ||
| 157 | D flush 10I 0 value Type of flush | ||
| 158 | * | ||
| 159 | D gzseek PR extproc('gzseek') | ||
| 160 | D like(z_off_t) | ||
| 161 | D file value like(gzFile) File pointer | ||
| 162 | D offset value like(z_off_t) Offset | ||
| 163 | D whence 10i 0 value Origin | ||
| 164 | * | ||
| 165 | D gzrewind PR 10i 0 extproc('gzrewind') | ||
| 166 | D file value like(gzFile) File pointer | ||
| 167 | * | ||
| 168 | D gztell PR extproc('gztell') | ||
| 169 | D like(z_off_t) | ||
| 170 | D file value like(gzFile) File pointer | ||
| 171 | * | ||
| 172 | D gzeof PR 10i 0 extproc('gzeof') | ||
| 173 | D file value like(gzFile) File pointer | ||
| 174 | * | ||
| 175 | D gzclose PR 10i 0 extproc('gzclose') | ||
| 176 | D file value like(gzFile) File pointer | ||
| 177 | * | ||
| 178 | D gzerror PR * extproc('gzerror') Error string | ||
| 179 | D file value like(gzFile) File pointer | ||
| 180 | D errnum 10I 0 Error code | ||
| 181 | * | ||
| 182 | D gzclearerr PR extproc('gzclearerr') | ||
| 183 | D file value like(gzFile) File pointer | ||
| 184 | * | ||
| 185 | ************************************************************************** | ||
| 186 | * Basic function prototypes | ||
| 187 | ************************************************************************** | ||
| 188 | * | ||
| 189 | D zlibVersion PR * extproc('zlibVersion') Version string | ||
| 190 | * | ||
| 191 | D deflateInit PR 10I 0 extproc('deflateInit_') Init. compression | ||
| 192 | D strm like(z_stream) Compression stream | ||
| 193 | D level 10I 0 value Compression level | ||
| 194 | D version * value options(*string) Version string | ||
| 195 | D stream_size 10i 0 value Stream struct. size | ||
| 196 | * | ||
| 197 | D deflate PR 10I 0 extproc('deflate') Compress data | ||
| 198 | D strm like(z_stream) Compression stream | ||
| 199 | D flush 10I 0 value Flush type required | ||
| 200 | * | ||
| 201 | D deflateEnd PR 10I 0 extproc('deflateEnd') Termin. compression | ||
| 202 | D strm like(z_stream) Compression stream | ||
| 203 | * | ||
| 204 | D inflateInit PR 10I 0 extproc('inflateInit_') Init. expansion | ||
| 205 | D strm like(z_stream) Expansion stream | ||
| 206 | D version * value options(*string) Version string | ||
| 207 | D stream_size 10i 0 value Stream struct. size | ||
| 208 | * | ||
| 209 | D inflate PR 10I 0 extproc('inflate') Expand data | ||
| 210 | D strm like(z_stream) Expansion stream | ||
| 211 | D flush 10I 0 value Flush type required | ||
| 212 | * | ||
| 213 | D inflateEnd PR 10I 0 extproc('inflateEnd') Termin. expansion | ||
| 214 | D strm like(z_stream) Expansion stream | ||
| 215 | * | ||
| 216 | ************************************************************************** | ||
| 217 | * Advanced function prototypes | ||
| 218 | ************************************************************************** | ||
| 219 | * | ||
| 220 | D deflateInit2 PR 10I 0 extproc('deflateInit2_') Init. compression | ||
| 221 | D strm like(z_stream) Compression stream | ||
| 222 | D level 10I 0 value Compression level | ||
| 223 | D method 10I 0 value Compression method | ||
| 224 | D windowBits 10I 0 value log2(window size) | ||
| 225 | D memLevel 10I 0 value Mem/cmpress tradeoff | ||
| 226 | D strategy 10I 0 value Compression stategy | ||
| 227 | D version * value options(*string) Version string | ||
| 228 | D stream_size 10i 0 value Stream struct. size | ||
| 229 | * | ||
| 230 | D deflateSetDictionary... | ||
| 231 | D PR 10I 0 extproc('deflateSetDictionary') Init. dictionary | ||
| 232 | D strm like(z_stream) Compression stream | ||
| 233 | D dictionary 32767 const options(*varsize) Dictionary bytes | ||
| 234 | D dictLength 10U 0 value Dictionary length | ||
| 235 | * | ||
| 236 | D deflateCopy PR 10I 0 extproc('deflateCopy') Compress strm 2 strm | ||
| 237 | D dest like(z_stream) Destination stream | ||
| 238 | D source like(z_stream) Source stream | ||
| 239 | * | ||
| 240 | D deflateReset PR 10I 0 extproc('deflateReset') End and init. stream | ||
| 241 | D strm like(z_stream) Compression stream | ||
| 242 | * | ||
| 243 | D deflateParams PR 10I 0 extproc('deflateParams') Change level & strat | ||
| 244 | D strm like(z_stream) Compression stream | ||
| 245 | D level 10I 0 value Compression level | ||
| 246 | D strategy 10I 0 value Compression stategy | ||
| 247 | * | ||
| 248 | D deflateBound PR 10U 0 extproc('deflateBound') Change level & strat | ||
| 249 | D strm like(z_stream) Compression stream | ||
| 250 | D sourcelen 10U 0 value Compression level | ||
| 251 | * | ||
| 252 | D deflatePrime PR 10I 0 extproc('deflatePrime') Change level & strat | ||
| 253 | D strm like(z_stream) Compression stream | ||
| 254 | D bits 10I 0 value Number of bits to insert | ||
| 255 | D value 10I 0 value Bits to insert | ||
| 256 | * | ||
| 257 | D inflateInit2 PR 10I 0 extproc('inflateInit2_') Init. expansion | ||
| 258 | D strm like(z_stream) Expansion stream | ||
| 259 | D windowBits 10I 0 value log2(window size) | ||
| 260 | D version * value options(*string) Version string | ||
| 261 | D stream_size 10i 0 value Stream struct. size | ||
| 262 | * | ||
| 263 | D inflateSetDictionary... | ||
| 264 | D PR 10I 0 extproc('inflateSetDictionary') Init. dictionary | ||
| 265 | D strm like(z_stream) Expansion stream | ||
| 266 | D dictionary 32767 const options(*varsize) Dictionary bytes | ||
| 267 | D dictLength 10U 0 value Dictionary length | ||
| 268 | * | ||
| 269 | D inflateSync PR 10I 0 extproc('inflateSync') Sync. expansion | ||
| 270 | D strm like(z_stream) Expansion stream | ||
| 271 | * | ||
| 272 | D inflateCopy PR 10I 0 extproc('inflateCopy') | ||
| 273 | D dest like(z_stream) Destination stream | ||
| 274 | D source like(z_stream) Source stream | ||
| 275 | * | ||
| 276 | D inflateReset PR 10I 0 extproc('inflateReset') End and init. stream | ||
| 277 | D strm like(z_stream) Expansion stream | ||
| 278 | * | ||
| 279 | D inflateBackInit... | ||
| 280 | D PR 10I 0 extproc('inflateBackInit_') | ||
| 281 | D strm like(z_stream) Expansion stream | ||
| 282 | D windowBits 10I 0 value Log2(buffer size) | ||
| 283 | D window 32767 options(*varsize) Buffer | ||
| 284 | D version * value options(*string) Version string | ||
| 285 | D stream_size 10i 0 value Stream struct. size | ||
| 286 | * | ||
| 287 | D inflateBack PR 10I 0 extproc('inflateBack') | ||
| 288 | D strm like(z_stream) Expansion stream | ||
| 289 | D in * value procptr Input function | ||
| 290 | D in_desc * value Input descriptor | ||
| 291 | D out * value procptr Output function | ||
| 292 | D out_desc * value Output descriptor | ||
| 293 | * | ||
| 294 | D inflateBackEnd PR 10I 0 extproc('inflateBackEnd') | ||
| 295 | D strm like(z_stream) Expansion stream | ||
| 296 | * | ||
| 297 | D zlibCompileFlags... | ||
| 298 | D PR 10U 0 extproc('zlibCompileFlags') | ||
| 299 | * | ||
| 300 | ************************************************************************** | ||
| 301 | * Checksum function prototypes | ||
| 302 | ************************************************************************** | ||
| 303 | * | ||
| 304 | D adler32 PR 10U 0 extproc('adler32') New checksum | ||
| 305 | D adler 10U 0 value Old checksum | ||
| 306 | D buf 32767 const options(*varsize) Bytes to accumulate | ||
| 307 | D len 10U 0 value Buffer length | ||
| 308 | * | ||
| 309 | D crc32 PR 10U 0 extproc('crc32') New checksum | ||
| 310 | D crc 10U 0 value Old checksum | ||
| 311 | D buf 32767 const options(*varsize) Bytes to accumulate | ||
| 312 | D len 10U 0 value Buffer length | ||
| 313 | * | ||
| 314 | ************************************************************************** | ||
| 315 | * Miscellaneous function prototypes | ||
| 316 | ************************************************************************** | ||
| 317 | * | ||
| 318 | D zError PR * extproc('zError') Error string | ||
| 319 | D err 10I 0 value Error code | ||
| 320 | * | ||
| 321 | D inflateSyncPoint... | ||
| 322 | D PR 10I 0 extproc('inflateSyncPoint') | ||
| 323 | D strm like(z_stream) Expansion stream | ||
| 324 | * | ||
| 325 | D get_crc_table PR * extproc('get_crc_table') Ptr to ulongs | ||
| 326 | * | ||
| 327 | /endif | ||
