Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cosmetics on the output when parsing the platform raises an exception
[simgrid.git] / teshsuite / simdag / platforms / flatifier.c
index 33ea064..3ff8d2d 100644 (file)
@@ -1,5 +1,10 @@
+/* Copyright (c) 2008, 2009, 2010. The SimGrid Team.
+ * All rights reserved.                                                     */
 
-#ifndef WIN32
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef _XBT_WIN32
 #include <unistd.h>
 #endif
 
@@ -13,6 +18,7 @@
 #include "simdag/simdag.h"
 #include "xbt/log.h"
 #include "xbt/dict.h"
+#include "xbt/ex.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(validator,
                              "Logging specific to this SimDag example");
@@ -43,6 +49,7 @@ int main(int argc, char **argv)
   xbt_dict_t props = NULL;
   xbt_dict_cursor_t cursor = NULL;
   char *key, *data;
+  xbt_ex_t e;
 
   const SD_workstation_t *hosts;
   const SD_link_t *links, *tmp;
@@ -51,11 +58,17 @@ int main(int argc, char **argv)
 
   platformFile = argv[1];
   DEBUG1("%s", platformFile);
-  SD_create_environment(platformFile);
+  TRY {
+    SD_create_environment(platformFile);
+  } CATCH(e) {
+    xbt_die(bprintf("Error while loading %s: %s",platformFile,e.msg));     
+  }
+   
 
   printf("<?xml version='1.0'?>\n");
   printf("<!DOCTYPE platform SYSTEM \"simgrid.dtd\">\n");
   printf("<platform version=\"2\">\n");
+  printf("<AS id=\"AS0\" routing=\"Full\">\n");
 
   totalHosts = SD_workstation_get_number();
   hosts = SD_workstation_get_list();
@@ -106,12 +119,13 @@ int main(int argc, char **argv)
 
         tmp_length = SD_route_get_size(hosts[i], hosts[j]);
         for (k = 0; k < tmp_length; k++) {
-          printf("<link:ctn id=\"%s\"/>", SD_link_get_name(tmp[k]));
+          printf("<link_ctn id=\"%s\"/>", SD_link_get_name(tmp[k]));
         }
         printf("\n  </route>\n");
       }
     }
   }
+  printf("</AS>\n");
   printf("</platform>\n");
   SD_exit();