Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Factor most callback definitions.
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 12 Jun 2008 08:36:20 +0000 (08:36 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 12 Jun 2008 08:36:20 +0000 (08:36 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5607 48e7efb5-ca39-0410-a469-dd3cf9ba447f

examples/msg/masterslave/masterslave_bypass.tesh
src/include/surf/surf.h
src/surf/cpu.c
src/surf/network.c
src/surf/network_constant.c
src/surf/network_gtnets.c
src/surf/surfxml_parse.c
src/surf/workstation_ptask_L07.c

index 92dba09..7a29520 100644 (file)
@@ -3,7 +3,7 @@ p Testing the bypassing of the flexml parser
 
 
 $ $SG_TEST_EXENV masterslave/masterslave_bypass
-> [0.000000] surf/surfxml_parse.c:409: [surf_parse/WARNING] Bypassing the XML parser since surf_parse_open received a NULL pointer. If it is not what you want, go fix your code.
+> [0.000000] surf/surfxml_parse.c:419: [surf_parse/WARNING] Bypassing the XML parser since surf_parse_open received a NULL pointer. If it is not what you want, go fix your code.
 > [host A:master:(1) 0.000000] [msg_test/INFO] Got 1 slave(s) :
 > [host A:master:(1) 0.000000] [msg_test/INFO]          host B
 > [host A:master:(1) 0.000000] [msg_test/INFO] Got 20 task to process :
index d5d78df..c6cac69 100644 (file)
@@ -578,7 +578,7 @@ XBT_PUBLIC(void) surf_exit(void);
 
 /* Prototypes of the functions that handle the properties */
 XBT_PUBLIC_DATA(xbt_dict_t) current_property_set; /* the prop set for the currently parsed element (also used in SIMIX) */
-void parse_properties(void);
+XBT_PUBLIC_DATA(void) parse_properties(void);
 
 /* surf parse file related (public because called from a test suite) */
 XBT_PUBLIC(void) parse_platform_file(const char* file);
@@ -586,16 +586,7 @@ XBT_PUBLIC(void) parse_platform_file(const char* file);
 /* Stores the sets */
 XBT_PUBLIC_DATA(xbt_dict_t) set_list;
 
-void parse_foreach(void);
-void parse_sets(void);
-void parse_route_multi_set_endpoints(void);
-void parse_route_multi_set_route(void);
-void parse_cluster(void);
-void parse_trace_init(void);
-void parse_trace_finalize(void);
-void parse_trace_c_connect(void);
-
-void manage_route(xbt_dict_t route_table, const char* route_name, int action, int isMultiRoute);
+XBT_PUBLIC_DATA(void) manage_route(xbt_dict_t route_table, const char* route_name, int action, int isMultiRoute);
 XBT_PUBLIC_DATA(int) route_action;
 
 /* This is used by all models when creating the routing table while parsing */
@@ -612,9 +603,8 @@ XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_bandwidth;
 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_latency;
 
 
-double get_cpu_power(const char* power);
-void init_randomness(void);
-void add_randomness(void);
+XBT_PUBLIC_DATA(double) get_cpu_power(const char* power);
+
 
 SG_END_DECL()
 
index d30a006..941b213 100644 (file)
@@ -125,9 +125,6 @@ static void define_callbacks(const char *file)
 {
   surf_parse_reset_parser();
   surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_init);
-  surfxml_add_callback(STag_surfxml_prop_cb_list, parse_properties);
-  surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness);
-  surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness);
 }
 
 static void *name_service(const char *name)
index 0495333..852da9a 100644 (file)
@@ -280,20 +280,11 @@ static void define_callbacks(const char *file)
   /* Figuring out the network links */
   surfxml_add_callback(STag_surfxml_host_cb_list, &count_hosts);
   surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
-  surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
   surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
   surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_route);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_loopback);
-  surfxml_add_callback(STag_surfxml_set_cb_list, &parse_sets);
-  surfxml_add_callback(STag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_endpoints);
-  surfxml_add_callback(ETag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_route);
-  surfxml_add_callback(STag_surfxml_foreach_cb_list, &parse_foreach);
-  surfxml_add_callback(STag_surfxml_cluster_cb_list, &parse_cluster);
-  surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_trace_init);
-  surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_trace_finalize);
-  surfxml_add_callback(STag_surfxml_trace_c_connect_cb_list, &parse_trace_c_connect);
 }
 
 static void *name_service(const char *name)
index 83cef7c..f98d480 100644 (file)
@@ -80,17 +80,8 @@ static void define_callbacks(const char *file)
 {
   /* Figuring out the network links */
   surfxml_add_callback(STag_surfxml_host_cb_list, &count_hosts);
-  surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
   surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
   surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
-  surfxml_add_callback(STag_surfxml_set_cb_list, &parse_sets);
-  surfxml_add_callback(STag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_endpoints);
-  surfxml_add_callback(ETag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_route);
-  surfxml_add_callback(STag_surfxml_foreach_cb_list, &parse_foreach);
-  surfxml_add_callback(STag_surfxml_cluster_cb_list, &parse_cluster);
-  surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_trace_init);
-  surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_trace_finalize);
-  surfxml_add_callback(STag_surfxml_trace_c_connect_cb_list, &parse_trace_c_connect);
 }
 
 static void *name_service(const char *name)
index d3c6d09..8804e19 100644 (file)
@@ -310,20 +310,12 @@ static void add_route()
 /* Main XML parsing */
 static void define_callbacks(const char *file)
 {
-  surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
   surfxml_add_callback(STag_surfxml_router_cb_list, &parse_route_set_routers);
   surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
   surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
   surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem);
 /* surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_onehop_route);*/
-  surfxml_add_callback(STag_surfxml_platform_cb_list, &init_data);
-  surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_route);
-  surfxml_add_callback(STag_surfxml_set_cb_list, &parse_sets);
-  surfxml_add_callback(STag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_endpoints);
-  surfxml_add_callback(ETag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_route);
-  surfxml_add_callback(STag_surfxml_foreach_cb_list, &parse_foreach);
-  surfxml_add_callback(STag_surfxml_cluster_cb_list, &parse_cluster);
 }
 
 static void *name_service(const char *name)
index c1dbedb..d8874a5 100644 (file)
@@ -96,6 +96,16 @@ FILE *surf_file_to_parse = NULL;
 
 static void convert_route_multi_to_routes(void);
 static void parse_route_elem(void);
+static void parse_foreach(void);
+static void parse_sets(void);
+static void parse_route_multi_set_endpoints(void);
+static void parse_route_multi_set_route(void);
+static void parse_cluster(void);
+static void parse_trace_init(void);
+static void parse_trace_finalize(void);
+static void parse_trace_c_connect(void);
+static void init_randomness(void);
+static void add_randomness(void);
 
 void surf_parse_free_callbacks(void)
 {
@@ -516,8 +526,19 @@ static void init_data(void)
   trace_connect_list_latency = xbt_dict_new();
 
   random_data_list = xbt_dict_new();
+  surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
   surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem);
   surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
+  surfxml_add_callback(STag_surfxml_set_cb_list, &parse_sets);
+  surfxml_add_callback(STag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_endpoints);
+  surfxml_add_callback(ETag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_route);
+  surfxml_add_callback(STag_surfxml_foreach_cb_list, &parse_foreach);
+  surfxml_add_callback(STag_surfxml_cluster_cb_list, &parse_cluster);
+  surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_trace_init);
+  surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_trace_finalize);
+  surfxml_add_callback(STag_surfxml_trace_c_connect_cb_list, &parse_trace_c_connect);
+  surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness);
+  surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness);
 }
 
 static void free_data(void) 
@@ -599,7 +620,7 @@ static void parse_restore_original_buffer(void)
 
 /* Functions for the sets and foreach tags */
 
-void parse_sets(void)
+static void parse_sets(void)
 {
   char *id, *suffix, *prefix, *radical;
   int start, end;
@@ -732,7 +753,7 @@ static void finalize_link_foreach(void)
   surfxml_bufferstack = old_buff;
 }
 
-void parse_foreach(void)
+static void parse_foreach(void)
 {
   /* save the host & link callbacks */
   main_STag_surfxml_host_cb_list = STag_surfxml_host_cb_list;
@@ -770,7 +791,7 @@ static void parse_route_elem(void)
   xbt_dynar_push(route_link_list, &val);
 }
 
-void parse_route_multi_set_endpoints(void)
+static void parse_route_multi_set_endpoints(void)
 {
   src_name = xbt_strdup(A_surfxml_route_c_multi_src); 
   dst_name = xbt_strdup(A_surfxml_route_c_multi_dst); 
@@ -793,7 +814,7 @@ static int contains(xbt_dynar_t list, const char* value)
 }
 
 /* 
-   This function is used to append or override the contents of an alread existing route in the case a new one with its name is found.
+   This function is used to append or override the contents of an already existing route in the case a new one with its name is found.
    The decision is based upon the value of action specified in the xml route:multi attribute action
  */
 void manage_route(xbt_dict_t routing_table, const char *route_name, int action, int isMultiRoute)
@@ -830,7 +851,7 @@ void manage_route(xbt_dict_t routing_table, const char *route_name, int action,
   }
 }
 
-void parse_route_multi_set_route(void)
+static void parse_route_multi_set_route(void)
 {
   char* route_name;
 
@@ -960,7 +981,7 @@ static void convert_route_multi_to_routes(void)
 
 /* Cluster tag functions */
 
-void parse_cluster(void)
+static void parse_cluster(void)
 {  
    static int AX_ptr = 0;
    static int surfxml_bufferstack_size = 2048;
@@ -1063,14 +1084,14 @@ static double trace_periodicity = -1.0;
 static char* trace_file = NULL;
 static char* trace_id;
 
-void parse_trace_init(void)
+static void parse_trace_init(void)
 {
    trace_id = strdup(A_surfxml_trace_id);
    trace_file = strdup(A_surfxml_trace_file);
    surf_parse_get_double(&trace_periodicity, A_surfxml_trace_periodicity);
 }
 
-void parse_trace_finalize(void)
+static void parse_trace_finalize(void)
 {
   tmgr_trace_t trace;
   if (!trace_file || strcmp(trace_file,"") != 0) {
@@ -1084,7 +1105,7 @@ void parse_trace_finalize(void)
   xbt_dict_set(traces_set_list, trace_id, (void *)trace, NULL);
 }
 
-void parse_trace_c_connect(void)
+static void parse_trace_c_connect(void)
 {
    xbt_assert2(xbt_dict_get_or_null(traces_set_list, A_surfxml_trace_c_connect_trace),
              "Cannot connect trace %s to %s: trace unknown", A_surfxml_trace_c_connect_trace,A_surfxml_trace_c_connect_element);
@@ -1138,7 +1159,7 @@ double get_cpu_power(const char *power)
 int random_min, random_max, random_mean, random_std_deviation, random_generator;
 char *random_id;
 
-void init_randomness(void)
+static void init_randomness(void)
 {
   random_id = A_surfxml_random_id;
   surf_parse_get_int(&random_min, A_surfxml_random_min);
@@ -1148,7 +1169,7 @@ void init_randomness(void)
   random_generator = A_surfxml_random_generator;
 }
 
-void add_randomness(void)
+static void add_randomness(void)
 {
    /* If needed aditional properties can be added by using the prop tag */
   random_data_t random = random_new(random_generator, 0, random_min, random_max, random_mean, random_std_deviation);
index 147d12a..34468c7 100644 (file)
@@ -1030,23 +1030,12 @@ static void define_callbacks(const char *file)
   /* Adding callback functions */
   surf_parse_reset_parser();
   surfxml_add_callback(STag_surfxml_host_cb_list, &parse_cpu_init);
-  surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
   surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
   surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
   surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_route);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_loopback);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces);
-  surfxml_add_callback(STag_surfxml_set_cb_list, &parse_sets);
-  surfxml_add_callback(STag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_endpoints);
-  surfxml_add_callback(ETag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_route);
-  surfxml_add_callback(STag_surfxml_foreach_cb_list, &parse_foreach);
-  surfxml_add_callback(STag_surfxml_cluster_cb_list, &parse_cluster);
-  surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_trace_init);
-  surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_trace_finalize);
-  surfxml_add_callback(STag_surfxml_trace_c_connect_cb_list, &parse_trace_c_connect);
-  surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness);
-  surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness);
 }