From: alegrand Date: Mon, 31 Jan 2005 18:02:07 +0000 (+0000) Subject: helper... X-Git-Tag: v3.3~4528 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3ac9530bdd50a7a168638228b1696f893d616b67 helper... git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@822 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/tools/platform_generation/msgplatform2surfxml.pl b/tools/platform_generation/msgplatform2surfxml.pl new file mode 100755 index 0000000000..59439d0f14 --- /dev/null +++ b/tools/platform_generation/msgplatform2surfxml.pl @@ -0,0 +1,62 @@ +#!/usr/bin/perl -w + +use strict; + +$ARGV[0] or die "msg2surf.pl "; +open INPUT, "$ARGV[0]" or die; + +my($line); +my($parsing_host) = 0; +my($parsing_link) = 0; +my($parsing_route) = 0; +my($lat); +my(@link_list) = (); +my($link); + +print "\n"; +print "\n"; +print "\n"; + +while(defined($line=)){ + chomp $line; + if($line=~/HOSTS/) { + $parsing_host=1; + next; + } + if($line=~/LINKS/) { + $parsing_host=0; + $parsing_link=1; + next; + } + if($line=~/ROUTES/) { + $parsing_link=0; + $parsing_route=1; + next; + } + + if($parsing_host) { + if($line=~ /^\s*(\w+)\s+([0-9\.]+)\s*$/) { + print " \n"; + } else die "Cannot understand line \"$line\"\n"; + } + if($parsing_link) { + if($line=~ /^\s*(\w+)\s+([0-9\.]+)\s*([0-9\.]+)\s*$/) { + $lat=$3; + $lat/=1000; + print " \n"; + } else die "Cannot understand line \"$line\"\n"; + } + if($parsing_route) { + if($line=~ /^\s*(\w+)\s+(\w+)\s+\((.*)\)\s*$/) { + @link_list=split(/\s+/, $3); + print " "; + foreach $link (@link_list) { + print ""; + } + print "\n"; + } else die "Cannot understand line \"$line\"\n"; + } +} +print "\n"; + +