robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqfix(lua): don't override script ID from :source (#32626)e2aca58bcc

master
2.6 KiB72 linesraw
1#pragma once
2
3#include <stdbool.h>
4
5#include "nvim/autocmd_defs.h"
6
7typedef enum {
8  ETYPE_TOP,       ///< toplevel
9  ETYPE_SCRIPT,    ///< sourcing script, use es_info.sctx
10  ETYPE_UFUNC,     ///< user function, use es_info.ufunc
11  ETYPE_AUCMD,     ///< autocomand, use es_info.aucmd
12  ETYPE_MODELINE,  ///< modeline, use es_info.sctx
13  ETYPE_EXCEPT,    ///< exception, use es_info.exception
14  ETYPE_ARGS,      ///< command line argument
15  ETYPE_ENV,       ///< environment variable
16  ETYPE_INTERNAL,  ///< internal operation
17  ETYPE_SPELL,     ///< loading spell file
18} etype_T;
19
20/// Entry in the execution stack "exestack".
21typedef struct {
22  linenr_T es_lnum;     ///< replaces "sourcing_lnum"
23  char *es_name;        ///< replaces "sourcing_name"
24  etype_T es_type;
25  union {
26    sctx_T *sctx;       ///< script and modeline info
27    ufunc_T *ufunc;     ///< function info
28    AutoPatCmd *aucmd;  ///< autocommand info
29    except_T *except;   ///< exception info
30  } es_info;
31} estack_T;
32
33/// Argument for estack_sfile().
34typedef enum {
35  ESTACK_NONE,
36  ESTACK_SFILE,
37  ESTACK_STACK,
38  ESTACK_SCRIPT,
39} estack_arg_T;
40
41/// Holds the hashtab with variables local to each sourced script.
42/// Each item holds a variable (nameless) that points to the dict_T.
43typedef struct {
44  ScopeDictDictItem sv_var;
45  dict_T sv_dict;
46} scriptvar_T;
47
48typedef struct {
49  scriptvar_T *sn_vars;         ///< stores s: variables for this script
50
51  char *sn_name;
52  bool sn_lua;                  ///< true for a lua script
53  bool sn_prof_on;              ///< true when script is/was profiled
54  bool sn_pr_force;             ///< forceit: profile functions in this script
55  proftime_T sn_pr_child;       ///< time set when going into first child
56  int sn_pr_nest;               ///< nesting for sn_pr_child
57  // profiling the script as a whole
58  int sn_pr_count;              ///< nr of times sourced
59  proftime_T sn_pr_total;       ///< time spent in script + children
60  proftime_T sn_pr_self;        ///< time spent in script itself
61  proftime_T sn_pr_start;       ///< time at script start
62  proftime_T sn_pr_children;    ///< time in children after script start
63  // profiling the script per line
64  garray_T sn_prl_ga;           ///< things stored for every line
65  proftime_T sn_prl_start;      ///< start time for current line
66  proftime_T sn_prl_children;   ///< time spent in children for this line
67  proftime_T sn_prl_wait;       ///< wait start time for current line
68  linenr_T sn_prl_idx;          ///< index of line being timed; -1 if none
69  int sn_prl_execed;            ///< line being timed was executed
70} scriptitem_T;
71
72typedef bool (*DoInRuntimepathCB)(int, char **, bool, void *);