1 #ifndef NVIM_LUA_EXECUTOR_H
2 #define NVIM_LUA_EXECUTOR_H
3 
4 #include <lauxlib.h>
5 #include <lua.h>
6 
7 #include "nvim/api/private/defs.h"
8 #include "nvim/eval/typval.h"
9 #include "nvim/ex_cmds_defs.h"
10 #include "nvim/func_attr.h"
11 #include "nvim/lua/converter.h"
12 
13 // Generated by msgpack-gen.lua
14 void nlua_add_api_functions(lua_State *lstate) REAL_FATTR_NONNULL_ALL;
15 
16 EXTERN LuaRef nlua_nil_ref INIT(= LUA_NOREF);
17 EXTERN LuaRef nlua_empty_dict_ref INIT(= LUA_NOREF);
18 
19 EXTERN int nlua_refcount INIT(= 0);
20 
21 #define set_api_error(s, err) \
22   do { \
23     Error *err_ = (err); \
24     err_->type = kErrorTypeException; \
25     err_->set = true; \
26     memcpy(&err_->msg[0], s, sizeof(s)); \
27   } while (0)
28 
29 #define NLUA_CLEAR_REF(x) \
30   do { \
31     /* Take the address to avoid double evaluation. #1375 */ \
32     if ((x) != LUA_NOREF) { \
33       api_free_luaref(x); \
34       (x) = LUA_NOREF; \
35     } \
36   } while (0)
37 
38 #ifdef INCLUDE_GENERATED_DECLARATIONS
39 # include "lua/executor.h.generated.h"
40 #endif
41 #endif  // NVIM_LUA_EXECUTOR_H
42