X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/dc6913c52605e309e5bbbf3bcccec1e15a1ae03b..5901b83edba40e5e7baa8197acc502e2b26b66da:/src/surf/surf_routing.c diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 583028ea24..25f4fa6b59 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -55,7 +55,7 @@ static void routing_parse_Sconfig(void); /* config Tag */ static void routing_parse_Econfig(void); /* config Tag */ static char* replace_random_parameter(char * chaine); -static void clean_dict_random(void); +static void clean_routing_after_parse(void); /* this lines are only for replace use like index in the model table */ typedef enum { @@ -980,7 +980,7 @@ void routing_model_create(size_t size_of_links, void *loopback, double_f_cpvoid_ &routing_parse_Speer); surfxml_add_callback(ETag_surfxml_platform_cb_list, - &clean_dict_random); + &clean_routing_after_parse); #ifdef HAVE_TRACING instr_routing_define_callbacks(); @@ -992,16 +992,20 @@ void surf_parse_add_callback_config(void) surfxml_add_callback(STag_surfxml_config_cb_list, &routing_parse_Sconfig); surfxml_add_callback(ETag_surfxml_config_cb_list, &routing_parse_Econfig); surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties_XML); - surfxml_add_callback(STag_surfxml_AS_cb_list, &surf_parse_models_setup); surfxml_add_callback(STag_surfxml_random_cb_list, &routing_parse_Srandom); } +static int surf_parse_models_setup_already_called=0; +/* Call the last initialization functions, that must be called after the + * tag, if any, and before the first of cluster|peer|AS|trace|trace_connect + */ void surf_parse_models_setup() { + if (surf_parse_models_setup_already_called) + return; + surf_parse_models_setup_already_called=1; routing_parse_Erandom(); - surfxml_del_callback(STag_surfxml_AS_cb_list, surf_parse_models_setup); - surf_config_models_setup(platform_filename); - free(platform_filename); + surf_config_models_setup(); } /* ************************************************** */ @@ -1481,7 +1485,7 @@ static void routing_parse_Econfig(void) if(xbt_cfg_is_default_value(_surf_cfg_set, key)) xbt_cfg_set_parse(_surf_cfg_set, cfg); else - XBT_INFO("The custom configuration '%s' is already define by user!",key); + XBT_INFO("The custom configuration '%s' is already defined by user!",key); free(cfg); } XBT_DEBUG("End configuration name = %s",A_surfxml_config_id); @@ -1862,10 +1866,11 @@ static char* replace_random_parameter(char * string) return string; } -static void clean_dict_random(void) +static void clean_routing_after_parse(void) { xbt_dict_free(&random_value); xbt_dict_free(&patterns); + surf_parse_models_setup_already_called = 0; /* make sure that this function will be called again when reloading a platf */ } static void routing_parse_Speer(void) @@ -2098,17 +2103,16 @@ static void routing_parse_Srandom(void) static void routing_parse_Erandom(void) { - xbt_dict_cursor_t cursor = NULL; + /*xbt_dict_cursor_t cursor = NULL; char *key; char *elem; xbt_dict_foreach(random_value, cursor, key, elem) { XBT_DEBUG("%s = %s",key,elem); } - +*/ } - /* * New methods to init the routing model component from the lua script */