- STag_surfxml_platform_description_fun = nil_function;
- ETag_surfxml_platform_description_fun = nil_function;
- STag_surfxml_cpu_fun = nil_function;
- ETag_surfxml_cpu_fun = nil_function;
- STag_surfxml_network_link_fun = nil_function;
- ETag_surfxml_network_link_fun = nil_function;
- STag_surfxml_route_fun = nil_function;
- ETag_surfxml_route_fun = nil_function;
- STag_surfxml_route_element_fun = nil_function;
- ETag_surfxml_route_element_fun = nil_function;
- STag_surfxml_process_fun = nil_function;
- ETag_surfxml_process_fun = nil_function;
- STag_surfxml_argument_fun = nil_function;
- ETag_surfxml_argument_fun = nil_function;
-}
-
-void STag_surfxml_include(void)
-{
- xbt_dynar_push(surf_input_buffer_stack,&surf_input_buffer);
- xbt_dynar_push(surf_file_to_parse_stack,&surf_file_to_parse);
-
- surf_file_to_parse = surf_fopen(A_surfxml_include_file,"r");
- xbt_assert1((surf_file_to_parse), "Unable to open \"%s\"\n",
- A_surfxml_include_file);
- surf_input_buffer = surf_parse__create_buffer( surf_file_to_parse, 10);
+ double version = 0.0;
+
+ sscanf(A_surfxml_platform_version, "%lg", &version);
+
+ xbt_assert0((version >= 1.0), "******* BIG FAT WARNING *********\n "
+ "You're using an ancient XML file. "
+ "Since SimGrid 3.1, units are Bytes, Flops, and seconds "
+ "instead of MBytes, MFlops and seconds. "
+ "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.1 version. "
+ "Last, do not forget to also update your values for "
+ "the calls to MSG_task_create (if any).");
+ xbt_assert0((version >= 2.0), "******* BIG FAT WARNING *********\n "
+ "You're using an old XML file. "
+ "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.");
+
+ surfxml_call_cb_functions(STag_surfxml_platform_cb_list);
+
+}
+
+#define parse_method(type,name) \
+void type##Tag_surfxml_##name(void) \
+{ surfxml_call_cb_functions(type##Tag_surfxml_##name##_cb_list); }
+
+ parse_method(E,platform);
+parse_method(S,host); parse_method(E,host);
+parse_method(S,router); parse_method(E,router);
+parse_method(S,link); parse_method(E,link);
+parse_method(S,route); parse_method(E,route);
+parse_method(S,link_c_ctn); parse_method(E,link_c_ctn);
+parse_method(S,process); parse_method(E,process);
+parse_method(S,argument); parse_method(E,argument);
+parse_method(S,prop); parse_method(E,prop);
+parse_method(S,trace); parse_method(E,trace);
+parse_method(S,trace_c_connect); parse_method(E,trace_c_connect);
+parse_method(S,random); parse_method(E,random);
+parse_method(S,AS); parse_method(E,AS);
+parse_method(S,ASroute); parse_method(E,ASroute);
+parse_method(S,bypassRoute); parse_method(E,bypassRoute);
+parse_method(S,cluster); parse_method(E,cluster);
+
+/* Open and Close parse file */
+
+void surf_parse_open(const char *file)
+{
+ static int warned = 0; /* warn only once */
+ if (!file) {
+ 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;
+ }
+ surf_file_to_parse = surf_fopen(file, "r");
+ xbt_assert1((surf_file_to_parse), "Unable to open \"%s\"\n", file);
+ surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, 10);