eval.h
Go to the documentation of this file.
1 #ifndef NVIM_EVAL_H
2 #define NVIM_EVAL_H
3 
4 #include "nvim/buffer_defs.h"
5 #include "nvim/channel.h"
6 #include "nvim/eval/funcs.h" // For FunPtr
7 #include "nvim/event/time.h" // For TimeWatcher
8 #include "nvim/ex_cmds_defs.h" // For exarg_T
9 #include "nvim/os/fileio.h" // For FileDescriptor
10 #include "nvim/os/stdpaths_defs.h" // For XDGVarType
11 
12 #define COPYID_INC 2
13 #define COPYID_MASK (~0x1)
14 
15 // All user-defined functions are found in this hashtable.
16 extern hashtab_T func_hashtab;
17 
19 typedef struct {
23 } funcdict_T;
24 
25 // From user function to hashitem and back.
27 #define UF2HIKEY(fp) ((fp)->uf_name)
28 #define HIKEY2UF(p) ((ufunc_T *)(p - offsetof(ufunc_T, uf_name)))
29 #define HI2UF(hi) HIKEY2UF((hi)->hi_key)
30 
31 /*
32  * Structure returned by get_lval() and used by set_var_lval().
33  * For a plain name:
34  * "name" points to the variable name.
35  * "exp_name" is NULL.
36  * "tv" is NULL
37  * For a magic braces name:
38  * "name" points to the expanded variable name.
39  * "exp_name" is non-NULL, to be freed later.
40  * "tv" is NULL
41  * For an index in a list:
42  * "name" points to the (expanded) variable name.
43  * "exp_name" NULL or non-NULL, to be freed later.
44  * "tv" points to the (first) list item value
45  * "li" points to the (first) list item
46  * "range", "n1", "n2" and "empty2" indicate what items are used.
47  * For an existing Dict item:
48  * "name" points to the (expanded) variable name.
49  * "exp_name" NULL or non-NULL, to be freed later.
50  * "tv" points to the dict item value
51  * "newkey" is NULL
52  * For a non-existing Dict item:
53  * "name" points to the (expanded) variable name.
54  * "exp_name" NULL or non-NULL, to be freed later.
55  * "tv" points to the Dictionary typval_T
56  * "newkey" is the key for the new item.
57  */
58 typedef struct lval_S {
59  const char *ll_name;
60  size_t ll_name_len;
61  char *ll_exp_name;
63  listitem_T *ll_li;
66  int ll_range;
67  long ll_n1;
68  long ll_n2;
69  int ll_empty2;
73 } lval_T;
74 
76 typedef enum {
77  VAR_FLAVOUR_DEFAULT = 1, // doesn't start with uppercase
78  VAR_FLAVOUR_SESSION = 2, // starts with uppercase, some lower
79  VAR_FLAVOUR_SHADA = 4 // all uppercase
81 
83 typedef enum {
155  VV__NULL_LIST, // List with NULL value. For test purposes only.
156  VV__NULL_DICT, // Dictionary with NULL value. For test purposes only.
169 } VimVarIndex;
170 
172 typedef enum {
182 #define LAST_MSGPACK_TYPE kMPExt
184 
187 
188 #undef LAST_MSGPACK_TYPE
189 
190 typedef int (*ArgvFunc)(int current_argcount, typval_T *argv,
191  int called_func_argcount);
192 
194 typedef enum {
195  TFN_INT = 1,
196  TFN_QUIET = 2,
201 
203 typedef enum {
207 } GetLvalFlags;
209 
211 #define FNE_INCL_BR 1 /* find_name_end(): include [] in name */
212 #define FNE_CHECK_START 2 /* find_name_end(): check name starts with
213  valid character */
214 
215 typedef struct {
217  int timer_id;
219  int refcount;
221  long timeout;
222  bool stopped;
223  bool paused;
225 } timer_T;
226 
228 typedef enum
229 {
236 } assert_type_T;
237 
239 typedef enum {
243 } DictListType;
244 
245 #ifdef INCLUDE_GENERATED_DECLARATIONS
246 # include "eval.h.generated.h"
247 #endif
248 #endif // NVIM_EVAL_H
TransFunctionNameFlags
trans_function_name() flags
Definition: eval.h:194
Definition: eval.h:125
Definition: eval.h:176
Definition: eval.h:206
Definition: eval.h:215
Definition: eval.h:150
Definition: eval.h:141
DictListType
Type for dict_list function.
Definition: eval.h:239
int emsg_count
Errors in a repeating timer.
Definition: eval.h:220
Definition: eval.h:86
Definition: eval.h:137
Definition: typval.h:164
Do not use script autoloading.
Definition: eval.h:205
listitem_T * ll_li
The list item or NULL.
Definition: eval.h:64
Definition: eval.h:157
Definition: coverity-model.c:39
list_T * ll_list
The list or NULL.
Definition: eval.h:65
Definition: eval.h:112
Structure that holds an internal variable value.
Definition: typval.h:123
Definition: eval.h:133
Definition: eval.h:135
Definition: typval.h:148
typval_T argv[MAX_FUNC_ARGS+1]
Definition: eval.c:6297
Callback callback
Definition: eval.h:224
Definition: eval.h:146
long timeout
Definition: eval.h:221
Definition: eval.h:177
Definition: eval.h:232
TimeWatcher tw
Definition: eval.h:216
Definition: eval.h:234
Definition: eval.h:231
Definition: eval.h:117
Definition: eval.h:163
Definition: eval.h:85
List dictionary contents: [keys, values].
Definition: eval.h:242
Definition: eval.h:119
int repeat_count
Definition: eval.h:218
Definition: eval.h:118
int timer_id
Definition: eval.h:217
Definition: eval.h:162
Definition: eval.h:113
Definition: eval.h:58
Definition: eval.h:181
Definition: eval.h:156
#define LAST_MSGPACK_TYPE
Definition: eval.h:182
Definition: eval.h:87
Definition: eval.h:144
Definition: eval.h:166
Definition: eval.h:175
Definition: eval.h:110
long ll_n2
Second index for list range.
Definition: eval.h:68
Definition: eval.h:148
Definition: eval.h:95
Definition: eval.h:139
Definition: eval.h:178
Definition: eval.h:174
Definition: eval.h:235
var_flavour_T
enum used by var_flavour()
Definition: eval.h:76
Definition: eval.h:116
Definition: eval.h:121
Definition: eval.h:127
Definition: eval.h:90
dict_T * fd_dict
Dictionary used.
Definition: eval.h:20
dictitem_T * fd_di
Dictionary item used.
Definition: eval.h:22
Definition: eval.h:140
#define EXTERN
Definition: macros.h:7
Definition: eval.h:93
Definition: eval.h:120
Do not emit error messages.
Definition: eval.h:196
Do not use script autoloading.
Definition: eval.h:197
assert_type_T
Type of assert_* check being performed.
Definition: eval.h:228
Definition: eval.h:99
Definition: eval.h:167
Definition: eval.h:98
Definition: eval.h:143
hashtab_T func_hashtab
Structure used by trans_function_name()
Definition: eval.c:91
Definition: eval.h:147
Definition: eval.h:134
Definition: time.h:11
Definition: coverity-model.c:40
Will not change the variable.
Definition: eval.h:199
Definition: eval.h:155
Definition: eval.h:173
struct lval_S lval_T
Definition: eval.h:92
Definition: eval.h:165
Definition: eval.h:123
Definition: eval.h:106
Definition: eval.h:77
Structure to hold info for a user function.
Definition: typval.h:265
Definition: eval.h:158
char_u * ll_newkey
New key for Dict in allocated memory or NULL.
Definition: eval.h:72
Definition: eval.h:78
int ll_range
TRUE when a [i:j] range was used.
Definition: eval.h:66
Definition: eval.h:79
Definition: eval.h:130
Do not dereference a Funcref.
Definition: eval.h:198
Definition: typval.h:76
Definition: eval.h:91
size_t ll_name_len
Length of the .ll_name.
Definition: eval.h:60
long ll_n1
First index for list.
Definition: eval.h:67
Definition: eval.h:94
EXTERN ufunc_T dumuf
Definition: eval.h:26
Definition: eval.h:233
VimVarIndex
Defines for Vim variables.
Definition: eval.h:83
Definition: eval.h:102
Definition: eval.h:180
MessagePackType
All recognized msgpack types.
Definition: eval.h:172
Definition: eval.h:131
Definition: eval.h:96
Definition: eval.h:161
Definition: hashtab.h:62
Definition: eval.h:179
Definition: eval.h:84
Definition: eval.h:128
Definition: eval.h:159
Definition: eval.h:149
const list_T * eval_msgpack_type_lists[LAST_MSGPACK_TYPE+1]
Array mapping values from MessagePackType to corresponding list pointers.
Definition: eval.c:321
int refcount
Definition: eval.h:219
const char * ll_name
Start of variable name (can be NULL).
Definition: eval.h:59
typval_T * ll_tv
isn't NULL it's the Dict to which to add the item.
Definition: eval.h:62
Definition: eval.h:168
Definition: eval.h:164
Definition: eval.h:115
Definition: eval.h:152
Definition: eval.h:160
Definition: eval.h:105
Definition: eval.h:108
Definition: eval.h:230
dictitem_T * ll_di
The dictitem or NULL.
Definition: eval.h:71
unsigned char char_u
Definition: types.h:11
List dictionary values.
Definition: eval.h:241
Definition: eval.h:124
Definition: eval.h:142
Definition: eval.h:111
Definition: eval.h:104
Definition: eval.h:103
dict_T * ll_dict
The Dictionary or NULL.
Definition: eval.h:70
Definition: eval.h:153
Definition: eval.h:151
char * ll_exp_name
NULL or expanded name in allocated memory.
Definition: eval.h:61
Definition: eval.h:114
bool stopped
Definition: eval.h:222
Definition: eval.h:88
Definition: eval.h:154
May use internal function name.
Definition: eval.h:195
Definition: eval.h:101
bool paused
Definition: eval.h:223
char_u * fd_newkey
New key in "dict" in allocated memory.
Definition: eval.h:21
GetLvalFlags
get_lval() flags
Definition: eval.h:203
Do not emit error messages.
Definition: eval.h:204
int(* ArgvFunc)(int current_argcount, typval_T *argv, int called_func_argcount)
Definition: eval.h:190
int ll_empty2
Second index is empty: [i:].
Definition: eval.h:69
Definition: eval.h:100
Definition: eval.h:89
Definition: eval.h:136
Definition: eval.h:97
Definition: eval.h:19
Definition: eval.h:145
Definition: eval.h:126
Definition: eval.h:122
Definition: eval.h:132
Definition: eval.h:138
List dictionary keys.
Definition: eval.h:240
Definition: eval.h:107
Definition: eval.h:109
Definition: eval.h:129