Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make simgrid compil with Full Flags.
[simgrid.git] / src / surf / surf_routing.c
index 62c1c00..d33eb64 100644 (file)
@@ -428,7 +428,7 @@ static route_extended_t _get_route(const char* src,const char* dst) {
      
   xbt_assert0(src&&dst,"bad parameters for \"_get_route\" method");
   
-  route_extended_t e_route, e_route_cnt, e_route_src, e_route_dst;
+  route_extended_t e_route, e_route_cnt, e_route_src=NULL, e_route_dst=NULL;
   
   xbt_dynar_t elem_father_list = elements_father(src,dst);
   
@@ -581,6 +581,16 @@ static void finalize(void) {
   xbt_free(global_routing);
 }
 
+static void get_onelink_routes(void)
+{
+       xbt_die("get_onelink_routes function not implemented yet!!!");
+}
+
+static int is_router(const char *name)
+{
+       xbt_die("is_router function not implemented yet!!!");
+}
+
 /**
  * \brief Generic method: create the global routing schema
  * 
@@ -819,7 +829,7 @@ static route_extended_t floyd_get_route(routing_component_t rc, const char* src,
   int first = 1;
   int pred = *dst_id;
   int prev_pred = 0;
-  char *gw_src,*gw_dst, *prev_gw_src,*prev_gw_dst, *first_gw;
+  char *gw_src=NULL,*gw_dst=NULL, *prev_gw_src,*prev_gw_dst, *first_gw=NULL;
   unsigned int cpt;
   void* link;
   xbt_dynar_t links;
@@ -1269,7 +1279,7 @@ static route_extended_t dijkstra_get_route(routing_component_t rc, const char* s
   }
   
   /* compose route path with links */
-  char *gw_src,*gw_dst, *prev_gw_src,*prev_gw_dst, *first_gw;
+  char *gw_src=NULL,*gw_dst=NULL, *prev_gw_src,*prev_gw_dst, *first_gw=NULL;
   
   for(v = dst_node_id; v != src_node_id; v = pred_arr[v]) {
     xbt_node_t node_pred_v = xbt_dynar_get_as(nodes, pred_arr[v], xbt_node_t);
@@ -1882,7 +1892,6 @@ static void generic_set_route(routing_component_t rc, const char* src, const cha
 
 static void generic_set_ASroute(routing_component_t rc, const char* src, const char* dst, route_extended_t e_route) {
   DEBUG4("Load ASroute from \"%s(%s)\" to \"%s(%s)\"",src,e_route->src_gateway,dst,e_route->dst_gateway);
-  printf("Load ASroute from \"%s(%s)\" to \"%s(%s)\"\n",src,e_route->src_gateway,dst,e_route->dst_gateway);
   model_type_t modeltype = rc->routing;
   xbt_dict_t _parse_routes;
   xbt_dict_t _to_index;
@@ -2213,15 +2222,12 @@ static void routing_full_parse_Scluster(void)
        xbt_dynar_t radical_elements;
        xbt_dynar_t radical_ends;
 
-       surfxml_bufferstack_push(1);
+       static unsigned int surfxml_buffer_stack_stack_ptr = 1;
+       static unsigned int surfxml_buffer_stack_stack[1024];
 
-       /* allocating memory for the buffer, I think 2kB should be enough */
-       // surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);
+       surfxml_buffer_stack_stack[0]= 0;
 
-//     DEBUG4("id='%s' prefix='%s' suffix='%s' radical='%s'",
-//       cluster_id,cluster_prefix,cluster_suffix,cluster_radical);
-//     DEBUG5("power='%s' bw='%s' lat='%s' bb_bw='%s' bb_lat='%s'",
-//               cluster_power,cluster_bw,cluster_lat,cluster_bb_bw,cluster_bb_lat);
+       surfxml_bufferstack_push(1);
 
        DEBUG1("<AS id=\"%s\"\trouting=\"RuleBased\">",cluster_id);
        SURFXML_BUFFER_SET(AS_id, cluster_id);
@@ -2240,7 +2246,6 @@ static void routing_full_parse_Scluster(void)
                          link_id = bprintf("%s_link_%d", cluster_id, start);
 
                          DEBUG2("<host\tid=\"%s\"\tpower=\"%s\"/>",host_id,cluster_power);
-                         SURFXML_BUFFER_RESET();
                          SURFXML_BUFFER_SET(host_id, host_id);
                          SURFXML_BUFFER_SET(host_power, cluster_power);
                          SURFXML_BUFFER_SET(host_availability, "1.0");
@@ -2255,7 +2260,6 @@ static void routing_full_parse_Scluster(void)
                          SURFXML_END_TAG(host);
 
                          DEBUG3("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>",link_id,cluster_bw,cluster_lat);
-                         SURFXML_BUFFER_RESET();
                          SURFXML_BUFFER_SET(link_id, link_id);
                          SURFXML_BUFFER_SET(link_bandwidth, cluster_bw);
                          SURFXML_BUFFER_SET(link_latency, cluster_lat);
@@ -2273,13 +2277,13 @@ static void routing_full_parse_Scluster(void)
 
                          surf_parse_get_int(&start, xbt_dynar_get_as(radical_ends, 0, char *));
                          surf_parse_get_int(&end, xbt_dynar_get_as(radical_ends, 1, char *));
+                         DEBUG2("Create hosts and links from %d to %d",start,end);
                          for (i = start; i <= end; i++)
                          {
                                  host_id = bprintf("%s%d%s", cluster_prefix, i, cluster_suffix);
                                  link_id = bprintf("%s_link_%d", cluster_id, i);
 
                                  DEBUG2("<host\tid=\"%s\"\tpower=\"%s\"/>",host_id,cluster_power);
-                                 SURFXML_BUFFER_RESET();
                                  SURFXML_BUFFER_SET(host_id, host_id);
                                  SURFXML_BUFFER_SET(host_power, cluster_power);
                                  SURFXML_BUFFER_SET(host_availability, "1.0");
@@ -2294,7 +2298,6 @@ static void routing_full_parse_Scluster(void)
                                  SURFXML_END_TAG(host);
 
                                  DEBUG3("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>",link_id,cluster_bw,cluster_lat);
-                                 SURFXML_BUFFER_RESET();
                                  SURFXML_BUFFER_SET(link_id, link_id);
                                  SURFXML_BUFFER_SET(link_bandwidth, cluster_bw);
                                  SURFXML_BUFFER_SET(link_latency, cluster_lat);
@@ -2321,13 +2324,11 @@ static void routing_full_parse_Scluster(void)
        link_backbone = bprintf("%s_backbone",cluster_id);
 
        DEBUG1("<router id=\"%s\"\">",router_id);
-       SURFXML_BUFFER_RESET();
        SURFXML_BUFFER_SET(router_id, router_id);;
        SURFXML_START_TAG(router);
        SURFXML_END_TAG(router);
 
        DEBUG3("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>",link_router,cluster_bw,cluster_lat);
-       SURFXML_BUFFER_RESET();
        SURFXML_BUFFER_SET(link_id, link_router);
        SURFXML_BUFFER_SET(link_bandwidth, cluster_bw);
        SURFXML_BUFFER_SET(link_latency, cluster_lat);
@@ -2340,7 +2341,6 @@ static void routing_full_parse_Scluster(void)
        SURFXML_END_TAG(link);
 
        DEBUG3("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>",link_backbone,cluster_bb_bw,cluster_bb_lat);
-       SURFXML_BUFFER_RESET();
        SURFXML_BUFFER_SET(link_id, link_backbone);
        SURFXML_BUFFER_SET(link_bandwidth, cluster_bb_bw);
        SURFXML_BUFFER_SET(link_latency, cluster_bb_lat);
@@ -2367,25 +2367,21 @@ static void routing_full_parse_Scluster(void)
        DEBUG0(" ");
 
        DEBUG2("<route\tsrc=\"%s\"\tdst=\"%s\">",route_src_dst,route_src_dst);
-       SURFXML_BUFFER_RESET();
        SURFXML_BUFFER_SET(route_src, route_src_dst);
        SURFXML_BUFFER_SET(route_dst, route_src_dst);
        SURFXML_START_TAG(route);
 
        DEBUG1("<link:ctn\tid=\"%s_link_$1src\"/>",cluster_id);
-       SURFXML_BUFFER_RESET();
        SURFXML_BUFFER_SET(link_c_ctn_id, bprintf("%s_link_$1src",cluster_id));
        SURFXML_START_TAG(link_c_ctn);
        SURFXML_END_TAG(link_c_ctn);
 
        DEBUG1("<link:ctn\tid=\"%s_backbone\"/>",cluster_id);
-       SURFXML_BUFFER_RESET();
        SURFXML_BUFFER_SET(link_c_ctn_id, bprintf("%s_backbone",cluster_id));
        SURFXML_START_TAG(link_c_ctn);
        SURFXML_END_TAG(link_c_ctn);
 
        DEBUG1("<link:ctn\tid=\"%s_link_$1dst\"/>",cluster_id);
-       SURFXML_BUFFER_RESET();
        SURFXML_BUFFER_SET(link_c_ctn_id, bprintf("%s_link_$1dst",cluster_id));
        SURFXML_START_TAG(link_c_ctn);
        SURFXML_END_TAG(link_c_ctn);