X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/14f459baf40f29906d54d3bd5774cda34aeadd76..7ac777931e588a2a48708ac16caeb50973f2cdf9:/src/bindings/lua/lua_private.h diff --git a/src/bindings/lua/lua_private.h b/src/bindings/lua/lua_private.h index 63472f0013..0010302204 100644 --- a/src/bindings/lua/lua_private.h +++ b/src/bindings/lua/lua_private.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2010, 2012-2015. 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. */ @@ -23,4 +22,11 @@ const char* sglua_get_msg_error(msg_error_t err); } -#endif /* LUA_PRIVATE_H */ +#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