aboutsummaryrefslogtreecommitdiff
path: root/textcomp.c
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-02-21 22:11:22 -0500
committerB. Watson <yalhcru@gmail.com>2016-02-21 22:11:22 -0500
commit4d68a8b59817a70922c9818ef208a57838961129 (patch)
tree2213a4134d71ebf68b48d9a4f816e66d1f95d91f /textcomp.c
parent784cf3334d4a38d3b4caeb86ed92d8ead8d06a3b (diff)
downloadtaipan-4d68a8b59817a70922c9818ef208a57838961129.tar.gz
more text compression, 7054 bytes free
Diffstat (limited to 'textcomp.c')
-rw-r--r--textcomp.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/textcomp.c b/textcomp.c
index 1ff769f..bb0b4c0 100644
--- a/textcomp.c
+++ b/textcomp.c
@@ -4,7 +4,28 @@
Example: "Taipan" (7 bytes, including null terminator) encodes as
0xb8 0x12 0x50 0x04 0xe0 0x00 (6 bytes).
- Longer strings approach 75% compression ratio.
+ Longer strings approach 75% compression ratio. Sadly, the result
+ has to be padded to an 8-bit byte boundary, or else we'd get 75%
+ for every string.
+
+ Input length | Encoded length | Ratio
+ (incl. null) | |
+ 2 | 2 | 100%, don't bother
+ 3 | 3 | 100%, don't bother
+ 4 | 3 | 75%
+ 5 | 4 | 80%
+ 6 | 5 | 83%
+ 7 | 6 | 86%
+ 8 | 6 | 75%
+ 9 | 7 | 78%
+ 10 | 8 | 80%
+ 11 | 9 | 82%
+ 12 | 9 | 75%
+ 13 | 10 | 77%
+ 14 | 11 | 79%
+ 15 | 12 | 80%
+ 16 | 12 | 75%
+ ...etc etc
No encoded string can be over 256 bytes long, as the decompressor
can't currently handle it.
@@ -38,6 +59,8 @@
print an encoded message. The decoding step slows down printing a bit,
but it's not really noticeable. cputc() is used for printing, so it
respects the reverse video setting (set by rvs_on() and rvs_off()).
+ The task of replacing cputs("some string") with print_msg(M_some_string)
+ is done manually.
When a newline is printed, the decoder always prints a carriage
return first. Any \r sequences listed in messages.pl are discarded