typval.h
Go to the documentation of this file.
1 #ifndef NVIM_EVAL_TYPVAL_H
2 #define NVIM_EVAL_TYPVAL_H
3 
4 #include <assert.h>
5 #include <inttypes.h>
6 #include <stdbool.h>
7 #include <stddef.h>
8 #include <string.h>
9 
10 #include "nvim/func_attr.h"
11 #include "nvim/garray.h"
12 #include "nvim/gettext.h"
13 #include "nvim/hashtab.h"
14 #include "nvim/lib/queue.h"
15 #include "nvim/macros.h"
16 #include "nvim/mbyte.h"
17 #include "nvim/message.h"
18 #include "nvim/pos.h" // for linenr_T
19 #include "nvim/profile.h" // for proftime_T
20 #include "nvim/types.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 typedef struct blobvar_S blob_T;
68 
69 typedef struct ufunc ufunc_T;
70 
71 typedef enum {
75 } CallbackType;
76 
77 typedef struct {
78  union {
81  } data;
83 } Callback;
84 #define CALLBACK_NONE ((Callback){ .type = kCallbackNone })
85 
87 typedef struct dict_watcher {
89  char *key_pattern;
92  bool busy; // prevent recursion if the dict is changed in the callback
93  bool needs_free;
94 } DictWatcher;
95 
97 typedef enum {
100 } BoolVarValue;
101 
103 typedef enum {
106 
108 typedef enum {
111  VAR_FIXED = 2,
112 } VarLockStatus;
113 
115 typedef enum {
125  VAR_PARTIAL,
128 } VarType;
129 
131 typedef struct {
144  } vval;
145 } typval_T;
146 
148 typedef enum {
150  VAR_SCOPE = 1,
152 } ScopeType;
154 
156 typedef struct listitem_S listitem_T;
157 
158 struct listitem_S {
162 };
163 
165 typedef struct listwatch_S listwatch_T;
166 
167 struct listwatch_S {
170 };
171 
174 struct listvar_S {
183  int lv_len;
184  int lv_idx;
185  int lv_copyID;
187 
189 };
190 
191 // Static list with 10 items. Use tv_list_init_static10() to initialize.
192 typedef struct {
193  list_T sl_list; // must be first
194  listitem_T sl_items[10];
196 
197 #define TV_LIST_STATIC10_INIT { \
198  .sl_list = { \
199  .lv_first = NULL, \
200  .lv_last = NULL, \
201  .lv_refcount = 0, \
202  .lv_len = 0, \
203  .lv_watch = NULL, \
204  .lv_idx_item = NULL, \
205  .lv_lock = VAR_FIXED, \
206  .lv_used_next = NULL, \
207  .lv_used_prev = NULL, \
208  }, \
209 }
210 
211 #define TV_DICTITEM_STRUCT(...) \
212  struct { \
213  typval_T di_tv; /* Structure that holds scope dictionary itself. */ \
214  uint8_t di_flags; /* Flags. */ \
215  char_u di_key[__VA_ARGS__]; /* Key value. */ \
216  }
217 
224 typedef TV_DICTITEM_STRUCT(1) ScopeDictDictItem;
225 
232 
234 typedef enum {
240 } DictItemFlags;
241 
243 struct dictvar_S {
246  int dv_refcount;
248  int dv_copyID;
254 
256 };
257 
259 struct blobvar_S {
263 };
264 
266 typedef int scid_T;
268 #define PRIdSCID "d"
269 
270 // SCript ConteXt (SCTX): identifies a script line.
271 // When sourcing a script "sc_lnum" is zero, "sourcing_lnum" is the current
272 // line number. When executing a user function "sc_lnum" is the line where the
273 // function was defined, "sourcing_lnum" is the line number inside the
274 // function. When stored with a function, mapping, option, etc. "sc_lnum" is
275 // the line number in the script "sc_sid".
276 typedef struct {
277  scid_T sc_sid; // script ID
278  int sc_seq; // sourcing sequence number
279  linenr_T sc_lnum; // line number
280 } sctx_T;
281 
283 #define MAX_FUNC_ARGS 20
284 #define VAR_SHORT_LEN 20
286 #define FIXVAR_CNT 12
288 
291 typedef int (*cfunc_T)(int argcount, typval_T *argvars, typval_T *rettv, void *state); // NOLINT
293 typedef void (*cfunc_free_T)(void *state);
294 
295 // Structure to hold info for a function that is currently being executed.
296 typedef struct funccall_S funccall_T;
297 
298 struct funccall_S {
300  int linenr;
301  int returned;
305  ScopeDictDictItem l_vars_var;
307  ScopeDictDictItem l_avars_var;
312  int dbg_tick;
313  int level;
316  int fc_refcount;
318  int fc_copyID;
320 };
321 
323 struct ufunc {
325  int uf_flags;
326  int uf_calls;
327  bool uf_cleared;
333  // Managing cfuncs
336  void *uf_cb_state;
337  // Profiling the function as a whole.
342  // Profiling the function per line.
352  int uf_refcount;
355  char_u uf_name[];
356 };
359 
360 struct partial_S {
364  bool pt_auto;
366  int pt_argc;
370 };
371 
373 typedef struct ht_stack_S {
375  struct ht_stack_S *prev;
376 } ht_stack_T;
377 
379 typedef struct list_stack_S {
382 } list_stack_T;
383 
385 typedef struct {
387  int idx;
388 } ListSortItem;
389 
390 typedef int (*ListSorter)(const void *, const void *);
391 
392 #ifdef LOG_LIST_ACTIONS
393 
395 typedef struct {
396  uintptr_t l;
397  uintptr_t li1;
398  uintptr_t li2;
399  int len;
400  const char *action;
401 } ListLogEntry;
402 
403 typedef struct list_log ListLog;
404 
406 struct list_log {
407  ListLog *next;
408  size_t capacity;
409  size_t size;
410  ListLogEntry entries[];
411 };
412 
413 extern ListLog *list_log_first;
414 extern ListLog *list_log_last;
415 
416 static inline ListLog *list_log_alloc(const size_t size)
418 
424 static inline ListLog *list_log_new(const size_t size)
425 {
426  ListLog *ret = xmalloc(offsetof(ListLog, entries)
427  + size * sizeof(ret->entries[0]));
428  ret->size = 0;
429  ret->capacity = size;
430  ret->next = NULL;
431  if (list_log_first == NULL) {
432  list_log_first = ret;
433  } else {
434  list_log_last->next = ret;
435  }
436  list_log_last = ret;
437  return ret;
438 }
439 
440 static inline void list_log(const list_T *const l,
441  const listitem_T *const li1,
442  const listitem_T *const li2,
443  const char *const action)
445 
455 static inline void list_log(const list_T *const l, const listitem_T *const li1,
456  const listitem_T *const li2, const char *const action)
457 {
458  ListLog *tgt;
459  if (list_log_first == NULL) {
460  tgt = list_log_new(128);
461  } else if (list_log_last->size == list_log_last->capacity) {
462  tgt = list_log_new(list_log_last->capacity * 2);
463  } else {
464  tgt = list_log_last;
465  }
466  tgt->entries[tgt->size++] = (ListLogEntry) {
467  .l = (uintptr_t)l,
468  .li1 = (uintptr_t)li1,
469  .li2 = (uintptr_t)li2,
470  .len = (l == NULL ? 0 : l->lv_len),
471  .action = action,
472  };
473 }
474 #else
475 # define list_log(...)
476 # define list_write_log(...)
477 # define list_free_log()
478 #endif
479 
480 // In a hashtab item "hi_key" points to "di_key" in a dictitem.
481 // This avoids adding a pointer to the hashtab item.
482 
484 #define TV_DICT_HI2DI(hi) \
485  ((dictitem_T *)((hi)->hi_key - offsetof(dictitem_T, di_key)))
486 
487 static inline void tv_list_ref(list_T *const l)
489 
495 static inline void tv_list_ref(list_T *const l)
496 {
497  if (l == NULL) {
498  return;
499  }
500  l->lv_refcount++;
501 }
502 
503 static inline void tv_list_set_ret(typval_T *const tv, list_T *const l)
505 
510 static inline void tv_list_set_ret(typval_T *const tv, list_T *const l)
511 {
512  tv->v_type = VAR_LIST;
513  tv->vval.v_list = l;
514  tv_list_ref(l);
515 }
516 
517 static inline VarLockStatus tv_list_locked(const list_T *const l)
519 
525 static inline VarLockStatus tv_list_locked(const list_T *const l)
526 {
527  if (l == NULL) {
528  return VAR_FIXED;
529  }
530  return l->lv_lock;
531 }
532 
539 static inline void tv_list_set_lock(list_T *const l, const VarLockStatus lock)
540 {
541  if (l == NULL) {
542  assert(lock == VAR_FIXED);
543  return;
544  }
545  l->lv_lock = lock;
546 }
547 
554 static inline void tv_list_set_copyid(list_T *const l, const int copyid)
556 {
557  l->lv_copyID = copyid;
558 }
559 
560 static inline int tv_list_len(const list_T *const l)
562 
566 static inline int tv_list_len(const list_T *const l)
567 {
568  list_log(l, NULL, NULL, "len");
569  if (l == NULL) {
570  return 0;
571  }
572  return l->lv_len;
573 }
574 
575 static inline int tv_list_copyid(const list_T *const l)
577 
583 static inline int tv_list_copyid(const list_T *const l)
584 {
585  return l->lv_copyID;
586 }
587 
588 static inline list_T *tv_list_latest_copy(const list_T *const l)
590 
598 static inline list_T *tv_list_latest_copy(const list_T *const l)
599 {
600  return l->lv_copylist;
601 }
602 
603 static inline int tv_list_uidx(const list_T *const l, int n)
605 
612 static inline int tv_list_uidx(const list_T *const l, int n)
613 {
614  // Negative index is relative to the end.
615  if (n < 0) {
616  n += tv_list_len(l);
617  }
618 
619  // Check for index out of range.
620  if (n < 0 || n >= tv_list_len(l)) {
621  return -1;
622  }
623  return n;
624 }
625 
626 static inline bool tv_list_has_watchers(const list_T *const l)
628 
636 static inline bool tv_list_has_watchers(const list_T *const l)
637 {
638  return l && l->lv_watch;
639 }
640 
641 static inline listitem_T *tv_list_first(const list_T *const l)
643 
649 static inline listitem_T *tv_list_first(const list_T *const l)
650 {
651  if (l == NULL) {
652  list_log(l, NULL, NULL, "first");
653  return NULL;
654  }
655  list_log(l, l->lv_first, NULL, "first");
656  return l->lv_first;
657 }
658 
659 static inline listitem_T *tv_list_last(const list_T *const l)
661 
667 static inline listitem_T *tv_list_last(const list_T *const l)
668 {
669  if (l == NULL) {
670  list_log(l, NULL, NULL, "last");
671  return NULL;
672  }
673  list_log(l, l->lv_last, NULL, "last");
674  return l->lv_last;
675 }
676 
677 static inline void tv_dict_set_ret(typval_T *const tv, dict_T *const d)
679 
684 static inline void tv_dict_set_ret(typval_T *const tv, dict_T *const d)
685 {
686  tv->v_type = VAR_DICT;
687  tv->vval.v_dict = d;
688  if (d != NULL) {
689  d->dv_refcount++;
690  }
691 }
692 
693 static inline long tv_dict_len(const dict_T *const d)
695 
699 static inline long tv_dict_len(const dict_T *const d)
700 {
701  if (d == NULL) {
702  return 0L;
703  }
704  return (long)d->dv_hashtab.ht_used;
705 }
706 
707 static inline bool tv_dict_is_watched(const dict_T *const d)
709 
715 static inline bool tv_dict_is_watched(const dict_T *const d)
716 {
717  return d && !QUEUE_EMPTY(&d->watchers);
718 }
719 
720 static inline void tv_blob_set_ret(typval_T *const tv, blob_T *const b)
722 
729 static inline void tv_blob_set_ret(typval_T *const tv, blob_T *const b)
730 {
731  tv->v_type = VAR_BLOB;
732  tv->vval.v_blob = b;
733  if (b != NULL) {
734  b->bv_refcount++;
735  }
736 }
737 
738 static inline int tv_blob_len(const blob_T *const b)
740 
744 static inline int tv_blob_len(const blob_T *const b)
745 {
746  if (b == NULL) {
747  return 0;
748  }
749  return b->bv_ga.ga_len;
750 }
751 
752 static inline char_u tv_blob_get(const blob_T *const b, int idx)
754 
761 static inline char_u tv_blob_get(const blob_T *const b, int idx)
762 {
763  return ((char_u *)b->bv_ga.ga_data)[idx];
764 }
765 
766 static inline void tv_blob_set(blob_T *const b, int idx, char_u c)
768 
774 static inline void tv_blob_set(blob_T *const b, int idx, char_u c)
775 {
776  ((char_u *)b->bv_ga.ga_data)[idx] = c;
777 }
778 
784 static inline void tv_init(typval_T *const tv)
785 {
786  if (tv != NULL) {
787  memset(tv, 0, sizeof(*tv));
788  }
789 }
790 
791 #define TV_INITIAL_VALUE \
792  ((typval_T) { \
793  .v_type = VAR_UNKNOWN, \
794  .v_lock = VAR_UNLOCKED, \
795  })
796 
801 extern const char *const tv_empty_string;
802 
804 extern bool tv_in_free_unref_items;
805 
813 #define _TV_LIST_ITER_MOD(modifier, l, li, code) \
814  do { \
815  modifier list_T *const l_ = (l); \
816  list_log(l_, NULL, NULL, "iter" #modifier); \
817  if (l_ != NULL) { \
818  for (modifier listitem_T *li = l_->lv_first; \
819  li != NULL; li = li->li_next) { \
820  code \
821  } \
822  } \
823  } while (0)
824 
833 #define TV_LIST_ITER(l, li, code) \
834  _TV_LIST_ITER_MOD( , l, li, code)
835 
844 #define TV_LIST_ITER_CONST(l, li, code) \
845  _TV_LIST_ITER_MOD(const, l, li, code)
846 
847 // Below macros are macros to avoid duplicating code for functionally identical
848 // const and non-const function variants.
849 
855 #define TV_LIST_ITEM_TV(li) (&(li)->li_tv)
856 
863 #define TV_LIST_ITEM_NEXT(l, li) ((li)->li_next)
864 
871 #define TV_LIST_ITEM_PREV(l, li) ((li)->li_prev)
872 // List argument is not used currently, but it is a must for lists implemented
873 // as a pair (size(in list), array) without terminator - basically for lists on
874 // top of kvec.
875 
881 #define TV_DICT_ITER(d, di, code) \
882  HASHTAB_ITER(&(d)->dv_hashtab, di##hi_, { \
883  { \
884  dictitem_T *const di = TV_DICT_HI2DI(di##hi_); \
885  { \
886  code \
887  } \
888  } \
889  })
890 
891 static inline bool tv_get_float_chk(const typval_T *const tv,
892  float_T *const ret_f)
894 
895 // FIXME circular dependency, cannot import message.h.
896 bool semsg(const char *const fmt, ...);
897 
906 static inline bool tv_get_float_chk(const typval_T *const tv, float_T *const ret_f)
907 {
908  if (tv->v_type == VAR_FLOAT) {
909  *ret_f = tv->vval.v_float;
910  return true;
911  }
912  if (tv->v_type == VAR_NUMBER) {
913  *ret_f = (float_T)tv->vval.v_number;
914  return true;
915  }
916  semsg("%s", _("E808: Number or Float required"));
917  return false;
918 }
919 
920 static inline DictWatcher *tv_dict_watcher_node_data(QUEUE *q)
923 
928 static inline DictWatcher *tv_dict_watcher_node_data(QUEUE *q)
929 {
930  return QUEUE_DATA(q, DictWatcher, node);
931 }
932 
933 static inline bool tv_is_func(const typval_T tv)
935 
943 static inline bool tv_is_func(const typval_T tv)
944 {
945  return tv.v_type == VAR_FUNC || tv.v_type == VAR_PARTIAL;
946 }
947 
952 #define TV_TRANSLATE (SIZE_MAX)
953 
957 #define TV_CSTRING (SIZE_MAX - 1)
958 
959 #ifdef UNIT_TESTING
960 // Do not use enum constants, see commit message.
961 EXTERN const size_t kTVCstring INIT(= TV_CSTRING);
962 EXTERN const size_t kTVTranslate INIT(= TV_TRANSLATE);
963 #endif
964 
965 #ifdef INCLUDE_GENERATED_DECLARATIONS
966 # include "eval/typval.h.generated.h"
967 #endif
968 #endif // NVIM_EVAL_TYPVAL_H
listvar_S::lv_first
listitem_T * lv_first
First item, NULL if none.
Definition: typval.h:175
funccall_S::l_vars
dict_T l_vars
l: local function variables.
Definition: typval.h:304
FUNC_ATTR_CONST
#define FUNC_ATTR_CONST
Definition: func_attr.h:243
ufunc::uf_tml_self
proftime_T * uf_tml_self
time spent in a line itself
Definition: typval.h:345
listvar_S::lua_table_ref
LuaRef lua_table_ref
Definition: typval.h:188
listvar_S::lv_last
listitem_T * lv_last
Last item, NULL if none.
Definition: typval.h:176
blobvar_S::bv_ga
garray_T bv_ga
Growarray with the data.
Definition: typval.h:260
ufunc::uf_tml_total
proftime_T * uf_tml_total
time spent in a line + children
Definition: typval.h:344
ufunc::uf_tm_total
proftime_T uf_tm_total
time spent in function + children
Definition: typval.h:339
VAR_FLOAT
@ VAR_FLOAT
Floating-point value, .v_float is used.
Definition: typval.h:122
listvar_S::lv_idx_item
listitem_T * lv_idx_item
When not NULL item at index "lv_idx".
Definition: typval.h:178
profile.h
ht_stack_S::prev
struct ht_stack_S * prev
Definition: typval.h:375
partial_S::pt_func
ufunc_T * pt_func
Definition: typval.h:363
VAR_SCOPE
@ VAR_SCOPE
Scope dictionary which requires prefix (a:, v:, …).
Definition: typval.h:150
typval_T::typval_vval_union::v_special
SpecialVarValue v_special
Special value, for VAR_SPECIAL.
Definition: typval.h:137
uvarnumber_T
uint64_t uvarnumber_T
Definition: typval.h:27
partial_S::pt_dict
dict_T * pt_dict
Dict for "self".
Definition: typval.h:369
_queue
Definition: queue.h:27
tv
typval_T tv
Definition: typval.c:1694
ListSorter
int(* ListSorter)(const void *, const void *)
Definition: typval.h:390
typval_T::typval_vval_union::v_number
varnumber_T v_number
Number, for VAR_NUMBER.
Definition: typval.h:135
DI_FLAGS_ALLOC
@ DI_FLAGS_ALLOC
Separately allocated.
Definition: typval.h:239
_
#define _(x)
Definition: gettext.h:20
CallbackType
CallbackType
Definition: typval.h:71
tv_empty_string
const char *const tv_empty_string
Definition: typval.c:48
dictvar_S::dv_copyID
int dv_copyID
ID used when recursivery traversing a value.
Definition: typval.h:248
ufunc::uf_tml_wait
proftime_T uf_tml_wait
start wait time for current line
Definition: typval.h:348
VarType
VarType
VimL variable types, for use in typval_T.v_type.
Definition: typval.h:115
typval_T
Structure that holds an internal variable value.
Definition: typval.h:131
listvar_S::lv_len
int lv_len
Number of items.
Definition: typval.h:183
REAL_FATTR_NONNULL_RET
#define REAL_FATTR_NONNULL_RET
Definition: func_attr.h:191
typval_T::typval_vval_union::v_partial
partial_T * v_partial
Closure: function with args.
Definition: typval.h:142
list_log
#define list_log(...)
Definition: typval.h:475
types.h
funccall_S::l_varlist
list_T l_varlist
List for a:000.
Definition: typval.h:308
ufunc::uf_flags
int uf_flags
Definition: typval.h:325
funccall_S::breakpoint
linenr_T breakpoint
Next line with breakpoint or zero.
Definition: typval.h:311
dict_watcher::node
QUEUE node
Definition: typval.h:91
funccall_S::rettv
typval_T * rettv
Return value.
Definition: typval.h:310
VAR_STRING
@ VAR_STRING
String, .v_string is used.
Definition: typval.h:118
dictvar_S::dv_hashtab
hashtab_T dv_hashtab
Hashtab containing all items.
Definition: typval.h:249
listvar_S
Definition: typval.h:174
ufunc::uf_varargs
int uf_varargs
variable nr of arguments
Definition: typval.h:324
kCallbackFuncref
@ kCallbackFuncref
Definition: typval.h:73
ScopeType
ScopeType
Values for (struct dictvar_S).dv_scope.
Definition: typval.h:148
ufunc::uf_tml_execed
int uf_tml_execed
line being timed was executed
Definition: typval.h:350
size
size_t size
Definition: regexp_nfa.c:5109
funccall_S::fc_refcount
int fc_refcount
Number of user functions that reference this funccall.
Definition: typval.h:317
VAR_UNKNOWN
@ VAR_UNKNOWN
Unknown (unspecified) value.
Definition: typval.h:116
funccall_S::returned
int returned
Definition: typval.h:301
Callback::type
CallbackType type
Definition: typval.h:82
dictvar_S::dv_refcount
int dv_refcount
Reference count.
Definition: typval.h:247
DO_NOT_FREE_CNT
@ DO_NOT_FREE_CNT
Definition: typval.h:33
listvar_S::lv_copyID
int lv_copyID
ID used by deepcopy().
Definition: typval.h:185
assert.h
VAR_FIXED
@ VAR_FIXED
Locked forever.
Definition: typval.h:111
dict_watcher::key_pattern
char * key_pattern
Definition: typval.h:89
ufunc::uf_tml_start
proftime_T uf_tml_start
start time for current line
Definition: typval.h:346
xmalloc
void * xmalloc(size_t size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1) FUNC_ATTR_NONNULL_RET
Definition: memory.c:105
blobvar_S
Structure to hold info about a Blob.
Definition: typval.h:259
listwatch_S::lw_next
listwatch_T * lw_next
Next watcher.
Definition: typval.h:169
VAR_NO_SCOPE
@ VAR_NO_SCOPE
Not a scope dictionary.
Definition: typval.h:149
dict_watcher::key_pattern_len
size_t key_pattern_len
Definition: typval.h:90
DI_FLAGS_FIX
@ DI_FLAGS_FIX
Fixed value: cannot be :unlet or remove()d.
Definition: typval.h:237
macros.h
TV_TRANSLATE
#define TV_TRANSLATE
Definition: typval.h:952
hashtable_S
Definition: hashtab.h:63
semsg
bool semsg(const char *const fmt,...)
Print an error message with unknown number of arguments.
QUEUE_DATA
#define QUEUE_DATA(ptr, type, field)
Definition: queue.h:33
cfunc_T
int(* cfunc_T)(int argcount, typval_T *argvars, typval_T *rettv, void *state)
Definition: typval.h:291
ufunc::uf_tm_children
proftime_T uf_tm_children
time spent in children this call
Definition: typval.h:341
funccall_S::l_listitems
listitem_T l_listitems[MAX_FUNC_ARGS]
List items for a:000.
Definition: typval.h:309
typval_T::typval_vval_union::v_list
list_T * v_list
List for VAR_LIST, can be NULL.
Definition: typval.h:140
kBoolVarFalse
@ kBoolVarFalse
v:false
Definition: typval.h:98
typval_T::typval_vval_union::v_float
float_T v_float
Floating-point number, for VAR_FLOAT.
Definition: typval.h:138
ht_stack_S::ht
hashtab_T * ht
Definition: typval.h:374
ListLenSpecials
ListLenSpecials
Additional values for tv_list_alloc() len argument.
Definition: typval.h:36
hashtab.h
ret
const int ret
Definition: eval.c:722
typval_T::typval_vval_union::v_bool
BoolVarValue v_bool
Bool value, for VAR_BOOL.
Definition: typval.h:136
kListLenShouldKnow
@ kListLenShouldKnow
Definition: typval.h:47
void
void(WINAPI *pClosePseudoConsole)(HPCON)
funccall_S::fc_funcs
garray_T fc_funcs
List of ufunc_T* which keep a reference to "func".
Definition: typval.h:319
INIT
#define INIT(...)
Definition: macros.h:10
listvar_S::lv_used_next
list_T * lv_used_next
next list in used lists list.
Definition: typval.h:180
typval_T::v_type
VarType v_type
Variable type.
Definition: typval.h:132
dict_watcher::needs_free
bool needs_free
Definition: typval.h:93
TV_CSTRING
#define TV_CSTRING
Definition: typval.h:957
staticList10_T
Definition: typval.h:192
growarray::ga_data
void * ga_data
Definition: garray.h:17
ufunc::uf_tm_self
proftime_T uf_tm_self
time spent in function itself
Definition: typval.h:340
sctx_T::sc_sid
scid_T sc_sid
Definition: typval.h:277
sctx_T
Definition: typval.h:276
LuaRef
int LuaRef
Definition: types.h:23
ufunc::uf_tml_count
int * uf_tml_count
nr of times line was executed
Definition: typval.h:343
kListLenUnknown
@ kListLenUnknown
Definition: typval.h:41
growarray
Definition: garray.h:12
funccall_S::linenr
int linenr
Next line to be executed.
Definition: typval.h:300
VarLockStatus
VarLockStatus
Variable lock status for typval_T.v_lock.
Definition: typval.h:108
listwatch_S::lw_item
listitem_T * lw_item
Item being watched.
Definition: typval.h:168
partial_S::pt_argv
typval_T * pt_argv
Arguments in allocated array.
Definition: typval.h:368
growarray::ga_len
int ga_len
Definition: garray.h:13
Callback::funcref
char_u * funcref
Definition: typval.h:79
REAL_FATTR_NONNULL_ALL
#define REAL_FATTR_NONNULL_ALL
Definition: func_attr.h:183
mbyte.h
scid_T
int scid_T
Type used for script ID.
Definition: typval.h:266
typval_T::v_lock
VarLockStatus v_lock
Variable lock status.
Definition: typval.h:133
dict_watcher
Structure holding dictionary watcher.
Definition: typval.h:87
ListSortItem::item
listitem_T * item
Sorted list item.
Definition: typval.h:386
funccall_S::caller
funccall_T * caller
Definition: typval.h:315
BoolVarValue
BoolVarValue
Bool variable values.
Definition: typval.h:97
message.h
ufunc::uf_prof_initialized
int uf_prof_initialized
Definition: typval.h:332
cfunc_free_T
void(* cfunc_free_T)(void *state)
Callback to clear cfunc_T and any associated state.
Definition: typval.h:293
VAR_PARTIAL
@ VAR_PARTIAL
Partial, .v_partial is used.
Definition: typval.h:126
VAR_BOOL
@ VAR_BOOL
true, false
Definition: typval.h:123
n
int n
Definition: funcs.c:8562
list_stack_T
struct list_stack_S list_stack_T
Structure used for explicit stack while garbage collecting lists.
tv_in_free_unref_items
bool tv_in_free_unref_items
Specifies that free_unref_items() function has (not) been entered.
Definition: typval.c:42
ufunc
Structure to hold info for a user function.
Definition: typval.h:323
typval_T::typval_vval_union::v_blob
blob_T * v_blob
Blob for VAR_BLOB, can be NULL.
Definition: typval.h:143
typval_T::typval_vval_union::v_dict
dict_T * v_dict
Dictionary for VAR_DICT, can be NULL.
Definition: typval.h:141
VAR_BLOB
@ VAR_BLOB
Blob, .v_blob is used.
Definition: typval.h:127
VAR_LIST
@ VAR_LIST
List, .v_list is used.
Definition: typval.h:120
memset
memset(lp, 0, sizeof(lval_T))
listvar_S::lv_copylist
list_T * lv_copylist
Copied list used by deepcopy().
Definition: typval.h:179
ufunc::uf_cleared
bool uf_cleared
func_clear() was already called
Definition: typval.h:327
ufunc::uf_lines
garray_T uf_lines
function lines
Definition: typval.h:330
VAR_UNLOCKED
@ VAR_UNLOCKED
Not locked.
Definition: typval.h:109
ht_stack_S
Structure used for explicit stack while garbage collecting hash tables.
Definition: typval.h:373
DictItemFlags
DictItemFlags
Flags for dictitem_T.di_flags.
Definition: typval.h:234
VAR_SPECIAL
@ VAR_SPECIAL
Definition: typval.h:124
kCallbackPartial
@ kCallbackPartial
Definition: typval.h:74
list_stack_S::list
list_T * list
Definition: typval.h:380
ufunc::uf_scoped
funccall_T * uf_scoped
l: local variables for closure
Definition: typval.h:354
gettext.h
float_T
double float_T
Type used for VimL VAR_FLOAT values.
Definition: typval.h:30
VAR_SHORT_LEN
#define VAR_SHORT_LEN
Short variable name length.
Definition: typval.h:285
funccall_S::level
int level
Top nesting level of executed function.
Definition: typval.h:313
funccall_S::func
ufunc_T * func
Function being called.
Definition: typval.h:299
ht_stack_T
struct ht_stack_S ht_stack_T
Structure used for explicit stack while garbage collecting hash tables.
FUNC_ATTR_NONNULL_ALL
#define FUNC_ATTR_NONNULL_ALL
Definition: func_attr.h:247
partial_S
Definition: typval.h:360
funccall_S::l_avars_var
ScopeDictDictItem l_avars_var
Variable for a: scope.
Definition: typval.h:307
queue.h
VAR_NUMBER
@ VAR_NUMBER
Number, .v_number is used.
Definition: typval.h:117
partial_S::pt_refcount
int pt_refcount
Reference count.
Definition: typval.h:361
assert
assert(len >=0)
ufunc::uf_cb_state
void * uf_cb_state
State of C function extension.
Definition: typval.h:336
varnumber_T
int64_t varnumber_T
Type used for VimL VAR_NUMBER values.
Definition: typval.h:26
ufunc::uf_tml_idx
int uf_tml_idx
index of line being timed; -1 if none
Definition: typval.h:349
funccall_S::dbg_tick
int dbg_tick
Debug_tick when breakpoint was set.
Definition: typval.h:312
ufunc::uf_calls
int uf_calls
nr of active calls
Definition: typval.h:326
typval_T::vval
union typval_T::typval_vval_union vval
Actual value.
DictWatcher
struct dict_watcher DictWatcher
Structure holding dictionary watcher.
DI_FLAGS_RO
@ DI_FLAGS_RO
Read-only value.
Definition: typval.h:235
listvar_S::lv_used_prev
list_T * lv_used_prev
Previous list in used lists list.
Definition: typval.h:181
dictvar_S::dv_used_next
dict_T * dv_used_next
Next dictionary in used dictionaries list.
Definition: typval.h:251
ufunc::uf_script_ctx
sctx_T uf_script_ctx
Definition: typval.h:351
dict_watcher::callback
Callback callback
Definition: typval.h:88
dictvar_S::watchers
QUEUE watchers
Dictionary key watchers set by user code.
Definition: typval.h:253
ufunc::uf_tml_children
proftime_T uf_tml_children
time spent in children for this line
Definition: typval.h:347
listvar_S::lv_watch
listwatch_T * lv_watch
First watcher, NULL if none.
Definition: typval.h:177
listwatch_S
Definition: typval.h:167
VAR_DEF_SCOPE
@ VAR_DEF_SCOPE
Definition: typval.h:151
REAL_FATTR_NONNULL_ARG
#define REAL_FATTR_NONNULL_ARG(...)
Definition: func_attr.h:187
sctx_T::sc_lnum
linenr_T sc_lnum
Definition: typval.h:279
listvar_S::lv_refcount
int lv_refcount
Reference count.
Definition: typval.h:182
EXTERN
#define EXTERN
Definition: macros.h:9
ListSortItem::idx
int idx
Sorted list item index.
Definition: typval.h:387
ufunc::uf_def_args
garray_T uf_def_args
default argument expressions
Definition: typval.h:329
typval_T::typval_vval_union
Definition: typval.h:134
ufunc::uf_cb_free
cfunc_free_T uf_cb_free
C function extension free callback.
Definition: typval.h:335
VAR_FUNC
@ VAR_FUNC
Function reference, .v_string is used as function name.
Definition: typval.h:119
TV_DICTITEM_STRUCT
#define TV_DICTITEM_STRUCT(...)
Definition: typval.h:211
list_stack_S::prev
struct list_stack_S * prev
Definition: typval.h:381
listvar_S::lv_lock
VarLockStatus lv_lock
Zero, VAR_LOCKED, VAR_FIXED.
Definition: typval.h:186
funccall_S::fc_copyID
int fc_copyID
CopyID used for garbage collection.
Definition: typval.h:318
proftime_T
uint64_t proftime_T
Definition: profile.h:7
dictvar_S::lua_table_ref
LuaRef lua_table_ref
Definition: typval.h:255
listitem_S::li_next
listitem_T * li_next
Next item in list.
Definition: typval.h:159
FUNC_ATTR_WARN_UNUSED_RESULT
#define FUNC_ATTR_WARN_UNUSED_RESULT
Definition: func_attr.h:244
rettv
typval_T rettv
Definition: typval.c:1296
dictitem_T
Definition: coverity-model.c:39
dictvar_S::dv_scope
ScopeType dv_scope
Definition: typval.h:245
listitem_S
Definition: typval.h:158
funccall_S::l_avars
dict_T l_avars
a: argument variables.
Definition: typval.h:306
VAR_LOCKED
@ VAR_LOCKED
User lock, can be unlocked.
Definition: typval.h:110
partial_S::pt_name
char_u * pt_name
Function name; when NULL use pt_func->name.
Definition: typval.h:362
l
list_T *const l
Definition: funcs.c:9040
char_u
unsigned char char_u
Definition: types.h:12
dictvar_S
Structure representing a Dictionary.
Definition: typval.h:243
staticList10_T::sl_list
list_T sl_list
Definition: typval.h:193
blobvar_S::bv_lock
VarLockStatus bv_lock
VAR_UNLOCKED, VAR_LOCKED, VAR_FIXED.
Definition: typval.h:262
funccall_S::prof_child
proftime_T prof_child
Time spent in a child.
Definition: typval.h:314
next
m next
Definition: window.c:6849
ufunc::uf_tm_count
int uf_tm_count
nr of calls
Definition: typval.h:338
Callback
Definition: typval.h:77
garray.h
dictvar_S::dv_lock
VarLockStatus dv_lock
Whole dictionary lock status.
Definition: typval.h:244
dictvar_S::dv_copydict
dict_T * dv_copydict
Copied dict used by deepcopy().
Definition: typval.h:250
REAL_FATTR_PURE
#define REAL_FATTR_PURE
Definition: func_attr.h:163
ufunc::uf_profiling
int uf_profiling
true when func is being profiled
Definition: typval.h:331
ufunc::uf_args
garray_T uf_args
arguments
Definition: typval.h:328
listvar_S::lv_idx
int lv_idx
Index of a cached item, used for optimising repeated l[idx].
Definition: typval.h:184
FIXVAR_CNT
#define FIXVAR_CNT
Number of fixed variables used for arguments.
Definition: typval.h:287
DI_FLAGS_RO_SBX
@ DI_FLAGS_RO_SBX
Value, read-only in the sandbox.
Definition: typval.h:236
dict_T
Definition: coverity-model.c:40
dictvar_S::dv_used_prev
dict_T * dv_used_prev
Previous dictionary in used dictionaries list.
Definition: typval.h:252
kBoolVarTrue
@ kBoolVarTrue
v:true
Definition: typval.h:99
kSpecialVarNull
@ kSpecialVarNull
v:null
Definition: typval.h:104
VAR_DICT
@ VAR_DICT
Dictionary, .v_dict is used.
Definition: typval.h:121
sctx_T::sc_seq
int sc_seq
Definition: typval.h:278
func_attr.h
list_stack_S
Structure used for explicit stack while garbage collecting lists.
Definition: typval.h:379
REAL_FATTR_ALWAYS_INLINE
static int REAL_FATTR_WARN_UNUSED_RESULT REAL_FATTR_ALWAYS_INLINE
Definition: typval_encode.c.h:265
ListSortItem
Structure representing one list item, used for sort array.
Definition: typval.h:385
funccall_S::l_vars_var
ScopeDictDictItem l_vars_var
Variable for l: scope.
Definition: typval.h:305
FUNC_ATTR_ALWAYS_INLINE
#define FUNC_ATTR_ALWAYS_INLINE
Definition: func_attr.h:245
kListLenMayKnow
@ kListLenMayKnow
Definition: typval.h:51
listitem_S::li_tv
typval_T li_tv
Item value.
Definition: typval.h:161
funccall_S
Definition: typval.h:298
linenr_T
long linenr_T
Definition: pos.h:7
typval_T::typval_vval_union::v_string
char_u * v_string
String, for VAR_STRING and VAR_FUNC, can be NULL.
Definition: typval.h:139
SpecialVarValue
SpecialVarValue
Special variable values.
Definition: typval.h:103
funccall_S::TV_DICTITEM_STRUCT
TV_DICTITEM_STRUCT(VAR_SHORT_LEN+1) fixvar[FIXVAR_CNT]
Fixed variables for arguments.
ufunc::uf_cb
cfunc_T uf_cb
C function extension callback.
Definition: typval.h:334
dict_watcher::busy
bool busy
Definition: typval.h:92
memory.h
NULL
return NULL
Definition: eval.c:10355
REAL_FATTR_WARN_UNUSED_RESULT
static int REAL_FATTR_WARN_UNUSED_RESULT
Definition: typval_encode.c.h:300
Callback::partial
partial_T * partial
Definition: typval.h:80
action
int action
Definition: funcs.c:8986
len
int len
Definition: helpers.c:1034
DI_FLAGS_LOCK
@ DI_FLAGS_LOCK
Locked value.
Definition: typval.h:238
kCallbackNone
@ kCallbackNone
Definition: typval.h:72
pos.h
listitem_S::li_prev
listitem_T * li_prev
Previous item in list.
Definition: typval.h:160
blobvar_S::bv_refcount
int bv_refcount
Reference count.
Definition: typval.h:261
MAX_FUNC_ARGS
#define MAX_FUNC_ARGS
Maximum number of function arguments.
Definition: typval.h:283