Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
More cleaning for surfxml callback (property and trace*)
authornavarro <navarro@caraja.(none)>
Mon, 6 Aug 2012 16:28:01 +0000 (18:28 +0200)
committernavarro <navarro@caraja.(none)>
Mon, 6 Aug 2012 16:28:18 +0000 (18:28 +0200)
include/simgrid/platf.h
include/surf/surfxml_parse.h
src/include/simgrid/platf_interface.h
src/simix/smx_deployment.c
src/surf/sg_platf.c
src/surf/surf_routing.c
src/surf/surfxml_parse.c
src/surf/surfxml_parseplatf.c

index 2359872..53b3986 100644 (file)
@@ -58,6 +58,13 @@ typedef enum {
   SURF_LINK_DIRECTION_DOWN = 0
 } e_surf_link_ctn_direction_t;
 
+typedef enum {
+  SURF_TRACE_CONNECT_KIND_HOST_AVAIL = 4,
+  SURF_TRACE_CONNECT_KIND_POWER = 3,
+  SURF_TRACE_CONNECT_KIND_LINK_AVAIL = 2,
+  SURF_TRACE_CONNECT_KIND_BANDWIDTH = 1,
+  SURF_TRACE_CONNECT_KIND_LATENCY = 0
+} e_surf_trace_connect_kin_t;
 /*
  * Platform creation functions. Instead of passing 123 arguments to the creation functions
  * (one for each possible XML attribute), we pass structures containing them all. It removes the
@@ -206,6 +213,26 @@ typedef struct {
   const char* name;
 } s_sg_platf_mount_cbarg_t, *sg_platf_mount_cbarg_t;
 
+typedef struct s_sg_platf_prop_cbarg *sg_platf_prop_cbarg_t;
+typedef struct s_sg_platf_prop_cbarg {
+  const char *id;
+  const char *value;
+} s_sg_platf_prop_cbarg_t;
+
+typedef struct s_sg_platf_trace_cbarg *sg_platf_trace_cbarg_t;
+typedef struct s_sg_platf_trace_cbarg {
+  const char *id;
+  const char *file;
+  double periodicity;
+  const char *pc_data;
+} s_sg_platf_trace_cbarg_t;
+
+typedef struct s_sg_platf_trace_connect_cbarg *sg_platf_trace_connect_cbarg_t;
+typedef struct s_sg_platf_trace_connect_cbarg {
+  e_surf_trace_connect_kin_t kind;
+  const char *trace;
+  const char *element;
+} s_sg_platf_trace_connect_cbarg_t;
 
 XBT_PUBLIC(void) sg_platf_begin(void);  // Start a new platform
 XBT_PUBLIC(void) sg_platf_end(void); // Finish the creation of the platform
@@ -226,6 +253,10 @@ XBT_PUBLIC(void) sg_platf_new_route (sg_platf_route_cbarg_t route); // Add a rou
 XBT_PUBLIC(void) sg_platf_new_ASroute (sg_platf_ASroute_cbarg_t ASroute); // Add an ASroute
 XBT_PUBLIC(void) sg_platf_new_bypassRoute (sg_platf_bypassRoute_cbarg_t bypassroute); // Add a bypassRoute
 XBT_PUBLIC(void) sg_platf_new_bypassASroute (sg_platf_bypassASroute_cbarg_t bypassASroute); // Add an bypassASroute
+XBT_PUBLIC(void) sg_platf_new_prop (sg_platf_prop_cbarg_t prop); // Add a prop
+
+XBT_PUBLIC(void) sg_platf_new_trace(sg_platf_trace_cbarg_t trace);
+XBT_PUBLIC(void) sg_platf_new_trace_connect(sg_platf_trace_connect_cbarg_t trace_connect);
 
 XBT_PUBLIC(void) sg_platf_new_storage(sg_platf_storage_cbarg_t storage); // Add a storage to the currently described AS
 XBT_PUBLIC(void) sg_platf_new_storage(sg_platf_storage_cbarg_t storage); // Add a storage to the currently described AS
index 6d34abf..031041d 100644 (file)
@@ -20,12 +20,6 @@ XBT_PUBLIC_DATA(xbt_dynar_t) STag_surfxml_process_cb_list;
 XBT_PUBLIC_DATA(xbt_dynar_t) ETag_surfxml_process_cb_list;
 XBT_PUBLIC_DATA(xbt_dynar_t) STag_surfxml_argument_cb_list;
 XBT_PUBLIC_DATA(xbt_dynar_t) ETag_surfxml_argument_cb_list;
-XBT_PUBLIC_DATA(xbt_dynar_t) STag_surfxml_prop_cb_list;
-XBT_PUBLIC_DATA(xbt_dynar_t) ETag_surfxml_prop_cb_list;
-XBT_PUBLIC_DATA(xbt_dynar_t) STag_surfxml_trace_cb_list;
-XBT_PUBLIC_DATA(xbt_dynar_t) ETag_surfxml_trace_cb_list;
-XBT_PUBLIC_DATA(xbt_dynar_t) STag_surfxml_trace_connect_cb_list;
-XBT_PUBLIC_DATA(xbt_dynar_t) ETag_surfxml_trace_connect_cb_list;
 
 XBT_PUBLIC(void) surf_parse_open(const char *file);
 XBT_PUBLIC(void) surf_parse_close(void);
index da830c7..9767ced 100644 (file)
@@ -27,12 +27,16 @@ typedef void (*sg_platf_peer_cb_t)(sg_platf_peer_cbarg_t);
 typedef void (*sg_platf_cluster_cb_t)(sg_platf_cluster_cbarg_t);
 typedef void (*sg_platf_cabinet_cb_t)(sg_platf_cabinet_cbarg_t);
 typedef void (*sg_platf_AS_begin_cb_t)(const char*id, int routing);
+typedef void (*sg_platf_prop_cb_t)(sg_platf_prop_cbarg_t);
 
 typedef void (*sg_platf_route_cb_t)(sg_platf_route_cbarg_t);
 typedef void (*sg_platf_ASroute_cb_t)(sg_platf_ASroute_cbarg_t);
 typedef void (*sg_platf_bypassRoute_cb_t)(sg_platf_bypassRoute_cbarg_t);
 typedef void (*sg_platf_bypassASroute_cb_t)(sg_platf_bypassASroute_cbarg_t);
 
+typedef void (*sg_platf_trace_cb_t)(sg_platf_trace_cbarg_t);
+typedef void (*sg_platf_trace_connect_cb_t)(sg_platf_trace_connect_cbarg_t);
+
 typedef void (*sg_platf_storage_cb_t)(sg_platf_storage_cbarg_t);
 typedef void (*sg_platf_storage_type_cb_t)(sg_platf_storage_type_cbarg_t);
 typedef void (*sg_platf_mount_cb_t)(sg_platf_mount_cbarg_t);
@@ -49,12 +53,16 @@ void sg_platf_cabinet_add_cb(sg_platf_cabinet_cb_t fct);
 void sg_platf_postparse_add_cb(void_f_void_t fct);
 void sg_platf_AS_begin_add_cb(sg_platf_AS_begin_cb_t fct);
 void sg_platf_AS_end_add_cb(void_f_void_t fct);
+void sg_platf_prop_add_cb(sg_platf_prop_cb_t fct);
 
 void sg_platf_route_add_cb(sg_platf_route_cb_t);
 void sg_platf_ASroute_add_cb(sg_platf_ASroute_cb_t);
 void sg_platf_bypassRoute_add_cb(sg_platf_bypassRoute_cb_t);
 void sg_platf_bypassASroute_add_cb(sg_platf_bypassASroute_cb_t);
 
+void sg_platf_trace_add_cb(sg_platf_trace_cb_t);
+void sg_platf_trace_connect_add_cb(sg_platf_trace_connect_cb_t);
+
 void sg_platf_storage_add_cb(sg_platf_storage_cb_t fct);
 void sg_platf_mstorage_add_cb(sg_platf_mstorage_cb_t fct);
 void sg_platf_storage_type_add_cb(sg_platf_storage_type_cb_t fct);
index a62992c..6b17613 100644 (file)
@@ -117,7 +117,6 @@ void SIMIX_launch_application(const char *file)
 
   surfxml_add_callback(STag_surfxml_process_cb_list, parse_process_init);
   surfxml_add_callback(ETag_surfxml_argument_cb_list, parse_argument);
-  surfxml_add_callback(STag_surfxml_prop_cb_list, parse_properties);
   surfxml_add_callback(ETag_surfxml_process_cb_list,
                        parse_process_finalize);
 
index 175ff66..87a6fd4 100644 (file)
@@ -23,12 +23,16 @@ xbt_dynar_t sg_platf_cabinet_cb_list = NULL; // of sg_platf_cluster_cb_t
 xbt_dynar_t sg_platf_AS_begin_cb_list = NULL; //of sg_platf_AS_begin_cb_t
 xbt_dynar_t sg_platf_AS_end_cb_list = NULL; //of void_f_void_t
 xbt_dynar_t sg_platf_postparse_cb_list = NULL; // of void_f_void_t
+xbt_dynar_t sg_platf_prop_cb_list = NULL; // of sg_platf_prop_cb_t
 
 xbt_dynar_t sg_platf_route_cb_list = NULL; // of sg_platf_route_cb_t
 xbt_dynar_t sg_platf_ASroute_cb_list = NULL; // of sg_platf_ASroute_cb_t
 xbt_dynar_t sg_platf_bypassRoute_cb_list = NULL; // of sg_platf_bypassRoute_cb_t
 xbt_dynar_t sg_platf_bypassASroute_cb_list = NULL; // of sg_platf_bypassASroute_cb_t
 
+xbt_dynar_t sg_platf_trace_cb_list = NULL;
+xbt_dynar_t sg_platf_trace_connect_cb_list = NULL;
+
 xbt_dynar_t sg_platf_storage_cb_list = NULL; // of sg_platf_storage_cb_t
 xbt_dynar_t sg_platf_storage_type_cb_list = NULL; // of sg_platf_storage_cb_t
 xbt_dynar_t sg_platf_mstorage_cb_list = NULL; // of sg_platf_storage_cb_t
@@ -57,12 +61,16 @@ void sg_platf_init(void) {
   sg_platf_postparse_cb_list = xbt_dynar_new(sizeof(sg_platf_link_cb_t),NULL);
   sg_platf_AS_begin_cb_list = xbt_dynar_new(sizeof(sg_platf_AS_begin_cb_t),NULL);
   sg_platf_AS_end_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
+  sg_platf_prop_cb_list = xbt_dynar_new(sizeof(sg_platf_prop_cb_t),NULL);
 
   sg_platf_route_cb_list = xbt_dynar_new(sizeof(sg_platf_route_cb_t), NULL);
   sg_platf_ASroute_cb_list = xbt_dynar_new(sizeof(sg_platf_ASroute_cb_t), NULL);
   sg_platf_bypassRoute_cb_list = xbt_dynar_new(sizeof(sg_platf_bypassRoute_cb_t), NULL);
   sg_platf_bypassASroute_cb_list = xbt_dynar_new(sizeof(sg_platf_bypassASroute_cb_t), NULL);
 
+  sg_platf_trace_cb_list = xbt_dynar_new(sizeof(sg_platf_trace_cb_t), NULL);
+  sg_platf_trace_connect_cb_list = xbt_dynar_new(sizeof(sg_platf_trace_connect_cb_t), NULL);
+
   sg_platf_storage_cb_list = xbt_dynar_new(sizeof(sg_platf_storage_cb_t), NULL);
   sg_platf_storage_type_cb_list = xbt_dynar_new(sizeof(sg_platf_storage_cb_t), NULL);
   sg_platf_mstorage_cb_list = xbt_dynar_new(sizeof(sg_platf_storage_cb_t), NULL);
@@ -81,6 +89,10 @@ void sg_platf_exit(void) {
   xbt_dynar_free(&sg_platf_cabinet_cb_list);
   xbt_dynar_free(&sg_platf_AS_begin_cb_list);
   xbt_dynar_free(&sg_platf_AS_end_cb_list);
+  xbt_dynar_free(&sg_platf_prop_cb_list);
+
+  xbt_dynar_free(&sg_platf_trace_cb_list);
+  xbt_dynar_free(&sg_platf_trace_connect_cb_list);
 
   xbt_dynar_free(&sg_platf_route_cb_list);
   xbt_dynar_free(&sg_platf_ASroute_cb_list);
@@ -207,6 +219,27 @@ void sg_platf_new_bypassRoute(sg_platf_bypassRoute_cbarg_t bypassRoute) {
     fun(bypassASroute);
   }
 }
+void sg_platf_new_prop(sg_platf_prop_cbarg_t prop) {
+  unsigned int iterator;
+  sg_platf_prop_cb_t fun;
+  xbt_dynar_foreach(sg_platf_prop_cb_list, iterator, fun) {
+    fun(prop);
+  }
+}
+void sg_platf_new_trace(sg_platf_trace_cbarg_t trace) {
+  unsigned int iterator;
+  sg_platf_trace_cb_t fun;
+  xbt_dynar_foreach(sg_platf_trace_cb_list, iterator, fun) {
+    fun(trace);
+  }
+}
+void sg_platf_new_trace_connect(sg_platf_trace_connect_cbarg_t trace_connect) {
+  unsigned int iterator;
+  sg_platf_trace_connect_cb_t fun;
+  xbt_dynar_foreach(sg_platf_trace_connect_cb_list, iterator, fun) {
+    fun(trace_connect);
+  }
+}
 void sg_platf_begin() { /* Do nothing: just for symmetry of user code */ }
 
 void sg_platf_end() {
@@ -311,7 +344,15 @@ void sg_platf_bypassRoute_add_cb(sg_platf_bypassRoute_cb_t fct) {
 void sg_platf_bypassASroute_add_cb(sg_platf_bypassASroute_cb_t fct) {
   xbt_dynar_push(sg_platf_bypassASroute_cb_list, &fct);
 }
-
+void sg_platf_prop_add_cb(sg_platf_prop_cb_t fct) {
+  xbt_dynar_push(sg_platf_prop_cb_list, &fct);
+}
+void sg_platf_trace_add_cb(sg_platf_trace_cb_t fct) {
+  xbt_dynar_push(sg_platf_trace_cb_list, &fct);
+}
+void sg_platf_trace_connect_add_cb(sg_platf_trace_connect_cb_t fct) {
+  xbt_dynar_push(sg_platf_trace_connect_cb_list, &fct);
+}
 void sg_platf_rng_stream_init(unsigned long seed[6]) {
   RngStream_SetPackageSeed(seed);
   sg_platf_rng_stream = RngStream_CreateStream(NULL);
index 5a026ee..6abdabb 100644 (file)
@@ -323,6 +323,60 @@ static void routing_parse_link_ctn(sg_platf_linkctn_cbarg_t linkctn)
   xbt_dynar_push(parsed_link_list, &link_id);
 }
 
+static void routing_parse_trace(sg_platf_trace_cbarg_t trace)
+{
+  tmgr_trace_t tmgr_trace;
+  if (!trace->file || strcmp(trace->file, "") != 0) {
+    tmgr_trace = tmgr_trace_new_from_file(trace->file);
+  } else if (strcmp(trace->pc_data, "") == 0) {
+    tmgr_trace = NULL;
+  } else {
+    tmgr_trace =
+          tmgr_trace_new_from_string(trace->id, trace->pc_data,
+                                     trace->periodicity);
+  }
+  xbt_dict_set(traces_set_list, trace->id, (void *) tmgr_trace, NULL);
+}
+
+static void routing_parse_trace_connect(sg_platf_trace_connect_cbarg_t trace_connect)
+{
+  xbt_assert(xbt_dict_get_or_null
+              (traces_set_list, trace_connect->trace),
+              "Cannot connect trace %s to %s: trace unknown",
+              trace_connect->trace,
+              trace_connect->element);
+
+  switch (trace_connect->kind) {
+  case SURF_TRACE_CONNECT_KIND_HOST_AVAIL:
+    xbt_dict_set(trace_connect_list_host_avail,
+        trace_connect->trace,
+        xbt_strdup(trace_connect->element), NULL);
+    break;
+  case SURF_TRACE_CONNECT_KIND_POWER:
+    xbt_dict_set(trace_connect_list_power, trace_connect->trace,
+        xbt_strdup(trace_connect->element), NULL);
+    break;
+  case SURF_TRACE_CONNECT_KIND_LINK_AVAIL:
+    xbt_dict_set(trace_connect_list_link_avail,
+        trace_connect->trace,
+        xbt_strdup(trace_connect->element), NULL);
+    break;
+  case SURF_TRACE_CONNECT_KIND_BANDWIDTH:
+    xbt_dict_set(trace_connect_list_bandwidth,
+        trace_connect->trace,
+        xbt_strdup(trace_connect->element), NULL);
+    break;
+  case SURF_TRACE_CONNECT_KIND_LATENCY:
+    xbt_dict_set(trace_connect_list_latency, trace_connect->trace,
+        xbt_strdup(trace_connect->element), NULL);
+    break;
+  default:
+    xbt_die("Cannot connect trace %s to %s: kind of trace unknown",
+        trace_connect->trace, trace_connect->element);
+    break;
+  }
+}
+
 /**
  * \brief Make a new routing component to the platform
  *
@@ -1147,7 +1201,8 @@ void routing_register_callbacks()
   sg_platf_AS_end_add_cb(routing_AS_end);
   sg_platf_AS_begin_add_cb(routing_AS_begin);
 
-
+  sg_platf_trace_add_cb(routing_parse_trace);
+  sg_platf_trace_connect_add_cb(routing_parse_trace_connect);
 
 #ifdef HAVE_TRACING
   instr_routing_define_callbacks();
index e2a0e4c..69a1b6c 100644 (file)
@@ -68,12 +68,6 @@ xbt_dynar_t STag_surfxml_process_cb_list = NULL;
 xbt_dynar_t ETag_surfxml_process_cb_list = NULL;
 xbt_dynar_t STag_surfxml_argument_cb_list = NULL;
 xbt_dynar_t ETag_surfxml_argument_cb_list = NULL;
-xbt_dynar_t STag_surfxml_prop_cb_list = NULL;
-xbt_dynar_t ETag_surfxml_prop_cb_list = NULL;
-xbt_dynar_t STag_surfxml_trace_cb_list = NULL;
-xbt_dynar_t ETag_surfxml_trace_cb_list = NULL;
-xbt_dynar_t STag_surfxml_trace_connect_cb_list = NULL;
-xbt_dynar_t ETag_surfxml_trace_connect_cb_list = NULL;
 
 /* The default current property receiver. Setup in the corresponding opening callbacks. */
 xbt_dict_t current_property_set = NULL;
@@ -225,14 +219,6 @@ void surf_parse_init_callbacks(void)
         xbt_dynar_new(sizeof(void_f_void_t), NULL);
     ETag_surfxml_argument_cb_list =
         xbt_dynar_new(sizeof(void_f_void_t), NULL);
-    STag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
-    ETag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
-    STag_surfxml_trace_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
-    ETag_surfxml_trace_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
-    STag_surfxml_trace_connect_cb_list =
-        xbt_dynar_new(sizeof(void_f_void_t), NULL);
-    ETag_surfxml_trace_connect_cb_list =
-        xbt_dynar_new(sizeof(void_f_void_t), NULL);
 }
 
 void surf_parse_reset_callbacks(void)
@@ -249,16 +235,9 @@ void surf_parse_free_callbacks(void)
   xbt_dynar_free(&ETag_surfxml_process_cb_list);
   xbt_dynar_free(&STag_surfxml_argument_cb_list);
   xbt_dynar_free(&ETag_surfxml_argument_cb_list);
-  xbt_dynar_free(&STag_surfxml_prop_cb_list);
-  xbt_dynar_free(&ETag_surfxml_prop_cb_list);
-  xbt_dynar_free(&STag_surfxml_trace_cb_list);
-  xbt_dynar_free(&ETag_surfxml_trace_cb_list);
-  xbt_dynar_free(&STag_surfxml_trace_connect_cb_list);
-  xbt_dynar_free(&ETag_surfxml_trace_connect_cb_list);
 }
 
 /* Stag and Etag parse functions */
-void ETag_surfxml_router(void)  { /* ignored -- do not add content here */ }
 
 void STag_surfxml_platform(void) {
   _XBT_GNUC_UNUSED double version = surf_parse_get_double(A_surfxml_platform_version);
@@ -293,6 +272,14 @@ void STag_surfxml_host(void){
   xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
 }
 
+void STag_surfxml_prop(void)
+{
+  if (!current_property_set)
+    current_property_set = xbt_dict_new_homogeneous(xbt_free_f); // Maybe, it should raise an error
+
+  xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), NULL);
+}
+
 void ETag_surfxml_host(void)    {
   s_sg_platf_host_cbarg_t host;
   memset(&host,0,sizeof(host));
@@ -328,10 +315,6 @@ void STag_surfxml_host_link(void){
   sg_platf_new_host_link(&host_link);
 }
 
-void ETag_surfxml_host_link(void){
-  XBT_DEBUG("End create a Host_link for %s",A_surfxml_host_link_id);
-}
-
 void STag_surfxml_router(void){
   s_sg_platf_router_cbarg_t router;
   memset(&router, 0, sizeof(router));
@@ -391,9 +374,6 @@ void STag_surfxml_cluster(void){
   cluster.state_trace = A_surfxml_cluster_state_file;
   sg_platf_new_cluster(&cluster);
 }
-void ETag_surfxml_cluster(void){
-  /* nothing I can think of */
-}
 
 void STag_surfxml_cabinet(void){
   s_sg_platf_cabinet_cbarg_t cabinet;
@@ -408,9 +388,6 @@ void STag_surfxml_cabinet(void){
 
   sg_platf_new_cabinet(&cabinet);
 }
-void ETag_surfxml_cabinet(void){
-  /* nothing I can think of */
-}
 
 void STag_surfxml_peer(void){
   s_sg_platf_peer_cbarg_t peer;
@@ -426,17 +403,11 @@ void STag_surfxml_peer(void){
 
   sg_platf_new_peer(&peer);
 }
-void ETag_surfxml_peer(void){
-  /* nothing to do here */
-}
+
 void STag_surfxml_link(void){
   xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
 }
 
-void STag_surfxml_backbone(void){
-  /* nothing to do here */
-}
-
 void ETag_surfxml_link(void){
   s_sg_platf_link_cbarg_t link;
   memset(&link,0,sizeof(link));
@@ -504,9 +475,6 @@ void STag_surfxml_link_ctn(void){
 
 }
 
-void ETag_surfxml_link_ctn(void){
- // NOTHING TO DO
-}
 void ETag_surfxml_backbone(void){
   s_sg_platf_link_cbarg_t link;
   memset(&link,0,sizeof(link));
@@ -613,21 +581,46 @@ void ETag_surfxml_bypassASroute(void){
   sg_platf_new_bypassASroute(&ASroute);
 }
 
-void STag_surfxml_process(void){
-  surfxml_call_cb_functions(STag_surfxml_process_cb_list);
-}
-void STag_surfxml_argument(void){
-  surfxml_call_cb_functions(STag_surfxml_argument_cb_list);
-}
-void STag_surfxml_prop(void){
-  surfxml_call_cb_functions(STag_surfxml_prop_cb_list);
-}
-void STag_surfxml_trace(void){
-  surfxml_call_cb_functions(STag_surfxml_trace_cb_list);
+void ETag_surfxml_trace(void){
+  s_sg_platf_trace_cbarg_t trace;
+  memset(&trace,0,sizeof(trace));
+
+  trace.id = A_surfxml_trace_id;
+  trace.file = A_surfxml_trace_file;
+  trace.periodicity = surf_parse_get_double(A_surfxml_trace_periodicity);
+  trace.pc_data = surfxml_pcdata;
+
+  sg_platf_new_trace(&trace);
 }
+
 void STag_surfxml_trace_connect(void){
-  surfxml_call_cb_functions(STag_surfxml_trace_connect_cb_list);
+  s_sg_platf_trace_connect_cbarg_t trace_connect;
+  memset(&trace_connect,0,sizeof(trace_connect));
+
+  trace_connect.element = A_surfxml_trace_connect_element;
+  trace_connect.trace = A_surfxml_trace_connect_trace;
+
+  switch (A_surfxml_trace_connect_kind) {
+  case AU_surfxml_trace_connect_kind:
+  case A_surfxml_trace_connect_kind_POWER:
+    trace_connect.kind =  SURF_TRACE_CONNECT_KIND_POWER;
+    break;
+  case A_surfxml_trace_connect_kind_BANDWIDTH:
+    trace_connect.kind =  SURF_TRACE_CONNECT_KIND_BANDWIDTH;
+    break;
+  case A_surfxml_trace_connect_kind_HOST_AVAIL:
+    trace_connect.kind =  SURF_TRACE_CONNECT_KIND_HOST_AVAIL;
+    break;
+  case A_surfxml_trace_connect_kind_LATENCY:
+    trace_connect.kind =  SURF_TRACE_CONNECT_KIND_LATENCY;
+    break;
+  case A_surfxml_trace_connect_kind_LINK_AVAIL:
+    trace_connect.kind =  SURF_TRACE_CONNECT_KIND_LINK_AVAIL;
+    break;
+  }
+  sg_platf_new_trace_connect(&trace_connect);
 }
+
 void STag_surfxml_AS(void){
   sg_platf_new_AS_begin(A_surfxml_AS_id, (int)A_surfxml_AS_routing);
 }
@@ -655,11 +648,27 @@ void ETag_surfxml_config(void){
   XBT_DEBUG("End configuration name = %s",A_surfxml_config_id);
   xbt_dict_free(&current_property_set);
 }
-void STag_surfxml_random(void){
-//TODO
+
+/* nothing to do in those functions */
+void ETag_surfxml_prop(void){}
+void STag_surfxml_random(void){}
+void ETag_surfxml_random(void){}
+void ETag_surfxml_trace_connect(void){}
+void STag_surfxml_trace(void){}
+void ETag_surfxml_router(void){}
+void ETag_surfxml_host_link(void){}
+void ETag_surfxml_cluster(void){}
+void ETag_surfxml_cabinet(void){}
+void ETag_surfxml_peer(void){}
+void STag_surfxml_backbone(void){}
+void ETag_surfxml_link_ctn(void){}
+
+// FIXME should not call surfxml_call_cb_functions
+void STag_surfxml_process(void){
+  surfxml_call_cb_functions(STag_surfxml_process_cb_list);
 }
-void ETag_surfxml_random(void){
-//TODO
+void STag_surfxml_argument(void){
+  surfxml_call_cb_functions(STag_surfxml_argument_cb_list);
 }
 
 #define parse_method(type,name)                                         \
@@ -669,9 +678,6 @@ void ETag_surfxml_random(void){
 
 parse_method(E, process);
 parse_method(E, argument);
-parse_method(E, prop);
-parse_method(E, trace);
-parse_method(E, trace_connect);
 
 /* Open and Close parse file */
 
@@ -769,14 +775,6 @@ static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t cb_list)
 /**
  * With XML parser
  */
-void parse_properties(void)
-{
-  if (!current_property_set)
-    current_property_set = xbt_dict_new_homogeneous(xbt_free_f); // Maybe, it should raise an error
-
-  xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), NULL);
-}
-
 
 /* Random tag functions */
 
index 631c6de..b86540c 100644 (file)
@@ -60,75 +60,6 @@ xbt_dict_t trace_connect_list_link_avail = NULL;
 xbt_dict_t trace_connect_list_bandwidth = NULL;
 xbt_dict_t trace_connect_list_latency = NULL;
 
-static double trace_periodicity = -1.0;
-static char *trace_file = NULL;
-static char *trace_id = NULL;
-
-static void parse_Stag_trace(void)
-{
-  trace_id = xbt_strdup(A_surfxml_trace_id);
-  trace_file = xbt_strdup(A_surfxml_trace_file);
-  trace_periodicity = surf_parse_get_double(A_surfxml_trace_periodicity);
-}
-
-static void parse_Etag_trace(void)
-{
-  tmgr_trace_t trace;
-  if (!trace_file || strcmp(trace_file, "") != 0) {
-    trace = tmgr_trace_new_from_file(trace_file);
-  } else if (strcmp(surfxml_pcdata, "") == 0) {
-      trace = NULL;
-  } else {
-      trace =
-          tmgr_trace_new_from_string(trace_id, surfxml_pcdata,
-                                     trace_periodicity);
-  }
-  xbt_dict_set(traces_set_list, trace_id, (void *) trace, NULL);
-  xbt_free(trace_file);
-  trace_file = NULL;
-  xbt_free(trace_id);
-  trace_id = NULL;
-}
-
-static void parse_Stag_trace_connect(void)
-{
-  xbt_assert(xbt_dict_get_or_null
-              (traces_set_list, A_surfxml_trace_connect_trace),
-              "Cannot connect trace %s to %s: trace unknown",
-              A_surfxml_trace_connect_trace,
-              A_surfxml_trace_connect_element);
-
-  switch (A_surfxml_trace_connect_kind) {
-  case A_surfxml_trace_connect_kind_HOST_AVAIL:
-    xbt_dict_set(trace_connect_list_host_avail,
-                 A_surfxml_trace_connect_trace,
-                 xbt_strdup(A_surfxml_trace_connect_element), NULL);
-    break;
-  case A_surfxml_trace_connect_kind_POWER:
-    xbt_dict_set(trace_connect_list_power, A_surfxml_trace_connect_trace,
-                 xbt_strdup(A_surfxml_trace_connect_element), NULL);
-    break;
-  case A_surfxml_trace_connect_kind_LINK_AVAIL:
-    xbt_dict_set(trace_connect_list_link_avail,
-                 A_surfxml_trace_connect_trace,
-                 xbt_strdup(A_surfxml_trace_connect_element), NULL);
-    break;
-  case A_surfxml_trace_connect_kind_BANDWIDTH:
-    xbt_dict_set(trace_connect_list_bandwidth,
-                 A_surfxml_trace_connect_trace,
-                 xbt_strdup(A_surfxml_trace_connect_element), NULL);
-    break;
-  case A_surfxml_trace_connect_kind_LATENCY:
-    xbt_dict_set(trace_connect_list_latency, A_surfxml_trace_connect_trace,
-                 xbt_strdup(A_surfxml_trace_connect_element), NULL);
-    break;
-  default:
-    xbt_die("Cannot connect trace %s to %s: kind of trace unknown",
-            A_surfxml_trace_connect_trace, A_surfxml_trace_connect_element);
-    break;
-  }
-}
-
 /* This function acts as a main in the parsing area. */
 void parse_platform_file(const char *file)
 {
@@ -137,7 +68,6 @@ void parse_platform_file(const char *file)
   surf_parse_init_callbacks();
 
   /* Register classical callbacks */
-  surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
   storage_register_callbacks();
   routing_register_callbacks();
 
@@ -158,11 +88,6 @@ void parse_platform_file(const char *file)
   trace_connect_list_bandwidth = xbt_dict_new_homogeneous(free);
   trace_connect_list_latency = xbt_dict_new_homogeneous(free);
 
-  surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_Stag_trace);
-  surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_Etag_trace);
-  surfxml_add_callback(STag_surfxml_trace_connect_cb_list,
-             &parse_Stag_trace_connect);
-
   /* Do the actual parsing */
   parse_status = surf_parse();