File: paszlib.pas

package info (click to toggle)
fpc 2.0.0-4
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 89,476 kB
  • ctags: 133,433
  • sloc: pascal: 1,075,377; makefile: 310,704; xml: 64,343; perl: 7,703; yacc: 3,297; ansic: 2,265; lex: 839; php: 447; sh: 412; sed: 132; asm: 71; csh: 34; cpp: 26; tcl: 7
file content (332 lines) | stat: -rw-r--r-- 9,588 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
unit paszlib;

interface

uses
  zbase;

const
  ZLIB_VERSION = '1.1.2';

type
  { Compatibility types }
  PByte   = ^Byte;
  Uint    = Cardinal;
  Ulong   = Cardinal;
  Ulongf  = ULong;
  Pulongf = ^Ulongf;
  z_off_t = longint;

  TAllocfunc = function (opaque:pointer; items:uInt; size:uInt):pointer;
  TFreeFunc = procedure (opaque:pointer; address:pointer);

  TInternalState = record
    end;
  PInternalState = ^TInternalstate;

  TZStream = z_stream;
  PZstream = ^TZStream;

  gzFile = pointer;


const
  Z_NO_FLUSH = 0;

  Z_PARTIAL_FLUSH = 1;
  Z_SYNC_FLUSH = 2;
  Z_FULL_FLUSH = 3;
  Z_FINISH = 4;

  Z_OK = 0;
  Z_STREAM_END = 1;
  Z_NEED_DICT = 2;
  Z_ERRNO = -(1);
  Z_STREAM_ERROR = -(2);
  Z_DATA_ERROR = -(3);
  Z_MEM_ERROR = -(4);
  Z_BUF_ERROR = -(5);
  Z_VERSION_ERROR = -(6);

  Z_NO_COMPRESSION = 0;
  Z_BEST_SPEED = 1;
  Z_BEST_COMPRESSION = 9;
  Z_DEFAULT_COMPRESSION = -(1);

  Z_FILTERED = 1;
  Z_HUFFMAN_ONLY = 2;
  Z_DEFAULT_STRATEGY = 0;

  Z_BINARY = 0;
  Z_ASCII = 1;
  Z_UNKNOWN = 2;

  Z_DEFLATED = 8;

  Z_NULL = 0;

function zlibVersion:string;
function deflate(var strm:TZstream; flush:longint):longint;
function deflateEnd(var strm:TZstream):longint;
function inflate(var strm:TZstream; flush:longint):longint;
function inflateEnd(var strm:TZstream):longint;
function deflateSetDictionary(var strm:TZstream;dictionary : pchar; dictLength:uInt):longint;
function deflateCopy(var dest,source:TZstream):longint;
function deflateReset(var strm:TZstream):longint;
function deflateParams(var strm:TZstream; level:longint; strategy:longint):longint;
function inflateSetDictionary(var strm:TZStream;dictionary : pchar; dictLength:uInt):longint;
function inflateSync(var strm:TZStream):longint;
function inflateReset(var strm:TZStream):longint;
function compress(dest:pchar;var destLen:uLongf; source : pchar; sourceLen:uLong):longint;
function compress2(dest:pchar;var destLen:uLongf; source : pchar; sourceLen:uLong; level:longint):longint;
function uncompress(dest:pchar;var destLen:uLongf; source : pchar; sourceLen:uLong):longint;
function gzopen(path:pchar; mode:pchar):gzFile;
function gzsetparams(Thefile:gzFile; level:longint; strategy:longint):longint;
function gzread(thefile:gzFile; buf : pointer; len:cardinal):longint;
function gzwrite(thefile:gzFile; buf: pointer; len:cardinal):longint;
function gzputs(thefile:gzFile; s:pchar):longint;
function gzgets(thefile:gzFile; buf:pchar; len:longint):pchar;
function gzputc(thefile:gzFile; c:char):longint;
function gzgetc(thefile:gzFile):char;
function gzflush(thefile:gzFile; flush:longint):longint;
function gzseek(thefile:gzFile; offset:z_off_t; whence:longint):z_off_t;
function gzrewind(thefile:gzFile):longint;
function gztell(thefile:gzFile):z_off_t;
function gzeof(thefile:gzFile):longbool;
function gzclose(thefile:gzFile):longint;
function gzerror(thefile:gzFile; var errnum:longint):string;
function adler32(theadler:uLong;buf : pchar; len:uInt):uLong;
function crc32(thecrc:uLong;buf : pchar; len:uInt):uLong;
function deflateInit_(var strm:TZStream; level:longint; version:pchar; stream_size:longint):longint;
function inflateInit_(var strm:TZStream; version:pchar; stream_size:longint):longint;
function deflateInit2_(var strm:TZStream; level:longint; method:longint; windowBits:longint; memLevel:longint;strategy:longint; version:pchar; stream_size:longint):longint;
function inflateInit2_(var strm:TZStream; windowBits:longint; version:pchar; stream_size:longint):longint;
function deflateInit(var strm:TZStream;level : longint) : longint;
function inflateInit(var strm:TZStream) : longint;
function deflateInit2(var strm:TZStream;level,method,windowBits,memLevel,strategy : longint) : longint;
function inflateInit2(var strm:TZStream; windowBits : longint) : longint;
function zError(err:longint):string;
function inflateSyncPoint(z:PZstream):longint;
function get_crc_table:pointer;

implementation

uses
  zutil,zdeflate,zinflate,zcompres,zuncompr,gzio,adler,gzcrc;

function zlibVersion:string;
begin
  zlibversion:=zbase.zlibversion;
end;

function deflate(var strm:TZstream; flush:longint):longint;
begin
  deflate:=zdeflate.deflate(strm,flush);
end;

function deflateEnd(var strm:TZstream):longint;
begin
  deflateEnd:=zdeflate.deflateEnd(strm);
end;

function inflate(var strm:TZstream; flush:longint):longint;
begin
  inflate:=zinflate.inflate(strm,flush);
end;

function inflateEnd(var strm:TZstream):longint;
begin
  inflateEnd:=zinflate.inflateEnd(strm);
end;

function deflateSetDictionary(var strm:TZstream;dictionary : pchar; dictLength:uInt):longint;
begin
  deflateSetDictionary:=zdeflate.deflateSetDictionary(strm,pbytef(dictionary),dictlength);
end;

function deflateCopy(var dest,source:TZstream):longint;
begin
  deflateCopy:=zdeflate.deflateCopy(@dest,@source);
end;

function deflateReset(var strm:TZstream):longint;
begin
  deflateReset:=zdeflate.deflateReset(strm);
end;

function deflateParams(var strm:TZstream; level:longint; strategy:longint):longint;
begin
  deflateParams:=zdeflate.deflateParams(strm,level,strategy);
end;

function inflateSetDictionary(var strm:TZStream;dictionary : pchar; dictLength:uInt):longint;
begin
  inflateSetDictionary:=zinflate.inflateSetDictionary(strm,pbytef(dictionary),dictlength);
end;

function inflateSync(var strm:TZStream):longint;
begin
  inflateSync:=zinflate.inflateSync(strm);
end;

function inflateReset(var strm:TZStream):longint;
begin
  inflateReset:=zinflate.inflateReset(strm);
end;

function compress(dest:pchar;var destLen:uLongf; source : pchar; sourceLen:uLong):longint;
begin
  compress:=zcompres.compress(pbytef(dest),destlen,pbytef(source),sourcelen);
end;

function compress2(dest:pchar;var destLen:uLongf; source : pchar; sourceLen:uLong; level:longint):longint;
begin
  compress2:=zcompres.compress2(pbytef(dest),destlen,pbytef(source),sourcelen,level);
end;

function uncompress(dest:pchar;var destLen:uLongf; source : pchar; sourceLen:uLong):longint;
begin
  uncompress:=zuncompr.uncompress(pbytef(dest),destlen,pbytef(source),sourcelen);
end;

function gzopen(path:pchar; mode:pchar):gzFile;
begin
  gzopen:=gzio.gzopen(path,mode);
end;

function gzsetparams(Thefile:gzFile; level:longint; strategy:longint):longint;
begin
  gzsetparams:=gzio.gzsetparams(thefile,level,strategy);
end;

function gzread(thefile:gzFile; buf : pointer; len:cardinal):longint;
begin
  gzread:=gzio.gzread(thefile,buf,len);
end;

function gzwrite(thefile:gzFile; buf: pointer; len:cardinal):longint;
begin
  gzwrite:=gzio.gzwrite(thefile,buf,len);
end;

function gzputs(thefile:gzFile; s:pchar):longint;
begin
  gzputs:=gzio.gzputs(thefile,s);
end;

function gzgets(thefile:gzFile; buf:pchar; len:longint):pchar;
begin
  gzgets:=gzio.gzgets(thefile,buf,len);
end;

function gzputc(thefile:gzFile; c:char):longint;
begin
  gzputc:=gzio.gzputc(thefile,c);
end;

function gzgetc(thefile:gzFile):char;
begin
  gzgetc:=chr(gzio.gzgetc(thefile));
end;

function gzflush(thefile:gzFile; flush:longint):longint;
begin
  gzflush:=gzio.gzflush(thefile,flush);
end;

function gzseek(thefile:gzFile; offset:z_off_t; whence:longint):z_off_t;
begin
  gzseek:=gzio.gzseek(thefile,offset,whence);
end;

function gzrewind(thefile:gzFile):longint;
begin
  gzrewind:=gzio.gzrewind(thefile);
end;

function gztell(thefile:gzFile):z_off_t;
begin
  gztell:=gzio.gztell(thefile);
end;

function gzeof(thefile:gzFile):longbool;
begin
  gzeof:=gzio.gzeof(thefile);
end;

function gzclose(thefile:gzFile):longint;
begin
  gzclose:=gzio.gzclose(thefile);
end;

function gzerror(thefile:gzFile; var errnum:longint):string;
begin
  gzerror:=gzio.gzerror(thefile,errnum);
end;

function adler32(theadler:uLong;buf : pchar; len:uInt):uLong;
begin
  adler32:=adler.adler32(theadler,pbytef(buf),len);
end;

function crc32(thecrc:uLong;buf : pchar; len:uInt):uLong;
begin
  crc32:=gzcrc.crc32(thecrc,pbytef(buf),len);
end;

function deflateInit_(var strm:TZStream; level:longint; version:pchar; stream_size:longint):longint;
begin
  deflateInit_:=zdeflate.deflateInit_(@strm,level,version,stream_size);
end;

function inflateInit_(var strm:TZStream; version:pchar; stream_size:longint):longint;
begin
  inflateInit_:=zinflate.inflateInit_(@strm,version,stream_size);
end;

function deflateInit2_(var strm:TZStream; level:longint; method:longint; windowBits:longint; memLevel:longint;strategy:longint; version:pchar; stream_size:longint):longint;
begin
  deflateInit2_:=zdeflate.deflateInit2_(strm,level,method,windowBits,memlevel,strategy,version,stream_size);
end;

function inflateInit2_(var strm:TZStream; windowBits:longint; version:pchar; stream_size:longint):longint;
begin
  inflateInit2_:=zinflate.inflateInit2_(strm,windowBits,version,stream_size);
end;

function deflateInit(var strm:TZStream;level : longint) : longint;
begin
  deflateInit:=zdeflate.deflateInit(strm,level);
end;

function inflateInit(var strm:TZStream) : longint;
begin
  inflateInit:=zinflate.inflateInit(strm);
end;

function deflateInit2(var strm:TZStream;level,method,windowBits,memLevel,strategy : longint) : longint;
begin
  deflateInit2:=zdeflate.deflateInit2(strm,level,method,windowbits,memlevel,strategy);
end;

function inflateInit2(var strm:TZStream; windowBits : longint) : longint;
begin
  inflateInit2:=zinflate.inflateInit2_(strm,windowBits,ZLIB_VERSION,sizeof(TZStream));
end;

function zError(err:longint):string;
begin
  zerror:=zbase.zerror(err);
end;

function inflateSyncPoint(z:PZstream):longint;
begin
  inflateSyncPoint:=zinflate.inflateSyncPoint(z^);
end;

function get_crc_table:pointer;
begin
  get_crc_table:=gzcrc.get_crc_table;
end;

end.