From b37ac0ede97639931bd540fe34848eb8bf52764b Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 26 Feb 2016 16:26:32 -0500 Subject: more dict entries, better comments, fix cart docs --- messages.pl | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'messages.pl') diff --git a/messages.pl b/messages.pl index 0d68f4d..1120a8b 100644 --- a/messages.pl +++ b/messages.pl @@ -2,7 +2,11 @@ # compresses messages for taipan.c. # messages are listed at the end of this file after __END__ marker. +# Run with no arguments to encode all messages, in which case the # output of this script should be redirected to messages.c. +# With an argument, encoding is not done: instead, the strings +# to be encoded are dumped to stdout, *after* dictionary +# substitution is done. # make dictionary from textdecomp.s comments open my $t, ") { s/^\w+\s+//; my $orig = $_; - #warn "msg: $_\n"; + print " input: $_\n" if @ARGV; s/"//g; s/\\r//g; s/\\n/\n/g; @@ -49,9 +53,12 @@ while() { } } - my $w = $_; - $w =~ s/\n/\\n/g; - #warn "got: \"$w\"\n"; + if(@ARGV) { + my $w = $_; + $w =~ s/\n/\\n/g; + print "output: \"$w\"\n\n"; + next; + } open my $out, ">msg.out" or die $!; print $out $_; close $out; @@ -69,6 +76,8 @@ while() { print "\n};" . ($dict_used ? " // dictionary used" : "") . "\n\n"; } +exit 0 if @ARGV; + print "// messages: $msgcount\n"; print "// total input size: $total_in\n"; print "// total output size: $total_out\n"; -- cgit v1.2.3