diff options
author | B. Watson <yalhcru@gmail.com> | 2016-02-27 17:38:06 -0500 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2016-02-27 17:38:06 -0500 |
commit | c82d5178ae3aab0fdfc2be339b5e0ff54ac558e1 (patch) | |
tree | 375cf641c751bf6a9c6c150252db9d66b148e745 | |
parent | f6e4f4cf4f61c4d230fb0b141bbab29ef9a66b86 (diff) | |
download | taipan-c82d5178ae3aab0fdfc2be339b5e0ff54ac558e1.tar.gz |
use dictionary entries for M_taipan, etc. 7720 bytes free.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | messages.pl | 12 | ||||
-rw-r--r-- | textdecomp.s | 2 |
4 files changed, 20 insertions, 0 deletions
@@ -1,3 +1,4 @@ +msg.inc messages.c msg.out msg.tmp @@ -297,6 +297,11 @@ convfont: convfont.c textcomp: textcomp.c $(HOSTCC) $(HOSTCFLAGS) -o textcomp textcomp.c +# textdecomp.s includes msg.inc +textdecomp.s: msg.inc + +msg.inc: messages.c + # messages.c is a generated file messages.c: messages.pl textcomp perl messages.pl > messages.c diff --git a/messages.pl b/messages.pl index 1120a8b..61ae824 100644 --- a/messages.pl +++ b/messages.pl @@ -13,6 +13,7 @@ open my $t, "<textdecomp.s" or die $!; while(<$t>) { next unless /^dict(\d\d):.*;\s*"([^"]*)"/; my $id = $1; + my $dictlabel = "dict$1"; if($id < 27) { $id = chr($id + 96); } else { @@ -21,6 +22,7 @@ while(<$t>) { my $value = 'Z' . $id; my $key = quotemeta $2; $dictionary{$key} = $value; + $dictlabels{$value} = $dictlabel; } close $t; @@ -29,6 +31,8 @@ close $t; #} #exit 0; +open ASMINC, ">msg.inc" or die $!; +print ASMINC "; do not edit, contents are generated by messages.pl\n\n"; print "// do not edit, contents are generated by messages.pl\n\n"; while(<DATA>) { @@ -53,6 +57,14 @@ while(<DATA>) { } } +# if a string turns out to be exactly a dict entry, no need to include +# the compressed version in messages.c. + if(/^Z.$/) { + print "\nextern const char M_$label\[\]; // dictionary used, $dictlabels{$_}\n\n"; + print ASMINC " _M_$label = $dictlabels{$_}\n .export _M_$label\n\n"; + next; + } + if(@ARGV) { my $w = $_; $w =~ s/\n/\\n/g; diff --git a/textdecomp.s b/textdecomp.s index fa82d7e..403507c 100644 --- a/textdecomp.s +++ b/textdecomp.s @@ -167,6 +167,8 @@ dict_offsets: dictsize = * - dict00 .out .sprintf("dictionary plus dict_offsets is %d bytes", dictsize) + .include "msg.inc" + .rodata table: ; outsnac values 53..63 .byte ' ', '!', '%', ',', '.', '?', ':', 39, 40, 41, $9b |