lua_lsup.h 1023 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <lua.h>
  2. #include <lauxlib.h>
  3. #include "lsup_rdf.h"
  4. #ifndef _LUA_LSUP_H
  5. #define _LUA_LSUP_H
  6. /// Raise Lua error including LSUP error message on negative rc.
  7. #define LUA_PCHECK(exp, message) do {\
  8. if (UNLIKELY ((exp) < LSUP_OK)) \
  9. return luaL_error (L, "%s: %s", message, LSUP_strerror (exp)); \
  10. } while (0)
  11. #define LUA_NLCHECK(exp, ...) do {\
  12. if (UNLIKELY ((exp) == NULL)) return luaL_error (L, __VA_ARGS__); \
  13. } while (0)
  14. /// Enum (int) constants to be passed to the module.
  15. typedef struct l_enum_const {
  16. const char *k;
  17. const int v;
  18. } LEnumConst;
  19. /// String constants to be passed to the module.
  20. typedef struct l_string_const {
  21. const char *k;
  22. const char *v;
  23. } LStringConst;
  24. void push_int_const (lua_State *L, const LEnumConst *list);
  25. void push_string_const (lua_State *L, const LStringConst *list);
  26. /// Create new namespace map.
  27. int l_nsmap_new (lua_State *L);
  28. /// Allocate space for a term object.
  29. LSUP_Term **allocate_term (lua_State *L);
  30. #endif // _LUA_LSUP_H