diff options
author | TJ DeVries <devries.timothyj@gmail.com> | 2020-07-11 17:40:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-11 17:40:31 -0400 |
commit | 1ca67a73c0ba680eb8328e68bea31f839855dd29 (patch) | |
tree | 6f770f564307cb8a31f6ead427114267fcba3953 /src/nvim/eval/typval.h | |
parent | a695da7d3fac19624d458e3f2980b4c0e55f50a4 (diff) | |
parent | 6360cf7ce87407bd8a519b9a17f45b2148291904 (diff) | |
download | rneovim-1ca67a73c0ba680eb8328e68bea31f839855dd29.tar.gz rneovim-1ca67a73c0ba680eb8328e68bea31f839855dd29.tar.bz2 rneovim-1ca67a73c0ba680eb8328e68bea31f839855dd29.zip |
Merge pull request #12507 from tjdevries/tjdevries/viml_lua_callbacks
[RFC] Allow passing lua functions and closures into vim functions.
Diffstat (limited to 'src/nvim/eval/typval.h')
-rw-r--r-- | src/nvim/eval/typval.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h index 343dd205ff..503a32a81e 100644 --- a/src/nvim/eval/typval.h +++ b/src/nvim/eval/typval.h @@ -180,6 +180,8 @@ struct listvar_S { int lv_idx; ///< Index of a cached item, used for optimising repeated l[idx]. int lv_copyID; ///< ID used by deepcopy(). VarLockStatus lv_lock; ///< Zero, VAR_LOCKED, VAR_FIXED. + + LuaRef lua_table_ref; }; // Static list with 10 items. Use tv_list_init_static10() to initialize. @@ -245,6 +247,8 @@ struct dictvar_S { dict_T *dv_used_next; ///< Next dictionary in used dictionaries list. dict_T *dv_used_prev; ///< Previous dictionary in used dictionaries list. QUEUE watchers; ///< Dictionary key watchers set by user code. + + LuaRef lua_table_ref; }; /// Type used for script ID @@ -271,6 +275,12 @@ typedef struct { /// Number of fixed variables used for arguments #define FIXVAR_CNT 12 +/// Callback interface for C function reference> +/// Used for managing functions that were registered with |register_cfunc| +typedef int (*cfunc_T)(int argcount, typval_T *argvars, typval_T *rettv, void *state); // NOLINT +/// Callback to clear cfunc_T and any associated state. +typedef void (*cfunc_free_T)(void *state); + // Structure to hold info for a function that is currently being executed. typedef struct funccall_S funccall_T; @@ -307,6 +317,10 @@ struct ufunc { garray_T uf_lines; ///< function lines int uf_profiling; ///< true when func is being profiled int uf_prof_initialized; + // Managing cfuncs + cfunc_T uf_cb; ///< C function extension callback + cfunc_free_T uf_cb_free; ///< C function extesion free callback + void *uf_cb_state; ///< State of C function extension. // Profiling the function as a whole. int uf_tm_count; ///< nr of calls proftime_T uf_tm_total; ///< time spent in function + children |