Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
changes for solve warrings
authornavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 28 Sep 2010 08:52:23 +0000 (08:52 +0000)
committernavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 28 Sep 2010 08:52:23 +0000 (08:52 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8230 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/surf/surfxml_parse.h
src/surf/surf_routing.c
src/surf/surfxml_parse.c

index fc6c31c..ec660d9 100644 (file)
@@ -92,9 +92,8 @@ XBT_PUBLIC_DATA(int_f_void_t) surf_parse;       /* Entry-point to the parser. Se
 #define SURFXML_START_TAG(tag)  STag_surfxml_##tag()
 #define SURFXML_END_TAG(tag)  do { ETag_surfxml_##tag(); SURFXML_BUFFER_RESET(); } while(0)
 
-XBT_PUBLIC(void) surfxml_add_callback(xbt_dynar_t cb_list,
-                                      void_f_void_t function);
-
+XBT_PUBLIC(void) surfxml_add_callback(xbt_dynar_t cb_list, void_f_void_t function);
+XBT_PUBLIC(void) surfxml_del_callback(xbt_dynar_t* cb_list, void_f_void_t function);
 
 SG_END_DECL()
 #endif
index 38deaf6..b6e1ba8 100644 (file)
@@ -66,30 +66,30 @@ routing_component_t current_routing = NULL;
 model_type_t current_routing_model = NULL;
 
 /* Prototypes of each model */
-static void* model_full_create(); /* create structures for full routing model */
-static void  model_full_load();   /* load parse functions for full routing model */
-static void  model_full_unload(); /* unload parse functions for full routing model */
-static void  model_full_end();    /* finalize the creation of full routing model */
-
-static void* model_floyd_create(); /* create structures for floyd routing model */
-static void  model_floyd_load();   /* load parse functions for floyd routing model */
-static void  model_floyd_unload(); /* unload parse functions for floyd routing model */
-static void  model_floyd_end();    /* finalize the creation of floyd routing model */
-
-static void* model_dijkstra_create(); /* create structures for dijkstra routing model */
-static void  model_dijkstra_load();   /* load parse functions for dijkstra routing model */
-static void  model_dijkstra_unload(); /* unload parse functions for dijkstra routing model */
-static void  model_dijkstra_end();    /* finalize the creation of dijkstra routing model */
-
-static void* model_dijkstracache_create(); /* create structures for dijkstracache routing model */
-static void  model_dijkstracache_load();   /* load parse functions for dijkstracache routing model */
-static void  model_dijkstracache_unload(); /* unload parse functions for dijkstracache routing model */
-static void  model_dijkstracache_end();    /* finalize the creation of dijkstracache routing model */
-
-static void* model_none_create(); /* none routing model */
-static void  model_none_load();   /* none routing model */
-static void  model_none_unload(); /* none routing model */
-static void  model_none_end();    /* none routing model */
+static void* model_full_create(void); /* create structures for full routing model */
+static void  model_full_load(void);   /* load parse functions for full routing model */
+static void  model_full_unload(void); /* unload parse functions for full routing model */
+static void  model_full_end(void);    /* finalize the creation of full routing model */
+
+static void* model_floyd_create(void); /* create structures for floyd routing model */
+static void  model_floyd_load(void);   /* load parse functions for floyd routing model */
+static void  model_floyd_unload(void); /* unload parse functions for floyd routing model */
+static void  model_floyd_end(void);    /* finalize the creation of floyd routing model */
+
+static void* model_dijkstra_create(void); /* create structures for dijkstra routing model */
+static void  model_dijkstra_load(void);   /* load parse functions for dijkstra routing model */
+static void  model_dijkstra_unload(void); /* unload parse functions for dijkstra routing model */
+static void  model_dijkstra_end(void);    /* finalize the creation of dijkstra routing model */
+
+static void* model_dijkstracache_create(void); /* create structures for dijkstracache routing model */
+static void  model_dijkstracache_load(void);   /* load parse functions for dijkstracache routing model */
+static void  model_dijkstracache_unload(void); /* unload parse functions for dijkstracache routing model */
+static void  model_dijkstracache_end(void);    /* finalize the creation of dijkstracache routing model */
+
+static void* model_none_create(void); /* none routing model */
+static void  model_none_load(void);   /* none routing model */
+static void  model_none_unload(void); /* none routing model */
+static void  model_none_end(void);    /* none routing model */
 
 /* Table of routing models */
 /* must be finish with null and carefull if change de order */
@@ -236,7 +236,6 @@ static void _add_parse_AS(routing_component_t rc) {
   xbt_dict_set(global_routing->where_network_elements,rc->name,rc->routing_father,NULL);
   xbt_dict_cursor_t cursor = NULL;
   char *key;
-  int *val;
   routing_component_t elem;
   xbt_dict_foreach(rc->routing_sons, cursor, key, elem) {
     _add_parse_AS(elem);
@@ -267,7 +266,7 @@ static xbt_dynar_t get_route(const char* src,const char* dst) {
   
   routing_component_t src_as, dst_as;
   int index_src, index_dst, index_father_src, index_father_dst;
-  int *src_id, *dst_id;
+  int count_src, count_dst;
   xbt_dynar_t path_src = NULL;
   xbt_dynar_t path_dst = NULL;
   char *current_router_src, *current_router_dst;
@@ -281,7 +280,7 @@ static xbt_dynar_t get_route(const char* src,const char* dst) {
   void* link;
   route_extended_t route_center_links;
   xbt_dynar_t path_src_links, path_dst_links, path_first, path_last;
-  int cpt;
+  unsigned int cpt;
   
   xbt_dynar_reset(global_routing->last_route);
   
@@ -353,8 +352,8 @@ static xbt_dynar_t get_route(const char* src,const char* dst) {
     current_router_dst = route_center_links->src_gateway;  /* first router in the reverse path */
     current_src_father = xbt_dynar_get_ptr(path_src,index_src);
     index_src--;
-    for(index_src;index_src>=0;index_src--) {
-      current_src = xbt_dynar_get_ptr(path_src,index_src);
+    for(count_src=index_src;count_src>=0;count_src--) {
+      current_src = xbt_dynar_get_ptr(path_src,count_src);
       xbt_assert1((*current_src_father)->get_route, "Invalid \"get_route\" for \"%s\"",(*current_src_father)->name);
       tmp_route = (*((*current_src_father)->get_route))(*current_src_father,(*current_src)->name,current_router_dst);
       xbt_assert3(tmp_route, "there is no route between \"%s\" and \"%s\" in \"%s\"",
@@ -373,8 +372,8 @@ static xbt_dynar_t get_route(const char* src,const char* dst) {
     current_router_src = route_center_links->dst_gateway;  /* last router in the reverse path */
     current_dst_father = xbt_dynar_get_ptr(path_dst,index_dst);
     index_dst--;
-    for(index_dst;index_dst>=0;index_dst--) {
-      current_dst = xbt_dynar_get_ptr(path_dst,index_dst);
+    for(count_dst=index_dst;count_dst>=0;count_dst--) {
+      current_dst = xbt_dynar_get_ptr(path_dst,count_dst);
       xbt_assert1((*current_dst_father)->get_route, "Invalid \"get_route\" for \"%s\"",(*current_dst_father)->name);
       tmp_route = (*((*current_dst_father)->get_route))(*current_dst_father,current_router_src,(*current_dst)->name);
       xbt_assert3(tmp_route, "there is no route between \"%s\" and \"%s\" in \"%s\"",
@@ -674,11 +673,11 @@ static void model_full_unload() {
 
 static void  model_full_end() {
 
-  char *key, *end, *link_name, *src_name, *dst_name,  *src_gw_name, *dst_gw_name;
+  char *key, *link_name, *src_name, *dst_name,  *src_gw_name, *dst_gw_name;
   const char* sep = "#";
-  network_element_t src_id, dst_id, src_gw_id, dst_gw_id, ne;
+  network_element_t src_id, dst_id, ne;
   route_extended_t new_e_route;
-  int i, j, cpt;
+  unsigned int i, j, cpt;
   routing_component_t component;
   xbt_dynar_t links;
   xbt_dict_cursor_t cursor = NULL;
@@ -1005,7 +1004,7 @@ static void  model_floyd_end() {
   
   routing_component_floyd_t routing = ((routing_component_floyd_t)current_routing);
   const char *sep = "#";
-  char *key, *key_gw, *end, *link_name, *keyX, *keyY; 
+  char *key, *key_gw, *link_name, *keyX, *keyY; 
   char *src_name, *dst_name, *src_gw_name, *dst_gw_name;
   double * cost_table;
   unsigned int i,j;
@@ -1014,7 +1013,7 @@ static void  model_floyd_end() {
   void *data = NULL;
   void *link = NULL;
   e_surf_network_element_type_t *type_gw;
-  network_element_t ne, ne_gw, new_ne, src_ne, dst_ne, src_gw_ne, dst_gw_ne, neX, neY;
+  network_element_t ne, new_ne, src_ne, dst_ne, src_gw_ne, dst_gw_ne, neX, neY;
   xbt_dict_cursor_t cursor=NULL, cursor_gw=NULL, cursorX=NULL, cursorY=NULL;
   xbt_dynar_t links, keys;
   routing_component_t component;
@@ -1286,6 +1285,7 @@ typedef struct {
 /* Creation routing model functions */
 
 static void* model_dijkstra_create() {
+  return NULL;
 }
 
 static void  model_dijkstra_load() {
@@ -1298,6 +1298,7 @@ static void  model_dijkstra_end() {
 }
 
 static void* model_dijkstracache_create() {
+  return NULL;
 }
 
 static void  model_dijkstracache_load() {
@@ -1344,7 +1345,7 @@ static void  model_none_end() {}
 /* The minimal configuration of a new routing model need the next functions,
  * also you need to set at the start of the file, the new model in the model
  * list. Remember keep the null ending of the list.
-
+ */
 /* Routing model structure */
 typedef struct {
   s_routing_component_t generic_routing;
@@ -1355,11 +1356,11 @@ typedef struct {
 static void NEW_parse_S_host(void) {} /* example*/
 
 /* Business methods */
-static route_extended_t NEW_get_route(routing_component_t rc, const char* src,const char* dst) {} /* mandatory */
+static route_extended_t NEW_get_route(routing_component_t rc, const char* src,const char* dst) {return NULL;} /* mandatory */
 static void NEW_finalize(routing_component_t rc) {} /* mandatory */
 
 /* Creation routing model functions */
-static void* model_NEW_create() {} /* mandatory */
+static void* model_NEW_create() {return NULL;} /* mandatory */
 static void  model_NEW_load() {}   /* mandatory */
 static void  model_NEW_unload() {} /* mandatory */
 static void  model_NEW_end() {}    /* mandatory */
@@ -1476,15 +1477,15 @@ static void DEGUB_exit(void) {
 //   char* names[] = { "142.A","142.B","142.C", "11.A","11.B","11.C","141.A","141.B","143.A","143.B","11.A","11.B","11.C","121.A","121.B","122.A","13.A","13.B"};
 //   int i,j,total = 3+4+8+3;
 
-   char* names[] = { "11.A","11.B","11.C",
-                     "121.A","121.B",
-                     "122.A",
-                     "13.A","13.B",
-                     "141.A","141.B",
-                     "142.A","142.B","142.C",
-                     "143.A","143.B",
-                     "15.A","15.B","15.C"};
-   int i,j,total = 3+2+1+2+2+3+2+3;
+   const char* names[] = { "11.A","11.B","11.C",
+                           "121.A","121.B",
+                           "122.A",
+                           "13.A","13.B",
+                           "141.A","141.B",
+                           "142.A","142.B","142.C",
+                           "143.A","143.B",
+                           "15.A","15.B","15.C"};
+   unsigned int i,j,total = 3+2+1+2+2+3+2+3;
 
   printf("-- print all the example routes --\n");
   xbt_dynar_t links;
@@ -1493,7 +1494,7 @@ static void DEGUB_exit(void) {
     for(j=0;j<total;j++) {
       links = (*(global_routing->get_route))(names[i],names[j]);
       printf("route from %s to %s >>> ",names[i],names[j]);
-      int cpt=0;
+      unsigned int cpt=0;
       xbt_dynar_foreach(links, cpt, link) {
         s_surf_resource_t* generic_resource = link;
         printf(" %s",generic_resource->name);
index 8967099..a2afeae 100644 (file)
@@ -90,6 +90,10 @@ xbt_dynar_t STag_surfxml_trace_c_connect_cb_list = NULL;
 xbt_dynar_t ETag_surfxml_trace_c_connect_cb_list = NULL;
 xbt_dynar_t STag_surfxml_random_cb_list = NULL;
 xbt_dynar_t ETag_surfxml_random_cb_list = NULL;
+xbt_dynar_t STag_surfxml_AS_cb_list = NULL;  // addded by david
+xbt_dynar_t ETag_surfxml_AS_cb_list = NULL;  // addded by david
+xbt_dynar_t STag_surfxml_gateway_cb_list = NULL;  // addded by david
+xbt_dynar_t ETag_surfxml_gateway_cb_list = NULL;  // addded by david
 
 /* Stores the sets defined in the XML */
 xbt_dict_t set_list = NULL;
@@ -160,6 +164,10 @@ void surf_parse_free_callbacks(void)
   xbt_dynar_free(&ETag_surfxml_trace_c_connect_cb_list);
   xbt_dynar_free(&STag_surfxml_random_cb_list);
   xbt_dynar_free(&ETag_surfxml_random_cb_list);
+  xbt_dynar_free(&STag_surfxml_AS_cb_list);  // addded by david
+  xbt_dynar_free(&ETag_surfxml_AS_cb_list);  // addded by david
+  xbt_dynar_free(&STag_surfxml_gateway_cb_list);  // addded by david
+  xbt_dynar_free(&ETag_surfxml_gateway_cb_list);  // addded by david
 }
 
 void surf_parse_reset_parser(void)
@@ -203,6 +211,10 @@ void surf_parse_reset_parser(void)
     xbt_dynar_new(sizeof(void_f_void_t), NULL);
   STag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
   ETag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_AS_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);  // addded by david
+  ETag_surfxml_AS_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);  // addded by david
+  STag_surfxml_gateway_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);  // addded by david
+  ETag_surfxml_gateway_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);  // addded by david
 }
 
 void STag_surfxml_include(void)
@@ -427,6 +439,26 @@ void ETag_surfxml_random(void)
   surfxml_call_cb_functions(ETag_surfxml_random_cb_list);
 }
 
+void STag_surfxml_AS(void)   // addded by david
+{
+  surfxml_call_cb_functions(STag_surfxml_AS_cb_list);
+}
+
+void ETag_surfxml_AS(void)   // addded by david
+{
+  surfxml_call_cb_functions(ETag_surfxml_AS_cb_list);
+}
+
+void STag_surfxml_gateway(void)   // addded by david
+{
+  surfxml_call_cb_functions(STag_surfxml_gateway_cb_list);
+}
+
+void ETag_surfxml_gateway(void)   // addded by david
+{
+  surfxml_call_cb_functions(ETag_surfxml_gateway_cb_list);
+}
+
 void surf_parse_open(const char *file)
 {
   static int warned = 0;        /* warn only once */
@@ -512,6 +544,19 @@ void surfxml_add_callback(xbt_dynar_t cb_list, void_f_void_t function)
   xbt_dynar_push(cb_list, &function);
 }
 
+void surfxml_del_callback(xbt_dynar_t* p_cb_list, void_f_void_t function)
+{
+  xbt_dynar_t new_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  unsigned int it;
+  void_f_void_t func;
+  xbt_dynar_foreach(*p_cb_list,it,func) {
+    if( func != function )
+      xbt_dynar_push(new_cb_list, &func);
+  }
+  xbt_dynar_free(p_cb_list);
+  *p_cb_list = new_cb_list;
+}
+
 static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t cb_list)
 {
   unsigned int iterator;
@@ -1252,7 +1297,7 @@ void surf_add_route_element(char* link_ctn_id)
 void surf_route_set_resource(char *source_id,char *destination_id,xbt_dynar_t links_id,int action)
 {
        route_link_list = xbt_dynar_new(sizeof(char *), NULL);
-       routing_add_route(source_id,destination_id,links_id,action);
+       //routing_add_route(source_id,destination_id,links_id,action); // COMMENTED BY DAVID
 
 }
 
@@ -1261,7 +1306,7 @@ void surf_route_set_resource(char *source_id,char *destination_id,xbt_dynar_t li
  */
 void surf_route_add_host(char *host_id)
 {
-       routing_add_host(host_id);
+       //routing_add_host(host_id); // COMMENTED BY DAVID
 }
 
 /*
@@ -1289,6 +1334,6 @@ void surf_wsL07_add_traces(void)
  */
 void surf_set_routes(void)
 {
-       routing_set_routes();
+       //routing_set_routes(); // COMMENTED BY DAVID
 }