Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics in lua platform creation
[simgrid.git] / src / bindings / lua / lua_private.h
1 /* Copyright (c) 2010, 2012-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 /* SimGrid Lua bindings                                                     */
8
9 #ifndef LUA_PRIVATE_H
10 #define LUA_PRIVATE_H
11
12 #include "simgrid/msg.h"
13 #include "simgrid_lua.h"
14
15 extern "C" {
16
17 void sglua_register_host_functions(lua_State* L);
18 msg_host_t sglua_check_host(lua_State* L, int index);
19
20 void sglua_register_platf_functions(lua_State* L);
21
22 const char* sglua_get_msg_error(msg_error_t err);
23
24 }
25
26 #define lua_ensure(...) \
27   _XBT_IF_ONE_ARG(_lua_ensure_ARG1, _lua_ensure_ARGN, __VA_ARGS__)(__VA_ARGS__)
28 #define _lua_ensure_ARG1(cond) \
29   _lua_ensure_ARGN(cond, "Assertion %s failed", #cond)
30 #define _lua_ensure_ARGN(cond, ...) \
31   do { if (!(cond)) { luaL_error(L, __VA_ARGS__); return -1;} } while (0)
32
33
34 #endif /* LUA_PRIVATE_H */