X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d6ee04bb4b77788c1f17220a2117f41573c9dcde..9d34bad1e34af28081b6000cf99d514c892a1c7e:/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 5f34526866..7f3d0ba9c6 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -81,11 +81,6 @@ void surf_parse_assert_netpoint(std::string hostname, std::string pre, std::stri surf_parse_error(msg); } -void surf_parse_warn(std::string msg) -{ - XBT_WARN("%s:%d: %s", surf_parsed_filename, surf_parse_lineno, msg.c_str()); -} - double surf_parse_get_double(std::string s) { try { @@ -426,7 +421,7 @@ void STag_surfxml_prop() } void ETag_surfxml_host() { - s_sg_platf_host_cbarg_t host{}; + s_sg_platf_host_cbarg_t host; host.properties = current_property_set; current_property_set = nullptr; @@ -485,16 +480,16 @@ void ETag_surfxml_cluster(){ switch(AX_surfxml_cluster_topology){ case A_surfxml_cluster_topology_FLAT: - cluster.topology= SURF_CLUSTER_FLAT ; + cluster.topology = ClusterTopology::FLAT; break; case A_surfxml_cluster_topology_TORUS: - cluster.topology= SURF_CLUSTER_TORUS ; + cluster.topology = ClusterTopology::TORUS; break; case A_surfxml_cluster_topology_FAT___TREE: - cluster.topology = SURF_CLUSTER_FAT_TREE; + cluster.topology = ClusterTopology::FAT_TREE; break; case A_surfxml_cluster_topology_DRAGONFLY: - cluster.topology= SURF_CLUSTER_DRAGONFLY ; + cluster.topology = ClusterTopology::DRAGONFLY; break; default: surf_parse_error(std::string("Invalid cluster topology for cluster ") + cluster.id); @@ -692,7 +687,7 @@ void STag_surfxml_bypassZoneRoute(){ } void ETag_surfxml_route(){ - s_sg_platf_route_cbarg_t route{}; + RouteCreationArgs route; route.src = sg_netpoint_by_name_or_null(A_surfxml_route_src); // tested to not be nullptr in start tag route.dst = sg_netpoint_by_name_or_null(A_surfxml_route_dst); // tested to not be nullptr in start tag @@ -716,7 +711,7 @@ void ETag_surfxml_ASroute() } void ETag_surfxml_zoneRoute() { - s_sg_platf_route_cbarg_t ASroute{}; + RouteCreationArgs ASroute; ASroute.src = sg_netpoint_by_name_or_null(A_surfxml_zoneRoute_src); // tested to not be nullptr in start tag ASroute.dst = sg_netpoint_by_name_or_null(A_surfxml_zoneRoute_dst); // tested to not be nullptr in start tag @@ -742,7 +737,7 @@ void ETag_surfxml_zoneRoute() } void ETag_surfxml_bypassRoute(){ - s_sg_platf_route_cbarg_t route{}; + RouteCreationArgs route; route.src = sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_src); // tested to not be nullptr in start tag route.dst = sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_dst); // tested to not be nullptr in start tag @@ -765,7 +760,7 @@ void ETag_surfxml_bypassASroute() } void ETag_surfxml_bypassZoneRoute() { - s_sg_platf_route_cbarg_t ASroute{}; + RouteCreationArgs ASroute; ASroute.src = sg_netpoint_by_name_or_null(A_surfxml_bypassZoneRoute_src); ASroute.dst = sg_netpoint_by_name_or_null(A_surfxml_bypassZoneRoute_dst); @@ -801,19 +796,19 @@ void STag_surfxml_trace___connect() switch (A_surfxml_trace___connect_kind) { case AU_surfxml_trace___connect_kind: case A_surfxml_trace___connect_kind_SPEED: - trace_connect.kind = SURF_TRACE_CONNECT_KIND_SPEED; + trace_connect.kind = TraceConnectKind::SPEED; break; case A_surfxml_trace___connect_kind_BANDWIDTH: - trace_connect.kind = SURF_TRACE_CONNECT_KIND_BANDWIDTH; + trace_connect.kind = TraceConnectKind::BANDWIDTH; break; case A_surfxml_trace___connect_kind_HOST___AVAIL: - trace_connect.kind = SURF_TRACE_CONNECT_KIND_HOST_AVAIL; + trace_connect.kind = TraceConnectKind::HOST_AVAIL; break; case A_surfxml_trace___connect_kind_LATENCY: - trace_connect.kind = SURF_TRACE_CONNECT_KIND_LATENCY; + trace_connect.kind = TraceConnectKind::LATENCY; break; case A_surfxml_trace___connect_kind_LINK___AVAIL: - trace_connect.kind = SURF_TRACE_CONNECT_KIND_LINK_AVAIL; + trace_connect.kind = TraceConnectKind::LINK_AVAIL; break; default: surf_parse_error("Invalid trace kind"); @@ -877,8 +872,7 @@ void ETag_surfxml_config() current_property_set = nullptr; } -static int argc; -static char **argv; +static std::vector arguments; void STag_surfxml_process() { @@ -889,9 +883,7 @@ void STag_surfxml_process() void STag_surfxml_actor() { ZONE_TAG = 0; - argc = 1; - argv = xbt_new(char *, 1); - argv[0] = xbt_strdup(A_surfxml_actor_function); + arguments.assign(1, A_surfxml_actor_function); xbt_assert(current_property_set == nullptr, "Someone forgot to reset the property set to nullptr in its closing tag (or XML malformed)"); } @@ -907,13 +899,12 @@ void ETag_surfxml_process() void ETag_surfxml_actor() { - s_sg_platf_process_cbarg_t actor{}; + ActorCreationArgs actor; actor.properties = current_property_set; current_property_set = nullptr; - actor.argc = argc; - actor.argv = (const char **)argv; + actor.args.swap(arguments); actor.host = A_surfxml_actor_host; actor.function = A_surfxml_actor_function; actor.start_time = surf_parse_get_double(A_surfxml_actor_start___time); @@ -922,28 +913,21 @@ void ETag_surfxml_actor() switch (A_surfxml_actor_on___failure) { case AU_surfxml_actor_on___failure: case A_surfxml_actor_on___failure_DIE: - actor.on_failure = SURF_ACTOR_ON_FAILURE_DIE; + actor.on_failure = ActorOnFailure::DIE; break; case A_surfxml_actor_on___failure_RESTART: - actor.on_failure = SURF_ACTOR_ON_FAILURE_RESTART; + actor.on_failure = ActorOnFailure::RESTART; break; default: surf_parse_error("Invalid on failure behavior"); break; } - sg_platf_new_process(&actor); - - for (int i = 0; i != argc; ++i) - xbt_free(argv[i]); - xbt_free(argv); - argv = nullptr; + sg_platf_new_actor(&actor); } void STag_surfxml_argument(){ - argc++; - argv = (char**)xbt_realloc(argv, (argc) * sizeof(char **)); - argv[(argc) - 1] = xbt_strdup(A_surfxml_argument_value); + arguments.push_back(A_surfxml_argument_value); } void STag_surfxml_model___prop(){