From: Martin Quinson Date: Mon, 7 Nov 2011 23:10:41 +0000 (+0100) Subject: Kill some further empty function chaining. X-Git-Tag: exp_20120216~445 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d7312117918307ea0ee4dd49ccb225b83ceff212?ds=sidebyside Kill some further empty function chaining. This breaks the lua console for a while, but this is to be redone with the new sg_platf anyway. --- diff --git a/src/bindings/lua/lua_console.c b/src/bindings/lua/lua_console.c index a3263f1b0f..e467d3414e 100644 --- a/src/bindings/lua/lua_console.c +++ b/src/bindings/lua/lua_console.c @@ -707,8 +707,7 @@ static int surf_parse_bypass_platform() p_host->state_trace, p_host->properties); - //add to routing model host list - surf_route_add_host((char *) p_host->id); + //FIXME: should use sg_platf instead. That would add to routing model host list, amongst other benefits } // add associated Links xbt_dynar_foreach(p_as->link_list_d, j, p_link){ @@ -765,7 +764,6 @@ static int surf_wsL07_parse_bypass_platform() p_host->power_trace, p_host->state_initial, p_host->state_trace); //add to routing model host list - surf_route_add_host((char *) p_host->id); } //add Links xbt_dynar_foreach(p_as->link_list_d, j, p_link) { diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index f33177c428..a0ed25ce70 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -787,23 +787,12 @@ XBT_PUBLIC(void) surf_add_host_traces(void); XBT_PUBLIC(void) surf_add_link_traces(void); XBT_PUBLIC(void) surf_wsL07_add_traces(void); -/* - * lua console - */ -// add host to network element list -XBT_PUBLIC(void) routing_add_host(const char *host_id); //Set a new link on the actual list of link for a route or ASroute XBT_PUBLIC(void) routing_add_link(const char *link_id); //Set the endpoints for a route XBT_PUBLIC(void) routing_set_route(const char *src_id, const char *dst_id); //Store the route XBT_PUBLIC(void) routing_store_route(void); - -/* - * interface between surf and lua bindings - * see surfxml_parse.c - */ -XBT_PUBLIC(void) surf_route_add_host(const char *id); XBT_PUBLIC(void) surf_routing_add_route(const char *src_id, const char *dest_id, xbt_dynar_t links_id); diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index f354e0596b..349f5e4d63 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -101,38 +101,29 @@ struct s_model_type routing_models[] = { {"Full", /** * \brief Add a "host" to the network element list */ -static void parse_S_host(const char *host_id, const char* coord) -{ +static void parse_S_host(sg_platf_host_cbarg_t host) { network_element_info_t info = NULL; if (current_routing->hierarchy == SURF_ROUTING_NULL) current_routing->hierarchy = SURF_ROUTING_BASE; - xbt_assert(!xbt_lib_get_or_null(host_lib, host_id,ROUTING_HOST_LEVEL), + xbt_assert(!xbt_lib_get_or_null(host_lib, host->V_host_id,ROUTING_HOST_LEVEL), "Reading a host, processing unit \"%s\" already exists", - host_id); + host->V_host_id); xbt_assert(current_routing->set_processing_unit, "no defined method \"set_processing_unit\" in \"%s\"", current_routing->name); - (*(current_routing->set_processing_unit)) (current_routing, host_id); + (*(current_routing->set_processing_unit)) (current_routing, host->V_host_id); info = xbt_new0(s_network_element_info_t, 1); info->rc_component = current_routing; info->rc_type = SURF_NETWORK_ELEMENT_HOST; - xbt_lib_set(host_lib,host_id,ROUTING_HOST_LEVEL,(void *) info); - if (strcmp(coord,"")) { - if(!COORD_HOST_LEVEL) xbt_die("To use coordinates, you must set configuration 'coordinates' to 'yes'"); - xbt_dynar_t ctn = xbt_str_split_str(coord, " "); + xbt_lib_set(host_lib,host->V_host_id,ROUTING_HOST_LEVEL,(void *) info); + if (strcmp(host->V_host_coord,"")) { + if(!COORD_HOST_LEVEL) xbt_die("To use coordinates, you must set configuration 'coordinates' to 'yes'"); + xbt_dynar_t ctn = xbt_str_split_str(host->V_host_coord, " "); xbt_dynar_shrink(ctn, 0); - xbt_lib_set(host_lib,host_id,COORD_HOST_LEVEL,(void *) ctn); + xbt_lib_set(host_lib,host->V_host_id,COORD_HOST_LEVEL,(void *) ctn); } } -/* - * \brief Add a host to the network element list from XML - */ -static void parse_S_host_XML(sg_platf_host_cbarg_t h) -{ - parse_S_host(h->V_host_id, h->V_host_coord); -} - /** * \brief Add a "router" to the network element list */ @@ -884,7 +875,7 @@ void routing_model_create(size_t size_of_links, void *loopback, double_f_cpvoid_ current_routing = NULL; /* parse generic elements */ - sg_platf_host_add_cb(parse_S_host_XML); + sg_platf_host_add_cb(parse_S_host); sg_platf_router_add_cb(parse_S_router); surfxml_add_callback(STag_surfxml_route_cb_list, @@ -1951,19 +1942,6 @@ static void routing_parse_Srandom(void) } } -/* - * New methods to init the routing model component from the lua script - */ - - -/* - * add a host to the network element list - */ - -void routing_add_host(const char *host_id) -{ - parse_S_host(host_id, ""); // FIXME propagate coordinate system to lua -} /* * Set a new link on the actual list of link for a route or ASroute diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 92a759d0b7..e18e079a53 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -728,14 +728,6 @@ void* surf_wsL07_link_create_resource(char *name, properties); } -/* - * add host to the network element list - */ -void surf_route_add_host(const char *host_id) -{ - routing_add_host(host_id); -} - /** * set route */