From cd709fc1a07a53e8fa8c07d144c36483761e90a9 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 4 Nov 2011 22:34:04 +0100 Subject: [PATCH 1/1] Call surf_parse_models_setup() from the right level This function is in charge of initializing the models after all configs have been parsed. It used to be called in the XML parser callback, it is now called from the platform creation API, which is intended to be called either from the XML parser or from the lua console, or directly from the user code. --- src/surf/surf_routing.c | 3 +++ src/surf/surfxml_parse.c | 6 ------ src/surf/surfxml_parseplatf.c | 3 --- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 349b8cf2a0..007a2cc8ba 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -429,6 +429,9 @@ void routing_AS_init(const char *AS_id, const char *wanted_routing_type) routing_component_t new_routing; model_type_t model = NULL; int cpt; + + surf_parse_models_setup(); /* ensure that the models are created after the last tag and before the first -like */ + /* search the routing model */ for (cpt = 0; routing_models[cpt].name; cpt++) if (!strcmp(wanted_routing_type, routing_models[cpt].name)) diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index c4f4a504ef..c255656ea8 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -349,8 +349,6 @@ void ETag_surfxml_router(void){ } void STag_surfxml_cluster(void){ - surf_parse_models_setup(); /* ensure that the models are created after the last tag. See comment in simgrid.dtd */ - struct_cluster = xbt_new0(s_surf_parsing_cluster_arg_t, 1); struct_cluster->V_cluster_id = xbt_strdup(A_surfxml_cluster_id); struct_cluster->V_cluster_prefix = xbt_strdup(A_surfxml_cluster_prefix); @@ -393,8 +391,6 @@ void ETag_surfxml_cluster(void){ } void STag_surfxml_peer(void){ - surf_parse_models_setup(); /* ensure that the models are created after the last tag. See comment in simgrid.dtd */ - struct_peer = xbt_new0(s_surf_parsing_peer_arg_t, 1); struct_peer->V_peer_id = xbt_strdup(A_surfxml_peer_id); struct_peer->V_peer_power = xbt_strdup(A_surfxml_peer_power); @@ -477,8 +473,6 @@ void STag_surfxml_trace_connect(void){ surfxml_call_cb_functions(STag_surfxml_trace_connect_cb_list); } void STag_surfxml_AS(void){ - surf_parse_models_setup(); /* ensure that the models are created after the last tag. See comment in simgrid.dtd */ - surfxml_call_cb_functions(STag_surfxml_AS_cb_list); } void STag_surfxml_ASroute(void){ diff --git a/src/surf/surfxml_parseplatf.c b/src/surf/surfxml_parseplatf.c index 3d2ff37d3d..72d1ed48c8 100644 --- a/src/surf/surfxml_parseplatf.c +++ b/src/surf/surfxml_parseplatf.c @@ -75,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 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); @@ -103,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 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", -- 2.20.1