X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8dcab2e3c296d3bf6ec701ccba85b45856c67e7e..d03dd509a40da2d9e0038e2ca89fb40bee62ec8f:/src/surf/surfxml_parse.c diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 8691238417..13a387bdcc 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -24,6 +24,32 @@ xbt_dict_t trace_connect_list_link_avail = NULL; xbt_dict_t trace_connect_list_bandwidth = NULL; xbt_dict_t trace_connect_list_latency = NULL; +/* This buffer is used to store the original buffer before substituting it by out own buffer. Useful for the foreach tag */ +static xbt_dynar_t surfxml_bufferstack_stack = NULL; +int surfxml_bufferstack_size = 2048; +static char *old_buff = NULL; +static void surf_parse_error(char *msg); + +void surfxml_bufferstack_push(int new) +{ + if (!new) + old_buff = surfxml_bufferstack; + else { + xbt_dynar_push(surfxml_bufferstack_stack, &surfxml_bufferstack); + surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size); + } +} + +void surfxml_bufferstack_pop(int new) +{ + if (!new) + surfxml_bufferstack = old_buff; + else { + free(surfxml_bufferstack); + xbt_dynar_pop(surfxml_bufferstack_stack, &surfxml_bufferstack); + } +} + /* 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_cb_list = NULL; xbt_dynar_t ETag_surfxml_platform_cb_list = NULL; @@ -43,6 +69,8 @@ xbt_dynar_t STag_surfxml_argument_cb_list = NULL; 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_dynar_t STag_surfxml_cluster_cb_list = NULL; +xbt_dynar_t ETag_surfxml_cluster_cb_list = NULL; xbt_dynar_t STag_surfxml_trace_cb_list = NULL; xbt_dynar_t ETag_surfxml_trace_cb_list = NULL; xbt_dynar_t STag_surfxml_trace_c_connect_cb_list = NULL; @@ -107,6 +135,8 @@ void surf_parse_free_callbacks(void) xbt_dynar_free(&ETag_surfxml_ASroute_cb_list); xbt_dynar_free(&STag_surfxml_bypassRoute_cb_list); xbt_dynar_free(&ETag_surfxml_bypassRoute_cb_list); + xbt_dynar_free(&STag_surfxml_cluster_cb_list); + xbt_dynar_free(&ETag_surfxml_cluster_cb_list); } void surf_parse_reset_parser(void) @@ -142,6 +172,8 @@ void surf_parse_reset_parser(void) ETag_surfxml_ASroute_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); STag_surfxml_bypassRoute_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); ETag_surfxml_bypassRoute_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); + STag_surfxml_cluster_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); + ETag_surfxml_cluster_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); } /* Stag and Etag parse functions */ @@ -193,6 +225,7 @@ parse_method(S,random); parse_method(E,random); parse_method(S,AS); parse_method(E,AS); parse_method(S,ASroute); parse_method(E,ASroute); parse_method(S,bypassRoute); parse_method(E,bypassRoute); +parse_method(S,cluster); parse_method(E,cluster); /* Open and Close parse file */ @@ -286,6 +319,9 @@ static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t cb_list) static void init_data(void) { + if (!surfxml_bufferstack_stack) + surfxml_bufferstack_stack = xbt_dynar_new(sizeof(char *), NULL); + random_data_list = xbt_dict_new(); traces_set_list = xbt_dict_new(); trace_connect_list_host_avail = xbt_dict_new(); @@ -311,6 +347,7 @@ static void free_data(void) xbt_dict_free(&trace_connect_list_latency); xbt_dict_free(&traces_set_list); xbt_dict_free(&random_data_list); + xbt_dynar_free(&surfxml_bufferstack_stack); } /* Here start parse */ @@ -575,4 +612,4 @@ void surf_set_routes(void) { xbt_die("\"surf_set_routes\" not support"); //routing_set_routes(); // COMMENTED BY DAVID -} \ No newline at end of file +}