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.
diff --git a/src/structs.h b/src/structs.h
index ffd6734..7e1508e 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -74,6 +74,8 @@
* 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
@@ -1566,13 +1568,28 @@
#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;