Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Correctly set callbacks for tags.
authornavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 21 Jan 2011 11:21:58 +0000 (11:21 +0000)
committernavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 21 Jan 2011 11:21:58 +0000 (11:21 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9470 48e7efb5-ca39-0410-a469-dd3cf9ba447f

15 files changed:
include/surf/surfxml_parse.h
src/bindings/ruby/simgrid_ruby.c
src/include/surf/surf.h
src/simdag/sd_global.c
src/simix/smx_deployment.c
src/simix/smx_environment.c
src/surf/cpu.c
src/surf/cpu_im.c
src/surf/cpu_ti.c
src/surf/surf_routing.c
src/surf/surfxml_parse.c
src/surf/workstation_ptask_L07.c
testsuite/surf/surf_usage.c
testsuite/surf/surf_usage2.c
tools/gras/stub_generator.c

index cd7be2c..5f3ae12 100644 (file)
 #include "xbt/function_types.h"
 #include "xbt/dict.h"
 
 #include "xbt/function_types.h"
 #include "xbt/dict.h"
 
+char * platform_filename;
+
 SG_BEGIN_DECL()
 
 /* Hook for the different tags. All the functions which pointer to are push into here are run when the tag is encountered */
 SG_BEGIN_DECL()
 
 /* Hook for the different tags. All the functions which pointer to are push into here are run when the tag is encountered */
-    XBT_PUBLIC_DATA(xbt_dynar_t) STag_surfxml_platform_cb_list;
+XBT_PUBLIC_DATA(xbt_dynar_t) STag_surfxml_platform_cb_list;
 XBT_PUBLIC_DATA(xbt_dynar_t) ETag_surfxml_platform_cb_list;
 XBT_PUBLIC_DATA(xbt_dynar_t) STag_surfxml_host_cb_list;
 XBT_PUBLIC_DATA(xbt_dynar_t) ETag_surfxml_host_cb_list;
 XBT_PUBLIC_DATA(xbt_dynar_t) ETag_surfxml_platform_cb_list;
 XBT_PUBLIC_DATA(xbt_dynar_t) STag_surfxml_host_cb_list;
 XBT_PUBLIC_DATA(xbt_dynar_t) ETag_surfxml_host_cb_list;
@@ -54,14 +56,14 @@ XBT_PUBLIC_DATA(xbt_dynar_t) ETag_surfxml_config_cb_list;
 
 XBT_PUBLIC(void) surf_parse_open(const char *file);
 XBT_PUBLIC(void) surf_parse_close(void);
 
 XBT_PUBLIC(void) surf_parse_open(const char *file);
 XBT_PUBLIC(void) surf_parse_close(void);
-XBT_PUBLIC(void) surf_parse_reset_parser(void);
 XBT_PUBLIC(int)  surf_parse_no_callbacks(void);
 XBT_PUBLIC(void) surf_parse_init_callbacks(void);
 XBT_PUBLIC(void) surf_parse_reset_callbacks(void);
 XBT_PUBLIC(void) surf_parse_free_callbacks(void);
 XBT_PUBLIC(void) surf_parse_get_double(double *value, const char *string);
 XBT_PUBLIC(void) surf_parse_get_int(int *value, const char *string);
 XBT_PUBLIC(int)  surf_parse_no_callbacks(void);
 XBT_PUBLIC(void) surf_parse_init_callbacks(void);
 XBT_PUBLIC(void) surf_parse_reset_callbacks(void);
 XBT_PUBLIC(void) surf_parse_free_callbacks(void);
 XBT_PUBLIC(void) surf_parse_get_double(double *value, const char *string);
 XBT_PUBLIC(void) surf_parse_get_int(int *value, const char *string);
-
+XBT_PUBLIC(void) surf_parse_add_callback_config(void);
+XBT_PUBLIC(void) surf_parse_models_setup(void);
 /* Prototypes of the functions offered by flex */
 XBT_PUBLIC(int) surf_parse_lex(void);
 XBT_PUBLIC(int) surf_parse_get_lineno(void);
 /* Prototypes of the functions offered by flex */
 XBT_PUBLIC(int) surf_parse_lex(void);
 XBT_PUBLIC(int) surf_parse_get_lineno(void);
@@ -76,7 +78,6 @@ XBT_PUBLIC(int) surf_parse_get_debug(void);
 XBT_PUBLIC(void) surf_parse_set_debug(int bdebug);
 XBT_PUBLIC(int) surf_parse_lex_destroy(void);
 
 XBT_PUBLIC(void) surf_parse_set_debug(int bdebug);
 XBT_PUBLIC(int) surf_parse_lex_destroy(void);
 
-
 /* What is needed to bypass the parser. */
 XBT_PUBLIC_DATA(int_f_void_t) surf_parse;       /* Entry-point to the parser. Set this to your function. */
 
 /* What is needed to bypass the parser. */
 XBT_PUBLIC_DATA(int_f_void_t) surf_parse;       /* Entry-point to the parser. Set this to your function. */
 
@@ -109,7 +110,7 @@ extern unsigned int surfxml_buffer_stack_stack[1024];
 
 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,
+XBT_PUBLIC(void) surfxml_del_callback(xbt_dynar_t cb_list,
                                       void_f_void_t function);
 
 SG_END_DECL()
                                       void_f_void_t function);
 
 SG_END_DECL()
index 6435003..6a4e096 100644 (file)
@@ -105,7 +105,7 @@ static void msg_deployApplication(VALUE class, VALUE deploymentFile)
     rb_raise(rb_eRuntimeError,
              "Bad Argument's Type for deployApplication ");
   const char *dep_file = RSTRING_PTR(deploymentFile);
     rb_raise(rb_eRuntimeError,
              "Bad Argument's Type for deployApplication ");
   const char *dep_file = RSTRING_PTR(deploymentFile);
-  surf_parse_reset_parser();
+  surf_parse_reset_callbacks();
   surfxml_add_callback(STag_surfxml_process_cb_list,
                        rb_application_handler_on_begin_process);
   surfxml_add_callback(ETag_surfxml_argument_cb_list,
   surfxml_add_callback(STag_surfxml_process_cb_list,
                        rb_application_handler_on_begin_process);
   surfxml_add_callback(ETag_surfxml_argument_cb_list,
index 00b33d3..af144b6 100644 (file)
@@ -620,7 +620,6 @@ XBT_PUBLIC(void) surf_init(int *argc, char **argv);     /* initialize common str
  * its code between, say, MSG_init and MSG_create_environment using MSG_config
  */
 XBT_PUBLIC(void) surf_config_models_setup(const char *platform_file);
  * its code between, say, MSG_init and MSG_create_environment using MSG_config
  */
 XBT_PUBLIC(void) surf_config_models_setup(const char *platform_file);
-XBT_PUBLIC(void) surf_config_add_callback(void);
 
 /** \brief create the elements of the models
  *
 
 /** \brief create the elements of the models
  *
index 1406696..344ec2a 100644 (file)
@@ -13,6 +13,7 @@
 #include "xbt/str.h"
 #include "xbt/config.h"
 #include "instr/instr_private.h"
 #include "xbt/str.h"
 #include "xbt/config.h"
 #include "instr/instr_private.h"
+#include "surf/surfxml_parse.h"
 #ifdef HAVE_LUA
 #include <lua.h>
 #include <lauxlib.h>
 #ifdef HAVE_LUA
 #include <lua.h>
 #include <lauxlib.h>
@@ -170,13 +171,13 @@ void SD_create_environment(const char *platform_file)
   void *surf_workstation = NULL;
   void *surf_link = NULL;
 
   void *surf_workstation = NULL;
   void *surf_link = NULL;
 
-  //First pass of platform file
-  surf_config_add_callback();
-  parse_platform_file(platform_file);
+  platform_filename = bprintf("%s",platform_file);
 
 
+  // Reset callbacks
+  surf_parse_reset_callbacks();
+  // Add config callbacks
+  surf_parse_add_callback_config();
   SD_CHECK_INIT_DONE();
   SD_CHECK_INIT_DONE();
-  DEBUG0("SD_create_environment");
-  surf_config_models_setup(platform_file);
   parse_platform_file(platform_file);
   surf_config_models_create_elms();
 
   parse_platform_file(platform_file);
   surf_config_models_create_elms();
 
index 15620bb..c3b977d 100644 (file)
@@ -111,7 +111,10 @@ void SIMIX_launch_application(const char *file)
   int parse_status;
   xbt_assert0(simix_global,
               "SIMIX_global_init has to be called before SIMIX_launch_application.");
   int parse_status;
   xbt_assert0(simix_global,
               "SIMIX_global_init has to be called before SIMIX_launch_application.");
-  surf_parse_reset_parser();
+
+  // Reset callbacks
+  surf_parse_reset_callbacks();
+
   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(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);
index 8f60fcc..6c46122 100644 (file)
@@ -9,6 +9,7 @@
 #include "xbt/log.h"
 #include "xbt/xbt_os_time.h"
 #include "xbt/config.h"
 #include "xbt/log.h"
 #include "xbt/xbt_os_time.h"
 #include "xbt/config.h"
+#include "surf/surfxml_parse.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_environment, simix,
                                 "Logging specific to SIMIX (environment)");
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_environment, simix,
                                 "Logging specific to SIMIX (environment)");
@@ -38,13 +39,16 @@ void SIMIX_create_environment(const char *file)
 
   double start, end;
 
 
   double start, end;
 
-  //First pass of platform file
-  surf_config_add_callback();
-  parse_platform_file(file);
+  platform_filename = bprintf("%s",file);
+
+  // Reset callbacks
+  surf_parse_reset_callbacks();
+  // Add config callbacks
+  surf_parse_add_callback_config();
 
 
-  surf_config_models_setup(file);
   parse_platform_file(file);
   surf_config_models_create_elms();
   parse_platform_file(file);
   surf_config_models_create_elms();
+
   start = xbt_os_time();
   /* FIXME: what time are we measuring ??? */
   end = xbt_os_time();
   start = xbt_os_time();
   /* FIXME: what time are we measuring ??? */
   end = xbt_os_time();
index b977e50..4e3916c 100644 (file)
@@ -139,7 +139,6 @@ static void add_traces_cpu(void)
 
 static void cpu_define_callbacks(const char *file)
 {
 
 static void cpu_define_callbacks(const char *file)
 {
-  surf_parse_reset_parser();
   surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces_cpu);
 }
   surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces_cpu);
 }
index fe34934..7af5acc 100644 (file)
@@ -156,8 +156,6 @@ static void cpu_im_add_traces_cpu(void)
 
 static void cpu_im_define_callbacks(const char *file)
 {
 
 static void cpu_im_define_callbacks(const char *file)
 {
-
-  surf_parse_reset_parser();
   surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_im_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list,
                        &cpu_im_add_traces_cpu);
   surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_im_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list,
                        &cpu_im_add_traces_cpu);
index 5408098..b1a06fd 100644 (file)
@@ -281,7 +281,6 @@ static void add_traces_cpu_ti(void)
 
 static void cpu_ti_define_callbacks(const char *file)
 {
 
 static void cpu_ti_define_callbacks(const char *file)
 {
-  surf_parse_reset_parser();
   surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_ti_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces_cpu_ti);
 }
   surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_ti_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces_cpu_ti);
 }
index c3f9e79..6881132 100644 (file)
@@ -18,6 +18,7 @@
 #include "xbt/config.h"
 #include "xbt/graph.h"
 #include "xbt/set.h"
 #include "xbt/config.h"
 #include "xbt/graph.h"
 #include "xbt/set.h"
+#include "surf/surfxml_parse.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf");
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf");
 
@@ -1108,12 +1109,19 @@ void routing_model_create(size_t size_of_links, void *loopback, double_f_cpvoid_
 #endif
 }
 
 #endif
 }
 
-void surf_config_add_callback(void)
+void surf_parse_add_callback_config(void)
 {
 {
-       surf_parse_reset_parser();
        surfxml_add_callback(STag_surfxml_config_cb_list, &routing_parse_Sconfig);
        surfxml_add_callback(ETag_surfxml_config_cb_list, &routing_parse_Econfig);
        surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
        surfxml_add_callback(STag_surfxml_config_cb_list, &routing_parse_Sconfig);
        surfxml_add_callback(ETag_surfxml_config_cb_list, &routing_parse_Econfig);
        surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
+       surfxml_add_callback(STag_surfxml_AS_cb_list, &surf_parse_models_setup);
+}
+
+void surf_parse_models_setup()
+{
+       surfxml_del_callback(STag_surfxml_AS_cb_list, surf_parse_models_setup);
+       surf_config_models_setup(platform_filename);
+       free(platform_filename);
 }
 
 /* ************************************************************************** */
 }
 
 /* ************************************************************************** */
index 463c9bb..28f70bf 100644 (file)
@@ -215,7 +215,7 @@ void surf_parse_init_callbacks(void)
                          xbt_dynar_new(sizeof(void_f_void_t), NULL);
 }
 
                          xbt_dynar_new(sizeof(void_f_void_t), NULL);
 }
 
-void surf_parse_reset_callbacks(void) // FIXME free + init
+void surf_parse_reset_callbacks(void)
 {
        surf_parse_free_callbacks();
        surf_parse_init_callbacks();
 {
        surf_parse_free_callbacks();
        surf_parse_init_callbacks();
@@ -261,67 +261,6 @@ void surf_parse_free_callbacks(void)
   xbt_dynar_free(&ETag_surfxml_config_cb_list);
 }
 
   xbt_dynar_free(&ETag_surfxml_config_cb_list);
 }
 
-void surf_parse_reset_parser(void)
-{
-  surf_parse_free_callbacks();
-  STag_surfxml_platform_cb_list =
-      xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  ETag_surfxml_platform_cb_list =
-      xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  STag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  ETag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  STag_surfxml_router_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  ETag_surfxml_router_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  STag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  ETag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  STag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  ETag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  STag_surfxml_link_ctn_cb_list =
-      xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  ETag_surfxml_link_ctn_cb_list =
-      xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  STag_surfxml_process_cb_list =
-      xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  ETag_surfxml_process_cb_list =
-      xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  STag_surfxml_argument_cb_list =
-      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);
-  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);
-  ETag_surfxml_AS_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  STag_surfxml_ASroute_cb_list =
-      xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  ETag_surfxml_ASroute_cb_list =
-      xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  STag_surfxml_bypassRoute_cb_list =
-      xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  ETag_surfxml_bypassRoute_cb_list =
-      xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  STag_surfxml_cluster_cb_list =
-      xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  ETag_surfxml_cluster_cb_list =
-      xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  STag_surfxml_peer_cb_list =
-      xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  ETag_surfxml_peer_cb_list =
-      xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  STag_surfxml_config_cb_list =
-                 xbt_dynar_new(sizeof(void_f_void_t), NULL);
-  ETag_surfxml_config_cb_list =
-                 xbt_dynar_new(sizeof(void_f_void_t), NULL);
-}
-
 /* Stag and Etag parse functions */
 
 void STag_surfxml_platform(void)
 /* Stag and Etag parse functions */
 
 void STag_surfxml_platform(void)
@@ -461,17 +400,23 @@ void surfxml_add_callback(xbt_dynar_t cb_list, void_f_void_t function)
   xbt_dynar_push(cb_list, &function);
 }
 
   xbt_dynar_push(cb_list, &function);
 }
 
-void surfxml_del_callback(xbt_dynar_t * p_cb_list, void_f_void_t function)
+void surfxml_del_callback(xbt_dynar_t 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_ex_t e;
+  unsigned int it=0;
+  void_f_void_t null_f=NULL;
+
+  TRY {
+    it = xbt_dynar_search(cb_list,&function);
+  } CATCH(e) {
+    if (e.category == not_found_error) {
+      xbt_ex_free(e);
+      xbt_die("Trying to remove a callback that is not here! This should not happen");
+    }
+    RETHROW;
   }
   }
-  xbt_dynar_free(p_cb_list);
-  *p_cb_list = new_cb_list;
+
+  xbt_dynar_replace(cb_list, it,&null_f);
 }
 
 static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t cb_list)
 }
 
 static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t cb_list)
@@ -479,7 +424,7 @@ static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t cb_list)
   unsigned int iterator;
   void_f_void_t fun;
   xbt_dynar_foreach(cb_list, iterator, fun) {
   unsigned int iterator;
   void_f_void_t fun;
   xbt_dynar_foreach(cb_list, iterator, fun) {
-    (*fun) ();
+    if (fun) (*fun) ();
   }
 }
 
   }
 }
 
@@ -499,15 +444,12 @@ static void init_data(void)
   trace_connect_list_latency = xbt_dict_new();
 
   surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
   trace_connect_list_latency = xbt_dict_new();
 
   surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
-  if(xbt_dynar_is_empty(STag_surfxml_config_cb_list))
-  {
-         surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness);
-         surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness);
-         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);
-  }
+  surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness);
+  surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness);
+  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);
 }
 
 static void free_data(void)
 }
 
 static void free_data(void)
index 2190295..7a9f6b5 100644 (file)
@@ -892,7 +892,6 @@ static void ptask_add_traces(void)
 static void ptask_define_callbacks(const char *file)
 {
   /* Adding callback functions */
 static void ptask_define_callbacks(const char *file)
 {
   /* Adding callback functions */
-  surf_parse_reset_parser();
   surfxml_add_callback(STag_surfxml_host_cb_list, &ptask_parse_cpu_init);
   surfxml_add_callback(STag_surfxml_link_cb_list, &ptask_parse_link_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &ptask_add_traces);
   surfxml_add_callback(STag_surfxml_host_cb_list, &ptask_parse_cpu_init);
   surfxml_add_callback(STag_surfxml_link_cb_list, &ptask_parse_link_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &ptask_add_traces);
index 0384a71..addd169 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <stdio.h>
 #include "surf/surf.h"
 
 #include <stdio.h>
 #include "surf/surf.h"
+#include "surf/surfxml_parse.h" // for reset callback
 
 #include "xbt/log.h"
 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,
 
 #include "xbt/log.h"
 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,
@@ -51,10 +52,9 @@ void test(char *platform)
   e_surf_action_state_t stateActionB;
   e_surf_action_state_t stateActionC;
   double now = -1.0;
   e_surf_action_state_t stateActionB;
   e_surf_action_state_t stateActionC;
   double now = -1.0;
-
+  surf_parse_reset_callbacks();
   surf_cpu_model_init_Cas01(platform);  /* Now it is possible to use CPUs */
   surf_network_model_init_CM02(platform);       /* Now it is possible to use eth0 */
   surf_cpu_model_init_Cas01(platform);  /* Now it is possible to use CPUs */
   surf_network_model_init_CM02(platform);       /* Now it is possible to use eth0 */
-
   parse_platform_file(platform);
 
   /*********************** CPU ***********************************/
   parse_platform_file(platform);
 
   /*********************** CPU ***********************************/
index a2baf5c..4c9e416 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <stdio.h>
 #include "surf/surf.h"
 
 #include <stdio.h>
 #include "surf/surf.h"
+#include "surf/surfxml_parse.h" // for reset callback
 
 #include "xbt/log.h"
 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,
 
 #include "xbt/log.h"
 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,
@@ -50,7 +51,7 @@ void test(char *platform)
 
   int workstation_id =
       find_model_description(surf_workstation_model_description, "CLM03");
 
   int workstation_id =
       find_model_description(surf_workstation_model_description, "CLM03");
-
+  surf_parse_reset_callbacks();
   surf_workstation_model_description[workstation_id].
       model_init_preparse(platform);
   parse_platform_file(platform);
   surf_workstation_model_description[workstation_id].
       model_init_preparse(platform);
   parse_platform_file(platform);
index 66c2596..123911a 100644 (file)
@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
 
   project_name = argv[1];
 
 
   project_name = argv[1];
 
-  surf_parse_reset_parser();
+  surf_parse_reset_callbacks();
   DEBUG2("%p %p", parse_process_init, &parse_process_init);
   surfxml_add_callback(STag_surfxml_process_cb_list, &parse_process_init);
   surfxml_add_callback(ETag_surfxml_argument_cb_list, &parse_argument);
   DEBUG2("%p %p", parse_process_init, &parse_process_init);
   surfxml_add_callback(STag_surfxml_process_cb_list, &parse_process_init);
   surfxml_add_callback(ETag_surfxml_argument_cb_list, &parse_argument);