#!/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 ""; @place_color=("000000","FF0000","FF3300","FF9900"); $upload=0; #file upload $file_name = param('file_name'); $maxcontrols= param('controls'); if($maxcontrols > 0) { $maxcontrols--; } #print "$maxcontrols controls\n"; #system("date >> /tmp/emit_upload.txt"); open(LOG,">>../log/emit_upload.txt"); $date=`date`; $date=~s/\n+$//g; $host=$ENV{"REMOTE_ADDR"}; print "
\n";
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\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 or could not find file on your computer, please check your URL:http://$host/$file_name\n\n";
      exit;   
    }
}
else
{
    print LOG "file:$file_name\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/)
    {
	$collect = 0;
	$skip = 0;
	$total = "";
	$newversion=0;
	while (defined ($_=<$sock>)) 
    #while (defined (<$sock>)) 
    {
	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; # new format #s/\r/CR/g; #s/\x0d+$/NL/g; #s/<td align=\"Rigth\">Post/\n<td align=\"Rigth\">Post if($_ =~/Total time/) { $skip = 0; $collect = 1; $total = ""; $_=""; } if($_ =~/Split time/) { $collect = 0; $_=$total; } if($_ =~/Total tid/) { $skip = 0; $collect = 1; $total = ""; $_=""; } if($_ =~/Strekktid/) { $collect = 0; $_=$total; } if($skip ==1){ $_=""; } if($_ =~/Post/) { $lines[$ii++]="00:00"; $skip = 1; } if($_ =~/Control/) { $lines[$ii++]="00:00"; $skip = 1; } if($_ =~/Tid etter/) { $skip=2; # $_ =""; # if($collect ==2) # { # $collect = 0; # # }else # { # $collect = 2; # } } if($_ =~/Time behind/) { $skip=2; # $_ =""; # if($collect ==2) # { # $collect = 0; # # }else # { # $collect = 2; # } } if($skip==2) { $_=""; } if($collect==1) { s/\-[0-9].*<\/td> .*\x0d/=/g; $total .= $_; } else{ #new format #s/<td>.*<td align=\"Rigth\">Total tid<\/td>//g; #s/\-[0-9].*<\/td>/-<\/td>/g; s/\-/,\-/g; s/<td align=\"Rigth\">.*<\/td>//g; #s/<td align=\"Right\">.*<\/td>//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/Lisensed.*//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($_ =~/Beste strekktid/) { 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/)) { while (<$file_name>) { 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; # new format #s/\r/CR/g; #s/\x0d+$/NL/g; #s/<td align=\"Rigth\">Post/\n<td align=\"Rigth\">Post if($_ =~/Total time/) { $skip = 0; $collect = 1; $total = ""; $_=""; } if($_ =~/Split time/) { $collect = 0; $_=$total; } if($_ =~/Total tid/) { $skip = 0; $collect = 1; $total = ""; $_=""; } if($_ =~/Strekktid/) { $collect = 0; $_=$total; } if($skip ==1){ $_=""; } if($_ =~/Post/) { $lines[$ii++]="00:00"; $skip = 1; } if($_ =~/Control/) { $lines[$ii++]="00:00"; $skip = 1; } if($_ =~/Tid etter/) { $skip=2; # $_ =""; # if($collect ==2) # { # $collect = 0; # # }else # { # $collect = 2; # } } if($_ =~/Time behind/) { $skip=2; # $_ =""; # if($collect ==2) # { # $collect = 0; # # }else # { # $collect = 2; # } } if($skip==2) { $_=""; } if($collect==1) { s/\-[0-9].*<\/td> .*\x0d/=/g; $total .= $_; } else{ #new format #s/<td>.*<td align=\"Rigth\">Total tid<\/td>//g; #s/\-[0-9].*<\/td>/-<\/td>/g; s/\-/,\-/g; s/<td align=\"Rigth\">.*<\/td>//g; #s/<td align=\"Right\">.*<\/td>//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/Lisensed.*//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($_ =~/Beste strekktid/) { 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; } #add for final $lines[$ii++]="00:00"; # 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]); #@ #$lines[$ii] =~ s/[ a-zA-Z0-9]*[^:0-9]1[^:]/1/g; $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 "1:$clean[$ii-1]\n"; #print "2:$clean[$ii]\n"; #print "3:$clean[$ii+1]\n"; $line[$lines]=$clean[$ii-1]; $lines++; } if($lines<3 || $record[$runner]=~/DSQ/) { #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]); @winneracc = split(/ /, $accline[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); } 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); # if($upload == 1){ # print "<title>Filtered Results for: file:$file_name\n"; # print "

Filtered Results: file:/$file_name

\n"; #}else{ # print "Filtered Results for: http://$host/$file_name\n"; # print "

Filtered Results for : http://$host/$file_name

\n"; # #} print "
\n">
print "";
for($nn=0;$nn<=$maxcontrols-1;$nn++)
{
    if(($nn==9)||($nn==19)||($nn==29)||($nn==39)||($nn==49))
    {    
	#printf("%2d. ctrl   ", $nn+1);
#        printf("%2d. ctrl   ", $nn+1);
       printf("%2d. ctrl   ", $nn+1);
    }
    else
    {
	printf("%2d. ctrl   ", $nn+1);
    } 
}
printf(" finish   \n"); 
print "\n";
for($nn=0;$nn<$runner;$nn++)
{
    $pl=$nn+1;
    print "($pl) $record[$nn]\n";
    print "$newaccline[$nn]\n";
    print "$accdiffline[$nn]\n";
    print "$newsplitline[$nn]\n";
    print "$newdiffline[$nn]\n";
}
print "\nBest split for this class\n\n";
for($nn=0;$nn<=$maxcontrols;$nn++)
{
    printf("%6.2f-0   ", $bestbestacc[$nn]); 
}
print "\n";
for($nn=0;$nn<=$maxcontrols;$nn++)
{
    printf("%6.2f-0   ", $bestsplit[$nn]); 
}
print "\n";
for($nn=0;$nn<=$maxcontrols;$nn++)
{
    printf("  0.00     "); 
}
print "\n\n";
if($compare eq "best")
{
print "Compare to best split: + slower  # 10% more loss  & 25% more loss  @ 100% more loss\n";
}
else
{
    print "Compare to class winner: - Faster  + slower  # 10% more loss  & 25% more loss  @ 100% more loss\n";
}
#print "Colors:\n"
#print "
"; #print "
1
000000
2;
\n"; $data_url="data"; if($upload == 1){ #print "Filtered Results for: file:$file_name\n"; $data_url="data"; }else{ #print "Filtered Results for: http://$host/$file_name\n"; $data_url ="data"; } print "\n\n"; print "This list is processed from timing $data_url delivered by Emit as. This service and the processing perl-script is developed by MultiResults\n"; print "

\n";