Files
neovim/src/nvim/lua/executor.h
bfredl e2fdd53d8c refactor(map): avoid duplicated khash_t types for values
This reduces the total number of khash_t instantiations from 22 to 8.

Make the khash internal functions take the size of values as a runtime
parameter. This is abstracted with typesafe Map containers which
are still specialized for both key, value type.

Introduce `Set(key)` type for when there is no value.

Refactor shada.c to use Map/Set instead of khash directly.
This requires `map_ref` operation to be more flexible.
Return pointers to both key and value, plus an indicator for new_item.
As a bonus, `map_key` is now redundant.

Instead of Map(cstr_t, FileMarks), use a pointer map as the FileMarks struct is
humongous.

Make `event_strings` actually work like an intern pool instead of wtf it
was doing before.
2023-05-17 12:26:21 +02:00

50 lines
1.2 KiB
C

#ifndef NVIM_LUA_EXECUTOR_H
#define NVIM_LUA_EXECUTOR_H
#include <lauxlib.h>
#include <lua.h>
#include <stdbool.h>
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/assert.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/func_attr.h"
#include "nvim/lua/converter.h"
#include "nvim/macros.h"
#include "nvim/types.h"
#include "nvim/usercmd.h"
// Generated by msgpack-gen.lua
void nlua_add_api_functions(lua_State *lstate) REAL_FATTR_NONNULL_ALL;
typedef struct {
LuaRef nil_ref;
LuaRef empty_dict_ref;
int ref_count;
#if __has_feature(address_sanitizer)
PMap(int) ref_markers;
#endif
} nlua_ref_state_t;
#define NLUA_EXEC_STATIC(cstr, arg, err) nlua_exec(STATIC_CSTR_AS_STRING(cstr), arg, err)
#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)
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "lua/executor.h.generated.h"
#endif
EXTERN nlua_ref_state_t *nlua_global_refs INIT(= NULL);
EXTERN bool nlua_disable_preload INIT(= false);
#endif // NVIM_LUA_EXECUTOR_H