2023-11-10 12:23:42 +01:00
|
|
|
#pragma once
|
2016-03-04 21:55:28 +03:00
|
|
|
|
2019-05-29 10:05:00 +02:00
|
|
|
#include <lauxlib.h>
|
2016-03-04 21:55:28 +03:00
|
|
|
#include <lua.h>
|
2022-09-11 17:12:44 +02:00
|
|
|
#include <stdbool.h>
|
2016-03-04 21:55:28 +03:00
|
|
|
|
|
|
|
|
#include "nvim/api/private/defs.h"
|
2022-09-11 17:12:44 +02:00
|
|
|
#include "nvim/api/private/helpers.h"
|
2021-09-11 11:48:58 +09:00
|
|
|
#include "nvim/assert.h"
|
2023-10-02 10:45:33 +08:00
|
|
|
#include "nvim/cmdexpand_defs.h"
|
2023-05-13 10:40:53 +08:00
|
|
|
#include "nvim/eval/typval_defs.h"
|
2017-04-11 01:05:56 +03:00
|
|
|
#include "nvim/ex_cmds_defs.h"
|
2016-03-04 21:55:28 +03:00
|
|
|
#include "nvim/func_attr.h"
|
2020-06-19 00:23:30 -04:00
|
|
|
#include "nvim/lua/converter.h"
|
2022-09-11 17:12:44 +02:00
|
|
|
#include "nvim/macros.h"
|
2023-09-30 12:05:28 +08:00
|
|
|
#include "nvim/map.h"
|
2023-11-27 20:27:32 +01:00
|
|
|
#include "nvim/types_defs.h"
|
2022-08-06 17:14:37 +08:00
|
|
|
#include "nvim/usercmd.h"
|
2016-03-04 21:55:28 +03:00
|
|
|
|
|
|
|
|
// Generated by msgpack-gen.lua
|
|
|
|
|
void nlua_add_api_functions(lua_State *lstate) REAL_FATTR_NONNULL_ALL;
|
|
|
|
|
|
2021-12-25 14:38:26 +01:00
|
|
|
typedef struct {
|
|
|
|
|
LuaRef nil_ref;
|
|
|
|
|
LuaRef empty_dict_ref;
|
|
|
|
|
int ref_count;
|
|
|
|
|
#if __has_feature(address_sanitizer)
|
2023-05-14 18:45:56 +02:00
|
|
|
PMap(int) ref_markers;
|
2021-12-25 14:38:26 +01:00
|
|
|
#endif
|
|
|
|
|
} nlua_ref_state_t;
|
|
|
|
|
|
2022-07-25 10:16:33 +02:00
|
|
|
#define NLUA_EXEC_STATIC(cstr, arg, err) nlua_exec(STATIC_CSTR_AS_STRING(cstr), arg, err)
|
|
|
|
|
|
2020-09-21 10:37:28 +02:00
|
|
|
#define NLUA_CLEAR_REF(x) \
|
|
|
|
|
do { \
|
|
|
|
|
/* Take the address to avoid double evaluation. #1375 */ \
|
|
|
|
|
if ((x) != LUA_NOREF) { \
|
|
|
|
|
api_free_luaref(x); \
|
|
|
|
|
(x) = LUA_NOREF; \
|
|
|
|
|
} \
|
|
|
|
|
} while (0)
|
|
|
|
|
|
2016-03-04 21:55:28 +03:00
|
|
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
2017-04-11 01:09:36 +03:00
|
|
|
# include "lua/executor.h.generated.h"
|
2016-03-04 21:55:28 +03:00
|
|
|
#endif
|
2021-12-25 14:38:26 +01:00
|
|
|
|
2023-10-20 15:10:33 +02:00
|
|
|
EXTERN nlua_ref_state_t *nlua_global_refs INIT( = NULL);
|
|
|
|
|
EXTERN bool nlua_disable_preload INIT( = false);
|