Algorithmique Numérique Distribuée Public GIT Repository
1 #!/usr/bin/perl -w
2 use strict;
4 if(\$#ARGV!=1) {
5     die "Usage: perl make_tesh.pl <directory> <old.tesh>\n";
6 }
8 my(\$directory)=\$ARGV[0];
9 my(\$old)=\$ARGV[1];
11 chdir("\$directory");
13 open SH_LIGNE, \$old or die "Unable to open \$old. \$!\n";
15 my(\$line);
16 my(\$line_exec);
17 my(\$l);
18 my(\$tmp);
20 print "#! ./tesh\n";
22 while(defined(\$line=<SH_LIGNE>))
23 {
24         if(\$line =~ /^p(.*)\$/)
25         {
26                 print "\$line\n";
27         }
28         else
29         {
30                 if(\$line =~ /^\\$(.*)\$/)
31                 {
32                         \$line_exec = \$line;
33                         \$line =~ s/\\$\{srcdir\:\=\.\}/./g;
34                         \$line =~ s/\\$SG_TEST_EXENV//g;
35                         \$line =~ s/\\$EXEEXT//g;
36                         \$line =~ s/^\\$\ */.\//g;
37                         \$line =~ s/^.\/lua/lua/g;
38                         \$line =~ s/^.\/ruby/ruby/g;
39                         print "\n\$line_exec";
40                         chomp \$line;
41                         open (FILE, "\$line 2>&1|");
42                         while(defined(\$l=<FILE>))
43                         {
44                         chomp \$l;
45                         print "\> \$l\n";
46                         }
48                 }
49                 close(FILE);
50         }
51 }
53 close(SH_LIGNE);