Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Change way to make tesh for win32.
[simgrid.git] / buildtools / Cmake / tesh.pl
old mode 100644 (file)
new mode 100755 (executable)
index d4e4c99..a1ec8af
@@ -1,16 +1,26 @@
-#!perl -w\r
+#! /usr/bin/perl -w\r
+\r
 use strict;\r
 \r
-if($#ARGV!=1){die "Usage: perl tesh.pl <directory> <teshfile.tesh>\n";}\r
-my($directory)=$ARGV[0];\r
-my($file)=$ARGV[1];\r
+if($#ARGV!=2){die "Usage: tesh.pl --cd <directory> <teshfile.tesh>\n";}\r
 my($line1);\r
 my($line2);\r
 my($execline);\r
 my($ok)=0;\r
-chdir("$directory");\r
-print "Change directory to \"$directory\"\n";\r
+my($nb_arg)=0;\r
+\r
+do{\r
+       if($ARGV[$nb_arg] =~ /^--cd$/)\r
+       {\r
+               $nb_arg++;\r
+               my($directory)=$ARGV[$nb_arg];\r
+               chdir("$directory");\r
+               print "Change directory to \"$directory\"\n";   \r
+       }\r
+       $nb_arg++;\r
+}while(($nb_arg-1)!=$#ARGV);\r
 \r
+my($file)=$ARGV[$nb_arg-1];\r
 open SH_LIGNE, $file or die "Unable to open $file. $!\n";\r
 \r
 while(defined($line1=<SH_LIGNE>))\r
@@ -25,6 +35,8 @@ while(defined($line1=<SH_LIGNE>))
                        $line1 =~ s/^\$\ *//g;\r
                        $line1 =~ s/^.\/lua/lua/g;\r
                        $line1 =~ s/^.\/ruby/ruby/g;\r
+                       \r
+                       $line1 =~ s/\(%i:%P@%h\)/\\\(%i:%P@%h\\\)/g;\r
                        chomp $line1;\r
                        $execline = $line1;\r
                        print "$execline\n";\r
@@ -56,10 +68,17 @@ while(defined($line1=<SH_LIGNE>))
                                {if(!defined($line2=<FILE_ERR>))\r
                                        {       print "- $line1\n";\r
                                                die;}}\r
-                       else{if(!defined($line2=<FILE>))\r
+                       elsif($line1 =~ /^.*\[.*\].*\[0\:\@\].*$/)\r
+                               {if(!defined($line2=<FILE_ERR>))\r
                                        {       print "- $line1\n";\r
                                                die;}}\r
-                       \r
+                       elsif($line1 =~ /^.*\[.*\].*\(0\:\@\).*$/)\r
+                               {if(!defined($line2=<FILE_ERR>))\r
+                                       {       print "- $line1\n";\r
+                                               die;}}\r
+                       else{if(!defined($line2=<FILE>))\r
+                                       {       print "- $line1\n";\r
+                                               die;}}          \r
                        $line2 =~ s/\r//g;                                                      \r
                        chomp $line2;\r
                        \r