diff options
Diffstat (limited to 'src/nvim/eval_defs.h')
-rw-r--r-- | src/nvim/eval_defs.h | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/nvim/eval_defs.h b/src/nvim/eval_defs.h index 8ffc0c98ce..f478d19ca1 100644 --- a/src/nvim/eval_defs.h +++ b/src/nvim/eval_defs.h @@ -15,6 +15,7 @@ typedef double float_T; typedef struct listvar_S list_T; typedef struct dictvar_S dict_T; +typedef struct partial_S partial_T; /// Special variable values typedef enum { @@ -35,12 +36,13 @@ typedef enum { VAR_UNKNOWN = 0, ///< Unknown (unspecified) value. VAR_NUMBER, ///< Number, .v_number is used. VAR_STRING, ///< String, .v_string is used. - VAR_FUNC, ///< Function referene, .v_string is used for function name. + VAR_FUNC, ///< Function reference, .v_string is used as function name. VAR_LIST, ///< List, .v_list is used. VAR_DICT, ///< Dictionary, .v_dict is used. VAR_FLOAT, ///< Floating-point value, .v_float is used. VAR_SPECIAL, ///< Special value (true, false, null), .v_special ///< is used. + VAR_PARTIAL, ///< Partial, .v_partial is used. } VarType; /// Structure that holds an internal variable value @@ -54,6 +56,7 @@ typedef struct { char_u *v_string; ///< String, for VAR_STRING and VAR_FUNC, can be NULL. list_T *v_list; ///< List for VAR_LIST, can be NULL. dict_T *v_dict; ///< Dictionary for VAR_DICT, can be NULL. + partial_T *v_partial; ///< Closure: function with args. } vval; ///< Actual value. } typval_T; @@ -114,6 +117,16 @@ struct dictitem_S { typedef struct dictitem_S dictitem_T; +/// A dictitem with a 16 character key (plus NUL) +struct dictitem16_S { + typval_T di_tv; ///< type and value of the variable + char_u di_flags; ///< flags (only used for variable) + char_u di_key[17]; ///< key +}; + +typedef struct dictitem16_S dictitem16_T; + + #define DI_FLAGS_RO 1 // "di_flags" value: read-only variable #define DI_FLAGS_RO_SBX 2 // "di_flags" value: read-only in the sandbox #define DI_FLAGS_FIX 4 // "di_flags" value: fixed: no :unlet or remove() @@ -134,6 +147,16 @@ struct dictvar_S { QUEUE watchers; ///< Dictionary key watchers set by user code. }; +struct partial_S { + int pt_refcount; ///< Reference count. + char_u *pt_name; ///< Function name. + bool pt_auto; ///< when true the partial was created for using + ///< dict.member in handle_subscript(). + int pt_argc; ///< Number of arguments. + typval_T *pt_argv; ///< Arguments in allocated array. + dict_T *pt_dict; ///< Dict for "self". +}; + // structure used for explicit stack while garbage collecting hash tables typedef struct ht_stack_S { hashtab_T *ht; @@ -155,7 +178,21 @@ typedef struct list_stack_S { /// Convert a hashitem key pointer to a dictitem pointer #define HIKEY2DI(p) ((dictitem_T *)(p - offsetof(dictitem_T, di_key))) +/// Convert a hashitem value pointer to a dictitem pointer +#define HIVAL2DI(p) \ + ((dictitem_T *)(((char *)p) - offsetof(dictitem_T, di_tv))) + /// Convert a hashitem pointer to a dictitem pointer #define HI2DI(hi) HIKEY2DI((hi)->hi_key) +/// Type of assert_* check being performed +typedef enum +{ + ASSERT_EQUAL, + ASSERT_NOTEQUAL, + ASSERT_MATCH, + ASSERT_NOTMATCH, + ASSERT_OTHER, +} assert_type_T; + #endif // NVIM_EVAL_DEFS_H |