aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/runtime.h
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-14 05:18:21 +0800
committerGitHub <noreply@github.com>2022-08-14 05:18:21 +0800
commit8cd116729fe2a15d62cd10e5ba7d3dcf1f677337 (patch)
treec3697b80da96e6e1165742979deb121ca491b1d0 /src/nvim/runtime.h
parentc1cbe3fb3d2ec1dbcfdc14ee2d9a5e8049d494ae (diff)
parent1ca2247639424994890ef70ab34f2bffa23ddd9f (diff)
downloadrneovim-8cd116729fe2a15d62cd10e5ba7d3dcf1f677337.tar.gz
rneovim-8cd116729fe2a15d62cd10e5ba7d3dcf1f677337.tar.bz2
rneovim-8cd116729fe2a15d62cd10e5ba7d3dcf1f677337.zip
Merge pull request #19752 from zeertzjq/vim-8.2.0056
vim-patch:8.2.{0056,0061,0078,0097,0823}: execution stack
Diffstat (limited to 'src/nvim/runtime.h')
-rw-r--r--src/nvim/runtime.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/nvim/runtime.h b/src/nvim/runtime.h
index fb12029693..6f9f31c9c4 100644
--- a/src/nvim/runtime.h
+++ b/src/nvim/runtime.h
@@ -3,7 +3,44 @@
#include <stdbool.h>
+#include "nvim/autocmd.h"
+#include "nvim/eval/typval.h"
#include "nvim/ex_cmds_defs.h"
+#include "nvim/ex_eval_defs.h"
+
+typedef enum {
+ ETYPE_TOP, ///< toplevel
+ ETYPE_SCRIPT, ///< sourcing script, use es_info.sctx
+ ETYPE_UFUNC, ///< user function, use es_info.ufunc
+ ETYPE_AUCMD, ///< autocomand, use es_info.aucmd
+ ETYPE_MODELINE, ///< modeline, use es_info.sctx
+ ETYPE_EXCEPT, ///< exception, use es_info.exception
+ ETYPE_ARGS, ///< command line argument
+ ETYPE_ENV, ///< environment variable
+ ETYPE_INTERNAL, ///< internal operation
+ ETYPE_SPELL, ///< loading spell file
+} etype_T;
+
+/// Entry in the execution stack "exestack".
+typedef struct {
+ linenr_T es_lnum; ///< replaces "sourcing_lnum"
+ char *es_name; ///< replaces "sourcing_name"
+ etype_T es_type;
+ union {
+ sctx_T *sctx; ///< script and modeline info
+ ufunc_T *ufunc; ///< function info
+ AutoPatCmd *aucmd; ///< autocommand info
+ except_T *except; ///< exception info
+ } es_info;
+} estack_T;
+
+/// Stack of execution contexts. Each entry is an estack_T.
+/// Current context is at ga_len - 1.
+extern garray_T exestack;
+/// name of error message source
+#define SOURCING_NAME (((estack_T *)exestack.ga_data)[exestack.ga_len - 1].es_name)
+/// line number in the message source or zero
+#define SOURCING_LNUM (((estack_T *)exestack.ga_data)[exestack.ga_len - 1].es_lnum)
typedef struct scriptitem_S {
char_u *sn_name;