robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
b38ce04283
master
1#pragma once 2 3#include <stdbool.h> 4#include <stddef.h> 5#include <stdint.h> 6 7#include "nvim/channel_defs.h" // IWYU pragma: keep 8#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep 9#include "nvim/eval/typval_defs.h" 10#include "nvim/eval_defs.h" // IWYU pragma: keep 11#include "nvim/event/defs.h" 12#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep 13#include "nvim/grid_defs.h" // IWYU pragma: keep 14#include "nvim/hashtab_defs.h" 15#include "nvim/macros_defs.h" 16#include "nvim/mbyte_defs.h" // IWYU pragma: keep 17#include "nvim/msgpack_rpc/channel_defs.h" // IWYU pragma: keep 18#include "nvim/option_defs.h" // IWYU pragma: keep 19#include "nvim/os/fileio_defs.h" // IWYU pragma: keep 20#include "nvim/os/stdpaths_defs.h" // IWYU pragma: keep 21#include "nvim/types_defs.h" // IWYU pragma: keep 22#include "nvim/vim_defs.h" // IWYU pragma: keep 23 24#define COPYID_INC 2 25#define COPYID_MASK (~0x1) 26 27// Structure returned by get_lval() and used by set_var_lval(). 28// For a plain name: 29// "name" points to the variable name. 30// "exp_name" is NULL. 31// "tv" is NULL 32// For a magic braces name: 33// "name" points to the expanded variable name. 34// "exp_name" is non-NULL, to be freed later. 35// "tv" is NULL 36// For an index in a list: 37// "name" points to the (expanded) variable name. 38// "exp_name" NULL or non-NULL, to be freed later. 39// "tv" points to the (first) list item value 40// "li" points to the (first) list item 41// "range", "n1", "n2" and "empty2" indicate what items are used. 42// For an existing Dict item: 43// "name" points to the (expanded) variable name. 44// "exp_name" NULL or non-NULL, to be freed later. 45// "tv" points to the dict item value 46// "newkey" is NULL 47// For a non-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 Dictionary typval_T 51// "newkey" is the key for the new item. 52typedef struct { 53const char * ll_name ;///< Start of variable name (can be NULL). 54size_t ll_name_len ;///< Length of the .ll_name. 55char * ll_exp_name ;///< NULL or expanded name in allocated memory. 56typval_T * ll_tv ;///< Typeval of item being used. If "newkey" 57///< isn't NULL it's the Dict to which to add the item. 58listitem_T * ll_li ;///< The list item or NULL. 59list_T * ll_list ;///< The list or NULL. 60bool ll_range ;///< true when a [i:j] range was used. 61bool ll_empty2 ;///< Second index is empty: [i:]. 62int ll_n1 ;///< First index for list. 63int ll_n2 ;///< Second index for list range. 64dict_T * ll_dict ;///< The Dict or NULL. 65dictitem_T * ll_di ;///< The dictitem or NULL. 66char * ll_newkey ;///< New key for Dict in allocated memory or NULL. 67blob_T * ll_blob ;///< The Blob or NULL. 68}lval_T ; 69 70/// enum used by var_flavour() 71typedef enum { 72VAR_FLAVOUR_DEFAULT = 1 ,// doesn't start with uppercase 73VAR_FLAVOUR_SESSION = 2 ,// starts with uppercase, some lower 74VAR_FLAVOUR_SHADA = 4 ,// all uppercase 75}var_flavour_T ; 76 77// Struct passed to get_v_event() and restore_v_event(). 78typedef struct { 79bool sve_did_save ; 80hashtab_T sve_hashtab ; 81}save_v_event_T ; 82 83/// trans_function_name() flags 84typedef enum { 85TFN_INT = 1 ,///< May use internal function name 86TFN_QUIET = 2 ,///< Do not emit error messages. 87TFN_NO_AUTOLOAD = 4 ,///< Do not use script autoloading. 88TFN_NO_DEREF = 8 ,///< Do not dereference a Funcref. 89TFN_READ_ONLY = 16 ,///< Will not change the variable. 90}TransFunctionNameFlags ; 91 92/// get_lval() flags 93typedef enum { 94GLV_QUIET = TFN_QUIET ,///< Do not emit error messages. 95GLV_NO_AUTOLOAD = TFN_NO_AUTOLOAD ,///< Do not use script autoloading. 96GLV_READ_ONLY = TFN_READ_ONLY ,///< Indicates that caller will not change 97///< the value (prevents error message). 98}GetLvalFlags ; 99 100/// flags for find_name_end() 101#define FNE_INCL_BR 1 // find_name_end(): include [] in name 102#define FNE_CHECK_START 2 // find_name_end(): check name starts with 103// valid character 104 105typedef struct { 106TimeWatcher tw ; 107int timer_id ; 108int repeat_count ; 109int refcount ; 110int emsg_count ;///< Errors in a repeating timer. 111int64_t timeout ; 112bool stopped ; 113bool paused ; 114Callback callback ; 115}timer_T ; 116 117/// types for expressions. 118typedef enum { 119EXPR_UNKNOWN = 0 , 120EXPR_EQUAL ,///< == 121EXPR_NEQUAL ,///< != 122EXPR_GREATER ,///< > 123EXPR_GEQUAL ,///< >= 124EXPR_SMALLER ,///< < 125EXPR_SEQUAL ,///< <= 126EXPR_MATCH ,///< =~ 127EXPR_NOMATCH ,///< !~ 128EXPR_IS ,///< is 129EXPR_ISNOT ,///< isnot 130}exprtype_T ; 131 132// Used for checking if local variables or arguments used in a lambda. 133extern bool * eval_lavars_used ; 134 135// Character used as separated in autoload function/variable names. 136#define AUTOLOAD_CHAR '#' 137 138/// Flag for expression evaluation. 139enum { 140EVAL_EVALUATE = 1 ,///< when missing don't actually evaluate 141}; 142 143/// Passed to an eval() function to enable evaluation. 144EXTERN evalarg_T EVALARG_EVALUATE INIT (= {EVAL_EVALUATE ,NULL ,NULL ,NULL }); 145 146#include "eval.h.generated.h"