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