Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Set level COORD_HOST_LEVEL and COORD_ASR_LEVEL if there are used.
[simgrid.git] / src / surf / surfxml_parse.c
index 250ee7e..a15bd37 100644 (file)
@@ -483,8 +483,20 @@ void parse_properties(void)
   char *value = NULL;
   if (!current_property_set)
     current_property_set = xbt_dict_new();      // Maybe, it should be make a error
   char *value = NULL;
   if (!current_property_set)
     current_property_set = xbt_dict_new();      // Maybe, it should be make a error
-  value = xbt_strdup(A_surfxml_prop_value);
-  xbt_dict_set(current_property_set, A_surfxml_prop_id, value, free);
+  if(!strcmp(A_surfxml_prop_id,"coordinates")){
+         if(!strcmp(A_surfxml_prop_value,"yes") && !COORD_HOST_LEVEL)
+         {
+                   XBT_INFO("Configuration change: Set '%s' to '%s'", A_surfxml_prop_id, A_surfxml_prop_value);
+                       COORD_HOST_LEVEL = xbt_lib_add_level(host_lib,xbt_dynar_free_voidp);
+                       COORD_ASR_LEVEL  = xbt_lib_add_level(as_router_lib,xbt_dynar_free_voidp);
+         }
+         if(strcmp(A_surfxml_prop_value,"yes"))
+                 xbt_die("Setting XML prop coordinates must be \"yes\"");
+  }
+  else{
+         value = xbt_strdup(A_surfxml_prop_value);
+         xbt_dict_set(current_property_set, A_surfxml_prop_id, value, free);
+  }
 }
 
 /* Trace management functions */
 }
 
 /* Trace management functions */
@@ -573,9 +585,8 @@ double get_cpu_power(const char *power)
       generator = xbt_malloc(q - (p + 6) + 1);
       memcpy(generator, p + 6, q - (p + 6));
       generator[q - (p + 6)] = '\0';
       generator = xbt_malloc(q - (p + 6) + 1);
       memcpy(generator, p + 6, q - (p + 6));
       generator[q - (p + 6)] = '\0';
-      xbt_assert1((random =
-                   xbt_dict_get_or_null(random_data_list, generator)),
-                  "Random generator %s undefined", generator);
+      random = xbt_dict_get_or_null(random_data_list, generator);
+      xbt_assert1(random, "Random generator %s undefined", generator);
       power_scale = random_generate(random);
     }
   } else {
       power_scale = random_generate(random);
     }
   } else {
@@ -694,6 +705,46 @@ void surf_wsL07_link_create_resource(char *name,
                            properties);
 }
 
                            properties);
 }
 
+/**
+ *
+ *init new routing model component
+ */
+
+void surf_AS_new(const char *AS_id, const char *AS_mode)
+{
+  routing_AS_init(AS_id, AS_mode);
+}
+
+void surf_AS_finalize(const char *AS_id)
+{
+  routing_AS_end(AS_id);
+}
+
+/*
+ * add host to the network element list
+ */
+void surf_route_add_host(const char *host_id)
+{
+  routing_add_host(host_id);
+}
+
+/**
+ * set route
+ */
+void surf_routing_add_route(const char *src_id, const char *dst_id,
+                            xbt_dynar_t links_id)
+{
+  unsigned int i;
+  const char *link_id;
+  routing_set_route(src_id, dst_id);
+  xbt_dynar_foreach(links_id, i, link_id) {
+    routing_add_link(link_id);
+  }
+
+  //store the route
+  routing_store_route();
+}
+
 /**
  * Add Traces
  */
 /**
  * Add Traces
  */