#!/usr/bin/perl use CGI qw/:standard/; use IO::Socket; $CGI::POST_MAX=1024 * 10000; # max 10000K posts print "Content-type: text/html\n\n"; print ""; print "Filtered Relay Results\n"; print "
\n";
@place_color=("000000","FF0000","FF3300","FF9900");
$upload=0;
#file upload
$file_name = param('file_name');
$maxcontrols= param('controls');
if($maxcontrols > 0)
{
  $maxcontrols--;
}
$search = param('search');
#system("date >> /tmp/emit_upload.txt");
open(LOG,">>/tmp/emit_upload.txt");
$date=`date`;
$date=~s/\n+$//g;
$host=$ENV{"REMOTE_ADDR"};
print LOG "$date ($host) ";
if($file_name eq "")
{
    $upload=2;
    #www upload
    $addr = param('addr');
    $addr =~ s/.*:\/\///g;
    @url = split(/\//, $addr);
    $host = $url[0];
    $file_name ="@url[1..$#url]";
    $file_name =~ s/ /\//g;
    print LOG "http://$addr relay:$search\n";
    #print "$host ($#url)\n";
    #print "$file_name\n";
    #exit(0);
    $sock= new IO::Socket::INET(PeerAddr => $host,
    PeerPort => 80,
    Proto => 'tcp');
    if($sock == NULL)
    {
      print "Empty link, please check your URL:http://$host/$file_name\n\n";
      exit;   
    }
}
else
{
    print LOG "file:$file_name relay:$search\n";
    $upload=1;
}
close(LOG);
$compare=param('compare');
#print "";
#print "
\n";
sub sort_array
{
    my($myarr, $ctrl) = @_;
    $len=@$myarr;
    #print "sort_array: $len, $ctrl\n";
    for($rr=0;$rr<$len;$rr++)
    {
	@arr2=split(/ /,$myarr->[$rr]);
	if($arr2[$ctrl] == 0)
	{$arr[$rr]=999.59;}
	else
	{
	    $arr[$rr]=$arr2[$ctrl];
	}
	#print "$arr[$rr]\n";
    }
    @newarr=sort { $arr[$a] <=> $arr[$b] } 0..$#arr;
    $pl=1;
    for($nn=0;$nn<=$#newarr;$nn++)
    {
	if($arr[$newarr[$nn]]>0)
	{
	    if($nn>0 && $arr[$newarr[$nn]]>0 && ($arr[$newarr[$nn]] != $arr[$newarr[$nn-1]]))
	    {
		$pl=$nn+1;
	    }
	    $arrplace[$newarr[$nn]]=$pl;
	}
	else
	{
	    $arrplace[$newacc[$nn]]=$pl;
	}
	#printf("%02d %02d %05.2f\n", $pl, $newarr[$nn], $arr[$newarr[$nn]]);
    }
    #put worst and best value at end
    #print "$#newarr $nn best=$arr[$newarr[0]] worst=$arr[$newarr[-1]]\n";
    $arrplace[$nn++]=$arr[$newarr[-1]];
    $arrplace[$nn]=$arr[$newarr[0]];
    return(@arrplace); 
}

sub fixtime
{
    $fixtime="@_";
    $_=$_[0];
    $cnt=tr/://;
    if($cnt>0)
    {
	local($min,$sec) = split(/:/,$fixtime);
	#print "$hour,$min,$sec\n";
	$min += 60*$hour;
	$fixtime = "$min.$sec";
    }
    $fixtime;
}

sub split_time
{
    $sign=1;
    
    $a = $_[0];
    $b = $_[1];
    local($am, $as) = split(/\./, $a);
    local($bm, $bs) = split(/\./, $b);
    $asec=$am*60+$as;
    $bsec=$bm*60+$bs;
    $dsec = $bsec-$asec;
    if($dsec<0)
    {
	$dsec=$asec-$bsec;
	$sign=-1;
    }
    elsif($dsec>0)
    {
	#find % loss
	if($asec>0)
	{    $loss = ($dsec/$asec)*100;}
	else
	{   $loss=101;}
    }
    else {$loss =0;}
    use integer;
    $dm=$dsec/60;
    $ds=$dsec-($dm*60);
    if($ds<10)
    {
	if($sign>0)
	{    
	    if($dsec==0){$split_time ="$dm.0$ds, ";}
	    elsif($loss<10){$split_time ="$dm.0$ds,+";}
	    elsif($loss<25){$split_time ="$dm.0$ds,#";}
	    elsif($loss<100){$split_time ="$dm.0$ds,&";}
	    else{$split_time ="$dm.0$ds,@";}
	}
	else
	{    $split_time ="$dm.0$ds,-";}
    }
    else
    {
	if($sign>0)
	{    
	    if($dsec==0){$split_time ="$dm.$ds, ";}
	    elsif($loss<10){$split_time ="$dm.$ds,+";}
	    elsif($loss<25){$split_time ="$dm.$ds,#";}
	    elsif($loss<100){$split_time ="$dm.$ds,&";}
	    else{$split_time ="$dm.$ds,@";}
	}
	else
	{    
	    $split_time ="$dm.$ds,-";
	}
    }
    #print "$split_time ($dm.$ds)$dsec=$b-$a ($bsec-$asec)\n";
    #print "$split_time\n";
    $split_time;
}
sub acc_time
{
    $a = $_[0];
    $b = $_[1];
    $a =~ s/\:/\./g;
    $b =~ s/\:/\./g;
    local($am, $as) = split(/\./, $a);
    local($bm, $bs) = split(/\./, $b);
    $asec=$am*60+$as;
    $bsec=$bm*60+$bs;
    $dsec = $bsec+$asec;
    if($dsec<0)
    {
	$dsec=0;
    }
    use integer;
    $dm=$dsec/60;
    $ds=$dsec-($dm*60);
    if($ds<10)
    {
	$acc_time ="$dm.0$ds";
    }
    else
    {
	$acc_time ="$dm.$ds";
    }
    #print "$acc_time\n";
    $acc_time;
}
# Open the document
$ii=0;
$emit=0;
if($upload == 2)
{
    print $sock "GET /$file_name HTTP/1.0\r\nHost: $host\r\n\r\n";
    #while(defined ($buf=<$sock>))
    #{
    #    print $buf;
    #}
    #exit(0);
    if(<$sock> =~/200 OK/)
    {
    @file=<$sock>;
    @line=grep(/$search/i, @file);
    #print "size=$#file $line[0]<\n";
    if($#line<0)
    {
	@line=grep(/Løype: /, @file);
    }
    if($#line<0)
    {
	$relay=0;
    }
    else
    {
	$relay=1;
	($runner, $loype)=split(/Løype: /, $line[0]);
	$loype=~ s/\n+$//g;
	#print "Løype: $loype\n";
    }
    if($relay == 1)
    {
	#File reduction
	$jj=0;
	$n=0;
	while($n<$#file)
	{
	    $_=$file[$n++];
	    chomp;
	    #print "$_\n";
	    if($_=~/Løype: $loype$/)
	    {
		#for($line=0;$line<9;$line++)
		#print ">$_\n";
		$text[$j++]=$_;
		$_=$file[$n];
		chomp;
		while(($n<$#file) && !($_ =~/Løype: /))
		{
		    #print ":$_\n";
		    $text[$j++]=$_;
		    $_=$file[++$n];
		    chomp;
		}
	    }
	}
    }
    else
    {
	@text=@file;
        print "Not a correct relay file, please try non-relay filtering.\n\n";
        exit;
    }
    #print "$#text reduced lines\n";
    if($#text<0)
    {
      print "Not a correct relay file, please try Non-relay filtering.\n\n";
      exit;
    }
    for($n=0;$n<$#text;$n++)
    {
	$_=$text[$n];
	chomp;
        if($_)
        {
          if($_ =~/[0-9][0-9]:[0-9][0-9]/)
	  {
	    $emit=1; 
	  }
	}
	# remove dos \r
	#s/\r+$/R/g;
	# remove title strekktider
        s/

.*<\/h1>//g; s/

.*<\/h2>//g; s/

.*<\/h3>//g; # remove heading s/.*<\/TABLE>//g; s/
.*<\/table>//g; s/.*<\/title>//g; s/<TITLE>.*<\/TITLE>//g; # remove all HTML tags s/<[^>][^>]*>//g; #D40 s/<a\.*//g; s/<font.*//g; s/href.*//g; s/size.*//g; s/color.*//g; s/Date.*//g; s/Server.*//g; s/Last.*//g; s/Etag.*//g; s/ETag.*//g; s/Content.*//g; s/Connection.*//g; s/Expires.*//g; s/Accept-Ranges.*//g; s/.*eTiming.*//g; s/Lisensen.*//g; s/Hjemmeside.*//g; s/\r+$//g; #s/\n+$//g; s/ :/ :/g; s/^ +//g; s/\t/ /g; s/ / /g; s/ / /g; s/ / /g; s/ / /g; s/ / /g; s/ / /g; s/ / /g; s/^ +//g; s/^ \- /,- /g; s/\+/,+/g; s/\#/,#/g; s/^ \& /,& /g; s/\@/,@/g; if($_) { if($_ =~/Best/) { last; } elsif($_ =~/Copyright/) { #print "$_"; } elsif($_ =~/Klasse/) { #print "$_"; } else { $lines[$ii++]="$_"; } } else { #print "blank linje\n"; } } } else { print "Link was not OK, please check your URL:<a href=\"http://$host/$file_name\">http://$host/$file_name</a>\n\n"; exit; } } elsif($upload==1) { if(<$file_name> && !($file_name =~/webadmin/)) { @file=<$file_name>; @line=grep(/$search/i, @file); #print "size=$#file $line[0]\n"; if($#line<0) { @line=grep(/Løype: /, @file); } if($#line<0) { $relay=0; } else { $relay=1; ($runner, $loype)=split(/Løype: /, $line[0]); $loype=~ s/\n+$//g; #print "Løype: $loype\n"; } if($relay == 1) { #File reduction $jj=0; $n=0; while($n<$#file) { $_=$file[$n++]; chomp; #print "$_\n"; if($_=~/Løype: $loype$/) { #for($line=0;$line<9;$line++) #print "$_\n"; $text[$j++]=$_; $_=$file[$n]; chomp; while(($n<$#file) && !($_ =~/Løype:/)) { #print "$_\n"; $text[$j++]=$_; $_=$file[++$n]; chomp; } } } } else { @text=@file; print "Not a correct relay file, please try <a href=\"http://gateway.navtek.no/~baard/resultater/emit_upload.html\">Non-relay</a> filtering.\n\n"; exit; } #print "$#text reduced lines\n"; if($#text<0) { print "Not a correct relay file, please try <a href=\"http://gateway.navtek.no/~baard/resultater/emit_upload.html\">Non-relay</a> filtering.\n\n"; exit; } for($n=0;$n<$#text;$n++) { $_=$text[$n]; chomp; if($_) { if($_ =~/[0-9][0-9]:[0-9][0-9]/) { $emit=1; } } # remove dos \r for upload from your computer s/\r+$//g; # remove strekktider s/<h1>.*<\/h1>//g; s/<h2>.*<\/h2>//g; s/<h3>.*<\/h3>//g; # remove heading s/<TABLE>.*<\/TABLE>//g; s/<table>.*<\/table>//g; s/<title>.*<\/title>//g; s/<TITLE>.*<\/TITLE>//g; # remove all HTML tags s/<[^>][^>]*>//g; s/<a\.*//g; s/<font.*//g; s/href.*//g; s/size.*//g; s/color.*//g; s/Date.*//g; s/Server.*//g; s/Last.*//g; s/Etag.*//g; s/ETag.*//g; s/Content.*//g; s/Connection.*//g; s/Expires.*//g; s/Accept-Ranges.*//g; s/.*eTiming.*//g; s/Lisensen.*//g; s/Hjemmeside.*//g; s/r+$/\n/g; #s/\n+$//g; s/ :/ :/g; s/^ +//g; s/\t/ /g; s/ / /g; s/ / /g; s/ / /g; s/ / /g; s/ / /g; s/ / /g; s/ / /g; s/^ +//g; s/^ \- /,- /g; s/\+/,+/g; s/\#/,#/g; s/^ \& /,& /g; s/\@/,@/g; if($_) { if($_ =~/Best/) { last; } elsif($_ =~/Copyright/) { #print "$_"; } elsif($_ =~/Klasse/) { #print "$_"; } else { $lines[$ii++]="$_"; } } else { #print "blank linje\n"; } } } else { print "Could not find this file on your computer:<a href=\"file:$file_name\">$file_name</a>\n\n"; exit; } } else { print "No file to parse\n\n"; exit(0); } if ($emit == 0) { if($upload == 1) { print "Not a correct EMIT-file, please check your file:<a href=\"file:$file_name\">$file_name</a>\n\n"; } else { print "Not a correct EMIT-file, please check your URL:<a href=\"http://$host/$file_name\">http://$host/$file_name</a>\n\n"; } exit; } # Wait for first competitor $ii=0; while (!($lines[$ii]=~/[0-9][0-9]:[0-9][0-9]/)) { $ii++; } # remove info text #$lines[$ii] =~ s/[ a-zA-Z0-9]*[^:0-9]1[^:]/1/g; #($left, $right)=split(/,/,$lines[$ii]); #@ #print "before: $lines[$ii]\n"; #$lines[$ii] =~ s/[ a-zA-Z0-9]*[^:0-9]1[^:]/1/g; #print "after: $lines[$ii]\n"; $nn=0; for($jj=$ii;$jj<=$#lines;$jj++) { $clean[$nn]=$lines[$jj]; $nn++; } #for($jj=0;$jj<=$#clean;$jj++) #{ # print "$clean[$jj]\n"; #} $runner=0; $ii=0; #$maxcontrols=0; $maxlines=0; $skipped=0; while ($ii<$#clean) { #if($clean[$ii++]=~/[a-zA-Z]*:[0-9][0-9]:[0-9][0-9].*,/) #nomif($clean[$ii++]=~/[a-zA-Z]*[0-9 ]:[0-9][0-9]:[0-9][0-9].*/) if($clean[$ii++]=~/[A-Z]/) #if($clean[$ii++]=~/[ a-zA-Z0-9]*[0-9]:[0-9][0-9]:[0-9][0-9]/) { $done=0; #look for acc, split and diff. Three and three while(($clean[$ii]) && !$done) { $record[$runner]=$clean[$ii-1]; #print ">$record[$runner]<\n"; $accline[$runner]=""; $splitline[$runner]=""; $diffline[$runner]=""; $lines=0; #nomwhile(($clean[$ii]) && !($clean[$ii++]=~/[a-zA-Z]*[0-9 ]:[0-9][0-9]:[0-9][0-9].*/)) while(($clean[$ii]) && !($clean[$ii++]=~/[A-Z]/)) { #print "Hit\n"; #print "$clean[$ii-1]\n"; #print "$clean[$ii]\n"; #print "$clean[$ii+1]\n"; $line[$lines]=$clean[$ii-1]; $lines++; } if($lines<3) { #print "$lines\n"; #print "skip runner $record[$runner]\n"; #print "$clean[$ii-1]\n"; #print "$clean[$ii]\n"; #print "$clean[$ii+1]\n"; $splitline[$runner] = $clean[$ii-2] . " $clean[$ii-1]"; @split =split(/ /, $splitline[$runner]); $acc="$split[0]"; $accline[$runner]="$acc"; for($ss=1;$ss<=$#split;$ss++) { #print "$split[$ss] + $acc ="; $acc=&acc_time($split[$ss], $acc); #print "$acc\n"; $accline[$runner].=" $acc"; } #print ">$accline[$runner]\n"; #$ii +=$lines; #exit(0); } else { #print "$lines\n"; $ii--; if($maxlines==0) { $maxlines=$lines; } $nlines=0; while($nlines<$lines) { $accline[$runner].="$line[$nlines++] "; $splitline[$runner].="$line[$nlines++] "; $diffline[$runner].="$line[$nlines++] "; } #$accline[$runner].=" "; #$splitline[$runner].= " "; #$diffline[$runner].= " "; $done=1; #print ">$record[$runner]\n"; #print ">$accline[$runner]\n"; #print ">$splitline[$runner]\n"; #print ">$diffline[$runner]\n"; } } if($record[$runner]) { #print ">$record[$runner]<\n"; #print ">$accline[$runner]\n"; $accline[$runner]=~s/ / /g; $accline[$runner]=~s/ / /g; $accline[$runner] =~ s/\:/./g; $accline[$runner] =~ s/\+//g; $accline[$runner] =~ s/\=//g; $accline[$runner] =~ s/\-//g; #print "<$accline[$runner]\n"; $splitline[$runner] =~ s/ / /g; $splitline[$runner] =~ s/ / /g; $splitline[$runner] =~ s/\:/./g; $splitline[$runner] =~ s/\+//g; $splitline[$runner] =~ s/\=//g; $splitline[$runner] =~ s/\-//g; $diffline[$runner] =~ s/ / /g; $diffline[$runner] =~ s/ / /g; $diffline[$runner] =~ s/\:/./g; $diffline[$runner] =~ s/\=/,=/g; #print ">$record\n"; #print ">$accline\n"; #print ">$splitline\n"; #print ">$diffline\n"; @acc = split(/ /, $accline[$runner]); $controls[$runner]=$#acc; #$runner++; if($#acc>$maxcontrols) { if($maxcontrols<3) { $maxcontrols = $#acc; } else { $record[$runner].=" <FONT COLOR=#FF0000>Too many controls</FONT>"; $accline[$runner]=""; $splitline[$runner]=""; $diffline[$runner]=""; } # $controls[$runner]=$#acc; # $runner++; } elsif($#acc<$maxcontrols) { $record[$runner].=" <FONT COLOR=#FF0000>Too few controls</FONT>"; $accline[$runner]=""; $splitline[$runner]=""; $diffline[$runner]=""; } #else #{ # $controls[$runner]=$#acc; # $runner++; #} } $runner++; } } for($nn=0;$nn<$runner;$nn++) { $newaccline[$nn]= ""; $accdiffline[$nn]= ""; $newsplitline[$nn]= ""; $newdiffline[$nn]= ""; } @winnersplit = split(/ /, $splitline[0]); for($control=0;$control<=$maxcontrols;$control++) { #print "control $control\n"; #sort accumulated @accplace=sort_array(\@accline, $control); $worstacc[$control]=$accplace[-2]; $bestacc[$control]=$accplace[-1]; #sort split @splitplace=sort_array(\@splitline, $control); $bestsplit[$control]=$splitplace[-1]; $worstsplit[$control]=$splitplace[-2]; #printf("worst=%f\n",$worstsplit[$control]); if($control == 0) {$bestbestacc[$control]=$bestsplit[$control];} else {$bestbestacc[$control]=&acc_time($bestsplit[$control], $bestbestacc[$control-1]);} for($nn=0;$nn<$runner;$nn++) { @acc = split(/ /, $accline[$nn]); #print "$acc[$control],$accplace[$nn]\n"; if(($control==9)||($control==19)||($control==29)||($control==39)||($control==49)) { #$newdiffline[$nn].= "<FONT COLOR=#00CC00>|</FONT>"; if($accplace[$nn]<4) { # $newaccline[$nn].= sprintf("<FONT COLOR=%s>%6.2f-%d</FONT> ", $place_color[$accplace[$nn]], $acc[$control], $accplace[$nn]); $newaccline[$nn].= sprintf("<b style=\"color:%s;background-color:#CCCCCC\">%6.2f-%d</b> ", $place_color[$accplace[$nn]], $acc[$control], $accplace[$nn]); } elsif($worstacc[$control]==$acc[$control]) { # $newaccline[$nn].= sprintf("<FONT COLOR=#660033>%6.2f-%d</FONT> ", $acc[$control], $accplace[$nn]); $newaccline[$nn].= sprintf("<b style=\"color:#660033;background-color:#CCCCCC\">%6.2f-%d</b> ", $acc[$control], $accplace[$nn]); } else { # $newaccline[$nn].= sprintf("<FONT COLOR=#333333><b>%6.2f-%d</b></FONT> ", $acc[$control], $accplace[$nn]); # $newaccline[$nn].= sprintf("<FONT COLOR=#00CCFF>%6.2f-%d</FONT> ", $acc[$control], $accplace[$nn]); $newaccline[$nn].= sprintf("<b style=\"color:black;background-color:#CCCCCC\">%6.2f-%d</b> ", $acc[$control], $accplace[$nn]); } } else { if($accplace[$nn]<4) { $newaccline[$nn].= sprintf("<FONT COLOR=%s>%6.2f-%d</FONT> ", $place_color[$accplace[$nn]], $acc[$control], $accplace[$nn]); } elsif($worstacc[$control]==$acc[$control]) { $newaccline[$nn].= sprintf("<FONT COLOR=#660033>%6.2f-%d</FONT> ", $acc[$control], $accplace[$nn]); } else { $newaccline[$nn].= sprintf("%6.2f-%d ", $acc[$control], $accplace[$nn]); } } if($accplace[$nn]<10) { $newaccline[$nn].= " ";} elsif($accplace[$nn]<100) { $newaccline[$nn].= " ";} @split = split(/ /, $splitline[$nn]); if(($control==9)||($control==19)||($control==29)||($control==39)||($control==49)) { if($splitplace[$nn] < 4) { # $newsplitline[$nn].= sprintf("<FONT COLOR=%s>%6.2f-%d</FONT> ", $place_color[$splitplace[$nn]], $split[$control], $splitplace[$nn]); $newsplitline[$nn].= sprintf("<b style=\"color:%s;background-color:#CCCCCC\">%6.2f-%d</b> ", $place_color[$splitplace[$nn]], $split[$control], $splitplace[$nn]); } elsif($worstsplit[$control]==$split[$control]) { # $newsplitline[$nn].= sprintf("<FONT COLOR=#660033>%6.2f-%d</FONT> ", $split[$control], $splitplace[$nn]); $newsplitline[$nn].= sprintf("<b style=\"color:#660033;background-color:#CCCCCC\">%6.2f-%d</b> ", $split[$control], $splitplace[$nn]); } else { # $newsplitline[$nn].= sprintf("<FONT COLOR=#333333>%6.2f-%d</FONT> ", $split[$control], $splitplace[$nn]); # $newsplitline[$nn].= sprintf("<FONT COLOR=#00CCFF>%6.2f-%d</FONT> ", $split[$control], $splitplace[$nn]); $newsplitline[$nn].= sprintf("<b style=\"color:black;background-color:#CCCCCC\">%6.2f-%d</b> ", $split[$control], $splitplace[$nn]); } } else { if($splitplace[$nn] < 4) { $newsplitline[$nn].= sprintf("<FONT COLOR=%s>%6.2f-%d</FONT> ", $place_color[$splitplace[$nn]], $split[$control], $splitplace[$nn]); } elsif($worstsplit[$control]==$split[$control]) { $newsplitline[$nn].= sprintf("<FONT COLOR=#660033>%6.2f-%d</FONT> ", $split[$control], $splitplace[$nn]); } else { $newsplitline[$nn].= sprintf("%6.2f-%d ", $split[$control], $splitplace[$nn]); } } if($splitplace[$nn]<10) { $newsplitline[$nn].= " ";} elsif($splitplace[$nn]<100) { $newsplitline[$nn].= " ";} if($compare eq "best") { # use real diff between best $diffc=&split_time($bestsplit[$control],$split[$control]); } else { # use real diff between winner $diffc=&split_time($winnersplit[$control],$split[$control]); } #@diff = split(/ /, $diffline[$nn]); #$diffc =$diff[$control]; ($value, $symbol)=split(/,/,$diffc); #if($value == 0) #{$symbol= " ";}; #printf("%s %c\n", $symbol, $symbol[0]); if($symbol eq "#") { $newdiffline[$nn].= sprintf("<FONT COLOR=#000099>%6.2f%s</FONT> ", $value, $symbol); } elsif($symbol eq "&") { $newdiffline[$nn].= sprintf("<FONT COLOR=#00CC00>%6.2f%s</FONT> ", $value, $symbol); } elsif($symbol eq "@") { $newdiffline[$nn].= sprintf("<FONT COLOR=#CC33CC>%6.2f%s</FONT> ", $value, $symbol); } elsif($symbol eq "+") { $newdiffline[$nn].= sprintf("%6.2f%s ", $value, $symbol); } else { $newdiffline[$nn].= sprintf("<FONT COLOR=#FF0000>%6.2f%s</FONT> ", $value, $symbol); } #$newdiffline[$nn].= sprintf("%6.2f%s ", $value, $symbol); #$newdiffline[$nn].= sprintf("%s %s %s ", $diffc, $diffc[0..$#diffc], $diffc[$#diffc]); if($compare eq "best") { # use real diff between best $diffc=&split_time($bestacc[$control],$acc[$control]); } else { # use real diff between winner $diffc=&split_time($winneracc[$control],$acc[$control]); } ($value, $symbol)=split(/,/,$diffc); #printf("%s %c\n", $symbol, $symbol[0]); if($symbol eq "#") { $accdiffline[$nn].= sprintf("<FONT COLOR=#000099>%6.2f%s</FONT> ", $value, $symbol); } elsif($symbol eq "&") { $accdiffline[$nn].= sprintf("<FONT COLOR=#00CC00>%6.2f%s</FONT> ", $value, $symbol); } elsif($symbol eq "@") { $accdiffline[$nn].= sprintf("<FONT COLOR=#CC33CC>%6.2f%s</FONT> ", $value, $symbol); } elsif($symbol eq "+") { $accdiffline[$nn].= sprintf("%6.2f%s ", $value, $symbol); } else { $accdiffline[$nn].= sprintf("<FONT COLOR=#FF0000>%6.2f%s</FONT> ", $value, $symbol); } } } #exit(0); print "<font size=1>"; for($nn=0;$nn<=$maxcontrols-1;$nn++) { if(($nn==9)||($nn==19)||($nn==29)||($nn==39)||($nn==49)) { #printf("<FONT COLOR=#333333></b>%2d. ctrl<b></FONT> ", $nn+1); # printf("<FONT COLOR=#00CCFF>%2d. ctrl</FONT> ", $nn+1); printf("<b style=\"color:black;background-color:#CCCCCC\">%2d. ctrl </b>", $nn+1); } else { printf("<b style=\"color:black;background-color:#FFFF80\">%2d. ctrl </b>", $nn+1); } } printf("<b style=\"color:black;background-color:#FFFF80\"> finish </b>\n"); print "</font size=1>\n"; for($nn=0;$nn<$runner;$nn++) { $pl=$nn+1; print "<font size=3>($pl) $record[$nn]</font size=3>\n"; print "<font size=1>$newaccline[$nn]\n"; print "<font size=1>$accdiffline[$nn]\n"; print "<font size=1>$newsplitline[$nn]\n"; print "<font size=1>$newdiffline[$nn]</font size=1>\n"; } print "\n"; print "<font size=3>Best split for this class</font size=3><font size=1>\n"; for($nn=0;$nn<=$maxcontrols;$nn++) { printf("<FONT COLOR=FF0000>%6.2f-0 </FONT>", $bestbestacc[$nn]); } print "\n"; for($nn=0;$nn<=$maxcontrols;$nn++) { printf("<FONT COLOR=FF0000>%6.2f-0 </FONT>", $bestsplit[$nn]); } print "\n"; for($nn=0;$nn<=$maxcontrols;$nn++) { printf(" <FONT COLOR=FF0000>0.00 </FONT>"); } print "</font size=1><font size=3>\n\n"; if($compare eq "best") { print "Compare to <FONT COLOR=FF0000>best split</FONT>: + slower <FONT COLOR=#000099># 10% more loss</FONT> <FONT COLOR=#00CC00>& 25% more loss</FONT> <FONT COLOR=#CC33CC>@ 100% more loss</FONT>\n"; } else { print "Compare to class winner: <FONT COLOR=FF0000>- Faster</FONT> + slower <FONT COLOR=#000099># 10% more loss</FONT> <FONT COLOR=#00CC00>& 25% more loss</FONT> <FONT COLOR=#CC33CC>@ 100% more loss</FONT>\n"; } #print "Colors:\n" #print "<TABLE BORDER=0 WIDTH=\"100%\" HEIGHT=\"100%\"><TR ALIGN=Center>"; #print "<TD BGCOLOR=#000000><FONT COLOR=#FFFFFF>1<br>000000<br>2;</FONT></TD></TR></TABLE>\n"; print "</font size=3>\n\n"; print "This list is processed from timing data delivered by <a href=\"http://www.emit.no\">Emit as</a>. This <a href=\"http://gateway.navtek.no/~baard/resultater/emit_upload.html\">service</a> and the processing perl-script is developed by <a href=\"http://www.navtek.no/~baard\">Bård Smestad</a>, e-mail:<a href=\"mailto:smestad\@navtek.no\">smestad\@navtek.no\n"; print "</pre>\n";