Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix the way to bypass the cpu_im without hard coding the model
[simgrid.git] / src / surf / surfxml_parse.c
index f312e78..0ef9b64 100644 (file)
@@ -269,6 +269,7 @@ void ETag_surfxml_platform(void)
 void STag_surfxml_host(void)
 {
   surfxml_call_cb_functions(STag_surfxml_host_cb_list);
+
 }
 
 void ETag_surfxml_host(void)
@@ -437,13 +438,14 @@ void surf_parse_open(const char *file)
     }
     return;
   }
+  surf_file_to_parse = surf_fopen(file, "r");
+  xbt_assert1((surf_file_to_parse), "Unable to open \"%s\"\n", file);
+
   if (!surf_input_buffer_stack)
     surf_input_buffer_stack = xbt_dynar_new(sizeof(YY_BUFFER_STATE), NULL);
   if (!surf_file_to_parse_stack)
     surf_file_to_parse_stack = xbt_dynar_new(sizeof(FILE *), NULL);
 
-  surf_file_to_parse = surf_fopen(file, "r");
-  xbt_assert1((surf_file_to_parse), "Unable to open \"%s\"\n", file);
   surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, 10);
   surf_parse__switch_to_buffer(surf_input_buffer);
   surf_parse_lineno = 1;
@@ -608,11 +610,15 @@ static void free_data(void)
 
 void parse_platform_file(const char *file)
 {
+  int parse_status;
   surf_parse_open(file);
   init_data();
-  xbt_assert1((!(*surf_parse) ()), "Parse error in %s", file);
+  parse_status = surf_parse();
   free_data();
   surf_parse_close();
+  if (parse_status)
+    xbt_dict_free(&random_data_list);
+  xbt_assert1(!parse_status, "Parse error in %s", file);
 }
 
 /* Functions to bypass route tag. Used by the route:multi tag */
@@ -692,6 +698,7 @@ static void parse_sets(void)
 }
 
 static void parse_host_foreach(void){
+
   xbt_dynar_t names = NULL;
   unsigned int cpt = 0;
   char *name;
@@ -1159,3 +1166,10 @@ static void add_randomness(void)
                random_std_deviation);
   xbt_dict_set(random_data_list, random_id, (void *) random, NULL);
 }
+
+
+/* Init Host bypassing XML*/
+void init_host_bypass(char* name,double power)
+{
+       surf_cpu_im_init_bypass(name,power);
+}