Debian Codegraph @

format_docs/tcr.txt

raw
1 About
2 -----
3
4 Text compression format that can be decompressed starting at any point.
5 Little-endian byte ordering is used.
6
7
8 Header
9 ------
10
11 TCR files always start with:
12
13 !!8-Bit!!
14
15
16 Layout
17 ------
18
19 Header
20 256 key dictionary
21 compressed text
22
23
24 Dictionary
25 ----------
26
27 A dictionary of key and replacement string. There are a total of 256 keys,
28 0 - 255. Each string is preceded with one byte that represents the length of
29 the string.
30
31
32 Compressed text
33 ---------------
34
35 The compressed text is a series of values 0-255 which correspond to a key and
36 thus a string. Reassembling is replacing each key in the compressed text with
37 its corresponding string.
38
39
40 Compressor
41 -----------------
42
43 From Andrew Giddings TCR.c (http://www.cix.co.uk/~gidds/Software/TCR.html):
44
45 The TCR compression format is easy to describe: after the fixed header is a
46 dictionary of 256 strings, each preceded by a length byte. The rest of the
47 file is a list of codes from this dictionary.
48
49 The compressor works by starting with each code defined as itself. While
50 there's an unused code, it finds the most common two-code combination, and
51 creates a new code for it, replacing all occurrences in the text with the
52 new code.
53
54 It also searches for codes that are always followed by another, which it can
55 merge, possibly freeing up some.
56