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 /messages.pl | |
parent | f6e4f4cf4f61c4d230fb0b141bbab29ef9a66b86 (diff) | |
download | taipan-c82d5178ae3aab0fdfc2be339b5e0ff54ac558e1.tar.gz |
use dictionary entries for M_taipan, etc. 7720 bytes free.
Diffstat (limited to 'messages.pl')
-rw-r--r-- | messages.pl | 12 |
1 files changed, 12 insertions, 0 deletions
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; |