X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/27680c02b4e665650698b64e4da27bc1cbfc2752..b1b6cb61ca85e53ac6d90a9b2bdc7d031ebaa6b8:/src/surf/surfxml_parse.c diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 31e3397cd4..a5f91f6401 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -10,15 +10,15 @@ #include "xbt/dict.h" #include "surf/surfxml_parse_private.h" #include "surf/surf_private.h" -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(parse, surf, - "Logging specific to the SURF module"); +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf, + "Logging specific to the SURF parsing module"); #undef CLEANUP #include "surfxml.c" /* make sure these symbols are defined as strong ones in this file so that the linked can resolve them */ -xbt_dynar_t STag_surfxml_platform_description_cb_list = NULL; -xbt_dynar_t ETag_surfxml_platform_description_cb_list = NULL; +xbt_dynar_t STag_surfxml_platform_cb_list = NULL; +xbt_dynar_t ETag_surfxml_platform_cb_list = NULL; xbt_dynar_t STag_surfxml_host_cb_list = NULL; xbt_dynar_t ETag_surfxml_host_cb_list = NULL; xbt_dynar_t STag_surfxml_router_cb_list = NULL; @@ -36,6 +36,8 @@ xbt_dynar_t ETag_surfxml_argument_cb_list = NULL; xbt_dynar_t STag_surfxml_prop_cb_list = NULL; xbt_dynar_t ETag_surfxml_prop_cb_list = NULL; +xbt_dict_t current_property_set = NULL; + static xbt_dynar_t surf_input_buffer_stack = NULL; static xbt_dynar_t surf_file_to_parse_stack = NULL; @@ -44,27 +46,49 @@ static inline void surfxml_call_cb_functions(xbt_dynar_t); YY_BUFFER_STATE surf_input_buffer; FILE *surf_file_to_parse; -void surf_parse_reset_parser(void) +void surf_parse_free_callbacks(void) { + xbt_dynar_free(&STag_surfxml_platform_cb_list); + xbt_dynar_free(&ETag_surfxml_platform_cb_list); + xbt_dynar_free(&STag_surfxml_host_cb_list); + xbt_dynar_free(&ETag_surfxml_host_cb_list); + xbt_dynar_free(&STag_surfxml_router_cb_list); + xbt_dynar_free(&ETag_surfxml_router_cb_list); + xbt_dynar_free(&STag_surfxml_link_cb_list); + xbt_dynar_free(&ETag_surfxml_link_cb_list); + xbt_dynar_free(&STag_surfxml_route_cb_list); + xbt_dynar_free(&ETag_surfxml_route_cb_list); + xbt_dynar_free(&STag_surfxml_link_c_ctn_cb_list); + xbt_dynar_free(&ETag_surfxml_link_c_ctn_cb_list); + xbt_dynar_free(&STag_surfxml_process_cb_list); + xbt_dynar_free(&ETag_surfxml_process_cb_list); + xbt_dynar_free(&STag_surfxml_argument_cb_list); + xbt_dynar_free(&ETag_surfxml_argument_cb_list); + xbt_dynar_free(&STag_surfxml_prop_cb_list); + xbt_dynar_free(&ETag_surfxml_prop_cb_list); +} - STag_surfxml_platform_description_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - ETag_surfxml_platform_description_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - STag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - ETag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - STag_surfxml_router_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - ETag_surfxml_router_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - STag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - ETag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - STag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - ETag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - STag_surfxml_link_c_ctn_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - ETag_surfxml_link_c_ctn_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - STag_surfxml_process_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - ETag_surfxml_process_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - STag_surfxml_argument_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - ETag_surfxml_argument_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - STag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); - ETag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t),&free); +void surf_parse_reset_parser(void) +{ + surf_parse_free_callbacks(); + STag_surfxml_platform_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + ETag_surfxml_platform_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + STag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + ETag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + STag_surfxml_router_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + ETag_surfxml_router_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + STag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + ETag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + STag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + ETag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + STag_surfxml_link_c_ctn_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + ETag_surfxml_link_c_ctn_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + STag_surfxml_process_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + ETag_surfxml_process_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + STag_surfxml_argument_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + ETag_surfxml_argument_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + STag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + ETag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); } @@ -92,11 +116,11 @@ void ETag_surfxml_include(void) xbt_dynar_pop(surf_input_buffer_stack, &surf_input_buffer); } -void STag_surfxml_platform_description(void) +void STag_surfxml_platform(void) { double version = 0.0; - sscanf(A_surfxml_platform_description_version, "%lg", &version); + sscanf(A_surfxml_platform_version, "%lg", &version); xbt_assert0((version >= 1.0), "******* BIG FAT WARNING *********\n " "You're using an ancient XML file. " @@ -116,12 +140,12 @@ void STag_surfxml_platform_description(void) "is available in the contrib/platform_generation directory " "of the simgrid repository."); - surfxml_call_cb_functions(STag_surfxml_platform_description_cb_list); + surfxml_call_cb_functions(STag_surfxml_platform_cb_list); } -void ETag_surfxml_platform_description(void) +void ETag_surfxml_platform(void) { - surfxml_call_cb_functions(ETag_surfxml_platform_description_cb_list); + surfxml_call_cb_functions(ETag_surfxml_platform_cb_list); } void STag_surfxml_host(void)