Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright notices
[simgrid.git] / src / surf / surfxml_parseplatf.c
index 0a404f2..795615c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011. The SimGrid Team.
+/* Copyright (c) 2006-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@ int surfxml_bufferstack_size = 2048;
 
 static char *old_buff = NULL;
 
 
 static char *old_buff = NULL;
 
-XBT_PUBLIC(unsigned int) surfxml_buffer_stack_stack_ptr;
-XBT_PUBLIC(unsigned int) surfxml_buffer_stack_stack[1024];
+XBT_IMPORT_NO_EXPORT(unsigned int) surfxml_buffer_stack_stack_ptr;
+XBT_IMPORT_NO_EXPORT(unsigned int) surfxml_buffer_stack_stack[1024];
 
 
 void surfxml_bufferstack_push(int new)
 
 
 void surfxml_bufferstack_push(int new)
@@ -69,6 +69,22 @@ XBT_PUBLIC(void) gpu_register_callbacks(void){
 }
 /* ***************************************** */
 
 }
 /* ***************************************** */
 
+static int after_config_done;
+void parse_after_config() {
+  if (!after_config_done) {
+         TRACE_start();
+
+    /* Register classical callbacks */
+    storage_register_callbacks();
+    routing_register_callbacks();
+    gpu_register_callbacks();
+
+    /* ***************************************** */
+    /* TUTORIAL: New TAG                         */
+    /* ***************************************** */
+    after_config_done = 1;
+  }
+}
 
 /* This function acts as a main in the parsing area. */
 void parse_platform_file(const char *file)
 
 /* This function acts as a main in the parsing area. */
 void parse_platform_file(const char *file)
@@ -77,19 +93,10 @@ void parse_platform_file(const char *file)
 
   surf_parse_init_callbacks();
 
 
   surf_parse_init_callbacks();
 
-  /* Register classical callbacks */
-  storage_register_callbacks();
-  routing_register_callbacks();
-
-  /* ***************************************** */
-  /* TUTORIAL: New TAG                         */
-  gpu_register_callbacks();
-  /* ***************************************** */
-
   /* init the flex parser */
   surfxml_buffer_stack_stack_ptr = 1;
   surfxml_buffer_stack_stack[0] = 0;
   /* init the flex parser */
   surfxml_buffer_stack_stack_ptr = 1;
   surfxml_buffer_stack_stack[0] = 0;
-
+  after_config_done = 0;
   surf_parse_open(file);
 
   /* Init my data */
   surf_parse_open(file);
 
   /* Init my data */
@@ -119,6 +126,6 @@ void parse_platform_file(const char *file)
   /* Stop the flex parser */
   surf_parse_close();
   if (parse_status)
   /* Stop the flex parser */
   surf_parse_close();
   if (parse_status)
-    xbt_die("Parse error in %s", file);
+    surf_parse_error("Parse error in %s", file);
 }
 
 }