-/* Copyright (c) 2006-2018. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2006-2019. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This function acts as a main in the parsing area. */
void parse_platform_file(std::string file)
{
-#if SIMGRID_HAVE_LUA
const char* cfile = file.c_str();
int len = strlen(cfile);
int is_lua = len > 3 && file[len - 3] == 'l' && file[len - 2] == 'u' && file[len - 1] == 'a';
-#endif
sg_platf_init();
-#if SIMGRID_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) {
+#if SIMGRID_HAVE_LUA
lua_State* L = luaL_newstate();
luaL_openlibs(L);
}
lua_close(L);
return;
- }
+#else
+ XBT_WARN("This looks like a lua platform file, but your SimGrid was not compiled with lua. Loading it as XML.");
#endif
+ }
// Use XML parser