diff --git a/modules/compiler_vm/languages/bash.pm b/modules/compiler_vm/languages/bash.pm index f1f55d71..083bb57c 100755 --- a/modules/compiler_vm/languages/bash.pm +++ b/modules/compiler_vm/languages/bash.pm @@ -14,10 +14,6 @@ sub initialize { $self->{default_options} = ''; $self->{cmdline} = 'bash $options $sourcefile'; - if (length $self->{arguments}) { - $self->{cmdline} .= " $self->{arguments}"; - } - $self->{cmdline_opening_comment} = ": <<'____CMDLINE____'\n"; $self->{cmdline_closing_comment} = "____CMDLINE____\n"; diff --git a/modules/compiler_vm/languages/go.pm b/modules/compiler_vm/languages/go.pm index 880d794d..b883d063 100755 --- a/modules/compiler_vm/languages/go.pm +++ b/modules/compiler_vm/languages/go.pm @@ -13,10 +13,6 @@ sub initialize { $self->{execfile} = 'prog'; $self->{default_options} = ''; $self->{cmdline} = 'go $options run $sourcefile'; - - if (length $self->{arguments}) { - $self->{cmdline} .= " $self->{arguments}"; - } } 1; diff --git a/modules/compiler_vm/languages/haskell.pm b/modules/compiler_vm/languages/haskell.pm index 31c70e38..1f031055 100755 --- a/modules/compiler_vm/languages/haskell.pm +++ b/modules/compiler_vm/languages/haskell.pm @@ -14,10 +14,6 @@ sub initialize { $self->{default_options} = ''; $self->{cmdline} = 'ghc -v0 $options -o $execfile $sourcefile'; - if (length $self->{arguments}) { - $self->{cmdline} .= " $self->{arguments}"; - } - $self->{cmdline_opening_comment} = "{-|\n=============== CMDLINE ===============\n"; $self->{cmdline_closing_comment} = "=============== CMDLINE ===============\n-}\n"; diff --git a/modules/compiler_vm/languages/javascript.pm b/modules/compiler_vm/languages/javascript.pm index 01c20485..dfd5c98b 100755 --- a/modules/compiler_vm/languages/javascript.pm +++ b/modules/compiler_vm/languages/javascript.pm @@ -14,10 +14,6 @@ sub initialize { $self->{default_options} = ''; $self->{cmdline} = 'd8 $options $sourcefile'; - if (length $self->{arguments}) { - $self->{cmdline} .= " $self->{arguments}"; - } - $self->{cmdline_opening_comment} = "/************* CMDLINE *************\n"; $self->{cmdline_closing_comment} = "************** CMDLINE *************/\n"; diff --git a/modules/compiler_vm/languages/ksh.pm b/modules/compiler_vm/languages/ksh.pm index f61ab457..e89494d0 100755 --- a/modules/compiler_vm/languages/ksh.pm +++ b/modules/compiler_vm/languages/ksh.pm @@ -14,10 +14,6 @@ sub initialize { $self->{default_options} = ''; $self->{cmdline} = 'ksh $options $sourcefile'; - if (length $self->{arguments}) { - $self->{cmdline} .= " $self->{arguments}"; - } - $self->{cmdline_opening_comment} = ": <<'____CMDLINE____'\n"; $self->{cmdline_closing_comment} = "____CMDLINE____\n"; diff --git a/modules/compiler_vm/languages/lua.pm b/modules/compiler_vm/languages/lua.pm index ccec5fd5..944ac13c 100755 --- a/modules/compiler_vm/languages/lua.pm +++ b/modules/compiler_vm/languages/lua.pm @@ -14,10 +14,6 @@ sub initialize { $self->{default_options} = ''; $self->{cmdline} = 'lua $options $sourcefile'; - if (length $self->{arguments}) { - $self->{cmdline} .= " $self->{arguments}"; - } - $self->{cmdline_opening_comment} = "--[[--------------- CMDLINE ---------------\n"; $self->{cmdline_closing_comment} = "------------------- CMDLINE ---------------]]\n"; diff --git a/modules/compiler_vm/languages/python.pm b/modules/compiler_vm/languages/python.pm index 0d9ef3ab..fe5d0c2d 100755 --- a/modules/compiler_vm/languages/python.pm +++ b/modules/compiler_vm/languages/python.pm @@ -14,10 +14,6 @@ sub initialize { $self->{default_options} = ''; $self->{cmdline} = 'python $options $sourcefile'; - if (length $self->{arguments}) { - $self->{cmdline} .= " $self->{arguments}"; - } - $self->{cmdline_opening_comment} = "'''\n=============== CMDLINE ===============\n"; $self->{cmdline_closing_comment} = "=============== CMDLINE ===============\n'''\n"; diff --git a/modules/compiler_vm/languages/python3.pm b/modules/compiler_vm/languages/python3.pm index 031490de..13aeab8b 100755 --- a/modules/compiler_vm/languages/python3.pm +++ b/modules/compiler_vm/languages/python3.pm @@ -14,10 +14,6 @@ sub initialize { $self->{default_options} = ''; $self->{cmdline} = 'python3 $options $sourcefile'; - if (length $self->{arguments}) { - $self->{cmdline} .= " $self->{arguments}"; - } - $self->{cmdline_opening_comment} = "'''\n=============== CMDLINE ===============\n"; $self->{cmdline_closing_comment} = "=============== CMDLINE ===============\n'''\n"; diff --git a/modules/compiler_vm/languages/ruby.pm b/modules/compiler_vm/languages/ruby.pm index 47f4c53c..9a564583 100755 --- a/modules/compiler_vm/languages/ruby.pm +++ b/modules/compiler_vm/languages/ruby.pm @@ -10,8 +10,6 @@ use strict; package ruby; use parent '_default'; -use Text::ParseWords qw(shellwords); - sub initialize { my ($self, %conf) = @_; @@ -19,51 +17,6 @@ sub initialize { $self->{execfile} = 'prog.rb'; $self->{default_options} = '-w'; $self->{cmdline} = 'ruby $options $sourcefile'; - - if (length $self->{arguments}) { - $self->{cmdline} .= " $self->{arguments}"; - } -} - -sub preprocess_code { - my $self = shift; - $self->SUPER::preprocess_code; - - if (defined $self->{arguments}) { - my @args = shellwords($self->{arguments}); - my $prelude .= "\nmy \$arglen = " . (scalar @args) . ";\n"; - - if (@args) { - $prelude .= "my \@args = ("; - - my $comma = ""; - foreach my $arg (@args) { - $arg = quotemeta $arg; - $prelude .= "$comma\"$arg\""; - $comma = ", "; - } - - $prelude .= ");\n"; - } else { - $prelude .= "my \@args;\n"; - } - - $self->{code} = "$prelude\n$self->{code}"; - } -} - -sub postprocess_output { - my $self = shift; - $self->SUPER::postprocess_output; - - $self->{output} =~ s/\s+at $self->{sourcefile} line \d+, near ".*?"//; - $self->{output} =~ s/\s*Execution of $self->{sourcefile} aborted due to compilation errors.//; - - $self->{cmdline_opening_comment} = "=cut =============== CMDLINE ===============\n"; - $self->{cmdline_closing_comment} = "=cut\n"; - - $self->{output_opening_comment} = "=cut =============== OUTPUT ===============\n"; - $self->{output_closing_comment} = "=cut\n"; } 1; diff --git a/modules/compiler_vm/languages/tcl.pm b/modules/compiler_vm/languages/tcl.pm index f3a219e8..e64427de 100755 --- a/modules/compiler_vm/languages/tcl.pm +++ b/modules/compiler_vm/languages/tcl.pm @@ -14,10 +14,6 @@ sub initialize { $self->{default_options} = ''; $self->{cmdline} = 'tclsh $options $sourcefile'; - if (length $self->{arguments}) { - $self->{cmdline} .= " $self->{arguments}"; - } - $self->{cmdline_opening_comment} = "set CMDLINE {\n"; $self->{cmdline_closing_comment} = "}\n"; diff --git a/modules/compiler_vm/languages/zsh.pm b/modules/compiler_vm/languages/zsh.pm new file mode 100755 index 00000000..d69eb842 --- /dev/null +++ b/modules/compiler_vm/languages/zsh.pm @@ -0,0 +1,24 @@ +#!/usr/bin/env perl + +use warnings; +use strict; + +package zsh; +use parent '_default'; + +sub initialize { + my ($self, %conf) = @_; + + $self->{sourcefile} = 'prog.zsh'; + $self->{execfile} = 'prog.zsh'; + $self->{default_options} = ''; + $self->{cmdline} = 'zsh $options $sourcefile'; + + $self->{cmdline_opening_comment} = ": <<'____CMDLINE____'\n"; + $self->{cmdline_closing_comment} = "____CMDLINE____\n"; + + $self->{output_opening_comment} = ": << '____OUTPUT____'\n"; + $self->{output_closing_comment} = "____OUTPUT____\n"; +} + +1;