compiler_vm: Show output from program when using `paste` command

google search: Show "No results found" if no results found
c99std/c11std: Minor clean-up of output
This commit is contained in:
Pragmatic Software 2012-11-02 22:08:20 +00:00
parent 208f89837f
commit b8d2d0797e
6 changed files with 32 additions and 10 deletions

View File

@ -13,8 +13,8 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 390,
BUILD_DATE => "2012-10-27",
BUILD_REVISION => 391,
BUILD_DATE => "2012-11-02",
};
1;

View File

@ -220,4 +220,11 @@ if($comma eq "") {
print "[", $found_section_title, "]\n\n" if length $found_section_title;
}
$result =~ s/\s*Constraints\s*$//;
$result =~ s/\s*Semantics\s*$//;
$result =~ s/\s*Description\s*$//;
$result =~ s/\s*Returns\s*$//;
$result =~ s/\s*Runtime-constraints\s*$//;
$result =~ s/\s*Recommended practice\s*$//;
print "$result\n";

View File

@ -214,4 +214,11 @@ if($comma eq "") {
print "[", $found_section_title, "]\n\n" if length $found_section_title;
}
$result =~ s/\s*Constraints\s*$//;
$result =~ s/\s*Semantics\s*$//;
$result =~ s/\s*Description\s*$//;
$result =~ s/\s*Returns\s*$//;
$result =~ s/\s*Runtime-constraints\s*$//;
$result =~ s/\s*Recommended practice\s*$//;
print "$result\n";

View File

@ -829,13 +829,7 @@ $code =~ s/(?:\n\n)+/\n\n/g;
print "final code: [$code]\n" if $debug;
if(defined $got_run and $got_run eq "paste") {
my $uri = paste_sprunge(pretty($code));
print "$nick: $uri\n";
exit 0;
}
print FILE "$nick: [lang:$lang][args:$args][input:$input]\n", pretty($code), "\n";
print FILE "$nick: [lang:$lang][args:$args][input:$input]\n", pretty($code), "\n" unless $got_run;
$input = "Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet." if not length $input;
@ -902,6 +896,7 @@ if($output =~ m/^\s*$/) {
$output =~ s/preprocessor macro>\s+<at\s+>/preprocessor macro>/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/, note: this is the location of the previous definition//g;
# remove duplicate warnings/infos
$output =~ s/(\[*.*warning:.*?\s*)\1/$1/g;
@ -911,7 +906,7 @@ if($output =~ m/^\s*$/) {
# splint
$output =~ s/Splint 3.1.2 --- 03 May 2009\s*//;
$output =~ s/Finished checking --- \d+ code warning\s*//;
print FILE "splint: [$output]\n";
print FILE "splint: [$output]\n" unless $got_run;
$output =~ s/\s*\(in function main\)\s*Fresh\s*storage\s*.*?\s*not\s*released.*?reference\s+to\s+it\s+is\s+lost.\s*//msg;
$output =~ s/\s*\(in function main\)\s*//g;
$output =~ s/\s*\(Use\s+.*?\s+to\s+inhibit\s+warning\)//msg;
@ -943,4 +938,11 @@ unless($got_run) {
close FILE;
}
if(defined $got_run and $got_run eq "paste") {
$code .= "\n\n/************* OUTPUT *************\n$output************** OUTPUT **************/\n";
my $uri = paste_sprunge(pretty($code));
print "$nick: $uri\n";
exit 0;
}
print "$nick: $output\n";

View File

@ -32,7 +32,11 @@ my $search = Google::Search->Web(query => $arguments, referrer => 'http://blacks
print "$nick: ";
if(not $search->first) {
if($search->error) {
print $search->error->reason, "\n";
} else {
print "No results found\n";
}
exit;
}

View File

@ -16,6 +16,8 @@ if ($#ARGV <= 0)
my $nick = shift(@ARGV);
$arguments = join("%20", @ARGV);
exit if($arguments =~ m/stackoverflow.com/i);
exit if($arguments =~ m/scratch.mit.edu/i);
exit if($arguments =~ m/sprunge.us/i);
exit if($arguments =~ m/hastebin.com/i);
exit if($arguments =~ m/lmgtfy.com/i);