home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / TURBOPAS / SQZTURBO.LBR / USQZMAIN.INC < prev   
Text File  |  2000-06-30  |  2KB  |  67 lines

  1. Function Hex(num: integer): HexStr;
  2.  Const h: String[16]='0123456789ABCDEF';
  3.   Var i, j:    integer;
  4.       str:     hexstr;
  5.   begin
  6.     Str:='0000'; j:=num;
  7.     For i:=4 DownTo 1 do
  8.       begin
  9.         Str[i]:=h[succ(j and $F)]; j:=j shr 4;
  10.       end;
  11.     Hex:=Str;
  12.   end; { Function Hex }
  13.  
  14. { getw - get a word value from the input file }
  15. Function GetW: integer;
  16.   Var in1,in2: char;
  17.   begin
  18.     ReadInFile(In1); ReadInFile(In2);
  19.     GetW:=ord(in1) + ord(in2) shl 8;
  20.   end; { Function GetW }
  21.  
  22. Function GetI: integer;
  23.   Var ch: Char;
  24.   begin
  25.     ReadInFile(ch); GetI:=ord(ch);
  26.   end; { Function GetI }
  27.  
  28. Function GetUHuff: char;
  29.   Var i: integer;
  30.   begin
  31.     i:=0;
  32.     Repeat
  33.       BPos:=succ(BPos);
  34.       If BPos>7 then
  35.         begin
  36.           CurIn:=GetI; BPos:=0;
  37.         end
  38.       else CurIn:=CurIn shr 1;
  39.       i:=ord(DNode[i,ord(CurIn and $0001)]);
  40.     Until (i<0);
  41.     i:=-(succ(i));
  42.     If i=SpEOF then
  43.       begin
  44.         EoFile:=true; GetuHuff:=chr(26)
  45.       end
  46.     else GetUHuff:=chr(i);
  47.   end; { Function GetUHuff }
  48.  
  49. Function GetCr: char;
  50.   var C: char;
  51.   begin
  52.     If (RepCt>0) then
  53.       begin RepCt:=pred(RepCt); GetCr:=LastChar; end
  54.     else
  55.       begin
  56.         C:=GetuHuff;
  57.         If C<>DLE then begin GetCr:=C; LastChar:=C; end
  58.         else
  59.           begin
  60.             RepCt:=ord(GetuHuff);
  61.             If RepCt=0 then GetCr:=DLE
  62.             else begin RepCt:=pred(pred(RepCt)); GetCr:=LastChar; end;
  63.           end;
  64.       end;
  65.   end; { Function GetCr }
  66.  
  67.