X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f034296466bf89268e0db232f0a365744efab460..ab3b0dcebcadbe3da395e9e8f73aefadb88b3924:/tools/simgrid_update_xml.pl diff --git a/tools/simgrid_update_xml.pl b/tools/simgrid_update_xml.pl index bb98e25b2f..2ca57b959b 100755 --- a/tools/simgrid_update_xml.pl +++ b/tools/simgrid_update_xml.pl @@ -1,9 +1,9 @@ #! /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-2007. The SimGrid team. All rights reserved. +# 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 @@ -12,7 +12,7 @@ use strict; my $fromversion=-1; -my $toversion=2; +my $toversion=3; my($output_string); @@ -22,6 +22,7 @@ open INPUT, "$ARGV[0]" or die "Cannot open input file $ARGV[0]: $!\n"; $output_string .= "\n"; $output_string .= "\n"; $output_string .= "\n"; +$output_string .= " \n"; my $line; while (defined($line = )) { @@ -32,11 +33,13 @@ while (defined($line = )) { if ($line =~ s///) { $fromversion = 0; + print "version 0\n"; next if !$line =~ /\S/; - } elsif ($line =~ s///) { + } elsif ($line =~ s///) { $fromversion = $1; + print "version $fromversion\n"; if ($fromversion == $toversion) { - warn "Input platform file version is already $fromversion. This should be a no-op.\n"; + die "Input platform file version is already $fromversion. This should be a no-op.\n"; } if ($fromversion > $toversion) { die "Input platform file version is more recent than this script (file version: $fromversion; script version: $toversion)\n"; @@ -59,15 +62,22 @@ while (defined($line = )) { } } - if ($fromversion < 2) { - # The renamings (\b=zero-width word boundary check) + if ($fromversion < 2) { + # The renamings (\b=zero-width word boundary check) $line =~ s/\bplatform_description\b/platform/g; $line =~ s/\bname\b/id/g; $line =~ s/\bcpu\b/host/g; $line =~ s/\bnetwork_link\b/link/g; $line =~ s/\broute_element\b/link:ctn/g; } - $output_string .= "$line\n"; + + if ($fromversion < 3) { + $line =~ s/\blink:ctn\b/link_ctn/g; + $line =~ s/\btrace:connect\b/trace_connect/g; + $line =~ s/^(.*)<\/platform>(.*)$/ <\/AS>\n<\/platform>/; + } + + $output_string .= "$line\n"; } close INPUT;