]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/perl -w | |
2 | use v5.14; | |
3 | no if $] > 5.017011, warnings => 'experimental::smartmatch'; | |
4 | ||
5 | use File::Copy qw/copy/; | |
6 | ||
7 | my ($format, $basename, $name) = @ARGV; | |
8 | my $ret = fork // die $!; | |
9 | if ($ret) { | |
10 | $SIG{ALRM} = sub {kill KILL => $ret}; | |
11 | alarm 5; | |
12 | wait; | |
13 | exit $? >> 8 | |
14 | } else { | |
15 | given ($format){ | |
16 | exec 'gcc', qw/-DONLINE_JUDGE -std=gnu11 -Wextra -O2 -o/, $basename, $name when 'C'; | |
17 | exec 'g++', qw/-DONLINE_JUDGE -std=gnu++11 -fabi-version=6 -Wextra -O2 -o/, $basename, $name when 'CPP'; | |
18 | exec 'gmcs', '-d:ONLINE_JUDGE', $name when 'MONO'; | |
19 | exec 'javac', $name when 'JAVA'; | |
20 | exec 'fpc', qw/-dONLINE_JUDGE -O2 -n/, $name when 'PASCAL'; | |
21 | copy $name, $basename when ['PERL', 'PYTHON'] | |
22 | } | |
23 | } |