Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Adding a <route> tag.
[simgrid.git] / src / surf / surfxml_parse.c
index bb2021a..3136fdf 100644 (file)
@@ -23,20 +23,22 @@ void nil_function(void)
   return;
 }
 
-void_f_void_t STag_surfxml_platform_description_fun = nil_function;
-void_f_void_t ETag_surfxml_platform_description_fun = nil_function;
-void_f_void_t STag_surfxml_cpu_fun = nil_function;
-void_f_void_t ETag_surfxml_cpu_fun = nil_function;
-void_f_void_t STag_surfxml_network_link_fun = nil_function;
-void_f_void_t ETag_surfxml_network_link_fun = nil_function;
-void_f_void_t STag_surfxml_route_fun = nil_function;
-void_f_void_t ETag_surfxml_route_fun = nil_function;
-void_f_void_t STag_surfxml_route_element_fun = nil_function;
-void_f_void_t ETag_surfxml_route_element_fun = nil_function;
-void_f_void_t STag_surfxml_process_fun = nil_function;
-void_f_void_t ETag_surfxml_process_fun = nil_function;
-void_f_void_t STag_surfxml_argument_fun = nil_function;
-void_f_void_t ETag_surfxml_argument_fun = nil_function;
+void_f_void_t *STag_surfxml_platform_description_fun = nil_function;
+void_f_void_t *ETag_surfxml_platform_description_fun = nil_function;
+void_f_void_t *STag_surfxml_cpu_fun = nil_function;
+void_f_void_t *ETag_surfxml_cpu_fun = nil_function;
+void_f_void_t *STag_surfxml_router_fun = nil_function;
+void_f_void_t *ETag_surfxml_router_fun = nil_function;
+void_f_void_t *STag_surfxml_network_link_fun = nil_function;
+void_f_void_t *ETag_surfxml_network_link_fun = nil_function;
+void_f_void_t *STag_surfxml_route_fun = nil_function;
+void_f_void_t *ETag_surfxml_route_fun = nil_function;
+void_f_void_t *STag_surfxml_route_element_fun = nil_function;
+void_f_void_t *ETag_surfxml_route_element_fun = nil_function;
+void_f_void_t *STag_surfxml_process_fun = nil_function;
+void_f_void_t *ETag_surfxml_process_fun = nil_function;
+void_f_void_t *STag_surfxml_argument_fun = nil_function;
+void_f_void_t *ETag_surfxml_argument_fun = nil_function;
 
 YY_BUFFER_STATE surf_input_buffer;
 FILE *surf_file_to_parse;
@@ -47,6 +49,8 @@ void surf_parse_reset_parser(void)
   ETag_surfxml_platform_description_fun = nil_function;
   STag_surfxml_cpu_fun = nil_function;
   ETag_surfxml_cpu_fun = nil_function;
+  STag_surfxml_router_fun = nil_function;
+  ETag_surfxml_router_fun = nil_function;
   STag_surfxml_network_link_fun = nil_function;
   ETag_surfxml_network_link_fun = nil_function;
   STag_surfxml_route_fun = nil_function;
@@ -87,16 +91,17 @@ void STag_surfxml_platform_description(void)
 
   sscanf(A_surfxml_platform_description_version,"%lg",&version);
 
-  xbt_assert0((version>=1.1),"******* BIG FAT WARNING *********\n "
+  xbt_assert0((version>=1.0),"******* BIG FAT WARNING *********\n "
              "You're using an old XML file. "
-             "Since SimGrid 3.0.2, units are Bytes, Flops, and seconds "
+             "Since SimGrid 3.1, units are Bytes, Flops, and seconds "
              "instead of MBytes, MFlops and seconds. "
-             "A script to help you convert your old platform files "
+             "A script (surfxml_update.pl) to help you convert your old "
+             "platform files "
              "is available in the contrib/platform_generation directory "
              "of the simgrid repository. Please check also out the "
-             "SURF section of the ChangeLog for the 3.0.2 version. "
+             "SURF section of the ChangeLog for the 3.1 version. "
              "Last, do not forget to also update your values for "
-             "the calls to MSG_task_create.");
+             "the calls to MSG_task_create (if any).");
 
   STag_surfxml_platform_description_fun();
 }
@@ -116,6 +121,16 @@ void ETag_surfxml_cpu(void)
   ETag_surfxml_cpu_fun();
 }
 
+void STag_surfxml_router(void)
+{
+  STag_surfxml_router_fun();
+}
+
+void ETag_surfxml_router(void)
+{
+  ETag_surfxml_router_fun();
+}
+
 void STag_surfxml_network_link(void)
 {
   STag_surfxml_network_link_fun();
@@ -167,8 +182,12 @@ void ETag_surfxml_argument(void)
 }
 
 void  surf_parse_open(const char *file) {
+  static int warned = 0; /* warn only once */
   if(!file) {
-    WARN0("I hope you know what you're doing... you just gave me a NULL pointer!");
+    if (!warned) {
+      WARN0("Bypassing the XML parser since surf_parse_open received a NULL pointer. If it is not what you want, go fix your code.");
+      warned = 1;
+    }
     return;
   }
   if(!surf_input_buffer_stack) 
@@ -201,7 +220,7 @@ static int _surf_parse(void)
   return surf_parse_lex();
 }
 
-int_f_void_t surf_parse = _surf_parse;
+int_f_void_t *surf_parse = _surf_parse;
 
 void surf_parse_get_double(double *value,const char *string)
 {