X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f734ec7475682eb90323e804cbcfddd7e4523992..2e60fe3cfd5cf5305888fcca0ae19700d808bb23:/src/bindings/lua/simgrid_lua.cpp diff --git a/src/bindings/lua/simgrid_lua.cpp b/src/bindings/lua/simgrid_lua.cpp index 1bca949d14..7a0f6f9be4 100644 --- a/src/bindings/lua/simgrid_lua.cpp +++ b/src/bindings/lua/simgrid_lua.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2017. The SimGrid Team. +/* Copyright (c) 2010-2020. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -9,57 +9,53 @@ #include "lua_private.hpp" #include "lua_utils.hpp" #include "src/surf/xml/platf.hpp" - +#include XBT_LOG_NEW_DEFAULT_CATEGORY(lua, "Lua Bindings"); -extern "C" { -#include - -int luaopen_simgrid(lua_State *L); -} +extern "C" int luaopen_simgrid(lua_State* L); /* ********************************************************************************* */ /* simgrid API */ /* ********************************************************************************* */ /** - * \brief Prints a log string with debug level. - * \param L a Lua state - * \return number of values returned to Lua + * @brief Prints a log string with debug level. + * @param L a Lua state + * @return number of values returned to Lua * * - Argument 1 (string): the text to print */ -static int debug(lua_State* L) { - +static int debug(lua_State* L) +{ const char* str = luaL_checkstring(L, 1); XBT_DEBUG("%s", str); return 0; } /** - * \brief Prints a log string with info level. - * \param L a Lua state - * \return number of values returned to Lua + * @brief Prints a log string with info level. + * @param L a Lua state + * @return number of values returned to Lua * * - Argument 1 (string): the text to print */ -static int info(lua_State* L) { - +static int info(lua_State* L) +{ const char* str = luaL_checkstring(L, 1); XBT_INFO("%s", str); return 0; } -static int error(lua_State* L) { - +static int error(lua_State* L) +{ const char* str = luaL_checkstring(L, 1); XBT_ERROR("%s", str); return 0; } -static int critical(lua_State* L) { - +static int critical(lua_State* L) +{ const char* str = luaL_checkstring(L, 1); XBT_CRITICAL("%s", str); return 0; @@ -71,7 +67,8 @@ static int critical(lua_State* L) { * This function can be called from within lua via "simgrid.dump(table)". It will * then dump the table via XBT_DEBUG */ -static int dump(lua_State* L) { +static int dump(lua_State* L) +{ int argc = lua_gettop(L); for (int i = 1; i <= argc; i++) { @@ -112,8 +109,8 @@ static const luaL_Reg simgrid_functions[] = { /* ********************************************************************************* */ /** - * \brief Makes the core functions available to the Lua world. - * \param L a Lua world + * @brief Makes the core functions available to the Lua world. + * @param L a Lua world */ static void sglua_register_core_functions(lua_State *L) { @@ -124,12 +121,12 @@ static void sglua_register_core_functions(lua_State *L) } /** - * \brief Opens the simgrid Lua module. + * @brief Opens the simgrid Lua module. * * This function is called automatically by the Lua interpreter when some * Lua code requires the "simgrid" module. * - * \param L the Lua state + * @param L the Lua state */ int luaopen_simgrid(lua_State *L) {