Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / bindings / lua / simgrid_lua.c
index 05e9584..8c44001 100644 (file)
@@ -158,6 +158,13 @@ static int msg_register_application(lua_State * L)
   return 0;
 }
 
+static int console_init_application(lua_State *L) {
+  MSG_function_register_default(run_lua_code);
+  SIMIX_init_application();
+  return 0;
+}
+
+
 static const luaL_Reg simgrid_functions[] = {
   {"create_environment", create_environment},
   {"launch_application", launch_application},
@@ -172,6 +179,7 @@ static const luaL_Reg simgrid_functions[] = {
   {"msg_register_platform", msg_register_platform},
   {"sd_register_platform", sd_register_platform},
   {"msg_register_application", msg_register_application},
+  {"init_application", console_init_application},
   {NULL, NULL}
 };
 
@@ -194,7 +202,7 @@ int luaopen_simgrid(lua_State *L)
   XBT_DEBUG("luaopen_simgrid *****");
 
   /* Get the command line arguments from the lua interpreter */
-  char **argv = malloc(sizeof(char *) * LUA_MAX_ARGS_COUNT);
+  char **argv = xbt_malloc(sizeof(char *) * LUA_MAX_ARGS_COUNT);
   int argc = 1;
   argv[0] = (char *) "/usr/bin/lua";    /* Lie on the argv[0] so that the stack dumping facilities find the right binary. FIXME: what if lua is not in that location? */