From d510bfbc8e447b1a60d5ec7faaa8f440eb4ef56f Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 2 Apr 2023 10:11:42 +0200 Subject: refactor: remove char_u (#22829) Closes https://github.com/neovim/neovim/issues/459 --- src/nvim/eval/typval_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/eval/typval_defs.h') diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index 4615198441..80432271b0 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -206,7 +206,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 -- cgit From b75634e55ee4cdfee7917b29f39e3ca1307cb059 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 16 Apr 2023 07:50:18 +0800 Subject: vim-patch:9.0.0370: cleaning up afterwards can make a function messy Problem: Cleaning up afterwards can make a function messy. Solution: Add the :defer command. https://github.com/vim/vim/commit/1d84f7608f1e41dad03b8cc7925895437775f7c0 Omit EX_EXPR_ARG: Vim9 script only. Make :def throw E319 to avoid confusing behavior. Co-authored-by: Bram Moolenaar --- src/nvim/eval/typval_defs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/eval/typval_defs.h') diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index 80432271b0..517e59f3c2 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -299,6 +299,7 @@ struct funccall_S { 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. + garray_T fc_defer; ///< Functions to be called on return. 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. -- cgit From 42e55ba009ecc14afa1b519c8de02cb30c0d1671 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 16 Apr 2023 16:57:25 +0800 Subject: vim-patch:9.0.0398: members of funccall_T are inconsistently named (#23123) Problem: Members of funccall_T are inconsistently named. Solution: Use the "fc_" prefix for all members. https://github.com/vim/vim/commit/ca16c60f337ed33d5dd66a6e90aaf95b619c5e47 Co-authored-by: Bram Moolenaar --- src/nvim/eval/typval_defs.h | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'src/nvim/eval/typval_defs.h') diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index 517e59f3c2..3e49417f6f 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -284,28 +284,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. - garray_T fc_defer; ///< Functions to be called on return. - 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. -- cgit From c48f94d1f30056272ed030ad3f4529055ac07853 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 28 May 2023 16:34:47 +0200 Subject: build: remove LOG_LIST_ACTIONS option and related code It has not been used for a long time and the likelihood of it still working is low. --- src/nvim/eval/typval_defs.h | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'src/nvim/eval/typval_defs.h') diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index 3e49417f6f..767603ac0e 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -375,25 +375,4 @@ typedef struct { 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 -- cgit From 2f17ef1fc4b96cf1106fd95ba090d34a2e4b977b Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 22 Jun 2023 04:09:14 -0700 Subject: fix(messages): use "Vimscript" instead of "VimL" #24111 followup to #24109 fix #16150 --- src/nvim/eval/typval_defs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/eval/typval_defs.h') diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index 767603ac0e..4099877539 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -10,7 +10,7 @@ #include "nvim/pos.h" #include "nvim/types.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 +100,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. -- cgit From dc6d0d2daf69e2fdadda81feb97906dbc962a239 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 30 Sep 2023 14:41:34 +0800 Subject: refactor: reorganize option header files (#25437) - Move vimoption_T to option.h - option_defs.h is for option-related types - option_vars.h corresponds to Vim's option.h - option_defs.h and option_vars.h don't include each other --- src/nvim/eval/typval_defs.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/nvim/eval/typval_defs.h') diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index 4099877539..d5e8cb0109 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -273,6 +273,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 @@ -367,12 +373,4 @@ typedef struct list_stack_S { 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 *); - #endif // NVIM_EVAL_TYPVAL_DEFS_H -- cgit From 09a17f91d0d362c6e58bfdbe3ccdeacffb0b44b9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 2 Oct 2023 10:45:33 +0800 Subject: refactor: move cmdline completion types to cmdexpand_defs.h (#25465) --- src/nvim/eval/typval_defs.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/nvim/eval/typval_defs.h') diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index d5e8cb0109..c0b5416a05 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -115,6 +115,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. -- cgit From 4f8941c1a5f1ef6caa410feeb52e343db22763ce Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 10 Nov 2023 12:23:42 +0100 Subject: refactor: replace manual header guards with #pragma once It is less error-prone than manually defining header guards. Pretty much all compilers support it even if it's not part of the C standard. --- src/nvim/eval/typval_defs.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/nvim/eval/typval_defs.h') diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index c0b5416a05..996dac20bc 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -1,5 +1,4 @@ -#ifndef NVIM_EVAL_TYPVAL_DEFS_H -#define NVIM_EVAL_TYPVAL_DEFS_H +#pragma once #include #include @@ -385,5 +384,3 @@ typedef struct list_stack_S { list_T *list; struct list_stack_S *prev; } list_stack_T; - -#endif // NVIM_EVAL_TYPVAL_DEFS_H -- cgit From 6361806aa28edca55ad3316a58bc3e936df9c0eb Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 26 Nov 2023 22:58:52 +0800 Subject: refactor: move garray_T to garray_defs.h (#26227) --- src/nvim/eval/typval_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/eval/typval_defs.h') diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index 996dac20bc..3c539863f8 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -3,7 +3,7 @@ #include #include -#include "nvim/garray.h" +#include "nvim/garray_defs.h" #include "nvim/hashtab.h" #include "nvim/lib/queue.h" #include "nvim/pos.h" -- cgit From f4aedbae4cb1f206f5b7c6142697b71dd473059b Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 18:39:38 +0100 Subject: build(IWYU): fix includes for undo_defs.h --- src/nvim/eval/typval_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/eval/typval_defs.h') diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index 3c539863f8..98710d4c51 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -6,7 +6,7 @@ #include "nvim/garray_defs.h" #include "nvim/hashtab.h" #include "nvim/lib/queue.h" -#include "nvim/pos.h" +#include "nvim/pos_defs.h" #include "nvim/types.h" /// Type used for Vimscript VAR_NUMBER values -- cgit From 6c14ae6bfaf51415b555e9a6b85d1d280976358d Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 20:27:32 +0100 Subject: refactor: rename types.h to types_defs.h --- src/nvim/eval/typval_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/eval/typval_defs.h') diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index 98710d4c51..ea5d70bf19 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -7,7 +7,7 @@ #include "nvim/hashtab.h" #include "nvim/lib/queue.h" #include "nvim/pos_defs.h" -#include "nvim/types.h" +#include "nvim/types_defs.h" /// Type used for Vimscript VAR_NUMBER values typedef int64_t varnumber_T; -- cgit From 1a8f60c7d2699826b51f23b040b83b1d96a14930 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 28 Nov 2023 10:47:22 +0800 Subject: refactor: move hashtab types to hashtab_defs.h (#26262) --- src/nvim/eval/typval_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/eval/typval_defs.h') diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index ea5d70bf19..c6bd11ccdb 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -4,7 +4,7 @@ #include #include "nvim/garray_defs.h" -#include "nvim/hashtab.h" +#include "nvim/hashtab_defs.h" #include "nvim/lib/queue.h" #include "nvim/pos_defs.h" #include "nvim/types_defs.h" -- cgit