X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=utils%2Fparallel%2Ftemplate.pl;fp=utils%2Fparallel%2Ftemplate.pl;h=7fbe4cf797bea073733a55223e24d1e650c2c818;hb=0065d5ab628975892cea1ec7303f968c3338cbe1;hp=0000000000000000000000000000000000000000;hpb=28a464a75e14cece5db40f2765a29348273ff2d2;p=ghc-hetmet.git diff --git a/utils/parallel/template.pl b/utils/parallel/template.pl new file mode 100644 index 0000000..7fbe4cf --- /dev/null +++ b/utils/parallel/template.pl @@ -0,0 +1,141 @@ +#!/usr/local/bin/perl +############################################################################## +# Time-stamp: +# +# Usage: do read_template(,); +# +# Read the template file as defined in /dev/null. +# Set global variables as defined in the template file. +# This is mainly used in gran-extr and RTS2gran. +# +############################################################################## + +require "par-aux.pl"; + +sub read_template { + local ($org_templ_file_name,$input) = @_; + local ($f,$templ_file_name); + + # Resolve name + $gran_dir = $ENV{GRANDIR} ? $ENV{GRANDIR} : $ENV{HOME} ; + $templ_file_name = ( $org_templ_file_name eq '.' ? "TEMPL" + #^^^ default file name + : $org_templ_file_name eq ',' ? $gran_dir . "/bin/TEMPL" + #^^^ global master template + : $org_templ_file_name eq '/' ? $gran_dir . "/bin/T0" + #^^ template, that throws away most of the info + : $org_templ_file_name ); + + if ( $opt_v ) { + print "Reading template file $templ_file_name ...\n"; + } + + ($f = ($input eq "-" ? "stdin" : $input)) =~ s/.rts//; + + open(TEMPLATE,"cat $templ_file_name | sed -e 's/\$0/$f/' |") + || die "Couldn't open file $templ_file_name"; + + while (