From bd99b1d06dd70aa739697de68cd200bd3ea54246 Mon Sep 17 00:00:00 2001 From: mquinson Date: Thu, 30 Sep 2010 18:45:25 +0000 Subject: [PATCH] reindent this script (no real change). I'm wondering why Pierre broke the indentation that badly ;) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8307 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- tools/simgrid_update_xml.pl | 95 ++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 55 deletions(-) diff --git a/tools/simgrid_update_xml.pl b/tools/simgrid_update_xml.pl index 5b7b5a1df2..24ff690fe1 100755 --- a/tools/simgrid_update_xml.pl +++ b/tools/simgrid_update_xml.pl @@ -3,7 +3,7 @@ # 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) -# 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 @@ -25,72 +25,57 @@ $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; - 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 ($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 - { + if($line =~ /^(.*)<\/platform>(.*)$/) { + $output_string .= " <\/AS>\n<\/platform>"; + } else { $output_string .= "$line\n"; - } + } } close INPUT; -- 2.20.1