8 Ugh . Perl sux. Anybody for Python?
12 $mf_to_table_version = 0.1;
24 print STDERR "This is mf-to-table " . $mf_to_table_version . "\n";
29 print STDERR "Usage: mf-to-table [options] LOG..\n"
30 . "Generate mozarella metrics table from preparated metafont log\n\n"
32 . " -h, --help print this help\n"
33 . " -o, --output=FILE name output file\n"
40 while ($line = <IN>) {
42 $line =~ s/^@@(.*)@@/$1/;
44 my @fields = split (/:/,$line);
45 my $label = $fields [0];
46 my $name = $fields [1];
47 print OUT "\t" x $indent;
48 if ($label eq "font") {
49 print OUT "% $name=\\symboltables {\n";
51 } elsif ($label eq "group") {
52 print OUT "\"$name\" = \\table {\n";
54 } elsif ($label eq "puorg") {
57 } elsif ($label eq "tnof") {
58 print OUT "% } % $name\n";
60 } elsif ($label eq "char") {
66 my $texstr = $fields [7];
67 print OUT sprintf( "\"%s\"\t\"\\%s\"\t%.2f\\pt\t%.2f\\pt\t%.2f\\pt\t%.2f\\pt\n", $id, $texstr, 0, $w, $h, $d );
69 print STDERR "mf-to-table: unknown label: \`$label\'\n";
79 $outfile = $opt_output if (defined($opt_output));
84 if (( ! -f $infile) && (! $infile =~ /\\.log$/s ) ){
87 print STDERR "Input ", (($infile eq "-") ?"STDIN" : $infile), " .. \n";
94 die "can't open \`$infile\'" unless open IN,$infile ;
95 die "can't open \`$outfile\'" unless open OUT, ">$outfile";
96 print OUT "% generated at " . localtime() . " from $infile\n";
97 print OUT "% changes will be lost\n";
109 #GetOptions ("help", "output=s", "from=i", "to=i", "minor=i", "edit", "show-rules");
110 GetOptions ("help", "output=s");
114 $opt_help = 0; # to extinguish typo check.
118 local ($infile,$outfile);
121 while (defined($ARGV[0])) {
126 do_one_arg unless ($processed_one);