tBuf) -4) then
begin
BlockWrite (OutputF, OutBuf, OutCounter, NumWritten);
OutCounter: = 0;
end;
CounterBite: = CounterBite-8;
If CounterBite0 then OutWord: = OutWord SHL 8 else OutWord: = 0;
end;
If Tail then
begin
Mask: = CodeTable [InBuf [InCounter]] ^. BiteChain SHL
(CodeTable [InBuf [InCounter]] ^. LengthBiteChain-CounterBite);
OutWord: = OutWord OR Mask;
end;
Inc (InCounter);
If (InCounter = (SizeOf (InBuf))) or (InCounter = NumRead) then
begin
InCounter: = 0;
BlockRead (InputF, InBuf, SizeOf (InBuf), NumRead);
end;
end;
procedure PakFile;
{--- процедура безпосереднього стиснення файлу ---}
begin
ResetFile;
SearchNameInArchiv;
If NormalWork then
begin
BlockRead (InputF, InBuf, SizeOf (InBuf), NumRead);
OutWord: = 0;
CounterBite: = 0;
OutCounter: = 0;
InCounter: = 0;
CRC: = 0;
CreateCodeArchiv;
While (NumRead0) do PakOneByte;
OutBuf [OutCounter]: = Hi (OutWord);
Inc (OutCounter);
OutBuf [OutCounter]: = CRC;
Inc (OutCounter);
BlockWrite (OutputF, OutBuf, OutCounter, NumWritten);
DisposeCodeTable;
ClosePakFile;
end;
end;
procedure ResetUnPakFiles;
{ --- Відкриття файлу для розпакування ---}
begin
InCounter: = 7;
St: ='';
repeat
St [InCounter-7]: = Chr (InBuf [InCounter]);
Inc (InCounter);
until InCounter = InBuf [7] +8;
Assign (InterF, St);
Rewrite (InterF, 1);
ErrorByte: = IOResult;
ErrorMessage;
If NormalWork then
begin
WriteLn ('UnPak file:', St, '...');
Move (InBuf [InCounter], TimeUnPakFile, 4);
InCounter: = InCounter +4;
AttrUnPakFile: = InBuf [InCounter];
Inc (InCounter);
Move (InBuf [InCounter], LengthArcFile, 4);
InCounter: = InCounter +4;
end;
end;
procedure CloseUnPakFile;
{--- закриття файлу для розпакування ---}
begin
If not NormalWork then Erase (InterF)
else
begin
SetFAttr (InterF, AttrUnPakFile);
SetFTime (InterF, TimeUnPakFile);
end;
Close (InterF);
end;
procedure RestoryCodeTable;
{--- відтворення кодової таблиці з архівної файлу ---}
Var I: byte;
begin
InitCodeTable;
For I: = 0 to 255 do
begin
CodeTable [I] ^. CounterEnter: = InBuf [InCounter];
CodeTable [I] ^. CounterEnter: = CodeTable [I] ^. CounterEnter SHL 8;
Inc (InCounter);
CodeTable [I] ^. CounterEnter: = CodeTable [I] ^. CounterEnter + InBuf [InCoun...