typval.h
Go to the documentation of this file.
1 #ifndef NVIM_EVAL_TYPVAL_H
2 #define NVIM_EVAL_TYPVAL_H
3 
4 #include <inttypes.h>
5 #include <stddef.h>
6 #include <string.h>
7 #include <stdbool.h>
8 #include <assert.h>
9 
10 #include "nvim/types.h"
11 #include "nvim/hashtab.h"
12 #include "nvim/garray.h"
13 #include "nvim/mbyte.h"
14 #include "nvim/func_attr.h"
15 #include "nvim/lib/queue.h"
16 #include "nvim/profile.h" // for proftime_T
17 #include "nvim/pos.h" // for linenr_T
18 #include "nvim/gettext.h"
19 #include "nvim/message.h"
20 #include "nvim/macros.h"
21 #ifdef LOG_LIST_ACTIONS
22 # include "nvim/memory.h"
23 #endif
24 
26 typedef int64_t varnumber_T;
27 typedef uint64_t uvarnumber_T;
28 
30 typedef double float_T;
31 
33 enum { DO_NOT_FREE_CNT = (INT_MAX / 2) };
34 
52 };
53 
55 #define VARNUMBER_MAX INT64_MAX
56 #define UVARNUMBER_MAX UINT64_MAX
57 
59 #define VARNUMBER_MIN INT64_MIN
60 
62 #define PRIdVARNUMBER PRId64
63 
64 typedef struct listvar_S list_T;
65 typedef struct dictvar_S dict_T;
66 typedef struct partial_S partial_T;
67 
68 typedef struct ufunc ufunc_T;
69 
70 typedef enum {
74 } CallbackType;
75 
76 typedef struct {
77  union {
80  } data;
82 } Callback;
83 #define CALLBACK_NONE ((Callback){ .type = kCallbackNone })
84 
86 typedef struct dict_watcher {
88  char *key_pattern;
91  bool busy; // prevent recursion if the dict is changed in the callback
92 } DictWatcher;
93 
95 typedef enum {
98 } BoolVarValue;
99 
101 typedef enum {
104 
106 typedef enum {
109  VAR_FIXED = 2,
110 } VarLockStatus;
111 
113 typedef enum {
123  VAR_PARTIAL,
125 } VarType;
126 
128 typedef struct {
140  } vval;
141 } typval_T;
142 
144 typedef enum {
146  VAR_SCOPE = 1,
148 } ScopeType;
150 
152 typedef struct listitem_S listitem_T;
153 
154 struct listitem_S {
158 };
159 
161 typedef struct listwatch_S listwatch_T;
162 
163 struct listwatch_S {
166 };
167 
170 struct listvar_S {
179  int lv_len;
180  int lv_idx;
181  int lv_copyID;
183 
185 };
186 
187 // Static list with 10 items. Use tv_list_init_static10() to initialize.
188 typedef struct {
189  list_T sl_list; // must be first
190  listitem_T sl_items[10];
192 
193 #define TV_LIST_STATIC10_INIT { \
194  .sl_list = { \
195  .lv_first = NULL, \
196  .lv_last = NULL, \
197  .lv_refcount = 0, \
198  .lv_len = 0, \
199  .lv_watch = NULL, \
200  .lv_idx_item = NULL, \
201  .lv_lock = VAR_FIXED, \
202  .lv_used_next = NULL, \
203  .lv_used_prev = NULL, \
204  }, \
205  }
206 
207 #define TV_DICTITEM_STRUCT(...) \
208  struct { \
209  typval_T di_tv; /* Structure that holds scope dictionary itself. */ \
210  uint8_t di_flags; /* Flags. */ \
211  char_u di_key[__VA_ARGS__]; /* Key value. */ \
212  }
213 
220 typedef TV_DICTITEM_STRUCT(1) ScopeDictDictItem;
221 
228 
230 typedef enum {
236 } DictItemFlags;
237 
239 struct dictvar_S {
242  int dv_refcount;
244  int dv_copyID;
250 
252 };
253 
255 typedef int scid_T;
257 #define PRIdSCID "d"
258 
259 // SCript ConteXt (SCTX): identifies a script line.
260 // When sourcing a script "sc_lnum" is zero, "sourcing_lnum" is the current
261 // line number. When executing a user function "sc_lnum" is the line where the
262 // function was defined, "sourcing_lnum" is the line number inside the
263 // function. When stored with a function, mapping, option, etc. "sc_lnum" is
264 // the line number in the script "sc_sid".
265 typedef struct {
266  scid_T sc_sid; // script ID
267  int sc_seq; // sourcing sequence number
268  linenr_T sc_lnum; // line number
269 } sctx_T;
270 
272 #define MAX_FUNC_ARGS 20
273 #define VAR_SHORT_LEN 20
275 #define FIXVAR_CNT 12
277 
280 typedef int (*cfunc_T)(int argcount, typval_T *argvars, typval_T *rettv, void *state); // NOLINT
282 typedef void (*cfunc_free_T)(void *state);
283 
284 // Structure to hold info for a function that is currently being executed.
285 typedef struct funccall_S funccall_T;
286 
287 struct funccall_S {
289  int linenr;
290  int returned;
293  dict_T l_vars;
294  ScopeDictDictItem l_vars_var;
295  dict_T l_avars;
296  ScopeDictDictItem l_avars_var;
297  list_T l_varlist;
298  listitem_T l_listitems[MAX_FUNC_ARGS];
301  int dbg_tick;
302  int level;
303  proftime_T prof_child;
306  int fc_copyID;
307  garray_T fc_funcs;
308 };
309 
311 struct ufunc {
313  int uf_flags;
314  int uf_calls;
315  bool uf_cleared;
320  // Managing cfuncs
323  void *uf_cb_state;
324  // Profiling the function as a whole.
329  // Profiling the function per line.
339  int uf_refcount;
343 };
345 
346 struct partial_S {
350  bool pt_auto;
352  int pt_argc;
356 };
357 
359 typedef struct ht_stack_S {
361  struct ht_stack_S *prev;
362 } ht_stack_T;
363 
365 typedef struct list_stack_S {
368 } list_stack_T;
369 
371 typedef struct {
373  int idx;
374 } ListSortItem;
375 
376 typedef int (*ListSorter)(const void *, const void *);
377 
378 #ifdef LOG_LIST_ACTIONS
379 
381 typedef struct {
382  uintptr_t l;
383  uintptr_t li1;
384  uintptr_t li2;
385  int len;
386  const char *action;
387 } ListLogEntry;
388 
389 typedef struct list_log ListLog;
390 
392 struct list_log {
393  ListLog *next;
394  size_t capacity;
395  size_t size;
396  ListLogEntry entries[];
397 };
398 
399 extern ListLog *list_log_first;
400 extern ListLog *list_log_last;
401 
402 static inline ListLog *list_log_alloc(const size_t size)
404 
410 static inline ListLog *list_log_new(const size_t size)
411 {
412  ListLog *ret = xmalloc(offsetof(ListLog, entries)
413  + size * sizeof(ret->entries[0]));
414  ret->size = 0;
415  ret->capacity = size;
416  ret->next = NULL;
417  if (list_log_first == NULL) {
418  list_log_first = ret;
419  } else {
420  list_log_last->next = ret;
421  }
422  list_log_last = ret;
423  return ret;
424 }
425 
426 static inline void list_log(const list_T *const l,
427  const listitem_T *const li1,
428  const listitem_T *const li2,
429  const char *const action)
431 
441 static inline void list_log(const list_T *const l,
442  const listitem_T *const li1,
443  const listitem_T *const li2,
444  const char *const action)
445 {
446  ListLog *tgt;
447  if (list_log_first == NULL) {
448  tgt = list_log_new(128);
449  } else if (list_log_last->size == list_log_last->capacity) {
450  tgt = list_log_new(list_log_last->capacity * 2);
451  } else {
452  tgt = list_log_last;
453  }
454  tgt->entries[tgt->size++] = (ListLogEntry) {
455  .l = (uintptr_t)l,
456  .li1 = (uintptr_t)li1,
457  .li2 = (uintptr_t)li2,
458  .len = (l == NULL ? 0 : l->lv_len),
459  .action = action,
460  };
461 }
462 #else
463 # define list_log(...)
464 # define list_write_log(...)
465 # define list_free_log()
466 #endif
467 
468 // In a hashtab item "hi_key" points to "di_key" in a dictitem.
469 // This avoids adding a pointer to the hashtab item.
470 
472 #define TV_DICT_HI2DI(hi) \
473  ((dictitem_T *)((hi)->hi_key - offsetof(dictitem_T, di_key)))
474 
475 static inline void tv_list_ref(list_T *const l)
477 
483 static inline void tv_list_ref(list_T *const l)
484 {
485  if (l == NULL) {
486  return;
487  }
488  l->lv_refcount++;
489 }
490 
491 static inline void tv_list_set_ret(typval_T *const tv, list_T *const l)
492  REAL_FATTR_ALWAYS_INLINE REAL_FATTR_NONNULL_ARG(1);
493 
498 static inline void tv_list_set_ret(typval_T *const tv, list_T *const l)
499 {
500  tv->v_type = VAR_LIST;
501  tv->vval.v_list = l;
502  tv_list_ref(l);
503 }
504 
505 static inline VarLockStatus tv_list_locked(const list_T *const l)
507 
513 static inline VarLockStatus tv_list_locked(const list_T *const l)
514 {
515  if (l == NULL) {
516  return VAR_FIXED;
517  }
518  return l->lv_lock;
519 }
520 
527 static inline void tv_list_set_lock(list_T *const l,
528  const VarLockStatus lock)
529 {
530  if (l == NULL) {
531  assert(lock == VAR_FIXED);
532  return;
533  }
534  l->lv_lock = lock;
535 }
536 
543 static inline void tv_list_set_copyid(list_T *const l,
544  const int copyid)
546 {
547  l->lv_copyID = copyid;
548 }
549 
550 static inline int tv_list_len(const list_T *const l)
552 
556 static inline int tv_list_len(const list_T *const l)
557 {
558  list_log(l, NULL, NULL, "len");
559  if (l == NULL) {
560  return 0;
561  }
562  return l->lv_len;
563 }
564 
565 static inline int tv_list_copyid(const list_T *const l)
566  REAL_FATTR_PURE REAL_FATTR_WARN_UNUSED_RESULT REAL_FATTR_NONNULL_ALL;
567 
573 static inline int tv_list_copyid(const list_T *const l)
574 {
575  return l->lv_copyID;
576 }
577 
578 static inline list_T *tv_list_latest_copy(const list_T *const l)
579  REAL_FATTR_PURE REAL_FATTR_WARN_UNUSED_RESULT REAL_FATTR_NONNULL_ALL;
580 
588 static inline list_T *tv_list_latest_copy(const list_T *const l)
589 {
590  return l->lv_copylist;
591 }
592 
593 static inline int tv_list_uidx(const list_T *const l, int n)
595 
602 static inline int tv_list_uidx(const list_T *const l, int n)
603 {
604  // Negative index is relative to the end.
605  if (n < 0) {
606  n += tv_list_len(l);
607  }
608 
609  // Check for index out of range.
610  if (n < 0 || n >= tv_list_len(l)) {
611  return -1;
612  }
613  return n;
614 }
615 
616 static inline bool tv_list_has_watchers(const list_T *const l)
618 
626 static inline bool tv_list_has_watchers(const list_T *const l)
627 {
628  return l && l->lv_watch;
629 }
630 
631 static inline listitem_T *tv_list_first(const list_T *const l)
633 
639 static inline listitem_T *tv_list_first(const list_T *const l)
640 {
641  if (l == NULL) {
642  list_log(l, NULL, NULL, "first");
643  return NULL;
644  }
645  list_log(l, l->lv_first, NULL, "first");
646  return l->lv_first;
647 }
648 
649 static inline listitem_T *tv_list_last(const list_T *const l)
651 
657 static inline listitem_T *tv_list_last(const list_T *const l)
658 {
659  if (l == NULL) {
660  list_log(l, NULL, NULL, "last");
661  return NULL;
662  }
663  list_log(l, l->lv_last, NULL, "last");
664  return l->lv_last;
665 }
666 
667 static inline void tv_dict_set_ret(typval_T *const tv, dict_T *const d)
668  REAL_FATTR_ALWAYS_INLINE REAL_FATTR_NONNULL_ARG(1);
669 
674 static inline void tv_dict_set_ret(typval_T *const tv, dict_T *const d)
675 {
676  tv->v_type = VAR_DICT;
677  tv->vval.v_dict = d;
678  if (d != NULL) {
679  d->dv_refcount++;
680  }
681 }
682 
683 static inline long tv_dict_len(const dict_T *const d)
685 
689 static inline long tv_dict_len(const dict_T *const d)
690 {
691  if (d == NULL) {
692  return 0L;
693  }
694  return (long)d->dv_hashtab.ht_used;
695 }
696 
697 static inline bool tv_dict_is_watched(const dict_T *const d)
699 
705 static inline bool tv_dict_is_watched(const dict_T *const d)
706 {
707  return d && !QUEUE_EMPTY(&d->watchers);
708 }
709 
715 static inline void tv_init(typval_T *const tv)
716 {
717  if (tv != NULL) {
718  memset(tv, 0, sizeof(*tv));
719  }
720 }
721 
722 #define TV_INITIAL_VALUE \
723  ((typval_T) { \
724  .v_type = VAR_UNKNOWN, \
725  .v_lock = VAR_UNLOCKED, \
726  })
727 
732 extern const char *const tv_empty_string;
733 
735 extern bool tv_in_free_unref_items;
736 
744 #define _TV_LIST_ITER_MOD(modifier, l, li, code) \
745  do { \
746  modifier list_T *const l_ = (l); \
747  list_log(l_, NULL, NULL, "iter" #modifier); \
748  if (l_ != NULL) { \
749  for (modifier listitem_T *li = l_->lv_first; \
750  li != NULL; li = li->li_next) { \
751  code \
752  } \
753  } \
754  } while (0)
755 
764 #define TV_LIST_ITER(l, li, code) \
765  _TV_LIST_ITER_MOD(, l, li, code)
766 
775 #define TV_LIST_ITER_CONST(l, li, code) \
776  _TV_LIST_ITER_MOD(const, l, li, code)
777 
778 // Below macros are macros to avoid duplicating code for functionally identical
779 // const and non-const function variants.
780 
786 #define TV_LIST_ITEM_TV(li) (&(li)->li_tv)
787 
794 #define TV_LIST_ITEM_NEXT(l, li) ((li)->li_next)
795 
802 #define TV_LIST_ITEM_PREV(l, li) ((li)->li_prev)
803 // List argument is not used currently, but it is a must for lists implemented
804 // as a pair (size(in list), array) without terminator - basically for lists on
805 // top of kvec.
806 
812 #define TV_DICT_ITER(d, di, code) \
813  HASHTAB_ITER(&(d)->dv_hashtab, di##hi_, { \
814  { \
815  dictitem_T *const di = TV_DICT_HI2DI(di##hi_); \
816  { \
817  code \
818  } \
819  } \
820  })
821 
822 static inline bool tv_get_float_chk(const typval_T *const tv,
823  float_T *const ret_f)
824  REAL_FATTR_NONNULL_ALL REAL_FATTR_WARN_UNUSED_RESULT;
825 
826 // FIXME circular dependency, cannot import message.h.
827 bool emsgf(const char *const fmt, ...);
828 
837 static inline bool tv_get_float_chk(const typval_T *const tv,
838  float_T *const ret_f)
839 {
840  if (tv->v_type == VAR_FLOAT) {
841  *ret_f = tv->vval.v_float;
842  return true;
843  }
844  if (tv->v_type == VAR_NUMBER) {
845  *ret_f = (float_T)tv->vval.v_number;
846  return true;
847  }
848  emsgf("%s", _("E808: Number or Float required"));
849  return false;
850 }
851 
852 static inline DictWatcher *tv_dict_watcher_node_data(QUEUE *q)
853  REAL_FATTR_NONNULL_ALL REAL_FATTR_NONNULL_RET REAL_FATTR_PURE
854  REAL_FATTR_WARN_UNUSED_RESULT REAL_FATTR_ALWAYS_INLINE;
855 
860 static inline DictWatcher *tv_dict_watcher_node_data(QUEUE *q)
861 {
862  return QUEUE_DATA(q, DictWatcher, node);
863 }
864 
865 static inline bool tv_is_func(const typval_T tv)
867 
875 static inline bool tv_is_func(const typval_T tv)
876 {
877  return tv.v_type == VAR_FUNC || tv.v_type == VAR_PARTIAL;
878 }
879 
884 #define TV_TRANSLATE (SIZE_MAX)
885 
889 #define TV_CSTRING (SIZE_MAX - 1)
890 
891 #ifdef UNIT_TESTING
892 // Do not use enum constants, see commit message.
893 EXTERN const size_t kTVCstring INIT(= TV_CSTRING);
894 EXTERN const size_t kTVTranslate INIT(= TV_TRANSLATE);
895 #endif
896 
897 #ifdef INCLUDE_GENERATED_DECLARATIONS
898 # include "eval/typval.h.generated.h"
899 #endif
900 #endif // NVIM_EVAL_TYPVAL_H
typval_T tv
Definition: typval.c:1620
#define REAL_FATTR_NONNULL_RET
Definition: func_attr.h:191
listitem_T * item
Sorted list item.
Definition: typval.h:372
dict_T * v_dict
Dictionary for VAR_DICT, can be NULL.
Definition: typval.h:138
typval_T li_tv
Item value.
Definition: typval.h:157
Unknown (unspecified) value.
Definition: typval.h:114
dict_T * dv_used_prev
Previous dictionary in used dictionaries list.
Definition: typval.h:248
#define _(x)
Definition: gettext.h:20
int dv_copyID
ID used when recursivery traversing a value.
Definition: typval.h:244
Callback callback
Definition: typval.h:87
BoolVarValue v_bool
Bool value, for VAR_BOOL.
Definition: typval.h:133
int lv_len
Number of items.
Definition: typval.h:179
sctx_T uf_script_ctx
Definition: typval.h:338
listitem_T * li_next
Next item in list.
Definition: typval.h:155
int scid_T
Type used for script ID.
Definition: typval.h:255
proftime_T uf_tml_children
time spent in children for this line
Definition: typval.h:334
Definition: typval.h:72
Definition: typval.h:51
int lv_copyID
ID used by deepcopy().
Definition: typval.h:181
#define FUNC_ATTR_CONST
Definition: func_attr.h:241
CallbackType
Definition: typval.h:70
Partial, .v_partial is used.
Definition: typval.h:124
proftime_T uf_tm_self
time spent in function itself
Definition: typval.h:327
int argcount
Definition: userfunc.c:1341
#define TV_TRANSLATE
Definition: typval.h:884
Definition: typval.h:170
struct ht_stack_S ht_stack_T
Structure used for explicit stack while garbage collecting hash tables.
partial_T * partial
Definition: typval.h:79
funccall_T * uf_scoped
l: local variables for closure
Definition: typval.h:341
int linenr
Next line to be executed.
Definition: typval.h:289
size_t size
Definition: regexp_nfa.c:5092
Definition: coverity-model.c:39
#define QUEUE_DATA(ptr, type, field)
Definition: queue.h:33
#define TV_CSTRING
Definition: typval.h:889
Structure that holds an internal variable value.
Definition: typval.h:128
Definition: typval.h:154
hashtab_T * ht
Definition: typval.h:360
fc fc_refcount
Definition: userfunc.c:825
Definition: typval.h:33
struct ht_stack_S * prev
Definition: typval.h:361
int * uf_tml_count
nr of times line was executed
Definition: typval.h:330
proftime_T uf_tml_wait
start wait time for current line
Definition: typval.h:335
fc level
Definition: userfunc.c:819
User lock, can be unlocked.
Definition: typval.h:108
Definition: typval.h:163
scid_T sc_sid
Definition: typval.h:266
list_T * list
Definition: typval.h:366
int action
Definition: funcs.c:8142
listitem_T * lw_item
Item being watched.
Definition: typval.h:164
Not locked.
Definition: typval.h:107
static char size_t n
Definition: memline.c:3382
return NULL
Definition: eval.c:9846
String, .v_string is used.
Definition: typval.h:116
ufunc_T * func
Function being called.
Definition: typval.h:288
Locked value.
Definition: typval.h:234
dict_T * d
Definition: funcs.c:8145
v:false
Definition: typval.h:96
int len
Definition: helpers.c:1464
void * uf_cb_state
State of C function extension.
Definition: typval.h:323
DictItemFlags
Flags for dictitem_T.di_flags.
Definition: typval.h:230
Read-only value.
Definition: typval.h:231
Number, .v_number is used.
Definition: typval.h:115
Definition: queue.h:27
bool tv_in_free_unref_items
Specifies that free_unref_items() function has (not) been entered.
Definition: typval.c:42
int sc_seq
Definition: typval.h:267
v:null
Definition: typval.h:102
void * xmalloc(size_t size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1) FUNC_ATTR_NONNULL_RET
Definition: memory.c:102
static int REAL_FATTR_WARN_UNUSED_RESULT
Definition: typval_encode.c.h:295
garray_T uf_lines
function lines
Definition: typval.h:317
int uf_tml_execed
line being timed was executed
Definition: typval.h:337
Structure representing one list item, used for sort array.
Definition: typval.h:371
proftime_T * uf_tml_self
time spent in a line itself
Definition: typval.h:332
garray_T uf_args
arguments
Definition: typval.h:316
int uf_varargs
variable nr of arguments
Definition: typval.h:312
int uf_tml_idx
index of line being timed; -1 if none
Definition: typval.h:336
Structure used for explicit stack while garbage collecting hash tables.
Definition: typval.h:359
#define REAL_FATTR_NONNULL_ALL
Definition: func_attr.h:183
Definition: typval.h:287
SpecialVarValue
Special variable values.
Definition: typval.h:101
cfunc_T uf_cb
C function extension callback.
Definition: typval.h:321
bool uf_cleared
func_clear() was already called
Definition: typval.h:315
VarType v_type
Variable type.
Definition: typval.h:129
partial_T * v_partial
Closure: function with args.
Definition: typval.h:139
Definition: typval.h:346
uint64_t uvarnumber_T
Definition: typval.h:27
size_t key_pattern_len
Definition: typval.h:89
#define EXTERN
Definition: macros.h:7
Definition: typval.h:73
cfunc_free_T uf_cb_free
C function extesion free callback.
Definition: typval.h:322
SpecialVarValue v_special
Special value, for VAR_SPECIAL.
Definition: typval.h:134
listwatch_T * lw_next
Next watcher.
Definition: typval.h:165
argv[2] vval v_dict dv_refcount
Definition: typval.c:1245
assert(len >=0)
Definition: typval.h:47
struct dict_watcher DictWatcher
Structure holding dictionary watcher.
fc breakpoint
Definition: userfunc.c:821
list_T * lv_used_next
next list in used lists list.
Definition: typval.h:176
list_T sl_list
Definition: typval.h:189
Definition: coverity-model.c:40
Definition: typval.h:188
#define FUNC_ATTR_WARN_UNUSED_RESULT
Definition: func_attr.h:242
bool emsgf(const char *const fmt,...)
Print an error message with unknown number of arguments.
int uf_profiling
true when func is being profiled
Definition: typval.h:318
list_T * v_list
List for VAR_LIST, can be NULL.
Definition: typval.h:137
QUEUE node
Definition: typval.h:90
Definition: garray.h:12
BoolVarValue
Bool variable values.
Definition: typval.h:95
Not a scope dictionary.
Definition: typval.h:145
list_T * lv_copylist
Copied list used by deepcopy().
Definition: typval.h:175
int uf_prof_initialized
Definition: typval.h:319
typval_T * pt_argv
Arguments in allocated array.
Definition: typval.h:354
char_u uf_name[]
Definition: typval.h:342
dict_T * dv_used_next
Next dictionary in used dictionaries list.
Definition: typval.h:247
Structure to hold info for a user function.
Definition: typval.h:311
struct list_stack_S * prev
Definition: typval.h:367
Floating-point value, .v_float is used.
Definition: typval.h:120
VarLockStatus v_lock
Variable lock status.
Definition: typval.h:130
char_u * funcref
Definition: typval.h:78
#define REAL_FATTR_NONNULL_ARG(...)
Definition: func_attr.h:187
Definition: typval.h:122
listwatch_T * lv_watch
First watcher, NULL if none.
Definition: typval.h:173
Scope dictionary which requires prefix (a:, v:, …).
Definition: typval.h:146
fc caller
Definition: userfunc.c:812
char_u * v_string
String, for VAR_STRING and VAR_FUNC, can be NULL.
Definition: typval.h:136
VarType
VimL variable types, for use in typval_T.v_type.
Definition: typval.h:113
#define MAX_FUNC_ARGS
Maximum number of function arguments.
Definition: typval.h:272
VarLockStatus
Variable lock status for typval_T.v_lock.
Definition: typval.h:106
union typval_T::typval_vval_union vval
Actual value.
#define VAR_SHORT_LEN
Short variable name length.
Definition: typval.h:274
Definition: typval.h:147
varnumber_T v_number
Number, for VAR_NUMBER.
Definition: typval.h:132
int pt_refcount
Reference count.
Definition: typval.h:347
proftime_T * uf_tml_total
time spent in a line + children
Definition: typval.h:331
Definition: typval.h:76
VarLockStatus lv_lock
Zero, VAR_LOCKED, VAR_FIXED.
Definition: typval.h:182
List, .v_list is used.
Definition: typval.h:118
return ret
Definition: userfunc.c:1515
QUEUE watchers
Dictionary key watchers set by user code.
Definition: typval.h:249
LuaRef lua_table_ref
Definition: typval.h:251
#define TV_DICTITEM_STRUCT(...)
Definition: typval.h:207
Value, read-only in the sandbox.
Definition: typval.h:232
void(WINAPI *pClosePseudoConsole)(HPCON)
memset(lp, 0, sizeof(lval_T))
int returned
Definition: typval.h:290
Separately allocated.
Definition: typval.h:235
linenr_T sc_lnum
Definition: typval.h:268
long linenr_T
Definition: pos.h:4
int lv_refcount
Reference count.
Definition: typval.h:178
Structure representing a Dictionary.
Definition: typval.h:239
Definition: hashtab.h:62
double float_T
Type used for VimL VAR_FLOAT values.
Definition: typval.h:30
static int REAL_FATTR_WARN_UNUSED_RESULT REAL_FATTR_ALWAYS_INLINE
Definition: typval_encode.c.h:258
proftime_T uf_tm_total
time spent in function + children
Definition: typval.h:326
ListLenSpecials
Additional values for tv_list_alloc() len argument.
Definition: typval.h:36
int64_t varnumber_T
Type used for VimL VAR_NUMBER values.
Definition: typval.h:26
Definition: typval.h:131
Structure used for explicit stack while garbage collecting lists.
Definition: typval.h:365
bool busy
Definition: typval.h:91
proftime_T uf_tml_start
start time for current line
Definition: typval.h:333
list_T * lv_used_prev
Previous list in used lists list.
Definition: typval.h:177
fc dbg_tick
Definition: userfunc.c:822
#define FIXVAR_CNT
Number of fixed variables used for arguments.
Definition: typval.h:276
struct list_stack_S list_stack_T
Structure used for explicit stack while garbage collecting lists.
unsigned char char_u
Definition: types.h:11
int lv_idx
Index of a cached item, used for optimising repeated l[idx].
Definition: typval.h:180
Function reference, .v_string is used as function name.
Definition: typval.h:117
int uf_tm_count
nr of calls
Definition: typval.h:325
char * key_pattern
Definition: typval.h:88
Definition: typval.h:41
void(* cfunc_free_T)(void *state)
Callback to clear cfunc_T and any associated state.
Definition: typval.h:282
#define FUNC_ATTR_ALWAYS_INLINE
Definition: func_attr.h:243
char_u * pt_name
Function name; when NULL use pt_func->name.
Definition: typval.h:348
int LuaRef
Definition: types.h:22
listitem_T * lv_first
First item, NULL if none.
Definition: typval.h:171
listitem_T * li_prev
Previous item in list.
Definition: typval.h:156
#define REAL_FATTR_PURE
Definition: func_attr.h:163
CallbackType type
Definition: typval.h:81
Locked forever.
Definition: typval.h:109
typval_T * argvars
Definition: userfunc.c:1342
Structure holding dictionary watcher.
Definition: typval.h:86
Fixed value: cannot be :unlet or remove()d.
Definition: typval.h:233
ScopeType dv_scope
Definition: typval.h:241
typval_T rettv
Definition: typval.c:1259
Definition: typval.h:265
true, false
Definition: typval.h:121
fc fc_copyID
Definition: userfunc.c:826
#define FUNC_ATTR_NONNULL_ALL
Definition: func_attr.h:245
int(* cfunc_T)(int argcount, typval_T *argvars, typval_T *rettv, void *state)
Definition: typval.h:280
const char *const tv_empty_string
Definition: typval.c:48
int idx
Sorted list item index.
Definition: typval.h:373
VarLockStatus dv_lock
Whole dictionary lock status.
Definition: typval.h:240
list_T *const l
Definition: funcs.c:8196
proftime_T uf_tm_children
time spent in children this call
Definition: typval.h:328
int(* ListSorter)(const void *, const void *)
Definition: typval.h:376
Dictionary, .v_dict is used.
Definition: typval.h:119
int uf_flags
Definition: typval.h:313
float_T v_float
Floating-point number, for VAR_FLOAT.
Definition: typval.h:135
ScopeType
Values for (struct dictvar_S).dv_scope.
Definition: typval.h:144
listitem_T * lv_idx_item
When not NULL item at index "lv_idx".
Definition: typval.h:174
LuaRef lua_table_ref
Definition: typval.h:184
int uf_refcount
reference count, see func_name_refcount()
Definition: typval.h:340
uint64_t proftime_T
Definition: profile.h:7
dict_T * dv_copydict
Copied dict used by deepcopy().
Definition: typval.h:246
listitem_T * lv_last
Last item, NULL if none.
Definition: typval.h:172
int uf_calls
nr of active calls
Definition: typval.h:314
#define INIT(...)
Definition: macros.h:8
dict_T * pt_dict
Dict for "self".
Definition: typval.h:355
hashtab_T dv_hashtab
Hashtab containing all items.
Definition: typval.h:245
ufunc_T * pt_func
Definition: typval.h:349
v:true
Definition: typval.h:97
Definition: typval.h:71
#define list_log(...)
Definition: typval.h:463