Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Clean tabs for publis.html
[simgrid.git] / tools / simgrid_update_xml.pl
index 171bdc2..16d4bc7 100755 (executable)
@@ -1,7 +1,7 @@
 #! /usr/bin/perl
 
 # This script updates the simgrid XML file passed as argument (modification in place)
-# It is built to do the conversion incrementally (even if for now, only 2 versions are defined)
+# It is built to do the conversion incrementally.
 
 # Copyright (C) 2006-2010. The SimGrid team. All rights reserved.
 #
@@ -19,10 +19,12 @@ my($output_string);
 $ARGV[0] or die "simgrid_update_xml.pl <platform.xml>\n";
 open INPUT, "$ARGV[0]" or die "Cannot open input file $ARGV[0]: $!\n";
 
-$output_string .=  "<?xml version='1.0'?>\n";
-$output_string .=  "<!DOCTYPE platform SYSTEM \"simgrid.dtd\">\n";
-$output_string .=  "<platform version=\"$toversion\">\n";
-$output_string .=  " <AS  id=\"AS0\"  routing=\"Full\">\n";
+$output_string = "<?xml version='1.0'?>\n".
+    "<!DOCTYPE platform SYSTEM \"http://simgrid.gforge.inria.fr/simgrid.dtd\">\n".
+    "<platform version=\"$toversion\">\n";
+
+
+my($AS_opened)=0;
 
 my $line;
 while (defined($line = <INPUT>)) {
@@ -72,12 +74,27 @@ while (defined($line = <INPUT>)) {
     }
     
     if ($fromversion < 3)  {
-       if($line =~ /^(.*)<\/platform>(.*)$/) {
-           $output_string .=  " <\/AS>\n<\/platform>";
-       } else {
-           $output_string .=  "$line\n";
+       $line =~ s/\blink:ctn\b/link_ctn/g;
+       $line =~ s/\btrace:connect\b/trace_connect/g;
+
+       if($AS_opened && (($line=~ /<\/platform>/) || ($line=~ /<process/))) {
+           $output_string .= "</AS>\n";
+           $AS_opened = 0;
+       }
+
+       if( (!$AS_opened) && (
+               ($line =~ /<host/)    ||
+               ($line =~ /<link/)    ||
+               ($line =~ /<cluster/) ||
+               ($line =~ /<router/)
+           )) {
+           $output_string .=  " <AS  id=\"AS0\"  routing=\"Full\">\n";
+           $AS_opened=1;
        }
     }
+       
+       if($line=~/<route /){$line =~ s/\<route/\<route symmetrical=\"NO\"/g;}
+    $output_string .= "$line\n";
 }
 
 close INPUT;