aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/typval_defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/eval/typval_defs.h')
-rw-r--r--src/nvim/eval/typval_defs.h109
1 files changed, 48 insertions, 61 deletions
diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h
index 4615198441..c6bd11ccdb 100644
--- a/src/nvim/eval/typval_defs.h
+++ b/src/nvim/eval/typval_defs.h
@@ -1,16 +1,15 @@
-#ifndef NVIM_EVAL_TYPVAL_DEFS_H
-#define NVIM_EVAL_TYPVAL_DEFS_H
+#pragma once
#include <inttypes.h>
#include <limits.h>
-#include "nvim/garray.h"
-#include "nvim/hashtab.h"
+#include "nvim/garray_defs.h"
+#include "nvim/hashtab_defs.h"
#include "nvim/lib/queue.h"
-#include "nvim/pos.h"
-#include "nvim/types.h"
+#include "nvim/pos_defs.h"
+#include "nvim/types_defs.h"
-/// Type used for VimL VAR_NUMBER values
+/// Type used for Vimscript VAR_NUMBER values
typedef int64_t varnumber_T;
typedef uint64_t uvarnumber_T;
@@ -100,7 +99,7 @@ typedef enum {
VAR_FIXED = 2, ///< Locked forever.
} VarLockStatus;
-/// VimL variable types, for use in typval_T.v_type
+/// Vimscript variable types, for use in typval_T.v_type
typedef enum {
VAR_UNKNOWN = 0, ///< Unknown (unspecified) value.
VAR_NUMBER, ///< Number, .v_number is used.
@@ -115,6 +114,19 @@ typedef enum {
VAR_BLOB, ///< Blob, .v_blob is used.
} VarType;
+/// Type values for type().
+enum {
+ VAR_TYPE_NUMBER = 0,
+ VAR_TYPE_STRING = 1,
+ VAR_TYPE_FUNC = 2,
+ VAR_TYPE_LIST = 3,
+ VAR_TYPE_DICT = 4,
+ VAR_TYPE_FLOAT = 5,
+ VAR_TYPE_BOOL = 6,
+ VAR_TYPE_SPECIAL = 7,
+ VAR_TYPE_BLOB = 10,
+};
+
/// Structure that holds an internal variable value
typedef struct {
VarType v_type; ///< Variable type.
@@ -206,7 +218,7 @@ typedef struct {
struct { \
typval_T di_tv; /* Structure that holds scope dictionary itself. */ \
uint8_t di_flags; /* Flags. */ \
- char_u di_key[__VA_ARGS__]; /* Key value. */ /* NOLINT(runtime/arrays)*/ \
+ char di_key[__VA_ARGS__]; /* Key value. */ /* NOLINT(runtime/arrays)*/ \
}
/// Structure to hold a scope dictionary
@@ -273,6 +285,12 @@ typedef struct {
linenr_T sc_lnum; ///< line number
} sctx_T;
+/// Stores an identifier of a script or channel that last set an option.
+typedef struct {
+ sctx_T script_ctx; /// script context where the option was last set
+ uint64_t channel_id; /// Only used when script_id is SID_API_CLIENT.
+} LastSet;
+
/// Maximum number of function arguments
enum { MAX_FUNC_ARGS = 20, };
/// Short variable name length
@@ -284,27 +302,27 @@ enum { FIXVAR_CNT = 12, };
typedef struct funccall_S funccall_T;
struct funccall_S {
- ufunc_T *func; ///< Function being called.
- int linenr; ///< Next line to be executed.
- int returned; ///< ":return" used.
- /// Fixed variables for arguments.
- TV_DICTITEM_STRUCT(VAR_SHORT_LEN + 1) fixvar[FIXVAR_CNT];
- dict_T l_vars; ///< l: local function variables.
- ScopeDictDictItem l_vars_var; ///< Variable for l: scope.
- dict_T l_avars; ///< a: argument variables.
- ScopeDictDictItem l_avars_var; ///< Variable for a: scope.
- list_T l_varlist; ///< List for a:000.
- listitem_T l_listitems[MAX_FUNC_ARGS]; ///< List items for a:000.
- typval_T *rettv; ///< Return value.
- linenr_T breakpoint; ///< Next line with breakpoint or zero.
- int dbg_tick; ///< debug_tick when breakpoint was set.
- int level; ///< Top nesting level of executed function.
- proftime_T prof_child; ///< Time spent in a child.
- funccall_T *caller; ///< Calling function or NULL; or next funccal in
- ///< list pointed to by previous_funccal.
- int fc_refcount; ///< Number of user functions that reference this funccall.
- int fc_copyID; ///< CopyID used for garbage collection.
- garray_T fc_funcs; ///< List of ufunc_T* which keep a reference to "func".
+ ufunc_T *fc_func; ///< Function being called.
+ int fc_linenr; ///< Next line to be executed.
+ int fc_returned; ///< ":return" used.
+ TV_DICTITEM_STRUCT(VAR_SHORT_LEN + 1) fc_fixvar[FIXVAR_CNT]; ///< Fixed variables for arguments.
+ dict_T fc_l_vars; ///< l: local function variables.
+ ScopeDictDictItem fc_l_vars_var; ///< Variable for l: scope.
+ dict_T fc_l_avars; ///< a: argument variables.
+ ScopeDictDictItem fc_l_avars_var; ///< Variable for a: scope.
+ list_T fc_l_varlist; ///< List for a:000.
+ listitem_T fc_l_listitems[MAX_FUNC_ARGS]; ///< List items for a:000.
+ typval_T *fc_rettv; ///< Return value.
+ linenr_T fc_breakpoint; ///< Next line with breakpoint or zero.
+ int fc_dbg_tick; ///< "debug_tick" when breakpoint was set.
+ int fc_level; ///< Top nesting level of executed function.
+ garray_T fc_defer; ///< Functions to be called on return.
+ proftime_T fc_prof_child; ///< Time spent in a child.
+ funccall_T *fc_caller; ///< Calling function or NULL; or next funccal in
+ ///< list pointed to by previous_funccal.
+ int fc_refcount; ///< Number of user functions that reference this funccall.
+ int fc_copyID; ///< CopyID used for garbage collection.
+ garray_T fc_ufuncs; ///< List of ufunc_T* which keep a reference to "fc_func".
};
/// Structure to hold info for a user function.
@@ -366,34 +384,3 @@ typedef struct list_stack_S {
list_T *list;
struct list_stack_S *prev;
} list_stack_T;
-
-/// Structure representing one list item, used for sort array.
-typedef struct {
- listitem_T *item; ///< Sorted list item.
- int idx; ///< Sorted list item index.
-} ListSortItem;
-
-typedef int (*ListSorter)(const void *, const void *);
-
-#ifdef LOG_LIST_ACTIONS
-/// List actions log entry
-typedef struct {
- uintptr_t l; ///< List log entry belongs to.
- uintptr_t li1; ///< First list item log entry belongs to, if applicable.
- uintptr_t li2; ///< Second list item log entry belongs to, if applicable.
- int len; ///< List length when log entry was created.
- const char *action; ///< Logged action.
-} ListLogEntry;
-
-typedef struct list_log ListLog;
-
-/// List actions log
-struct list_log {
- ListLog *next; ///< Next chunk or NULL.
- size_t capacity; ///< Number of entries in current chunk.
- size_t size; ///< Current chunk size.
- ListLogEntry entries[]; ///< Actual log entries.
-};
-#endif
-
-#endif // NVIM_EVAL_TYPVAL_DEFS_H