]> mj.ucw.cz Git - moe.git/blobdiff - mop/eval/mo-score.sh
Isolate: Directory rules can have flags
[moe.git] / mop / eval / mo-score.sh
index 9ed73f4a2cb8f144a08d2330dea88553f550ea97..b893d7623b6128c6ba557d8dbefca0b81b0c6731 100755 (executable)
@@ -8,7 +8,8 @@ $tex = 0;
 $extras = 0;
 $alt = 0;
 $merged = 0;
 $extras = 0;
 $alt = 0;
 $merged = 0;
-$usage = "Usage: mo-score [--detail] [--alt] [--extras] [--html] [--tex] [--merged] [<directory>/]<task> ...";
+$table = 0;
+$usage = "Usage: mo-score [--detail] [--alt] [--extras] [--html] [--tex] [--table] [--merged] [<directory>/]<task> ...";
 while (($arg = $ARGV[0]) =~ /^--([a-z]+)$/) {
        shift @ARGV;
        $var = "\$$1";
 while (($arg = $ARGV[0]) =~ /^--([a-z]+)$/) {
        shift @ARGV;
        $var = "\$$1";
@@ -17,6 +18,12 @@ while (($arg = $ARGV[0]) =~ /^--([a-z]+)$/) {
 }
 @ARGV || die $usage;
 
 }
 @ARGV || die $usage;
 
+$print_key = 1;
+if ($table) {
+       open STDOUT, "|column -t -s'\t'" or die;
+       $print_key = 0;
+}
+
 print STDERR "Scanning contestants... ";
 open (CT, "bin/mo-get-users --full |") || die "Cannot get list of contestants";
 while (<CT>) {
 print STDERR "Scanning contestants... ";
 open (CT, "bin/mo-get-users --full |") || die "Cannot get list of contestants";
 while (<CT>) {
@@ -75,6 +82,8 @@ foreach $u (keys %users) {
                                elsif ($trem =~ /^Caught fatal signal /) { $cmt = "SG"; }
                                elsif ($trem =~ /^([A-Za-z])\S*\s+([A-Za-z])/) {
                                        ($cmt = "$1$2") =~ tr/a-z/A-Z/;
                                elsif ($trem =~ /^Caught fatal signal /) { $cmt = "SG"; }
                                elsif ($trem =~ /^([A-Za-z])\S*\s+([A-Za-z])/) {
                                        ($cmt = "$1$2") =~ tr/a-z/A-Z/;
+                               } elsif ($trem =~ /^([A-Za-z]{2})/) {
+                                       ($cmt = $1) =~ tr/a-z/A-Z/;
                                }
                                if (!defined $messages{$trem}) {
                                        $messages{$trem} = $cmt;
                                }
                                if (!defined $messages{$trem}) {
                                        $messages{$trem} = $cmt;
@@ -178,7 +187,7 @@ while ($i < @table) {
        } else {
                ${table[$j]}[0] = $j+1 . ".-" . $i . ".";
                $j++;
        } else {
                ${table[$j]}[0] = $j+1 . ".-" . $i . ".";
                $j++;
-               while ($j < $i) { ${table[$j++]}[0] = ""; };
+               while ($j < $i) { ${table[$j++]}[0] = " "; };
        }
 }
 print STDERR "OK\n";
        }
 }
 print STDERR "OK\n";
@@ -219,11 +228,12 @@ if ($debug) {
        print "\\error{TeX output not supported yet!}\n";
 } else {
        foreach $r (@table) { print join("\t",@$r), "\n"; }
        print "\\error{TeX output not supported yet!}\n";
 } else {
        foreach $r (@table) { print join("\t",@$r), "\n"; }
-       print "\n";
-       foreach $r (sort keys %error_codes) { print "$r: $error_codes{$r}\n"; }
+       if ($print_key) {
+               print "\n";
+               foreach $r (sort keys %error_codes) { print "$r: $error_codes{$r}\n"; }
+       }
 }
 
 }
 
-
 sub printHtmlRow {
        print "<TR>", join('',map {
                if ($hdr) { $_ = "<TH>$_"; }
 sub printHtmlRow {
        print "<TR>", join('',map {
                if ($hdr) { $_ = "<TH>$_"; }
@@ -231,7 +241,6 @@ sub printHtmlRow {
        } @_), "\n";
 }
 
        } @_), "\n";
 }
 
-
 sub printHtmlHeader {
 
   my ($perm) = @_;
 sub printHtmlHeader {
 
   my ($perm) = @_;