X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/687f4837379b6b1d25eecb3c3ad9faa6e495efc8..bb38b738b6810c3e4c0be80ffc5de5eb25e62435:/src/surf/surfxml_parse.c diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 9bb8b4e375..5c6aa3885a 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -7,6 +7,7 @@ #include "xbt/misc.h" #include "xbt/log.h" +#include "xbt/str.h" #include "xbt/dict.h" #include "surf/surfxml_parse_private.h" #include "surf/surf_private.h" @@ -15,7 +16,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf, "Logging specific to the SURF parsing module"); #undef CLEANUP -#include "surfxml.c" +#include "simgrid_dtd.c" /* Initialize the parsing globals */ int route_action = 0; @@ -850,12 +851,14 @@ static void convert_route_multi_to_routes(void) unsigned int cpt, cpt2, cursor; char *src_host_name, *dst_host_name, *key, *src, *dst, *val, *key_w, *data_w; const char* sep="#"; + xbt_dict_t set; xbt_dynar_t src_names = NULL, dst_names = NULL, links; if (!route_multi_elements) return; - xbt_dict_t set = cpu_set; - if (workstation_set != NULL) + set = cpu_set; + DEBUG1("%d", xbt_dict_length(workstation_set)); + if (workstation_set != NULL && xbt_dict_length(workstation_set) > 0) set = workstation_set; @@ -880,18 +883,23 @@ static void convert_route_multi_to_routes(void) src_names = xbt_dynar_new(sizeof(char *), &free_string); val = xbt_strdup(src); xbt_dynar_push(src_names, &val); + if (strcmp(val,"$*") != 0 && NULL == xbt_dict_get_or_null(set, val)) + THROW3(unknown_error,0,"(In route:multi (%s -> %s) source %s does not exist (not a set or a host)", src, dst, src); } if (dst_names == NULL) { dst_names = xbt_dynar_new(sizeof(char *), &free_string); val = xbt_strdup(dst); + if (strcmp(val,"$*") != 0 && NULL == xbt_dict_get_or_null(set, val)) + THROW3(unknown_error,0,"(In route:multi (%s -> %s) destination %s does not exist (not a set or a host)", src, dst, dst); xbt_dynar_push(dst_names, &val); } + /* Build the routes */ DEBUG2("ADDING MULTI ROUTE: %s -> %s", xbt_dynar_get_as(keys, 0, char*), xbt_dynar_get_as(keys, 1, char*)); xbt_dynar_foreach(src_names, cpt, src_host_name) { xbt_dynar_foreach(dst_names, cpt2, dst_host_name) { /* If dst is $* then set this route to have its dst point to all hosts */ - if (strcmp(src_host_name,"$*") != 0 && strcmp(dst_host_name,"$*") == 0){ + if (strcmp(src_host_name,"$*") != 0 && strcmp(dst_host_name,"$*") == 0){ xbt_dict_foreach(set, cursor_w, key_w, data_w) { //int n = xbt_dynar_member(src_names, (char*)key_w); add_multi_links(src, dst, links, src_host_name, key_w);