Add PHP
authorSergiu <srg.pscs@gmail.com>
Thu, 21 Jan 2016 04:17:48 +0000 (06:17 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 23 Jan 2016 16:09:13 +0000 (16:09 +0000)
gruntmaster-compile
lib/Gruntmaster/Daemon.pm
t/01-jobs.t
t/problems/hello/tests/php/meta.yml [new file with mode: 0644]
t/problems/hello/tests/php/prog.php [new file with mode: 0644]

index cea2733..0ab18fc 100755 (executable)
@@ -38,15 +38,16 @@ given ($format){
                exit
        }
 
-       when ([qw/GOLFSCRIPT JULIA PERL PYTHON RUBY SBCL/]){
+       when ([qw/GOLFSCRIPT JULIA PERL PHP PYTHON RUBY SBCL/]){
                open IN, '<', $name;
                open OUT, '>', $basename;
-               print OUT "#!/usr/bin/golfscript\n"    if $_ eq 'GOLFSCRIPT';
-               print OUT "#!/usr/bin/julia -O\n"      if $_ eq 'JULIA';
-               print OUT "#!/usr/bin/perl\n"          if $_ eq 'PERL';
-               print OUT "#!/usr/bin/python\n"        if $_ eq 'PYTHON';
-               print OUT "#!/usr/bin/ruby\n"          if $_ eq 'RUBY';
-               print OUT "#!/usr/bin/sbcl --script\n" if $_ eq 'SBCL';
+               print OUT "#!/usr/bin/golfscript\n"                                                             if $_ eq 'GOLFSCRIPT';
+               print OUT "#!/usr/bin/julia -O\n"                                                               if $_ eq 'JULIA';
+               print OUT "#!/usr/bin/perl\n"                                                                   if $_ eq 'PERL';
+               print OUT "#!/usr/bin/php -d ONLINE_JUDGE=true\n"                                               if $_ eq 'PHP';
+               print OUT "#!/usr/bin/python\n"                                                                 if $_ eq 'PYTHON';
+               print OUT "#!/usr/bin/ruby\n"                                                                   if $_ eq 'RUBY';
+               print OUT "#!/usr/bin/sbcl --script\n"                                                          if $_ eq 'SBCL';
                print OUT while <IN>;
                close OUT;
                close IN;
@@ -125,6 +126,10 @@ Compile commands for each format:
 
   cp $input $output
 
+=item PHP
+
+  cp $input $output
+
 =item PYTHON
 
   cp $input $output
index ad4e727..b6d3a52 100644 (file)
@@ -30,6 +30,7 @@ use constant FORMAT_EXTENSION => {
        MONO => 'cs',
        PASCAL => 'pas',
        PERL => 'pl',
+       PHP => 'php',
        PYTHON => 'py',
        RUBY => 'rb',
        RUST => 'rs',
index e3464fc..90f7d70 100644 (file)
@@ -31,6 +31,7 @@ use constant COMPILER => {
           GCCGO gccgo
           HASKELL ghc
           PERL perl
+          PHP php
           PYTHON python
           RUBY ruby
           RUST rustc
diff --git a/t/problems/hello/tests/php/meta.yml b/t/problems/hello/tests/php/meta.yml
new file mode 100644 (file)
index 0000000..0f9f474
--- /dev/null
@@ -0,0 +1,7 @@
+test_name: PHP
+test_description: Hello world in PHP
+problem: hello
+files:
+  prog:
+    format: PHP
+    name: prog.php
diff --git a/t/problems/hello/tests/php/prog.php b/t/problems/hello/tests/php/prog.php
new file mode 100644 (file)
index 0000000..c1319fb
--- /dev/null
@@ -0,0 +1,3 @@
+<?php
+echo("Hello World!\n");
+?>
This page took 0.033091 seconds and 4 git commands to generate.