#!/afs/athena/contrib/perl/p 

# parser.prl -- takes the frigging dxf files and parses them, then
# makes calls to sml library functions to display them in xdbv 

if ($#ARGV < $[) {
	print "Usage: xform.prl fname\n";
	exit;
}
# --------------------------------------------
# Initialize the variables.
# --------------------------------------------
$odd_line = 1;

# -------------------------------------------
# Read from standard input.
# -------------------------------------------
open(F, "-") || die "cannot open STDIN: $!";
while (<F>) {

# -----------------------------------------------------
# Even lines have values -- integers, strings, or reals
# -----------------------------------------------------
	if ($odd_line == 0) {
		if ($_ =~ /[0-9\-]+\.[0-9]+/) {
			printf "%14.6f\n", $_;
		}
		elsif ($_ =~ /[0-9\-]+/) {
			printf "%6d\n", $_;
		}
		else {
			print "$_";
		}
		$odd_line = 1;
	}

# -----------------------------------------------------
# Odd lines have codes.
# -----------------------------------------------------
	else {
		if ($odd_line == 1) {
			$odd_line = 0;
		}
	}
}
