X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a7c05e186c0c2c4555d127909c1898f0668c050c..3fc07005abb54bbceec067c73455b50f96e5d908:/src/surf/xml/surfxml_sax_cb.cpp diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index bf7b20ee55..d42e4297b3 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -462,8 +462,8 @@ void ETag_surfxml_host(void) { XBT_DEBUG("pstate: %s", A_surfxml_host_pstate); host.core_amount = surf_parse_get_int(A_surfxml_host_core); - host.speed_trace = A_surfxml_host_availability___file[0] ? tmgr_trace_new_from_file(A_surfxml_host_availability___file) : NULL; - host.state_trace = A_surfxml_host_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_host_state___file) : NULL; + host.speed_trace = A_surfxml_host_availability___file[0] ? tmgr_trace_new_from_file(A_surfxml_host_availability___file) : nullptr; + host.state_trace = A_surfxml_host_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_host_state___file) : nullptr; host.pstate = surf_parse_get_int(A_surfxml_host_pstate); host.coord = A_surfxml_host_coordinates; @@ -527,6 +527,9 @@ void ETag_surfxml_cluster(void){ case A_surfxml_cluster_topology_FAT___TREE: cluster.topology = SURF_CLUSTER_FAT_TREE; break; + case A_surfxml_cluster_topology_DRAGONFLY: + cluster.topology= SURF_CLUSTER_DRAGONFLY ; + break; default: surf_parse_error("Invalid cluster topology for cluster %s", cluster.id); @@ -598,8 +601,8 @@ void STag_surfxml_peer(void){ peer.bw_out = surf_parse_get_bandwidth(A_surfxml_peer_bw___out, "bw_out of peer", peer.id); peer.lat = surf_parse_get_time(A_surfxml_peer_lat, "lat of peer", peer.id); peer.coord = A_surfxml_peer_coordinates; - peer.availability_trace = A_surfxml_peer_availability___file[0] ? tmgr_trace_new_from_file(A_surfxml_peer_availability___file) : NULL; - peer.state_trace = A_surfxml_peer_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_peer_state___file) : NULL; + peer.availability_trace = A_surfxml_peer_availability___file[0] ? tmgr_trace_new_from_file(A_surfxml_peer_availability___file) : nullptr; + peer.state_trace = A_surfxml_peer_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_peer_state___file) : nullptr; sg_platf_new_peer(&peer); } @@ -616,10 +619,10 @@ void ETag_surfxml_link(void){ link.properties = current_property_set; link.id = A_surfxml_link_id; link.bandwidth = surf_parse_get_bandwidth(A_surfxml_link_bandwidth, "bandwidth of link", link.id); - link.bandwidth_trace = A_surfxml_link_bandwidth___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_bandwidth___file) : NULL; + link.bandwidth_trace = A_surfxml_link_bandwidth___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_bandwidth___file) : nullptr; link.latency = surf_parse_get_time(A_surfxml_link_latency, "latency of link", link.id); - link.latency_trace = A_surfxml_link_latency___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_latency___file) : NULL; - link.state_trace = A_surfxml_link_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_state___file):NULL; + link.latency_trace = A_surfxml_link_latency___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_latency___file) : nullptr; + link.state_trace = A_surfxml_link_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_state___file):nullptr; switch (A_surfxml_link_sharing___policy) { case A_surfxml_link_sharing___policy_SHARED: @@ -724,20 +727,23 @@ void ETag_surfxml_route(void){ s_sg_platf_route_cbarg_t route; memset(&route,0,sizeof(route)); - route.src = A_surfxml_route_src; - route.dst = A_surfxml_route_dst; + + route.src = sg_netcard_by_name_or_null(A_surfxml_route_src); // tested to not be NULL in start tag + route.dst = sg_netcard_by_name_or_null(A_surfxml_route_dst); // tested to not be NULL in start tag route.gw_src = nullptr; route.gw_dst = nullptr; + route.link_list = new std::vector(); route.symmetrical = (A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES); unsigned int cpt; char *link_name; xbt_dynar_foreach(parsed_link_list, cpt, link_name) { simgrid::surf::Link *link = Link::byName(link_name); - route.link_list.push_back(link); + route.link_list->push_back(link); } sg_platf_new_route(&route); + delete route.link_list; xbt_dynar_free(&parsed_link_list); } @@ -745,25 +751,19 @@ void ETag_surfxml_ASroute(void){ s_sg_platf_route_cbarg_t ASroute; memset(&ASroute,0,sizeof(ASroute)); - ASroute.src = A_surfxml_ASroute_src; - ASroute.dst = A_surfxml_ASroute_dst; - - ASroute.gw_src = sg_netcard_by_name_or_null(A_surfxml_ASroute_gw___src); - ASroute.gw_dst = sg_netcard_by_name_or_null(A_surfxml_ASroute_gw___dst); + ASroute.src = sg_netcard_by_name_or_null(A_surfxml_ASroute_src); // tested to not be NULL in start tag + ASroute.dst = sg_netcard_by_name_or_null(A_surfxml_ASroute_dst); // tested to not be NULL in start tag - if (A_surfxml_ASroute_gw___src && !ASroute.gw_src) - surf_parse_error("gw_src=\"%s\" not found for ASroute from \"%s\" to \"%s\"", - A_surfxml_ASroute_gw___src, ASroute.src, ASroute.dst); - if (A_surfxml_ASroute_gw___dst && !ASroute.gw_dst) - surf_parse_error("gw_dst=\"%s\" not found for ASroute from \"%s\" to \"%s\"", - A_surfxml_ASroute_gw___dst, ASroute.src, ASroute.dst); + ASroute.gw_src = sg_netcard_by_name_or_null(A_surfxml_ASroute_gw___src); // tested to not be NULL in start tag + ASroute.gw_dst = sg_netcard_by_name_or_null(A_surfxml_ASroute_gw___dst); // tested to not be NULL in start tag + ASroute.link_list = new std::vector(); unsigned int cpt; char *link_name; xbt_dynar_foreach(parsed_link_list, cpt, link_name) { simgrid::surf::Link *link = Link::byName(link_name); - ASroute.link_list.push_back(link); + ASroute.link_list->push_back(link); } xbt_dynar_free(&parsed_link_list); @@ -778,23 +778,25 @@ void ETag_surfxml_ASroute(void){ } sg_platf_new_route(&ASroute); + delete ASroute.link_list; } void ETag_surfxml_bypassRoute(void){ s_sg_platf_route_cbarg_t route; memset(&route,0,sizeof(route)); - route.src = A_surfxml_bypassRoute_src; - route.dst = A_surfxml_bypassRoute_dst; + route.src = sg_netcard_by_name_or_null(A_surfxml_bypassRoute_src); // tested to not be NULL in start tag + route.dst = sg_netcard_by_name_or_null(A_surfxml_bypassRoute_dst); // tested to not be NULL in start tag route.gw_src = nullptr; route.gw_dst = nullptr; route.symmetrical = false; + route.link_list = new std::vector(); unsigned int cpt; char *link_name; xbt_dynar_foreach(parsed_link_list, cpt, link_name) { simgrid::surf::Link *link = Link::byName(link_name); - route.link_list.push_back(link); + route.link_list->push_back(link); } xbt_dynar_free(&parsed_link_list); @@ -805,13 +807,14 @@ void ETag_surfxml_bypassASroute(void){ s_sg_platf_route_cbarg_t ASroute; memset(&ASroute,0,sizeof(ASroute)); - ASroute.src = A_surfxml_bypassASroute_src; - ASroute.dst = A_surfxml_bypassASroute_dst; + ASroute.src = sg_netcard_by_name_or_null(A_surfxml_bypassASroute_src); + ASroute.dst = sg_netcard_by_name_or_null(A_surfxml_bypassASroute_dst); + ASroute.link_list = new std::vector(); unsigned int cpt; char *link_name; xbt_dynar_foreach(parsed_link_list, cpt, link_name) { simgrid::surf::Link *link = Link::byName(link_name); - ASroute.link_list.push_back(link); + ASroute.link_list->push_back(link); } xbt_dynar_free(&parsed_link_list); ASroute.symmetrical = false; @@ -945,6 +948,12 @@ void ETag_surfxml_process(void){ } sg_platf_new_process(&process); + + for (int i = 0; i != argc; ++i) + xbt_free(argv[i]); + xbt_free(argv); + argv = nullptr; + current_property_set = nullptr; } @@ -980,7 +989,7 @@ void ETag_surfxml_model___prop(void){} void surf_parse_open(const char *file) { - xbt_assert(file, "Cannot parse the NULL file. Bypassing the parser is strongly deprecated nowadays."); + xbt_assert(file, "Cannot parse the nullptr file. Bypassing the parser is strongly deprecated nowadays."); if (!surf_input_buffer_stack) surf_input_buffer_stack = xbt_dynar_new(sizeof(YY_BUFFER_STATE), nullptr);