Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill some further empty function chaining.
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 7 Nov 2011 23:10:41 +0000 (00:10 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 7 Nov 2011 23:10:41 +0000 (00:10 +0100)
This breaks the lua console for a while, but this is to be redone with
the new sg_platf anyway.

src/bindings/lua/lua_console.c
src/include/surf/surf.h
src/surf/surf_routing.c
src/surf/surfxml_parse.c

index a3263f1..e467d34 100644 (file)
@@ -707,8 +707,7 @@ static int surf_parse_bypass_platform()
                                  p_host->state_trace, p_host->properties);
 
 
                                  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){
          }
          // 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
                              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) {
          }
          //add Links
          xbt_dynar_foreach(p_as->link_list_d, j, p_link) {
index f33177c..a0ed25c 100644 (file)
@@ -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);
 
 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);
 //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);
 XBT_PUBLIC(void) surf_routing_add_route(const char *src_id,
                                         const char *dest_id,
                                         xbt_dynar_t links_id);
index f354e05..349f5e4 100644 (file)
@@ -101,38 +101,29 @@ struct s_model_type routing_models[] = { {"Full",
 /**
  * \brief Add a "host" to the network element list
  */
 /**
  * \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;
   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",
               "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);
   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;
   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_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
  */
 /**
  * \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 */
   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,
   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
 
 /*
  * Set a new link on the actual list of link for a route or ASroute
index 92a759d..e18e079 100644 (file)
@@ -728,14 +728,6 @@ void* surf_wsL07_link_create_resource(char *name,
                            properties);
 }
 
                            properties);
 }
 
-/*
- * add host to the network element list
- */
-void surf_route_add_host(const char *host_id)
-{
-  routing_add_host(host_id);
-}
-
 /**
  * set route
  */
 /**
  * set route
  */