diff options
Diffstat (limited to 'contrib/delphi')
| -rw-r--r-- | contrib/delphi/zlib.mak | 36 | ||||
| -rw-r--r-- | contrib/delphi/zlibdef.pas | 169 |
2 files changed, 205 insertions, 0 deletions
diff --git a/contrib/delphi/zlib.mak b/contrib/delphi/zlib.mak new file mode 100644 index 0000000..ba557e2 --- /dev/null +++ b/contrib/delphi/zlib.mak | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | # Makefile for zlib32bd.lib | ||
| 2 | # ------------- Borland C++ 4.5 ------------- | ||
| 3 | |||
| 4 | # The (32-bit) zlib32bd.lib made with this makefile is intended for use | ||
| 5 | # in making the (32-bit) DLL, png32bd.dll. It uses the "stdcall" calling | ||
| 6 | # convention. | ||
| 7 | |||
| 8 | CFLAGS= -ps -O2 -C -K -N- -k- -d -3 -r- -w-par -w-aus -WDE | ||
| 9 | CC=f:\bc45\bin\bcc32 | ||
| 10 | LIBFLAGS= /C | ||
| 11 | LIB=f:\bc45\bin\tlib | ||
| 12 | ZLIB=zlib32bd.lib | ||
| 13 | |||
| 14 | .autodepend | ||
| 15 | .c.obj: | ||
| 16 | $(CC) -c $(CFLAGS) $< | ||
| 17 | |||
| 18 | OBJ1=adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infblock.obj | ||
| 19 | OBJ2=infcodes.obj inflate.obj inftrees.obj infutil.obj inffast.obj | ||
| 20 | OBJ3=trees.obj uncompr.obj zutil.obj | ||
| 21 | pOBJ1=+adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infblock.obj | ||
| 22 | pOBJ2=+infcodes.obj+inflate.obj+inftrees.obj+infutil.obj+inffast.obj | ||
| 23 | pOBJ3=+trees.obj+uncompr.obj+zutil.obj | ||
| 24 | |||
| 25 | all: $(ZLIB) | ||
| 26 | |||
| 27 | $(ZLIB): $(OBJ1) $(OBJ2) $(OBJ3) | ||
| 28 | @if exist $@ del $@ | ||
| 29 | $(LIB) @&&| | ||
| 30 | $@ $(LIBFLAGS) & | ||
| 31 | $(pOBJ1) & | ||
| 32 | $(pOBJ2) & | ||
| 33 | $(pOBJ3) | ||
| 34 | | | ||
| 35 | |||
| 36 | # End of makefile for zlib32bd.lib | ||
diff --git a/contrib/delphi/zlibdef.pas b/contrib/delphi/zlibdef.pas new file mode 100644 index 0000000..4f96b7d --- /dev/null +++ b/contrib/delphi/zlibdef.pas | |||
| @@ -0,0 +1,169 @@ | |||
| 1 | unit zlibdef; | ||
| 2 | |||
| 3 | interface | ||
| 4 | |||
| 5 | uses | ||
| 6 | Windows; | ||
| 7 | |||
| 8 | const | ||
| 9 | ZLIB_VERSION = '1.1.3'; | ||
| 10 | |||
| 11 | type | ||
| 12 | voidpf = Pointer; | ||
| 13 | int = Integer; | ||
| 14 | uInt = Cardinal; | ||
| 15 | pBytef = PChar; | ||
| 16 | uLong = Cardinal; | ||
| 17 | |||
| 18 | alloc_func = function(opaque: voidpf; items, size: uInt): voidpf; | ||
| 19 | stdcall; | ||
| 20 | free_func = procedure(opaque, address: voidpf); | ||
| 21 | stdcall; | ||
| 22 | |||
| 23 | internal_state = Pointer; | ||
| 24 | |||
| 25 | z_streamp = ^z_stream; | ||
| 26 | z_stream = packed record | ||
| 27 | next_in: pBytef; // next input byte | ||
| 28 | avail_in: uInt; // number of bytes available at next_in | ||
| 29 | total_in: uLong; // total nb of input bytes read so far | ||
| 30 | |||
| 31 | next_out: pBytef; // next output byte should be put there | ||
| 32 | avail_out: uInt; // remaining free space at next_out | ||
| 33 | total_out: uLong; // total nb of bytes output so far | ||
| 34 | |||
| 35 | msg: PChar; // last error message, NULL if no error | ||
| 36 | state: internal_state; // not visible by applications | ||
| 37 | |||
| 38 | zalloc: alloc_func; // used to allocate the internal state | ||
| 39 | zfree: free_func; // used to free the internal state | ||
| 40 | opaque: voidpf; // private data object passed to zalloc and zfree | ||
| 41 | |||
| 42 | data_type: int; // best guess about the data type: ascii or binary | ||
| 43 | adler: uLong; // adler32 value of the uncompressed data | ||
| 44 | reserved: uLong; // reserved for future use | ||
| 45 | end; | ||
| 46 | |||
| 47 | const | ||
| 48 | Z_NO_FLUSH = 0; | ||
| 49 | Z_SYNC_FLUSH = 2; | ||
| 50 | Z_FULL_FLUSH = 3; | ||
| 51 | Z_FINISH = 4; | ||
| 52 | |||
| 53 | Z_OK = 0; | ||
| 54 | Z_STREAM_END = 1; | ||
| 55 | |||
| 56 | Z_NO_COMPRESSION = 0; | ||
| 57 | Z_BEST_SPEED = 1; | ||
| 58 | Z_BEST_COMPRESSION = 9; | ||
| 59 | Z_DEFAULT_COMPRESSION = -1; | ||
| 60 | |||
| 61 | Z_FILTERED = 1; | ||
| 62 | Z_HUFFMAN_ONLY = 2; | ||
| 63 | Z_DEFAULT_STRATEGY = 0; | ||
| 64 | |||
| 65 | Z_BINARY = 0; | ||
| 66 | Z_ASCII = 1; | ||
| 67 | Z_UNKNOWN = 2; | ||
| 68 | |||
| 69 | Z_DEFLATED = 8; | ||
| 70 | |||
| 71 | MAX_MEM_LEVEL = 9; | ||
| 72 | |||
| 73 | function adler32(adler: uLong; const buf: pBytef; len: uInt): uLong; | ||
| 74 | stdcall; | ||
| 75 | function crc32(crc: uLong; const buf: pBytef; len: uInt): uLong; | ||
| 76 | stdcall; | ||
| 77 | function deflate(strm: z_streamp; flush: int): int; | ||
| 78 | stdcall; | ||
| 79 | function deflateCopy(dest, source: z_streamp): int; | ||
| 80 | stdcall; | ||
| 81 | function deflateEnd(strm: z_streamp): int; | ||
| 82 | stdcall; | ||
| 83 | function deflateInit2_(strm: z_streamp; level, method, | ||
| 84 | windowBits, memLevel, strategy: int; | ||
| 85 | const version: PChar; stream_size: int): int; | ||
| 86 | stdcall; | ||
| 87 | function deflateInit_(strm: z_streamp; level: int; | ||
| 88 | const version: PChar; stream_size: int): int; | ||
| 89 | stdcall; | ||
| 90 | function deflateParams(strm: z_streamp; level, strategy: int): int; | ||
| 91 | stdcall; | ||
| 92 | function deflateReset(strm: z_streamp): int; | ||
| 93 | stdcall; | ||
| 94 | function deflateSetDictionary(strm: z_streamp; | ||
| 95 | const dictionary: pBytef; | ||
| 96 | dictLength: uInt): int; | ||
| 97 | stdcall; | ||
| 98 | function inflate(strm: z_streamp; flush: int): int; | ||
| 99 | stdcall; | ||
| 100 | function inflateEnd(strm: z_streamp): int; | ||
| 101 | stdcall; | ||
| 102 | function inflateInit2_(strm: z_streamp; windowBits: int; | ||
| 103 | const version: PChar; stream_size: int): int; | ||
| 104 | stdcall; | ||
| 105 | function inflateInit_(strm: z_streamp; const version: PChar; | ||
| 106 | stream_size: int): int; | ||
| 107 | stdcall; | ||
| 108 | function inflateReset(strm: z_streamp): int; | ||
| 109 | stdcall; | ||
| 110 | function inflateSetDictionary(strm: z_streamp; | ||
| 111 | const dictionary: pBytef; | ||
| 112 | dictLength: uInt): int; | ||
| 113 | stdcall; | ||
| 114 | function inflateSync(strm: z_streamp): int; | ||
| 115 | stdcall; | ||
| 116 | |||
| 117 | function deflateInit(strm: z_streamp; level: int): int; | ||
| 118 | function deflateInit2(strm: z_streamp; level, method, windowBits, | ||
| 119 | memLevel, strategy: int): int; | ||
| 120 | function inflateInit(strm: z_streamp): int; | ||
| 121 | function inflateInit2(strm: z_streamp; windowBits: int): int; | ||
| 122 | |||
| 123 | implementation | ||
| 124 | |||
| 125 | function deflateInit(strm: z_streamp; level: int): int; | ||
| 126 | begin | ||
| 127 | Result := deflateInit_(strm, level, ZLIB_VERSION, sizeof(z_stream)); | ||
| 128 | end; | ||
| 129 | |||
| 130 | function deflateInit2(strm: z_streamp; level, method, windowBits, | ||
| 131 | memLevel, strategy: int): int; | ||
| 132 | begin | ||
| 133 | Result := deflateInit2_(strm, level, method, windowBits, memLevel, | ||
| 134 | strategy, ZLIB_VERSION, sizeof(z_stream)); | ||
| 135 | end; | ||
| 136 | |||
| 137 | function inflateInit(strm: z_streamp): int; | ||
| 138 | begin | ||
| 139 | Result := inflateInit_(strm, ZLIB_VERSION, sizeof(z_stream)); | ||
| 140 | end; | ||
| 141 | |||
| 142 | function inflateInit2(strm: z_streamp; windowBits: int): int; | ||
| 143 | begin | ||
| 144 | Result := inflateInit2_(strm, windowBits, ZLIB_VERSION, | ||
| 145 | sizeof(z_stream)); | ||
| 146 | end; | ||
| 147 | |||
| 148 | const | ||
| 149 | zlibDLL = 'png32bd.dll'; | ||
| 150 | |||
| 151 | function adler32; external zlibDLL; | ||
| 152 | function crc32; external zlibDLL; | ||
| 153 | function deflate; external zlibDLL; | ||
| 154 | function deflateCopy; external zlibDLL; | ||
| 155 | function deflateEnd; external zlibDLL; | ||
| 156 | function deflateInit2_; external zlibDLL; | ||
| 157 | function deflateInit_; external zlibDLL; | ||
| 158 | function deflateParams; external zlibDLL; | ||
| 159 | function deflateReset; external zlibDLL; | ||
| 160 | function deflateSetDictionary; external zlibDLL; | ||
| 161 | function inflate; external zlibDLL; | ||
| 162 | function inflateEnd; external zlibDLL; | ||
| 163 | function inflateInit2_; external zlibDLL; | ||
| 164 | function inflateInit_; external zlibDLL; | ||
| 165 | function inflateReset; external zlibDLL; | ||
| 166 | function inflateSetDictionary; external zlibDLL; | ||
| 167 | function inflateSync; external zlibDLL; | ||
| 168 | |||
| 169 | end. | ||
