0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.0114: info about sourced scripts is scattered

Problem:    Info about sourced scripts is scattered.
Solution:   Use scriptitem_T for info about a script, including s: variables.
            Drop ga_scripts.
This commit is contained in:
Bram Moolenaar
2020-01-12 17:42:55 +01:00
parent 9b24dfcb9f
commit 7ebcba61b2
5 changed files with 45 additions and 53 deletions

View File

@@ -74,6 +74,8 @@ typedef struct VimMenu vimmenu_T;
* function was defined, "sourcing_lnum" is the line number inside the
* function. When stored with a function, mapping, option, etc. "sc_lnum" is
* the line number in the script "sc_sid".
*
* sc_version is also here, for convenience.
*/
typedef struct {
scid_T sc_sid; // script ID
@@ -1565,14 +1567,29 @@ struct funccal_entry {
#define HIKEY2UF(p) ((ufunc_T *)((p) - offsetof(ufunc_T, uf_name)))
#define HI2UF(hi) HIKEY2UF((hi)->hi_key)
/*
* Holds the hashtab with variables local to each sourced script.
* Each item holds a variable (nameless) that points to the dict_T.
*/
typedef struct
{
dictitem_T sv_var;
dict_T sv_dict;
} scriptvar_T;
/*
* Growarray to store info about already sourced scripts.
* For Unix also store the dev/ino, so that we don't have to stat() each
* script when going through the list.
*/
typedef struct scriptitem_S
typedef struct
{
scriptvar_T *sn_vars; // stores s: variables for this script
char_u *sn_name;
int sn_version; // :scriptversion
# ifdef UNIX
int sn_dev_valid;
dev_t sn_dev;