Function Hex(num: integer): HexStr; Const h: String[16]='0123456789ABCDEF'; Var i, j: integer; str: hexstr; begin Str:='0000'; j:=num; For i:=4 DownTo 1 do begin Str[i]:=h[succ(j and $F)]; j:=j shr 4; end; Hex:=Str; end; { Function Hex } { getw - get a word value from the input file } Function GetW: integer; Var in1,in2: char; begin ReadInFile(In1); ReadInFile(In2); GetW:=ord(in1) + ord(in2) shl 8; end; { Function GetW } Function GetI: integer; Var ch: Char; begin ReadInFile(ch); GetI:=ord(ch); end; { Function GetI } Function GetUHuff: char; Var i: integer; begin i:=0; Repeat BPos:=succ(BPos); If BPos>7 then begin CurIn:=GetI; BPos:=0; end else CurIn:=CurIn shr 1; i:=ord(DNode[i,ord(CurIn and $0001)]); Until (i<0); i:=-(succ(i)); If i=SpEOF then begin EoFile:=true; GetuHuff:=chr(26) end else GetUHuff:=chr(i); end; { Function GetUHuff } Function GetCr: char; var C: char; begin If (RepCt>0) then begin RepCt:=pred(RepCt); GetCr:=LastChar; end else begin C:=GetuHuff; If C<>DLE then begin GetCr:=C; LastChar:=C; end else begin RepCt:=ord(GetuHuff); If RepCt=0 then GetCr:=DLE else begin RepCt:=pred(pred(RepCt)); GetCr:=LastChar; end; end; end; end; { Function GetCr }