3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02:00

compiler_vm: Use random fortune instead of Ipsum for default input

This commit is contained in:
Pragmatic Software 2014-02-24 07:25:50 +00:00
parent 6e3dc6dba2
commit f6edfce6b4
3 changed files with 22 additions and 9 deletions

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script # These are set automatically by the build/commit script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 484, BUILD_REVISION => 485,
BUILD_DATE => "2014-02-23", BUILD_DATE => "2014-02-23",
}; };

View File

@ -181,9 +181,9 @@ if($subcode =~ m/^\s*diff\s*$/i) {
} else { } else {
$diff =~ s/<del>(.*?)(\s+)<\/del>/<del>$1<\/del>$2/g; $diff =~ s/<del>(.*?)(\s+)<\/del>/<del>$1<\/del>$2/g;
$diff =~ s/<ins>(.*?)(\s+)<\/ins>/<ins>$1<\/ins>$2/g; $diff =~ s/<ins>(.*?)(\s+)<\/ins>/<ins>$1<\/ins>$2/g;
$diff =~ s/<del>((?:(?!<del>).)*)<\/del>\s*<ins>((?:(?!<ins>).)*)<\/ins>/<[replaced `$1` with `$2`]>/g; $diff =~ s/<del>((?:(?!<del>).)*)<\/del>\s*<ins>((?:(?!<ins>).)*)<\/ins>/`replaced $1 with $2`/g;
$diff =~ s/<del>(.*?)<\/del>/<[removed `$1`]>/g; $diff =~ s/<del>(.*?)<\/del>/`removed $1`/g;
$diff =~ s/<ins>(.*?)<\/ins>/<[inserted `$1`]>/g; $diff =~ s/<ins>(.*?)<\/ins>/`inserted $1`/g;
} }
print "$nick: $diff\n"; print "$nick: $diff\n";
@ -911,9 +911,12 @@ $code =~ s/(?:\n\n)+/\n\n/g;
print "final code: [$code]\n" if $debug; print "final code: [$code]\n" if $debug;
print FILE "$nick: [lang:$lang][args:$args][input:$input]\n", pretty($code), "\n" unless $got_run; $input = `fortune -u` if not length $input;
$input =~ s/[\n\r\t]/ /msg;
$input =~ s/:/ - /g;
$input =~ s/\s+/ /g;
$input = "Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet." if not length $input; print FILE "$nick: [lang:$lang][args:$args][input:$input]\n", pretty($code), "\n" unless $got_run;
my $pretty_code = pretty $code; my $pretty_code = pretty $code;
@ -988,8 +991,17 @@ if($output =~ m/^\s*$/) {
$output =~ s/<No symbol table is loaded. Use the "file" command.>\s*//g; $output =~ s/<No symbol table is loaded. Use the "file" command.>\s*//g;
$output =~ s/cc1: all warnings being treated as; errors//g; $output =~ s/cc1: all warnings being treated as; errors//g;
$output =~ s/, note: this is the location of the previous definition//g; $output =~ s/, note: this is the location of the previous definition//g;
$output =~ s/ called by gdb \(\) at statement: void gdb\(\) { __asm__\(""\); }//; $output =~ s/ called by gdb \(\) at statement: void gdb\(\) { __asm__\(""\); }//g;
# $output =~ s/(?<!\s)(expands to:)/ $1/g;
my $removed_warning = 0;
$removed_warning++ if $output =~ s/warning: ISO C forbids nested functions \[-pedantic\]\s*//g;
if($removed_warning) {
$output =~ s/^\[\]\s*//;
}
# remove duplicate warnings/infos # remove duplicate warnings/infos
$output =~ s/(\[*.*warning:.*?\s*)\1/$1/g; $output =~ s/(\[*.*warning:.*?\s*)\1/$1/g;
$output =~ s/(info: .*?\s)\1/$1/g; $output =~ s/(info: .*?\s)\1/$1/g;

View File

@ -165,7 +165,8 @@ sub interpret {
print "Executing gdb\n"; print "Executing gdb\n";
my $user_input_quoted = quotemeta $user_input; my $user_input_quoted = quotemeta $user_input;
($ret, $result) = execute(60, "bash -c 'date -s \@$date; ulimit -t 1; compiler_watchdog.pl $user_input_quoted > .output'"); $user_input_quoted =~ s/\\"/"'\\"'"/g;
($ret, $result) = execute(60, "bash -c \"date -s \@$date; ulimit -t 1; compiler_watchdog.pl $user_input_quoted > .output\"");
$result = ""; $result = "";