X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f034296466bf89268e0db232f0a365744efab460..1576126997a42eb30844433bb83477ba01aa6863:/tools/simgrid_update_xml.pl diff --git a/tools/simgrid_update_xml.pl b/tools/simgrid_update_xml.pl index bb98e25b2f..5b7b5a1df2 100755 --- a/tools/simgrid_update_xml.pl +++ b/tools/simgrid_update_xml.pl @@ -12,7 +12,7 @@ use strict; my $fromversion=-1; -my $toversion=2; +my $toversion=3; my($output_string); @@ -22,52 +22,75 @@ 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 = )) { +while (defined($line = )) +{ chomp $line; # eat the header, whatever form it has next if ($line =~ s/<\?xml[^>]*>// && ! $line =~ /\S/); # just in case several tags are on the same line next if ($line =~ s/]*>// && ! $line =~ /\S/); - if ($line =~ s///) { - $fromversion = 0; - next if !$line =~ /\S/; - } elsif ($line =~ s///) { - $fromversion = $1; - if ($fromversion == $toversion) { - warn "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"; - } - next if !$line =~ /\S/; + if ($line =~ s///) + { + $fromversion = 0; + print "version 0\n"; + next if !$line =~ /\S/; + } + elsif ($line =~ s///) + { + $fromversion = $1; + print "version $fromversion\n"; + if ($fromversion == $toversion) + { + 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"; + } + next if !$line =~ /\S/; } - if ($fromversion == 0) { - while ($line =~ m|^(.*?)(.*)$/) + { + $output_string .= " <\/AS>\n<\/platform>"; + } + else + { + $output_string .= "$line\n"; + } } close INPUT;