#!/bin/perl # Perl output for Thutu2 file forte.t22 $_="=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) { s/^(.*)=x(.*)=:%x/$2=:$1=x/ and next; s/=:=x/=:%x/ and next; while(not(// or /=9/ or /=:%x/ or 0)) {do { s/^([0-9])/=n$1/ and next; s/=1// and next; s/=x/=n/ and next; s/=n=n/=n/ and next; s/REM[^=]/REM/ and next; s/REM=[^n]/REM/ and next; s/(PRINT[^=]*)=\"=\"=;/$1\~/ and next; s/(PRINT[^=]*)=\"=\"/$1\~61\~110\~/ and next; /PRINT[^=]*=\"(.)()/ and do{$c=ord($1);$e=$1eq$2;$g=$1gt$2;$u=uc($1);$l=lc($1);}; s/(PRINT[^=]*)=\"./$1\~$c=\"/ and next; s/=t// and next; s/=v// and next; s/=f// and next; s/=r// and next; s/=([()])/%$1/ and next; s/ // and next; s/LET([^=%][^:nq]*)=q([^:nq]*[:n])/LET%\{$1%\}=q%\{$2%\}/ and next; s/PRINT([^=%~;][^:n;]*?)=([:n;])/PRINT%\{$1%\}=$2/ and next; s/%\(/%\{/ and next; s/%\)/%\}/ and next; s/=n%\}/%\}=n/ and next; s/=:%\}/%\}=:/ and next; s/([^{0-9~])([0-9]+)([^0-9~])/$1%\{$2%\}$3/ and next; s/([^0-9~])([0-9]+)([^}%0-9~]|%[^}])/$1%\{$2%\}$3/ and next; last;}}; while(not(// or 0)) {do { s/=9/<0>%,

/ and next; last;}}; // and s/=9// and next; while(// and 1) {do { /^61\~110\~/ and last; /[^0-9]61\~110\~/ and last; s/%\{/%\(/ and next; s/%\}/%\)/ and next; /<([0-9]+)%\+(1)>/ 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/<[0-9]+%\+1>/<$s>/ and next; s/%\,(%\([0-9]+%\))\1// and next; s/%\,(%\([0-9]+%\))(%\([0-9]+%\))%\,(.*)\1/%\,$1$2%\,$3$2/ and next; s/<([0-9]+)>/<$1%\+1>/ and next; s/%\[([0-9]+)%\]/$1/ and next; /%\[([0-9]+)=\+([0-9]+)%\]/ 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/%\[[0-9]+=\+[0-9]+%\]/%\($s%\)/ and next; /%\[([0-9]+)=\-([0-9]+)%\]/ 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/%\[[0-9]+=\-[0-9]+%\]/%\($d%\)/ and next; /%\[([0-9]+)=\*([0-9]+)%\]/ 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/%\[[0-9]+=\*[0-9]+%\]/%\($p%\)/ and next; /%\[([0-9]+)=\/([0-9]+)%\]/ 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/%\[[0-9]+=\/[0-9]+%\]/%\($v%\)/ and next; s/([^):n]*)%\(([^)]*)%\)/$1%\[$2%\]/ and next; s/(.*)([^:]*?)=n/$1$2=n/ and next; s/(.*)([^:n]*?)=:([^:n]*[:n])/$3$1$2=:$3/ and next; while(not(// or // or // or 0)) {do { s/<([0-9]+)>(.*)

(.*)=n%\(\1%\)([^<][^:n]*[:n])/$4<$1>$2

$3=n%\($1%\)$4/ and next; last;}}; s/// and next; s/(.*)REM/$1REM/ and next; s/(.*)(.*)(.*)LET([0-9]+)=q([0-9]+)=[:n]/$2%\,%\($4%\)%($5%\)$3$1/ and next; s/^(.*)(.*)(.*)(.*)PRINT\~([^=]*)=[:n]/$1$5$2$4$3/ and next; s/^(.*)(.*)(.*)(.*)PRINT([0-9]+)=;=[:n]/$1$5\^$2$4$3/ and next; s/^(.*)(.*)(.*)(.*)PRINT([0-9]+)=[:n]/$1$5\^61\~110\~$2$4$3/ and next; s/.*END.*$/=9/ and next; s/// and next; last;}}; // and do {while(1) { while(not(/^\~/ or 0)) {do { s/^/\~/ and next; last;}}; s//%%0%%=x<%o%>/ and next; /[~^]([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/([~^])([0-9]+)\~%%0%%/$1%%0%%$c/ and next; s/([~^])([0-9]+)\^%%0%%/$1%%0%%$2/ and next; while(1) {do { s/^\~%%0%%// and next; s/<%o%>// and next; last;}}; 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=<>; };