diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-07-27 22:56:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-27 22:56:05 +0200 |
commit | 8e6b0a73c91bb8650e21f56183c7fa83f6fb312f (patch) | |
tree | ac70d41d2179452b01fd618afeb6d0e39be26576 /src/nvim/context.h | |
parent | 0e23ee3cc77960f5348dfa6eeb56e97432019126 (diff) | |
parent | b6278bbf12dd4946095b76f47b7c2ace3f929245 (diff) | |
download | rneovim-8e6b0a73c91bb8650e21f56183c7fa83f6fb312f.tar.gz rneovim-8e6b0a73c91bb8650e21f56183c7fa83f6fb312f.tar.bz2 rneovim-8e6b0a73c91bb8650e21f56183c7fa83f6fb312f.zip |
Merge #10619 'API: context'
Diffstat (limited to 'src/nvim/context.h')
-rw-r--r-- | src/nvim/context.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/nvim/context.h b/src/nvim/context.h new file mode 100644 index 0000000000..328e12c6a6 --- /dev/null +++ b/src/nvim/context.h @@ -0,0 +1,46 @@ +#ifndef NVIM_CONTEXT_H +#define NVIM_CONTEXT_H + +#include <msgpack.h> +#include "nvim/api/private/defs.h" +#include "nvim/lib/kvec.h" + +typedef struct { + msgpack_sbuffer regs; ///< Registers. + msgpack_sbuffer jumps; ///< Jumplist. + msgpack_sbuffer buflist; ///< Buffer list. + msgpack_sbuffer gvars; ///< Global variables. + Array funcs; ///< Functions. +} Context; +typedef kvec_t(Context) ContextVec; + +#define MSGPACK_SBUFFER_INIT (msgpack_sbuffer) { \ + .size = 0, \ + .data = NULL, \ + .alloc = 0, \ +} + +#define CONTEXT_INIT (Context) { \ + .regs = MSGPACK_SBUFFER_INIT, \ + .jumps = MSGPACK_SBUFFER_INIT, \ + .buflist = MSGPACK_SBUFFER_INIT, \ + .gvars = MSGPACK_SBUFFER_INIT, \ + .funcs = ARRAY_DICT_INIT, \ +} + +typedef enum { + kCtxRegs = 1, ///< Registers + kCtxJumps = 2, ///< Jumplist + kCtxBuflist = 4, ///< Buffer list + kCtxGVars = 8, ///< Global variables + kCtxSFuncs = 16, ///< Script functions + kCtxFuncs = 32, ///< Functions +} ContextTypeFlags; + +extern int kCtxAll; + +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "context.h.generated.h" +#endif + +#endif // NVIM_CONTEXT_H |