X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ce1289d4421b08ce6f69d8203784ee648671972e..5b4186afc59b21b326fbe3128e4c39b487dd2c36:/src/surf/surfxml_parse.c diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index d19fdefba4..90c3711c97 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -7,6 +7,7 @@ #include #include #include /* va_arg */ +#include #include "xbt/misc.h" #include "xbt/log.h" @@ -413,15 +414,17 @@ void STag_surfxml_prop(void) as_current_property_set = xbt_dict_new_homogeneous(xbt_free_f); // Maybe, it should raise an error as_name_tab[as_prop_nb] = xbt_strdup(A_surfxml_AS_id); as_dict_tab[as_prop_nb] = as_current_property_set; - XBT_DEBUG("PUSH prop %p for AS '%s'",as_dict_tab[as_prop_nb],as_name_tab[as_prop_nb]); + XBT_DEBUG("PUSH prop set %p for AS '%s'",as_dict_tab[as_prop_nb],as_name_tab[as_prop_nb]); as_prop_nb++; } + XBT_DEBUG("add prop %s=%s into current AS property set", A_surfxml_prop_id, A_surfxml_prop_value); xbt_dict_set(as_current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), NULL); } else{ if (!current_property_set) current_property_set = xbt_dict_new(); // Maybe, it should raise an error xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), xbt_free_f); + XBT_DEBUG("add prop %s=%s into current property set", A_surfxml_prop_id, A_surfxml_prop_value); } } @@ -502,7 +505,7 @@ void STag_surfxml_router(void){ void ETag_surfxml_cluster(void){ s_sg_platf_cluster_cbarg_t cluster; memset(&cluster,0,sizeof(cluster)); - cluster.properties = current_property_set; + cluster.properties = as_current_property_set; cluster.id = A_surfxml_cluster_id; cluster.prefix = A_surfxml_cluster_prefix; @@ -1025,6 +1028,8 @@ void surf_parse_open(const char *file) if (!surf_parsed_filename_stack) surf_parsed_filename_stack = xbt_dynar_new(sizeof(char *), &xbt_free_ref); surf_parsed_filename = xbt_strdup(file); + char *dir = dirname(surf_parsed_filename); + xbt_dynar_push(surf_path, &dir); surf_file_to_parse = surf_fopen(file, "r"); xbt_assert((surf_file_to_parse), "Unable to open \"%s\"\n", file); @@ -1038,6 +1043,11 @@ void surf_parse_close(void) xbt_dynar_free(&surf_input_buffer_stack); xbt_dynar_free(&surf_file_to_parse_stack); xbt_dynar_free(&surf_parsed_filename_stack); + if (surf_parsed_filename) { + char *dir = NULL; + xbt_dynar_pop(surf_path, dir); + free(dir); + } free(surf_parsed_filename); surf_parsed_filename = NULL;