X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3b93278045da2926f2e0d4e75531b276f4599312..e9f0018b823e34405847177b25a85d3facc30ae1:/src/surf/surfxml_parseplatf.c diff --git a/src/surf/surfxml_parseplatf.c b/src/surf/surfxml_parseplatf.c index 9333659b38..9d5964e30a 100644 --- a/src/surf/surfxml_parseplatf.c +++ b/src/surf/surfxml_parseplatf.c @@ -10,13 +10,15 @@ #include "xbt/dict.h" #include "simgrid/platf.h" #include "surf/surfxml_parse.h" -#include "surf/surf_private.h" -#include "bindings/lua/simgrid_lua.h" -#include "bindings/lua/lua_state_cloner.h" +#include "src/surf/surf_private.h" + +#ifdef HAVE_LUA +#include "src/bindings/lua/simgrid_lua.h" #include /* Always include this when calling Lua */ #include /* Always include this when calling Lua */ #include /* Prototype for luaL_openlibs(), */ +#endif XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse); @@ -65,13 +67,6 @@ xbt_dict_t trace_connect_list_link_avail = NULL; xbt_dict_t trace_connect_list_bandwidth = NULL; xbt_dict_t trace_connect_list_latency = NULL; -/* ********************************************* */ -/* TUTORIAL: New TAG */ -/* This function should be in gpu.c */ -/* because sg_platf_gpu_add_cb take a staic fct */ -XBT_PUBLIC(void) gpu_register_callbacks(void){ - sg_platf_gpu_add_cb(NULL); -} /* ***************************************** */ static int after_config_done; @@ -82,11 +77,7 @@ void parse_after_config() { /* Register classical callbacks */ storage_register_callbacks(); routing_register_callbacks(); - gpu_register_callbacks(); - /* ***************************************** */ - /* TUTORIAL: New TAG */ - /* ***************************************** */ after_config_done = 1; } } @@ -94,32 +85,29 @@ void parse_after_config() { /* This function acts as a main in the parsing area. */ void parse_platform_file(const char *file) { +#ifdef HAVE_LUA int is_lua = (file != NULL && strlen(file) > 3 && file[strlen(file)-3] == 'l' && file[strlen(file)-2] == 'u' && file[strlen(file)-1] == 'a'); +#endif surf_parse_init_callbacks(); +#ifdef HAVE_LUA /* Check if file extension is "lua". If so, we will use * the lua bindings to parse the platform file (since it is * written in lua). If not, we will use the (old?) XML parser */ if (is_lua) { - // Get maestro state. In case we're calling Lua from - // C only, this will be NULL -- no Lua code has been - // executed yet and hence, the SimGrid module has not - // yet been loaded. // NOTE: After executing the lua_pcall() below, // sglua_get_maestro() will not be NULL, since the // SimGrid module was loaded! - lua_State* L = sglua_get_maestro(); + // C. Heinrich 01/2016: Not sure if this is still required after I + // ripped out most of that bloody Lua simulation stuff. We may + // want to check and maybe we can clean that up. + lua_State* L; - // We may want to remove the task_copy_callback from - // the SimGrid module if we're using C code only (this - // callback is used for Lua-only code). - int remove_callback = FALSE; if (L == NULL) { L = luaL_newstate(); - remove_callback = TRUE; } luaL_openlibs(L); @@ -130,16 +118,10 @@ void parse_platform_file(const char *file) XBT_ERROR("FATAL ERROR:\n %s: %s\n\n", "Lua call failed. Errormessage:", lua_tostring(L, -1)); xbt_die("Lua call failed. See Log"); } - // Without this, task_copy_callback() will try to copy - // some tasks -- but these don't exist in case we're using - // C. Hence, we need to remove the callback -- we don't - // want to segfault. - if (remove_callback) { - MSG_task_set_copy_callback(NULL); - } - } - else { // Use XML parser + else +#endif + { // Use XML parser int parse_status;