aboutsummaryrefslogtreecommitdiff
path: root/messages.pl
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-02-25 17:37:18 -0500
committerB. Watson <yalhcru@gmail.com>2016-02-25 17:37:18 -0500
commit3da4662976b697f203498b79e46e85ae8df01981 (patch)
treecdccc7bccfa6efddcc8e6a250dc471a57d09ad98 /messages.pl
parent9dc7267a351b79ac5b855e812520362f28922341 (diff)
downloadtaipan-3da4662976b697f203498b79e46e85ae8df01981.tar.gz
dictionary now full, 7678 bytes free
Diffstat (limited to 'messages.pl')
-rw-r--r--messages.pl11
1 files changed, 9 insertions, 2 deletions
diff --git a/messages.pl b/messages.pl
index d225d17..fe94a35 100644
--- a/messages.pl
+++ b/messages.pl
@@ -8,7 +8,13 @@
open my $t, "<textdecomp.s" or die $!;
while(<$t>) {
next unless /^dict(\d\d):.*;\s*"([^"]*)"/;
- my $value = 'Z' . chr($1 + 96);
+ my $id = $1;
+ if($id < 27) {
+ $id = chr($id + 96);
+ } else {
+ $id = chr($id - 27 + 65);
+ }
+ my $value = 'Z' . $id;
my $key = quotemeta $2;
$dictionary{$key} = $value;
}
@@ -37,12 +43,13 @@ while(<DATA>) {
$total_in += (1 + length);
my $dict_used = 0;
- for my $dk (keys %dictionary) {
+ for my $dk (sort { length $b <=> length $a } keys %dictionary) {
if(s/$dk/$dictionary{$dk}/g) {
$dict_used = 1;
}
}
+ #warn "'$_'\n" if $label eq 'do_you_want';
open my $out, ">msg.out" or die $!;
print $out $_;
close $out;