#!/usr/bin/perl -n
#Function: Convert arithmetic IF into IF-THEN-ELSE with GOTOs.
# Usage: this.pl <file to convert> > <converted file>
######################################
chop;
$bar="                                      ";
if ((/^[^c](.*)/)&&(/(.*)if\s*\((.*)\)\s*(\d+)\s*\,\s*(\d+)\s*\,\s*(\d+)\s*(.*)/)){
    $spaces = substr($bar, 0, length($1)); 
        print "$1 if($2 .lt. 0) then\n$spaces  goto $3\n$spaces else if($2 .eq. 0) then \n$spaces goto $4\n$spaces else \n$spaces goto $5\n$spaces end if\n"; 
}
else { print "$_\n";
}
