5 my $input = shift @ARGV || die "Usage: $ARGV[0] platform_file.xml nb_host\n";
6 my $nb_hosts = shift @ARGV || die "Usage: $ARGV[0] platform_file.xml nb_host\n";
10 open IN,$input || die "Cannot open $input: $!\n";
13 next unless /<cpu name="([^"]*)"/; # "
18 # map { print "$_\n" } @host;
20 print "<?xml version='1.0'?>\n";
21 print "<!DOCTYPE platform_description SYSTEM \"surfxml.dtd\">\n";
22 print "<platform_description>\n\n";
28 for (my $i=0; $i<$nb_hosts -1; $i++) {
30 print " <process host=\"".$host[$it_host]."\" function=\"node\">\n";
31 print " <argument value=\"". $it_port ."\"/> <!-- port on which I am listening -->\n";
33 if ($it_host == scalar @host) {
37 print " <argument value=\"". $host[ $it_host ]."\"/> <!-- peer (successor) host -->\n";
38 print " <argument value=\"".($it_port)."\"/> <!-- port on which peer is listening -->\n";
39 print " </process>\n\n";
43 print " <process host=\"".$host[$it_host]."\" function=\"node\">\n";
44 print " <argument value=\"". $it_port ."\"/> <!-- port on which I am listening -->\n";
45 print " <argument value=\"". $host[ 0 ]."\"/> <!-- peer (successor) host -->\n";
46 print " <argument value=\"4000\"/> <!-- port on which peer is listening -->\n";
47 print " <argument value=\"--create-token\"/> <!-- I'm first client, ie I have to create the token -->\n";
48 print " </process>\n\n";
50 print "</platform_description>\n";