patch 9.1.1232: Vim script is missing the tuple data type
Problem: Vim script is missing the tuple data type
Solution: Add support for the tuple data type
(Yegappan Lakshmanan)
closes: #16776
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/structs.h b/src/structs.h
index ce98bce..1a3abcb 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -73,6 +73,7 @@
typedef struct dictvar_S dict_T;
typedef struct partial_S partial_T;
typedef struct blobvar_S blob_T;
+typedef struct tuplevar_S tuple_T;
typedef struct window_S win_T;
typedef struct wininfo_S wininfo_T;
@@ -1511,7 +1512,8 @@
VAR_INSTR, // "v_instr" is used
VAR_CLASS, // "v_class" is used (also used for interface)
VAR_OBJECT, // "v_object" is used
- VAR_TYPEALIAS // "v_typealias" is used
+ VAR_TYPEALIAS, // "v_typealias" is used
+ VAR_TUPLE // "v_tuple" is used
} vartype_T;
// A type specification.
@@ -1679,6 +1681,7 @@
class_T *v_class; // class value (can be NULL)
object_T *v_object; // object value (can be NULL)
typealias_T *v_typealias; // user-defined type name
+ tuple_T *v_tuple; // tuple
} vval;
};
@@ -1818,6 +1821,21 @@
char bv_lock; // zero, VAR_LOCKED, VAR_FIXED
};
+/*
+ * Structure to hold info about a tuple.
+ */
+struct tuplevar_S
+{
+ garray_T tv_items; // tuple items
+ type_T *tv_type; // current type, allocated by alloc_type()
+ tuple_T *tv_copytuple; // copied tuple used by deepcopy()
+ tuple_T *tv_used_next; // next tuple in used tuples list
+ tuple_T *tv_used_prev; // previous tuple in used tuples list
+ int tv_refcount; // reference count
+ int tv_copyID; // ID used by deepcopy()
+ char tv_lock; // zero, VAR_LOCKED, VAR_FIXED
+};
+
typedef int (*cfunc_T)(int argcount, typval_T *argvars, typval_T *rettv, void *state);
typedef void (*cfunc_free_T)(void *state);
@@ -1846,6 +1864,8 @@
blob_T *fi_blob; // blob being used
char_u *fi_string; // copy of string being used
int fi_byte_idx; // byte index in fi_string
+ tuple_T *fi_tuple; // tuple being used
+ int fi_tuple_idx; // tuple index in fi_tuple
int fi_cs_flags; // cs_flags or'ed together
} forinfo_T;
@@ -2821,6 +2841,15 @@
} list_stack_T;
/*
+ * structure used for explicit stack while garbage collecting tuples
+ */
+typedef struct tuple_stack_S
+{
+ tuple_T *tuple;
+ struct tuple_stack_S *prev;
+} tuple_stack_T;
+
+/*
* Structure used for iterating over dictionary items.
* Initialize with dict_iterate_start().
*/
@@ -4692,6 +4721,7 @@
char_u *ll_newkey; // New key for Dict in alloc. mem or NULL.
type_T *ll_valtype; // type expected for the value or NULL
blob_T *ll_blob; // The Blob or NULL
+ tuple_T *ll_tuple; // tuple or NULL
ufunc_T *ll_ufunc; // The function or NULL
object_T *ll_object; // The object or NULL, class is not NULL
class_T *ll_class; // The class or NULL, object may be NULL