text
stringlengths
0
99.6k
ENDIF
IF switch 1 is an A or a C then create archive.
IF switch 1 is an X, P, or V then extract archive.
IF switch 1 is an L then archive directory.
IF switch 1 is an F then fix XMODEM padding.
ARC VERSION 2.20 PAGE - 43
CREATE ARCHIVE
WHILE still more parameters (2,3,4,...9)
Make a directory name ($d:xxxx) out of the
parameter and load the directory into RAM.
FOR each filename in the directory
1) analyze the file
2) compress the file using
the best compressor.
NEXT file
NEXT parameter
ENDWHILE
Close archive
STOP
ARC VERSION 2.20 PAGE - 44
Analyze the File.
OPEN the file to be analyzed for read.
SET stored, packed, squeezed, squashed, and crunched
lengths to zero.
SET the checksum to zero.
SET the squeeze and squash frequency distributions
to zero.
FOR each byte in the file.
Increment the stored (original) length.
Adjust the checksum.
Adjust the squeeze frequency distribution.
IF output required for PACK THEN
Increment the packed files length.
Adjust the squash frequency distribution.
IF output required for CRUNCH THEN
Adjust the crunched files length.
NEXT byte
CLOSE input file
Generate the squeeze Huffman codes and calculate
the squeezed file length as
sum(code length * frequency)+header
Generate the squash Huffman codes and calculate
the squashed file length as
sum(code length * frequency)+header
Calculate which is the shortest length.
store, pack, squeeze, squash, or crunch.
DONE analyzing the file.
ARC VERSION 2.20 PAGE - 45
Compress the file.
Write the file header.
If the file is packed then write the control character.
(always 254 for version 2.xx) Version 1.xx selects
the byte which occurs least often in the input file
as the control character.
If the file is squeezed or squashed then write the
appropriate Huffman encoding table.
OPEN the file to be compressed.