5 $ARGV[0] or die "msg2surf.pl <platform.txt>";
6 open INPUT, "$ARGV[0]" or die;
10 my($parsing_link) = 0;
11 my($parsing_route) = 0;
16 print "<?xml version='1.0'?>\n";
17 print "<!DOCTYPE platform_description SYSTEM \"surfxml.dtd\">\n";
18 print "<platform_description>\n";
20 while(defined($line=<INPUT>)){
38 if($line=~ /^\s*(\w+)\s+([0-9\.]+)\s*$/) {
39 print " <cpu name=\"$1\" power=\"$2\"/>\n";
40 } else die "Cannot understand line \"$line\"\n";
43 if($line=~ /^\s*(\w+)\s+([0-9\.]+)\s*([0-9\.]+)\s*$/) {
46 print " <network_link name=\"$1\" bandwidth=\"$2\" latency=\"$lat\"/>\n";
47 } else die "Cannot understand line \"$line\"\n";
50 if($line=~ /^\s*(\w+)\s+(\w+)\s+\((.*)\)\s*$/) {
51 @link_list=split(/\s+/, $3);
52 print " <route src=\"$1\" dst=\"$2\">";
53 foreach $link (@link_list) {
54 print "<route_element name=\"$link\"/>";
57 } else die "Cannot understand line \"$line\"\n";
60 print "</platform_description>\n";