Data Structures | Macros | Enumerations | Functions | Variables
eval.c File Reference
#include <math.h>
#include "nvim/ascii.h"
#include "nvim/buffer.h"
#include "nvim/change.h"
#include "nvim/channel.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/eval/encode.h"
#include "nvim/eval/executor.h"
#include "nvim/eval/gc.h"
#include "nvim/eval/typval.h"
#include "nvim/ex_cmds2.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_getln.h"
#include "nvim/ex_session.h"
#include "nvim/fileio.h"
#include "nvim/getchar.h"
#include "nvim/lua/executor.h"
#include "nvim/mark.h"
#include "nvim/memline.h"
#include "nvim/misc1.h"
#include "nvim/move.h"
#include "nvim/ops.h"
#include "nvim/option.h"
#include "nvim/os/input.h"
#include "nvim/os/os.h"
#include "nvim/os/shell.h"
#include "nvim/path.h"
#include "nvim/quickfix.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
#include "nvim/search.h"
#include "nvim/sign.h"
#include "nvim/syntax.h"
#include "nvim/ui.h"
#include "nvim/undo.h"
#include "nvim/version.h"
#include "nvim/window.h"

Data Structures

struct  scriptvar_T
 
struct  funccall_S
 
struct  forinfo_T
 
struct  vimvar
 

Macros

#define DICT_MAXNEST   100 /* maximum nesting of lists and dicts */
 
#define AUTOLOAD_CHAR   '#'
 
#define globvarht   globvardict.dv_hashtab
 g: value More...
 
#define SCRIPT_SV(id)   (((scriptvar_T **)ga_scripts.ga_data)[(id) - 1])
 
#define SCRIPT_VARS(id)   (SCRIPT_SV(id)->sv_dict.dv_hashtab)
 
#define FC_ABORT   0x01
 
#define FC_RANGE   0x02
 
#define FC_DICT   0x04
 
#define FC_CLOSURE   0x08
 
#define FC_DELETED   0x10
 
#define FC_REMOVED   0x20
 
#define FC_SANDBOX   0x40
 
#define FUNCARG(fp, j)   ((char_u **)(fp->uf_args.ga_data))[j]
 
#define FUNCLINE(fp, j)   ((char_u **)(fp->uf_lines.ga_data))[j]
 
#define VAR_SHORT_LEN   20
 Short variable name length. More...
 
#define FIXVAR_CNT   12
 Number of fixed variables used for arguments. More...
 
#define VV_COMPAT   1 /* compatible, also used without "v:" */
 
#define VV_RO   2 /* read-only */
 
#define VV_RO_SBX   4 /* read-only in the sandbox */
 
#define VV(idx, name, type, flags)
 
#define vv_type   vv_di.di_tv.v_type
 
#define vv_nr   vv_di.di_tv.vval.v_number
 
#define vv_special   vv_di.di_tv.vval.v_special
 
#define vv_float   vv_di.di_tv.vval.v_float
 
#define vv_str   vv_di.di_tv.vval.v_string
 
#define vv_list   vv_di.di_tv.vval.v_list
 
#define vv_dict   vv_di.di_tv.vval.v_dict
 
#define vv_partial   vv_di.di_tv.vval.v_partial
 
#define vv_tv   vv_di.di_tv
 
#define vimvarht   vimvardict.dv_hashtab
 v: hashtab More...
 
#define ABORTING(func)   abort = abort || func
 
#define FLEN_FIXED   40
 

Enumerations

enum  exptype_T {
  TYPE_UNKNOWN = 0, TYPE_EQUAL, TYPE_NEQUAL, TYPE_GREATER,
  TYPE_GEQUAL, TYPE_SMALLER, TYPE_SEQUAL, TYPE_MATCH,
  TYPE_NOMATCH
}
 
enum  FnameTransError {
  ERROR_UNKNOWN = 0, ERROR_TOOMANY, ERROR_TOOFEW, ERROR_SCRIPT,
  ERROR_DICT, ERROR_NONE, ERROR_OTHER, ERROR_BOTH,
  ERROR_DELETED
}
 

Functions

varnumber_T num_divide (varnumber_T n1, varnumber_T n2) FUNC_ATTR_CONST FUNC_ATTR_WARN_UNUSED_RESULT
 
varnumber_T num_modulus (varnumber_T n1, varnumber_T n2) FUNC_ATTR_CONST FUNC_ATTR_WARN_UNUSED_RESULT
 
void eval_init (void)
 
char_ufunc_name (void *cookie)
 
linenr_Tfunc_breakpoint (void *cookie)
 
int * func_dbg_tick (void *cookie)
 
int func_level (void *cookie)
 
int current_func_returned (void)
 
void set_internal_string_var (char_u *name, char_u *value)
 
int var_redir_start (char_u *name, int append)
 
void var_redir_str (char_u *value, int value_len)
 
void var_redir_stop (void)
 
int eval_charconvert (const char *const enc_from, const char *const enc_to, const char *const fname_from, const char *const fname_to)
 
int eval_printexpr (const char *const fname, const char *const args)
 
void eval_diff (const char *const origfile, const char *const newfile, const char *const outfile)
 
void eval_patch (const char *const origfile, const char *const difffile, const char *const outfile)
 
int eval_to_bool (char_u *arg, bool *error, char_u **nextcmd, int skip)
 
 if (ret==FAIL)
 
int eval_expr_typval (const typval_T *expr, typval_T *argv, int argc, typval_T *rettv) FUNC_ATTR_NONNULL_ARG(1
 
int if (expr->v_type==VAR_FUNC)
 
 if (s==NULL)
 
 if (eval1_emsg(&s, rettv, true)==FAIL)
 
 emsgf (_(e_invexpr2), s)
 
bool eval_expr_to_bool (const typval_T *expr, bool *error) FUNC_ATTR_NONNULL_ARG(1
 
bool if (eval_expr_typval(expr,&argv, 0,&rettv)==FAIL)
 
char * eval_to_string_skip (const char *arg, const char **nextcmd, const bool skip) FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_WARN_UNUSED_RESULT
 
int skip_expr (char_u **pp)
 
char_ueval_to_string (char_u *arg, char_u **nextcmd, int convert)
 
char_ueval_to_string_safe (char_u *arg, char_u **nextcmd, int use_sandbox)
 
varnumber_T eval_to_number (char_u *expr)
 
void find_win_for_curbuf (void)
 If there is a window for "curbuf", make it the current window. More...
 
list_Teval_spell_expr (char_u *badword, char_u *expr)
 
int get_spellword (list_T *const list, const char **ret_word)
 
int call_vim_function (const char_u *func, int argc, typval_T *argv, typval_T *rettv) FUNC_ATTR_NONNULL_ALL
 
varnumber_T call_func_retnr (const char_u *func, int argc, typval_T *argv) FUNC_ATTR_NONNULL_ALL
 
char * call_func_retstr (const char *const func, int argc, typval_T *argv) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC
 
voidcall_func_retlist (const char_u *func, int argc, typval_T *argv) FUNC_ATTR_NONNULL_ALL
 
voidsave_funccal (void)
 
void restore_funccal (void *vfc)
 
void prof_child_enter (proftime_T *tm)
 
void prof_child_exit (proftime_T *tm)
 
int eval_foldexpr (char_u *arg, int *cp)
 
void ex_const (exarg_T *eap)
 
void ex_let (exarg_T *eap)
 
 if (len==0)
 
char_uget_lval (char_u *const name, typval_T *const rettv, lval_T *const lp, const bool unlet, const bool skip, const int flags, const int fne_flags) FUNC_ATTR_NONNULL_ARG(1
 
 memset (lp, 0, sizeof(lval_T))
 
 if (skip)
 
 if (expr_start!=NULL)
 
 if ((*p!= '['&&*p!= '.')||lp->ll_name==NULL)
 
 if (v==NULL &&!quiet)
 
whilep (*p== '.'&&lp->ll_tv->v_type==VAR_DICT)
 
void clear_lval (lval_T *lp)
 
voideval_for_line (const char_u *arg, bool *errp, char_u **nextcmdp, int skip)
 
bool next_for_item (void *fi_void, char_u *arg)
 
void free_for_info (void *fi_void)
 
void set_context_for_expression (expand_T *xp, char_u *arg, cmdidx_T cmdidx)
 
void ex_call (exarg_T *eap)
 
void ex_unlet (exarg_T *eap)
 
void ex_lockvar (exarg_T *eap)
 
int do_unlet (const char *const name, const size_t name_len, const int forceit) FUNC_ATTR_NONNULL_ALL
 
void del_menutrans_vars (void)
 
char_uget_user_var_name (expand_T *xp, int idx)
 
int eval0 (char_u *arg, typval_T *rettv, char_u **nextcmd, int evaluate)
 
int eval1 (char_u **arg, typval_T *rettv, int evaluate)
 
int get_option_tv (const char **const arg, typval_T *const rettv, const bool evaluate) FUNC_ATTR_NONNULL_ARG(1)
 
char_upartial_name (partial_T *pt)
 
void partial_unref (partial_T *pt)
 
bool func_equal (typval_T *tv1, typval_T *tv2, bool ic)
 
int get_copyID (void)
 
bool garbage_collect (bool testing)
 
bool set_ref_in_ht (hashtab_T *ht, int copyID, list_stack_T **list_stack) FUNC_ATTR_WARN_UNUSED_RESULT
 
bool set_ref_in_list (list_T *l, int copyID, ht_stack_T **ht_stack) FUNC_ATTR_WARN_UNUSED_RESULT
 
bool set_ref_in_item (typval_T *tv, int copyID, ht_stack_T **ht_stack, list_stack_T **list_stack) FUNC_ATTR_WARN_UNUSED_RESULT
 
bool set_ref_in_functions (int copyID)
 Set "copyID" in all functions available by name. More...
 
size_t string2float (const char *const text, float_T *const ret_value) FUNC_ATTR_NONNULL_ALL
 
static char_u if (v!=NULL &&v->di_tv.v_type==VAR_FUNC)
 
 return (char_u *)
 
bool set_ref_in_func (char_u *name, ufunc_T *fp_in, int copyID)
 
int call_func (const char_u *funcname, int len, typval_T *rettv, int argcount_in, typval_T *argvars_in, ArgvFunc argv_func, linenr_T firstline, linenr_T lastline, int *doesrange, bool evaluate, partial_T *partial, dict_T *selfdict_in) FUNC_ATTR_NONNULL_ARG(1
 
 if (partial!=NULL)
 
 if (error==ERROR_NONE &&evaluate)
 
 while (argv_clear > 0)
 
 xfree (tofree)
 
 xfree (name)
 
void get_arglist_as_rettv (aentry_T *arglist, int argcount, typval_T *rettv)
 Get the argument list for a given window. More...
 
void prepare_assert_error (garray_T *gap)
 
void fill_assert_error (garray_T *gap, typval_T *opt_msg_tv, char_u *exp_str, typval_T *exp_tv, typval_T *got_tv, assert_type_T atype)
 
void assert_error (garray_T *gap)
 
int assert_equal_common (typval_T *argvars, assert_type_T atype) FUNC_ATTR_NONNULL_ALL
 
int assert_equalfile (typval_T *argvars) FUNC_ATTR_NONNULL_ALL
 
int assert_inrange (typval_T *argvars) FUNC_ATTR_NONNULL_ALL
 
int assert_bool (typval_T *argvars, bool is_true) FUNC_ATTR_NONNULL_ALL
 
int assert_exception (typval_T *argvars) FUNC_ATTR_NONNULL_ALL
 
int assert_fails (typval_T *argvars) FUNC_ATTR_NONNULL_ALL
 
int assert_match_common (typval_T *argvars, assert_type_T atype) FUNC_ATTR_NONNULL_ALL
 
int func_call (char_u *name, typval_T *args, partial_T *partial, dict_T *selfdict, typval_T *rettv)
 
win_Tfind_win_by_nr_or_id (typval_T *vp)
 
void filter_map (typval_T *argvars, typval_T *rettv, int map)
 
 tv_copy (tv,&vimvars[VV_VAL].vv_tv)
 
 if (eval_expr_typval(expr, argv, 2,&rettv)==FAIL)
 
 if (map)
 
void common_function (typval_T *argvars, typval_T *rettv, bool is_funcref, FunPtr fptr)
 
dict_Tget_buffer_info (buf_T *buf)
 Returns buffer options, variables and other attributes in a dictionary. More...
 
linenr_T tv_get_lnum_buf (const typval_T *const tv, const buf_T *const buf) FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_WARN_UNUSED_RESULT
 
void get_qf_loc_list (int is_qf, win_T *wp, typval_T *what_arg, typval_T *rettv)
 
dict_Tget_tabpage_info (tabpage_T *tp, int tp_idx)
 
dict_Tget_win_info (win_T *wp, int16_t tpnr, int16_t winnr)
 Returns information about a window as a dictionary. More...
 
win_Tfind_win_by_nr (typval_T *vp, tabpage_T *tp)
 
win_Tfind_tabwin (typval_T *wvp, typval_T *tvp)
 Find window specified by "wvp" in tabpage "tvp". More...
 
void getwinvar (typval_T *argvars, typval_T *rettv, int off)
 
void get_user_input (const typval_T *const argvars, typval_T *const rettv, const bool inputdialog, const bool secret) FUNC_ATTR_NONNULL_ALL
 
void dict_list (typval_T *const tv, typval_T *const rettv, const DictListType what)
 
char ** tv_to_argv (typval_T *cmd_tv, const char **cmd, bool *executable)
 
void mapblock_fill_dict (dict_T *const dict, const mapblock_T *const mp, long buffer_value, bool compatible) FUNC_ATTR_NONNULL_ALL
 
int matchadd_dict_arg (typval_T *tv, const char **conceal_char, win_T **win)
 
void return_register (int regname, typval_T *rettv)
 
void screenchar_adjust_grid (ScreenGrid **grid, int *row, int *col)
 
void set_buffer_lines (buf_T *buf, linenr_T lnum_arg, bool append, const typval_T *lines, typval_T *rettv) FUNC_ATTR_NONNULL_ARG(4
 Set line or list of lines in buffer "buf". More...
 
 if (buf==NULL||(!is_curbuf &&buf->b_ml.ml_mfp==NULL)||lnum< 1)
 
 if (!is_curbuf)
 
 if (append)
 
 if (lines->v_type==VAR_LIST)
 
 for (;;)
 
 if (added > 0)
 
void setwinvar (typval_T *argvars, typval_T *rettv, int off)
 
void get_xdg_var_list (const XDGVarType xdg, typval_T *rettv) FUNC_ATTR_NONNULL_ALL
 "stdpath()" helper for list results More...
 
void get_system_output_as_rettv (typval_T *argvars, typval_T *rettv, bool retlist)
 
bool callback_from_typval (Callback *const callback, typval_T *const arg) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
 
bool callback_call (Callback *const callback, const int argcount_in, typval_T *const argvars_in, typval_T *const rettv) FUNC_ATTR_NONNULL_ALL
 
timer_Tfind_timer_by_nr (varnumber_T xx)
 
void add_timer_info (typval_T *rettv, timer_T *timer)
 
void add_timer_info_all (typval_T *rettv)
 
void timer_due_cb (TimeWatcher *tw, void *data)
 
uint64_t timer_start (const long timeout, const int repeat_count, const Callback *const callback)
 
void timer_stop (timer_T *timer)
 
void timer_stop_all (void)
 
void timer_teardown (void)
 
bool write_list (FileDescriptor *const fp, const list_T *const list, const bool binary) FUNC_ATTR_NONNULL_ARG(1)
 
char * save_tv_as_string (typval_T *tv, ptrdiff_t *const len, bool endnl) FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL
 
pos_Tvar2fpos (const typval_T *const tv, const int dollar_lnum, int *const ret_fnum) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
 
int list2fpos (typval_T *arg, pos_T *posp, int *fnump, colnr_T *curswantp)
 
int get_name_len (const char **const arg, char **alias, int evaluate, int verbose)
 
varnumber_T get_vim_var_nr (int idx) FUNC_ATTR_PURE
 
char_uget_vim_var_str (int idx) FUNC_ATTR_PURE FUNC_ATTR_NONNULL_RET
 
list_Tget_vim_var_list (int idx) FUNC_ATTR_PURE
 
dict_Tget_vim_var_dict (int idx) FUNC_ATTR_PURE
 
void set_vim_var_char (int c)
 
void set_vcount (long count, long count1, int set_prevcount)
 
void set_vim_var_nr (const VimVarIndex idx, const varnumber_T val)
 
void set_vim_var_special (const VimVarIndex idx, const SpecialVarValue val)
 
void set_vim_var_string (const VimVarIndex idx, const char *const val, const ptrdiff_t len)
 
void set_vim_var_list (const VimVarIndex idx, list_T *const val)
 
void set_vim_var_dict (const VimVarIndex idx, dict_T *const val)
 
void set_reg_var (int c)
 
char_uv_exception (char_u *oldval)
 
char_uv_throwpoint (char_u *oldval)
 
char_uset_cmdarg (exarg_T *eap, char_u *oldarg)
 
int get_var_tv (const char *name, int len, typval_T *rettv, dictitem_T **dip, int verbose, int no_autoload)
 
int handle_subscript (const char **const arg, typval_T *rettv, int evaluate, int verbose)
 
void set_selfdict (typval_T *rettv, dict_T *selfdict)
 
dictitem_Tfind_var (const char *const name, const size_t name_len, hashtab_T **htp, int no_autoload)
 
dictitem_Tfind_var_in_ht (hashtab_T *const ht, int htname, const char *const varname, const size_t varname_len, int no_autoload) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
 
char_uget_var_value (const char *const name)
 
void new_script_vars (scid_T id)
 
void init_var_dict (dict_T *dict, ScopeDictDictItem *dict_var, int scope)
 
void unref_var_dict (dict_T *dict)
 
void vars_clear (hashtab_T *ht)
 
void set_var (const char *name, const size_t name_len, typval_T *const tv, const bool copy) FUNC_ATTR_NONNULL_ALL
 
bool var_check_ro (const int flags, const char *name, size_t name_len) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
 
bool var_check_fixed (const int flags, const char *name, size_t name_len) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
 
bool var_check_func_name (const char *const name, const bool new_var) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
 
bool valid_varname (const char *varname) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
 
int var_item_copy (const vimconv_T *const conv, typval_T *const from, typval_T *const to, const bool deep, const int copyID) FUNC_ATTR_NONNULL_ARG(2
 
 if (recurse >=DICT_MAXNEST)
 
 switch (from->v_type)
 
void ex_echo (exarg_T *eap)
 
void ex_echohl (exarg_T *eap)
 
void ex_execute (exarg_T *eap)
 
void ex_function (exarg_T *eap)
 
bool translated_function_exists (const char *name)
 
bool function_exists (const char *const name, bool no_deref)
 
void func_dump_profile (FILE *fd)
 
char_uget_user_func_name (expand_T *xp, int idx)
 
void ex_delfunction (exarg_T *eap)
 ":delfunction {name}" More...
 
void func_unref (char_u *name)
 
void func_ptr_unref (ufunc_T *fp)
 
void func_ref (char_u *name)
 Count a reference to a Function. More...
 
void func_ptr_ref (ufunc_T *fp)
 Count a reference to a Function. More...
 
void call_user_func (ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rettv, linenr_T firstline, linenr_T lastline, dict_T *selfdict) FUNC_ATTR_NONNULL_ARG(1
 
 if (depth >=p_mfd)
 
 save_search_patterns ()
 
 if (!ins_compl_active())
 
 line_breakcheck ()
 
ga_initfc (ufunc_T *), 1
 
 func_ptr_ref (fp)
 
 if (STRNCMP(fp->uf_name,"<lambda>", 8)==0)
 
 if (selfdict!=NULL)
 
 STRCPY (name,"000")
 
add_nr_var & fc (dictitem_T *)&fc->fixvar[fixvar_idx++],"firstline",(varnumber_T) firstline
 
 for (int i=0;i< argcount;i++)
 
 if (fp->uf_flags &FC_SANDBOX)
 
 if (p_verbose >=12)
 
 if (func_not_yet_profiling_but_should)
 
 if (func_or_func_caller_profiling)
 
 if (do_profiling_yes)
 
 do_cmdline (NULL, get_func_line,(void *) fc, DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT)
 
 if ((did_emsg &&(fp->uf_flags &FC_ABORT))||rettv->v_type==VAR_UNKNOWN)
 
 xfree (sourcing_name)
 
 if (using_sandbox)
 
 if (p_verbose >=12 &&sourcing_name!=NULL)
 
 cleanup_function_call (fc)
 
 if (--fp->uf_calls<=0 &&fp->uf_refcount<=0)
 
 if (did_save_redo)
 
 restore_search_patterns ()
 
void ex_return (exarg_T *eap)
 
int do_return (exarg_T *eap, int reanimate, int is_cmd, void *rettv)
 
char_uget_return_cmd (void *rettv)
 
char_uget_func_line (int c, void *cookie, int indent, bool do_concat)
 
void func_line_start (void *cookie)
 
void func_line_exec (void *cookie)
 
void func_line_end (void *cookie)
 
int func_has_ended (void *cookie)
 
int func_has_abort (void *cookie)
 
hashitem_Tfind_hi_in_scoped_ht (const char *name, hashtab_T **pht)
 Search hashitem in parent scope. More...
 
dictitem_Tfind_var_in_scoped_ht (const char *name, const size_t namelen, int no_autoload)
 Search variable in parent scope. More...
 
const voidvar_shada_iter (const void *const iter, const char **const name, typval_T *rettv, var_flavour_T flavour) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ARG(2
 
 if (iter==NULL)
 
tv_copyTV_DICT_HI2DI (hi) ->di_tv, rettv
 
 while ((size_t)(++hi-hifirst)< hinum)
 
void var_set_global (const char *const name, typval_T vartv)
 
int store_session_globals (FILE *fd)
 
void last_set_msg (sctx_T script_ctx)
 
void option_last_set_msg (LastSet last_set)
 
void reset_v_option_vars (void)
 
int modify_fname (char_u *src, bool tilde_file, size_t *usedlen, char_u **fnamep, char_u **bufp, size_t *fnamelen)
 
char_udo_string_sub (char_u *str, char_u *pat, char_u *sub, typval_T *expr, char_u *flags)
 
bool common_job_callbacks (dict_T *vopts, CallbackReader *on_stdout, CallbackReader *on_stderr, Callback *on_exit)
 
Channelfind_job (uint64_t id, bool show_error)
 
void script_host_eval (char *name, typval_T *argvars, typval_T *rettv)
 
typval_T eval_call_provider (char *provider, char *method, list_T *arguments)
 
bool eval_has_provider (const char *feat)
 Checks if provider for feature feat is enabled. More...
 
void eval_fmt_source_name_line (char *buf, size_t bufsize)
 Writes "<sourcing_name>:<sourcing_lnum>" to buf[bufsize]. More...
 
void ex_checkhealth (exarg_T *eap)
 ":checkhealth [plugins]" More...
 
void invoke_prompt_callback (void)
 
bool invoke_prompt_interrupt (void)
 

Variables

hashtab_T func_hashtab
 Structure used by trans_function_name() More...
 
const list_Teval_msgpack_type_lists []
 Array mapping values from MessagePackType to corresponding list pointers. More...
 
funccall_Tcurrent_funccal = NULL
 
funccall_Tprevious_funccal = NULL
 
static int const int did_emsg_before = did_emsg
 
const int called_emsg_before = called_emsg
 
const int ret = eval1(arg, rettv, evaluate)
 
 else
 
char_us = (char_u *)tv_get_string_buf_chk(expr, buf)
 
return FAIL
 
return OK
 
const bool res = (tv_get_number_chk(&rettv, error) != 0)
 
tv_clearrettv = rettv
 
static char_u FUNC_ATTR_WARN_UNUSED_RESULT
 
int len = get_env_len((const char_u **)&arg)
 
int opt_flags
 
char_utofree = NULL
 
if arg
 
char * name = (char *)arg
 
return arg_end
 
char_u typval_T var1
 
typval_T var2
 
int empty1 = FALSE
 
listitem_Tni
 
hashtab_Tht
 
int quiet = flags & GLV_QUIET
 
char_uexpr_start
 
char_uexpr_end
 
char_up
 
lp ll_name_len = (size_t)((const char *)p - lp->ll_name)
 
 v
 
lp ll_tv = &v->di_tv
 
var1 v_type = VAR_UNKNOWN
 
int int error = ERROR_NONE
 
ufunc_Tfp
 
char_u fname_buf [FLEN_FIXED+1]
 
char_ufname = fname_trans_sid(name, fname_buf, &tofree, &error)
 
int argcount = argcount_in
 
typval_Targvars = argvars_in
 
dict_Tselfdict = selfdict_in
 
typval_T argv [MAX_FUNC_ARGS+1]
 
int argv_clear = 0
 
doesrange = false
 
int retval = FAIL
 
remp = (tv_get_number_chk(&rettv, &error) == 0)
 
theend __pad0__
 
void const char * line = NULL
 
list_Tl = NULL
 
listitem_Tli = NULL
 
long added = 0
 
linenr_T append_lnum
 
buf_Tcurbuf_save = NULL
 
win_Tcurwin_save = NULL
 
const bool is_curbuf = buf == curbuf
 
 recurse
 
void linenr_T save_sourcing_lnum
 
bool using_sandbox = false
 
funccall_Tfc = xmalloc(sizeof(funccall_T))
 
int save_did_emsg = did_emsg
 
int fixvar_idx = 0
 
int ai
 
bool islambda = false
 
char_u numbuf [NUMBUFLEN]
 
proftime_T wait_start
 
proftime_T call_start
 
int started_profiling = false
 
bool did_save_redo = false
 
save_redo_T save_redo
 
fp uf_calls
 
fc caller = current_funccal
 
fc func = fp
 
rettv vval v_number = 0
 
fc linenr = 0
 
fc returned = FALSE
 
fc level = ex_nesting_level
 
fc breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0)
 
fc dbg_tick = debug_tick
 
fc fc_refcount = 0
 
fc fc_copyID = 0
 
fc l_avars dv_lock = VAR_FIXED
 
v di_flags = DI_FLAGS_RO | DI_FLAGS_FIX
 
v di_tv v_lock = VAR_FIXED
 
v di_tv vval v_list = &fc->l_varlist
 
 RedrawingDisabled
 
 save_sourcing_name = sourcing_name
 
 sourcing_lnum = 1
 
 sourcing_name = xmalloc(len)
 
const bool do_profiling_yes = do_profiling == PROF_YES
 
bool func_not_yet_profiling_but_should
 
bool func_or_func_caller_profiling
 
const sctx_T save_current_sctx = current_sctx
 
 current_sctx = fp->uf_script_ctx
 
 did_emsg = FALSE
 
const void const hashitem_Thifirst = globvarht.ht_array
 
const size_t hinum = (size_t) globvarht.ht_mask + 1
 
return NULL
 

Macro Definition Documentation

#define ABORTING (   func)    abort = abort || func
#define AUTOLOAD_CHAR   '#'
#define DICT_MAXNEST   100 /* maximum nesting of lists and dicts */
#define FC_ABORT   0x01
#define FC_CLOSURE   0x08
#define FC_DELETED   0x10
#define FC_DICT   0x04
#define FC_RANGE   0x02
#define FC_REMOVED   0x20
#define FC_SANDBOX   0x40
#define FIXVAR_CNT   12

Number of fixed variables used for arguments.

#define FLEN_FIXED   40
#define FUNCARG (   fp,
 
)    ((char_u **)(fp->uf_args.ga_data))[j]
#define FUNCLINE (   fp,
 
)    ((char_u **)(fp->uf_lines.ga_data))[j]
#define globvarht   globvardict.dv_hashtab

g: value

#define SCRIPT_SV (   id)    (((scriptvar_T **)ga_scripts.ga_data)[(id) - 1])
#define SCRIPT_VARS (   id)    (SCRIPT_SV(id)->sv_dict.dv_hashtab)
#define VAR_SHORT_LEN   20

Short variable name length.

#define vimvarht   vimvardict.dv_hashtab

v: hashtab

#define VV (   idx,
  name,
  type,
  flags 
)
Value:
[idx] = { \
.vv_name = name, \
.vv_di = { \
.di_tv = { .v_type = type }, \
.di_flags = 0, \
.di_key = { 0 }, \
}, \
.vv_flags = flags, \
}
char * name
Definition: eval.c:1899
err type
Definition: helpers.c:1473
#define VV_COMPAT   1 /* compatible, also used without "v:" */
#define vv_dict   vv_di.di_tv.vval.v_dict
#define vv_float   vv_di.di_tv.vval.v_float
#define vv_list   vv_di.di_tv.vval.v_list
#define vv_nr   vv_di.di_tv.vval.v_number
#define vv_partial   vv_di.di_tv.vval.v_partial
#define VV_RO   2 /* read-only */
#define VV_RO_SBX   4 /* read-only in the sandbox */
#define vv_special   vv_di.di_tv.vval.v_special
#define vv_str   vv_di.di_tv.vval.v_string
#define vv_tv   vv_di.di_tv
#define vv_type   vv_di.di_tv.v_type

Enumeration Type Documentation

enum exptype_T
Enumerator
TYPE_UNKNOWN 
TYPE_EQUAL 
TYPE_NEQUAL 
TYPE_GREATER 
TYPE_GEQUAL 
TYPE_SMALLER 
TYPE_SEQUAL 
TYPE_MATCH 
TYPE_NOMATCH 
Enumerator
ERROR_UNKNOWN 
ERROR_TOOMANY 
ERROR_TOOFEW 
ERROR_SCRIPT 
ERROR_DICT 
ERROR_NONE 
ERROR_OTHER 
ERROR_BOTH 
ERROR_DELETED 

Function Documentation

void add_timer_info ( typval_T rettv,
timer_T timer 
)
void add_timer_info_all ( typval_T rettv)
int assert_bool ( typval_T argvars,
bool  is_true 
)
int assert_equal_common ( typval_T argvars,
assert_type_T  atype 
)
int assert_equalfile ( typval_T argvars)
void assert_error ( garray_T gap)
int assert_exception ( typval_T argvars)
int assert_fails ( typval_T argvars)
int assert_inrange ( typval_T argvars)
int assert_match_common ( typval_T argvars,
assert_type_T  atype 
)
int call_func ( const char_u funcname,
int  len,
typval_T rettv,
int  argcount_in,
typval_T argvars_in,
ArgvFunc  argv_func,
linenr_T  firstline,
linenr_T  lastline,
int *  doesrange,
bool  evaluate,
partial_T partial,
dict_T selfdict_in 
)

Call a function with its resolved parameters

"argv_func", when not NULL, can be used to fill in arguments only when the invoked function uses them. It is called like this: new_argcount = argv_func(current_argcount, argv, called_func_argcount)

Returns
FAIL if function cannot be called, else OK (even if an error occurred while executing the function! Set msg_list to capture the error, see do_cmdline()).
void* call_func_retlist ( const char_u func,
int  argc,
typval_T argv 
)

Call Vim script function and return the result as a List

Parameters
[in]funcFunction name.
[in]argcNumber of arguments.
[in]argvArray with typval_T arguments.
Returns
[allocated] NULL when calling function fails or return tv is not a List, allocated List otherwise.
varnumber_T call_func_retnr ( const char_u func,
int  argc,
typval_T argv 
)

Call Vim script function and return the result as a number

Parameters
[in]funcFunction name.
[in]argcNumber of arguments.
[in]argvArray with typval_T arguments.
Returns
-1 when calling function fails, result of function otherwise.
char* call_func_retstr ( const char *const  func,
int  argc,
typval_T argv 
)

Call Vim script function and return the result as a string

Parameters
[in]funcFunction name.
[in]argcNumber of arguments.
[in]argvArray with typval_T arguments.
Returns
[allocated] NULL when calling function fails, allocated string otherwise.
void call_user_func ( ufunc_T fp,
int  argcount,
typval_T argvars,
typval_T rettv,
linenr_T  firstline,
linenr_T  lastline,
dict_T selfdict 
)

Call a user function

Parameters
fpFunction to call.
[in]argcountNumber of arguments.
argvarsArguments.
[out]rettvReturn value.
[in]firstlineFirst line of range.
[in]lastlineLast line of range.
selfdictDictionary for "self" for dictionary functions.
int call_vim_function ( const char_u func,
int  argc,
typval_T argv,
typval_T rettv 
)
bool callback_call ( Callback *const  callback,
const int  argcount_in,
typval_T *const  argvars_in,
typval_T *const  rettv 
)
bool callback_from_typval ( Callback *const  callback,
typval_T *const  arg 
)
cleanup_function_call ( fc  )
void clear_lval ( lval_T lp)
void common_function ( typval_T argvars,
typval_T rettv,
bool  is_funcref,
FunPtr  fptr 
)
bool common_job_callbacks ( dict_T vopts,
CallbackReader on_stdout,
CallbackReader on_stderr,
Callback on_exit 
)

common code for getting job callbacks for jobstart, termopen and rpcstart

Returns
true/false on success/failure.
int current_func_returned ( void  )
void del_menutrans_vars ( void  )
void dict_list ( typval_T *const  tv,
typval_T *const  rettv,
const DictListType  what 
)

Turn a dictionary into a list

Parameters
[in]tvDictionary to convert. Is checked for actually being a dictionary, will give an error if not.
[out]rettvLocation where result will be saved.
[in]whatWhat to save in rettv.
do_cmdline ( NULL  ,
get_func_line  ,
(void *)  fc,
DOCMD_NOWAIT|DOCMD_VERBOSE DOCMD_REPEAT 
)
int do_return ( exarg_T eap,
int  reanimate,
int  is_cmd,
void rettv 
)
char_u* do_string_sub ( char_u str,
char_u pat,
char_u sub,
typval_T expr,
char_u flags 
)

Perform a substitution on "str" with pattern "pat" and substitute "sub". When "sub" is NULL "expr" is used, must be a VAR_FUNC or VAR_PARTIAL. "flags" can be "g" to do a global substitute. Returns an allocated string, NULL for error.

int do_unlet ( const char *const  name,
const size_t  name_len,
const int  forceit 
)

unlet a variable

Parameters
[in]nameVariable name to unlet.
[in]name_lenVariable name length.
[in]fonceitIf true, do not complain if variable doesn’t exist.
Returns
OK if it existed, FAIL otherwise.
emsgf ( _(e_invexpr2)  ,
s   
)
int eval0 ( char_u arg,
typval_T rettv,
char_u **  nextcmd,
int  evaluate 
)
int eval1 ( char_u **  arg,
typval_T rettv,
int  evaluate 
)
typval_T eval_call_provider ( char *  provider,
char *  method,
list_T arguments 
)
int eval_charconvert ( const char *const  enc_from,
const char *const  enc_to,
const char *const  fname_from,
const char *const  fname_to 
)
void eval_diff ( const char *const  origfile,
const char *const  newfile,
const char *const  outfile 
)
bool eval_expr_to_bool ( const typval_T expr,
bool *  error 
)

Like eval_to_bool() but using a typval_T instead of a string. Works for string, funcref and partial.

int eval_expr_typval ( const typval_T expr,
typval_T argv,
int  argc,
typval_T rettv 
)
void eval_fmt_source_name_line ( char *  buf,
size_t  bufsize 
)

Writes "<sourcing_name>:<sourcing_lnum>" to buf[bufsize].

int eval_foldexpr ( char_u arg,
int *  cp 
)
void* eval_for_line ( const char_u arg,
bool *  errp,
char_u **  nextcmdp,
int  skip 
)
bool eval_has_provider ( const char *  feat)

Checks if provider for feature feat is enabled.

void eval_init ( void  )
void eval_patch ( const char *const  origfile,
const char *const  difffile,
const char *const  outfile 
)
int eval_printexpr ( const char *const  fname,
const char *const  args 
)
list_T* eval_spell_expr ( char_u badword,
char_u expr 
)
int eval_to_bool ( char_u arg,
bool *  error,
char_u **  nextcmd,
int  skip 
)
varnumber_T eval_to_number ( char_u expr)
char_u* eval_to_string ( char_u arg,
char_u **  nextcmd,
int  convert 
)
char_u* eval_to_string_safe ( char_u arg,
char_u **  nextcmd,
int  use_sandbox 
)
char* eval_to_string_skip ( const char *  arg,
const char **  nextcmd,
const bool  skip 
)

Top level evaluation function, returning a string

Parameters
[in]argString to evaluate.
nextcmdPointer to the start of the next Ex command.
[in]skipIf true, only do parsing to nextcmd without reporting errors or actually evaluating anything.
Returns
[allocated] string result of evaluation or NULL in case of error or when skipping.
void ex_call ( exarg_T eap)
void ex_checkhealth ( exarg_T eap)

":checkhealth [plugins]"

void ex_const ( exarg_T eap)
void ex_delfunction ( exarg_T eap)

":delfunction {name}"

void ex_echo ( exarg_T eap)
void ex_echohl ( exarg_T eap)
void ex_execute ( exarg_T eap)
void ex_function ( exarg_T eap)
void ex_let ( exarg_T eap)
void ex_lockvar ( exarg_T eap)
void ex_return ( exarg_T eap)
void ex_unlet ( exarg_T eap)
ga_init& fc ( ufunc_T )
add_nr_var& fc ( dictitem_T ) -> fixvar[fixvar_idx++],"firstline",(varnumber_T) firstline
void fill_assert_error ( garray_T gap,
typval_T opt_msg_tv,
char_u exp_str,
typval_T exp_tv,
typval_T got_tv,
assert_type_T  atype 
)
void filter_map ( typval_T argvars,
typval_T rettv,
int  map 
)
hashitem_T* find_hi_in_scoped_ht ( const char *  name,
hashtab_T **  pht 
)

Search hashitem in parent scope.

Channel* find_job ( uint64_t  id,
bool  show_error 
)
win_T* find_tabwin ( typval_T wvp,
typval_T tvp 
)

Find window specified by "wvp" in tabpage "tvp".

timer_T* find_timer_by_nr ( varnumber_T  xx)
dictitem_T* find_var ( const char *const  name,
const size_t  name_len,
hashtab_T **  htp,
int  no_autoload 
)
dictitem_T* find_var_in_ht ( hashtab_T *const  ht,
int  htname,
const char *const  varname,
const size_t  varname_len,
int  no_autoload 
)

Find variable in hashtab

Parameters
[in]htHashtab to find variable in.
[in]htnameHashtab name (first character).
[in]varnameVariable name.
[in]varname_lenVariable name length.
[in]no_autoloadIf true then autoload scripts will not be sourced if autoload variable was not found.
Returns
pointer to the dictionary item with the found variable or NULL if it was not found.
dictitem_T* find_var_in_scoped_ht ( const char *  name,
const size_t  namelen,
int  no_autoload 
)

Search variable in parent scope.

win_T* find_win_by_nr ( typval_T vp,
tabpage_T tp 
)
win_T* find_win_by_nr_or_id ( typval_T vp)

Find a window: When using a Window ID in any tab page, when using a number in the current tab page.

void find_win_for_curbuf ( void  )

If there is a window for "curbuf", make it the current window.

for ( ;;  )
for ( )
void free_for_info ( void fi_void)
linenr_T* func_breakpoint ( void cookie)
int func_call ( char_u name,
typval_T args,
partial_T partial,
dict_T selfdict,
typval_T rettv 
)
int* func_dbg_tick ( void cookie)
void func_dump_profile ( FILE *  fd)
bool func_equal ( typval_T tv1,
typval_T tv2,
bool  ic 
)
int func_has_abort ( void cookie)
int func_has_ended ( void cookie)
int func_level ( void cookie)
void func_line_end ( void cookie)
void func_line_exec ( void cookie)
void func_line_start ( void cookie)
char_u* func_name ( void cookie)
void func_ptr_ref ( ufunc_T fp)

Count a reference to a Function.

func_ptr_ref ( fp  )
void func_ptr_unref ( ufunc_T fp)

Unreference a Function: decrement the reference count and free it when it becomes zero. Unreference user function, freeing it if needed

Decrements the reference count and frees when it becomes zero.

Parameters
fpFunction to unreference.
void func_ref ( char_u name)

Count a reference to a Function.

void func_unref ( char_u name)
bool function_exists ( const char *const  name,
bool  no_deref 
)

Check whether function with the given name exists

Parameters
[in]nameFunction name.
[in]no_derefWhether to dereference a Funcref.
Returns
True if it exists, false otherwise.
bool garbage_collect ( bool  testing)

Do garbage collection for lists and dicts.

Parameters
testingtrue if called from test_garbagecollect_now().
Returns
true if some memory was freed.
void get_arglist_as_rettv ( aentry_T arglist,
int  argcount,
typval_T rettv 
)

Get the argument list for a given window.

dict_T* get_buffer_info ( buf_T buf)

Returns buffer options, variables and other attributes in a dictionary.

int get_copyID ( void  )

Get next (unique) copy ID

Used for traversing nested structures e.g. when serializing them or garbage collecting.

char_u* get_func_line ( int  c,
void cookie,
int  indent,
bool  do_concat 
)
char_u* get_lval ( char_u *const  name,
typval_T *const  rettv,
lval_T *const  lp,
const bool  unlet,
const bool  skip,
const int  flags,
const int  fne_flags 
)

Get an lvalue

Lvalue may be

  • variable: "name", "na{me}"
  • dictionary item: "dict.key", "dict['key']"
  • list item: "list[expr]"
  • list slice: "list[expr:expr]"

Indexing only works if trying to use it with an existing List or Dictionary.

Parameters
[in]nameName to parse.
rettvPointer to the value to be assigned or NULL.
[out]lpLvalue definition. When evaluation errors occur ->ll_name is NULL.
[in]unletTrue if using :unlet. This results in slightly different behaviour when something is wrong; must end in space or cmd separator.
[in]skipTrue when skipping.
[in]flags
See also
GetLvalFlags.
Parameters
[in]fne_flagsFlags for find_name_end().
Returns
A pointer to just after the name, including indexes. Returns NULL for a parsing error, but it is still needed to free items in lp.
int get_name_len ( const char **const  arg,
char **  alias,
int  evaluate,
int  verbose 
)
int get_option_tv ( const char **const  arg,
typval_T *const  rettv,
const bool  evaluate 
)

Get an option value

Parameters
[in,out]argPoints to the '&' or '+' before the option name. Is advanced to the character after the option name.
[out]rettvLocation where result is saved.
[in]evaluateIf not true, rettv is not populated.
Returns
OK or FAIL.
void get_qf_loc_list ( int  is_qf,
win_T wp,
typval_T what_arg,
typval_T rettv 
)
char_u* get_return_cmd ( void rettv)
int get_spellword ( list_T *const  list,
const char **  ret_word 
)

Get spell word from an entry from spellsuggest=expr:

Entry in question is supposed to be a list (to be checked by the caller) with two items: a word and a score represented as an unsigned number (whether it actually is unsigned is not checked).

Used to get the good word and score from the eval_spell_expr() result.

Parameters
[in]listList to get values from.
[out]ret_wordSuggested word. Not initialized if return value is -1.
Returns
-1 in case of error, score otherwise.
void get_system_output_as_rettv ( typval_T argvars,
typval_T rettv,
bool  retlist 
)
dict_T* get_tabpage_info ( tabpage_T tp,
int  tp_idx 
)

Returns information (variables, options, etc.) about a tab page as a dictionary.

char_u* get_user_func_name ( expand_T xp,
int  idx 
)
void get_user_input ( const typval_T *const  argvars,
typval_T *const  rettv,
const bool  inputdialog,
const bool  secret 
)
char_u* get_user_var_name ( expand_T xp,
int  idx 
)
int get_var_tv ( const char *  name,
int  len,
typval_T rettv,
dictitem_T **  dip,
int  verbose,
int  no_autoload 
)
char_u* get_var_value ( const char *const  name)
dict_T* get_vim_var_dict ( int  idx)

Get Dictionary v: variable value. Caller must take care of reference count when needed.

list_T* get_vim_var_list ( int  idx)
varnumber_T get_vim_var_nr ( int  idx)
char_u* get_vim_var_str ( int  idx)
dict_T* get_win_info ( win_T wp,
int16_t  tpnr,
int16_t  winnr 
)

Returns information about a window as a dictionary.

void get_xdg_var_list ( const XDGVarType  xdg,
typval_T rettv 
)

"stdpath()" helper for list results

void getwinvar ( typval_T argvars,
typval_T rettv,
int  off 
)
int handle_subscript ( const char **const  arg,
typval_T rettv,
int  evaluate,
int  verbose 
)

Handle expr[expr], expr[expr:expr] subscript and .name lookup. Also handle function call with Funcref variable: func(expr) Can all be combined: dict.func(expr)[idx]['func'](expr)

if ( ret  = FAIL)
else if ( expr->  v_type = VAR_FUNC)
if ( s  = NULL)
if ( eval1_emsg &,,  true = FAIL)
bool if ( eval_expr_typval(expr,&argv, 0,&rettv = FAIL)
if ( len  = = 0)
if ( skip  )
if ( expr_start!  = NULL)
if ( *!= '['&&*!= '.'p||lp->  ll_name = NULL)
if ( v  = NULL && !quiet)
if ( v!  = NULL && v->di_tv.v_type == VAR_FUNC)
if ( partial!  = NULL)
if ( error  = ERROR_NONE && evaluate)
if ( eval_expr_typval(expr, argv, 2,&rettv = FAIL)
if ( map  )
if ( )
if ( is_curbuf)
if ( append  )
if ( lines->  v_type = VAR_LIST)
if ( added  ,
 
)
if ( recurse >=  DICT_MAXNEST)
if ( depth >=  p_mfd)
if ( ins_compl_active())
if ( STRNCMP(fp->uf_name,"<lambda>", 8)  = = 0)
if ( selfdict!  = NULL)
if ( fp->uf_flags &  FC_SANDBOX)
if ( p_verbose >=  12)
if ( do_profiling_yes  )
if ( (did_emsg &&(fp->uf_flags &FC_ABORT))||rettv->  v_type = VAR_UNKNOWN)
if ( using_sandbox  )
if ( p_verbose >=12 &&sourcing_name!  = NULL)
if ( --fp->uf_calls<=0 &&fp->uf_refcount<=  0)
if ( did_save_redo  )
if ( iter  = NULL)
void init_var_dict ( dict_T dict,
ScopeDictDictItem *  dict_var,
int  scope 
)
void invoke_prompt_callback ( void  )
bool invoke_prompt_interrupt ( void  )
void last_set_msg ( sctx_T  script_ctx)
line_breakcheck ( )
int list2fpos ( typval_T arg,
pos_T posp,
int *  fnump,
colnr_T curswantp 
)
void mapblock_fill_dict ( dict_T *const  dict,
const mapblock_T *const  mp,
long  buffer_value,
bool  compatible 
)

Fill a dictionary with all applicable maparg() like dictionaries

Parameters
dictThe dictionary to be filled
mpThe maphash that contains the mapping information
buffer_valueThe "buffer" value
compatibleTrue for compatible with old maparg() dict
int matchadd_dict_arg ( typval_T tv,
const char **  conceal_char,
win_T **  win 
)
memset ( lp  ,
,
sizeof(lval_T  
)
int modify_fname ( char_u src,
bool  tilde_file,
size_t *  usedlen,
char_u **  fnamep,
char_u **  bufp,
size_t *  fnamelen 
)
void new_script_vars ( scid_T  id)
bool next_for_item ( void fi_void,
char_u arg 
)
varnumber_T num_divide ( varnumber_T  n1,
varnumber_T  n2 
)
varnumber_T num_modulus ( varnumber_T  n1,
varnumber_T  n2 
)
void option_last_set_msg ( LastSet  last_set)

Displays where an option was last set.

Should only be invoked when 'verbose' is non-zero.

while* p ( p = = '.' && lp->ll_tv->v_type == VAR_DICT)
char_u* partial_name ( partial_T pt)
Returns
the function name of the partial.
void partial_unref ( partial_T pt)

Unreference a closure: decrement the reference count and free it when it becomes zero.

void prepare_assert_error ( garray_T gap)
void prof_child_enter ( proftime_T tm)
void prof_child_exit ( proftime_T tm)
void reset_v_option_vars ( void  )
void restore_funccal ( void vfc)
restore_search_patterns ( )
return ( char_u )
void return_register ( int  regname,
typval_T rettv 
)
void* save_funccal ( void  )
save_search_patterns ( )
char* save_tv_as_string ( typval_T tv,
ptrdiff_t *const  len,
bool  endnl 
)

Saves a typval_T as a string.

For lists or buffers, replaces NLs with NUL and separates items with NLs.

Parameters
[in]tvValue to store as a string.
[out]lenLength of the resulting string or -1 on error.
[in]endnlIf true, the output will end in a newline (if a list).
Returns
an allocated string if tv represents a VimL string, list, or number; NULL otherwise.
void screenchar_adjust_grid ( ScreenGrid **  grid,
int *  row,
int *  col 
)
void script_host_eval ( char *  name,
typval_T argvars,
typval_T rettv 
)
void set_buffer_lines ( buf_T buf,
linenr_T  lnum_arg,
bool  append,
const typval_T lines,
typval_T rettv 
)

Set line or list of lines in buffer "buf".

char_u* set_cmdarg ( exarg_T eap,
char_u oldarg 
)
void set_context_for_expression ( expand_T xp,
char_u arg,
cmdidx_T  cmdidx 
)
void set_internal_string_var ( char_u name,
char_u value 
)
bool set_ref_in_func ( char_u name,
ufunc_T fp_in,
int  copyID 
)

Mark all lists and dicts referenced through function "name" with "copyID". "list_stack" is used to add lists to be marked. Can be NULL. "ht_stack" is used to add hashtabs to be marked. Can be NULL.

Returns
true if setting references failed somehow.
bool set_ref_in_functions ( int  copyID)

Set "copyID" in all functions available by name.

bool set_ref_in_ht ( hashtab_T ht,
int  copyID,
list_stack_T **  list_stack 
)

Mark all lists and dicts referenced through hashtab "ht" with "copyID".

Parameters
htHashtab content will be marked.
copyIDNew mark for lists and dicts.
list_stackUsed to add lists to be marked. Can be NULL.
Returns
true if setting references failed somehow.
bool set_ref_in_item ( typval_T tv,
int  copyID,
ht_stack_T **  ht_stack,
list_stack_T **  list_stack 
)

Mark all lists and dicts referenced through typval "tv" with "copyID".

Parameters
tvTypval content will be marked.
copyIDNew mark for lists and dicts.
ht_stackUsed to add hashtabs to be marked. Can be NULL.
list_stackUsed to add lists to be marked. Can be NULL.
Returns
true if setting references failed somehow.
bool set_ref_in_list ( list_T l,
int  copyID,
ht_stack_T **  ht_stack 
)

Mark all lists and dicts referenced through list "l" with "copyID".

Parameters
lList content will be marked.
copyIDNew mark for lists and dicts.
ht_stackUsed to add hashtabs to be marked. Can be NULL.
Returns
true if setting references failed somehow.
void set_reg_var ( int  c)
void set_selfdict ( typval_T rettv,
dict_T selfdict 
)
void set_var ( const char *  name,
const size_t  name_len,
typval_T *const  tv,
const bool  copy 
)

Set variable to the given value

If the variable already exists, the value is updated. Otherwise the variable is created.

Parameters
[in]nameVariable name to set.
[in]name_lenLength of the variable name.
tvVariable value.
[in]copyTrue if value in tv is to be copied.
void set_vcount ( long  count,
long  count1,
int  set_prevcount 
)
void set_vim_var_char ( int  c)
void set_vim_var_dict ( const VimVarIndex  idx,
dict_T *const  val 
)

Set Dictionary v: variable to the given dictionary

Parameters
[in]idxIndex of variable to set.
[in,out]valValue to set to. Reference count will be incremented. Also keys of the dictionary will be made read-only.
void set_vim_var_list ( const VimVarIndex  idx,
list_T *const  val 
)

Set list v: variable to the given list

Parameters
[in]idxIndex of variable to set.
[in,out]valValue to set to. Reference count will be incremented.
void set_vim_var_nr ( const VimVarIndex  idx,
const varnumber_T  val 
)

Set number v: variable to the given value

Parameters
[in]idxIndex of variable to set.
[in]valValue to set to.
void set_vim_var_special ( const VimVarIndex  idx,
const SpecialVarValue  val 
)

Set special v: variable to the given value

Parameters
[in]idxIndex of variable to set.
[in]valValue to set to.
void set_vim_var_string ( const VimVarIndex  idx,
const char *const  val,
const ptrdiff_t  len 
)

Set string v: variable to the given string

Parameters
[in]idxIndex of variable to set.
[in]valValue to set to. Will be copied.
[in]lenLegth of that value or -1 in which case strlen() will be used.
void setwinvar ( typval_T argvars,
typval_T rettv,
int  off 
)
int skip_expr ( char_u **  pp)
int store_session_globals ( FILE *  fd)
STRCPY ( name  ,
"000"   
)
size_t string2float ( const char *const  text,
float_T *const  ret_value 
)

Convert the string to a floating point number

This uses strtod(). setlocale(LC_NUMERIC, "C") has been used earlier to make sure this always uses a decimal point.

Parameters
[in]textString to convert.
[out]ret_valueLocation where conversion result is saved.
Returns
Length of the text that was consumed.
switch ( from->  v_type)
void timer_due_cb ( TimeWatcher tw,
void data 
)
uint64_t timer_start ( const long  timeout,
const int  repeat_count,
const Callback *const  callback 
)
void timer_stop ( timer_T timer)
void timer_stop_all ( void  )
void timer_teardown ( void  )
bool translated_function_exists ( const char *  name)
tv_copy ( tv  ,
&vimvars.  vv_tv[VV_VAL] 
)
tv_copy& TV_DICT_HI2DI ( hi  ) -> di_tv, rettv
linenr_T tv_get_lnum_buf ( const typval_T *const  tv,
const buf_T *const  buf 
)

Get the line number from VimL object

Note
Unlike tv_get_lnum(), this one supports only "$" special string.
Parameters
[in]tvObject to get value from. Is expected to be a number or a special string "$".
[in]bufBuffer to take last line number from in case tv is "$". May be NULL, in this case "$" results in zero return.
Returns
Line number or 0 in case of error.
char** tv_to_argv ( typval_T cmd_tv,
const char **  cmd,
bool *  executable 
)

Builds a process argument vector from a VimL object (typval_T).

Parameters
[in]cmd_tvVimL object
[out]cmdReturns the command or executable name.
[out]executableReturns false if argv[0] is not executable.
Returns
Result of shell_build_argv() if cmd_tv is a String. Else, string values of cmd_tv copied to a (char **) list with argv[0] resolved to full path ($PATHEXT-resolved on Windows).
void unref_var_dict ( dict_T dict)
char_u* v_exception ( char_u oldval)
char_u* v_throwpoint ( char_u oldval)
bool valid_varname ( const char *  varname)

Check if a variable name is valid

Parameters
[in]varnameVariable name to check.
Returns
false when variable name is not valid, true when it is. Also gives an error message if appropriate.
pos_T* var2fpos ( const typval_T *const  tv,
const int  dollar_lnum,
int *const  ret_fnum 
)

Translate a VimL object into a position

Accepts VAR_LIST and VAR_STRING objects. Does not give an error for invalid type.

Parameters
[in]tvObject to translate.
[in]dollar_lnumTrue when "$" is last line.
[out]ret_fnumSet to fnum for marks.
Returns
Pointer to position or NULL in case of error (e.g. invalid type).
bool var_check_fixed ( const int  flags,
const char *  name,
size_t  name_len 
)

Check whether variable is fixed (DI_FLAGS_FIX)

Also gives an error message.

Parameters
[in]flagsdi_flags attribute value.
[in]nameVariable name, for use in error message.
[in]name_lenVariable name length. Use TV_TRANSLATE to translate variable name and compute the length. Use TV_CSTRING to compute the length with strlen() without translating.

Both #TV_… values are used for optimization purposes: variable name with its length is needed only in case of error, when no error occurs computing them is a waste of CPU resources. This especially applies to gettext.

Returns
True if variable is fixed, false otherwise.
bool var_check_func_name ( const char *const  name,
const bool  new_var 
)

Check if name is a valid name to assign funcref to

Parameters
[in]namePossible function/funcref name.
[in]new_varTrue if it is a name for a variable.
Returns
false in case of error, true in case of success. Also gives an error message if appropriate.
bool var_check_ro ( const int  flags,
const char *  name,
size_t  name_len 
)

Check whether variable is read-only (DI_FLAGS_RO, DI_FLAGS_RO_SBX)

Also gives an error message.

Parameters
[in]flagsdi_flags attribute value.
[in]nameVariable name, for use in error message.
[in]name_lenVariable name length. Use TV_TRANSLATE to translate variable name and compute the length. Use TV_CSTRING to compute the length with strlen() without translating.

Both #TV_… values are used for optimization purposes: variable name with its length is needed only in case of error, when no error occurs computing them is a waste of CPU resources. This especially applies to gettext.

Returns
True if variable is read-only: either always or in sandbox when sandbox is enabled, false otherwise.
int var_item_copy ( const vimconv_T *const  conv,
typval_T *const  from,
typval_T *const  to,
const bool  deep,
const int  copyID 
)

Make a copy of an item

Lists and Dictionaries are also copied.

Parameters
[in]convIf not NULL, convert all copied strings.
[in]fromValue to copy.
[out]toLocation where to copy to.
[in]deepIf true, use copy the container and all of the contained containers (nested).
[in]copyIDIf non-zero then when container is referenced more then once then copy of it that was already done is used. E.g. when copying list list = [list2, list2] (list[0] is list[1]) var_item_copy with zero copyID will emit a copy with (copy[0] isnot copy[1]), with non-zero it will emit a copy with (copy[0] is copy[1]) like in the original list. Not used when deep is false.
int var_redir_start ( char_u name,
int  append 
)
void var_redir_stop ( void  )
void var_redir_str ( char_u value,
int  value_len 
)
void var_set_global ( const char *const  name,
typval_T  vartv 
)
const void* var_shada_iter ( const void *const  iter,
const char **const  name,
typval_T rettv,
var_flavour_T  flavour 
)

Iterate over global variables

Warning
No modifications to global variable dictionary must be performed while iteration is in progress.
Parameters
[in]iterIterator. Pass NULL to start iteration.
[out]nameVariable name.
[out]rettvVariable value.
Returns
Pointer that needs to be passed to next var_shada_iter invocation or NULL to indicate that iteration is over.
void vars_clear ( hashtab_T ht)
while ( argv_clear  ,
 
)
while ( )
bool write_list ( FileDescriptor *const  fp,
const list_T *const  list,
const bool  binary 
)

Write "list" of strings to file "fd".

Parameters
fpFile to write to.
[in]listList to write.
[in]binaryWhether to write in binary mode.
Returns
true in case of success, false otherwise.
xfree ( tofree  )
xfree ( name  )
xfree ( sourcing_name  )

Variable Documentation

theend __pad0__
long added = 0
int ai
linenr_T append_lnum
if arg
Initial value:
{
if (is_const) {
EMSG(_("E996: Cannot lock an environment variable"));
return NULL;
}
arg++
#define _(x)
Definition: gettext.h:20
return NULL
Definition: eval.c:13033
if arg
Definition: eval.c:1892
#define EMSG(s)
Definition: message.h:40
return arg_end
int argcount = argcount_in
static int typval_T argv
Initial value:
{
Structure that holds an internal variable value.
Definition: typval.h:123
tv_clear & rettv
Definition: eval.c:873
int argv_clear = 0
typval_T* argvars = argvars_in
fc breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0)
proftime_T call_start
const int called_emsg_before = called_emsg
fc caller = current_funccal
buf_T* curbuf_save = NULL
current_funccal = NULL
current_sctx = fp->uf_script_ctx
win_T* curwin_save = NULL
fc dbg_tick = debug_tick
v di_flags = DI_FLAGS_RO | DI_FLAGS_FIX
did_emsg = FALSE
int const int did_emsg_before = did_emsg
bool did_save_redo = false
const bool do_profiling_yes = do_profiling == PROF_YES
* doesrange = false
fc l_avars dv_lock = VAR_FIXED
else
Initial value:
{
char buf[NUMBUFLEN]
char *const buf
Definition: encode.c:231
Definition: vim.h:27
int empty1 = FALSE
int int error = ERROR_NONE
const list_T* eval_msgpack_type_lists[]
Initial value:
= {
[kMPNil] = NULL,
[kMPMap] = NULL,
[kMPExt] = NULL,
}
Definition: eval.h:176
Definition: eval.h:177
Definition: eval.h:181
return NULL
Definition: eval.c:13033
Definition: eval.h:175
Definition: eval.h:178
Definition: eval.h:174
Definition: eval.h:173
Definition: eval.h:180
Definition: eval.h:179

Array mapping values from MessagePackType to corresponding list pointers.

char_u* expr_end
char_u* expr_start
return FAIL
add_nr_var & fc = xmalloc(sizeof(funccall_T))
fc fc_copyID = 0
fc fc_refcount = 0
int fixvar_idx = 0
return fname = fname_trans_sid(name, fname_buf, &tofree, &error)
char_u fname_buf[FLEN_FIXED+1]
ufunc_T* fp
fc func = fp
char_u FUNC_ATTR_WARN_UNUSED_RESULT
Initial value:
{
return NULL
Definition: eval.c:13033
return arg_end
Definition: eval.c:2047
unsigned char char_u
Definition: types.h:11
hashtab_T func_hashtab

Structure used by trans_function_name()

bool func_not_yet_profiling_but_should
Initial value:
=
return NULL
Definition: eval.c:13033
bool has_profiling(bool file, char_u *fname, bool *fp)
Definition: ex_cmds2.c:778
ufunc_T * fp
Definition: eval.c:6289
int uf_profiling
true when func is being profiled
Definition: typval.h:272
char_u uf_name[]
Definition: typval.h:292
const bool do_profiling_yes
Definition: eval.c:12375
bool func_or_func_caller_profiling
Initial value:
=
return NULL
Definition: eval.c:13033
ufunc_T * func
Function being called.
Definition: eval.c:132
ufunc_T * fp
Definition: eval.c:6289
int uf_profiling
true when func is being profiled
Definition: typval.h:272
funccall_T * caller
Calling function or NULL.
Definition: eval.c:148
const bool do_profiling_yes
Definition: eval.c:12375
funccall_T * fc
Definition: eval.c:12149
const void const hashitem_T* hifirst = globvarht.ht_array
const size_t hinum = (size_t) globvarht.ht_mask + 1
hashtab_T* ht
const bool is_curbuf = buf == curbuf
bool islambda = false
list_T* l = NULL
size_t len = get_env_len((const char_u **)&arg)
fc level = ex_nesting_level
void const char* line = NULL
fc linenr = 0
lp ll_name_len = (size_t)((const char *)p - lp->ll_name)
lp ll_tv = &v->di_tv
* name = (char *)arg
return NULL
char_u numbuf[NUMBUFLEN]
return OK
int opt_flags
while p
Initial value:
= (char_u *)find_name_end(name,
(const char_u **)&expr_start,
(const char_u **)&expr_end,
fne_flags)
char_u * expr_end
Definition: eval.c:2100
char * name
Definition: eval.c:1899
unsigned char char_u
Definition: types.h:11
char_u * expr_start
Definition: eval.c:2099
funccall_T* previous_funccal = NULL
int quiet = flags & GLV_QUIET
recurse
RedrawingDisabled
* remp = (tv_get_number_chk(&rettv, &error) == 0)
return ret = eval1(arg, rettv, evaluate)
fc rettv = rettv
fc returned = FALSE
return retval = FAIL
const sctx_T save_current_sctx = current_sctx
save_did_emsg = did_emsg
save_redo_T save_redo
save_sourcing_lnum
Initial value:
{
unsigned char char_u
Definition: types.h:11
save_sourcing_name
Definition: eval.c:12305
save_sourcing_name = sourcing_name
dict_T* selfdict = selfdict_in
sourcing_lnum = 1
sourcing_name = xmalloc(len)
int started_profiling = false
char_u * tofree = NULL
fp uf_calls
bool using_sandbox = false
Initial value:
= find_var(lp->ll_name, lp->ll_name_len,
(flags & GLV_READ_ONLY) ? NULL : &ht,
flags & GLV_NO_AUTOLOAD)
Definition: eval.h:206
Do not use script autoloading.
Definition: eval.h:205
dictitem_T * find_var(const char *const name, const size_t name_len, hashtab_T **htp, int no_autoload)
Definition: eval.c:9498
return NULL
Definition: eval.c:13033
hashtab_T * ht
Definition: eval.c:2085
v di_tv vval v_list = &fc->l_varlist
v di_tv v_lock = VAR_FIXED
rettv vval v_number = 0
v di_tv v_type = VAR_UNKNOWN
tv_clear & var1
Initial value:
{
Definition: coverity-model.c:39
v
Definition: eval.c:2141
typval_T var2
proftime_T wait_start