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