Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Script to transform v2 platfrom into a v3.
authornavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 29 Sep 2010 13:52:28 +0000 (13:52 +0000)
committernavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 29 Sep 2010 13:52:28 +0000 (13:52 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8297 48e7efb5-ca39-0410-a469-dd3cf9ba447f

tools/simgrid_update_xml_v2_to_v3.pl [new file with mode: 0644]

diff --git a/tools/simgrid_update_xml_v2_to_v3.pl b/tools/simgrid_update_xml_v2_to_v3.pl
new file mode 100644 (file)
index 0000000..10b02fe
--- /dev/null
@@ -0,0 +1,50 @@
+#! /usr/bin/perl
+
+# This script updates the simgrid XML file passed as argument (modification in place)
+# It is built to do the conversion from a XML platfrom version 2 to a version 3
+
+# Copyright (C) 2006-2010. The SimGrid team. All rights reserved.
+#
+# This file is part of the SimGrid project. This is free software:
+# You can redistribute and/or modify it under the terms of the
+# GNU LGPL (v2.1) licence.
+
+use strict;
+
+my($line);
+my($command);
+my($Filecount)=1;
+my($file);
+my($filename_old);
+my($AScount);
+
+if($#ARGV!=0) {
+    die "Error:  Wrong number of parameters\nUsage:\tperl transform_platform.perl [platform_v2.xml]\n";
+}
+
+my($file)=$ARGV[0];
+
+open FILE, "$file" or die "Error:  Unable to open file: \"$file\".\n$!\n";
+while(defined($line=<FILE>))
+{ 
+         $AScount=0;
+         if($line =~ /^(.*)<platform version=\"2\"(.*)$/) 
+         {
+                 print "<platform version=\"3\">\n";
+                 print "<AS  id=\"AS$AScount\"  routing=\"Full\">\n";
+                 $AScount++;
+         }
+         else
+         {
+                 if($line =~ /^(.*)<\/platform(.*)$/) 
+                 {
+                       print "<\/AS>\n";
+                       print "$line";
+                 }
+                 else
+                 {
+                       print "$line";
+                 }
+         }
+}
+close(FILE);
\ No newline at end of file