Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Further parser cleanups
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 7 Nov 2011 11:14:15 +0000 (12:14 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 7 Nov 2011 11:14:15 +0000 (12:14 +0100)
Simply rename a bunch of symbols to make the module logic clear

12 files changed:
include/simgrid/platf.h
src/include/simgrid/platf_interface.h
src/instr/instr_routing.c
src/surf/cpu.c
src/surf/cpu_im.c
src/surf/cpu_ti.c
src/surf/network_constant.c
src/surf/sg_platf.c
src/surf/surf_routing.c
src/surf/surfxml_parse.c
src/surf/surfxml_parseplatf.c
src/surf/workstation_ptask_L07.c

index 5bade91..79aee43 100644 (file)
@@ -30,7 +30,7 @@ typedef enum {
  * used, instead of malloced structures.
  */
 
-typedef struct s_surf_parsing_host_arg {
+typedef struct {
   char* V_host_id;                          //id
   double V_host_power_peak;                     //power
   int V_host_core;                          //core
@@ -39,19 +39,19 @@ typedef struct s_surf_parsing_host_arg {
   e_surf_resource_state_t V_host_state_initial;           //state
   tmgr_trace_t V_host_state_trace;                  //state file
   const char* V_host_coord;
-} s_surf_parsing_host_arg_t, *surf_parsing_host_arg_t;
+} s_sg_platf_host_cbarg_t, *sg_platf_host_cbarg_t;
 
-typedef struct s_surf_parsing_router_arg {
+typedef struct {
   const char* V_router_id;
   const char* V_router_coord;
-} s_surf_parsing_router_arg_t, *surf_parsing_router_arg_t;
+} s_sg_platf_router_cbarg_t, *sg_platf_router_cbarg_t;
 
 
 XBT_PUBLIC(void) sg_platf_new_AS_open(const char *id, const char *mode);
 XBT_PUBLIC(void) sg_platf_new_AS_close(void);
 
-XBT_PUBLIC(void) sg_platf_new_host(surf_parsing_host_arg_t h);
-XBT_PUBLIC(void) sg_platf_new_router(surf_parsing_router_arg_t router);
+XBT_PUBLIC(void) sg_platf_new_host  (sg_platf_host_cbarg_t   host);
+XBT_PUBLIC(void) sg_platf_new_router(sg_platf_router_cbarg_t router);
 
 
 #endif                          /* SG_PLATF_H */
index bc84e74..7e8eb3f 100644 (file)
@@ -17,10 +17,10 @@ void sg_platf_exit(void);
 
 /* Managing the parsing callbacks */
 
-typedef void (*surf_parse_host_fct_t)(surf_parsing_host_arg_t);
-typedef void (*surf_parse_router_fct_t)(surf_parsing_router_arg_t);
-void surf_parse_host_add_cb(surf_parse_host_fct_t);
-void surf_parse_router_add_cb(surf_parse_router_fct_t);
+typedef void (*sg_platf_host_cb_t)(sg_platf_host_cbarg_t);
+typedef void (*sg_platf_router_cb_t)(sg_platf_router_cbarg_t);
+void sg_platf_host_add_cb(sg_platf_host_cb_t);
+void sg_platf_router_add_cb(sg_platf_router_cb_t);
 
 
 
index 183ae07..8f913c3 100644 (file)
@@ -225,7 +225,7 @@ static void instr_routing_parse_start_link ()
   xbt_dynar_free (&links_to_create);
 }
 
-static void instr_routing_parse_start_host (surf_parsing_host_arg_t host)
+static void instr_routing_parse_start_host (sg_platf_host_cbarg_t host)
 {
   container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
   container_t new = newContainer (host->V_host_id, INSTR_HOST, father);
@@ -266,7 +266,7 @@ static void instr_routing_parse_start_host (surf_parsing_host_arg_t host)
   }
 }
 
-static void instr_routing_parse_start_router (surf_parsing_router_arg_t router)
+static void instr_routing_parse_start_router (sg_platf_router_cbarg_t router)
 {
   container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
   newContainer (router->V_router_id, INSTR_ROUTER, father);
@@ -292,8 +292,8 @@ void instr_routing_define_callbacks ()
   surfxml_add_callback(ETag_surfxml_AS_cb_list, &instr_routing_parse_end_AS);
   if (!TRACE_needs_platform()) return;
   surfxml_add_callback(STag_surfxml_link_cb_list, &instr_routing_parse_start_link);
-  surf_parse_host_add_cb(instr_routing_parse_start_host);
-  surf_parse_router_add_cb(instr_routing_parse_start_router);
+  sg_platf_host_add_cb(instr_routing_parse_start_host);
+  sg_platf_router_add_cb(instr_routing_parse_start_router);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &instr_routing_parse_end_platform);
 }
 
index 1bbeb9f..fe1b2f2 100644 (file)
@@ -71,7 +71,7 @@ static void* cpu_create_resource(const char *name, double power_peak,
 }
 
 
-static void parse_cpu_init(surf_parsing_host_arg_t host)
+static void parse_cpu_init(sg_platf_host_cbarg_t host)
 {
   if(strcmp(host->V_host_coord,"")) xbt_die("Coordinates not implemented yet!");
 
@@ -124,7 +124,7 @@ static void add_traces_cpu(void)
 
 static void cpu_define_callbacks(void)
 {
-  surf_parse_host_add_cb(parse_cpu_init);
+  sg_platf_host_add_cb(parse_cpu_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces_cpu);
 }
 
index 14c9cfb..01630f2 100644 (file)
@@ -88,7 +88,7 @@ static void* cpu_im_create_resource(const char *name, double power_peak,
 }
 
 
-static void parse_cpu_im_init(surf_parsing_host_arg_t host)
+static void parse_cpu_im_init(sg_platf_host_cbarg_t host)
 {
        cpu_im_create_resource(host->V_host_id,
                          host->V_host_power_peak,
@@ -136,7 +136,7 @@ static void cpu_im_add_traces_cpu(void)
 
 static void cpu_im_define_callbacks()
 {
-  surf_parse_host_add_cb(parse_cpu_im_init);
+  sg_platf_host_add_cb(parse_cpu_im_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list,
                        &cpu_im_add_traces_cpu);
 }
index fe6e4f4..206e7dd 100644 (file)
@@ -190,7 +190,7 @@ static void* cpu_ti_create_resource(const char *name, double power_peak,
 }
 
 
-static void parse_cpu_ti_init(surf_parsing_host_arg_t host)
+static void parse_cpu_ti_init(sg_platf_host_cbarg_t host)
 {
   cpu_ti_create_resource(host->V_host_id,
                          host->V_host_power_peak,
@@ -263,7 +263,7 @@ static void add_traces_cpu_ti(void)
 
 static void cpu_ti_define_callbacks()
 {
-  surf_parse_host_add_cb(parse_cpu_ti_init);
+  sg_platf_host_add_cb(parse_cpu_ti_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces_cpu_ti);
 }
 
index f4251f0..a94f7ac 100644 (file)
@@ -21,14 +21,14 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network);
 static random_data_t random_latency = NULL;
 static int host_number_int = 0;
 
-static void netcste_count_hosts(surf_parsing_host_arg_t h)
+static void netcste_count_hosts(sg_platf_host_cbarg_t h)
 {
   host_number_int++;
 }
 
 static void netcste_define_callbacks(void)
 {
-  surf_parse_host_add_cb(netcste_count_hosts);
+  sg_platf_host_add_cb(netcste_count_hosts);
 }
 
 static int netcste_resource_used(void *resource_id)
index ee11d0b..219a30a 100644 (file)
 #include "surf/surf_private.h"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
-xbt_dynar_t surf_parse_host_cb_list = NULL; // of functions of type: surf_parsing_host_arg_t -> void
-xbt_dynar_t surf_parse_router_cb_list = NULL; // of functions of type: surf_parsing_router_arg_t -> void
+xbt_dynar_t sg_platf_host_cb_list = NULL;   // of sg_platf_host_cb_t
+xbt_dynar_t sg_platf_router_cb_list = NULL; // of sg_platf_router_cb_t
 
 /** Module management function: creates all internal data structures */
 void sg_platf_init(void) {
-  surf_parse_host_cb_list = xbt_dynar_new(sizeof(surf_parse_host_fct_t), NULL);
-  surf_parse_router_cb_list = xbt_dynar_new(sizeof(surf_parse_host_fct_t), NULL);
+  sg_platf_host_cb_list = xbt_dynar_new(sizeof(sg_platf_host_cb_t), NULL);
+  sg_platf_router_cb_list = xbt_dynar_new(sizeof(sg_platf_host_cb_t), NULL);
 }
 /** Module management function: frees all internal data structures */
 void sg_platf_exit(void) {
-  xbt_dynar_free(&surf_parse_host_cb_list);
-  xbt_dynar_free(&surf_parse_router_cb_list);
+  xbt_dynar_free(&sg_platf_host_cb_list);
+  xbt_dynar_free(&sg_platf_router_cb_list);
 }
 
-void sg_platf_new_host(surf_parsing_host_arg_t h){
+void sg_platf_new_host(sg_platf_host_cbarg_t h){
   unsigned int iterator;
-  surf_parse_host_fct_t fun;
-  xbt_dynar_foreach(surf_parse_host_cb_list, iterator, fun) {
+  sg_platf_host_cb_t fun;
+  xbt_dynar_foreach(sg_platf_host_cb_list, iterator, fun) {
     if (fun) (*fun) (h);
   }
 }
-void sg_platf_new_router(surf_parsing_router_arg_t router) {
+void sg_platf_new_router(sg_platf_router_cbarg_t router) {
   unsigned int iterator;
-  surf_parse_router_fct_t fun;
-  xbt_dynar_foreach(surf_parse_router_cb_list, iterator, fun) {
+  sg_platf_router_cb_t fun;
+  xbt_dynar_foreach(sg_platf_router_cb_list, iterator, fun) {
     if (fun) (*fun) (router);
   }
 }
 
 
-void surf_parse_host_add_cb(surf_parse_host_fct_t fct) {
-  xbt_dynar_push(surf_parse_host_cb_list, &fct);
+void sg_platf_host_add_cb(sg_platf_host_cb_t fct) {
+  xbt_dynar_push(sg_platf_host_cb_list, &fct);
 }
-void surf_parse_router_add_cb(surf_parse_router_fct_t fct) {
-  xbt_dynar_push(surf_parse_router_cb_list, &fct);
+void sg_platf_router_add_cb(sg_platf_router_cb_t fct) {
+  xbt_dynar_push(sg_platf_router_cb_list, &fct);
 }
 
index ccb2c3a..75808fd 100644 (file)
@@ -186,7 +186,7 @@ static void parse_E_host(void)
 /*
  * \brief Add a host to the network element list from XML
  */
-static void parse_S_host_XML(surf_parsing_host_arg_t h)
+static void parse_S_host_XML(sg_platf_host_cbarg_t h)
 {
        parse_S_host(h->V_host_id, h->V_host_coord);
 }
@@ -207,7 +207,7 @@ static void parse_S_host_lua(const char *host_id, const char *coord)
 /**
  * \brief Add a "router" to the network element list
  */
-static void parse_S_router(surf_parsing_router_arg_t router)
+static void parse_S_router(sg_platf_router_cbarg_t router)
 {
   network_element_info_t info = NULL;
   if (current_routing->hierarchy == SURF_ROUTING_NULL)
@@ -237,7 +237,7 @@ static void parse_S_router(surf_parsing_router_arg_t router)
  * brief Add a "router" to the network element list from XML description
  */
 static void parse_S_router_lua(const char* router_id) {
-  s_surf_parsing_router_arg_t router;
+  s_sg_platf_router_cbarg_t router;
   memset(&router,0,sizeof(router));
        router.V_router_id = router_id;
        router.V_router_coord = "";
@@ -960,9 +960,9 @@ void routing_model_create(size_t size_of_links, void *loopback, double_f_cpvoid_
   current_routing = NULL;
 
   /* parse generic elements */
-  surf_parse_host_add_cb(parse_S_host_XML);
+  sg_platf_host_add_cb(parse_S_host_XML);
   surfxml_add_callback(ETag_surfxml_host_cb_list, &parse_E_host_XML);
-  surf_parse_router_add_cb(parse_S_router);
+  sg_platf_router_add_cb(parse_S_router);
 
   surfxml_add_callback(STag_surfxml_route_cb_list,
                        &parse_S_route_new_and_endpoints_XML);
@@ -1466,7 +1466,7 @@ void generic_src_dst_check(routing_component_t rc, const char *src,
 static void parse_create_host_link(int i)
 {
        char *host_id, *link_id = NULL;
-       s_surf_parsing_host_arg_t host;
+       s_sg_platf_host_cbarg_t host;
        memset(&host,0,sizeof(host));
 
        host_id = bprintf("%s%d%s", struct_cluster->V_cluster_prefix, i, struct_cluster->V_cluster_suffix);
@@ -1567,7 +1567,7 @@ void routing_parse_Scluster(void)
   static int AX_ptr = 0;
   char *host_id, *groups, *link_id = NULL;
 
-  s_surf_parsing_host_arg_t host;
+  s_sg_platf_host_cbarg_t host;
 
   if( strcmp(struct_cluster->V_cluster_availability_file,"")
          || strcmp(struct_cluster->V_cluster_state_file,"") )
index 58d320b..ffa11fc 100644 (file)
@@ -289,7 +289,7 @@ void STag_surfxml_platform(void)
 }
 
 void STag_surfxml_host(void){
-  s_surf_parsing_host_arg_t host;
+  s_sg_platf_host_cbarg_t host;
   memset(&host,0,sizeof(host));
 
        host.V_host_id = A_surfxml_host_id;
@@ -314,7 +314,7 @@ void ETag_surfxml_host(void){
 
 
 void STag_surfxml_router(void){
-  s_surf_parsing_router_arg_t router;
+  s_sg_platf_router_cbarg_t router;
   memset(&router, 0, sizeof(router));
 
        router.V_router_id = xbt_strdup(A_surfxml_router_id);
index 312d100..4d6945f 100644 (file)
@@ -53,7 +53,7 @@ void surfxml_bufferstack_pop(int new)
  * Pass arguments to parsing callback as structures to save some time (and allow callbacks to ignore some)
  */
 
-surf_parsing_router_arg_t struct_router = NULL;
+sg_platf_router_cbarg_t struct_router = NULL;
 surf_parsing_cluster_arg_t struct_cluster = NULL;
 surf_parsing_peer_arg_t struct_peer = NULL;
 surf_parsing_link_arg_t struct_lnk = NULL;
index 726ecb5..ac1c51c 100644 (file)
@@ -654,7 +654,7 @@ static void* ptask_cpu_create_resource(const char *name, double power_scale,
   return cpu;
 }
 
-static void ptask_parse_cpu_init(surf_parsing_host_arg_t host)
+static void ptask_parse_cpu_init(sg_platf_host_cbarg_t host)
 {
   ptask_cpu_create_resource(
                  host->V_host_id,
@@ -802,7 +802,7 @@ static void ptask_add_traces(void)
 static void ptask_define_callbacks()
 {
   /* Adding callback functions */
-  surf_parse_host_add_cb(ptask_parse_cpu_init);
+  sg_platf_host_add_cb(ptask_parse_cpu_init);
   surfxml_add_callback(ETag_surfxml_link_cb_list, &ptask_parse_link_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &ptask_add_traces);
 }