text
stringlengths 0
99.6k
|
|---|
offset length description
|
------ ------ -----------
|
0 1 version 1 for ARC 1.xx
|
2 for ARC 2.xx
|
1 1 storage. 0=store 1=pack
|
2=squeez 3=crunch
|
4=squash 5=1 pass crunch
|
2 2 checksum lo,hi
|
4 3 original length-(bytes) lo,mid,hi
|
7 2 squeezed length-(blocks) lo,hi
|
9 1 file type. s,p,u or r
|
10 1 length of filename
|
11 n filename
|
The following additional bytes occur if version is 2
|
or higher.
|
11+n 1 record length if relative file.
|
(254 otherwise)
|
11+n+1 2 date in MS-DOS format.
|
bits: 0-4 = day
|
5-8 = month
|
9-15= year-1980
|
The file data follows starting at offset 11+n+2.
|
If the file is stored, then a copy of the file
|
follows. The number of bytes are specified at offset 4 in
|
the header.
|
If the file is packed, then ARCs numbered 1.xx will
|
choose the byte which occurs least often in the file as the
|
control character. ARCs numbered 2.xx always use 254 as the
|
control character. The control character is stored at offset
|
11+n+2 in the header and is followed by the packed file. A
|
control sequence is <control char> <count> <character to
|
repeat>. Count can be between 3 and 256, with 0 being 256.
|
ARCs numbered less than 2.00 had a bug in the pack routines.
|
To compensate for this bug, a count of zero should be
|
replaced by a count of 255, and the file will un-pack
|
properly. This bug has been corrected in ARCs numbered 2.00
|
or higher.
|
ARC VERSION 2.20 PAGE - 39
|
If the file is squeezed, squashed or crunched, then it
|
must be read one bit at a time from here on in. ARC fills a
|
byte from right to left, so the bits will appear differently
|
if you look at them with a disk doctor, but this is the
|
order in which they are written to the file.
|
Squeezed file encoding table.
|
L0 C0 L1 C1 L2 C2 ... L255 C255
|
Since each code can be as long as 24 bits, each length
|
is 5 bits long. Thus L0 is the length of the Huffman code
|
for ascii 0, and C0 is the actual Huffman code. The total
|
length of the encoding table is then:
|
(5 * 256) + sum(code lengths) ... in bits
|
If an ascii value does not occur in the file, its code
|
length will be zero and the bit immediately following will
|
be the length for the next ascii value. This is why when you
|
squeeze a text file, there are alot of zeros near the
|
beginning of the archive entry. There are alot of unused
|
ascii values.
|
Immediately following the last BIT of the encoding
|
table is the actual file represented by its Huffman codes.
|
When unsqueezing a file, ARC reads in the lengths and
|
codes and inserts them into tables so that they remain
|
sorted on the code length. If our tree was:
|
e m p a
|
/ / / /
|
root - - - - r
|
The tables would look like this after reading in the
|
encoding table.
|
ascii length code
|
----- ------ ----
|
e 1 00000000 00000000 00000000
|
m 2 00000000 00000000 00000010
|
p 3 00000000 00000000 00000110
|
a 4 00000000 00000000 00001110
|
r 4 00000000 00000000 00001111
|
The word "ampere" would be stored on disk as:
|
1110 10 110 0 1111 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.