#!/bin/perl
# Perl output generated from a Thutu2 file.
$_="=1";
$row="";
$ninequit=0;
while(!$ninequit)
{
$row =~ s/=/=q/g;
$row =~ s/\t/=t/g;
$row =~ s/\n/=x/g; # The newline at the end of the line becomes =x
$row =~ s/\r/=r/g;
$row =~ s/\f/=f/g;
$row =~ s/\a/=a/g;
$row =~ s/\e/=e/g;
$row =~ s/([!-\/:-<>-@[-`{-~])/=$1/g; #`
defined($row) or $row = '=9';
$_ = $row . $_;
while(1) {
while(not(/=1/ or /=9/ or 0)) {do {
s/^(.*)=x/M$1/ and next;
s/=[^x~?!]/*/ and next;
s/=([^x])/$1/ and next;
s/^M\?((..)*.)$/S$1/ and next;
s/^M\?((..)*)$/C%%$1/ and next;
s/%%\?/!%%/ and next;
s/%%!/~%%/ and next;
s/%%~/?%%/ and next;
s/^C(.*)%%/S$1/ and next;
s/^M~(.*)$/S$1$1/ and next;
/^M(.*)()/ and do{$c=ord($1);$e=$1eq$2;$g=$1gt$2;$u=uc($1);$l=lc($1);$g=length($1);};
s/^M/P$g:128:/ and next;
/^P([0-9]+):(128):/ and do {$s=$1+$2;$p=$1*$2;$d=$1-$2;$m=0;$2 and $m=$1%$2;$g=$1>$2;$c=chr($1);$e=$1==$2;$q=0;$2 and $q=$1/$2;$v=int($q);};
s/^P([0-9]+):(128):/P$m:0:/ and next;
/^P([0-9]+):(0):/ and do {$s=$1+$2;$p=$1*$2;$d=$1-$2;$m=0;$2 and $m=$1%$2;$g=$1>$2;$c=chr($1);$e=$1==$2;$q=0;$2 and $q=$1/$2;$v=int($q);};
s/^P([0-9]+):(0):/P-$c-/ and next;
/^P-([^a]|[^b])-/ and print $1;
s/^P-([^a]|[^b])-./S/ and next;
s/^S!(.*)$/M$1$1/ and next;
s/^S\?/R--/ and next;
s/--(.*)(.)$/$2--$1/ and next;
s/^R(.*)--/M$1/ and next;
/^S(.*)()/ and do{$c=ord($1);$e=$1eq$2;$g=$1gt$2;$u=uc($1);$l=lc($1);$g=length($1);};
s/^S.*$/O$g/ and next;
/^O(.*)$/ and print $1;
s/^O(.*)$/=n=x=9/ and next;
last;}};
while(/=1/ and 1) {do {
s/=1// and next;
last;}};
last; }
s/=9// and $ninequit=1;
if(s/(.*?)=x//) # =x marks the end of what to print out.
{
$orow=$1;
$orow =~ s/=t/\t/g;
$orow =~ s/=n/\n/g; # =n converts back to newline.
$orow =~ s/=r/\r/g;
$orow =~ s/=f/\f/g;
$orow =~ s/=a/\a/g;
$orow =~ s/=e/\e/g;
$orow =~ s/=([!-\/:-<>-@[-`{-~])/$1/g; #`
$orow =~ s/=q/=/g;
# print "\n"; # DEBUG
print $orow;
}
# Perl changes input source on EOF, but we want to continue in an EOF
# condition after EOF is reached.
$ninequit or ($row eq '=9' and scalar($row = undef, 1)) or $row=<>;
};