X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f06041cf2c450457a0b47a49b66b19cb9133c18e..90603961312ebafdfa7b490bc720baed0a69f76c:/src/bindings/lua/lua_private.h diff --git a/src/bindings/lua/lua_private.h b/src/bindings/lua/lua_private.h index ab9cf56b05..0010302204 100644 --- a/src/bindings/lua/lua_private.h +++ b/src/bindings/lua/lua_private.h @@ -1,28 +1,32 @@ -/* Copyright (c) 2010, 2012-2014. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2010-2015. 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. */ /* SimGrid Lua bindings */ -#include "simgrid_lua.h" -#include "simgrid/msg.h" +#ifndef LUA_PRIVATE_H +#define LUA_PRIVATE_H -void sglua_register_task_functions(lua_State* L); -msg_task_t sglua_check_task(lua_State* L, int index); -void sglua_task_register(lua_State* L); -void sglua_task_unregister(lua_State* L, msg_task_t task); +#include "simgrid/msg.h" +#include "simgrid_lua.h" -void sglua_register_comm_functions(lua_State* L); -msg_comm_t sglua_check_comm(lua_State* L, int index); -void sglua_push_comm(lua_State* L, msg_comm_t comm); +extern "C" { void sglua_register_host_functions(lua_State* L); msg_host_t sglua_check_host(lua_State* L, int index); -void sglua_register_process_functions(lua_State* L); - void sglua_register_platf_functions(lua_State* L); const char* sglua_get_msg_error(msg_error_t err); + +} + +#define lua_ensure(...) \ + _XBT_IF_ONE_ARG(_lua_ensure_ARG1, _lua_ensure_ARGN, __VA_ARGS__)(__VA_ARGS__) +#define _lua_ensure_ARG1(cond) \ + _lua_ensure_ARGN(cond, "Assertion %s failed", #cond) +#define _lua_ensure_ARGN(cond, ...) \ + do { if (!(cond)) { luaL_error(L, __VA_ARGS__); return -1;} } while (0) + +#endif