3
0
mirror of https://github.com/pragma-/pbot.git synced 2025-01-09 19:42:38 +01:00

compiler_vm: fix indentation

This commit is contained in:
Pragmatic Software 2011-02-08 01:27:45 +00:00
parent bb05ab5274
commit 8f4152c918

View File

@ -26,10 +26,10 @@ my %languages = (
); );
my %preludes = ( my %preludes = (
'C99' => "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n#include <math.h>\n#include <limits.h>\n#include <sys/types.h>\n#include <stdint.h>\n\n", 'C99' => "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n#include <math.h>\n#include <limits.h>\n#include <sys/types.h>\n#include <stdint.h>\n\n",
'C' => "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n#include <math.h>\n#include <limits.h>\n#include <sys/types.h>\n#include <stdint.h>\n\n", 'C' => "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n#include <math.h>\n#include <limits.h>\n#include <sys/types.h>\n#include <stdint.h>\n\n",
'C++' => "#include <iostream>\n#include <cstdio>\n\nusing namespace std;\n\n", 'C++' => "#include <iostream>\n#include <cstdio>\n\nusing namespace std;\n\n",
); );
sub pretty { sub pretty {
my $code = join '', @_; my $code = join '', @_;
@ -58,11 +58,11 @@ sub paste_codepad {
my %post = ( 'lang' => 'C', 'code' => $text, 'private' => 'True', 'submit' => 'Submit' ); my %post = ( 'lang' => 'C', 'code' => $text, 'private' => 'True', 'submit' => 'Submit' );
my $response = $ua->post("http://codepad.org", \%post); my $response = $ua->post("http://codepad.org", \%post);
if(not $response->is_success) { if(not $response->is_success) {
return $response->status_line; return $response->status_line;
} }
return $response->request->uri; return $response->request->uri;
} }
sub compile { sub compile {
@ -677,28 +677,28 @@ print FILE "$nick: [lang:$lang][args:$args][input:$input]\n$code\n";
$output = compile($lang, pretty($code), $args, $input, $USE_LOCAL); $output = compile($lang, pretty($code), $args, $input, $USE_LOCAL);
if($output =~ m/^\s*$/) { if($output =~ m/^\s*$/) {
$output = $nooutput $output = $nooutput
} else { } else {
$output =~ s/cc1: warnings being treated as errors//; $output =~ s/cc1: warnings being treated as errors//;
$output =~ s/ Line \d+ ://g; $output =~ s/ Line \d+ ://g;
$output =~ s/ \(first use in this function\)//g; $output =~ s/ \(first use in this function\)//g;
$output =~ s/error: \(Each undeclared identifier is reported only once.*?\)//msg; $output =~ s/error: \(Each undeclared identifier is reported only once.*?\)//msg;
$output =~ s/prog\.c:[:\d]*//g; $output =~ s/prog\.c:[:\d]*//g;
$output =~ s/ld: warning: cannot find entry symbol _start; defaulting to [^ ]+//; $output =~ s/ld: warning: cannot find entry symbol _start; defaulting to [^ ]+//;
$output =~ s/error: (.*?) error/error: $1; error/msg; $output =~ s/error: (.*?) error/error: $1; error/msg;
$output =~ s/\/tmp\/.*\.o://g; $output =~ s/\/tmp\/.*\.o://g;
$output =~ s/collect2: ld returned \d+ exit status//g; $output =~ s/collect2: ld returned \d+ exit status//g;
$output =~ s/\(\.text\+[^)]+\)://g; $output =~ s/\(\.text\+[^)]+\)://g;
$output =~ s/\[ In/[In/; $output =~ s/\[ In/[In/;
$output =~ s/warning: Can't read pathname for load map: Input.output error.//g; $output =~ s/warning: Can't read pathname for load map: Input.output error.//g;
my $left_quote = chr(226) . chr(128) . chr(152); my $left_quote = chr(226) . chr(128) . chr(152);
my $right_quote = chr(226) . chr(128) . chr(153); my $right_quote = chr(226) . chr(128) . chr(153);
$output =~ s/$left_quote/'/g; $output =~ s/$left_quote/'/g;
$output =~ s/$right_quote/'/g; $output =~ s/$right_quote/'/g;
$output =~ s/[\r\n]+/ /g; $output =~ s/[\r\n]+/ /g;
$output =~ s/\s+/ /g; $output =~ s/\s+/ /g;
} }
unless($got_run) { unless($got_run) {