diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 4a467b67..add701bd 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,8 +13,8 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 387, - BUILD_DATE => "2012-10-07", + BUILD_REVISION => 388, + BUILD_DATE => "2012-10-24", }; 1; diff --git a/modules/compiler_vm/compiler_client.pl b/modules/compiler_vm/compiler_client.pl index b2460dc0..c852199d 100755 --- a/modules/compiler_vm/compiler_client.pl +++ b/modules/compiler_vm/compiler_client.pl @@ -23,7 +23,7 @@ if(not defined $sock) { my $nick = shift @ARGV; my $code = join ' ', @ARGV; -my $lang = "C99"; +my $lang = "C11"; if($code =~ s/-lang=([^ ]+)//) { $lang = uc $1; diff --git a/modules/compiler_vm/compiler_server.pl b/modules/compiler_vm/compiler_server.pl index 201413e3..5cdece69 100755 --- a/modules/compiler_vm/compiler_server.pl +++ b/modules/compiler_vm/compiler_server.pl @@ -154,7 +154,7 @@ sub compiler_server { $result =~ s/\s+$//; print "Ret: $ret; result: [$result]\n"; - if($result =~ m/Killed$/) { + if($result =~ m/\[Killed\]$/) { print "Processed was killed\n"; $killed = 1; } diff --git a/modules/compiler_vm/compiler_vm_client.pl b/modules/compiler_vm/compiler_vm_client.pl index 5fb8d737..9142a60f 100755 --- a/modules/compiler_vm/compiler_vm_client.pl +++ b/modules/compiler_vm/compiler_vm_client.pl @@ -102,7 +102,9 @@ sub compile { $compiler_output = $compiler; } - print $compiler "compile:$lang:$args:$input\n"; + my $date = time; + + print $compiler "compile:$lang:$args:$input:$date\n"; print $compiler "$code\n"; print $compiler "compile:end\n"; @@ -576,7 +578,8 @@ unless($got_run) { my $found = 0; my @langs; foreach my $l (sort { uc $a cmp uc $b } keys %languages) { - push @langs, sprintf(" %-30s => %s", $l, $languages{$l}); + #push @langs, sprintf(" %-30s => %s", $l, $languages{$l}); + push @langs, sprintf("%s => %s", $l, $languages{$l}); if(uc $lang eq uc $l) { $lang = $l; $found = 1; @@ -584,7 +587,7 @@ foreach my $l (sort { uc $a cmp uc $b } keys %languages) { } if(not $found) { - print "$nick: Invalid language '$lang'. Supported languages are:\n", (join ",\n", @langs), "\n"; + print "$nick: Invalid language '$lang'. Supported languages are:\n", (join ",\n", @langs), "\n; For additional languages try the cc2 command."; exit 0; } @@ -731,7 +734,7 @@ if($lang eq 'C' or $lang eq 'C99' or $lang eq 'C11' or $lang eq 'C++') { print "*** prelude: [$prelude]\n precode: [$precode]\n" if $debug; # strip C and C++ style comments - $precode =~ s#/\*[^*]*\*+([^/*][^*]*\*+)*/|//([^\\]|[^\n][\n]?)*?\n|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#defined $3 ? $3 : ""#gse; + $precode =~ s#/\*[^*]*\*+([^/*][^*]*\*+)*/|//([^\\]|[^\n][\n]?)*?\n|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#defined $3 ? $3 : " "#gse; print " precode: [$precode]\n" if $debug; @@ -786,6 +789,7 @@ if($lang eq 'C' or $lang eq 'C99' or $lang eq 'C11' or $lang eq 'C++') { my $body; if(not defined $extract[0]) { print "error: unmatched brackets for function '$ident';\n"; + print "body: [$potential_body]\n"; exit; } else { $body = $extract[0]; @@ -892,6 +896,7 @@ if($output =~ m/^\s*$/) { $output =~ s/\/home\/compiler\///g; $output =~ s/compilation terminated.//; $output =~ s/<'(.)' = char>/<'$1' = int>/g; + $output =~ s/= (-?\d+) ''/= $1/g; $output =~ s/, //g; $output =~ s/\s*warning: shadowed declaration is here \[-Wshadow\]//g; $output =~ s/preprocessor macro>\s+/preprocessor macro>/g; diff --git a/modules/compiler_vm/compiler_vm_server.pl b/modules/compiler_vm/compiler_vm_server.pl index 69124b47..cd1cb97a 100755 --- a/modules/compiler_vm/compiler_vm_server.pl +++ b/modules/compiler_vm/compiler_vm_server.pl @@ -39,6 +39,7 @@ sub runserver { open($output, '>', "/dev/stdout") or die $!; } + my $date; my $lang; my $code; my $user_args; @@ -57,7 +58,7 @@ sub runserver { print "Attempting compile [$lang] ...\n"; - my $result = interpret($lang, $code, $user_args, $user_input); + my $result = interpret($lang, $code, $user_args, $user_input, $date); print "Done compiling; result: [$result]\n"; print $output "result:$result\n"; @@ -79,14 +80,14 @@ sub runserver { $user_input = undef; $lang = undef; - ($lang, $user_args, $user_input) = split /:/, $options; + ($lang, $user_args, $user_input, $date) = split /:/, $options; $code = ""; $lang = "C11" if not defined $lang; $user_args = "" if not defined $user_args; $user_input = "" if not defined $user_input; - print "Setting lang [$lang]; [$user_args]; [$user_input]\n"; + print "Setting lang [$lang]; [$user_args]; [$user_input]; [$date]\n"; next; } @@ -98,9 +99,9 @@ sub runserver { } sub interpret { - my ($lang, $code, $user_args, $user_input) = @_; + my ($lang, $code, $user_args, $user_input, $date) = @_; - print "lang: [$lang], code: [$code], user_args: [$user_args], input: [$user_input]\n"; + print "lang: [$lang], code: [$code], user_args: [$user_args], input: [$user_input], date: [$date]\n"; $lang = uc $lang; @@ -146,7 +147,7 @@ sub interpret { } my $user_input_quoted = quotemeta $user_input; - ($ret, $result) = execute(60, "bash -c 'ulimit -t 1; compiler_watchdog.pl $user_input_quoted > .output'"); + ($ret, $result) = execute(60, "bash -c 'date -s \@$date; ulimit -t 1; compiler_watchdog.pl $user_input_quoted > .output'"); $result = ""; diff --git a/modules/compiler_vm/compiler_watchdog.pl b/modules/compiler_vm/compiler_watchdog.pl index 497093c3..62ebdc61 100755 --- a/modules/compiler_vm/compiler_watchdog.pl +++ b/modules/compiler_vm/compiler_watchdog.pl @@ -359,7 +359,7 @@ sub execute { } if($line =~ m/Program terminated with signal SIGKILL/) { - print "Killed\n"; + print "[Killed]\n"; return 0; }