3 {
4 inffast.h and
5 inffast.c -- process literals and length/distance pairs fast
6 Copyright (C) 1995-1998 Mark Adler
8 Pascal tranlastion
9 Copyright (C) 1998 by Jacques Nomssi Nzali
10 For conditions of distribution and use, see copyright notice in readme.txt
11 }
14 interface
16 {$I imzconf.inc}
18 uses
19 {$ifdef DEBUG}
21 {$ENDIF}
32 implementation
34 uses
35 iminfutil;
38 { Called with number of bytes left to write in window at least 258
39 (the maximum string length) and number of input bytes available
40 at least ten. The ten bytes are six bytes for the longest length/
41 distance pair plus four bytes for overloading the bit buffer. }
50 var
64 begin
65 { load input, output, bit values (macro LOAD) }
73 else
76 { initialize masks }
80 { do until not enough input or output space for fast loop }
82 { get literal/length code }
85 begin
96 begin
97 {DUMPBITS(t^.bits);}
100 {$IFDEF DEBUG}
103 else
105 {$ENDIF}
109 continue;
111 repeat
112 {DUMPBITS(t^.bits);}
117 begin
118 { get extra bits for length }
121 {DUMPBITS(e);}
124 {$IFDEF DEBUG}
126 {$ENDIF}
127 { decode distance base of block to copy }
130 begin
139 repeat
140 {DUMPBITS(t^.bits);}
145 begin
146 { get extra bits to add to distance base }
150 begin
158 {DUMPBITS(e);}
162 {$IFDEF DEBUG}
164 {$ENDIF}
165 { do the copy }
173 end
175 begin
180 begin
182 repeat
197 break;
198 end
199 else
201 begin
204 end
205 else
206 begin
208 {UNGRAB}
215 {UPDATE}
224 exit;
227 break;
230 begin
231 {t += t->base;
232 e = (t += ((uInt)b & inflate_mask[e]))->exop;}
237 begin
238 {DUMPBITS(t^.bits);}
242 {$IFDEF DEBUG}
245 else
247 {$ENDIF}
251 break;
253 end
254 else
256 begin
257 {$IFDEF DEBUG}
259 {$ENDIF}
260 {UNGRAB}
267 {UPDATE}
275 exit;
276 end
277 else
278 begin
280 {UNGRAB}
287 {UPDATE}
295 exit;
300 { not enough input or output--restore pointers and return }
301 {UNGRAB}
308 {UPDATE}