Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Call surf_parse_models_setup() from the right level
[simgrid.git] / src / surf / surfxml_parseplatf.c
index 23865b4..72d1ed4 100644 (file)
@@ -52,11 +52,10 @@ void surfxml_bufferstack_pop(int new)
  * Pass arguments to parsing callback as structures to save some time (and allow callbacks to ignore some)
  */
 
-hostSG_t struct_host = NULL;
-router_t struct_router = NULL;
-cluster_t struct_cluster = NULL;
-peer_t struct_peer = NULL;
-link_t struct_lnk = NULL;
+surf_parsing_router_arg_t struct_router = NULL;
+surf_parsing_cluster_arg_t struct_cluster = NULL;
+surf_parsing_peer_arg_t struct_peer = NULL;
+surf_parsing_link_arg_t struct_lnk = NULL;
 
 
 /*
@@ -76,7 +75,6 @@ static char *trace_id = NULL;
 
 static void parse_Stag_trace(void)
 {
-  surf_parse_models_setup(); /* ensure that the models are created after the last <config> tag. See comment in simgrid.dtd */
   trace_id = xbt_strdup(A_surfxml_trace_id);
   trace_file = xbt_strdup(A_surfxml_trace_file);
   surf_parse_get_double(&trace_periodicity, A_surfxml_trace_periodicity);
@@ -104,8 +102,6 @@ static void parse_Etag_trace(void)
 
 static void parse_Stag_trace_connect(void)
 {
-  surf_parse_models_setup(); /* ensure that the models are created after the last <config> tag. See comment in simgrid.dtd */
-
   xbt_assert(xbt_dict_get_or_null
               (traces_set_list, A_surfxml_trace_connect_trace),
               "Cannot connect trace %s to %s: trace unknown",
@@ -143,6 +139,14 @@ static void parse_Stag_trace_connect(void)
   }
 }
 
+/* Call the right C function when we see the <AS> tags */
+static void parse_S_AS(void) {
+  routing_AS_init(A_surfxml_AS_id, A_surfxml_AS_routing);
+}
+static void parse_E_AS(void) {
+  routing_AS_end(A_surfxml_AS_id);
+}
+
 
 /* Init and free parse data */
 
@@ -162,6 +166,10 @@ static void init_data(void)
   surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_Etag_trace);
   surfxml_add_callback(STag_surfxml_trace_connect_cb_list,
              &parse_Stag_trace_connect);
+
+  /* we care about the ASes while parsing the platf. Incredible, isnt it? */
+  surfxml_add_callback(STag_surfxml_AS_cb_list, &parse_S_AS);
+  surfxml_add_callback(ETag_surfxml_AS_cb_list, &parse_E_AS);
 }
 
 static void free_data(void)