Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use CATCH_ANONYMOUS whenever possible.
[simgrid.git] / src / simix / smx_deployment.c
index 5cb246b..5b34af3 100644 (file)
@@ -41,7 +41,7 @@ static void parse_process(sg_platf_process_cbarg_t process)
     arg->name = (char*)(process->argv)[0];
     arg->code = parse_code;
     arg->data = NULL;
-    arg->hostname = host->name;
+    arg->hostname = sg_host_name(host);
     arg->argc = process->argc;
     arg->argv = (char**)(process->argv);
     arg->kill_time = kill_time;
@@ -51,21 +51,21 @@ static void parse_process(sg_platf_process_cbarg_t process)
            arg->hostname, start_time);
     SIMIX_timer_set(start_time, &SIMIX_process_create_from_wrapper, arg);
   } else {                      // start_time <= SIMIX_get_clock()
-    XBT_DEBUG("Starting Process %s(%s) right now", process->argv[0], host->name);
+    XBT_DEBUG("Starting Process %s(%s) right now", process->argv[0], sg_host_name(host));
 
     if (simix_global->create_process_function)
       simix_global->create_process_function(&process_created,
                                             (char*)(process->argv)[0],
                                             parse_code,
                                             NULL,
-                                            host->name,
+                                            sg_host_name(host),
                                             kill_time,
                                             process->argc,
                                             (char**)(process->argv),
                                             current_property_set,
                                             auto_restart);
     else
-      simcall_process_create(&process_created, (char*)(process->argv)[0], parse_code, NULL, host->name, kill_time, process->argc,
+      simcall_process_create(&process_created, (char*)(process->argv)[0], parse_code, NULL, sg_host_name(host), kill_time, process->argc,
           (char**)process->argv, current_property_set,auto_restart);
 
     /* verify if process has been created (won't be the case if the host is currently dead, but that's fine) */
@@ -76,6 +76,11 @@ static void parse_process(sg_platf_process_cbarg_t process)
   current_property_set = NULL;
 }
 
+void SIMIX_init_application(void){
+  surf_parse_reset_callbacks();
+  sg_platf_process_add_cb(parse_process);
+}
+
 /**
  * \brief An application deployer.
  *
@@ -92,22 +97,19 @@ static void parse_process(sg_platf_process_cbarg_t process)
  */
 void SIMIX_launch_application(const char *file)
 {
-  xbt_ex_t e;
-
   _XBT_GNUC_UNUSED int parse_status;
   xbt_assert(simix_global,
               "SIMIX_global_init has to be called before SIMIX_launch_application.");
 
-  surf_parse_reset_callbacks();
-
-  sg_platf_process_add_cb(parse_process);
+  SIMIX_init_application();
 
   surf_parse_open(file);
   TRY {
     parse_status = surf_parse();
     surf_parse_close();
     xbt_assert(!parse_status, "Parse error at %s:%d", file,surf_parse_lineno);
-  } CATCH(e) {
+  }
+  CATCH_ANONYMOUS {
     XBT_ERROR("Unrecoverable error at %s:%d. The full exception stack follows, in case it helps you to diagnose the problem.",
         file, surf_parse_lineno);
     RETHROW;
@@ -181,7 +183,7 @@ void SIMIX_process_set_function(const char *process_host,
   smx_host_t host = SIMIX_host_get_by_name(process_host);
   if (!host)
     THROWF(arg_error, 0, "Host '%s' unknown", process_host);
-  process.host = host->name;
+  process.host = sg_host_name(host);
 
   process.argc = 1 + xbt_dynar_length(arguments);
   process.argv = (const char**)xbt_new(char *, process.argc + 1);